@jxsuite/compiler 9.0.1 → 9.1.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.js CHANGED
@@ -1,70 +1,70 @@
1
1
  #!/usr/bin/env node
2
- import{createRequire as fR}from"node:module";var oR=Object.create;var{getPrototypeOf:iR,defineProperty:Ng,getOwnPropertyNames:aR}=Object;var Tg=Object.prototype.hasOwnProperty;function cR(e){return this[e]}var lR,uR,Jr=(e,t,n)=>{var r=e!=null&&typeof e==="object";if(r){var s=t?lR??=new WeakMap:uR??=new WeakMap,o=s.get(e);if(o)return o}n=e!=null?oR(iR(e)):{};let i=t||!e||!e.__esModule||!Tg.call(e,"default")?Ng(n,"default",{value:e,enumerable:!0}):n;if(e&&typeof e==="object"||typeof e==="function"){for(let a of aR(e))if(!Tg.call(i,a))Ng(i,a,{get:cR.bind(e,a),enumerable:!0})}if(r)s.set(e,i);return i};var W=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var T=(e,t,n)=>()=>{if(e)try{t=e(e=0)}catch(r){n=[r]}if(n)throw n[0];return t};var it=fR(import.meta.url);function k(e){return typeof e==="string"}function St(e){return typeof e==="number"}function Mt(e){return typeof e==="boolean"}function At(e){return typeof e==="function"}function D(e){return typeof e==="object"&&e!==null}function V(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Ne(e){return V(e)&&typeof e.$ref==="string"}function jt(e){return V(e)&&e.$prototype==="Function"}function yn(e){return V(e)&&V(e.$expression)}function Ir(e){return yn(e)&&Array.isArray(e.parameters)&&e.parameters.length>0}function sr(e){return jt(e)&&Array.isArray(e.body)}function _n(e){return V(e)&&typeof e.$prototype==="string"&&e.$prototype!=="Function"}function Mr(e){return V(e)&&e.timing==="server"&&typeof e.$src==="string"&&typeof e.$export==="string"&&!e.$prototype}function Mg(e){return V(e)&&!e.$prototype&&!e.$expression&&"default"in e}function rs(e){if(!V(e))return!1;for(let t of Object.keys(e))if(!Dg.has(t))return!1;return!0}function at(e){return V(e)&&e.$prototype==="Array"}function ed(e){return(Array.isArray(e)?e:[e]).some((n)=>at(n))}function Fg(e){return V(e)&&e.$prototype==="Class"}function nn(e){return V(e)}function me(e){return typeof e==="string"&&e.includes("${")}function Lg(e){return/\breturn\b[^\S\n]*(?![;}\s]|$)/.test(to(e))}function td(e){return e.$prototype==="Function"||k(e.role)&&e.role!=="field"}function to(e){if(!/[/'"`]/u.test(e))return e;let t=Mc.get(e);if(t!==void 0)return t;let n=Wg(e);if(Mc.size>=Vg)Mc.clear();return Mc.set(e,n),n}function qg(e){if(!e.includes("${"))return dR;let t=Dc.get(e);if(t!==void 0)return t;let n=[],r=0;while(r<e.length){let s=[];Wg(e.slice(r),s);let o=-1;for(let a=0;a<s.length;a+=2){let c=r+(s[a]??0),l=s[a+1]??-1;if(l===-1){o=c;break}n.push(Jg(e,c,r+l))}if(o===-1)break;let i=pR(e,o);if(i===-1)r=o+2;else n.push(Jg(e,o,i)),r=i}if(Dc.size>=Vg)Dc.clear();return Dc.set(e,n),n}function Jg(e,t,n){return{end:n,expr:e.slice(t+2,n-1),start:t}}function pR(e,t){let n=0;for(let r=t+1;r<e.length;r+=1){let s=e.charAt(r);if(s==="{")n+=1;else if(s==="}"){if(n-=1,n===0)return r+1}}return-1}function hR(e,t,n){return(t==="+"||t==="-")&&e.charAt(n-1)===t}function Ig(e,t){let n=!1;for(let r=t+1;r<e.length;r+=1){let s=e.charAt(r);if(s===`
3
- `)return-1;if(s==="\\")r+=1;else if(s==="[")n=!0;else if(s==="]")n=!1;else if(s==="/"&&!n)return r+1}return-1}function Wg(e,t){let n=e.split(""),r=(l)=>{if(n[l]!==void 0&&n[l]!==`
2
+ import{createRequire as hR}from"node:module";var lR=Object.create;var{getPrototypeOf:uR,defineProperty:Cx,getOwnPropertyNames:fR}=Object;var Rx=Object.prototype.hasOwnProperty;function dR(e){return this[e]}var pR,mR,ar=(e,t,n)=>{var r=e!=null&&typeof e==="object";if(r){var s=t?pR??=new WeakMap:mR??=new WeakMap,o=s.get(e);if(o)return o}n=e!=null?lR(uR(e)):{};let i=t||!e||!e.__esModule||!Rx.call(e,"default")?Cx(n,"default",{value:e,enumerable:!0}):n;if(e&&typeof e==="object"||typeof e==="function"){for(let a of fR(e))if(!Rx.call(i,a))Cx(i,a,{get:dR.bind(e,a),enumerable:!0})}if(r)s.set(e,i);return i};var q=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var R=(e,t,n)=>()=>{if(e)try{t=e(e=0)}catch(r){n=[r]}if(n)throw n[0];return t};var it=hR(import.meta.url);function k(e){return typeof e==="string"}function We(e){return typeof e==="number"}function bt(e){return typeof e==="boolean"}function _t(e){return typeof e==="function"}function I(e){return typeof e==="object"&&e!==null}function L(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Ce(e){return L(e)&&typeof e.$ref==="string"}function kt(e){return L(e)&&e.$prototype==="Function"}function gn(e){return L(e)&&L(e.$expression)}function Dr(e){return gn(e)&&Array.isArray(e.parameters)&&e.parameters.length>0}function cr(e){return kt(e)&&Array.isArray(e.body)}function yn(e){return L(e)&&typeof e.$prototype==="string"&&e.$prototype!=="Function"}function Mr(e){return L(e)&&e.timing==="server"&&typeof e.$src==="string"&&typeof e.$export==="string"&&!e.$prototype}function Jx(e){return L(e)&&!e.$prototype&&!e.$expression&&"default"in e}function os(e){if(!L(e))return!1;for(let t of Object.keys(e))if(!Ix.has(t))return!1;return!0}function nt(e){return L(e)&&e.$prototype==="Array"}function Dx(e){return(Array.isArray(e)?e:[e]).some((n)=>nt(n))}function Mx(e){return L(e)&&e.$prototype==="Class"}function tn(e){return L(e)}function me(e){return typeof e==="string"&&e.includes("${")}function Fx(e){return/\breturn\b[^\S\n]*(?![;}\s]|$)/.test(ro(e))}function _d(e){return e.$prototype==="Function"||k(e.role)&&e.role!=="field"}function ro(e){if(!/[/'"`]/u.test(e))return e;let t=Gc.get(e);if(t!==void 0)return t;let n=qx(e);if(Gc.size>=Lx)Gc.clear();return Gc.set(e,n),n}function Vx(e){if(!e.includes("${"))return gR;let t=Xc.get(e);if(t!==void 0)return t;let n=[],r=0;while(r<e.length){let s=[];qx(e.slice(r),s);let o=-1;for(let a=0;a<s.length;a+=2){let c=r+(s[a]??0),l=s[a+1]??-1;if(l===-1){o=c;break}n.push(Nx(e,c,r+l))}if(o===-1)break;let i=yR(e,o);if(i===-1)r=o+2;else n.push(Nx(e,o,i)),r=i}if(Xc.size>=Lx)Xc.clear();return Xc.set(e,n),n}function Nx(e,t,n){return{end:n,expr:e.slice(t+2,n-1),start:t}}function yR(e,t){let n=0;for(let r=t+1;r<e.length;r+=1){let s=e.charAt(r);if(s==="{")n+=1;else if(s==="}"){if(n-=1,n===0)return r+1}}return-1}function bR(e,t,n){return(t==="+"||t==="-")&&e.charAt(n-1)===t}function Tx(e,t){let n=!1;for(let r=t+1;r<e.length;r+=1){let s=e.charAt(r);if(s===`
3
+ `)return-1;if(s==="\\")r+=1;else if(s==="[")n=!0;else if(s==="]")n=!1;else if(s==="/"&&!n)return r+1}return-1}function qx(e,t){let n=e.split(""),r=(l)=>{if(n[l]!==void 0&&n[l]!==`
4
4
  `)n[l]=" "},s=[],o=t!==void 0,i="",a=-1,c=0;while(c<e.length){let l=e.charAt(c);if(o)if(l==="\\")r(c),r(c+1),c+=2;else if(l==="`"&&!(t&&s.length===0))o=!1,i=l,c+=1;else if(l==="$"&&e.charAt(c+1)==="{"){if(s.length===0)t?.push(c,-1);s.push(0),o=!1,i="{",c+=2}else r(c),c+=1;else if(l==="/"&&e.charAt(c+1)==="/")while(c<e.length&&e.charAt(c)!==`
5
5
  `)r(c),c+=1;else if(l==="/"&&e.charAt(c+1)==="*"){let u=e.indexOf("*/",c+2),d=u===-1?e.length:u+2;for(;c<d;c+=1)r(c)}else if(l==="'"||l==='"'){c+=1;while(c<e.length&&e.charAt(c)!==l&&e.charAt(c)!==`
6
- `){if(e.charAt(c)==="\\")r(c),c+=1;r(c),c+=1}i=l,c+=1}else if(l==="`")o=!0,c+=1;else if(t&&l==="/"&&mR.has(i)&&!hR(e,i,a)&&Ig(e,c)>0){let u=Ig(e,c);for(c+=1;c<u-1;c+=1)r(c);i="/",c=u}else{let u=s.length-1;if(u>=0&&l==="{")s[u]=(s[u]??0)+1;else if(u>=0&&l==="}")if(s[u]===0){if(s.pop(),o=!0,t&&s.length===0)t[t.length-1]=c+1}else s[u]=(s[u]??1)-1;if(l.trim()!=="")i=l,a=c;c+=1}}return n.join("")}function no(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Fc(e){if(!e)return[];return e.map((t)=>k(t)?t:t.name)}function gR(e){return typeof e==="string"}function or(e){if(typeof e!=="object"||e===null||Array.isArray(e)||!V(e.$expression))return!1;let t=e.$expression;if(t.operator==="?:")return typeof t.value==="string"&&typeof t.initial==="string";if(t.operator==="switch")return V(t.cases)&&Object.values(t.cases).every((n)=>k(n))&&typeof t.default==="string";return!1}function Ho(e){if(gR(e))return[e];if(!or(e))return[];let t=e.$expression;if(t.operator==="?:")return[...new Set([t.value,t.initial])];return[...new Set([...Object.values(t.cases),t.default])]}var Dg,Mc,Vg=2048,dR,Dc,mR;var le=T(()=>{Dg=new Set(["type","enum","minimum","maximum","minLength","maxLength","pattern","format","items","properties","required","description","title","$comment"]);Mc=new Map;dR=[],Dc=new Map;mR=new Set("(,=:[!&|?{;+-*%<>~^")});function Ug(e){let t=[],n=[],r=null,s=0,o=()=>n.at(-1)?.path??"",i=()=>r===null?o():bR(o(),r),a=()=>{s+=1;let c="";while(s<e.length){let l=e[s];if(l==="\\"){let u=e[s+1]??"";if(u==="u")c+=String.fromCodePoint(Number.parseInt(e.slice(s+2,s+6),16)),s+=6;else c+=yR.get(u)??u,s+=2;continue}if(l==='"')return s+=1,c;c+=l,s+=1}return c};while(s<e.length){let c=e[s];if(Hg.has(c)||c===","||c===":"){s+=1;continue}if(c==="{"||c==="["){n.push(c==="{"?{keys:new Set,kind:"object",path:i()}:{kind:"array",path:i()}),r=null,s+=1;continue}if(c==="}"||c==="]"){n.pop(),r=null,s+=1;continue}if(c==='"'){let u=a(),d=n.at(-1);if(d?.kind==="object"&&xR(e,s)===":"){if(d.keys.has(u))t.push({detail:u,kind:"duplicate-key",path:d.path});d.keys.add(u),r=u}else r=null;continue}if(c==="-"||c>="0"&&c<="9"){let u=s;while(s<e.length&&/[\d+.eE-]/.test(e[s]))s+=1;let d=e.slice(u,s);if(!$R(d))t.push({detail:d,kind:"unsafe-number",path:i()});r=null;continue}let l=s;while(s<e.length&&/[A-Za-z]/.test(e[s]))s+=1;if(s===l)s+=1;r=null}return t}function xR(e,t){let n=t;while(n<e.length&&Hg.has(e[n]))n+=1;return e[n]??""}function bR(e,t){return e===""?t:`${e}.${t}`}function $R(e){if(/[.eE]/.test(e))return!0;let t=Number(e);if(!Number.isFinite(t))return!1;return String(t)===e.replace(/^\+/,"")}function Bg(e){let t=e.path===""?"the document root":`"${e.path}"`;return e.kind==="duplicate-key"?`duplicate key "${e.detail}" in ${t} — JSON.parse keeps the last one and `+"silently discards the first (RFC 7493 §2.3)":`number ${e.detail} in ${t} cannot be represented exactly and will change when `+"the document is written back (RFC 7493 §2.2)"}var Hg,yR;var zg=T(()=>{Hg=new Set([" ","\t",`
7
- `,"\r"]);yR=new Map([["b","\b"],["f","\f"],["n",`
8
- `],["r","\r"],["t","\t"]])});function $e(e){return e instanceof Error?e.message:String(e)}function Gg(e){if(k(e))return Kg.test(e)?e.normalize("NFC"):e;if(Array.isArray(e))return e.map((t)=>Gg(t));if(V(e))return Uo(e);return e}function Uo(e){let t={};for(let[n,r]of Object.entries(e))t[Kg.test(n)?n.normalize("NFC"):n]=Gg(r);return t}function nd(e,t,n){let r;try{r=JSON.parse(e)}catch(o){throw Error(`Failed to parse ${n} at ${t}: ${$e(o)}`,{cause:o})}if(!V(r))throw Error(`Invalid ${n} at ${t}: expected a JSON object`);let s=Ug(e);if(s.length>0){let o=s.map((i)=>Bg(i)).join("; ");throw Error(`Invalid ${n} at ${t}: ${o}`)}return Uo(r)}function Xg(e,t){return nd(e,t,"Jx document")}function Yg(e,t){return nd(e,t,"project config")}function Zg(e,t){return nd(e,t,"class definition")}var Kg;var Dt=T(()=>{le();zg();Kg=/[^\p{ASCII}]/u});import{spawn as wR}from"node:child_process";import{createRequire as SR}from"node:module";import{join as vR}from"node:path";function Qg(e,t){try{return SR(vR(e,"package.json")).resolve(`@jxsuite/server/${t}`)}catch{throw Error(`@jxsuite/server is not installed in ${e}. Add it to devDependencies (e.g. \`bun add -d @jxsuite/server\`) and retry.`)}}function Lc(e,t,n,r=wR,s=process){let o=Qg(t,e),i=r("bun",[o,"--root",t,...n],{stdio:"inherit"});return i.on("error",(a)=>{console.error(a.code==="ENOENT"?`jx ${e} runs on Bun, which was not found on your PATH. Install it from https://bun.sh and retry.`:`Failed to start jx ${e}: ${a.message}`),s.exitCode=1}),i.on("exit",(a)=>{s.exitCode=a??0}),i}var rd=()=>{};import{spawn as ER}from"node:child_process";function ey(e,t,n=ER,r=process){return Lc("convert",e,t,n,r)}var ty=T(()=>{rd()});import{spawn as jR}from"node:child_process";function ny(e,t,n=jR,r=process){return Lc("format",e,t,n,r)}var ry=T(()=>{rd()});function PR(e){return JSON.parse(e)}function Bo(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function _R(e){return Bo(e)&&typeof e.binding==="string"}function kR(e){try{let t=PR(e);return Bo(t)?t:void 0}catch{return}}function sy(e,t){if(t.length===0)return{content:e??"",patched:!1};let n={};if(e){let r=kR(e);if(r===void 0)return{content:e,patched:!1};n=r}for(let r of t)oy(n,r);return{content:`${JSON.stringify(n,null,"\t")}
9
- `,patched:!0}}function oy(e,t){for(let[n,r]of Object.entries(t)){let s=n in e?e[n]:void 0;if(Array.isArray(r)){e[n]=OR(Array.isArray(s)?s:[],r);continue}if(Bo(r)){if(Bo(s))oy(s,r);else if(s===void 0)e[n]=structuredClone(r);continue}if(s===void 0)e[n]=r}}function OR(e,t){let n=[...e];for(let r of t){if(!_R(r)){if(!n.some((a)=>JSON.stringify(a)===JSON.stringify(r)))n.push(structuredClone(r));continue}let s=n.findIndex((i)=>Bo(i)&&i.binding===r.binding),o=n[s];if(Bo(o))n[s]={...o,...r};else n.push(structuredClone(r))}return n}var iy=()=>{};function uy(e){if(!k(e))return null;let[t,...n]=e.split(";"),r=(t??"").indexOf("/");if(r===-1)return null;let s=(t??"").slice(0,r).trim().toLowerCase(),o=(t??"").slice(r+1).trim().toLowerCase();if(!ay.test(s)||!ay.test(o))return null;let i=o.lastIndexOf("+"),a=i===-1?null:o.slice(i+1),c=i===-1?o:o.slice(0,i);if(a==="")return null;let l=c.indexOf("."),u=l===-1?null:c.slice(0,l),d=u!==null&&AR.has(u)?u:null,p=d===null?c:c.slice(d.length+1);if(p==="")return null;let m={};for(let x of n){let h=x.indexOf("=");if(h===-1)return null;let g=x.slice(0,h).trim().toLowerCase(),b=x.slice(h+1).trim();if(g==="")return null;if(b.startsWith('"')&&b.endsWith('"')&&b.length>=2)b=b.slice(1,-1);m[g]=b}return{parameters:m,subtype:p,suffix:a,tree:d,type:s}}function fy(e){if(!k(e)||e.trim()==="")return"expected a media type string";if(!e.includes("/"))return`"${e}" has no "/" — a media type is type/subtype (RFC 6838 §4.2)`;if(uy(e)===null)return`"${e}" is not a well-formed media type (RFC 6838 §4.2)`;return null}function dy(e){let t=uy(e);if(t===null)return null;let n=t.tree===null?"":`${t.tree}.`,r=t.suffix===null?"":`+${t.suffix}`;return`${t.type}/${n}${t.subtype}${r}`}var ay,AR,cy="text/markdown; variant=GFM",ly="application/yaml",py;var sd=T(()=>{le();ay=/^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}$/,AR=new Set(["vnd","prs","x"]);py={".jxn":"text/plain; charset=utf-8",".markdown":`${cy}; charset=utf-8`,".md":`${cy}; charset=utf-8`,".yaml":`${ly}; charset=utf-8`,".yml":`${ly}; charset=utf-8`}});class my{index;text;constructor(e){this.text=e,this.index=e.codePointAt(0)===65279?1:0}get done(){return this.index>=this.text.length}startsWith(e){return this.text.startsWith(e,this.index)}skipLine(){let e=this.text.indexOf(`
6
+ `){if(e.charAt(c)==="\\")r(c),c+=1;r(c),c+=1}i=l,c+=1}else if(l==="`")o=!0,c+=1;else if(t&&l==="/"&&xR.has(i)&&!bR(e,i,a)&&Tx(e,c)>0){let u=Tx(e,c);for(c+=1;c<u-1;c+=1)r(c);i="/",c=u}else{let u=s.length-1;if(u>=0&&l==="{")s[u]=(s[u]??0)+1;else if(u>=0&&l==="}")if(s[u]===0){if(s.pop(),o=!0,t&&s.length===0)t[t.length-1]=c+1}else s[u]=(s[u]??1)-1;if(l.trim()!=="")i=l,a=c;c+=1}}return n.join("")}function so(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Yc(e){if(!e)return[];return e.map((t)=>k(t)?t:t.name)}function $R(e){return typeof e==="string"}function lr(e){if(typeof e!=="object"||e===null||Array.isArray(e)||!L(e.$expression))return!1;let t=e.$expression;if(t.operator==="?:")return typeof t.value==="string"&&typeof t.initial==="string";if(t.operator==="switch")return L(t.cases)&&Object.values(t.cases).every((n)=>k(n))&&typeof t.default==="string";return!1}function xa(e){if($R(e))return[e];if(!lr(e))return[];let t=e.$expression;if(t.operator==="?:")return[...new Set([t.value,t.initial])];return[...new Set([...Object.values(t.cases),t.default])]}function kd(e){return e.startsWith("#")}var Ix,Gc,Lx=2048,gR,Xc,xR;var le=R(()=>{Ix=new Set(["type","enum","minimum","maximum","minLength","maxLength","pattern","format","items","properties","required","description","title","$comment"]);Gc=new Map;gR=[],Xc=new Map;xR=new Set("(,=:[!&|?{;+-*%<>~^")});function Hx(e){let t=[],n=[],r=null,s=0,o=()=>n.at(-1)?.path??"",i=()=>r===null?o():vR(o(),r),a=()=>{s+=1;let c="";while(s<e.length){let l=e[s];if(l==="\\"){let u=e[s+1]??"";if(u==="u")c+=String.fromCodePoint(Number.parseInt(e.slice(s+2,s+6),16)),s+=6;else c+=SR.get(u)??u,s+=2;continue}if(l==='"')return s+=1,c;c+=l,s+=1}return c};while(s<e.length){let c=e[s];if(Wx.has(c)||c===","||c===":"){s+=1;continue}if(c==="{"||c==="["){n.push(c==="{"?{keys:new Set,kind:"object",path:i()}:{kind:"array",path:i()}),r=null,s+=1;continue}if(c==="}"||c==="]"){n.pop(),r=null,s+=1;continue}if(c==='"'){let u=a(),d=n.at(-1);if(d?.kind==="object"&&wR(e,s)===":"){if(d.keys.has(u))t.push({detail:u,kind:"duplicate-key",path:d.path});d.keys.add(u),r=u}else r=null;continue}if(c==="-"||c>="0"&&c<="9"){let u=s;while(s<e.length&&/[\d+.eE-]/.test(e[s]))s+=1;let d=e.slice(u,s);if(!ER(d))t.push({detail:d,kind:"unsafe-number",path:i()});r=null;continue}let l=s;while(s<e.length&&/[A-Za-z]/.test(e[s]))s+=1;if(s===l)s+=1;r=null}return t}function wR(e,t){let n=t;while(n<e.length&&Wx.has(e[n]))n+=1;return e[n]??""}function vR(e,t){return e===""?t:`${e}.${t}`}function ER(e){if(/[.eE]/.test(e))return!0;let t=Number(e);if(!Number.isFinite(t))return!1;return String(t)===e.replace(/^\+/,"")}function Ux(e){let t=e.path===""?"the document root":`"${e.path}"`;return e.kind==="duplicate-key"?`duplicate key "${e.detail}" in ${t} — JSON.parse keeps the last one and `+"silently discards the first (RFC 7493 §2.3)":`number ${e.detail} in ${t} cannot be represented exactly and will change when `+"the document is written back (RFC 7493 §2.2)"}var Wx,SR;var Bx=R(()=>{Wx=new Set([" ","\t",`
7
+ `,"\r"]);SR=new Map([["b","\b"],["f","\f"],["n",`
8
+ `],["r","\r"],["t","\t"]])});function ge(e){return e instanceof Error?e.message:String(e)}function Kx(e){if(k(e))return zx.test(e)?e.normalize("NFC"):e;if(Array.isArray(e))return e.map((t)=>Kx(t));if(L(e))return Vo(e);return e}function Vo(e){let t={};for(let[n,r]of Object.entries(e))t[zx.test(n)?n.normalize("NFC"):n]=Kx(r);return t}function Od(e,t,n){let r;try{r=JSON.parse(e)}catch(o){throw Error(`Failed to parse ${n} at ${t}: ${ge(o)}`,{cause:o})}if(!L(r))throw Error(`Invalid ${n} at ${t}: expected a JSON object`);let s=Hx(e);if(s.length>0){let o=s.map((i)=>Ux(i)).join("; ");throw Error(`Invalid ${n} at ${t}: ${o}`)}return Vo(r)}function Gx(e,t){return Od(e,t,"Jx document")}function Xx(e,t){return Od(e,t,"project config")}function Yx(e,t){return Od(e,t,"class definition")}var zx;var Rt=R(()=>{le();Bx();zx=/[^\p{ASCII}]/u});import{spawn as jR}from"node:child_process";import{createRequire as PR}from"node:module";import{join as _R}from"node:path";function Zx(e,t){try{return PR(_R(e,"package.json")).resolve(`@jxsuite/server/${t}`)}catch{throw Error(`@jxsuite/server is not installed in ${e}. Add it to devDependencies (e.g. \`bun add -d @jxsuite/server\`) and retry.`)}}function Zc(e,t,n,r=jR,s=process){let o=Zx(t,e),i=r("bun",[o,"--root",t,...n],{stdio:"inherit"});return i.on("error",(a)=>{console.error(a.code==="ENOENT"?`jx ${e} runs on Bun, which was not found on your PATH. Install it from https://bun.sh and retry.`:`Failed to start jx ${e}: ${a.message}`),s.exitCode=1}),i.on("exit",(a)=>{s.exitCode=a??0}),i}var Ad=()=>{};import{spawn as kR}from"node:child_process";function Qx(e,t,n=kR,r=process){return Zc("convert",e,t,n,r)}var eb=R(()=>{Ad()});import{spawn as OR}from"node:child_process";function tb(e,t,n=OR,r=process){return Zc("format",e,t,n,r)}var nb=R(()=>{Ad()});function AR(e){return JSON.parse(e)}function qo(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function CR(e){return qo(e)&&typeof e.binding==="string"}function RR(e){try{let t=AR(e);return qo(t)?t:void 0}catch{return}}function rb(e,t){if(t.length===0)return{content:e??"",patched:!1};let n={};if(e){let r=RR(e);if(r===void 0)return{content:e,patched:!1};n=r}for(let r of t)sb(n,r);return{content:`${JSON.stringify(n,null,"\t")}
9
+ `,patched:!0}}function sb(e,t){for(let[n,r]of Object.entries(t)){let s=n in e?e[n]:void 0;if(Array.isArray(r)){e[n]=NR(Array.isArray(s)?s:[],r);continue}if(qo(r)){if(qo(s))sb(s,r);else if(s===void 0)e[n]=structuredClone(r);continue}if(s===void 0)e[n]=r}}function NR(e,t){let n=[...e];for(let r of t){if(!CR(r)){if(!n.some((a)=>JSON.stringify(a)===JSON.stringify(r)))n.push(structuredClone(r));continue}let s=n.findIndex((i)=>qo(i)&&i.binding===r.binding),o=n[s];if(qo(o))n[s]={...o,...r};else n.push(structuredClone(r))}return n}var ob=()=>{};function lb(e){if(!k(e))return null;let[t,...n]=e.split(";"),r=(t??"").indexOf("/");if(r===-1)return null;let s=(t??"").slice(0,r).trim().toLowerCase(),o=(t??"").slice(r+1).trim().toLowerCase();if(!ib.test(s)||!ib.test(o))return null;let i=o.lastIndexOf("+"),a=i===-1?null:o.slice(i+1),c=i===-1?o:o.slice(0,i);if(a==="")return null;let l=c.indexOf("."),u=l===-1?null:c.slice(0,l),d=u!==null&&TR.has(u)?u:null,p=d===null?c:c.slice(d.length+1);if(p==="")return null;let m={};for(let x of n){let g=x.indexOf("=");if(g===-1)return null;let y=x.slice(0,g).trim().toLowerCase(),S=x.slice(g+1).trim();if(y==="")return null;if(S.startsWith('"')&&S.endsWith('"')&&S.length>=2)S=S.slice(1,-1);m[y]=S}return{parameters:m,subtype:p,suffix:a,tree:d,type:s}}function ub(e){if(!k(e)||e.trim()==="")return"expected a media type string";if(!e.includes("/"))return`"${e}" has no "/" — a media type is type/subtype (RFC 6838 §4.2)`;if(lb(e)===null)return`"${e}" is not a well-formed media type (RFC 6838 §4.2)`;return null}function fb(e){let t=lb(e);if(t===null)return null;let n=t.tree===null?"":`${t.tree}.`,r=t.suffix===null?"":`+${t.suffix}`;return`${t.type}/${n}${t.subtype}${r}`}var ib,TR,ab="text/markdown; variant=GFM",cb="application/yaml",db;var Cd=R(()=>{le();ib=/^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}$/,TR=new Set(["vnd","prs","x"]);db={".jxn":"text/plain; charset=utf-8",".markdown":`${ab}; charset=utf-8`,".md":`${ab}; charset=utf-8`,".yaml":`${cb}; charset=utf-8`,".yml":`${cb}; charset=utf-8`}});class pb{index;text;constructor(e){this.text=e,this.index=e.codePointAt(0)===65279?1:0}get done(){return this.index>=this.text.length}startsWith(e){return this.text.startsWith(e,this.index)}skipLine(){let e=this.text.indexOf(`
10
10
  `,this.index);this.index=e===-1?this.text.length:e}skipBlock(){let e=1;this.index+=2;while(!this.done&&e>0)if(this.startsWith("/*"))e+=1,this.index+=2;else if(this.startsWith("*/"))e-=1,this.index+=2;else this.index+=1}skipTrivia(){for(;;){while(!this.done&&/[\s;]/u.test(this.text.charAt(this.index)))this.index+=1;if(this.startsWith("//"))this.skipLine();else if(this.startsWith("/*"))this.skipBlock();else if(this.startsWith("/-"))this.index+=2,this.skipNode();else return}}skipString(){let e=0,t=this.index;while(this.text.charAt(t)==="#")e+=1,t+=1;let n=this.text.startsWith('"""',t),r=n?'"""':'"',s=r+"#".repeat(e);t+=r.length;while(t<this.text.length)if(e===0&&this.text.charAt(t)==="\\")t+=2;else if(this.text.startsWith(s,t))return this.index=t+s.length,!0;else if(!n&&this.text.charAt(t)===`
11
11
  `)return!1;else t+=1;return!1}skipNode(){let e=0;while(!this.done){let t=this.text.charAt(this.index);if(t==='"'||t==="#"&&/^#+"/u.test(this.text.slice(this.index,this.index+16))){if(!this.skipString())return!1}else if(this.startsWith("//"))this.skipLine();else if(this.startsWith("/*"))this.skipBlock();else if(t==="{")e+=1,this.index+=1;else if(t==="}"){if(e===0)return!1;e-=1,this.index+=1}else if((t===`
12
- `||t===";")&&e===0)return this.index+=1,!0;else this.index+=1}return e===0}}function zo(e){if(RR.test(e))return"unreadable";let t=new my(e);for(;;){if(t.skipTrivia(),t.done)return"document";if(t.startsWith("(")){let n=e.indexOf(")",t.index);if(n===-1)return"unreadable";t.index=n+1}else{let[n]=CR.exec(e.slice(t.index,t.index+256))??[];if(!n)return t.startsWith('"')||t.startsWith("#")?"document":"unreadable";if(!n.startsWith("$"))return n==="project"?"project":"document";if(t.index+=n.length,!t.skipNode())return"unreadable"}}}var RR,CR;var Sa=T(()=>{RR=/\0/u,CR=/^[^\s\\/(){};[\]"#=]+/u});function ja(e){switch(e){case 9:case 32:case 160:case 5760:case 8192:case 8193:case 8194:case 8195:case 8196:case 8197:case 8198:case 8199:case 8200:case 8201:case 8202:case 8239:case 8287:case 12288:return!0}return!1}function as(e){return e===13||e===10||e===133||e===11||e===12||e===8232||e===8233||!1}function Yc(e){return e<8||e>=14&&e<=25||e===127||e>=55296&&e<=57343||e>1114111||e===8206||e===8207||e>=8234&&e<=8238||e>=8294&&e<=8297||e===65279}function ze(e){return!isNaN(e)&&!ja(e)&&!as(e)&&e!==61&&e!==92&&e!==47&&e!==40&&e!==41&&e!==123&&e!==125&&e!==59&&e!==91&&e!==93&&e!==34&&e!==35&&!0}function hy(e){return e>=65&&e<91||e>=97&&e<123||!1}function od(e){return e>=48&&e<64||e>=65&&e<71||e>=97&&e<103||!1}function id(e){return od(e)||e===95}function Fr(e){return e>=48&&e<58}function io(e){return Fr(e)||e===95}function ad(e){return e>=48&&e<56}function gy(e){return ad(e)||e===95}function cd(e){return e===48||e===49}function yy(e){return cd(e)||e===95}function xy(e){return e===45||e===43}var ss=1,Ko=2,ro=3,Vc=4,qc=5,va=6,Wc=7,Hc=8,Ea=9,os=10,Ft=11,Go=12,Xo=13,Uc=14,Dr=15,Bc=16,zc=17,so=18,is=19,Kc=20,Gc=21,Xc=22,Yo=23,oo=24,ir=28;function*TR(e){for(let t of(NR??=new Intl.Segmenter("en")).segment(e))yield t.segment}function JR(e){return e[Symbol.iterator]()}function by(e,{flags:t,graphemeLocations:n=!1}){let r=n?TR(e):JR(e),s=r.next();return{text:e,graphemeLocations:n,line:1,column:1,offset:0,length:e.length,iterator:r,currentIter:s,current:s.done?NaN:s.value.codePointAt(0),start:{line:1,column:1,offset:0},errorsInToken:null,flags:t}}function*$y(e){if(Ae(e,65279))e.column=1,yield Se(e,Ko);if(Yc(e.current))throw ar(e,`Invalid character \\u${e.current.toString(16)}`)}function mt(e){e.offset+=e.currentIter.value.length,e.column++;let t=e.currentIter=e.iterator.next(),n=e.current=t.done?NaN:t.value.codePointAt(0);if(Yc(n))if(n>=55296&&n<=57343||n>1114111)Pa(e,`Invalid character \\u${n.toString(16)}`);else Pa(e,`Invalid character \\u${n.toString(16)}, this character is not allowed but can be included in strings as \\u{${n.toString(16)}}`);return n}function Hn(e,t){if(t(e.current)){let n=e.current;return mt(e),n}}function Ae(e,t){if(e.current===t)return mt(e),t}function Zo(e){if(!as(e.current))return!1;if(!e.graphemeLocations&&e.current===13&&e.text.codePointAt(e.offset+1)===10)e.iterator.next(),e.offset++;return mt(e),e.column=1,e.line++,!0}function ld(e,t){while(e.current===t)mt(e)}function Ve(e,t){while(t(e.current))mt(e)}function Se(e,t,n){let{line:r,column:s,offset:o}=e,i={line:r,column:s,offset:o},a=e.start;e.start=i;let c=e.errorsInToken;e.errorsInToken=null;let l={type:t,text:e.text.slice(a.offset,i.offset),start:a,end:i,errors:c};if(n){if(!l.errors)l.errors=[];l.errors.push(new Re(n,{token:l}))}return l}function ar(e,t){if(t instanceof Re)return t;let{line:n,column:r,offset:s}=e,o={line:n,column:r,offset:s},i;if(s<e.length)if(as(e.current))i={line:n+1,column:1,offset:s+1};else i={line:n,column:r+1,offset:s+1};return new Re(`${t}`,{start:o,end:i})}function Pa(e,t){(e.errorsInToken??=[]).push(ar(e,t))}var NR;var wy=T(()=>{ao()});function co(e){return(t)=>(mt(t),Se(t,e))}function _a(e){return Ve(e,ja),Se(e,so)}function lo(e){return Zo(e),Se(e,is)}function IR(e){mt(e);let t=!1,n=!1;if(Ae(e,34)){if(!Ae(e,34))return Se(e,Ea);if(n=!0,e.current===34)throw ar(e,"Multiline strings must start with exactly three quotes");while(!t&&e.offset<e.length)if(Ae(e,34)){if(Ae(e,34)&&Ae(e,34))t=!0}else Ae(e,92),Zo(e)||mt(e)}else while(!t&&e.offset<e.length)if(Ae(e,34))t=!0;else Ae(e,92),Zo(e)||mt(e);if(!t)throw ar(e,"Unexpected EOF inside string");return Se(e,n?Yo:Ea)}function Sy(e){if(mt(e),e.current===35||e.current===34){let t=1;while(Ae(e,35))t++;if(!Ae(e,34))throw ar(e,`Expected a quote after ${"#".repeat(t)}`);let n=!1;if(Ae(e,34))if(Ae(e,34)){if(e.current===34)throw ar(e,"Multiline strings must start with exactly three quotes");n=!0}else{let r=0;while(Ae(e,35))r++;if(r===t)return Se(e,os)}while(!0){if(e.offset>=e.length)throw ar(e,"Unexpected EOF while parsing raw string");if(Ae(e,34)){if(n){if(!Ae(e,34)||!Ae(e,34))continue}let r=0;while(r<t&&Ae(e,35))r++;if(r===t)return Se(e,n?oo:os)}else Zo(e)||mt(e)}}else{let t;if(e.current<255){let n=je[e.current];t=n(e)}else if(ja(e.current))t=_a(e);else if(as(e.current))t=lo(e);else t=fd(e);if(t.type!==Ft)(t.errors??=[]).push(new Re("Expected a valid identifier",{token:t}));return t.type=Xo,t}}function MR(e){if(mt(e),Hn(e,Fr))return Ve(e,ze),Se(e,Ft,"Invalid identifier, identifiers that start with a sign and a dot must be quoted if the next character is a digit to prevent confusion with decimal numbers");return Ve(e,ze),Se(e,Ft)}function DR(e){if(mt(e),Ae(e,45))return Se(e,ro);else if(Ae(e,47)){while(e.offset<e.length&&!as(e.current))mt(e);return Se(e,Gc)}else if(Ae(e,42)){let t=1;while(e.offset<e.length)if(Ae(e,42)){if(Ae(e,47)){if(t--,t===0)return Se(e,Xc)}}else if(Ae(e,47)){if(Ae(e,42))t++}else Zo(e)||mt(e);throw ar(e,"Unexpected EOF in multiline comment")}else Qc(e)}function vy(e){return mt(e),FR(e)}function FR(e){if(Fr(e.current))return Un(e);else if(Ae(e,46)){if(Hn(e,Fr))return Ve(e,ze),Se(e,Ft,"Invalid identifier or number, surround with quotes to make it an identifier or add a zero between the sign and the decimal point");return Ve(e,ze),Se(e,Ft)}else return Ve(e,ze),Se(e,Ft)}function ud(e,t,n,r){return(s)=>{let o=mt(s);if(Hn(s,n))return Ve(s,r),Se(s,t);else if(!s.flags.experimentalSuffixedNumbers){if(Ae(s,95)){if(Ve(s,r),!ze(s.current))return Se(s,t,`Invalid ${e} number, the first character after 0${String.fromCodePoint(o)} cannot be an underscore`)}return Ve(s,ze),Se(s,Ft,`Invalid ${e} number`)}else if(Ae(s,95)){if(ld(s,95),n(s.current)){if(Ve(s,r),!ze(s.current))return Se(s,t,`Invalid ${e} number, the first character after 0${String.fromCodePoint(o)} cannot be an underscore`)}return Ve(s,ze),Se(s,Ft,"Invalid number with suffix, a suffix cannot start with a letter followed by an underscore")}else if(Fr(s.current))return Se(s,Ft,"Invalid number with suffix, a suffix cannot start with a letter followed by a number");else return Ve(s,ze),Se(s,ir)}}function Un(e){if(Ae(e,48)){let t=Zc[e.current];if(t)return t(e)}if(Ve(e,io),Ae(e,46)){if(!Hn(e,Fr))if(e.current===95)Pa(e,"Invalid decimal number, the part after the decimal point mustn't start on an underscore");else Pa(e,"Invalid decimal number, a decimal point must be followed by a digit");Ve(e,io)}if(Ae(e,101)||Ae(e,69))if(Hn(e,xy),Hn(e,Fr)){if(Ve(e,io),ze(e.current))return Ve(e,ze),Se(e,Ft,"Invalid number with suffix, a number with an exponent cannot have a suffix");return Se(e,Dr)}else if(!e.flags.experimentalSuffixedNumbers)if(e.current===95)return Ve(e,io),Se(e,Dr,"Invalid decimal number, the number after the exponent mustn't start on an underscore");else return Ve(e,ze),Se(e,Dr,"Invalid decimal number, missing a number after the exponent");else if(Ae(e,95)){if(ld(e,95),Fr(e.current)){if(Ve(e,io),!ze(e.current))return Se(e,Dr,"Invalid decimal number, the number after the exponent mustn't start on an underscore")}return Ve(e,ze),Se(e,Ft,"Invalid number with suffix, a suffix cannot start with a letter followed by an underscore")}else return Ve(e,ze),Se(e,ir);else if(e.flags.experimentalSuffixedNumbers)if(e.current===88||e.current===120){mt(e);let t=null;if(Hn(e,id))t="Invalid number with suffix, a suffix cannot start with an x followed by a hexidecimal number";return Ve(e,ze),Se(e,ir,t)}else if(Hn(e,hy)){let t=null;if(Hn(e,io))t="Invalid number with suffix, a suffix cannot start with a letter followed by a digit";return Ve(e,ze),Se(e,ir,t)}else if(Ae(e,44))return Ve(e,ze),Se(e,ir,"Invalid number with suffix, a suffix cannot start with a comma");else if(Ae(e,46))return Ve(e,ze),Se(e,ir,"Invalid number with suffix, a suffix cannot start with a dot");else if(Hn(e,ze))return Ve(e,ze),Se(e,ir);else return Se(e,Dr);else return Se(e,Dr)}function LR(e){if(mt(e),e.current!=35)return Ve(e,ze),Se(e,Ft);let t=Sy(e);t.start.offset--,t.start.column--;let n;switch(t.type){case os:case oo:n='Invalid raw string, the correct syntax is #" "#, not r#" "#';break;default:n="Invalid token, did you forget a whitespace after this r?"}return(t.errors??=[]).push(new Re(n,{token:t})),t}function fd(e){return mt(e),Ve(e,ze),Se(e,Ft)}function Qc(e){throw ar(e,`Unexpected character ${JSON.stringify(String.fromCodePoint(e.current))}, did you forget to quote an identifier?`)}function*ka(e,t){let n=by(e,t);yield*$y(n);while(!n.currentIter.done){if(n.current<255){let r=je[n.current];yield r(n);continue}if(ja(n.current)){yield _a(n);continue}if(as(n.current)){yield lo(n);continue}yield fd(n)}yield Se(n,ss)}var Zc,je;var Ey=T(()=>{ao();wy();Zc=Array(256).fill(null);Zc[98]=ud("binary",zc,cd,yy);Zc[111]=ud("octal",Bc,ad,gy);Zc[120]=ud("hexadecimal",Uc,od,id);je=Array(255);je.fill(fd);for(let e=0;e<32;e++)je[e]=Qc;je[9]=_a;je[10]=lo;je[11]=lo;je[12]=lo;je[13]=lo;je[32]=_a;je[34]=IR;je[35]=Sy;je[40]=co(Vc);je[41]=co(va);je[43]=vy;je[45]=vy;je[46]=MR;je[47]=DR;je[48]=Un;je[49]=Un;je[50]=Un;je[51]=Un;je[52]=Un;je[53]=Un;je[54]=Un;je[55]=Un;je[56]=Un;je[57]=Un;je[59]=co(Hc);je[61]=co(Go);je[91]=Qc;je[92]=co(Kc);je[93]=Qc;je[114]=LR;je[123]=co(qc);je[125]=co(Wc);je[133]=lo;je[160]=_a});var Qo=T(()=>{Ey()});var Re;var ao=T(()=>{Qo();Re=class Re extends Error{name="InvalidKdlError";start;end;token;errors;constructor(e,{token:t,start:n=t?.start,end:r=t?.end,errors:s,...o}={}){if(t?.type===ss)e=`${e} at end of input`;else if(n)e=`${e} at ${n.line}:${n.column}`;super(e,o);this.token=t,this.start=n,this.end=r,this.errors=s}*flat(){if(this.errors==null){yield this;return}for(let e of this.errors)yield*e.flat()}}});function ei(e){return jy.get(e)}function Py(e,{start:t},{end:n}){jy.set(e,{start:t,end:n})}var jy;var dd=T(()=>{jy=new WeakMap});function _y({experimentalSuffixedNumbers:e=!1}={}){return{experimentalSuffixedNumbers:e}}class Bn{type="identifier";static type="identifier";representation;constructor(e){this.name=e}getName(){return this.name}setName(e){if(e!==this.name)this.name=e,this.representation=void 0}clone(){let e=new Bn(this.name);return e.representation=this.representation,e}}class cr{type="tag";static type="tag";representation;leading;trailing;suffix;constructor(e){this.name,Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!1,value:e})}getName(){return this.name}setName(e){if(e!==this.name)this.name=e,this.representation=void 0}clone(){let e=new cr(this.name);return e.representation=this.representation,e.leading=this.leading,e.trailing=this.trailing,e.suffix=this.suffix,e}}class zn{type="value";static type="value";representation;tag=null;betweenTagAndValue;constructor(e){this.value=e}clone(){let e=new zn(this.value);return e.tag=this.tag?.clone()??null,e.betweenTagAndValue=this.betweenTagAndValue,e.representation=this.representation,e}getValue(){return this.value}setValue(e){if(e!==this.value)this.value=e,this.representation=void 0}getTag(){return this.tag?this.tag.name:null}setTag(e){if(e==null)this.tag=null;else if(this.tag!=null)this.tag.setName(e);else this.tag=new cr(e)}}var pd=()=>{};class xn{static createArgument(e){return new xn(new zn(e),null)}static createProperty(e,t){return new xn(new zn(t),new Bn(e))}type="entry";static type="entry";name;value;leading;trailing;equals;constructor(e,t){this.value=e,this.name=t}clone(){let e=new xn(this.value.clone(),this.name?.clone()??null);return e.leading=this.leading,e.trailing=this.trailing,e.equals=this.equals,e}getTag(){return this.value.getTag()}setTag(e){this.value.setTag(e)}getName(){return this.name?this.name.name:null}setName(e){this.name=e!=null?new Bn(e):null}getValue(){return this.value.value}setValue(e){this.value=new zn(e)}isArgument(){return this.name==null}isProperty(){return this.name!=null}}var md=T(()=>{pd()});function*ti(e){for(let t=e.length-1;t>=0;t--)yield e[t]}function hd(e){return e.children??(e.children=new cs)}class ni{static create(e){return new ni(new Bn(e))}type="node";static type="node";name;tag=null;entries;children;leading;trailing;beforeChildren;betweenTagAndName;constructor(e,t=[],n=null){this.name=e,this.entries=t,this.children=n}clone({shallow:e=!1}={}){let t=new ni(this.name.clone(),e?[]:this.entries.map((n)=>n.clone()),this.children?.clone({shallow:e}));if(this.tag)t.tag=this.tag.clone();return t.leading=this.leading,t.betweenTagAndName=this.betweenTagAndName,t.beforeChildren=this.beforeChildren,t.trailing=this.trailing,t}getTag(){return this.tag?this.tag.name:null}setTag(e){this.tag=e!=null?new cr(e):null}getName(){return this.name.name}setName(e){this.name.setName(e)}hasArguments(){return this.entries.some((e)=>e.isArgument())}getArguments(){return this.getArgumentEntries().map((e)=>e.getValue())}getArgumentEntries(){return this.entries.filter((e)=>e.isArgument())}hasArgument(e){return this.getArgumentEntry(e)!=null}getArgument(e){return this.getArgumentEntry(e)?.getValue()}getArgumentEntry(e){for(let t of this.entries){if(!t.isArgument())continue;if(e===0)return t;e--}}addArgument(e,t,n){let r=xn.createArgument(e);if(r.value.setTag(t),n!=null)for(let[s,o]of this.entries.entries()){if(!o.isArgument())continue;if(n===0){this.entries.splice(s,0,o);return}n--}this.entries.push(r)}removeArgument(e){for(let[t,n]of this.entries.entries()){if(!n.isArgument())continue;if(e===0){this.entries.splice(t,1);return}e--}}hasProperties(){return this.entries.some((e)=>e.isProperty())}getProperties(){return new Map(this.getPropertyEntries().map((e)=>[e.getName(),e.getValue()]))}getPropertyEntries(){return this.entries.filter((e)=>e.isProperty())}getPropertyEntryMap(){return new Map(this.getPropertyEntries().map((e)=>[e.getName(),e]))}hasProperty(e){return this.getPropertyEntry(e)!=null}getProperty(e){return this.getPropertyEntry(e)?.getValue()}getPropertyEntry(e){for(let t of ti(this.entries))if(t.getName()===e)return t;return}setProperty(e,t,n){for(let s of ti(this.entries))if(s.getName()===e){s.setValue(t),s.value.setTag(n);return}let r=xn.createProperty(e,t);r.value.setTag(n),this.entries.push(r)}deleteProperty(e){this.entries=this.entries.filter((t)=>t.getName()!==e)}hasChildren(){return this.children!=null&&!this.children.isEmpty()}appendNode(e){hd(this).appendNode(e)}insertNodeBefore(e,t){hd(this).insertNodeBefore(e,t)}insertNodeAfter(e,t){hd(this).insertNodeAfter(e,t)}removeNode(e){if(this.children==null)throw Error("Node to remove is not in document");this.children.removeNode(e)}replaceNode(e,t){if(this.children==null)throw Error("Node to remove is not in document");this.children.replaceNode(e,t)}findNodesByName(e){return this.children!=null?this.children.findNodesByName(e):[]}findNodeByName(e){return this.children?.findNodeByName(e)}findParameterizedNode(e,t){return this.children?.findParameterizedNode(e,t)}removeNodesByName(e){this.children?.removeNodesByName(e)}}var ky=T(()=>{gd();md()});function*ri(e){if(e instanceof cs)yield*e.nodes;else yield e}class cs{type="document";static type="document";nodes;trailing;constructor(e=[]){this.nodes=e}clone({shallow:e}={}){let t=new cs(e?[]:this.nodes.map((n)=>n.clone()));return t.trailing=this.trailing,t}appendNode(e){this.nodes.push(...ri(e))}insertNodeBefore(e,t){if(t==null){this.nodes.push(...ri(e));return}let n=this.nodes.indexOf(t);if(n===-1)throw Error("Reference node is not in document");this.nodes.splice(n,0,...ri(e))}insertNodeAfter(e,t){if(t==null){this.nodes.unshift(...ri(e));return}let n=this.nodes.indexOf(t);if(n===-1)throw Error("Reference node is not in document");this.nodes.splice(n+1,0,...ri(e))}removeNode(e){let t=this.nodes.indexOf(e);if(t===-1)throw Error("Node to remove is not in document");this.nodes.splice(t,1)}replaceNode(e,t){let n=this.nodes.indexOf(e);if(n===-1)throw Error("Node to replace is not in document");this.nodes.splice(n,1,...ri(t))}findNodesByName(e){return this.nodes.filter((t)=>t.name.name===e)}findNodeByName(e){for(let t of ti(this.nodes))if(t.name.name===e)return t;return}findParameterizedNode(e,t){for(let n of ti(this.nodes)){if(n.name.name!==e)continue;let r=n.getArguments();if(r.length!==1||t!==void 0&&r[0]!==t)continue;return n}return}removeNodesByName(e){this.nodes=this.nodes.filter((t)=>t.name.name!==e)}isEmpty(){return this.nodes.length===0}}var gd=()=>{};var Oy=T(()=>{gd();md();ky();pd()});function Ay(e,t,n){let r;while(r=qR.exec(t)){let s=Oa(n,t,r.index);e.push(new Re("Raw strings with single quotes cannot contain any unescaped newlines, use triple-quotes for multiline strings",{token:n,start:s,end:{offset:s.offset+r[0].length,line:s.line+1,column:1}}))}return t}function Ry(e,t,n){if(!si.test(t))return e.push(new Re("Raw strings with three quotes must be multiline strings",{token:n})),t;if(!si.test(t[0]))return e.push(new Re("Multi-line strings must start with a newline",{token:n})),t;let r=UR.exec(t)?.[1];if(r==null)return e.push(new Re("The final line in a multiline string may only contain whitespace",{token:n})),t;return t.replace(zR,(s,o,i,a,c)=>{if(!a)return`
13
- `;if(!i.startsWith(r)){let l=Oa(n,t,c+o.length);return e.push(new Re("Every non-blank line of a multi-line string must start with the offset defined by the last line of the string",{token:n,start:l,end:{offset:l.offset+r.length,line:l.line,column:l.column+r.length}})),`
12
+ `||t===";")&&e===0)return this.index+=1,!0;else this.index+=1}return e===0}}function Wo(e){if(JR.test(e))return"unreadable";let t=new pb(e);for(;;){if(t.skipTrivia(),t.done)return"document";if(t.startsWith("(")){let n=e.indexOf(")",t.index);if(n===-1)return"unreadable";t.index=n+1}else{let[n]=IR.exec(e.slice(t.index,t.index+256))??[];if(!n)return t.startsWith('"')||t.startsWith("#")?"document":"unreadable";if(!n.startsWith("$"))return n==="project"?"project":"document";if(t.index+=n.length,!t.skipNode())return"unreadable"}}}var JR,IR;var ba=R(()=>{JR=/\0/u,IR=/^[^\s\\/(){};[\]"#=]+/u});function wa(e){switch(e){case 9:case 32:case 160:case 5760:case 8192:case 8193:case 8194:case 8195:case 8196:case 8197:case 8198:case 8199:case 8200:case 8201:case 8202:case 8239:case 8287:case 12288:return!0}return!1}function ls(e){return e===13||e===10||e===133||e===11||e===12||e===8232||e===8233||!1}function ll(e){return e<8||e>=14&&e<=25||e===127||e>=55296&&e<=57343||e>1114111||e===8206||e===8207||e>=8234&&e<=8238||e>=8294&&e<=8297||e===65279}function He(e){return!isNaN(e)&&!wa(e)&&!ls(e)&&e!==61&&e!==92&&e!==47&&e!==40&&e!==41&&e!==123&&e!==125&&e!==59&&e!==91&&e!==93&&e!==34&&e!==35&&!0}function mb(e){return e>=65&&e<91||e>=97&&e<123||!1}function Rd(e){return e>=48&&e<58||e>=65&&e<71||e>=97&&e<103||!1}function Nd(e){return Rd(e)||e===95}function Lr(e){return e>=48&&e<58}function co(e){return Lr(e)||e===95}function Td(e){return e>=48&&e<56}function hb(e){return Td(e)||e===95}function Jd(e){return e===48||e===49}function gb(e){return Jd(e)||e===95}function yb(e){return e===45||e===43}var is=1,Ho=2,oo=3,Qc=4,el=5,$a=6,tl=7,nl=8,Sa=9,as=10,Lt=11,Uo=12,Bo=13,rl=14,Fr=15,sl=16,ol=17,io=18,cs=19,il=20,al=21,cl=22,zo=23,ao=24,ur=28;function*MR(e){for(let t of(DR??=new Intl.Segmenter("en")).segment(e))yield t.segment}function FR(e){return e[Symbol.iterator]()}function xb(e,{flags:t,graphemeLocations:n=!1}){let r=n?MR(e):FR(e),s=r.next();return{text:e,graphemeLocations:n,line:1,column:1,offset:0,length:e.length,iterator:r,currentIter:s,current:s.done?NaN:s.value.codePointAt(0),start:{line:1,column:1,offset:0},errorsInToken:null,flags:t}}function*bb(e){if(ke(e,65279))e.column=1,yield Se(e,Ho);if(ll(e.current))throw fr(e,`Invalid character \\u${e.current.toString(16)}`)}function pt(e){e.offset+=e.currentIter.value.length,e.column++;let t=e.currentIter=e.iterator.next(),n=e.current=t.done?NaN:t.value.codePointAt(0);if(ll(n))if(n>=55296&&n<=57343||n>1114111)va(e,`Invalid character \\u${n.toString(16)}`);else va(e,`Invalid character \\u${n.toString(16)}, this character is not allowed but can be included in strings as \\u{${n.toString(16)}}`);return n}function qn(e,t){if(t(e.current)){let n=e.current;return pt(e),n}}function ke(e,t){if(e.current===t)return pt(e),t}function Ko(e){if(!ls(e.current))return!1;if(!e.graphemeLocations&&e.current===13&&e.text.codePointAt(e.offset+1)===10)e.iterator.next(),e.offset++;return pt(e),e.column=1,e.line++,!0}function Id(e,t){while(e.current===t)pt(e)}function Me(e,t){while(t(e.current))pt(e)}function Se(e,t,n){let{line:r,column:s,offset:o}=e,i={line:r,column:s,offset:o},a=e.start;e.start=i;let c=e.errorsInToken;e.errorsInToken=null;let l={type:t,text:e.text.slice(a.offset,i.offset),start:a,end:i,errors:c};if(n){if(!l.errors)l.errors=[];l.errors.push(new Oe(n,{token:l}))}return l}function fr(e,t){if(t instanceof Oe)return t;let{line:n,column:r,offset:s}=e,o={line:n,column:r,offset:s},i;if(s<e.length)if(ls(e.current))i={line:n+1,column:1,offset:s+1};else i={line:n,column:r+1,offset:s+1};return new Oe(`${t}`,{start:o,end:i})}function va(e,t){(e.errorsInToken??=[]).push(fr(e,t))}var DR;var $b=R(()=>{lo()});function uo(e){return(t)=>(pt(t),Se(t,e))}function Ea(e){return Me(e,wa),Se(e,io)}function fo(e){return Ko(e),Se(e,cs)}function LR(e){pt(e);let t=!1,n=!1;if(ke(e,34)){if(!ke(e,34))return Se(e,Sa);if(n=!0,e.current===34)throw fr(e,"Multiline strings must start with exactly three quotes");while(!t&&e.offset<e.length)if(ke(e,34)){if(ke(e,34)&&ke(e,34))t=!0}else ke(e,92),Ko(e)||pt(e)}else while(!t&&e.offset<e.length)if(ke(e,34))t=!0;else ke(e,92),Ko(e)||pt(e);if(!t)throw fr(e,"Unexpected EOF inside string");return Se(e,n?zo:Sa)}function Sb(e){if(pt(e),e.current===35||e.current===34){let t=1;while(ke(e,35))t++;if(!ke(e,34))throw fr(e,`Expected a quote after ${"#".repeat(t)}`);let n=!1;if(ke(e,34))if(ke(e,34)){if(e.current===34)throw fr(e,"Multiline strings must start with exactly three quotes");n=!0}else{let r=0;while(ke(e,35))r++;if(r===t)return Se(e,as)}while(!0){if(e.offset>=e.length)throw fr(e,"Unexpected EOF while parsing raw string");if(ke(e,34)){if(n){if(!ke(e,34)||!ke(e,34))continue}let r=0;while(r<t&&ke(e,35))r++;if(r===t)return Se(e,n?ao:as)}else Ko(e)||pt(e)}}else{let t;if(e.current<255){let n=Ee[e.current];t=n(e)}else if(wa(e.current))t=Ea(e);else if(ls(e.current))t=fo(e);else t=Md(e);if(t.type!==Lt)(t.errors??=[]).push(new Oe("Expected a valid identifier",{token:t}));return t.type=Bo,t}}function VR(e){if(pt(e),qn(e,Lr))return Me(e,He),Se(e,Lt,"Invalid identifier, identifiers that start with a sign and a dot must be quoted if the next character is a digit to prevent confusion with decimal numbers");return Me(e,He),Se(e,Lt)}function qR(e){if(pt(e),ke(e,45))return Se(e,oo);else if(ke(e,47)){while(e.offset<e.length&&!ls(e.current))pt(e);return Se(e,al)}else if(ke(e,42)){let t=1;while(e.offset<e.length)if(ke(e,42)){if(ke(e,47)){if(t--,t===0)return Se(e,cl)}}else if(ke(e,47)){if(ke(e,42))t++}else Ko(e)||pt(e);throw fr(e,"Unexpected EOF in multiline comment")}else fl(e)}function wb(e){return pt(e),WR(e)}function WR(e){if(Lr(e.current))return Wn(e);else if(ke(e,46)){if(qn(e,Lr))return Me(e,He),Se(e,Lt,"Invalid identifier or number, surround with quotes to make it an identifier or add a zero between the sign and the decimal point");return Me(e,He),Se(e,Lt)}else return Me(e,He),Se(e,Lt)}function Dd(e,t,n,r){return(s)=>{let o=pt(s);if(qn(s,n))return Me(s,r),Se(s,t);else if(!s.flags.experimentalSuffixedNumbers){if(ke(s,95)){if(Me(s,r),!He(s.current))return Se(s,t,`Invalid ${e} number, the first character after 0${String.fromCodePoint(o)} cannot be an underscore`)}return Me(s,He),Se(s,Lt,`Invalid ${e} number`)}else if(ke(s,95)){if(Id(s,95),n(s.current)){if(Me(s,r),!He(s.current))return Se(s,t,`Invalid ${e} number, the first character after 0${String.fromCodePoint(o)} cannot be an underscore`)}return Me(s,He),Se(s,Lt,"Invalid number with suffix, a suffix cannot start with a letter followed by an underscore")}else if(Lr(s.current))return Se(s,Lt,"Invalid number with suffix, a suffix cannot start with a letter followed by a number");else return Me(s,He),Se(s,ur)}}function Wn(e){if(ke(e,48)){let t=ul[e.current];if(t)return t(e)}if(Me(e,co),ke(e,46)){if(!qn(e,Lr))if(e.current===95)va(e,"Invalid decimal number, the part after the decimal point mustn't start on an underscore");else va(e,"Invalid decimal number, a decimal point must be followed by a digit");Me(e,co)}if(ke(e,101)||ke(e,69))if(qn(e,yb),qn(e,Lr)){if(Me(e,co),He(e.current))return Me(e,He),Se(e,Lt,"Invalid number with suffix, a number with an exponent cannot have a suffix");return Se(e,Fr)}else if(!e.flags.experimentalSuffixedNumbers)if(e.current===95)return Me(e,co),Se(e,Fr,"Invalid decimal number, the number after the exponent mustn't start on an underscore");else return Me(e,He),Se(e,Fr,"Invalid decimal number, missing a number after the exponent");else if(ke(e,95)){if(Id(e,95),Lr(e.current)){if(Me(e,co),!He(e.current))return Se(e,Fr,"Invalid decimal number, the number after the exponent mustn't start on an underscore")}return Me(e,He),Se(e,Lt,"Invalid number with suffix, a suffix cannot start with a letter followed by an underscore")}else return Me(e,He),Se(e,ur);else if(e.flags.experimentalSuffixedNumbers)if(e.current===88||e.current===120){pt(e);let t=null;if(qn(e,Nd))t="Invalid number with suffix, a suffix cannot start with an x followed by a hexidecimal number";return Me(e,He),Se(e,ur,t)}else if(qn(e,mb)){let t=null;if(qn(e,co))t="Invalid number with suffix, a suffix cannot start with a letter followed by a digit";return Me(e,He),Se(e,ur,t)}else if(ke(e,44))return Me(e,He),Se(e,ur,"Invalid number with suffix, a suffix cannot start with a comma");else if(ke(e,46))return Me(e,He),Se(e,ur,"Invalid number with suffix, a suffix cannot start with a dot");else if(qn(e,He))return Me(e,He),Se(e,ur);else return Se(e,Fr);else return Se(e,Fr)}function HR(e){if(pt(e),e.current!=35)return Me(e,He),Se(e,Lt);let t=Sb(e);t.start.offset--,t.start.column--;let n;switch(t.type){case as:case ao:n='Invalid raw string, the correct syntax is #" "#, not r#" "#';break;default:n="Invalid token, did you forget a whitespace after this r?"}return(t.errors??=[]).push(new Oe(n,{token:t})),t}function Md(e){return pt(e),Me(e,He),Se(e,Lt)}function fl(e){throw fr(e,`Unexpected character ${JSON.stringify(String.fromCodePoint(e.current))}, did you forget to quote an identifier?`)}function*ja(e,t){let n=xb(e,t);yield*bb(n);while(!n.currentIter.done){if(n.current<255){let r=Ee[n.current];yield r(n);continue}if(wa(n.current)){yield Ea(n);continue}if(ls(n.current)){yield fo(n);continue}yield Md(n)}yield Se(n,is)}var ul,Ee;var vb=R(()=>{lo();$b();ul=Array(256).fill(null);ul[98]=Dd("binary",ol,Jd,gb);ul[111]=Dd("octal",sl,Td,hb);ul[120]=Dd("hexadecimal",rl,Rd,Nd);Ee=Array(255);Ee.fill(Md);for(let e=0;e<32;e++)Ee[e]=fl;Ee[9]=Ea;Ee[10]=fo;Ee[11]=fo;Ee[12]=fo;Ee[13]=fo;Ee[32]=Ea;Ee[34]=LR;Ee[35]=Sb;Ee[40]=uo(Qc);Ee[41]=uo($a);Ee[43]=wb;Ee[45]=wb;Ee[46]=VR;Ee[47]=qR;Ee[48]=Wn;Ee[49]=Wn;Ee[50]=Wn;Ee[51]=Wn;Ee[52]=Wn;Ee[53]=Wn;Ee[54]=Wn;Ee[55]=Wn;Ee[56]=Wn;Ee[57]=Wn;Ee[59]=uo(nl);Ee[61]=uo(Uo);Ee[91]=fl;Ee[92]=uo(il);Ee[93]=fl;Ee[114]=HR;Ee[123]=uo(el);Ee[125]=uo(tl);Ee[133]=fo;Ee[160]=Ea});var Go=R(()=>{vb()});var Oe;var lo=R(()=>{Go();Oe=class Oe extends Error{name="InvalidKdlError";start;end;token;errors;constructor(e,{token:t,start:n=t?.start,end:r=t?.end,errors:s,...o}={}){if(t?.type===is)e=`${e} at end of input`;else if(n)e=`${e} at ${n.line}:${n.column}`;super(e,o);this.token=t,this.start=n,this.end=r,this.errors=s}*flat(){if(this.errors==null){yield this;return}for(let e of this.errors)yield*e.flat()}}});function Xo(e){return Eb.get(e)}function jb(e,{start:t},{end:n}){Eb.set(e,{start:t,end:n})}var Eb;var Fd=R(()=>{Eb=new WeakMap});function Pb({experimentalSuffixedNumbers:e=!1}={}){return{experimentalSuffixedNumbers:e}}class Hn{type="identifier";static type="identifier";representation;constructor(e){this.name=e}getName(){return this.name}setName(e){if(e!==this.name)this.name=e,this.representation=void 0}clone(){let e=new Hn(this.name);return e.representation=this.representation,e}}class dr{type="tag";static type="tag";representation;leading;trailing;suffix;constructor(e){this.name,Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!1,value:e})}getName(){return this.name}setName(e){if(e!==this.name)this.name=e,this.representation=void 0}clone(){let e=new dr(this.name);return e.representation=this.representation,e.leading=this.leading,e.trailing=this.trailing,e.suffix=this.suffix,e}}class Un{type="value";static type="value";representation;tag=null;betweenTagAndValue;constructor(e){this.value=e}clone(){let e=new Un(this.value);return e.tag=this.tag?.clone()??null,e.betweenTagAndValue=this.betweenTagAndValue,e.representation=this.representation,e}getValue(){return this.value}setValue(e){if(e!==this.value)this.value=e,this.representation=void 0}getTag(){return this.tag?this.tag.name:null}setTag(e){if(e==null)this.tag=null;else if(this.tag!=null)this.tag.setName(e);else this.tag=new dr(e)}}var Ld=()=>{};class xn{static createArgument(e){return new xn(new Un(e),null)}static createProperty(e,t){return new xn(new Un(t),new Hn(e))}type="entry";static type="entry";name;value;leading;trailing;equals;constructor(e,t){this.value=e,this.name=t}clone(){let e=new xn(this.value.clone(),this.name?.clone()??null);return e.leading=this.leading,e.trailing=this.trailing,e.equals=this.equals,e}getTag(){return this.value.getTag()}setTag(e){this.value.setTag(e)}getName(){return this.name?this.name.name:null}setName(e){this.name=e!=null?new Hn(e):null}getValue(){return this.value.value}setValue(e){this.value=new Un(e)}isArgument(){return this.name==null}isProperty(){return this.name!=null}}var Vd=R(()=>{Ld()});function*Yo(e){for(let t=e.length-1;t>=0;t--)yield e[t]}function qd(e){return e.children??(e.children=new us)}class Zo{static create(e){return new Zo(new Hn(e))}type="node";static type="node";name;tag=null;entries;children;leading;trailing;beforeChildren;betweenTagAndName;constructor(e,t=[],n=null){this.name=e,this.entries=t,this.children=n}clone({shallow:e=!1}={}){let t=new Zo(this.name.clone(),e?[]:this.entries.map((n)=>n.clone()),this.children?.clone({shallow:e}));if(this.tag)t.tag=this.tag.clone();return t.leading=this.leading,t.betweenTagAndName=this.betweenTagAndName,t.beforeChildren=this.beforeChildren,t.trailing=this.trailing,t}getTag(){return this.tag?this.tag.name:null}setTag(e){this.tag=e!=null?new dr(e):null}getName(){return this.name.name}setName(e){this.name.setName(e)}hasArguments(){return this.entries.some((e)=>e.isArgument())}getArguments(){return this.getArgumentEntries().map((e)=>e.getValue())}getArgumentEntries(){return this.entries.filter((e)=>e.isArgument())}hasArgument(e){return this.getArgumentEntry(e)!=null}getArgument(e){return this.getArgumentEntry(e)?.getValue()}getArgumentEntry(e){for(let t of this.entries){if(!t.isArgument())continue;if(e===0)return t;e--}}addArgument(e,t,n){let r=xn.createArgument(e);if(r.value.setTag(t),n!=null)for(let[s,o]of this.entries.entries()){if(!o.isArgument())continue;if(n===0){this.entries.splice(s,0,o);return}n--}this.entries.push(r)}removeArgument(e){for(let[t,n]of this.entries.entries()){if(!n.isArgument())continue;if(e===0){this.entries.splice(t,1);return}e--}}hasProperties(){return this.entries.some((e)=>e.isProperty())}getProperties(){return new Map(this.getPropertyEntries().map((e)=>[e.getName(),e.getValue()]))}getPropertyEntries(){return this.entries.filter((e)=>e.isProperty())}getPropertyEntryMap(){return new Map(this.getPropertyEntries().map((e)=>[e.getName(),e]))}hasProperty(e){return this.getPropertyEntry(e)!=null}getProperty(e){return this.getPropertyEntry(e)?.getValue()}getPropertyEntry(e){for(let t of Yo(this.entries))if(t.getName()===e)return t;return}setProperty(e,t,n){for(let s of Yo(this.entries))if(s.getName()===e){s.setValue(t),s.value.setTag(n);return}let r=xn.createProperty(e,t);r.value.setTag(n),this.entries.push(r)}deleteProperty(e){this.entries=this.entries.filter((t)=>t.getName()!==e)}hasChildren(){return this.children!=null&&!this.children.isEmpty()}appendNode(e){qd(this).appendNode(e)}insertNodeBefore(e,t){qd(this).insertNodeBefore(e,t)}insertNodeAfter(e,t){qd(this).insertNodeAfter(e,t)}removeNode(e){if(this.children==null)throw Error("Node to remove is not in document");this.children.removeNode(e)}replaceNode(e,t){if(this.children==null)throw Error("Node to remove is not in document");this.children.replaceNode(e,t)}findNodesByName(e){return this.children!=null?this.children.findNodesByName(e):[]}findNodeByName(e){return this.children?.findNodeByName(e)}findParameterizedNode(e,t){return this.children?.findParameterizedNode(e,t)}removeNodesByName(e){this.children?.removeNodesByName(e)}}var _b=R(()=>{Wd();Vd()});function*Qo(e){if(e instanceof us)yield*e.nodes;else yield e}class us{type="document";static type="document";nodes;trailing;constructor(e=[]){this.nodes=e}clone({shallow:e}={}){let t=new us(e?[]:this.nodes.map((n)=>n.clone()));return t.trailing=this.trailing,t}appendNode(e){this.nodes.push(...Qo(e))}insertNodeBefore(e,t){if(t==null){this.nodes.push(...Qo(e));return}let n=this.nodes.indexOf(t);if(n===-1)throw Error("Reference node is not in document");this.nodes.splice(n,0,...Qo(e))}insertNodeAfter(e,t){if(t==null){this.nodes.unshift(...Qo(e));return}let n=this.nodes.indexOf(t);if(n===-1)throw Error("Reference node is not in document");this.nodes.splice(n+1,0,...Qo(e))}removeNode(e){let t=this.nodes.indexOf(e);if(t===-1)throw Error("Node to remove is not in document");this.nodes.splice(t,1)}replaceNode(e,t){let n=this.nodes.indexOf(e);if(n===-1)throw Error("Node to replace is not in document");this.nodes.splice(n,1,...Qo(t))}findNodesByName(e){return this.nodes.filter((t)=>t.name.name===e)}findNodeByName(e){for(let t of Yo(this.nodes))if(t.name.name===e)return t;return}findParameterizedNode(e,t){for(let n of Yo(this.nodes)){if(n.name.name!==e)continue;let r=n.getArguments();if(r.length!==1||t!==void 0&&r[0]!==t)continue;return n}return}removeNodesByName(e){this.nodes=this.nodes.filter((t)=>t.name.name!==e)}isEmpty(){return this.nodes.length===0}}var Wd=()=>{};var kb=R(()=>{Wd();Vd();_b();Ld()});function Ob(e,t,n){let r;while(r=BR.exec(t)){let s=Pa(n,t,r.index);e.push(new Oe("Raw strings with single quotes cannot contain any unescaped newlines, use triple-quotes for multiline strings",{token:n,start:s,end:{offset:s.offset+r[0].length,line:s.line+1,column:1}}))}return t}function Ab(e,t,n){if(!ei.test(t))return e.push(new Oe("Raw strings with three quotes must be multiline strings",{token:n})),t;if(!ei.test(t[0]))return e.push(new Oe("Multi-line strings must start with a newline",{token:n})),t;let r=GR.exec(t)?.[1];if(r==null)return e.push(new Oe("The final line in a multiline string may only contain whitespace",{token:n})),t;return t.replace(YR,(s,o,i,a,c)=>{if(!a)return`
13
+ `;if(!i.startsWith(r)){let l=Pa(n,t,c+o.length);return e.push(new Oe("Every non-blank line of a multi-line string must start with the offset defined by the last line of the string",{token:n,start:l,end:{offset:l.offset+r.length,line:l.line,column:l.column+r.length}})),`
14
14
  `}return`
15
- `+i.slice(r.length)+a}).slice(1,-1)}function Cy(e,t,n){let r;while(r=HR.exec(t)){let s=Oa(n,t,r.indices[1][0]);e.push(new Re("Strings with single quotes cannot contain any unescaped newlines, use triple-quotes for multiline strings",{token:n,start:s,end:{offset:s.offset+r[1].length,line:s.line+1,column:1}}))}return t.replace(GR,(s,o,i,a,c)=>Ty(e,t,n,s,o,i,a,c))}function Ny(e,t,n){if(!WR.test(t))return e.push(new Re("Strings with three quotes must be multiline strings",{token:n})),t;if(!si.test(t[0]))return e.push(new Re("Multi-line strings must start with a newline",{token:n})),t;let r=BR.exec(t)?.[1];if(r==null){let s=KR.exec(t),o=s?Oa(n,t,s.index):void 0,i="The final line in a multiline string may only contain whitespace";if(s?.[0][0]==="\\")i+=" after removing escaped whitespace";return e.push(new Re(i,{token:n,start:o,end:o&&{offset:o.offset,line:o.line,column:o.column+1}})),t}return t.replace(XR,(s,o,i,a,c,l,u)=>{if(!o)return Ty(e,t,n,s,a,c,l,u);let d=t[u+o.length+(i?i.length:0)];if(si.test(d))return`
16
- `;if(!i.startsWith(r)){let p=Oa(n,t,u+o.length);return e.push(new Re("Every non-blank line of a multi-line string must start with the offset defined by the last line of the string",{token:n,start:p,end:{offset:p.offset+r.length,line:p.line,column:p.column+r.length}})),`
15
+ `+i.slice(r.length)+a}).slice(1,-1)}function Cb(e,t,n){let r;while(r=KR.exec(t)){let s=Pa(n,t,r.indices[1][0]);e.push(new Oe("Strings with single quotes cannot contain any unescaped newlines, use triple-quotes for multiline strings",{token:n,start:s,end:{offset:s.offset+r[1].length,line:s.line+1,column:1}}))}return t.replace(QR,(s,o,i,a,c)=>Nb(e,t,n,s,o,i,a,c))}function Rb(e,t,n){if(!zR.test(t))return e.push(new Oe("Strings with three quotes must be multiline strings",{token:n})),t;if(!ei.test(t[0]))return e.push(new Oe("Multi-line strings must start with a newline",{token:n})),t;let r=XR.exec(t)?.[1];if(r==null){let s=ZR.exec(t),o=s?Pa(n,t,s.index):void 0,i="The final line in a multiline string may only contain whitespace";if(s?.[0][0]==="\\")i+=" after removing escaped whitespace";return e.push(new Oe(i,{token:n,start:o,end:o&&{offset:o.offset,line:o.line,column:o.column+1}})),t}return t.replace(eN,(s,o,i,a,c,l,u)=>{if(!o)return Nb(e,t,n,s,a,c,l,u);let d=t[u+o.length+(i?i.length:0)];if(ei.test(d))return`
16
+ `;if(!i.startsWith(r)){let p=Pa(n,t,u+o.length);return e.push(new Oe("Every non-blank line of a multi-line string must start with the offset defined by the last line of the string",{token:n,start:p,end:{offset:p.offset+r.length,line:p.line,column:p.column+r.length}})),`
17
17
  `}return`
18
- `+i.slice(r.length)}).slice(1,-1)}function Ty(e,t,n,r,s,o,i,a){if(i)return"";if(o){let c=n.text.startsWith('"""'),l=t.slice(0,a).split(si),u={offset:n.start.offset+(c?3:1)+a,line:n.start.line+(l.length-1),column:l.length===1?n.start.column+(c?3:1)+a:l.at(-1).length},d={offset:u.offset+r.length,line:u.line,column:u.column+r.length};if(!o.startsWith("{"))e.push(new Re(String.raw`Invalid unicode escape "\u${o}", did you forget to use {}? "\u{${o}}"`,{token:n,start:u,end:d}));else e.push(new Re(String.raw`Invalid unicode escape "\u${o.endsWith("}")?o:`${o}...`}"`,{token:n,start:u,end:d}));return""}else if(s){let c=parseInt(s,16);if(c>=55296&&c<=57343)e.push(new Re(String.raw`Invalid unicode escape "\u{${s}}, only scalar values can be added using an escape`,{token:n}));return String.fromCodePoint(c)}else{let c=VR.get(r);if(c==null)return e.push(new Re(r.length<2?"Invalid whitespace escape at the end of a string":`Invalid escape "${r}"`,{token:n})),"";return c}}function Oa(e,t,n){let r=1;switch(e.type){case Yo:r=3;break;case os:r=e.text.indexOf('"')+1;break;case oo:r=e.text.indexOf('"')+3;break}let s=t.slice(0,n).split(si);return{offset:e.start.offset+r+n,line:e.start.line+(s.length-1),column:s.length===1?e.start.column+r+n:1+s[s.length-1].length}}var r4,VR,si,qR,WR,HR,UR,BR,zR,KR,GR,XR;var Jy=T(()=>{ao();Qo();r4=new Map([...Array.from({length:32},(e,t)=>[t,`\\u{${t.toString(16).padStart(2,"0")}}`]),[127,"\\u{7f}"],[8206,"\\u{200e}"],[8207,"\\u{200f}"],[8234,"\\u{202a}"],[8235,"\\u{202b}"],[8236,"\\u{202c}"],[8237,"\\u{202d}"],[8238,"\\u{202e}"],[8294,"\\u{2066}"],[8295,"\\u{2067}"],[8296,"\\u{2068}"],[8297,"\\u{2069}"],[65279,"\\u{feff}"],[34,"\\\""],[92,"\\\\"],[10,"\\n"],[11,"\\u{0b}"],[12,"\\f"],[13,"\\r"],[133,"\\u{85}"],[8232,"\\u{2028}"],[8233,"\\u{2029}"],[8,"\\b"],[9,"\\t"]]),VR=new Map([["\\n",`
19
- `],["\\r","\r"],["\\t","\t"],["\\\\","\\"],["\\\"",'"'],["\\b","\b"],["\\f","\f"],["\\s"," "]]),si=/\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029]/,qR=/\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029]/g,WR=/(?:^|[^\\\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000\x0A\x0B\x0C\x0D\x85\u2028\u2029])(?:\\\\)*[\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000\x0A\x0B\x0C\x0D\x85\u2028\u2029]*(\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029])/s,HR=/(?:^|[^\\\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000\x0A\x0B\x0C\x0D\x85\u2028\u2029])(?:\\\\)*[\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000\x0A\x0B\x0C\x0D\x85\u2028\u2029]*(\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029])/dgs;UR=/[\x0A\x0B\x0C\x0D\x85\u2028\u2029]([\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)$/,BR=/(?:^|[^\\\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000])(?:\\\\)*[\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*[\x0A\x0B\x0C\x0D\x85\u2028\u2029]([\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)(?:\\[\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)*$/,zR=/(\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029])([\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)([^\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]?)/g,KR=/([^\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000])[\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*$/;GR=/\\(?:$|u\{(0[0-9a-fA-F]{0,5}|10[0-9a-fA-F]{4}|[1-9a-fA-F][0-9a-fA-F]{0,4})\}|u(\{[^}]{1,6}\}?|[0-9a-fA-F]{1,5}|10[0-9a-fA-F]{4})|([\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]+)|.)/g;XR=/(\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029])([\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)|\\(?:$|u\{(0[0-9a-fA-F]{0,5}|10[0-9a-fA-F]{4}|[1-9a-fA-F][0-9a-fA-F]{0,4})\}|u(\{[^}]{1,6}\}?|[0-9a-fA-F]{1,5}|10[0-9a-fA-F]{4})|([\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]+)|.)/g});function Lr(e){if(!e.current.done)e.lastToken=e.current.value;e.current=e.tokens.next();let t=!e.current.done&&e.current.value.errors;if(t)e.errors.push(...t)}function qe(e,t){if(!e.current.done&&e.current.value.type===t){let n=e.current.value;return Lr(e),n}}function Pe(e,t){let n="current"in e?e.current.value??e.lastToken:e;return new Re(t,{token:n})}function rn(e,t,n,r=n){if(e.storeLocations)Py(t,n,r)}function Lt(e="",t="",n=""){return e+t+n||void 0}function nl(e,t,{storeLocations:n=!1,flags:r}){let s={type:-1,text:"",start:{offset:0,line:1,column:1},end:{offset:0,line:1,column:1},errors:null},o={text:e,tokens:t[Symbol.iterator](),current:{done:!1,value:s},storeLocations:n,lastToken:s,errors:[],flags:r};return Lr(o),o}function xd(e,t){if(!t&&!e.current.done&&e.current.value.type!==ss)t=Pe(e,`Unexpected token ${JSON.stringify(e.current.value.text)}, did you forget to quote an identifier?`);let n=e.errors??[];if(t!=null)if(t instanceof Re)if(t.errors)n.push(...t.errors);else n.push(t);else n.push(new Re(`An unexpected error occurred, ${String(t)}, this is likely a bug in the KDL parser`,{cause:t}));if(n.length)if(n.length===1)throw n[0];else throw new Re("Encountered multiple errors",{errors:n})}function el(e){switch(e){case"#null":return null;case"#true":return!0;case"#false":return!1;case"#inf":return 1/0;case"#-inf":return-1/0;case"#nan":return NaN}}function Iy(e){return e==="inf"||e==="-inf"||e==="nan"||e==="true"||e==="false"||e==="null"||!1}function bd(e){let{value:t}=e.current,n,r,s,o,i,a=!1;if(t?.text[0]==="-"||t?.text[0]==="+")i=t.text[0];switch(t?.type){case ir:{if(!e.flags.experimentalSuffixedNumbers)throw new Re("Unreachable code: got a suffixed number from the tokenizer but the suffixed number flag is not set",{token:t});let u=i?t.text.slice(1):t.text,d=u.search(/[^0-9._]/);if(r=(i??"")+u.slice(0,d),n=Number.parseFloat(r.replaceAll("_","")),o=s=u.slice(d),Iy(s))e.errors.push(Pe(e,`Invalid suffix ${s}, values that look like keywords cannot be used as suffix`))}break;case zc:a=!0,n=(i==="-"?-1:1)*Number.parseInt(t.text.slice(i?3:2).replaceAll("_",""),2);break;case Bc:a=!0,n=(i==="-"?-1:1)*Number.parseInt(t.text.slice(i?3:2).replaceAll("_",""),8);break;case Dr:a=!0,n=Number.parseFloat(t.text.replaceAll("_",""));break;case Uc:a=!0,n=(i==="-"?-1:1)*Number.parseInt(t.text.slice(i?3:2).replaceAll("_",""),16);break;case Xo:if(n=el(t.text),n===void 0)if(n=null,el(t.text.toLowerCase())!==void 0)e.errors.push(Pe(e,`Invalid keyword ${t.text}, keywords are case sensitive, write ${t.text.toLowerCase()} instead`));else switch(t.text.toLowerCase()){case"#nul":case"#nill":e.errors.push(Pe(e,`Invalid keyword ${t.text}, did you mean #null?`));break;case"#fals":case"#fasle":e.errors.push(Pe(e,`Invalid keyword ${t.text}, did you mean #false?`));break;case"#ture":case"#treu":e.errors.push(Pe(e,`Invalid keyword ${t.text}, did you mean #true?`));break;case"#ifn":e.errors.push(Pe(e,`Invalid keyword ${t.text}, did you mean #inf?`));break;case"#-ifn":e.errors.push(Pe(e,`Invalid keyword ${t.text}, did you mean #-inf?`));break;default:e.errors.push(Pe(e,`Invalid keyword ${t.text}, surround it with quotes to use a string`))}break;default:return}Lr(e);let c=e.flags.experimentalSuffixedNumbers&&qe(e,Xo);if(c)if(a){if(o=c.text,el(o)!==void 0)e.errors.push(Pe(c,`Invalid number suffix ${o}, did you forget a space between the number and the keyword?`));s=o.slice(1)}else if(s)e.errors.push(Pe(c,"Unexpected hashed suffix, a number can only have one suffix"));else if(typeof n==="number")e.errors.push(Pe(c,"Unexpected hashed suffix, you cannot place suffixes on number keywords"));else e.errors.push(Pe(c,"Unexpected hashed suffix, you can only place suffixes on numbers"));let l=new zn(n);if(l.representation=r??t.text,rn(e,l,t),s){let u=new cr(s);u.representation=o,u.suffix=!0,rn(e,u,e.lastToken),l.tag=u}return l}function Aa(e){if(e.current.done)return;let{value:t}=e.current,n;switch(t.type){case Ft:if(Lr(e),Iy(t.text))e.errors.push(Pe(e,`Invalid keyword "${t.text}", add a leading # to use the keyword or surround with quotes to make it a string`));n=[t.text,t.text,t];break;case Ea:Lr(e),n=[Cy(e.errors,t.text.slice(1,-1),t),t.text,t];break;case Yo:Lr(e),n=[Ny(e.errors,t.text.slice(3,-3),t),t.text,t];break;case os:{Lr(e);let r=t.text,s=r.indexOf('"');n=[Ay(e.errors,r.slice(s+1,-(s+1)),t),r,t];break}case oo:{Lr(e);let r=t.text,s=r.indexOf('"');n=[Ry(e.errors,r.slice(s+3,-(s+3)),t),r,t];break}default:return}if(qe(e,Xo))e.errors.push(Pe(e.lastToken,el(e.lastToken.text)===void 0?"Unexpected hashed suffix on a string, you can only place suffixes on numbers":"Unexpected keyword, did you forget to add whitespace?"));return n}function $d(e){let t=Aa(e);if(!t)return;let n=new Bn(t[0]);return n.representation=t[1],rn(e,n,t[2],e.lastToken),n}function tl(e){let t=bd(e);if(t)return t;let n=Aa(e);if(!n)return;let r=new zn(n[0]);return r.representation=n[1],rn(e,r,n[2],e.lastToken),r}function Ra(e){let t=qe(e,Gc);if(!t)return;let{value:n}=e.current;return Lr(e),t.text+(n?.text??"")}function rl(e){return qe(e,Xc)?.text}function wd(e){return qe(e,so)??rl(e)}function sl(e){let t=qe(e,Kc);if(!t)return;while(wd(e));if(!Ra(e)&&!qe(e,is)&&!qe(e,ss))e.errors.push(Pe(e,`Expected newline or single-line comment after backslash but got ${e.current.value?.text??"EOF"}`));return e.text.slice(t.start.offset,e.lastToken.end.offset)}function ls(e){let t=e.lastToken.end;while(qe(e,is)?.text??Ra(e)??wd(e)??sl(e));if(e.lastToken.end===t)return;return e.text.slice(t.offset,e.lastToken.end.offset)}function xt(e){let t=e.lastToken.end;while(wd(e)??sl(e));if(e.lastToken.end===t)return;return e.text.slice(t.offset,e.lastToken.end.offset)}function yd(e){let t=qe(e,Vc);if(!t)return;let n=xt(e),r=Aa(e);if(!r&&e.current.value){let a=e.current.value;if(ls(e))e.errors.push(Pe(a,"This type of whitespace is not allowed inside a tag"));r=Aa(e)}if(!r){if(bd(e))e.errors.push(Pe(e,"Invalid tag, did you forget to quote a string?")),r=["error","error"]}if(!r)throw Pe(e,"Invalid tag, did you forget to quote a string?");let s=xt(e),o=qe(e,va);if(!o&&e.current.value){let a=e.current.value;if(ls(e))e.errors.push(Pe(a,"This type of whitespace is not allowed inside a tag"));o=qe(e,va)}if(!o)throw Pe(e,"Invalid tag, did you forget to quote a string?");let i=new cr(r[0]);return i.representation=r[1],i.leading=n,i.trailing=s,rn(e,i,t,e.lastToken),i}function ol(e){return Ra(e)??qe(e,is)?.text??qe(e,Hc)?.text??qe(e,ss)?.text}function Sd(e){if(!qe(e,qc))return;let t=Ly(e);if(!qe(e,Wc))throw Pe(e,"Invalid node children");return t}function oi(e){let t=e.current.value;{let d=yd(e);if(d){let p=xt(e),m=tl(e);if(!m)throw Pe(e,"Invalid argument");if(m.tag)e.errors.push(Pe(e.lastToken,"A number suffix cannot be combined with a regular tag"));m.tag=d,m.betweenTagAndValue=p;let x=new xn(m,null);rn(e,m,t,e.lastToken),rn(e,x,t,e.lastToken);let h=xt(e);if(qe(e,Go))e.errors.push(Pe(e.lastToken,typeof m.value==="string"?"Unexpected equals sign, properties are name=(tag)value not (tag)name=value":"Unexpected equals sign")),h=Lt(h,xt(e))||" ";return[x,h]}}{let d=bd(e);if(d){let p=new xn(d,null);rn(e,p,t,e.lastToken);let m=xt(e);if(qe(e,Go))e.errors.push(Pe(e.lastToken,"Unexpected equals sign, did you forget to quote the property name?")),m=Lt(m,xt(e))||" ";return[p,m]}}let n=Aa(e);if(!n)return;let r=xt(e),s=qe(e,Go);if(!s){let d=new zn(n[0]);d.representation=n[1],rn(e,d,n[2]);let p=new xn(d,null);return rn(e,p,t,e.lastToken),[p,r]}let o=new Bn(n[0]);o.representation=n[1],rn(e,o,n[2]);let i=xt(e),a=yd(e),c=a&&xt(e),l=tl(e);if(!l)throw Pe(e,"Expected a value");if(a){if(l.tag)e.errors.push(Pe(e.lastToken,"A number suffix cannot be combined with a regular tag"));l.tag=a,l.betweenTagAndValue=c}let u=new xn(l,o);return rn(e,u,t,e.lastToken),u.equals=Lt(r,s.text,i),[u,void 0]}function My(e){let t=xt(e)??"",n;while(n=uo(e)){let i=e.lastToken.end,a=oi(e);if(!a)throw Pe(e,"Expected a property or argument");if(!(a[1]??xt(e)))throw Pe(e,"Expected space after slashdashed property or argument");t=t+n+e.text.slice(i.offset,e.lastToken.end.offset)}let r=oi(e);if(!r)return;let s=r[1]??xt(e)??"";while(n=uo(e)){let i=e.lastToken.end,a=oi(e);if(!a)throw Pe(e,"Expected a property or argument");if(!(a[1]??xt(e)))break;s=s+n+e.text.slice(i.offset,e.lastToken.end.offset)}let o=r[0];return o.leading=t,o.trailing=s,o}function uo(e){let t=qe(e,ro)?.text;if(!t)return;return Lt(t,ls(e))}function il(e){let t=e.current.value,n=yd(e),r=n&&xt(e),s=$d(e);if(!s)if(n)throw Pe(e,"Couldn't find node name");else return;let o=xt(e),i=o!=null,a=uo(e),c=[];while(i||a){let p=e.lastToken.end,m=oi(e);if(!m)break;if(a)i=(m[1]||xt(e))!=null,o=Lt(o,a,e.text.slice(p.offset,e.lastToken.end.offset)),a=uo(e);else{let x=m[0];x.leading=o,c.push(x),o=m[1]||xt(e),i=o!=null,a=uo(e)}}let l,u;while(!0){a??=uo(e);let p=e.lastToken.end,m=Sd(e);if(!m){if(a)throw Pe(e,"Unexpected slashdash");break}if(a)o=Lt(o,a,e.text.slice(p.offset,e.lastToken.end.offset)),a=void 0;else{if(l)e.errors.push(Pe(e,"A node can only have one children block"));l=m,u=o??"",o=void 0}o=Lt(o,xt(e))}let d=new ni(s,c,l);return d.tag=n??null,d.betweenTagAndName=r,d.beforeChildren=u,d.trailing=o??"",rn(e,d,t,e.lastToken),d}function Dy(e){let t=ls(e),n=il(e);if(!n)return;let r=Lt(ol(e),ls(e));return n.leading=Lt(t,n.leading),n.trailing=Lt(n.trailing,r),n}function Fy(e){let t=qe(e,Ko)?.text,n=Ly(e);if(!t)return n;if(n.nodes[0])n.nodes[0].leading=Lt(t,n.nodes[0].leading);else n.trailing=Lt(t,n.trailing);return n}function Ly(e){let t=e.current.value,n=[],r=!0,s=ls(e);while(r){let i=e.lastToken.end,a=uo(e),c=il(e);if(!c){if(a)throw Pe(e,"Unexpected slashdash");break}let l=xt(e),u=ol(e);if(a)s=Lt(s,e.text.slice(i.offset,e.lastToken.end.offset),ls(e));else c.trailing=Lt(c.trailing,l,u)??"",n.push(c),c.leading=s??"",s=ls(e);r=u!=null}let o=new cs(n);return rn(e,o,t,e.lastToken),o.trailing=s??"",o}var vd=T(()=>{ao();dd();Oy();Jy();Qo()});function Vy(e,t){let n=[],r;while(r=t(e))n.push(r);return n.length>0?n:void 0}function YR(e){{let t=qe(e,Ko);if(t)return{type:"bom",text:t.text}}{let t=qe(e,is);if(t)return{type:"newline",text:t.text}}{let t=qe(e,so);if(t)return{type:"space",text:t.text}}{let t=Ra(e);if(t)return{type:"singleline",text:t}}{let t=rl(e);if(t)return{type:"multiline",text:t}}return}function al(e){{let t=sl(e);if(t)return{type:"line-escape",text:t}}{let t=qe(e,so);if(t)return{type:"space",text:t.text}}{let t=rl(e);if(t)return{type:"multiline",text:t}}return}function qy(e){let t=[];while(!0){{let n=YR(e);if(n){t.push(n);continue}}if(qe(e,ro)?.text){let r,s=Vy(e,al)??[],o=il(e);if(!o)throw Pe(e,"Invalid slashdash, expected a commented node");o.trailing=Lt(o.trailing,Vy(e,al)?.map((i)=>i.text).join(""),ol(e)),t.push({type:"slashdash",preface:s,value:o});continue}break}return t}function ZR(e){let t=qe(e,ro);if(t==null)return;let n,r=[];while(n=al(e))r.push(n);let s,o,i="";if(o=oi(e)){if(s=o[0],o[1])i=o[1]}else if(o=Sd(e))s=o;else throw Pe(t,"Couldn't find argument, property, or children that were commented by slashdash");return[{type:"slashdash",preface:r,value:s},i]}function Ed(e){let t=[];while(!0){let n=al(e);if(!n)break;let r=!0;t.push(n);while(r){let s=ZR(e);if(!s)break;if(t.push(s[0]),s[1][0])t.push(...Ed(nl(s[1][0],ka(s[1][0],{flags:e.flags}),{flags:e.flags})));r=!!s[1][0]}}return t}var Wy=T(()=>{Qo();vd()});function us(e,{as:t="document",flags:n,...r}={}){let s=QR[t];if(s==null)throw TypeError(`Invalid "as" target passed: ${JSON.stringify(t)}`);if(typeof e!=="string"){if(typeof TextDecoder!=="function")throw TypeError("Uint8Array input is only supported on platforms that include TextDecoder");e=new TextDecoder("utf-8",{fatal:!0}).decode(e)}let o=_y(n),i=ka(e,{...r,flags:o}),a=nl(e,i,{...r,flags:o}),c;try{c=s(a)}catch(l){xd(a,l)}if(xd(a),!c)throw new Re(`Expected ${/^[aeiouy]/.exec(t)?"an":"a"} ${t}`);return c}var QR;var Hy=T(()=>{ao();Qo();vd();Wy();QR={value:tl,identifier:$d,node:Dy,entry:My,document:Fy,"whitespace in document":qy,"whitespace in node":Ed}});var cl=T(()=>{ao();dd();Hy()});function ii(e,t){let n=e.slice(0,t),r=n.split(`
18
+ `+i.slice(r.length)}).slice(1,-1)}function Nb(e,t,n,r,s,o,i,a){if(i)return"";if(o){let c=n.text.startsWith('"""'),l=t.slice(0,a).split(ei),u={offset:n.start.offset+(c?3:1)+a,line:n.start.line+(l.length-1),column:l.length===1?n.start.column+(c?3:1)+a:l.at(-1).length},d={offset:u.offset+r.length,line:u.line,column:u.column+r.length};if(!o.startsWith("{"))e.push(new Oe(String.raw`Invalid unicode escape "\u${o}", did you forget to use {}? "\u{${o}}"`,{token:n,start:u,end:d}));else e.push(new Oe(String.raw`Invalid unicode escape "\u${o.endsWith("}")?o:`${o}...`}"`,{token:n,start:u,end:d}));return""}else if(s){let c=parseInt(s,16);if(c>=55296&&c<=57343)e.push(new Oe(String.raw`Invalid unicode escape "\u{${s}}, only scalar values can be added using an escape`,{token:n}));return String.fromCodePoint(c)}else{let c=UR.get(r);if(c==null)return e.push(new Oe(r.length<2?"Invalid whitespace escape at the end of a string":`Invalid escape "${r}"`,{token:n})),"";return c}}function Pa(e,t,n){let r=1;switch(e.type){case zo:r=3;break;case as:r=e.text.indexOf('"')+1;break;case ao:r=e.text.indexOf('"')+3;break}let s=t.slice(0,n).split(ei);return{offset:e.start.offset+r+n,line:e.start.line+(s.length-1),column:s.length===1?e.start.column+r+n:1+s[s.length-1].length}}var k3,UR,ei,BR,zR,KR,GR,XR,YR,ZR,QR,eN;var Tb=R(()=>{lo();Go();k3=new Map([...Array.from({length:32},(e,t)=>[t,`\\u{${t.toString(16).padStart(2,"0")}}`]),[127,"\\u{7f}"],[8206,"\\u{200e}"],[8207,"\\u{200f}"],[8234,"\\u{202a}"],[8235,"\\u{202b}"],[8236,"\\u{202c}"],[8237,"\\u{202d}"],[8238,"\\u{202e}"],[8294,"\\u{2066}"],[8295,"\\u{2067}"],[8296,"\\u{2068}"],[8297,"\\u{2069}"],[65279,"\\u{feff}"],[34,"\\\""],[92,"\\\\"],[10,"\\n"],[11,"\\u{0b}"],[12,"\\f"],[13,"\\r"],[133,"\\u{85}"],[8232,"\\u{2028}"],[8233,"\\u{2029}"],[8,"\\b"],[9,"\\t"]]),UR=new Map([["\\n",`
19
+ `],["\\r","\r"],["\\t","\t"],["\\\\","\\"],["\\\"",'"'],["\\b","\b"],["\\f","\f"],["\\s"," "]]),ei=/\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029]/,BR=/\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029]/g,zR=/(?:^|[^\\\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000\x0A\x0B\x0C\x0D\x85\u2028\u2029])(?:\\\\)*[\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000\x0A\x0B\x0C\x0D\x85\u2028\u2029]*(\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029])/s,KR=/(?:^|[^\\\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000\x0A\x0B\x0C\x0D\x85\u2028\u2029])(?:\\\\)*[\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000\x0A\x0B\x0C\x0D\x85\u2028\u2029]*(\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029])/dgs;GR=/[\x0A\x0B\x0C\x0D\x85\u2028\u2029]([\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)$/,XR=/(?:^|[^\\\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000])(?:\\\\)*[\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*[\x0A\x0B\x0C\x0D\x85\u2028\u2029]([\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)(?:\\[\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)*$/,YR=/(\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029])([\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)([^\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]?)/g,ZR=/([^\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000])[\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*$/;QR=/\\(?:$|u\{(0[0-9a-fA-F]{0,5}|10[0-9a-fA-F]{4}|[1-9a-fA-F][0-9a-fA-F]{0,4})\}|u(\{[^}]{1,6}\}?|[0-9a-fA-F]{1,5}|10[0-9a-fA-F]{4})|([\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]+)|.)/g;eN=/(\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029])([\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)|\\(?:$|u\{(0[0-9a-fA-F]{0,5}|10[0-9a-fA-F]{4}|[1-9a-fA-F][0-9a-fA-F]{0,4})\}|u(\{[^}]{1,6}\}?|[0-9a-fA-F]{1,5}|10[0-9a-fA-F]{4})|([\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]+)|.)/g});function Vr(e){if(!e.current.done)e.lastToken=e.current.value;e.current=e.tokens.next();let t=!e.current.done&&e.current.value.errors;if(t)e.errors.push(...t)}function Fe(e,t){if(!e.current.done&&e.current.value.type===t){let n=e.current.value;return Vr(e),n}}function je(e,t){let n="current"in e?e.current.value??e.lastToken:e;return new Oe(t,{token:n})}function nn(e,t,n,r=n){if(e.storeLocations)jb(t,n,r)}function Vt(e="",t="",n=""){return e+t+n||void 0}function ml(e,t,{storeLocations:n=!1,flags:r}){let s={type:-1,text:"",start:{offset:0,line:1,column:1},end:{offset:0,line:1,column:1},errors:null},o={text:e,tokens:t[Symbol.iterator](),current:{done:!1,value:s},storeLocations:n,lastToken:s,errors:[],flags:r};return Vr(o),o}function Ud(e,t){if(!t&&!e.current.done&&e.current.value.type!==is)t=je(e,`Unexpected token ${JSON.stringify(e.current.value.text)}, did you forget to quote an identifier?`);let n=e.errors??[];if(t!=null)if(t instanceof Oe)if(t.errors)n.push(...t.errors);else n.push(t);else n.push(new Oe(`An unexpected error occurred, ${String(t)}, this is likely a bug in the KDL parser`,{cause:t}));if(n.length)if(n.length===1)throw n[0];else throw new Oe("Encountered multiple errors",{errors:n})}function dl(e){switch(e){case"#null":return null;case"#true":return!0;case"#false":return!1;case"#inf":return 1/0;case"#-inf":return-1/0;case"#nan":return NaN}}function Jb(e){return e==="inf"||e==="-inf"||e==="nan"||e==="true"||e==="false"||e==="null"||!1}function Bd(e){let{value:t}=e.current,n,r,s,o,i,a=!1;if(t?.text[0]==="-"||t?.text[0]==="+")i=t.text[0];switch(t?.type){case ur:{if(!e.flags.experimentalSuffixedNumbers)throw new Oe("Unreachable code: got a suffixed number from the tokenizer but the suffixed number flag is not set",{token:t});let u=i?t.text.slice(1):t.text,d=u.search(/[^0-9._]/);if(r=(i??"")+u.slice(0,d),n=Number.parseFloat(r.replaceAll("_","")),o=s=u.slice(d),Jb(s))e.errors.push(je(e,`Invalid suffix ${s}, values that look like keywords cannot be used as suffix`))}break;case ol:a=!0,n=(i==="-"?-1:1)*Number.parseInt(t.text.slice(i?3:2).replaceAll("_",""),2);break;case sl:a=!0,n=(i==="-"?-1:1)*Number.parseInt(t.text.slice(i?3:2).replaceAll("_",""),8);break;case Fr:a=!0,n=Number.parseFloat(t.text.replaceAll("_",""));break;case rl:a=!0,n=(i==="-"?-1:1)*Number.parseInt(t.text.slice(i?3:2).replaceAll("_",""),16);break;case Bo:if(n=dl(t.text),n===void 0)if(n=null,dl(t.text.toLowerCase())!==void 0)e.errors.push(je(e,`Invalid keyword ${t.text}, keywords are case sensitive, write ${t.text.toLowerCase()} instead`));else switch(t.text.toLowerCase()){case"#nul":case"#nill":e.errors.push(je(e,`Invalid keyword ${t.text}, did you mean #null?`));break;case"#fals":case"#fasle":e.errors.push(je(e,`Invalid keyword ${t.text}, did you mean #false?`));break;case"#ture":case"#treu":e.errors.push(je(e,`Invalid keyword ${t.text}, did you mean #true?`));break;case"#ifn":e.errors.push(je(e,`Invalid keyword ${t.text}, did you mean #inf?`));break;case"#-ifn":e.errors.push(je(e,`Invalid keyword ${t.text}, did you mean #-inf?`));break;default:e.errors.push(je(e,`Invalid keyword ${t.text}, surround it with quotes to use a string`))}break;default:return}Vr(e);let c=e.flags.experimentalSuffixedNumbers&&Fe(e,Bo);if(c)if(a){if(o=c.text,dl(o)!==void 0)e.errors.push(je(c,`Invalid number suffix ${o}, did you forget a space between the number and the keyword?`));s=o.slice(1)}else if(s)e.errors.push(je(c,"Unexpected hashed suffix, a number can only have one suffix"));else if(typeof n==="number")e.errors.push(je(c,"Unexpected hashed suffix, you cannot place suffixes on number keywords"));else e.errors.push(je(c,"Unexpected hashed suffix, you can only place suffixes on numbers"));let l=new Un(n);if(l.representation=r??t.text,nn(e,l,t),s){let u=new dr(s);u.representation=o,u.suffix=!0,nn(e,u,e.lastToken),l.tag=u}return l}function _a(e){if(e.current.done)return;let{value:t}=e.current,n;switch(t.type){case Lt:if(Vr(e),Jb(t.text))e.errors.push(je(e,`Invalid keyword "${t.text}", add a leading # to use the keyword or surround with quotes to make it a string`));n=[t.text,t.text,t];break;case Sa:Vr(e),n=[Cb(e.errors,t.text.slice(1,-1),t),t.text,t];break;case zo:Vr(e),n=[Rb(e.errors,t.text.slice(3,-3),t),t.text,t];break;case as:{Vr(e);let r=t.text,s=r.indexOf('"');n=[Ob(e.errors,r.slice(s+1,-(s+1)),t),r,t];break}case ao:{Vr(e);let r=t.text,s=r.indexOf('"');n=[Ab(e.errors,r.slice(s+3,-(s+3)),t),r,t];break}default:return}if(Fe(e,Bo))e.errors.push(je(e.lastToken,dl(e.lastToken.text)===void 0?"Unexpected hashed suffix on a string, you can only place suffixes on numbers":"Unexpected keyword, did you forget to add whitespace?"));return n}function zd(e){let t=_a(e);if(!t)return;let n=new Hn(t[0]);return n.representation=t[1],nn(e,n,t[2],e.lastToken),n}function pl(e){let t=Bd(e);if(t)return t;let n=_a(e);if(!n)return;let r=new Un(n[0]);return r.representation=n[1],nn(e,r,n[2],e.lastToken),r}function ka(e){let t=Fe(e,al);if(!t)return;let{value:n}=e.current;return Vr(e),t.text+(n?.text??"")}function hl(e){return Fe(e,cl)?.text}function Kd(e){return Fe(e,io)??hl(e)}function gl(e){let t=Fe(e,il);if(!t)return;while(Kd(e));if(!ka(e)&&!Fe(e,cs)&&!Fe(e,is))e.errors.push(je(e,`Expected newline or single-line comment after backslash but got ${e.current.value?.text??"EOF"}`));return e.text.slice(t.start.offset,e.lastToken.end.offset)}function fs(e){let t=e.lastToken.end;while(Fe(e,cs)?.text??ka(e)??Kd(e)??gl(e));if(e.lastToken.end===t)return;return e.text.slice(t.offset,e.lastToken.end.offset)}function $t(e){let t=e.lastToken.end;while(Kd(e)??gl(e));if(e.lastToken.end===t)return;return e.text.slice(t.offset,e.lastToken.end.offset)}function Hd(e){let t=Fe(e,Qc);if(!t)return;let n=$t(e),r=_a(e);if(!r&&e.current.value){let a=e.current.value;if(fs(e))e.errors.push(je(a,"This type of whitespace is not allowed inside a tag"));r=_a(e)}if(!r){if(Bd(e))e.errors.push(je(e,"Invalid tag, did you forget to quote a string?")),r=["error","error"]}if(!r)throw je(e,"Invalid tag, did you forget to quote a string?");let s=$t(e),o=Fe(e,$a);if(!o&&e.current.value){let a=e.current.value;if(fs(e))e.errors.push(je(a,"This type of whitespace is not allowed inside a tag"));o=Fe(e,$a)}if(!o)throw je(e,"Invalid tag, did you forget to quote a string?");let i=new dr(r[0]);return i.representation=r[1],i.leading=n,i.trailing=s,nn(e,i,t,e.lastToken),i}function yl(e){return ka(e)??Fe(e,cs)?.text??Fe(e,nl)?.text??Fe(e,is)?.text}function Gd(e){if(!Fe(e,el))return;let t=Fb(e);if(!Fe(e,tl))throw je(e,"Invalid node children");return t}function ti(e){let t=e.current.value;{let d=Hd(e);if(d){let p=$t(e),m=pl(e);if(!m)throw je(e,"Invalid argument");if(m.tag)e.errors.push(je(e.lastToken,"A number suffix cannot be combined with a regular tag"));m.tag=d,m.betweenTagAndValue=p;let x=new xn(m,null);nn(e,m,t,e.lastToken),nn(e,x,t,e.lastToken);let g=$t(e);if(Fe(e,Uo))e.errors.push(je(e.lastToken,typeof m.value==="string"?"Unexpected equals sign, properties are name=(tag)value not (tag)name=value":"Unexpected equals sign")),g=Vt(g,$t(e))||" ";return[x,g]}}{let d=Bd(e);if(d){let p=new xn(d,null);nn(e,p,t,e.lastToken);let m=$t(e);if(Fe(e,Uo))e.errors.push(je(e.lastToken,"Unexpected equals sign, did you forget to quote the property name?")),m=Vt(m,$t(e))||" ";return[p,m]}}let n=_a(e);if(!n)return;let r=$t(e),s=Fe(e,Uo);if(!s){let d=new Un(n[0]);d.representation=n[1],nn(e,d,n[2]);let p=new xn(d,null);return nn(e,p,t,e.lastToken),[p,r]}let o=new Hn(n[0]);o.representation=n[1],nn(e,o,n[2]);let i=$t(e),a=Hd(e),c=a&&$t(e),l=pl(e);if(!l)throw je(e,"Expected a value");if(a){if(l.tag)e.errors.push(je(e.lastToken,"A number suffix cannot be combined with a regular tag"));l.tag=a,l.betweenTagAndValue=c}let u=new xn(l,o);return nn(e,u,t,e.lastToken),u.equals=Vt(r,s.text,i),[u,void 0]}function Ib(e){let t=$t(e)??"",n;while(n=po(e)){let i=e.lastToken.end,a=ti(e);if(!a)throw je(e,"Expected a property or argument");if(!(a[1]??$t(e)))throw je(e,"Expected space after slashdashed property or argument");t=t+n+e.text.slice(i.offset,e.lastToken.end.offset)}let r=ti(e);if(!r)return;let s=r[1]??$t(e)??"";while(n=po(e)){let i=e.lastToken.end,a=ti(e);if(!a)throw je(e,"Expected a property or argument");if(!(a[1]??$t(e)))break;s=s+n+e.text.slice(i.offset,e.lastToken.end.offset)}let o=r[0];return o.leading=t,o.trailing=s,o}function po(e){let t=Fe(e,oo)?.text;if(!t)return;return Vt(t,fs(e))}function xl(e){let t=e.current.value,n=Hd(e),r=n&&$t(e),s=zd(e);if(!s)if(n)throw je(e,"Couldn't find node name");else return;let o=$t(e),i=o!=null,a=po(e),c=[];while(i||a){let p=e.lastToken.end,m=ti(e);if(!m)break;if(a)i=(m[1]||$t(e))!=null,o=Vt(o,a,e.text.slice(p.offset,e.lastToken.end.offset)),a=po(e);else{let x=m[0];x.leading=o,c.push(x),o=m[1]||$t(e),i=o!=null,a=po(e)}}let l,u;while(!0){a??=po(e);let p=e.lastToken.end,m=Gd(e);if(!m){if(a)throw je(e,"Unexpected slashdash");break}if(a)o=Vt(o,a,e.text.slice(p.offset,e.lastToken.end.offset)),a=void 0;else{if(l)e.errors.push(je(e,"A node can only have one children block"));l=m,u=o??"",o=void 0}o=Vt(o,$t(e))}let d=new Zo(s,c,l);return d.tag=n??null,d.betweenTagAndName=r,d.beforeChildren=u,d.trailing=o??"",nn(e,d,t,e.lastToken),d}function Db(e){let t=fs(e),n=xl(e);if(!n)return;let r=Vt(yl(e),fs(e));return n.leading=Vt(t,n.leading),n.trailing=Vt(n.trailing,r),n}function Mb(e){let t=Fe(e,Ho)?.text,n=Fb(e);if(!t)return n;if(n.nodes[0])n.nodes[0].leading=Vt(t,n.nodes[0].leading);else n.trailing=Vt(t,n.trailing);return n}function Fb(e){let t=e.current.value,n=[],r=!0,s=fs(e);while(r){let i=e.lastToken.end,a=po(e),c=xl(e);if(!c){if(a)throw je(e,"Unexpected slashdash");break}let l=$t(e),u=yl(e);if(a)s=Vt(s,e.text.slice(i.offset,e.lastToken.end.offset),fs(e));else c.trailing=Vt(c.trailing,l,u)??"",n.push(c),c.leading=s??"",s=fs(e);r=u!=null}let o=new us(n);return nn(e,o,t,e.lastToken),o.trailing=s??"",o}var Xd=R(()=>{lo();Fd();kb();Tb();Go()});function Lb(e,t){let n=[],r;while(r=t(e))n.push(r);return n.length>0?n:void 0}function tN(e){{let t=Fe(e,Ho);if(t)return{type:"bom",text:t.text}}{let t=Fe(e,cs);if(t)return{type:"newline",text:t.text}}{let t=Fe(e,io);if(t)return{type:"space",text:t.text}}{let t=ka(e);if(t)return{type:"singleline",text:t}}{let t=hl(e);if(t)return{type:"multiline",text:t}}return}function bl(e){{let t=gl(e);if(t)return{type:"line-escape",text:t}}{let t=Fe(e,io);if(t)return{type:"space",text:t.text}}{let t=hl(e);if(t)return{type:"multiline",text:t}}return}function Vb(e){let t=[];while(!0){{let n=tN(e);if(n){t.push(n);continue}}if(Fe(e,oo)?.text){let r,s=Lb(e,bl)??[],o=xl(e);if(!o)throw je(e,"Invalid slashdash, expected a commented node");o.trailing=Vt(o.trailing,Lb(e,bl)?.map((i)=>i.text).join(""),yl(e)),t.push({type:"slashdash",preface:s,value:o});continue}break}return t}function nN(e){let t=Fe(e,oo);if(t==null)return;let n,r=[];while(n=bl(e))r.push(n);let s,o,i="";if(o=ti(e)){if(s=o[0],o[1])i=o[1]}else if(o=Gd(e))s=o;else throw je(t,"Couldn't find argument, property, or children that were commented by slashdash");return[{type:"slashdash",preface:r,value:s},i]}function Yd(e){let t=[];while(!0){let n=bl(e);if(!n)break;let r=!0;t.push(n);while(r){let s=nN(e);if(!s)break;if(t.push(s[0]),s[1][0])t.push(...Yd(ml(s[1][0],ja(s[1][0],{flags:e.flags}),{flags:e.flags})));r=!!s[1][0]}}return t}var qb=R(()=>{Go();Xd()});function ds(e,{as:t="document",flags:n,...r}={}){let s=rN[t];if(s==null)throw TypeError(`Invalid "as" target passed: ${JSON.stringify(t)}`);if(typeof e!=="string"){if(typeof TextDecoder!=="function")throw TypeError("Uint8Array input is only supported on platforms that include TextDecoder");e=new TextDecoder("utf-8",{fatal:!0}).decode(e)}let o=Pb(n),i=ja(e,{...r,flags:o}),a=ml(e,i,{...r,flags:o}),c;try{c=s(a)}catch(l){Ud(a,l)}if(Ud(a),!c)throw new Oe(`Expected ${/^[aeiouy]/.exec(t)?"an":"a"} ${t}`);return c}var rN;var Wb=R(()=>{lo();Go();Xd();qb();rN={value:pl,identifier:zd,node:Db,entry:Ib,document:Mb,"whitespace in document":Vb,"whitespace in node":Yd}});var $l=R(()=>{lo();Fd();Wb()});function ni(e,t){let n=e.slice(0,t),r=n.split(`
20
20
  `).length;return{column:t-n.lastIndexOf(`
21
- `),line:r,offset:t}}var Rt;var ai=T(()=>{Rt=class Rt extends Error{column;line;offset;reason;constructor(e,t=null){super(t?`${e} (line ${t.line}, column ${t.column})`:e);this.name="JxnError",this.column=t?.column??null,this.line=t?.line??null,this.offset=t?.offset??null,this.reason=e}inFile(e){let t=this.line!==null&&this.column!==null&&this.offset!==null?{column:this.column,line:this.line,offset:this.offset}:null;return new Rt(`${e}: ${this.reason}`,t)}}});var Uy;var By=T(()=>{Uy=new Set(["onabort","onactivate","onaddsourcebuffer","onaddtrack","onadvertisementreceived","onafterprint","onanimationcancel","onanimationend","onanimationiteration","onanimationstart","onappinstalled","onaudioend","onaudioprocess","onaudiostart","onauxclick","onavailabilitychanged","onbackgroundfetchabort","onbackgroundfetchclick","onbackgroundfetchfail","onbackgroundfetchsuccess","onbeforeinput","onbeforeinstallprompt","onbeforematch","onbeforeprint","onbeforetoggle","onbeforexrselect","onbegin","onblocked","onblur","onboundary","onbufferedamountlow","onbufferedchange","oncancel","oncanmakepayment","oncanplay","oncanplaythrough","oncaptureaction","oncapturedmousechange","oncapturehandlechange","onchange","oncharacterboundsupdate","oncharacteristicvaluechanged","onchargingchange","onchargingtimechange","onclick","onclose","onclosing","oncommand","oncomplete","oncompositionend","oncompositionstart","onconfigurationchange","onconnect","onconnecting","onconnectionavailable","onconnectionstatechange","oncontentdelete","oncontextlost","oncontextmenu","oncontextoverflow","oncontextrestored","oncontrollerchange","oncookiechange","oncopy","oncuechange","oncurrententrychange","oncurrentscreenchange","oncut","ondataavailable","ondatachannel","ondblclick","ondequeue","ondevicechange","ondevicemotion","ondeviceorientation","ondeviceorientationabsolute","ondischargingtimechange","ondisconnect","ondispose","ondownloadprogress","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onencrypted","onend","onended","onendstreaming","onenter","onenterpictureinpicture","onerror","onexit","onfencedtreeclick","onfetch","onfinish","onfocus","onformdata","onframeratechange","onfreeze","onfullscreenchange","onfullscreenerror","ongamepadconnected","ongamepaddisconnected","ongatheringstatechange","ongattserverdisconnected","ongeometrychange","ongotpointercapture","onhashchange","onicecandidate","onicecandidateerror","oniceconnectionstatechange","onicegatheringstatechange","oninput","oninputreport","oninputsourceschange","oninstall","oninstallresult","oninvalid","onisolationchange","onkeydown","onkeyframerequest","onkeypress","onkeystatuseschange","onkeyup","onlanguagechange","onlayoutchange","onleavepictureinpicture","onlevelchange","onload","onloadeddata","onloadedmetadata","onloadend","onloading","onloadingdone","onloadingerror","onloadstart","onlocation","onlostpointercapture","onmanagedconfigurationchange","onmark","onmessage","onmessageerror","onmidimessage","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onmute","onnavigate","onnavigateerror","onnavigatesuccess","onnegotiationneeded","onnomatch","onnotificationclick","onnotificationclose","onoffline","ononline","onopen","onorientationchange","onpagehide","onpagereveal","onpageshow","onpageswap","onpaste","onpause","onpayerdetailchange","onpaymentmethodchange","onpaymentrequest","onperiodicsync","onplay","onplaying","onpointercancel","onpointerdown","onpointerenter","onpointerleave","onpointerlockchange","onpointerlockerror","onpointermove","onpointerout","onpointerover","onpointerrawupdate","onpointerup","onpopstate","onportalactivate","onprerenderingchange","onprioritychange","onprocessorerror","onprogress","onpromptaction","onpromptdismiss","onpush","onpushsubscriptionchange","onquotaoverflow","onratechange","onreading","onreadingerror","onreadystatechange","onredraw","onreflectionchange","onrejectionhandled","onrelease","onremove","onremovesourcebuffer","onremovetrack","onrepeat","onreset","onresize","onresourcetimingbufferfull","onresult","onresume","onrtctransform","onscreenschange","onscroll","onscrollend","onsecuritypolicyviolation","onseeked","onseeking","onselect","onselectedcandidatepairchange","onselectend","onselectionchange","onselectstart","onserviceadded","onservicechanged","onserviceremoved","onshippingaddresschange","onshippingoptionchange","onshow","onsignalingstatechange","onsinkchange","onslotchange","onsnapchanged","onsnapchanging","onsoundend","onsoundstart","onsourceclose","onsourceended","onsourceopen","onspeechend","onspeechstart","onsqueeze","onsqueezeend","onsqueezestart","onstalled","onstart","onstartstreaming","onstatechange","onstop","onstorage","onstream","onsubmit","onsuccess","onsuspend","onsync","onterminate","ontextformatupdate","ontextupdate","ontimeout","ontimeupdate","ontoggle","ontonechange","ontoolactivated","ontoolcancel","ontoolchange","ontouchcancel","ontouchend","ontouchmove","ontouchstart","ontrack","ontransitioncancel","ontransitionend","ontransitionrun","ontransitionstart","onuncapturederror","onunhandledrejection","onunload","onunmute","onupdate","onupdateend","onupdatefound","onupdatestart","onupgradeneeded","onvalidationstatuschange","onversionchange","onvisibilitychange","onvoiceschanged","onvolumechange","onwaiting","onwaitingforkey","onwebkitanimationend","onwebkitanimationiteration","onwebkitanimationstart","onwebkittransitionend","onwheel","onzoomlevelchange"])});function ve(e,t,n,r,s){let o=t.normalize("NFC");if(o==="__proto__")throw _e(r,s,'"__proto__" cannot be a key: it would not be data');if(Object.hasOwn(e,o))throw _e(r,s,`"${o}" is written twice, and one of them would be lost`);e[o]=n}function _e(e,t,n){let r=ul(t)?.start;return new Rt(n,r===void 0?null:ii(e.text,r))}function ul(e){let t=ei(e);return t?{end:t.end.offset,start:t.start.offset}:null}function ht(e,t,n){let r=e.spans?ul(n):null;if(r)e.spans?.set(t,r)}function zy(e,t,n){let r=e.tokens&&n?ul(n):null;if(r)e.tokens?.names.set(t,r)}function Pt(e,t,n){let r=e.tokens&&n?ul(n.value):null;if(r){let s=n?.value.representation,o=s===void 0?r.start:r.end-s.length;e.tokens?.values.set(t,{end:r.end,start:o})}}function fs(e){return e.entries.filter((t)=>!t.name)}function Xe(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function ci(e,t){let n=t.getTag();if(n!==null&&!Xy.has(n))throw _e(e,t,`(${n}) is not an annotation Jx Notation has`);if(n==="ref")throw _e(e,t,"(ref) annotates a value, and this is a name");return n}function Vr(e,t){let n=t.getTag(),r=t.getValue();if(n!==null&&n!=="ref")throw _e(e,t,`(${n}) cannot annotate a value here; only (ref) can`);if(St(r)){if(!Number.isFinite(r))throw _e(e,t,"JSON has no way to hold #inf or #nan");if(Number.isInteger(r)&&!Number.isSafeInteger(r))throw _e(e,t,"This number is too large to survive being read as JSON")}if(n==="ref"){if(!k(r))throw _e(e,t,"(ref) needs a string");return{$ref:r}}return r}function On(e,t){return t.entries.filter((n)=>!n.name).map((n)=>Vr(e,n))}function An(e){return e.entries.filter((t)=>t.name)}function Ct(e){return e.children?.nodes??[]}function lr(e){return e.getName()??""}function nC(e,t,n){let r={$prototype:"Function"},s=On(e,t),o=Ct(t);for(let a of An(t))ve(r,lr(a),Vr(e,a),e,a),Pt(e,`${n}/${Xe(lr(a))}`,a);let i=e.tokens?fs(t):[];if(o.length>0){if(s.length>0)ve(r,"parameters",s,e,t);ve(r,"body",jd(e,o,`${n}/body`),e,t)}else if(s.length>0){let a=s.at(-1)??null,c=s.slice(0,-1);if(c.length>0)ve(r,"parameters",c,e,t);ve(r,"body",a,e,t),Pt(e,`${n}/body`,i.pop())}for(let[a,c]of i.entries())Pt(e,`${n}/parameters/${a}`,c);return ht(e,n,t),r}function rC(e,t,n){let r={$prototype:"Function",$src:"#client"};if(On(e,t).length>0||Ct(t).length>0)throw _e(e,t,"(export) names a function the document's script exports, and holds no body of its own");for(let s of An(t))ve(r,lr(s),Vr(e,s),e,s),Pt(e,`${n}/${Xe(lr(s))}`,s);if(!Object.hasOwn(r,"$export"))r.$export=t.getName().normalize("NFC");return ht(e,n,t),r}function sC(e,t,n){if(On(e,t).length>0||Ct(t).length>0)throw _e(e,t,"(server) names a function the document's server script exports. Its arguments are written name=value");let r={$export:t.getName().normalize("NFC"),$src:"#server",timing:"server"},s=An(t);if(s.length>0){let o={};for(let i of s){let a=lr(i);ve(o,a,Vr(e,i),e,i),ht(e,`${n}/arguments/${Xe(a)}`,i),Pt(e,`${n}/arguments/${Xe(a)}`,i)}r.arguments=o}return ht(e,n,t),r}function oC(e,t,n){let r={};for(let c of An(t)){let l=lr(c);if(ve(r,l,Vr(e,c),e,c),l!=="timing"||r[l]!=="server")throw _e(e,c,"A script takes timing=server, and nothing else")}let s=On(e,t),[o]=s;if(s.length!==1||!k(o)||Ct(t).length>0)throw _e(e,t,"A script holds one string, which is the text of its module");let i=Object.hasOwn(r,"timing")?"server":"client",a=n.$script;if(!V(a)||!Ky.has(a))a={},Ky.add(a),ve(n,"$script",a,e,t);ve(a,i,o,e,t),ht(e,`/$script/${i}`,t),Pt(e,`/$script/${i}`,fs(t)[0])}function Gy(e,t,n){for(let[r,s]of(e.tokens?fs(n):[]).entries())Pt(e,`${t}/${r}`,s)}function jd(e,t,n,r=0){return t.map((s,o)=>{if(s.getName()!=="-")throw _e(e,s,`A list holds only "-" items, and this is "${s.getName()}"`);return kn(e,s,`${n}/${r+o}`)})}function kn(e,t,n){let r=ci(e,t);if(ht(e,n,t),r==="fn")return nC(e,t,n);if(r==="export")return rC(e,t,n);if(r==="server")return sC(e,t,n);let s=On(e,t),o=An(t),i=Ct(t);if(r==="array"){if(o.length>0)throw _e(e,t,"(array) holds items, and these are named");return Gy(e,n,t),[...s,...jd(e,i,n,s.length)]}if(r!=="object"){if(s.length>1){if(o.length>0||i.length>0)throw _e(e,t,"A list of values cannot also have names or a block");return Gy(e,n,t),s}if(s.length===1){if(o.length>0||i.length>0)throw _e(e,t,"A value cannot also have names or a block");return Pt(e,n,fs(t)[0]),s[0]??null}if(i.length>0&&o.length===0&&i.every((c)=>c.getName()==="-"))return jd(e,i,n)}else if(s.length>0)throw _e(e,t,"(object) holds names, and this is a value");let a={};for(let c of o){let l=lr(c);ve(a,l,Vr(e,c),e,c),ht(e,`${n}/${Xe(l)}`,c),zy(e,`${n}/${Xe(l)}`,c.name),Pt(e,`${n}/${Xe(l)}`,c)}for(let c of i){let l=c.getName();ve(a,l,kn(e,c,`${n}/${Xe(l)}`),e,c),zy(e,`${n}/${Xe(l)}`,c.name)}return a}function fl(e,t,n){let r={};if(ht(e,n,t),On(e,t).length>0)throw _e(e,t,"A style block holds declarations, and this is a value");for(let s of An(t)){let o=lr(s);ve(r,o,Vr(e,s),e,s),ht(e,`${n}/${Xe(o)}`,s),Pt(e,`${n}/${Xe(o)}`,s)}for(let s of Ct(t)){let o=s.getName(),i=`${n}/${Xe(o)}`,a=Ct(s);if(s.getTag()==="array"||a.length>0&&a.every((l)=>l.getName()==="-")){ve(r,o,kn(e,s,i),e,s);continue}let c=On(e,s);if(c.length>1)throw _e(e,s,`"${o}" has more than one value. A selector with a space in it needs quotes`);if(c.length===1){if(An(s).length>0||Ct(s).length>0)throw _e(e,s,`"${o}" has a value and names. A selector with a space in it needs quotes`);ve(r,o,c[0]??null,e,s),ht(e,i,s),Pt(e,i,fs(s)[0])}else ve(r,o,fl(e,s,i),e,s)}return r}function ll(e,t,n){let r=Ct(t);if(r.length!==1||!r[0])throw _e(e,t,`"${t.getName()}" holds one element`);return Zy(e,r[0],n)}function Yy(e,t,n){let r={$prototype:"Array"};if(ht(e,n,t),On(e,t).length>0)throw _e(e,t,"$array holds names and one element, and this is a value");for(let s of An(t)){let o=lr(s),i=o.startsWith(".")?o.slice(1):o;ve(r,i,Vr(e,s),e,s),Pt(e,`${n}/${Xe(i)}`,s)}if(Ct(t).length>0)ve(r,"map",ll(e,t,`${n}/map`),e,t);return r}function Zy(e,t,n){let r=t.getName();if(r==="-"){let s=On(e,t);if(s.length!==1||An(t).length>0||Ct(t).length>0)throw _e(e,t,'"-" is one piece of text or one (ref)');return ht(e,n,t),Pt(e,n,fs(t)[0]),s[0]??null}if(r==="$array")return Yy(e,t,n);return Pd(e,t,n)}function iC(e,t,n,r){let s=ci(e,n);if(t==="map")return ll(e,n,r);if(t==="cases"){let o={};for(let i of Ct(n)){let a=i.getName();ve(o,a,ll(e,i,`${r}/${Xe(a)}`),e,i)}return o}if(t==="children"&&s!=="array"&&Ct(n).length>0)return ll(e,n,r);return kn(e,n,r)}function Pd(e,t,n){let r={},s=t.getName(),o=ci(e,t);if(ht(e,n,t),o!==null)throw _e(e,t,`(${o}) cannot annotate an element`);let i=On(e,t);if(s==="$element"){let[c,l,...u]=i;if(u.length>0)throw _e(e,t,"$element takes at most a tag and a text value");if(c!==void 0)ve(r,"tagName",c,e,t);if(l!==void 0)ve(r,"textContent",l,e,t),Pt(e,`${n}/textContent`,fs(t)[1])}else{if(s.startsWith("$"))throw _e(e,t,`"${s}" is not a kind of element`);if(ve(r,"tagName",s,e,t),i.length>1)throw _e(e,t,"An element has one text value. A list of them needs a block");if(i[0]!==void 0)ve(r,"textContent",i[0],e,t),ht(e,`${n}/textContent`,t),Pt(e,`${n}/textContent`,fs(t)[0])}aC(e,t,r,n);let a=[];for(let c of Ct(t))cC(e,c,r,a,n);if(a.length>0)ve(r,"children",a,e,t);return r}function Qy(e){let{attributes:t}=e;if(V(t))return t;let n={};return e.attributes=n,n}function aC(e,t,n,r){for(let s of An(t)){let o=lr(s),i=s.getTag();if(i==="fn")throw _e(e,s,"A function has a block form: (fn)name, on a line of its own");let a=Vr(e,s);if(o.startsWith(".")||o.startsWith("$")){let c=o.startsWith(".")?o.slice(1):o;ve(n,c,a,e,s),ht(e,`${r}/${Xe(c)}`,s),Pt(e,`${r}/${Xe(c)}`,s)}else if(o.startsWith("on")&&i==="ref")ve(n,o,a,e,s),ht(e,`${r}/${Xe(o)}`,s),Pt(e,`${r}/${Xe(o)}`,s);else if(o.startsWith("on")&&Uy.has(o))throw _e(e,s,`${o} needs (ref)"pointer", or a function on a line of its own: (fn)${o} "…"`);else ve(Qy(n),o,a,e,s),ht(e,`${r}/attributes/${Xe(o)}`,s),Pt(e,`${r}/attributes/${Xe(o)}`,s)}}function cC(e,t,n,r,s){let o=t.getName(),i=ci(e,t),a=(c)=>`${s}/${Xe(c)}`;if(i==="fn"||i==="on"){if(!o.startsWith("on"))throw _e(e,t,`(${i}) in an element marks a handler, and "${o}" is not one`);ve(n,o,kn(e,t,a(o)),e,t)}else if(o==="script"){if(s!=="")throw _e(e,t,`"script" is the document's module, and is written in its root element. A <script> element is $element "script"`);if(i!==null)throw _e(e,t,`(${i}) cannot annotate a script`);oC(e,t,n)}else if(o==="state")ve(n,"state",kn(e,t,a("state")),e,t);else if(o==="style")ve(n,"style",fl(e,t,a("style")),e,t);else if(o==="attributes"){let c=kn(e,t,a("attributes"));if(V(c))for(let[l,u]of Object.entries(c))ve(Qy(n),l,u,e,t);else ve(n,"attributes",c,e,t)}else if(o.startsWith(".")){let c=o.slice(1);ve(n,c,iC(e,c,t,a(c)),e,t)}else if(o.startsWith("$")&&o!=="$array"&&o!=="$element")ve(n,o,kn(e,t,a(o)),e,t);else{if(tC.has(o))throw _e(e,t,`"${o}" is reserved here`);r.push(Zy(e,t,`${s}/children/${r.length}`))}}function _d(e,t){return Ct(t).map((n,r)=>{let s=`/$head/${r}`;return n.getName()==="-"?kn(e,n,s):Pd(e,n,s)})}function kd(e){let t=eC.exec(e);if(t)throw new Rt(`A raw control character (U+${t[0].codePointAt(0)?.toString(16).toUpperCase().padStart(4,"0")}) cannot be in a Jx Notation file. Escape it, as \\u{1b}`,ii(e,t.index));try{return us(e,{storeLocations:!0})}catch(n){let s=(n instanceof Re?n.errors?.[0]??n:null)?.start,o=n instanceof Error?n.message:String(n);throw new Rt(o.split(`
22
- `)[0]??o,s?ii(e,s.offset):null)}}function ex(e){if(zo(e.text)==="project")throw new Rt('This is a project file: its first node is "project". A document has an element there, and a <project> element is $element "project"');let n=kd(e.text),r={},s=null;for(let o of n.nodes){let i=o.getName();if(i==="$head"&&o.getTag()===null)ve(r,i,_d(e,o),e,o);else if(i.startsWith("$")&&i!=="$array"&&i!=="$element")ve(r,i,kn(e,o,`/${Xe(i)}`),e,o),ht(e,`/${Xe(i)}`,o);else if(s)throw _e(e,o,"A document has one root element, and this is a second");else s=o}if(s){let o=s.getName()==="$array"?Yy(e,s,""):Pd(e,s,"");for(let[i,a]of Object.entries(o))ve(r,i,a,e,s)}return Uo(r)}function fo(e,t){try{return ex({spans:null,text:e})}catch(n){throw t!==void 0&&n instanceof Rt?n.inFile(t):n}}function Od(e){let t=new Map;return{document:ex({spans:t,text:e}),spans:t}}var eC,Xy,tC,Ky;var Ca=T(()=>{cl();le();Dt();Sa();ai();By();eC=/(?![\t\n\v\f\r])\p{Cc}/u,Xy=new Set(["array","export","fn","object","on","ref","server"]),tC=new Set(["attributes","script","state","style"]);Ky=new WeakSet});function qr(e){return e.toLowerCase().endsWith(".jxn")}function Wr(e){return e.endsWith(".json")||qr(e)}function Kn(e,t){return qr(t)?fo(e,t):Xg(e,t)}var dl=T(()=>{Dt();Ca()});function fC(e){let t={comments:0,escapes:[]},n=uC.exec(e)?.[0].length??0;while(n<e.length)if(e.startsWith("//",n)){t.comments+=1;let r=e.indexOf(`
23
- `,n);n=r===-1?e.length:r}else if(e.startsWith("/*",n)){t.comments+=1;let r=e.indexOf("*/",n+2);n=r===-1?e.length:r+2}else if(e.startsWith("/-",n))t.comments+=1,n+=2;else if(e.charAt(n)==="#"&&/^#+"/u.test(e.slice(n,n+16))){let[r=""]=/^#+/u.exec(e.slice(n))??[],s=n+r.length,o=e.startsWith('"""',s)?'"""':'"',i=e.indexOf(o+r,s+o.length);n=i===-1?e.length:i+o.length+r.length}else if(e.charAt(n)==='"'){let r=e.startsWith('"""',n)?'"""':'"';n+=r.length;while(n<e.length&&!e.startsWith(r,n))if(e.charAt(n)==="\\")t.escapes.push(n),n+=2;else n+=1;n+=r.length}else n+=1;return t}function Ad(e){return fC(e).escapes.flatMap((t)=>{let n=lC.get(e.charAt(t+1));return n?[{...ii(e,t),message:n}]:[]})}var lC,uC;var tx=T(()=>{ai();lC=new Map([["b",String.raw`\b in a quoted string is a backspace, not a word boundary. Use a raw string, like #"…"#, if this is a pattern.`],["s",String.raw`\s in a quoted string is a space, not whitespace. Use a raw string, like #"…"#, if this is a pattern.`]]),uC=/^\uFEFF?\s*\/-[^\S\n]*kdl-version[^\S\n]+\d+[^\S\n]*(?:\n|$)/u});function li(e,t=!1){if(Array.isArray(e))return`[${e.map((s)=>li(s,t)).join(",")}]`;if(!V(e))return e===void 0?"null":JSON.stringify(e);return`{${(t?Object.keys(e):Object.keys(e).toSorted()).map((s)=>`${JSON.stringify(s)}:${li(e[s],t||s==="style")}`).join(",")}}`}function dC(e,t){let n=e;for(let r of t.split("/").slice(1)){let s=r.replaceAll("~1","/").replaceAll("~0","~");if(Array.isArray(n))n=n[Number(s)];else n=V(n)?n[s]:void 0}return n}function pC({spans:e}){let t=new Map;for(let[n,r]of e){let s=t.get(r.start);if(s===void 0||n.length<s.length)t.set(r.start,n)}return t}function nx(e,t){let n=pC(e),r=new Map;for(let[s,o]of n)r.set(s,li(dC(e.document,o)));return{meanings:r,pointers:n,text:t}}function Hr(e){let t=ei(e);return{end:t?.end.offset??0,start:t?.start.offset??0}}function ml(e,t){let{end:n,start:r}=Hr(e);return t.slice(r,n).trimEnd()}function pl(e,t){let{end:n,start:r}=Hr(e);return`${e.leading??" "}${t.slice(r,n).trimEnd()}`}function Td(e){return e.children?.nodes??[]}function Rd(e){let t=e.entries.map((o)=>`${o.getName()??""}=(${o.getTag()??""})${JSON.stringify(o.getValue())}`),n=t.filter((o)=>!o.startsWith("=")).toSorted(),r=t.filter((o)=>o.startsWith("=")),s=Td(e).map((o)=>Rd(o));return`(${e.getTag()??""})${e.getName()} ${[...n,...r].join(" ")} {${s.join(";")}}`}function Cd(e,t,n){if(Rd(t)===Rd(n))return!0;let r=e.previous.meanings.get(Hr(t).start);return r!==void 0&&r===e.next.meanings.get(Hr(n).start)}function rx(e){let n=e.entries.filter((r)=>["$id","key"].includes(r.getName()??"")).map((r)=>JSON.stringify(r.getValue()));return`(${e.getTag()??""})${e.getName()} ${n.join(" ")}`}function sx(e,t,n){let r=e.length+1,s=t.length+1,o=new Int32Array(r*s);for(let l=e.length-1;l>=0;l-=1)for(let u=t.length-1;u>=0;u-=1){let d=e[l],p=t[u];o[l*s+u]=d!==void 0&&p!==void 0&&n(d,p)?(o[(l+1)*s+u+1]??0)+1:Math.max(o[(l+1)*s+u]??0,o[l*s+u+1]??0)}let i=[],a=0,c=0;while(a<e.length&&c<t.length){let l=e[a],u=t[c];if(l!==void 0&&u!==void 0&&n(l,u))i.push([a,c]),a+=1,c+=1;else if((o[(a+1)*s+c]??0)>=(o[a*s+c+1]??0))a+=1;else c+=1}return i}function mC(e,t,n){let r=new Map,s=new Set,o=(l,u)=>{let d=t[l];if(d)r.set(u,d),s.add(l)},i=sx(t,n,(l,u)=>Cd(e,l,u)),a=0,c=0;for(let[l,u]of[...i,[t.length,n.length]]){let d=sx(t.slice(a,l),n.slice(c,u),(p,m)=>rx(p)===rx(m));for(let[p,m]of d)o(a+p,c+m);if(l<t.length)o(l,u);a=l+1,c=u+1}for(let[l,u]of n.entries())if(!r.has(l)){let d=t.findIndex((p,m)=>!s.has(m)&&Cd(e,p,u));if(d!==-1)o(d,l)}return r}function Jd(e){let t=e.leading??"";return t.slice(t.lastIndexOf(`
24
- `)+1)}function hC(e,t,n){return e.split(`
21
+ `),line:r,offset:t}}var Nt;var ri=R(()=>{Nt=class Nt extends Error{column;line;offset;reason;constructor(e,t=null){super(t?`${e} (line ${t.line}, column ${t.column})`:e);this.name="JxnError",this.column=t?.column??null,this.line=t?.line??null,this.offset=t?.offset??null,this.reason=e}inFile(e){let t=this.line!==null&&this.column!==null&&this.offset!==null?{column:this.column,line:this.line,offset:this.offset}:null;return new Nt(`${e}: ${this.reason}`,t)}}});var Hb;var Ub=R(()=>{Hb=new Set(["onabort","onactivate","onaddsourcebuffer","onaddtrack","onadvertisementreceived","onafterprint","onanimationcancel","onanimationend","onanimationiteration","onanimationstart","onappinstalled","onaudioend","onaudioprocess","onaudiostart","onauxclick","onavailabilitychanged","onbackgroundfetchabort","onbackgroundfetchclick","onbackgroundfetchfail","onbackgroundfetchsuccess","onbeforeinput","onbeforeinstallprompt","onbeforematch","onbeforeprint","onbeforetoggle","onbeforexrselect","onbegin","onblocked","onblur","onboundary","onbufferedamountlow","onbufferedchange","oncancel","oncanmakepayment","oncanplay","oncanplaythrough","oncaptureaction","oncapturedmousechange","oncapturehandlechange","onchange","oncharacterboundsupdate","oncharacteristicvaluechanged","onchargingchange","onchargingtimechange","onclick","onclose","onclosing","oncommand","oncomplete","oncompositionend","oncompositionstart","onconfigurationchange","onconnect","onconnecting","onconnectionavailable","onconnectionstatechange","oncontentdelete","oncontextlost","oncontextmenu","oncontextoverflow","oncontextrestored","oncontrollerchange","oncookiechange","oncopy","oncsrcchange","oncuechange","oncurrententrychange","oncurrentscreenchange","oncut","ondataavailable","ondatachannel","ondblclick","ondequeue","ondevicechange","ondevicemotion","ondeviceorientation","ondeviceorientationabsolute","ondischargingtimechange","ondisconnect","ondispose","ondownloadprogress","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onencrypted","onend","onended","onendstreaming","onenter","onenterpictureinpicture","onerror","onexit","onfencedtreeclick","onfetch","onfinish","onfocus","onformdata","onframeratechange","onfreeze","onfullscreenchange","onfullscreenerror","ongamepadconnected","ongamepaddisconnected","ongatheringstatechange","ongattserverdisconnected","ongeometrychange","ongotpointercapture","onhashchange","onicecandidate","onicecandidateerror","onicecandidatepairadd","onicecandidatepairnominate","onicecandidatepairremove","oniceconnectionstatechange","onicegatheringstatechange","oninput","oninputreport","oninputsourceschange","oninstall","oninstallresult","oninvalid","onisolationchange","onkeydown","onkeyframerequest","onkeypress","onkeystatuseschange","onkeyup","onlanguagechange","onlayoutchange","onleavepictureinpicture","onlevelchange","onload","onloadeddata","onloadedmetadata","onloadend","onloading","onloadingdone","onloadingerror","onloadstart","onlocation","onlostpointercapture","onmanagedconfigurationchange","onmark","onmessage","onmessageerror","onmidimessage","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onmute","onnavigate","onnavigateerror","onnavigatesuccess","onnegotiationneeded","onnomatch","onnotificationclick","onnotificationclose","onoffline","ononline","onopen","onorientationchange","onpagehide","onpagereveal","onpageshow","onpageswap","onpaste","onpause","onpayerdetailchange","onpaymentmethodchange","onpaymentrequest","onperiodicsync","onplay","onplaying","onpointercancel","onpointerdown","onpointerenter","onpointerleave","onpointerlockchange","onpointerlockerror","onpointermove","onpointerout","onpointerover","onpointerrawupdate","onpointerup","onpopstate","onportalactivate","onprerenderingchange","onprioritychange","onprocessorerror","onprogress","onpromptaction","onpromptdismiss","onpush","onpushsubscriptionchange","onquotaoverflow","onratechange","onreading","onreadingerror","onreadystatechange","onredraw","onreflectionchange","onrejectionhandled","onrelease","onremove","onremovesourcebuffer","onremovetrack","onrepeat","onreset","onresize","onresourcetimingbufferfull","onresult","onresume","onrtctransform","onscreenschange","onscroll","onscrollend","onsecuritypolicyviolation","onseeked","onseeking","onselect","onselectedcandidatepairchange","onselectend","onselectionchange","onselectstart","onserviceadded","onservicechanged","onserviceremoved","onshippingaddresschange","onshippingoptionchange","onshow","onsignalingstatechange","onsinkchange","onslotchange","onsnapchanged","onsnapchanging","onsoundend","onsoundstart","onsourceclose","onsourceended","onsourceopen","onspeechend","onspeechstart","onsqueeze","onsqueezeend","onsqueezestart","onssrcchange","onstalled","onstart","onstartstreaming","onstatechange","onstop","onstorage","onstream","onsubmit","onsuccess","onsuspend","onsync","onterminate","ontextformatupdate","ontextupdate","ontimeout","ontimeupdate","ontoggle","ontonechange","ontoolactivated","ontoolcancel","ontoolchange","ontouchcancel","ontouchend","ontouchmove","ontouchstart","ontrack","ontransitioncancel","ontransitionend","ontransitionrun","ontransitionstart","onuncapturederror","onunhandledrejection","onunload","onunmute","onupdate","onupdateend","onupdatefound","onupdatestart","onupgradeneeded","onvalidationstatuschange","onversionchange","onvisibilitychange","onvoiceschanged","onvolumechange","onwaiting","onwaitingforkey","onwebkitanimationend","onwebkitanimationiteration","onwebkitanimationstart","onwebkittransitionend","onwheel","onzoomlevelchange"])});function we(e,t,n,r,s){let o=t.normalize("NFC");if(o==="__proto__")throw Pe(r,s,'"__proto__" cannot be a key: it would not be data');if(Object.hasOwn(e,o))throw Pe(r,s,`"${o}" is written twice, and one of them would be lost`);e[o]=n}function Pe(e,t,n){let r=wl(t)?.start;return new Nt(n,r===void 0?null:ni(e.text,r))}function wl(e){let t=Xo(e);return t?{end:t.end.offset,start:t.start.offset}:null}function mt(e,t,n){let r=e.spans?wl(n):null;if(r)e.spans?.set(t,r)}function Bb(e,t,n){let r=e.tokens&&n?wl(n):null;if(r)e.tokens?.names.set(t,r)}function Ot(e,t,n){let r=e.tokens&&n?wl(n.value):null;if(r){let s=n?.value.representation,o=s===void 0?r.start:r.end-s.length;e.tokens?.values.set(t,{end:r.end,start:o})}}function ps(e){return e.entries.filter((t)=>!t.name)}function ze(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function si(e,t){let n=t.getTag();if(n!==null&&!Gb.has(n))throw Pe(e,t,`(${n}) is not an annotation Jx Notation has`);if(n==="ref")throw Pe(e,t,"(ref) annotates a value, and this is a name");return n}function qr(e,t){let n=t.getTag(),r=t.getValue();if(n!==null&&n!=="ref")throw Pe(e,t,`(${n}) cannot annotate a value here; only (ref) can`);if(We(r)){if(!Number.isFinite(r))throw Pe(e,t,"JSON has no way to hold #inf or #nan");if(Number.isInteger(r)&&!Number.isSafeInteger(r))throw Pe(e,t,"This number is too large to survive being read as JSON")}if(n==="ref"){if(!k(r))throw Pe(e,t,"(ref) needs a string");return{$ref:r}}return r}function kn(e,t){return t.entries.filter((n)=>!n.name).map((n)=>qr(e,n))}function On(e){return e.entries.filter((t)=>t.name)}function Tt(e){return e.children?.nodes??[]}function pr(e){return e.getName()??""}function iN(e,t,n){let r={$prototype:"Function"},s=kn(e,t),o=Tt(t);for(let a of On(t))we(r,pr(a),qr(e,a),e,a),Ot(e,`${n}/${ze(pr(a))}`,a);let i=e.tokens?ps(t):[];if(o.length>0){if(s.length>0)we(r,"parameters",s,e,t);we(r,"body",Zd(e,o,`${n}/body`),e,t)}else if(s.length>0){let a=s.at(-1)??null,c=s.slice(0,-1);if(c.length>0)we(r,"parameters",c,e,t);we(r,"body",a,e,t),Ot(e,`${n}/body`,i.pop())}for(let[a,c]of i.entries())Ot(e,`${n}/parameters/${a}`,c);return mt(e,n,t),r}function aN(e,t,n){let r={$prototype:"Function",$src:"#client"};if(kn(e,t).length>0||Tt(t).length>0)throw Pe(e,t,"(export) names a function the document's script exports, and holds no body of its own");for(let s of On(t))we(r,pr(s),qr(e,s),e,s),Ot(e,`${n}/${ze(pr(s))}`,s);if(!Object.hasOwn(r,"$export"))r.$export=t.getName().normalize("NFC");return mt(e,n,t),r}function cN(e,t,n){if(kn(e,t).length>0||Tt(t).length>0)throw Pe(e,t,"(server) names a function the document's server script exports. Its arguments are written name=value");let r={$export:t.getName().normalize("NFC"),$src:"#server",timing:"server"},s=On(t);if(s.length>0){let o={};for(let i of s){let a=pr(i);we(o,a,qr(e,i),e,i),mt(e,`${n}/arguments/${ze(a)}`,i),Ot(e,`${n}/arguments/${ze(a)}`,i)}r.arguments=o}return mt(e,n,t),r}function lN(e,t,n){let r={};for(let c of On(t)){let l=pr(c);if(we(r,l,qr(e,c),e,c),l!=="timing"||r[l]!=="server")throw Pe(e,c,"A script takes timing=server, and nothing else")}let s=kn(e,t),[o]=s;if(s.length!==1||!k(o)||Tt(t).length>0)throw Pe(e,t,"A script holds one string, which is the text of its module");let i=Object.hasOwn(r,"timing")?"server":"client",a=n.$script;if(!L(a)||!zb.has(a))a={},zb.add(a),we(n,"$script",a,e,t);we(a,i,o,e,t),mt(e,`/$script/${i}`,t),Ot(e,`/$script/${i}`,ps(t)[0])}function Kb(e,t,n){for(let[r,s]of(e.tokens?ps(n):[]).entries())Ot(e,`${t}/${r}`,s)}function Zd(e,t,n,r=0){return t.map((s,o)=>{if(s.getName()!=="-")throw Pe(e,s,`A list holds only "-" items, and this is "${s.getName()}"`);return _n(e,s,`${n}/${r+o}`)})}function _n(e,t,n){let r=si(e,t);if(mt(e,n,t),r==="fn")return iN(e,t,n);if(r==="export")return aN(e,t,n);if(r==="server")return cN(e,t,n);let s=kn(e,t),o=On(t),i=Tt(t);if(r==="array"){if(o.length>0)throw Pe(e,t,"(array) holds items, and these are named");return Kb(e,n,t),[...s,...Zd(e,i,n,s.length)]}if(r!=="object"){if(s.length>1){if(o.length>0||i.length>0)throw Pe(e,t,"A list of values cannot also have names or a block");return Kb(e,n,t),s}if(s.length===1){if(o.length>0||i.length>0)throw Pe(e,t,"A value cannot also have names or a block");return Ot(e,n,ps(t)[0]),s[0]??null}if(i.length>0&&o.length===0&&i.every((c)=>c.getName()==="-"))return Zd(e,i,n)}else if(s.length>0)throw Pe(e,t,"(object) holds names, and this is a value");let a={};for(let c of o){let l=pr(c);we(a,l,qr(e,c),e,c),mt(e,`${n}/${ze(l)}`,c),Bb(e,`${n}/${ze(l)}`,c.name),Ot(e,`${n}/${ze(l)}`,c)}for(let c of i){let l=c.getName();we(a,l,_n(e,c,`${n}/${ze(l)}`),e,c),Bb(e,`${n}/${ze(l)}`,c.name)}return a}function vl(e,t,n){let r={};if(mt(e,n,t),kn(e,t).length>0)throw Pe(e,t,"A style block holds declarations, and this is a value");for(let s of On(t)){let o=pr(s);we(r,o,qr(e,s),e,s),mt(e,`${n}/${ze(o)}`,s),Ot(e,`${n}/${ze(o)}`,s)}for(let s of Tt(t)){let o=s.getName(),i=`${n}/${ze(o)}`,a=Tt(s);if(s.getTag()==="array"||a.length>0&&a.every((l)=>l.getName()==="-")){we(r,o,_n(e,s,i),e,s);continue}let c=kn(e,s);if(c.length>1)throw Pe(e,s,`"${o}" has more than one value. A selector with a space in it needs quotes`);if(c.length===1){if(On(s).length>0||Tt(s).length>0)throw Pe(e,s,`"${o}" has a value and names. A selector with a space in it needs quotes`);we(r,o,c[0]??null,e,s),mt(e,i,s),Ot(e,i,ps(s)[0])}else we(r,o,vl(e,s,i),e,s)}return r}function Sl(e,t,n){let r=Tt(t);if(r.length!==1||!r[0])throw Pe(e,t,`"${t.getName()}" holds one element`);return Yb(e,r[0],n)}function Xb(e,t,n){let r={$prototype:"Array"};if(mt(e,n,t),kn(e,t).length>0)throw Pe(e,t,"$array holds names and one element, and this is a value");for(let s of On(t)){let o=pr(s),i=o.startsWith(".")?o.slice(1):o;we(r,i,qr(e,s),e,s),Ot(e,`${n}/${ze(i)}`,s)}if(Tt(t).length>0)we(r,"map",Sl(e,t,`${n}/map`),e,t);return r}function Yb(e,t,n){let r=t.getName();if(r==="-"){let s=kn(e,t);if(s.length!==1||On(t).length>0||Tt(t).length>0)throw Pe(e,t,'"-" is one piece of text or one (ref)');return mt(e,n,t),Ot(e,n,ps(t)[0]),s[0]??null}if(r==="$array")return Xb(e,t,n);return Qd(e,t,n)}function uN(e,t,n,r){let s=si(e,n);if(t==="map")return Sl(e,n,r);if(t==="cases"){let o={};for(let i of Tt(n)){let a=i.getName();we(o,a,Sl(e,i,`${r}/${ze(a)}`),e,i)}return o}if(t==="children"&&s!=="array"&&Tt(n).length>0)return Sl(e,n,r);return _n(e,n,r)}function Qd(e,t,n){let r={},s=t.getName(),o=si(e,t);if(mt(e,n,t),o!==null)throw Pe(e,t,`(${o}) cannot annotate an element`);let i=kn(e,t);if(s==="$element"){let[c,l,...u]=i;if(u.length>0)throw Pe(e,t,"$element takes at most a tag and a text value");if(c!==void 0)we(r,"tagName",c,e,t);if(l!==void 0)we(r,"textContent",l,e,t),Ot(e,`${n}/textContent`,ps(t)[1])}else{if(s.startsWith("$"))throw Pe(e,t,`"${s}" is not a kind of element`);if(we(r,"tagName",s,e,t),i.length>1)throw Pe(e,t,"An element has one text value. A list of them needs a block");if(i[0]!==void 0)we(r,"textContent",i[0],e,t),mt(e,`${n}/textContent`,t),Ot(e,`${n}/textContent`,ps(t)[0])}fN(e,t,r,n);let a=[];for(let c of Tt(t))dN(e,c,r,a,n);if(a.length>0)we(r,"children",a,e,t);return r}function Zb(e){let{attributes:t}=e;if(L(t))return t;let n={};return e.attributes=n,n}function fN(e,t,n,r){for(let s of On(t)){let o=pr(s),i=s.getTag();if(i==="fn")throw Pe(e,s,"A function has a block form: (fn)name, on a line of its own");let a=qr(e,s);if(o.startsWith(".")||o.startsWith("$")){let c=o.startsWith(".")?o.slice(1):o;we(n,c,a,e,s),mt(e,`${r}/${ze(c)}`,s),Ot(e,`${r}/${ze(c)}`,s)}else if(o.startsWith("on")&&i==="ref")we(n,o,a,e,s),mt(e,`${r}/${ze(o)}`,s),Ot(e,`${r}/${ze(o)}`,s);else if(o.startsWith("on")&&Hb.has(o))throw Pe(e,s,`${o} needs (ref)"pointer", or a function on a line of its own: (fn)${o} "…"`);else we(Zb(n),o,a,e,s),mt(e,`${r}/attributes/${ze(o)}`,s),Ot(e,`${r}/attributes/${ze(o)}`,s)}}function dN(e,t,n,r,s){let o=t.getName(),i=si(e,t),a=(c)=>`${s}/${ze(c)}`;if(i==="fn"||i==="on"){if(!o.startsWith("on"))throw Pe(e,t,`(${i}) in an element marks a handler, and "${o}" is not one`);we(n,o,_n(e,t,a(o)),e,t)}else if(o==="script"){if(s!=="")throw Pe(e,t,`"script" is the document's module, and is written in its root element. A <script> element is $element "script"`);if(i!==null)throw Pe(e,t,`(${i}) cannot annotate a script`);lN(e,t,n)}else if(o==="state")we(n,"state",_n(e,t,a("state")),e,t);else if(o==="style")we(n,"style",vl(e,t,a("style")),e,t);else if(o==="attributes"){let c=_n(e,t,a("attributes"));if(L(c))for(let[l,u]of Object.entries(c))we(Zb(n),l,u,e,t);else we(n,"attributes",c,e,t)}else if(o.startsWith(".")){let c=o.slice(1);we(n,c,uN(e,c,t,a(c)),e,t)}else if(o.startsWith("$")&&o!=="$array"&&o!=="$element")we(n,o,_n(e,t,a(o)),e,t);else{if(oN.has(o))throw Pe(e,t,`"${o}" is reserved here`);r.push(Yb(e,t,`${s}/children/${r.length}`))}}function ep(e,t){return Tt(t).map((n,r)=>{let s=`/$head/${r}`;return n.getName()==="-"?_n(e,n,s):Qd(e,n,s)})}function tp(e){let t=sN.exec(e);if(t)throw new Nt(`A raw control character (U+${t[0].codePointAt(0)?.toString(16).toUpperCase().padStart(4,"0")}) cannot be in a Jx Notation file. Escape it, as \\u{1b}`,ni(e,t.index));try{return ds(e,{storeLocations:!0})}catch(n){let s=(n instanceof Oe?n.errors?.[0]??n:null)?.start,o=n instanceof Error?n.message:String(n);throw new Nt(o.split(`
22
+ `)[0]??o,s?ni(e,s.offset):null)}}function Qb(e){if(Wo(e.text)==="project")throw new Nt('This is a project file: its first node is "project". A document has an element there, and a <project> element is $element "project"');let n=tp(e.text),r={},s=null;for(let o of n.nodes){let i=o.getName();if(i==="$head"&&o.getTag()===null)we(r,i,ep(e,o),e,o);else if(i.startsWith("$")&&i!=="$array"&&i!=="$element")we(r,i,_n(e,o,`/${ze(i)}`),e,o),mt(e,`/${ze(i)}`,o);else if(s)throw Pe(e,o,"A document has one root element, and this is a second");else s=o}if(s){let o=s.getName()==="$array"?Xb(e,s,""):Qd(e,s,"");for(let[i,a]of Object.entries(o))we(r,i,a,e,s)}return Vo(r)}function mo(e,t){try{return Qb({spans:null,text:e})}catch(n){throw t!==void 0&&n instanceof Nt?n.inFile(t):n}}function np(e){let t=new Map;return{document:Qb({spans:t,text:e}),spans:t}}var sN,Gb,oN,zb;var Oa=R(()=>{$l();le();Rt();ba();ri();Ub();sN=/(?![\t\n\v\f\r])\p{Cc}/u,Gb=new Set(["array","export","fn","object","on","ref","server"]),oN=new Set(["attributes","script","state","style"]);zb=new WeakSet});function Wr(e){return e.toLowerCase().endsWith(".jxn")}function Hr(e){return e.endsWith(".json")||Wr(e)}function Bn(e,t){return Wr(t)?mo(e,t):Gx(e,t)}var El=R(()=>{Rt();Oa()});function hN(e){let t={comments:0,escapes:[]},n=mN.exec(e)?.[0].length??0;while(n<e.length)if(e.startsWith("//",n)){t.comments+=1;let r=e.indexOf(`
23
+ `,n);n=r===-1?e.length:r}else if(e.startsWith("/*",n)){t.comments+=1;let r=e.indexOf("*/",n+2);n=r===-1?e.length:r+2}else if(e.startsWith("/-",n))t.comments+=1,n+=2;else if(e.charAt(n)==="#"&&/^#+"/u.test(e.slice(n,n+16))){let[r=""]=/^#+/u.exec(e.slice(n))??[],s=n+r.length,o=e.startsWith('"""',s)?'"""':'"',i=e.indexOf(o+r,s+o.length);n=i===-1?e.length:i+o.length+r.length}else if(e.charAt(n)==='"'){let r=e.startsWith('"""',n)?'"""':'"';n+=r.length;while(n<e.length&&!e.startsWith(r,n))if(e.charAt(n)==="\\")t.escapes.push(n),n+=2;else n+=1;n+=r.length}else n+=1;return t}function rp(e){return hN(e).escapes.flatMap((t)=>{let n=pN.get(e.charAt(t+1));return n?[{...ni(e,t),message:n}]:[]})}var pN,mN;var e$=R(()=>{ri();pN=new Map([["b",String.raw`\b in a quoted string is a backspace, not a word boundary. Use a raw string, like #"…"#, if this is a pattern.`],["s",String.raw`\s in a quoted string is a space, not whitespace. Use a raw string, like #"…"#, if this is a pattern.`]]),mN=/^\uFEFF?\s*\/-[^\S\n]*kdl-version[^\S\n]+\d+[^\S\n]*(?:\n|$)/u});function oi(e,t=!1){if(Array.isArray(e))return`[${e.map((s)=>oi(s,t)).join(",")}]`;if(!L(e))return e===void 0?"null":JSON.stringify(e);return`{${(t?Object.keys(e):Object.keys(e).toSorted()).map((s)=>`${JSON.stringify(s)}:${oi(e[s],t||s==="style")}`).join(",")}}`}function gN(e,t){let n=e;for(let r of t.split("/").slice(1)){let s=r.replaceAll("~1","/").replaceAll("~0","~");if(Array.isArray(n))n=n[Number(s)];else n=L(n)?n[s]:void 0}return n}function yN({spans:e}){let t=new Map;for(let[n,r]of e){let s=t.get(r.start);if(s===void 0||n.length<s.length)t.set(r.start,n)}return t}function t$(e,t){let n=yN(e),r=new Map;for(let[s,o]of n)r.set(s,oi(gN(e.document,o)));return{meanings:r,pointers:n,text:t}}function Ur(e){let t=Xo(e);return{end:t?.end.offset??0,start:t?.start.offset??0}}function Pl(e,t){let{end:n,start:r}=Ur(e);return t.slice(r,n).trimEnd()}function jl(e,t){let{end:n,start:r}=Ur(e);return`${e.leading??" "}${t.slice(r,n).trimEnd()}`}function ap(e){return e.children?.nodes??[]}function sp(e){let t=e.entries.map((o)=>`${o.getName()??""}=(${o.getTag()??""})${JSON.stringify(o.getValue())}`),n=t.filter((o)=>!o.startsWith("=")).toSorted(),r=t.filter((o)=>o.startsWith("=")),s=ap(e).map((o)=>sp(o));return`(${e.getTag()??""})${e.getName()} ${[...n,...r].join(" ")} {${s.join(";")}}`}function op(e,t,n){if(sp(t)===sp(n))return!0;let r=e.previous.meanings.get(Ur(t).start);return r!==void 0&&r===e.next.meanings.get(Ur(n).start)}function n$(e){let n=e.entries.filter((r)=>["$id","key"].includes(r.getName()??"")).map((r)=>JSON.stringify(r.getValue()));return`(${e.getTag()??""})${e.getName()} ${n.join(" ")}`}function r$(e,t,n){let r=e.length+1,s=t.length+1,o=new Int32Array(r*s);for(let l=e.length-1;l>=0;l-=1)for(let u=t.length-1;u>=0;u-=1){let d=e[l],p=t[u];o[l*s+u]=d!==void 0&&p!==void 0&&n(d,p)?(o[(l+1)*s+u+1]??0)+1:Math.max(o[(l+1)*s+u]??0,o[l*s+u+1]??0)}let i=[],a=0,c=0;while(a<e.length&&c<t.length){let l=e[a],u=t[c];if(l!==void 0&&u!==void 0&&n(l,u))i.push([a,c]),a+=1,c+=1;else if((o[(a+1)*s+c]??0)>=(o[a*s+c+1]??0))a+=1;else c+=1}return i}function xN(e,t,n){let r=new Map,s=new Set,o=(l,u)=>{let d=t[l];if(d)r.set(u,d),s.add(l)},i=r$(t,n,(l,u)=>op(e,l,u)),a=0,c=0;for(let[l,u]of[...i,[t.length,n.length]]){let d=r$(t.slice(a,l),n.slice(c,u),(p,m)=>n$(p)===n$(m));for(let[p,m]of d)o(a+p,c+m);if(l<t.length)o(l,u);a=l+1,c=u+1}for(let[l,u]of n.entries())if(!r.has(l)){let d=t.findIndex((p,m)=>!s.has(m)&&op(e,p,u));if(d!==-1)o(d,l)}return r}function cp(e){let t=e.leading??"";return t.slice(t.lastIndexOf(`
24
+ `)+1)}function bN(e,t,n){return e.split(`
25
25
  `).map((r,s)=>s>0&&r.startsWith(t)?n+r.slice(t.length):r).join(`
26
- `)}function gC(e,t,n){let r=[...n],s=(i)=>{let a=i.getName(),c=r.findIndex((l)=>l.getName()===a);return c===-1?void 0:r.splice(c,1)[0]},o="";for(let i of t.entries){let a=s(i);if(a){let c=a.getTag()===i.getTag()&&a.getValue()===i.getValue();o+=c?pl(i,e.previous.text):`${i.leading??" "}${pl(a,e.next.text).trimStart()}`}}for(let i of r)o+=` ${pl(i,e.next.text).trimStart()}`;return o}function yC(e,t,n){let r=new Map;for(let o of Td(t)){let i=e.previous.pointers.get(Hr(o).start);if(i!==void 0)r.set(i,o)}let s=new Map;for(let o of n.entries){let i=e.next.pointers.get(Hr(o).start),a=i===void 0?void 0:r.get(i);if(a&&o.getName()!==null)s.set(a,o)}return s}function xC(e,t,n){let{text:r}=e.previous,s=pl(n,e.next.text).trimStart().slice(`${n.getName()}=`.length),[o]=t.entries;if(o?.getName()===null&&t.entries.length===1&&!t.children){if(o.getValue()===n.getValue()&&o.getTag()===n.getTag())return ml(t,r);return`${Nd(t,r)}${o.leading??" "}${s}`}return`${Nd(t,r)} ${s}`}function Nd(e,t){let{start:n}=Hr(e),[r]=e.entries;if(r)return t.slice(n,Hr(r).start-(r.leading??"").length);let s=e.children&&ei(e.children);if(s)return t.slice(n,s.start.offset-1).trimEnd();return ml(e,t)}function bC(e,t,n,r){let s=yC(e,t,n),o=new Set(s.values()),i=n.entries.filter((m)=>!o.has(m)),a=`${Nd(t,e.previous.text)}${gC(e,t,i)}`,c=Td(n);if(c.length===0&&s.size===0)return a;let l=c[0]?Jd(c[0]):`${r} `,u=t.children,d=t.beforeChildren===""?" ":t.beforeChildren??" ";if(u&&u.nodes.length>0&&wC(u,e.previous.text,t)){let m=`${r}${$C(u,r)}`;return`${a}${d}{${ix(e,u,c,m,l,s)}}`}let p=c.map((m)=>ox(e,m,l,`${r} `));return`${a}${d}{
27
- ${p.join("")}${r}}`}function $C(e,t){let[n]=e.nodes,r=n?Jd(n):"";return r.startsWith(t)?r.slice(t.length):" "}function wC(e,t,n){let{end:r,start:s}=Hr(n),[o]=e.nodes;return o!==void 0&&(o.leading??"").includes(`
26
+ `)}function $N(e,t,n){let r=[...n],s=(i)=>{let a=i.getName(),c=r.findIndex((l)=>l.getName()===a);return c===-1?void 0:r.splice(c,1)[0]},o="";for(let i of t.entries){let a=s(i);if(a){let c=a.getTag()===i.getTag()&&a.getValue()===i.getValue();o+=c?jl(i,e.previous.text):`${i.leading??" "}${jl(a,e.next.text).trimStart()}`}}for(let i of r)o+=` ${jl(i,e.next.text).trimStart()}`;return o}function SN(e,t,n){let r=new Map;for(let o of ap(t)){let i=e.previous.pointers.get(Ur(o).start);if(i!==void 0)r.set(i,o)}let s=new Map;for(let o of n.entries){let i=e.next.pointers.get(Ur(o).start),a=i===void 0?void 0:r.get(i);if(a&&o.getName()!==null)s.set(a,o)}return s}function wN(e,t,n){let{text:r}=e.previous,s=jl(n,e.next.text).trimStart().slice(`${n.getName()}=`.length),[o]=t.entries;if(o?.getName()===null&&t.entries.length===1&&!t.children){if(o.getValue()===n.getValue()&&o.getTag()===n.getTag())return Pl(t,r);return`${ip(t,r)}${o.leading??" "}${s}`}return`${ip(t,r)} ${s}`}function ip(e,t){let{start:n}=Ur(e),[r]=e.entries;if(r)return t.slice(n,Ur(r).start-(r.leading??"").length);let s=e.children&&Xo(e.children);if(s)return t.slice(n,s.start.offset-1).trimEnd();return Pl(e,t)}function vN(e,t,n,r){let s=SN(e,t,n),o=new Set(s.values()),i=n.entries.filter((m)=>!o.has(m)),a=`${ip(t,e.previous.text)}${$N(e,t,i)}`,c=ap(n);if(c.length===0&&s.size===0)return a;let l=c[0]?cp(c[0]):`${r} `,u=t.children,d=t.beforeChildren===""?" ":t.beforeChildren??" ";if(u&&u.nodes.length>0&&jN(u,e.previous.text,t)){let m=`${r}${EN(u,r)}`;return`${a}${d}{${o$(e,u,c,m,l,s)}}`}let p=c.map((m)=>s$(e,m,l,`${r} `));return`${a}${d}{
27
+ ${p.join("")}${r}}`}function EN(e,t){let[n]=e.nodes,r=n?cp(n):"";return r.startsWith(t)?r.slice(t.length):" "}function jN(e,t,n){let{end:r,start:s}=Ur(n),[o]=e.nodes;return o!==void 0&&(o.leading??"").includes(`
28
28
  `)&&t.slice(s,r).includes(`
29
- `)}function ox(e,t,n,r){return`${r}${hC(ml(t,e.next.text),n,r)}
30
- `}function ix(e,t,n,r,s,o){let i=t.nodes.filter((g)=>!o.has(g)),a=mC(e,i,n),c=t.nodes[0]?.leading??"",l=c.indexOf(`
29
+ `)}function s$(e,t,n,r){return`${r}${bN(Pl(t,e.next.text),n,r)}
30
+ `}function o$(e,t,n,r,s,o){let i=t.nodes.filter((y)=>!o.has(y)),a=xN(e,i,n),c=t.nodes[0]?.leading??"",l=c.indexOf(`
31
31
  `),u=l===-1?"":c.slice(0,l+1),d=u,p=-1,m=()=>{if(d!==""&&!d.endsWith(`
32
32
  `)&&!d.endsWith(";"))d+=`
33
- `},x=(g,b)=>{let j=t.nodes.indexOf(g),v=j===p+1||j>p;p=Math.max(p,j);let P=g===t.nodes[0]?c.slice(u.length):g.leading??"";if(v&&(P.includes(`
34
- `)||d===u||d.endsWith(";"))){d+=`${P}${b}${g.trailing??""}`;return}if(!d.endsWith(`
33
+ `},x=(y,S)=>{let E=t.nodes.indexOf(y),v=E===p+1||E>p;p=Math.max(p,E);let j=y===t.nodes[0]?c.slice(u.length):y.leading??"";if(v&&(j.includes(`
34
+ `)||d===u||d.endsWith(";"))){d+=`${j}${S}${y.trailing??""}`;return}if(!d.endsWith(`
35
35
  `))d+=`
36
- `;let S=(g.trailing??"").replace(/^;/u,"");d+=`${P.includes(`
37
- `)?P:r}${b}${S}`},h=(g)=>{for(let[b,j]of t.nodes.entries()){let v=o.get(j);if(v&&b<g&&b>p)m(),x(j,xC(e,j,v))}};for(let[g,b]of n.entries()){let j=a.get(g);if(j){h(t.nodes.indexOf(j)),m();let v=Cd(e,j,b)?ml(j,e.previous.text):bC(e,j,b,Jd(j));x(j,v)}else m(),d+=ox(e,b,s,r)}return h(t.nodes.length),`${d}${t.trailing??""}`}function hl(e,t,n){let r;try{r=n(e)}catch{return t}let s=n(t),o=li(s.document);if(li(r.document)===o)return e;let i={next:nx(s,t),previous:nx(r,e)},a=ix(i,us(e,{storeLocations:!0}),us(t,{storeLocations:!0}).nodes,"","",new Map);try{return li(n(a).document)===o?a:t}catch{return t}}var gl=T(()=>{cl();le()});function ux(e){return!/\p{Cs}/u.test(e)}function fx(e,t){try{return us(`x ${e}`).nodes[0]?.entries[0]?.getValue()===t}catch{return!1}}function xl(e){let t='"';for(let n of e)if(n==='"')t+=String.raw`\"`;else if(n==="\\")t+=String.raw`\\`;else if(n===`
38
- `)t+=String.raw`\n`;else if(n==="\t")t+=String.raw`\t`;else if(n==="\r")t+=String.raw`\r`;else if(lx.test(n))t+=`\\u{${n.codePointAt(0)?.toString(16)}}`;else t+=n;return`${t}"`}function dx(e,t){let n="#";while(e.includes(t+n))n+="#";return n}function EC(e,t){if(SC.test(e))return null;let n=dx(e,'"""'),r=`${t}${Nt}`,s=e.split(`
36
+ `;let P=(y.trailing??"").replace(/^;/u,"");d+=`${j.includes(`
37
+ `)?j:r}${S}${P}`},g=(y)=>{for(let[S,E]of t.nodes.entries()){let v=o.get(E);if(v&&S<y&&S>p)m(),x(E,wN(e,E,v))}};for(let[y,S]of n.entries()){let E=a.get(y);if(E){g(t.nodes.indexOf(E)),m();let v=op(e,E,S)?Pl(E,e.previous.text):vN(e,E,S,cp(E));x(E,v)}else m(),d+=s$(e,S,s,r)}return g(t.nodes.length),`${d}${t.trailing??""}`}function _l(e,t,n){let r;try{r=n(e)}catch{return t}let s=n(t),o=oi(s.document);if(oi(r.document)===o)return e;let i={next:t$(s,t),previous:t$(r,e)},a=o$(i,ds(e,{storeLocations:!0}),ds(t,{storeLocations:!0}).nodes,"","",new Map);try{return oi(n(a).document)===o?a:t}catch{return t}}var kl=R(()=>{$l();le()});function l$(e){return!/\p{Cs}/u.test(e)}function u$(e,t){try{return ds(`x ${e}`).nodes[0]?.entries[0]?.getValue()===t}catch{return!1}}function Al(e){let t='"';for(let n of e)if(n==='"')t+=String.raw`\"`;else if(n==="\\")t+=String.raw`\\`;else if(n===`
38
+ `)t+=String.raw`\n`;else if(n==="\t")t+=String.raw`\t`;else if(n==="\r")t+=String.raw`\r`;else if(c$.test(n))t+=`\\u{${n.codePointAt(0)?.toString(16)}}`;else t+=n;return`${t}"`}function f$(e,t){let n="#";while(e.includes(t+n))n+="#";return n}function kN(e,t){if(PN.test(e))return null;let n=f$(e,'"""'),r=`${t}${Jt}`,s=e.split(`
39
39
  `).map((i)=>i===""?"":r+i),o=`${n}"""
40
40
  ${s.join(`
41
41
  `)}
42
- ${r}"""${n}`;return fx(o,e)?o:null}function yl(e,t,n){if(!ux(e))throw new Rt(`${n} holds a lone surrogate, which Jx Notation has no way to spell`);if(cx.test(e))return e;if(e.includes(`
43
- `)){let r=EC(e,t);if(r)return r}else if((e.includes("\\")||e.includes('"'))&&!lx.test(e)){let r=dx(e,'"'),s=`${r}"${e}"${r}`;if(fx(s,e))return s}return xl(e)}function _t(e,t){if(!ux(e))throw new Rt(`${t} is a key with a lone surrogate, which Jx Notation cannot spell`);return cx.test(e)?e:xl(e)}function rt(e,t,n){if(e===null)return"#null";if(e===!0)return"#true";if(e===!1)return"#false";if(St(e))return Object.is(e,-0)?"-0":String(e);if(k(e))return yl(e,t,n);return Ta(e)?`(ref)${xl(e.$ref)}`:null}function px(e){if(!Tt(e)||e.$prototype!=="Function")return!1;let{$prototype:t,body:n,parameters:r,...s}=e,o=Object.values(s).every((l)=>rt(l,"","")!==null),i=r===void 0||Array.isArray(r)&&r.length>0&&r.every((l)=>k(l))&&n!==void 0,a=n===void 0||k(n)||Array.isArray(n),c=Array.isArray(n)&&n.length===0;return o&&i&&a&&!c}function mx(e,t,n,r){let{$prototype:s,body:o,parameters:i,...a}=t,c=[`${n}(fn)${_t(e,r)}`];for(let[l,u]of Object.entries(a))c.push(`${_t(l,r)}=${rt(u,n,Ke(r,l))}`);if(Array.isArray(i))for(let l of i)c.push(yl(String(l),n,Ke(r,"parameters")));if(k(o))c.push(yl(o,n,Ke(r,"body")));else if(Array.isArray(o))return[`${c.join(" ")} {`,...o.flatMap((l,u)=>bn("-",l,n+Nt,Ke(Ke(r,"body"),u))),`${n}}`];return[c.join(" ")]}function jC(e){if(!Tt(e)||e.$prototype!=="Function"||e.$src!=="#client"||!k(e.$export)||Object.hasOwn(e,"body")||Object.hasOwn(e,"parameters"))return!1;return Object.values(e).every((t)=>rt(t,"","")!==null)}function PC(e,t,n,r){let{$export:s,$prototype:o,$src:i,...a}=t,c=[`${n}(export)${_t(e,r)}`];if(s!==e)c.push(`$export=${rt(s,n,Ke(r,"$export"))}`);for(let[l,u]of Object.entries(a))c.push(`${_t(l,r)}=${rt(u,n,Ke(r,l))}`);return[c.join(" ")]}function kC(e,t){if(!Tt(t)||t.timing!=="server"||t.$src!=="#server"||t.$export!==e||!Object.keys(t).every((s)=>_C.has(s)))return!1;let{arguments:n}=t;if(n===void 0)return!0;let r=Tt(n)?Object.values(n):[];return r.length>0&&r.every((s)=>rt(s,"","")!==null)}function OC(e,t,n,r){let s=[`${n}(server)${_t(e,r)}`],o=Ke(r,"arguments"),i=Tt(t.arguments)?t.arguments:{};for(let[a,c]of Object.entries(i))s.push(`${_t(a,o)}=${rt(c,n,Ke(o,a))}`);return[s.join(" ")]}function bn(e,t,n,r){let s=_t(e,r),o=n+s,i=rt(t,n,r);if(i!==null)return[`${o} ${i}`];if(jC(t))return PC(e,t,n,r);if(kC(e,t))return OC(e,t,n,r);if(px(t))return mx(e,t,n,r);if(Array.isArray(t)){if(t.length===0)return[`${n}(array)${s}`];let u=t.map((p,m)=>rt(p,n,Ke(r,m)));if(t.length>1&&u.every((p)=>p!==null&&!p.includes(`
44
- `))){let p=`${o} ${u.join(" ")}`;if(p.length<=Id)return[p]}return[`${o} {`,...t.flatMap((p,m)=>bn("-",p,n+Nt,Ke(r,m))),`${n}}`]}let a=Tt(t)?Object.entries(t):[];if(a.length===0)return[`${o} {}`];let c=a.every(([u])=>u==="-")?`${n}(object)${s}`:o,l=a.map(([u,d])=>{let p=rt(d,n,Ke(r,u));return p===null||p.includes(`
45
- `)?null:`${_t(u,r)}=${p}`});if(l.every((u)=>u!==null)){let u=`${c} ${l.join(" ")}`;if(u.length<=Id)return[u]}return[`${c} {`,...a.flatMap(([u,d])=>bn(u,d,n+Nt,Ke(r,u))),`${n}}`]}function hx(e,t,n,r){let s=Object.entries(t),o=n+_t(e,r);if(s.length===0)return[`${o} {}`];let i=[],a=0;for(let[p,m]of s){let x=rt(m,n,Ke(r,p));if(x===null||x.includes(`
46
- `))break;i.push(`${_t(p,r)}=${x}`),a+=1}let c=`${o} ${i.join(" ")}`,l=i.length>0&&c.length<=Id,u=l?a:0,d=s.slice(u).flatMap(([p,m])=>{if(Tt(m)&&!Ta(m))return hx(p,m,n+Nt,Ke(r,p));return bn(p,m,n+Nt,Ke(r,p))});if(l&&d.length===0)return[c];return[`${l?c:o} {`,...d,`${n}}`]}function AC(e){if(!Tt(e)||e.$prototype!=="Array"||!Tt(e.map))return!1;let{$prototype:t,map:n,...r}=e;return Object.values(r).every((s)=>{let o=rt(s,"","");return o!==null&&!o.includes(`
47
- `)})}function RC(e,t,n){let{$prototype:r,map:s,...o}=e,i=[`${t}$array`];for(let[a,c]of Object.entries(o))i.push(`${_t(a,n)}=${rt(c,t,Ke(n,a))}`);return[`${i.join(" ")} {`,...Na(s??null,t+Nt,Ke(n,"map")),`${t}}`]}function Na(e,t,n){let r=rt(e,t,n);if(r!==null)return[`${t}- ${r}`];if(AC(e))return RC(e,t,n);if(Tt(e))return Md(e,t,n);throw new Rt(`${n} is a list inside a list of children, which has no spelling`)}function CC(e,t,n){let{tagName:r}=e;if(!k(r))return`${t}$element`;if(vC.has(r)||r.startsWith("$")||r.startsWith("."))return`${t}$element ${xl(r)}`;return t+_t(r,n)}function NC(e,t){return t!==null&&!t.includes(`
48
- `)&&!e.startsWith("on")&&!e.startsWith("$")&&!e.startsWith(".")}function TC(e,t){let n=Tt(e)?Object.entries(e):[],r=[];for(let[s,o]of n){if(s!=="client"&&s!=="server"||!k(o))return null;let i=s==="server"?"timing=server ":"";r.push(`${t}script ${i}${yl(o,t,`/$script/${s}`)}`)}return r.length>0?r:null}function Md(e,t,n,r=[]){let s=[CC(e,t,n)],o=t+Nt,i=[...r],a={},c=null;for(let[l,u]of Object.entries(e)){let d=Ke(n,l);if(l==="tagName"&&k(u))continue;if(l==="children")continue;if(l==="textContent"){let p=rt(u,t,d);if(p===null||!k(e.tagName))ax(s,i,l,u,o,t,d);else c=p}else if(l==="attributes"&&Tt(u))for(let[p,m]of Object.entries(u)){let x=rt(m,t,Ke(d,p));if(NC(p,x))s.push(`${_t(p,d)}=${x}`);else a[p]=m}else if(l==="state")i.push(...bn("state",u,o,d));else if(l==="style"&&Tt(u))i.push(...hx("style",u,o,d));else if(l.startsWith("on")&&Ta(u))s.push(`${_t(l,d)}=${rt(u,t,d)}`);else if(l.startsWith("on"))i.push(...px(u)?mx(l,u,o,d):bn(l,u,o,d).map((p,m)=>m===0?p.replace(o,`${o}(on)`):p));else if(l.startsWith("$")){let p=rt(u,t,d);if(p===null||p.includes(`
49
- `))i.push(...bn(l,u,o,d));else s.push(`${_t(l,d)}=${p}`)}else ax(s,i,l,u,o,t,d)}if(Object.keys(a).length>0)i.push(...bn("attributes",a,o,Ke(n,"attributes")));if(i.push(...JC(e.children,o,Ke(n,"children"))),c!==null)s.push(c);return i.length===0?[s.join(" ")]:[`${s.join(" ")} {`,...i,`${t}}`]}function JC(e,t,n){if(e===void 0)return[];if(Array.isArray(e)){if(e.length===0)return[`${t}(array).children`];return e.flatMap((s,o)=>Na(s,t,Ke(n,o)))}let r=rt(e,t,n);if(r!==null)return[`${t}.children ${r}`];return[`${t}.children {`,...Na(e,t+Nt,n),`${t}}`]}function ax(e,t,n,r,s,o,i){let a=_t(`.${n}`,i);if(n==="map"&&Tt(r)){t.push(`${s}${a} {`,...Na(r,s+Nt,i),`${s}}`);return}if(n==="cases"&&Tt(r)){t.push(`${s}${a} {`);for(let[l,u]of Object.entries(r))t.push(`${s}${Nt}${_t(l,i)} {`,...Na(u,s+Nt+Nt,Ke(i,l)),`${s}${Nt}}`);t.push(`${s}}`);return}let c=rt(r,o,i);if(c===null||c.includes(`
50
- `))t.push(...bn(`.${n}`,r,s,i));else e.push(`${a}=${c}`)}function gx(e,t){return["$head {",...e.flatMap((n,r)=>Tt(n)&&!Ta(n)&&k(n.tagName)&&!n.$ref?Md(n,t,`/$head/${r}`):bn("-",n,t,`/$head/${r}`)),"}"]}function IC(e){let{document:t,spans:n}=Od(e);return{document:V(t)?t:null,spans:n}}function Dd(e,t){let n=MC(e);return t===void 0?n:hl(t,n,IC)}function MC(e){if(!V(e))throw new Rt("A document is an object");let t=e,n=["/- kdl-version 2"],r={},s=Object.keys(t).some((i)=>!i.startsWith("$")),o=[];for(let[i,a]of Object.entries(t)){let c=i==="$script"&&s?TC(a,Nt):null;if(c)o=c;else if(i==="$head"&&Array.isArray(a))n.push(...gx(a,Nt));else if(i==="$head")n.push(`(object)${bn(i,a,"","/$head").join(`
51
- `)}`);else if(i.startsWith("$"))n.push(...bn(i,a,"",Ke("",i)));else r[i]=a}if(Object.keys(r).length>0)n.push("",...Md(r,"","",o));return`${n.join(`
42
+ ${r}"""${n}`;return u$(o,e)?o:null}function Ol(e,t,n){if(!l$(e))throw new Nt(`${n} holds a lone surrogate, which Jx Notation has no way to spell`);if(a$.test(e))return e;if(e.includes(`
43
+ `)){let r=kN(e,t);if(r)return r}else if((e.includes("\\")||e.includes('"'))&&!c$.test(e)){let r=f$(e,'"'),s=`${r}"${e}"${r}`;if(u$(s,e))return s}return Al(e)}function At(e,t){if(!l$(e))throw new Nt(`${t} is a key with a lone surrogate, which Jx Notation cannot spell`);return a$.test(e)?e:Al(e)}function rt(e,t,n){if(e===null)return"#null";if(e===!0)return"#true";if(e===!1)return"#false";if(We(e))return Object.is(e,-0)?"-0":String(e);if(k(e))return Ol(e,t,n);return Ca(e)?`(ref)${Al(e.$ref)}`:null}function d$(e){if(!It(e)||e.$prototype!=="Function")return!1;let{$prototype:t,body:n,parameters:r,...s}=e,o=Object.values(s).every((l)=>rt(l,"","")!==null),i=r===void 0||Array.isArray(r)&&r.length>0&&r.every((l)=>k(l))&&n!==void 0,a=n===void 0||k(n)||Array.isArray(n),c=Array.isArray(n)&&n.length===0;return o&&i&&a&&!c}function p$(e,t,n,r){let{$prototype:s,body:o,parameters:i,...a}=t,c=[`${n}(fn)${At(e,r)}`];for(let[l,u]of Object.entries(a))c.push(`${At(l,r)}=${rt(u,n,Ue(r,l))}`);if(Array.isArray(i))for(let l of i)c.push(Ol(String(l),n,Ue(r,"parameters")));if(k(o))c.push(Ol(o,n,Ue(r,"body")));else if(Array.isArray(o))return[`${c.join(" ")} {`,...o.flatMap((l,u)=>bn("-",l,n+Jt,Ue(Ue(r,"body"),u))),`${n}}`];return[c.join(" ")]}function ON(e){if(!It(e)||e.$prototype!=="Function"||e.$src!=="#client"||!k(e.$export)||Object.hasOwn(e,"body")||Object.hasOwn(e,"parameters"))return!1;return Object.values(e).every((t)=>rt(t,"","")!==null)}function AN(e,t,n,r){let{$export:s,$prototype:o,$src:i,...a}=t,c=[`${n}(export)${At(e,r)}`];if(s!==e)c.push(`$export=${rt(s,n,Ue(r,"$export"))}`);for(let[l,u]of Object.entries(a))c.push(`${At(l,r)}=${rt(u,n,Ue(r,l))}`);return[c.join(" ")]}function RN(e,t){if(!It(t)||t.timing!=="server"||t.$src!=="#server"||t.$export!==e||!Object.keys(t).every((s)=>CN.has(s)))return!1;let{arguments:n}=t;if(n===void 0)return!0;let r=It(n)?Object.values(n):[];return r.length>0&&r.every((s)=>rt(s,"","")!==null)}function NN(e,t,n,r){let s=[`${n}(server)${At(e,r)}`],o=Ue(r,"arguments"),i=It(t.arguments)?t.arguments:{};for(let[a,c]of Object.entries(i))s.push(`${At(a,o)}=${rt(c,n,Ue(o,a))}`);return[s.join(" ")]}function bn(e,t,n,r){let s=At(e,r),o=n+s,i=rt(t,n,r);if(i!==null)return[`${o} ${i}`];if(ON(t))return AN(e,t,n,r);if(RN(e,t))return NN(e,t,n,r);if(d$(t))return p$(e,t,n,r);if(Array.isArray(t)){if(t.length===0)return[`${n}(array)${s}`];let u=t.map((p,m)=>rt(p,n,Ue(r,m)));if(t.length>1&&u.every((p)=>p!==null&&!p.includes(`
44
+ `))){let p=`${o} ${u.join(" ")}`;if(p.length<=lp)return[p]}return[`${o} {`,...t.flatMap((p,m)=>bn("-",p,n+Jt,Ue(r,m))),`${n}}`]}let a=It(t)?Object.entries(t):[];if(a.length===0)return[`${o} {}`];let c=a.every(([u])=>u==="-")?`${n}(object)${s}`:o,l=a.map(([u,d])=>{let p=rt(d,n,Ue(r,u));return p===null||p.includes(`
45
+ `)?null:`${At(u,r)}=${p}`});if(l.every((u)=>u!==null)){let u=`${c} ${l.join(" ")}`;if(u.length<=lp)return[u]}return[`${c} {`,...a.flatMap(([u,d])=>bn(u,d,n+Jt,Ue(r,u))),`${n}}`]}function m$(e,t,n,r){let s=Object.entries(t),o=n+At(e,r);if(s.length===0)return[`${o} {}`];let i=[],a=0;for(let[p,m]of s){let x=rt(m,n,Ue(r,p));if(x===null||x.includes(`
46
+ `))break;i.push(`${At(p,r)}=${x}`),a+=1}let c=`${o} ${i.join(" ")}`,l=i.length>0&&c.length<=lp,u=l?a:0,d=s.slice(u).flatMap(([p,m])=>{if(It(m)&&!Ca(m))return m$(p,m,n+Jt,Ue(r,p));return bn(p,m,n+Jt,Ue(r,p))});if(l&&d.length===0)return[c];return[`${l?c:o} {`,...d,`${n}}`]}function TN(e){if(!It(e)||e.$prototype!=="Array"||!It(e.map))return!1;let{$prototype:t,map:n,...r}=e;return Object.values(r).every((s)=>{let o=rt(s,"","");return o!==null&&!o.includes(`
47
+ `)})}function JN(e,t,n){let{$prototype:r,map:s,...o}=e,i=[`${t}$array`];for(let[a,c]of Object.entries(o))i.push(`${At(a,n)}=${rt(c,t,Ue(n,a))}`);return[`${i.join(" ")} {`,...Aa(s??null,t+Jt,Ue(n,"map")),`${t}}`]}function Aa(e,t,n){let r=rt(e,t,n);if(r!==null)return[`${t}- ${r}`];if(TN(e))return JN(e,t,n);if(It(e))return up(e,t,n);throw new Nt(`${n} is a list inside a list of children, which has no spelling`)}function IN(e,t,n){let{tagName:r}=e;if(!k(r))return`${t}$element`;if(_N.has(r)||r.startsWith("$")||r.startsWith("."))return`${t}$element ${Al(r)}`;return t+At(r,n)}function DN(e,t){return t!==null&&!t.includes(`
48
+ `)&&!e.startsWith("on")&&!e.startsWith("$")&&!e.startsWith(".")}function MN(e,t){let n=It(e)?Object.entries(e):[],r=[];for(let[s,o]of n){if(s!=="client"&&s!=="server"||!k(o))return null;let i=s==="server"?"timing=server ":"";r.push(`${t}script ${i}${Ol(o,t,`/$script/${s}`)}`)}return r.length>0?r:null}function up(e,t,n,r=[]){let s=[IN(e,t,n)],o=t+Jt,i=[...r],a={},c=null;for(let[l,u]of Object.entries(e)){let d=Ue(n,l);if(l==="tagName"&&k(u))continue;if(l==="children")continue;if(l==="textContent"){let p=rt(u,t,d);if(p===null||!k(e.tagName))i$(s,i,l,u,o,t,d);else c=p}else if(l==="attributes"&&It(u))for(let[p,m]of Object.entries(u)){let x=rt(m,t,Ue(d,p));if(DN(p,x))s.push(`${At(p,d)}=${x}`);else a[p]=m}else if(l==="state")i.push(...bn("state",u,o,d));else if(l==="style"&&It(u))i.push(...m$("style",u,o,d));else if(l.startsWith("on")&&Ca(u))s.push(`${At(l,d)}=${rt(u,t,d)}`);else if(l.startsWith("on"))i.push(...d$(u)?p$(l,u,o,d):bn(l,u,o,d).map((p,m)=>m===0?p.replace(o,`${o}(on)`):p));else if(l.startsWith("$")){let p=rt(u,t,d);if(p===null||p.includes(`
49
+ `))i.push(...bn(l,u,o,d));else s.push(`${At(l,d)}=${p}`)}else i$(s,i,l,u,o,t,d)}if(Object.keys(a).length>0)i.push(...bn("attributes",a,o,Ue(n,"attributes")));if(i.push(...FN(e.children,o,Ue(n,"children"))),c!==null)s.push(c);return i.length===0?[s.join(" ")]:[`${s.join(" ")} {`,...i,`${t}}`]}function FN(e,t,n){if(e===void 0)return[];if(Array.isArray(e)){if(e.length===0)return[`${t}(array).children`];return e.flatMap((s,o)=>Aa(s,t,Ue(n,o)))}let r=rt(e,t,n);if(r!==null)return[`${t}.children ${r}`];return[`${t}.children {`,...Aa(e,t+Jt,n),`${t}}`]}function i$(e,t,n,r,s,o,i){let a=At(`.${n}`,i);if(n==="map"&&It(r)){t.push(`${s}${a} {`,...Aa(r,s+Jt,i),`${s}}`);return}if(n==="cases"&&It(r)){t.push(`${s}${a} {`);for(let[l,u]of Object.entries(r))t.push(`${s}${Jt}${At(l,i)} {`,...Aa(u,s+Jt+Jt,Ue(i,l)),`${s}${Jt}}`);t.push(`${s}}`);return}let c=rt(r,o,i);if(c===null||c.includes(`
50
+ `))t.push(...bn(`.${n}`,r,s,i));else e.push(`${a}=${c}`)}function h$(e,t){return["$head {",...e.flatMap((n,r)=>It(n)&&!Ca(n)&&k(n.tagName)&&!n.$ref?up(n,t,`/$head/${r}`):bn("-",n,t,`/$head/${r}`)),"}"]}function LN(e){let{document:t,spans:n}=np(e);return{document:L(t)?t:null,spans:n}}function fp(e,t){let n=VN(e);return t===void 0?n:_l(t,n,LN)}function VN(e){if(!L(e))throw new Nt("A document is an object");let t=e,n=["/- kdl-version 2"],r={},s=Object.keys(t).some((i)=>!i.startsWith("$")),o=[];for(let[i,a]of Object.entries(t)){let c=i==="$script"&&s?MN(a,Jt):null;if(c)o=c;else if(i==="$head"&&Array.isArray(a))n.push(...h$(a,Jt));else if(i==="$head")n.push(`(object)${bn(i,a,"","/$head").join(`
51
+ `)}`);else if(i.startsWith("$"))n.push(...bn(i,a,"",Ue("",i)));else r[i]=a}if(Object.keys(r).length>0)n.push("",...up(r,"","",o));return`${n.join(`
52
52
  `)}
53
- `}var Nt=" ",Id=100,cx,lx,SC,vC,Tt=(e)=>V(e),Ta=(e)=>Tt(e)&&k(e.$ref)&&Object.keys(e).length===1,Ke=(e,t)=>`${e}/${String(t).replaceAll("~","~0").replaceAll("/","~1")}`,_C;var bl=T(()=>{cl();le();ai();Ca();gl();cx=/^(?![-+]?\.?\d)(?!(?:true|false|null|inf|-inf|nan)$)[^\s\\/(){};[\]"#=,\p{Cc}\p{Cf}\p{Zl}\p{Zp}]+$/u,lx=/[\p{Cc}\p{Zl}\p{Zp}‎‏‪-‮⁦-⁩]/u,SC=/(?!\n)\p{Cc}|[\p{Zl}\p{Zp}‎‏‪-‮⁦-⁩]/u,vC=new Set(["-","attributes","script","state","style"]);_C=new Set(["$export","$src","arguments","timing"])});function LC(e,t,n){if(ci(e,t)!==null)throw _e(e,t,`"project" names the file's kind, and takes no annotation`);let r=On(e,t);if(r.length>1||An(t).length>0||Ct(t).length>0)throw _e(e,t,`"project" holds one value, the project's name, and nothing else`);if(r[0]!==void 0)ve(n,"name",r[0],e,t),ht(e,"/name",t)}function VC(e,t,n){let r=t.getName(),s=`/${Xe(r)}`,o=t.getTag()===null,i;if(r==="$head"&&o)i=_d(e,t),ht(e,s,t);else if(FC.has(r)&&o)i=fl(e,t,s);else i=kn(e,t,s);ve(n,r,i,e,t)}function qC(e){if(zo(e.text)==="document")throw new Rt('A project file declares itself: its first node, after any $ metadata, is project "<name>"');let t=kd(e.text),n={},r=!1;for(let s of t.nodes)if(s.getName()===DC){if(r)throw _e(e,s,'"project" is written twice, and a file declares one project');LC(e,s,n),r=!0}else VC(e,s,n);return Uo(n)}function Fd(e,t){try{return qC({spans:null,text:e})}catch(n){throw t!==void 0&&n instanceof Rt?n.inFile(t):n}}var DC="project",FC;var Ld=T(()=>{le();Dt();Sa();ai();Ca();gl();bl();FC=new Set(["$media","style"])});var ds=T(()=>{Sa();dl();ai();tx();Ca();gl();bl();Ld()});function $x(e){if(e===null)throw TypeError("A class descriptor cannot be null");return V(e)?e:{}}class Ja{name;classPath;classDef;extensions;mediaType;mediaTypeEssence;documentKinds;exportTarget;remote;studio;project;server;connector;capabilities;#t;#e=null;constructor(e,t,n,r){this.name=e,this.classPath=t,this.classDef=n,this.#t=r;let{format:s}=n;this.extensions=(s?.extensions??[]).map((o)=>o.toLowerCase()),this.mediaType=s?.mediaType??null,this.mediaTypeEssence=dy(this.mediaType),this.documentKinds=s?.documentKinds??[],this.exportTarget=s?.exportTarget===!0,this.remote=s?.remote===!0,this.studio=n.$studio??null,this.project=n.project??null,this.server=n.server??null,this.connector=n.connector??null,this.capabilities=UC(n)}implementation(){if(!this.#e){let e=this.classDef.$implementation;if(!e)return Promise.reject(Error(`Format class "${this.name}" has no $implementation to import`));this.#e=this.#t.importModule(this.#t.resolvePath(this.classPath,e))}return this.#e}async implementationExport(){return this.#n(await this.implementation())}#n(e){let t=this.classDef.title??this.name;return e[t]??e.default?.[t]??e.default}async call(e,...t){let n=this.capabilities[e];if(!n)throw Error(`Format class "${this.name}" does not declare a "${e}" capability`);let r=this.#n(await this.implementation()),s=r?.[n.identifier];if(!At(s)){let i=this.classDef.title??this.name;throw TypeError(`Format class "${this.name}": implementation export "${i}" has no static "${n.identifier}" method`)}return await s.call(r,...t)}async parseDocument(e,t){return await this.call("parse",e,t)}}class $l{#t;get#e(){return[...this.#t,GC]}constructor(e){this.#t=e;for(let t of e)if(t.extensions.includes(".jxn"))throw Error(`Format "${t.name}" claims ".jxn", which is built in`);for(let t of e){if(t.mediaType===null)continue;let n=fy(t.mediaType);if(n!==null)throw Error(`Format "${t.name}" declares an invalid mediaType: ${n}`)}for(let t of xx){let n=new Map;for(let r of e){if(!r.capabilities[t])continue;for(let s of r.extensions){let o=n.get(s);if(o)throw Error(`Format conflict: "${o.name}" and "${r.name}" both claim "${s}" with the "${t}" capability`);n.set(s,r)}}}}get entries(){return this.#t}byExtension(e,t){let n=yx(e);return this.#e.find((r)=>r.extensions.includes(n)&&(!t||r.capabilities[t]))}byName(e){return this.#t.find((t)=>t.name===e)}withCapability(e){return this.#e.filter((t)=>t.capabilities[e])}documentExtensions(e){let t=new Set;for(let n of this.#e){if(e&&!n.documentKinds.includes(e))continue;for(let r of n.extensions)t.add(r)}return t.delete(".json"),[...t]}has(e){let t=yx(e);return this.#e.some((n)=>n.extensions.includes(t))}}function UC(e){let t={},n=e.$defs?.methods??{};for(let[r,s]of Object.entries(n)){let{role:o}=s;if(!zC(o))continue;let i={identifier:s.identifier??r,timing:s.timing??HC};if(k(s.discriminator))i.discriminator=s.discriminator;t[o]=i}return t}function zC(e){return e!==void 0&&BC.has(e)}function yx(e){let t=e.toLowerCase();return t.startsWith(".")?t:`.${t}`}var xx,bx,HC,BC,KC,GC;var Vd=T(()=>{le();sd();xx=["parse","serialize","rewrite","discover","load"],bx=[...xx,"projectData","resolvePaths","lower","emit","head","assets","mount","dialect","deploySchema","bindings","testConnection"];HC=["compiler","server"];BC=new Set(bx);KC={importModule:async()=>{await Promise.resolve().then(() => ds());return{JxNotation:{parse:(n)=>fo(n),serialize:(n)=>Dd(n)}}},loadJson:()=>Promise.reject(Error("Jx Notation reads no file of its own")),resolvePath:(e,t)=>t},GC=new Ja("jxn","",{$defs:{methods:{parse:{role:"parse"},serialize:{role:"serialize"}}},$implementation:"jxn",format:{documentKinds:["page","component"],extensions:[".jxn"]},title:"JxNotation"},KC)});class wx{#t;#e;#n;constructor(e){this.#t=e,this.#e=e.flatMap((s)=>s.classes);let t=new Map;for(let s of e)for(let o of s.classes){let i=t.get(o.name);if(i&&i!==s.specifier)throw Error(`Extension conflict: "${i}" and "${s.specifier}" both provide a class named "${o.name}"`);t.set(o.name,s.specifier)}let n=new Map;for(let s of this.#e){if(!s.project)continue;let o=n.get(s.project.key);if(o)throw Error(`Extension conflict: "${o.name}" and "${s.name}" both claim the project section "${s.project.key}"`);n.set(s.project.key,s)}let r=new Map;for(let s of this.#e){if(!s.server)continue;let{basePath:o}=s.server;if(!o.startsWith("/_jx/"))throw Error(`Extension "${s.name}": server basePath "${o}" must be under /_jx/`);let i=r.get(o);if(i)throw Error(`Extension conflict: "${i.name}" and "${s.name}" both mount "${o}"`);r.set(o,s)}this.#n=new $l(this.#e.filter((s)=>s.extensions.length>0))}get extensions(){return this.#t}get classes(){return this.#e}get formats(){return this.#n}byName(e){return this.#e.find((t)=>t.name===e)}projectContributions(){return this.#e.filter((e)=>e.project!==null)}byProjectKey(e){return this.#e.find((t)=>t.project?.key===e)}byPathsDiscriminator(e){return this.#e.find((t)=>t.capabilities.resolvePaths?.discriminator===e)}emitters(){return this.#e.filter((e)=>e.capabilities.emit!==void 0)}headProviders(){return this.#e.filter((e)=>e.capabilities.head!==void 0)}assetProviders(){return this.#e.filter((e)=>e.capabilities.assets!==void 0)}serverMounts(){return this.#e.filter((e)=>e.server!==null).toSorted((e,t)=>(e.server?.order??100)-(t.server?.order??100)||e.name.localeCompare(t.name))}connectors(){return this.#e.filter((e)=>e.connector!==null)}schemaFragments(e){return this.#t.map((t)=>t.schemas[e]).filter((t)=>typeof t==="string")}}async function Sx(e,t,n){let r=[];for(let s of e??[])r.push(await XC(s,t,n));return new wx(r)}async function XC(e,t,n){let r;if(e.startsWith("./")||e.startsWith("../")){let c=t.resolvePath(n,e);r=t.resolvePath(`${c}/package.json`,`./${Ia}`)}else try{r=t.resolvePath(n,`${e}/${Ia}`)}catch(c){throw Error(`Extension "${e}" is not resolvable: it must export ${Ia} (is the package installed, and does its exports map include it?): ${qd(c)}`,{cause:c})}let s;try{s=await t.loadJson(r)}catch(c){throw Error(`Extension "${e}": cannot read manifest ${r}: ${qd(c)}`,{cause:c})}if(!V(s)||!k(s.name))throw Error(`Extension "${e}": ${Ia} must declare a "name"`);let o=s;if(!e.startsWith(".")&&o.name!==e)throw Error(`Extension "${e}": manifest name "${o.name}" does not match the specifier`);let i=[];for(let[c,l]of Object.entries(o.classes??{})){let u=t.resolvePath(r,l),d;try{d=await t.loadJson(u)}catch(p){throw Error(`Extension "${e}": cannot read class "${c}" at ${u}: ${qd(p)}`,{cause:p})}i.push(new Ja(c,u,$x(d),t))}let a={};if(o.schemas?.project)a.project=t.resolvePath(r,o.schemas.project);if(o.schemas?.document)a.document=t.resolvePath(r,o.schemas.document);if(o.schemas?.fields)a.fields=t.resolvePath(r,o.schemas.fields);return{specifier:e,manifestPath:r,manifest:o,classes:i,schemas:a}}function qd(e){return e instanceof Error?e.message:String(e)}var Ia="jx-extension.json";var vx=T(()=>{Vd();le();Vd()});var Ex=T(()=>{le()});function ZC(e){return`${e} holds both project.jxn and project.json, and a project has one. Keep the one you edit and delete the other`}function Px(e){let t=YC.filter((n)=>e(n));if(t.length>1)return"conflict";return t[0]??null}function wl(e,t){return qr(t)?Fd(e,t):Yg(e,t)}var YC,jx="project.jxn",Wd;var Sl=T(()=>{le();Ex();Sa();dl();Ld();Dt();YC=["project.jxn","project.json"];Wd=class Wd extends Error{constructor(e){super(ZC(e));this.name="ProjectFileConflictError"}}});import{accessSync as z3,closeSync as K3,constants as G3,existsSync as QC,fstatSync as X3,lstatSync as Y3,openSync as Z3,readFileSync as Q3,statSync as eK}from"node:fs";import{dirname as nK,join as _x}from"node:path";function eN(e){return Px((t)=>QC(_x(e,t)))}function Rn(e){let t=eN(e);if(t==="conflict")throw new Wd(e);return _x(e,t??jx)}var po=T(()=>{Sl()});import{readFileSync as tN}from"node:fs";import{dirname as nN,isAbsolute as rN,resolve as kx,sep as vl}from"node:path";import{pathToFileURL as sN}from"node:url";import{createRequire as oN}from"node:module";async function Hd(e){let t=[e],n=`${vl}src${vl}`,r=`${vl}dist${vl}`;if(e.includes(n)){let o=e.replace(n,r);if(t.push(o),o.endsWith(".ts"))t.push(`${o.slice(0,-3)}.js`)}if(e.endsWith(".js"))t.push(`${e.slice(0,-3)}.ts`);let s;for(let o of t)try{return await import(sN(o).href)}catch(i){s=i}throw s instanceof Error?s:Error(String(s))}function Ud(e,t){return oN(kx(e,"package.json")).resolve(t)}function Bd(e){return{importModule:(t)=>Hd(t),loadJson:async(t)=>JSON.parse(tN(t,"utf8")),resolvePath:(t,n)=>{if(n.startsWith("./")||n.startsWith("../"))return kx(nN(t),n);if(rN(n))return n;return Ud(e,n)}}}async function ps(e,t){return Sx(t?.extensions,Bd(e),Rn(e))}function El(e,t){return Error(`No format class registered for "${t}" (${e}). Enable an extension providing this format in project.json "extensions", e.g. "@jxsuite/parser".`)}var Ur=T(()=>{vx();le();po()});import{existsSync as iN,readFileSync as aN}from"node:fs";import{basename as cN,resolve as lN}from"node:path";function ms(e){let t=Rn(e);if(!iN(t))throw Error(`No project.jxn or project.json in ${e}`);let n;try{n=wl(aN(t,"utf8"),t)}catch(i){throw Error(`Invalid ${cN(t)}: ${$e(i)}`,{cause:i})}let r={...Ma,...n,build:{...Ma.build,...n.build},defaults:{...Ma.defaults,...n.defaults},images:{...Ma.images,...n.images},url:n.url??Ma.url};if(n.$head)r.$head=n.$head;if(n.$media)r.$media=n.$media;if(n.style)r.style=n.style;if(n.state)r.state=n.state;if(n.redirects)r.redirects=n.redirects;if(n.imports)r.imports=n.imports;let s=["cloudflare-workers","cloudflare-pages","node","bun"];if(r.build.adapter==="static")delete r.build.adapter;if(r.build.adapter&&!s.includes(r.build.adapter))throw Error(`Unknown build adapter "${r.build.adapter}" in project.json. Valid adapters: ${s.join(", ")}`);let o=["build","cloudflare"];if(!o.includes(r.images.service))throw Error(`Unknown images.service "${r.images.service}" in project.json. Valid services: ${o.join(", ")}`);return{config:r,configPath:t,projectRoot:lN(e)}}var Ma;var Da=T(()=>{Dt();Sl();po();Ma={$head:[],$media:{},build:{format:"directory",outDir:"./dist",provider:null,trailingSlash:"always"},defaults:{charset:"utf8",lang:"en",layout:null},images:{formats:["avif","jpeg"],lazyLoad:!0,optimize:!0,picture:!0,quality:{avif:65,jpeg:80},service:"build",sizes:"(max-width: 768px) 100vw, 50vw",widths:[320,640,960,1280,1920]},imports:{},name:"Jx Site",redirects:{},state:{},style:{},url:""}});import{existsSync as zd,readFileSync as Ox,writeFileSync as uN}from"node:fs";import{resolve as Ax}from"node:path";async function Rx(e,t={}){let{dryRun:n=!1,connection:r}=t,{config:s}=ms(e),o=await ps(e,s),i=V(s.connections)?s.connections:{},a=V(s.data)?s.data:{},c=Object.keys(i).filter((x)=>!r||x===r);if(r&&c.length===0)throw Error(`Unknown connection "${r}" (no such connections entry in project.json)`);if(c.length===0)throw Error('project.json has no "connections" section — nothing to push. Declare a connection and '+'its tables in the "data" section first.');let l={...process.env,...dN(e),JX_PROJECT_ROOT:e},u=[],d=[];for(let x of c){let h=i[x],g=V(h)?{...h,$name:x}:{$name:x},b=String(g.provider??""),j=fN(o.connectors(),b);if(!j)throw Error(`Connection "${x}" names provider "${b}", but no enabled extension provides it (enable the extension in project.json "extensions")`);let v={};for(let[S,_]of Object.entries(a))if(V(_)&&_.connection===x)v[S]=_;let P=await j.call("deploySchema",v,g,{dryRun:n,env:l});if(u.push({applied:P.applied??!n,connection:x,provider:b,statements:P.statements??[],tables:Object.keys(v),warnings:P.warnings??[]}),j.capabilities.bindings){let S=await j.call("bindings",g);if(V(S)&&Object.keys(S).length>0)d.push(S)}}let p=Ax(e,"wrangler.jsonc"),m=!1;if(!n&&d.length>0&&zd(p)){let x=Ox(p,"utf8"),{content:h,patched:g}=sy(x,d);if(g&&h!==x)uN(p,h,"utf8"),m=!0}return{bindingsPatched:m,results:u,wranglerPath:zd(p)?p:null}}function fN(e,t){return e.find((n)=>n.connector?.provider===t)}function dN(e){let t=Ax(e,".dev.vars");if(!zd(t))return{};let n=new Map;for(let r of Ox(t,"utf8").split(`
54
- `)){let s=r.trim();if(s===""||s.startsWith("#"))continue;let o=s.indexOf("=");if(o===-1)continue;let i=s.slice(0,o).trim(),a=s.slice(o+1).trim();if(a.startsWith('"')&&a.endsWith('"')||a.startsWith("'")&&a.endsWith("'"))a=a.slice(1,-1);if(i!=="")n.set(i,a)}return Object.fromEntries(n)}var Cx=T(()=>{iy();Ur();Da();le()});function mo(e){return e.startsWith(jl)}function Gd(e){let t=e;if(mo(t))t=t.slice(jl.length);return t=t.replace(/^\.\//,"").replace(/\.(js|ts|mjs|mts)$/,"").replaceAll("@","").replaceAll(/[/\\]+/g,"-").replaceAll(/[^\w.-]/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,""),`${Kd}${t}.js`}function Nx(e){let t=/\.(\w+)$/.exec(e)?.[1]??"",n=e.replace(/\.\w+$/,"").replaceAll("@","").replaceAll(/[/\\]+/g,"-").replaceAll(/[^\w.-]/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,"");return t===""?`${Kd}${n}`:`${Kd}${n}.${t}`}function Tx(e){let t=e.replaceAll("\\","/");return t.length>1&&t.endsWith("/")?t.slice(0,-1):t}function Pl(e){let t=Tx(e);return t.startsWith("/")?t:`/${t}`}function pN(e,t){return[...e].toSorted((n,r)=>r[t].length-n[t].length)}function _l(e,t){let n=t.split("#")[0].split("?")[0];if(!n.startsWith("/"))return null;let r;try{r=decodeURIComponent(n)}catch{return null}if(/%2e|%2f/i.test(r))return null;for(let s of pN(e,"urlPrefix")){let o=Pl(s.urlPrefix);if(!r.startsWith(`${o}/`))continue;let a=r.slice(o.length+1).split("/");if(a.some((l)=>l===""||l==="."||l===".."))return null;let{filter:c}=s;if(c&&!c(a.join("/")))return null;return`${Tx(s.dir)}/${a.join("/")}`}return null}function Jx(e,t){let n=new Set;for(let r of t){let s=Pl(r.urlPrefix),o=new RegExp(`${s.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}/[^${mN}]+`,"g");for(let i of e.matchAll(o)){let a=i[0].split("#")[0].split("?")[0];if(!a.endsWith("/"))n.add(a)}}return[...n].filter(Boolean)}function Xd(e){let t=[],n=0;while(n<e.length){while(n<e.length&&(/\s/.test(e[n])||e[n]===","))n+=1;if(n>=e.length)break;let r=n;while(n<e.length&&!/\s/.test(e[n]))n+=1;let s=e.slice(r,n);if(s.endsWith(",")){t.push({descriptor:"",url:s.replace(/,+$/,"")});continue}while(n<e.length&&/\s/.test(e[n]))n+=1;let o=n;while(n<e.length&&e[n]!==",")n+=1;let i=e.slice(o,n).trim();if(n+=1,s=s.replace(/,+$/,""),s!=="")t.push({descriptor:i,url:s})}return t}function Yd(e){return e.map(({url:t,descriptor:n})=>n?`${t} ${n}`:t).join(", ")}function ho(e){if(!k(e)||e==="")return"";let t;try{({pathname:t}=new URL(e))}catch{return""}let n=t.replace(/\/+$/,"");if(n===""||n==="/")return"";return n.startsWith("/")?n:`/${n}`}function We(e,t){if(e===""||!t.startsWith("/")||t.startsWith("//"))return t;if(t===e||t.startsWith(`${e}/`))return t;return e+t}function hs(e,t){let n=new URL(t);if(!n.pathname.endsWith("/"))n.pathname+="/";return new URL(e.replace(/^\/+/,""),n).href}var jl="npm:",Kd="/assets/",mN;var $n=T(()=>{le();mN=String.raw`"'\s<>()\\`});function Ix(e,t){return e.replaceAll(bN,(n,r,s)=>{let o=s.trim(),i=EN.exec(o),a=i?i[2]:o,c=We(t,a);if(c===a)return n;return`url(${r}${i?`${i[1]}${c}${i[1]}`:c}${r})`})}function jN(e,t,n,r,s){let o=n.toLowerCase();if(hN.has(o))return We(s,r);if(gN.has(o)){let i=Xd(r);return i.length===0?r:Yd(i.map((a)=>({descriptor:a.descriptor,url:We(s,a.url)})))}if(o==="style")return Ix(r,s);if(o==="content"&&e==="meta"&&vN.test(t))return We(s,r);return r}function Mx(e,t){if(t==="")return e;let n=e.replaceAll(wN,(r,s,o,i)=>{let a=o.replaceAll($N,(c,l)=>`"${We(t,l)}"`);return s+a+i});return n=n.replaceAll(SN,(r,s,o,i)=>s+Ix(o,t)+i),n.replaceAll(yN,(r,s,o)=>{if(o==="")return r;let i=s.toLowerCase(),a=o.replaceAll(xN,(c,l,u,d,p)=>{let m=d===void 0?"'":'"',x=d??p??"",h=jN(i,o,l,x,t);return h===x?c:`${l}=${m}${h}${m}`});return a===o?r:`<${s}${a}>`})}var hN,gN,yN,xN,bN,$N,wN,SN,vN,EN;var Dx=T(()=>{$n();hN=new Set(["href","src","poster","action","formaction","data"]),gN=new Set(["srcset","imagesrcset"]),yN=/<([a-zA-Z][a-zA-Z0-9-]*)((?:"[^"]*"|'[^']*'|[^>"'])*)>/g,xN=/([a-zA-Z_:][\w:.-]*)\s*=\s*("([^"]*)"|'([^']*)')/g,bN=/url\(\s*(['"]?)([^'")]+)\1\s*\)/g,$N=/"(\/[^"/][^"]*)"/g,wN=/(<script\b[^>]*\btype\s*=\s*["']importmap["'][^>]*>)([\s\S]*?)(<\/script>)/gi,SN=/(<style\b[^>]*>)([\s\S]*?)(<\/style>)/gi,vN=/\b(?:property|name)\s*=\s*["'](?:og:|twitter:)[\w:.-]*(?:image|url|video|audio|player)[\w:.-]*["']/i,EN=/^(&quot;|&#34;|&apos;|&#39;)([\s\S]*)\1$/});var Fl=W(function(AK,lb){var __dirname="/home/runner/work/jx/jx/node_modules/esbuild/lib",__filename="/home/runner/work/jx/jx/node_modules/esbuild/lib/main.js",{defineProperty:np,getOwnPropertyDescriptor:PN,getOwnPropertyNames:_N}=Object,kN=Object.prototype.hasOwnProperty,ON=(e,t)=>{for(var n in t)np(e,n,{get:t[n],enumerable:!0})},AN=(e,t,n,r)=>{if(t&&typeof t==="object"||typeof t==="function"){for(let s of _N(t))if(!kN.call(e,s)&&s!==n)np(e,s,{get:()=>t[s],enumerable:!(r=PN(t,s))||r.enumerable})}return e},RN=(e)=>AN(np({},"__esModule",{value:!0}),e),qa={};ON(qa,{analyzeMetafile:()=>cT,analyzeMetafileSync:()=>dT,build:()=>sT,buildSync:()=>lT,context:()=>oT,default:()=>gT,formatMessages:()=>aT,formatMessagesSync:()=>fT,initialize:()=>mT,stop:()=>pT,transform:()=>iT,transformSync:()=>uT,version:()=>rT});lb.exports=RN(qa);function Fx(e){let t=(r)=>{if(r===null)n.write8(0);else if(typeof r==="boolean")n.write8(1),n.write8(+r);else if(typeof r==="number")n.write8(2),n.write32(r|0);else if(typeof r==="string")n.write8(3),n.write(Gn(r));else if(r instanceof Uint8Array)n.write8(4),n.write(r);else if(r instanceof Array){n.write8(5),n.write32(r.length);for(let s of r)t(s)}else{let s=Object.keys(r);n.write8(6),n.write32(s.length);for(let o of s)n.write(Gn(o)),t(r[o])}},n=new Gx;return n.write32(0),n.write32(e.id<<1|+!e.isRequest),t(e.value),Qd(n.buf,n.len-4,0),n.buf.subarray(0,n.len)}function CN(e){let t=()=>{switch(n.read8()){case 0:return null;case 1:return!!n.read8();case 2:return n.read32();case 3:return $o(n.read());case 4:return n.read();case 5:{let i=n.read32(),a=[];for(let c=0;c<i;c++)a.push(t());return a}case 6:{let i=n.read32(),a={};for(let c=0;c<i;c++)a[$o(n.read())]=t();return a}default:throw Error("Invalid packet")}},n=new Gx(e),r=n.read32(),s=(r&1)===0;r>>>=1;let o=t();if(n.ptr!==e.length)throw Error("Invalid packet");return{id:r,isRequest:s,value:o}}var Gx=class{constructor(e=new Uint8Array(1024)){this.buf=e,this.len=0,this.ptr=0}_write(e){if(this.len+e>this.buf.length){let t=new Uint8Array((this.len+e)*2);t.set(this.buf),this.buf=t}return this.len+=e,this.len-e}write8(e){let t=this._write(1);this.buf[t]=e}write32(e){let t=this._write(4);Qd(this.buf,e,t)}write(e){let t=this._write(4+e.length);Qd(this.buf,e.length,t),this.buf.set(e,t+4)}_read(e){if(this.ptr+e>this.buf.length)throw Error("Invalid packet");return this.ptr+=e,this.ptr-e}read8(){return this.buf[this._read(1)]}read32(){return Xx(this.buf,this._read(4))}read(){let e=this.read32(),t=new Uint8Array(e),n=this._read(t.length);return t.set(this.buf.subarray(n,n+e)),t}},Gn,$o,Zd;if(typeof TextEncoder<"u"&&typeof TextDecoder<"u"){let e=new TextEncoder,t=new TextDecoder;Gn=(n)=>e.encode(n),$o=(n)=>t.decode(n),Zd='new TextEncoder().encode("")'}else if(typeof Buffer<"u")Gn=(e)=>Buffer.from(e),$o=(e)=>{let{buffer:t,byteOffset:n,byteLength:r}=e;return Buffer.from(t,n,r).toString()},Zd='Buffer.from("")';else throw Error("No UTF-8 codec found");if(!(Gn("")instanceof Uint8Array))throw Error(`Invariant violation: "${Zd} instanceof Uint8Array" is incorrectly false
53
+ `}var Jt=" ",lp=100,a$,c$,PN,_N,It=(e)=>L(e),Ca=(e)=>It(e)&&k(e.$ref)&&Object.keys(e).length===1,Ue=(e,t)=>`${e}/${String(t).replaceAll("~","~0").replaceAll("/","~1")}`,CN;var Cl=R(()=>{$l();le();ri();Oa();kl();a$=/^(?![-+]?\.?\d)(?!(?:true|false|null|inf|-inf|nan)$)[^\s\\/(){};[\]"#=,\p{Cc}\p{Cf}\p{Zl}\p{Zp}]+$/u,c$=/[\p{Cc}\p{Zl}\p{Zp}‎‏‪-‮⁦-⁩]/u,PN=/(?!\n)\p{Cc}|[\p{Zl}\p{Zp}‎‏‪-‮⁦-⁩]/u,_N=new Set(["-","attributes","script","state","style"]);CN=new Set(["$export","$src","arguments","timing"])});function HN(e,t,n){if(si(e,t)!==null)throw Pe(e,t,`"project" names the file's kind, and takes no annotation`);let r=kn(e,t);if(r.length>1||On(t).length>0||Tt(t).length>0)throw Pe(e,t,`"project" holds one value, the project's name, and nothing else`);if(r[0]!==void 0)we(n,"name",r[0],e,t),mt(e,"/name",t)}function UN(e,t,n){let r=t.getName(),s=`/${ze(r)}`,o=t.getTag()===null,i;if(r==="$head"&&o)i=ep(e,t),mt(e,s,t);else if(WN.has(r)&&o)i=vl(e,t,s);else i=_n(e,t,s);we(n,r,i,e,t)}function BN(e){if(Wo(e.text)==="document")throw new Nt('A project file declares itself: its first node, after any $ metadata, is project "<name>"');let t=tp(e.text),n={},r=!1;for(let s of t.nodes)if(s.getName()===qN){if(r)throw Pe(e,s,'"project" is written twice, and a file declares one project');HN(e,s,n),r=!0}else UN(e,s,n);return Vo(n)}function dp(e,t){try{return BN({spans:null,text:e})}catch(n){throw t!==void 0&&n instanceof Nt?n.inFile(t):n}}var qN="project",WN;var pp=R(()=>{le();Rt();ba();ri();Oa();kl();Cl();WN=new Set(["$media","style"])});var ms=R(()=>{ba();El();ri();e$();Oa();kl();Cl();pp()});function b$(e){if(e===null)throw TypeError("A class descriptor cannot be null");return L(e)?e:{}}class Ra{name;classPath;classDef;extensions;mediaType;mediaTypeEssence;documentKinds;exportTarget;remote;studio;project;server;connector;capabilities;#t;#e=null;constructor(e,t,n,r){this.name=e,this.classPath=t,this.classDef=n,this.#t=r;let{format:s}=n;this.extensions=(s?.extensions??[]).map((o)=>o.toLowerCase()),this.mediaType=s?.mediaType??null,this.mediaTypeEssence=fb(this.mediaType),this.documentKinds=s?.documentKinds??[],this.exportTarget=s?.exportTarget===!0,this.remote=s?.remote===!0,this.studio=n.$studio??null,this.project=n.project??null,this.server=n.server??null,this.connector=n.connector??null,this.capabilities=GN(n)}implementation(){if(!this.#e){let e=this.classDef.$implementation;if(!e)return Promise.reject(Error(`Format class "${this.name}" has no $implementation to import`));this.#e=this.#t.importModule(this.#t.resolvePath(this.classPath,e))}return this.#e}async implementationExport(){return this.#n(await this.implementation())}#n(e){let t=this.classDef.title??this.name;return e[t]??e.default?.[t]??e.default}async call(e,...t){let n=this.capabilities[e];if(!n)throw Error(`Format class "${this.name}" does not declare a "${e}" capability`);let r=this.#n(await this.implementation()),s=r?.[n.identifier];if(!_t(s)){let i=this.classDef.title??this.name;throw TypeError(`Format class "${this.name}": implementation export "${i}" has no static "${n.identifier}" method`)}return await s.call(r,...t)}async parseDocument(e,t){return await this.call("parse",e,t)}}class Rl{#t;get#e(){return[...this.#t,QN]}constructor(e){this.#t=e;for(let t of e)if(t.extensions.includes(".jxn"))throw Error(`Format "${t.name}" claims ".jxn", which is built in`);for(let t of e){if(t.mediaType===null)continue;let n=ub(t.mediaType);if(n!==null)throw Error(`Format "${t.name}" declares an invalid mediaType: ${n}`)}for(let t of y$){let n=new Map;for(let r of e){if(!r.capabilities[t])continue;for(let s of r.extensions){let o=n.get(s);if(o)throw Error(`Format conflict: "${o.name}" and "${r.name}" both claim "${s}" with the "${t}" capability`);n.set(s,r)}}}}get entries(){return this.#t}byExtension(e,t){let n=g$(e);return this.#e.find((r)=>r.extensions.includes(n)&&(!t||r.capabilities[t]))}byName(e){return this.#t.find((t)=>t.name===e)}withCapability(e){return this.#e.filter((t)=>t.capabilities[e])}documentExtensions(e){let t=new Set;for(let n of this.#e){if(e&&!n.documentKinds.includes(e))continue;for(let r of n.extensions)t.add(r)}return t.delete(".json"),[...t]}has(e){let t=g$(e);return this.#e.some((n)=>n.extensions.includes(t))}}function GN(e){let t={},n=e.$defs?.methods??{};for(let[r,s]of Object.entries(n)){let{role:o}=s;if(!YN(o))continue;let i={identifier:s.identifier??r,timing:s.timing??KN};if(k(s.discriminator))i.discriminator=s.discriminator;t[o]=i}return t}function YN(e){return e!==void 0&&XN.has(e)}function g$(e){let t=e.toLowerCase();return t.startsWith(".")?t:`.${t}`}var y$,x$,KN,XN,ZN,QN;var mp=R(()=>{le();Cd();y$=["parse","serialize","rewrite","discover","load"],x$=[...y$,"projectData","resolvePaths","lower","emit","head","assets","mount","dialect","deploySchema","bindings","testConnection"];KN=["compiler","server"];XN=new Set(x$);ZN={importModule:async()=>{await Promise.resolve().then(() => ms());return{JxNotation:{parse:(n)=>mo(n),serialize:(n)=>fp(n)}}},loadJson:()=>Promise.reject(Error("Jx Notation reads no file of its own")),resolvePath:(e,t)=>t},QN=new Ra("jxn","",{$defs:{methods:{parse:{role:"parse"},serialize:{role:"serialize"}}},$implementation:"jxn",format:{documentKinds:["page","component"],extensions:[".jxn"]},title:"JxNotation"},ZN)});class $${#t;#e;#n;constructor(e){this.#t=e,this.#e=e.flatMap((s)=>s.classes);let t=new Map;for(let s of e)for(let o of s.classes){let i=t.get(o.name);if(i&&i!==s.specifier)throw Error(`Extension conflict: "${i}" and "${s.specifier}" both provide a class named "${o.name}"`);t.set(o.name,s.specifier)}let n=new Map;for(let s of this.#e){if(!s.project)continue;let o=n.get(s.project.key);if(o)throw Error(`Extension conflict: "${o.name}" and "${s.name}" both claim the project section "${s.project.key}"`);n.set(s.project.key,s)}let r=new Map;for(let s of this.#e){if(!s.server)continue;let{basePath:o}=s.server;if(!o.startsWith("/_jx/"))throw Error(`Extension "${s.name}": server basePath "${o}" must be under /_jx/`);let i=r.get(o);if(i)throw Error(`Extension conflict: "${i.name}" and "${s.name}" both mount "${o}"`);r.set(o,s)}this.#n=new Rl(this.#e.filter((s)=>s.extensions.length>0))}get extensions(){return this.#t}get classes(){return this.#e}get formats(){return this.#n}byName(e){return this.#e.find((t)=>t.name===e)}projectContributions(){return this.#e.filter((e)=>e.project!==null)}byProjectKey(e){return this.#e.find((t)=>t.project?.key===e)}byPathsDiscriminator(e){return this.#e.find((t)=>t.capabilities.resolvePaths?.discriminator===e)}emitters(){return this.#e.filter((e)=>e.capabilities.emit!==void 0)}headProviders(){return this.#e.filter((e)=>e.capabilities.head!==void 0)}assetProviders(){return this.#e.filter((e)=>e.capabilities.assets!==void 0)}serverMounts(){return this.#e.filter((e)=>e.server!==null).toSorted((e,t)=>(e.server?.order??100)-(t.server?.order??100)||e.name.localeCompare(t.name))}connectors(){return this.#e.filter((e)=>e.connector!==null)}schemaFragments(e){return this.#t.map((t)=>t.schemas[e]).filter((t)=>typeof t==="string")}}async function S$(e,t,n){let r=[];for(let s of e??[])r.push(await eT(s,t,n));return new $$(r)}async function eT(e,t,n){let r;if(e.startsWith("./")||e.startsWith("../")){let c=t.resolvePath(n,e);r=t.resolvePath(`${c}/package.json`,`./${Na}`)}else try{r=t.resolvePath(n,`${e}/${Na}`)}catch(c){throw Error(`Extension "${e}" is not resolvable: it must export ${Na} (is the package installed, and does its exports map include it?): ${hp(c)}`,{cause:c})}let s;try{s=await t.loadJson(r)}catch(c){throw Error(`Extension "${e}": cannot read manifest ${r}: ${hp(c)}`,{cause:c})}if(!L(s)||!k(s.name))throw Error(`Extension "${e}": ${Na} must declare a "name"`);let o=s;if(!e.startsWith(".")&&o.name!==e)throw Error(`Extension "${e}": manifest name "${o.name}" does not match the specifier`);let i=[];for(let[c,l]of Object.entries(o.classes??{})){let u=t.resolvePath(r,l),d;try{d=await t.loadJson(u)}catch(p){throw Error(`Extension "${e}": cannot read class "${c}" at ${u}: ${hp(p)}`,{cause:p})}i.push(new Ra(c,u,b$(d),t))}let a={};if(o.schemas?.project)a.project=t.resolvePath(r,o.schemas.project);if(o.schemas?.document)a.document=t.resolvePath(r,o.schemas.document);if(o.schemas?.fields)a.fields=t.resolvePath(r,o.schemas.fields);return{specifier:e,manifestPath:r,manifest:o,classes:i,schemas:a}}function hp(e){return e instanceof Error?e.message:String(e)}var Na="jx-extension.json";var w$=R(()=>{mp();le();mp()});var v$=R(()=>{le()});function nT(e){return`${e} holds both project.jxn and project.json, and a project has one. Keep the one you edit and delete the other`}function j$(e){let t=tT.filter((n)=>e(n));if(t.length>1)return"conflict";return t[0]??null}function Nl(e,t){return Wr(t)?dp(e,t):Xx(e,t)}var tT,E$="project.jxn",gp;var Tl=R(()=>{le();v$();ba();El();pp();Rt();tT=["project.jxn","project.json"];gp=class gp extends Error{constructor(e){super(nT(e));this.name="ProjectFileConflictError"}}});import{accessSync as x6,closeSync as b6,constants as $6,existsSync as rT,fstatSync as S6,lstatSync as w6,openSync as v6,readFileSync as E6,statSync as j6}from"node:fs";import{dirname as _6,join as P$}from"node:path";function sT(e){return j$((t)=>rT(P$(e,t)))}function An(e){let t=sT(e);if(t==="conflict")throw new gp(e);return P$(e,t??E$)}var ho=R(()=>{Tl()});import{existsSync as oT,readFileSync as iT}from"node:fs";import{dirname as Il,isAbsolute as aT,resolve as _$,sep as Jl}from"node:path";import{pathToFileURL as cT}from"node:url";import{createRequire as lT}from"node:module";function k$(e){let t=[e],n=`${Jl}src${Jl}`,r=`${Jl}dist${Jl}`;if(e.includes(n)){let s=e.replace(n,r);if(t.push(s),s.endsWith(".ts"))t.push(`${s.slice(0,-3)}.js`)}if(e.endsWith(".js"))t.push(`${e.slice(0,-3)}.ts`);return t}function O$(e){let t=k$(e),n=Il(e),r=[...t.filter((o)=>Il(o)===n),...t.filter((o)=>Il(o)!==n)],s=r.find((o)=>oT(o));if(s===void 0)throw Error(`no module at ${e} (tried ${r.join(", ")})`);return s}async function yp(e){let t=k$(e),n;for(let r of t)try{return await import(cT(r).href)}catch(s){n=s}throw n instanceof Error?n:Error(String(n))}function xp(e,t){return lT(_$(e,"package.json")).resolve(t)}function bp(e){return{importModule:(t)=>yp(t),loadJson:async(t)=>JSON.parse(iT(t,"utf8")),resolvePath:(t,n)=>{if(n.startsWith("./")||n.startsWith("../"))return _$(Il(t),n);if(aT(n))return n;return xp(e,n)}}}async function hs(e,t){return S$(t?.extensions,bp(e),An(e))}function Dl(e,t){return Error(`No format class registered for "${t}" (${e}). Enable an extension providing this format in project.json "extensions", e.g. "@jxsuite/parser".`)}var Br=R(()=>{w$();le();ho()});import{existsSync as uT,readFileSync as fT}from"node:fs";import{basename as dT,resolve as pT}from"node:path";function gs(e){let t=An(e);if(!uT(t))throw Error(`No project.jxn or project.json in ${e}`);let n;try{n=Nl(fT(t,"utf8"),t)}catch(i){throw Error(`Invalid ${dT(t)}: ${ge(i)}`,{cause:i})}let r={...Ta,...n,build:{...Ta.build,...n.build},defaults:{...Ta.defaults,...n.defaults},images:{...Ta.images,...n.images},url:n.url??Ta.url};if(n.$head)r.$head=n.$head;if(n.$media)r.$media=n.$media;if(n.style)r.style=n.style;if(n.state)r.state=n.state;if(n.redirects)r.redirects=n.redirects;if(n.imports)r.imports=n.imports;let s=["cloudflare-workers","cloudflare-pages","node","bun"];if(r.build.adapter==="static")delete r.build.adapter;if(r.build.adapter&&!s.includes(r.build.adapter))throw Error(`Unknown build adapter "${r.build.adapter}" in project.json. Valid adapters: ${s.join(", ")}`);let o=["build","cloudflare"];if(!o.includes(r.images.service))throw Error(`Unknown images.service "${r.images.service}" in project.json. Valid services: ${o.join(", ")}`);return{config:r,configPath:t,projectRoot:pT(e)}}function A$(e){return["0","false","no","off"].includes((e??"").trim().toLowerCase())}var Ta;var ii=R(()=>{Rt();Tl();ho();Ta={$head:[],$media:{},build:{format:"directory",outDir:"./dist",provider:null,trailingSlash:"always"},defaults:{charset:"utf8",lang:"en",layout:null},images:{formats:["avif","jpeg"],lazyLoad:!0,optimize:!0,picture:!0,quality:{avif:65,jpeg:80},service:"build",sizes:"(max-width: 768px) 100vw, 50vw",widths:[320,640,960,1280,1920]},imports:{},name:"Jx Site",redirects:{},state:{},style:{},url:""}});import{existsSync as $p,readFileSync as C$,writeFileSync as mT}from"node:fs";import{resolve as R$}from"node:path";async function N$(e,t={}){let{dryRun:n=!1,connection:r}=t,{config:s}=gs(e),o=await hs(e,s),i=L(s.connections)?s.connections:{},a=L(s.data)?s.data:{},c=Object.keys(i).filter((x)=>!r||x===r);if(r&&c.length===0)throw Error(`Unknown connection "${r}" (no such connections entry in project.json)`);if(c.length===0)throw Error('project.json has no "connections" section — nothing to push. Declare a connection and '+'its tables in the "data" section first.');let l={...process.env,...gT(e),JX_PROJECT_ROOT:e},u=[],d=[];for(let x of c){let g=i[x],y=L(g)?{...g,$name:x}:{$name:x},S=String(y.provider??""),E=hT(o.connectors(),S);if(!E)throw Error(`Connection "${x}" names provider "${S}", but no enabled extension provides it (enable the extension in project.json "extensions")`);let v={};for(let[P,O]of Object.entries(a))if(L(O)&&O.connection===x)v[P]=O;let j=await E.call("deploySchema",v,y,{dryRun:n,env:l});if(u.push({applied:j.applied??!n,connection:x,provider:S,statements:j.statements??[],tables:Object.keys(v),warnings:j.warnings??[]}),E.capabilities.bindings){let P=await E.call("bindings",y);if(L(P)&&Object.keys(P).length>0)d.push(P)}}let p=R$(e,"wrangler.jsonc"),m=!1;if(!n&&d.length>0&&$p(p)){let x=C$(p,"utf8"),{content:g,patched:y}=rb(x,d);if(y&&g!==x)mT(p,g,"utf8"),m=!0}return{bindingsPatched:m,results:u,wranglerPath:$p(p)?p:null}}function hT(e,t){return e.find((n)=>n.connector?.provider===t)}function gT(e){let t=R$(e,".dev.vars");if(!$p(t))return{};let n=new Map;for(let r of C$(t,"utf8").split(`
54
+ `)){let s=r.trim();if(s===""||s.startsWith("#"))continue;let o=s.indexOf("=");if(o===-1)continue;let i=s.slice(0,o).trim(),a=s.slice(o+1).trim();if(a.startsWith('"')&&a.endsWith('"')||a.startsWith("'")&&a.endsWith("'"))a=a.slice(1,-1);if(i!=="")n.set(i,a)}return Object.fromEntries(n)}var T$=R(()=>{ob();Br();ii();le()});function go(e){return e.startsWith(Ml)}function Fl(e){let t=e;if(go(t))t=t.slice(Ml.length);return t=t.replace(/^\.\//,"").replace(/\.(js|ts|mjs|mts)$/,"").replaceAll("@","").replaceAll(/[/\\]+/g,"-").replaceAll(/[^\w.-]/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,""),`${Sp}${t}.js`}function J$(e){let t=/\.(\w+)$/.exec(e)?.[1]??"",n=e.replace(/\.\w+$/,"").replaceAll("@","").replaceAll(/[/\\]+/g,"-").replaceAll(/[^\w.-]/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,"");return t===""?`${Sp}${n}`:`${Sp}${n}.${t}`}function I$(e){let t=e.replaceAll("\\","/");return t.length>1&&t.endsWith("/")?t.slice(0,-1):t}function Ll(e){let t=I$(e);return t.startsWith("/")?t:`/${t}`}function yT(e,t){return[...e].toSorted((n,r)=>r[t].length-n[t].length)}function Vl(e,t){let n=t.split("#")[0].split("?")[0];if(!n.startsWith("/"))return null;let r;try{r=decodeURIComponent(n)}catch{return null}if(/%2e|%2f/i.test(r))return null;for(let s of yT(e,"urlPrefix")){let o=Ll(s.urlPrefix);if(!r.startsWith(`${o}/`))continue;let a=r.slice(o.length+1).split("/");if(a.some((l)=>l===""||l==="."||l===".."))return null;let{filter:c}=s;if(c&&!c(a.join("/")))return null;return`${I$(s.dir)}/${a.join("/")}`}return null}function D$(e,t){let n=new Set;for(let r of t){let s=Ll(r.urlPrefix),o=new RegExp(`${s.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}/[^${xT}]+`,"g");for(let i of e.matchAll(o)){let a=i[0].split("#")[0].split("?")[0];if(!a.endsWith("/"))n.add(a)}}return[...n].filter(Boolean)}function wp(e){let t=[],n=0;while(n<e.length){while(n<e.length&&(/\s/.test(e[n])||e[n]===","))n+=1;if(n>=e.length)break;let r=n;while(n<e.length&&!/\s/.test(e[n]))n+=1;let s=e.slice(r,n);if(s.endsWith(",")){t.push({descriptor:"",url:s.replace(/,+$/,"")});continue}while(n<e.length&&/\s/.test(e[n]))n+=1;let o=n;while(n<e.length&&e[n]!==",")n+=1;let i=e.slice(o,n).trim();if(n+=1,s=s.replace(/,+$/,""),s!=="")t.push({descriptor:i,url:s})}return t}function vp(e){return e.map(({url:t,descriptor:n})=>n?`${t} ${n}`:t).join(", ")}function yo(e){if(!k(e)||e==="")return"";let t;try{({pathname:t}=new URL(e))}catch{return""}let n=t.replace(/\/+$/,"");if(n===""||n==="/")return"";return n.startsWith("/")?n:`/${n}`}function Ie(e,t){if(e===""||!t.startsWith("/")||t.startsWith("//"))return t;if(t===e||t.startsWith(`${e}/`))return t;return e+t}function ys(e,t){let n=new URL(t);if(!n.pathname.endsWith("/"))n.pathname+="/";return new URL(e.replace(/^\/+/,""),n).href}var Ml="npm:",Sp="/assets/",xT;var $n=R(()=>{le();xT=String.raw`"'\s<>()\\`});function M$(e,t){return e.replaceAll(vT,(n,r,s)=>{let o=s.trim(),i=kT.exec(o),a=i?i[2]:o,c=Ie(t,a);if(c===a)return n;return`url(${r}${i?`${i[1]}${c}${i[1]}`:c}${r})`})}function OT(e,t,n,r,s){let o=n.toLowerCase();if(bT.has(o))return Ie(s,r);if($T.has(o)){let i=wp(r);return i.length===0?r:vp(i.map((a)=>({descriptor:a.descriptor,url:Ie(s,a.url)})))}if(o==="style")return M$(r,s);if(o==="content"&&e==="meta"&&_T.test(t))return Ie(s,r);return r}function F$(e,t){if(t==="")return e;let n=e.replaceAll(jT,(r,s,o,i)=>{let a=o.replaceAll(ET,(c,l)=>`"${Ie(t,l)}"`);return s+a+i});return n=n.replaceAll(PT,(r,s,o,i)=>s+M$(o,t)+i),n.replaceAll(ST,(r,s,o)=>{if(o==="")return r;let i=s.toLowerCase(),a=o.replaceAll(wT,(c,l,u,d,p)=>{let m=d===void 0?"'":'"',x=d??p??"",g=OT(i,o,l,x,t);return g===x?c:`${l}=${m}${g}${m}`});return a===o?r:`<${s}${a}>`})}var bT,$T,ST,wT,vT,ET,jT,PT,_T,kT;var L$=R(()=>{$n();bT=new Set(["href","src","poster","action","formaction","data"]),$T=new Set(["srcset","imagesrcset"]),ST=/<([a-zA-Z][a-zA-Z0-9-]*)((?:"[^"]*"|'[^']*'|[^>"'])*)>/g,wT=/([a-zA-Z_:][\w:.-]*)\s*=\s*("([^"]*)"|'([^']*)')/g,vT=/url\(\s*(['"]?)([^'")]+)\1\s*\)/g,ET=/"(\/[^"/][^"]*)"/g,jT=/(<script\b[^>]*\btype\s*=\s*["']importmap["'][^>]*>)([\s\S]*?)(<\/script>)/gi,PT=/(<style\b[^>]*>)([\s\S]*?)(<\/style>)/gi,_T=/\b(?:property|name)\s*=\s*["'](?:og:|twitter:)[\w:.-]*(?:image|url|video|audio|player)[\w:.-]*["']/i,kT=/^(&quot;|&#34;|&apos;|&#39;)([\s\S]*)\1$/});var La=q(function(t5,fS){var __dirname="/home/runner/work/jx/jx/node_modules/esbuild/lib",__filename="/home/runner/work/jx/jx/node_modules/esbuild/lib/main.js",{defineProperty:kp,getOwnPropertyDescriptor:AT,getOwnPropertyNames:CT}=Object,RT=Object.prototype.hasOwnProperty,NT=(e,t)=>{for(var n in t)kp(e,n,{get:t[n],enumerable:!0})},TT=(e,t,n,r)=>{if(t&&typeof t==="object"||typeof t==="function"){for(let s of CT(t))if(!RT.call(e,s)&&s!==n)kp(e,s,{get:()=>t[s],enumerable:!(r=AT(t,s))||r.enumerable})}return e},JT=(e)=>TT(kp({},"__esModule",{value:!0}),e),Ma={};NT(Ma,{analyzeMetafile:()=>dJ,analyzeMetafileSync:()=>gJ,build:()=>cJ,buildSync:()=>pJ,context:()=>lJ,default:()=>$J,formatMessages:()=>fJ,formatMessagesSync:()=>hJ,initialize:()=>xJ,stop:()=>yJ,transform:()=>uJ,transformSync:()=>mJ,version:()=>aJ});fS.exports=JT(Ma);function V$(e){let t=(r)=>{if(r===null)n.write8(0);else if(typeof r==="boolean")n.write8(1),n.write8(+r);else if(typeof r==="number")n.write8(2),n.write32(r|0);else if(typeof r==="string")n.write8(3),n.write(zn(r));else if(r instanceof Uint8Array)n.write8(4),n.write(r);else if(r instanceof Array){n.write8(5),n.write32(r.length);for(let s of r)t(s)}else{let s=Object.keys(r);n.write8(6),n.write32(s.length);for(let o of s)n.write(zn(o)),t(r[o])}},n=new Y$;return n.write32(0),n.write32(e.id<<1|+!e.isRequest),t(e.value),jp(n.buf,n.len-4,0),n.buf.subarray(0,n.len)}function IT(e){let t=()=>{switch(n.read8()){case 0:return null;case 1:return!!n.read8();case 2:return n.read32();case 3:return wo(n.read());case 4:return n.read();case 5:{let i=n.read32(),a=[];for(let c=0;c<i;c++)a.push(t());return a}case 6:{let i=n.read32(),a={};for(let c=0;c<i;c++)a[wo(n.read())]=t();return a}default:throw Error("Invalid packet")}},n=new Y$(e),r=n.read32(),s=(r&1)===0;r>>>=1;let o=t();if(n.ptr!==e.length)throw Error("Invalid packet");return{id:r,isRequest:s,value:o}}var Y$=class{constructor(e=new Uint8Array(1024)){this.buf=e,this.len=0,this.ptr=0}_write(e){if(this.len+e>this.buf.length){let t=new Uint8Array((this.len+e)*2);t.set(this.buf),this.buf=t}return this.len+=e,this.len-e}write8(e){let t=this._write(1);this.buf[t]=e}write32(e){let t=this._write(4);jp(this.buf,e,t)}write(e){let t=this._write(4+e.length);jp(this.buf,e.length,t),this.buf.set(e,t+4)}_read(e){if(this.ptr+e>this.buf.length)throw Error("Invalid packet");return this.ptr+=e,this.ptr-e}read8(){return this.buf[this._read(1)]}read32(){return Z$(this.buf,this._read(4))}read(){let e=this.read32(),t=new Uint8Array(e),n=this._read(t.length);return t.set(this.buf.subarray(n,n+e)),t}},zn,wo,Ep;if(typeof TextEncoder<"u"&&typeof TextDecoder<"u"){let e=new TextEncoder,t=new TextDecoder;zn=(n)=>e.encode(n),wo=(n)=>t.decode(n),Ep='new TextEncoder().encode("")'}else if(typeof Buffer<"u")zn=(e)=>Buffer.from(e),wo=(e)=>{let{buffer:t,byteOffset:n,byteLength:r}=e;return Buffer.from(t,n,r).toString()},Ep='Buffer.from("")';else throw Error("No UTF-8 codec found");if(!(zn("")instanceof Uint8Array))throw Error(`Invariant violation: "${Ep} instanceof Uint8Array" is incorrectly false
55
55
 
56
56
  This indicates that your JavaScript environment is broken. You cannot use
57
57
  esbuild in this environment because esbuild relies on this invariant. This
58
58
  is not a problem with esbuild. You need to fix your environment instead.
59
- `);function Xx(e,t){return(e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)>>>0}function Qd(e,t,n){e[n++]=t,e[n++]=t>>8,e[n++]=t>>16,e[n++]=t>>24}var Br=String.fromCharCode;function Cn(e,t,n){let r=e[t],s=1,o=0;for(let i=0;i<t;i++)if(e[i]===10)s++,o=0;else o++;throw SyntaxError(n?n:t===e.length?"Unexpected end of input while parsing JSON":r>=32&&r<=126?`Unexpected character ${Br(r)} in JSON at position ${t} (line ${s}, column ${o})`:`Unexpected byte 0x${r.toString(16)} in JSON at position ${t} (line ${s}, column ${o})`)}function NN(e){if(!(e instanceof Uint8Array))throw Error("JSON input must be a Uint8Array");let t=[],n=[],r=[],s=e.length,o=null,i=0,a,c=0;while(c<s){let l=e[c++];if(l<=32)continue;let u;if(i===2&&o===null&&l!==34&&l!==125)Cn(e,--c);switch(l){case 116:{if(e[c++]!==114||e[c++]!==117||e[c++]!==101)Cn(e,--c);u=!0;break}case 102:{if(e[c++]!==97||e[c++]!==108||e[c++]!==115||e[c++]!==101)Cn(e,--c);u=!1;break}case 110:{if(e[c++]!==117||e[c++]!==108||e[c++]!==108)Cn(e,--c);u=null;break}case 45:case 46:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:{let d=c;u=Br(l),l=e[c];while(!0){switch(l){case 43:case 45:case 46:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 101:case 69:{u+=Br(l),l=e[++c];continue}}break}if(u=+u,isNaN(u))Cn(e,--d,"Invalid number");break}case 34:{u="";while(!0){if(c>=s)Cn(e,s);if(l=e[c++],l===34)break;else if(l===92)switch(e[c++]){case 34:u+='"';break;case 47:u+="/";break;case 92:u+="\\";break;case 98:u+="\b";break;case 102:u+="\f";break;case 110:u+=`
60
- `;break;case 114:u+="\r";break;case 116:u+="\t";break;case 117:{let d=0;for(let p=0;p<4;p++)if(l=e[c++],d<<=4,l>=48&&l<=57)d|=l-48;else if(l>=97&&l<=102)d|=l+-87;else if(l>=65&&l<=70)d|=l+-55;else Cn(e,--c);u+=Br(d);break}default:Cn(e,--c);break}else if(l<=127)u+=Br(l);else if((l&224)===192)u+=Br((l&31)<<6|e[c++]&63);else if((l&240)===224)u+=Br((l&15)<<12|(e[c++]&63)<<6|e[c++]&63);else if((l&248)==240){let d=(l&7)<<18|(e[c++]&63)<<12|(e[c++]&63)<<6|e[c++]&63;if(d>65535)d-=65536,u+=Br(d>>10&1023|55296),d=56320|d&1023;u+=Br(d)}}u[0];break}case 91:{u=[],t.push(o),n.push(a),r.push(i),o=null,a=u,i=1;continue}case 123:{u={},t.push(o),n.push(a),r.push(i),o=null,a=u,i=2;continue}case 93:{if(i!==1)Cn(e,--c);u=a,o=t.pop(),a=n.pop(),i=r.pop();break}case 125:{if(i!==2)Cn(e,--c);u=a,o=t.pop(),a=n.pop(),i=r.pop();break}default:Cn(e,--c)}l=e[c];while(l<=32)l=e[++c];switch(i){case 0:{if(c===s)return u;break}case 1:{if(a.push(u),l===44){c++;continue}if(l===93)continue;break}case 2:{if(o===null){if(o=u,l===58){c++;continue}}else{if(a[o]=u,o=null,l===44){c++;continue}if(l===125)continue}break}}break}Cn(e,c)}var bt=JSON.stringify,Lx="warning",Vx="silent";function fi(e,t){let n=[];for(let r of e){if(sn(r,t),r.indexOf(",")>=0)throw Error(`Invalid ${t}: ${r}`);n.push(r)}return n.join(",")}var Al=()=>null,et=(e)=>typeof e==="boolean"?null:"a boolean",re=(e)=>typeof e==="string"?null:"a string",Rl=(e)=>e instanceof RegExp?null:"a RegExp object",yo=(e)=>typeof e==="number"&&e===(e|0)?null:"an integer",TN=(e)=>typeof e==="number"&&e===(e|0)&&e>=0&&e<=65535?null:"a valid port number",Yx=(e)=>typeof e==="function"?null:"a function",zr=(e)=>Array.isArray(e)?null:"an array",on=(e)=>Array.isArray(e)&&e.every((t)=>typeof t==="string")?null:"an array of strings",wn=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)?null:"an object",JN=(e)=>typeof e==="object"&&e!==null?null:"an array or an object",IN=(e)=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",qx=(e)=>typeof e==="object"&&!Array.isArray(e)?null:"an object or null",Zx=(e)=>typeof e==="string"||typeof e==="boolean"?null:"a string or a boolean",MN=(e)=>typeof e==="string"||typeof e==="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",Qx=(e)=>typeof e==="string"||Array.isArray(e)&&e.every((t)=>typeof t==="string")?null:"a string or an array of strings",eb=(e)=>typeof e==="string"||e instanceof Uint8Array?null:"a string or a Uint8Array",DN=(e)=>typeof e==="string"||e instanceof URL?null:"a string or a URL";function R(e,t,n,r){let s=e[n];if(t[n+""]=!0,s===void 0)return;let o=r(s);if(o!==null)throw Error(`${bt(n)} must be ${o}`);return s}function gt(e,t,n){for(let r in e)if(!(r in t))throw Error(`Invalid option ${n}: ${bt(r)}`)}function FN(e){let t=Object.create(null),n=R(e,t,"wasmURL",DN),r=R(e,t,"wasmModule",IN),s=R(e,t,"worker",et);return gt(e,t,"in initialize() call"),{wasmURL:n,wasmModule:r,worker:s}}function tb(e){let t;if(e!==void 0){t=Object.create(null);for(let n in e){let r=e[n];if(typeof r==="string"||r===!1)t[n]=r;else throw Error(`Expected ${bt(n)} in mangle cache to map to either a string or false`)}}return t}function Il(e,t,n,r,s){let o=R(t,n,"color",et),i=R(t,n,"logLevel",re),a=R(t,n,"logLimit",yo),c=R(t,n,"logStyle",re);if(o!==void 0)e.push(`--color=${o}`);else if(r)e.push("--color=true");if(e.push(`--log-level=${i||s}`),e.push(`--log-limit=${a||0}`),c)e.push(`--log-style=${c}`)}function sn(e,t,n){if(typeof e!=="string")throw Error(`Expected value for ${t}${n!==void 0?" "+bt(n):""} to be a string, got ${typeof e} instead`);return e}function nb(e,t,n){let r=R(t,n,"legalComments",re),s=R(t,n,"sourceRoot",re),o=R(t,n,"sourcesContent",et),i=R(t,n,"target",Qx),a=R(t,n,"format",re),c=R(t,n,"globalName",re),l=R(t,n,"mangleProps",Rl),u=R(t,n,"reserveProps",Rl),d=R(t,n,"mangleQuoted",et),p=R(t,n,"minify",et),m=R(t,n,"minifySyntax",et),x=R(t,n,"minifyWhitespace",et),h=R(t,n,"minifyIdentifiers",et),g=R(t,n,"lineLimit",yo),b=R(t,n,"drop",on),j=R(t,n,"dropLabels",on),v=R(t,n,"charset",re),P=R(t,n,"treeShaking",et),S=R(t,n,"ignoreAnnotations",et),_=R(t,n,"jsx",re),N=R(t,n,"jsxFactory",re),F=R(t,n,"jsxFragment",re),K=R(t,n,"jsxImportSource",re),J=R(t,n,"jsxDev",et),C=R(t,n,"jsxSideEffects",et),L=R(t,n,"define",wn),G=R(t,n,"logOverride",wn),te=R(t,n,"supported",wn),de=R(t,n,"pure",on),ae=R(t,n,"keepNames",et),ne=R(t,n,"platform",re),se=R(t,n,"tsconfigRaw",MN),xe=R(t,n,"absPaths",on);if(r)e.push(`--legal-comments=${r}`);if(s!==void 0)e.push(`--source-root=${s}`);if(o!==void 0)e.push(`--sources-content=${o}`);if(i)e.push(`--target=${fi(Array.isArray(i)?i:[i],"target")}`);if(a)e.push(`--format=${a}`);if(c)e.push(`--global-name=${c}`);if(ne)e.push(`--platform=${ne}`);if(se)e.push(`--tsconfig-raw=${typeof se==="string"?se:JSON.stringify(se)}`);if(p)e.push("--minify");if(m)e.push("--minify-syntax");if(x)e.push("--minify-whitespace");if(h)e.push("--minify-identifiers");if(g)e.push(`--line-limit=${g}`);if(v)e.push(`--charset=${v}`);if(P!==void 0)e.push(`--tree-shaking=${P}`);if(S)e.push("--ignore-annotations");if(b)for(let z of b)e.push(`--drop:${sn(z,"drop")}`);if(j)e.push(`--drop-labels=${fi(j,"drop label")}`);if(xe)e.push(`--abs-paths=${fi(xe,"abs paths")}`);if(l)e.push(`--mangle-props=${Cl(l)}`);if(u)e.push(`--reserve-props=${Cl(u)}`);if(d!==void 0)e.push(`--mangle-quoted=${d}`);if(_)e.push(`--jsx=${_}`);if(N)e.push(`--jsx-factory=${N}`);if(F)e.push(`--jsx-fragment=${F}`);if(K)e.push(`--jsx-import-source=${K}`);if(J)e.push("--jsx-dev");if(C)e.push("--jsx-side-effects");if(L)for(let z in L){if(z.indexOf("=")>=0)throw Error(`Invalid define: ${z}`);e.push(`--define:${z}=${sn(L[z],"define",z)}`)}if(G)for(let z in G){if(z.indexOf("=")>=0)throw Error(`Invalid log override: ${z}`);e.push(`--log-override:${z}=${sn(G[z],"log override",z)}`)}if(te)for(let z in te){if(z.indexOf("=")>=0)throw Error(`Invalid supported: ${z}`);let ye=te[z];if(typeof ye!=="boolean")throw Error(`Expected value for supported ${bt(z)} to be a boolean, got ${typeof ye} instead`);e.push(`--supported:${z}=${ye}`)}if(de)for(let z of de)e.push(`--pure:${sn(z,"pure")}`);if(ae)e.push("--keep-names")}function LN(e,t,n,r,s){var o;let i=[],a=[],c=Object.create(null),l=null,u=null;Il(i,t,c,n,r),nb(i,t,c);let d=R(t,c,"sourcemap",Zx),p=R(t,c,"bundle",et),m=R(t,c,"splitting",et),x=R(t,c,"preserveSymlinks",et),h=R(t,c,"metafile",et),g=R(t,c,"outfile",re),b=R(t,c,"outdir",re),j=R(t,c,"outbase",re),v=R(t,c,"tsconfig",re),P=R(t,c,"resolveExtensions",on),S=R(t,c,"nodePaths",on),_=R(t,c,"mainFields",on),N=R(t,c,"conditions",on),F=R(t,c,"external",on),K=R(t,c,"packages",re),J=R(t,c,"alias",wn),C=R(t,c,"loader",wn),L=R(t,c,"outExtension",wn),G=R(t,c,"publicPath",re),te=R(t,c,"entryNames",re),de=R(t,c,"chunkNames",re),ae=R(t,c,"assetNames",re),ne=R(t,c,"inject",on),se=R(t,c,"banner",wn),xe=R(t,c,"footer",wn),z=R(t,c,"entryPoints",JN),ye=R(t,c,"absWorkingDir",re),pe=R(t,c,"stdin",wn),ee=(o=R(t,c,"write",et))!=null?o:s,Qe=R(t,c,"allowOverwrite",et),Me=R(t,c,"mangleCache",wn);if(c.plugins=!0,gt(t,c,`in ${e}() call`),d)i.push(`--sourcemap${d===!0?"":`=${d}`}`);if(p)i.push("--bundle");if(Qe)i.push("--allow-overwrite");if(m)i.push("--splitting");if(x)i.push("--preserve-symlinks");if(h)i.push("--metafile");if(g)i.push(`--outfile=${g}`);if(b)i.push(`--outdir=${b}`);if(j)i.push(`--outbase=${j}`);if(v)i.push(`--tsconfig=${v}`);if(K)i.push(`--packages=${K}`);if(P)i.push(`--resolve-extensions=${fi(P,"resolve extension")}`);if(G)i.push(`--public-path=${G}`);if(te)i.push(`--entry-names=${te}`);if(de)i.push(`--chunk-names=${de}`);if(ae)i.push(`--asset-names=${ae}`);if(_)i.push(`--main-fields=${fi(_,"main field")}`);if(N)i.push(`--conditions=${fi(N,"condition")}`);if(F)for(let X of F)i.push(`--external:${sn(X,"external")}`);if(J)for(let X in J){if(X.indexOf("=")>=0)throw Error(`Invalid package name in alias: ${X}`);i.push(`--alias:${X}=${sn(J[X],"alias",X)}`)}if(se)for(let X in se){if(X.indexOf("=")>=0)throw Error(`Invalid banner file type: ${X}`);i.push(`--banner:${X}=${sn(se[X],"banner",X)}`)}if(xe)for(let X in xe){if(X.indexOf("=")>=0)throw Error(`Invalid footer file type: ${X}`);i.push(`--footer:${X}=${sn(xe[X],"footer",X)}`)}if(ne)for(let X of ne)i.push(`--inject:${sn(X,"inject")}`);if(C)for(let X in C){if(X.indexOf("=")>=0)throw Error(`Invalid loader extension: ${X}`);i.push(`--loader:${X}=${sn(C[X],"loader",X)}`)}if(L)for(let X in L){if(X.indexOf("=")>=0)throw Error(`Invalid out extension: ${X}`);i.push(`--out-extension:${X}=${sn(L[X],"out extension",X)}`)}if(z)if(Array.isArray(z))for(let X=0,Bt=z.length;X<Bt;X++){let Et=z[X];if(typeof Et==="object"&&Et!==null){let ce=Object.create(null),be=R(Et,ce,"in",re),Fe=R(Et,ce,"out",re);if(gt(Et,ce,"in entry point at index "+X),be===void 0)throw Error('Missing property "in" for entry point at index '+X);if(Fe===void 0)throw Error('Missing property "out" for entry point at index '+X);a.push([Fe,be])}else a.push(["",sn(Et,"entry point at index "+X)])}else for(let X in z)a.push([X,sn(z[X],"entry point",X)]);if(pe){let X=Object.create(null),Bt=R(pe,X,"contents",eb),Et=R(pe,X,"resolveDir",re),ce=R(pe,X,"sourcefile",re),be=R(pe,X,"loader",re);if(gt(pe,X,'in "stdin" object'),ce)i.push(`--sourcefile=${ce}`);if(be)i.push(`--loader=${be}`);if(Et)u=Et;if(typeof Bt==="string")l=Gn(Bt);else if(Bt instanceof Uint8Array)l=Bt}let Ge=[];if(S)for(let X of S)X+="",Ge.push(X);return{entries:a,flags:i,write:ee,stdinContents:l,stdinResolveDir:u,absWorkingDir:ye,nodePaths:Ge,mangleCache:tb(Me)}}function VN(e,t,n,r){let s=[],o=Object.create(null);Il(s,t,o,n,r),nb(s,t,o);let i=R(t,o,"sourcemap",Zx),a=R(t,o,"sourcefile",re),c=R(t,o,"loader",re),l=R(t,o,"banner",re),u=R(t,o,"footer",re),d=R(t,o,"mangleCache",wn);if(gt(t,o,`in ${e}() call`),i)s.push(`--sourcemap=${i===!0?"external":i}`);if(a)s.push(`--sourcefile=${a}`);if(c)s.push(`--loader=${c}`);if(l)s.push(`--banner=${l}`);if(u)s.push(`--footer=${u}`);return{flags:s,mangleCache:tb(d)}}function rb(e){let t={},n={didClose:!1,reason:""},r={},s=0,o=0,i=new Uint8Array(16384),a=0,c=(v)=>{let P=a+v.length;if(P>i.length){let _=new Uint8Array(P*2);_.set(i),i=_}i.set(v,a),a+=v.length;let S=0;while(S+4<=a){let _=Xx(i,S);if(S+4+_>a)break;S+=4,x(i.subarray(S,S+_)),S+=_}if(S>0)i.copyWithin(0,S,a),a-=S},l=(v)=>{if(n.didClose=!0,v)n.reason=": "+(v.message||v);let P="The service was stopped"+n.reason;for(let S in r)r[S](P,null);r={}},u=(v,P,S)=>{if(n.didClose)return S("The service is no longer running"+n.reason,null);let _=s++;if(r[_]=(N,F)=>{try{S(N,F)}finally{if(v)v.unref()}},v)v.ref();e.writeToStdin(Fx({id:_,isRequest:!0,value:P}))},d=(v,P)=>{if(n.didClose)throw Error("The service is no longer running"+n.reason);e.writeToStdin(Fx({id:v,isRequest:!1,value:P}))},p=async(v,P)=>{try{if(P.command==="ping"){d(v,{});return}if(typeof P.key==="number"){let S=t[P.key];if(!S)return;let _=S[P.command];if(_){await _(v,P);return}}throw Error("Invalid command: "+P.command)}catch(S){let _=[go(S,e,null,void 0,"")];try{d(v,{errors:_})}catch{}}},m=!0,x=(v)=>{if(m){m=!1;let S=String.fromCharCode(...v);if(S!=="0.28.2")throw Error(`Cannot start service: Host version "0.28.2" does not match binary version ${bt(S)}`);return}let P=CN(v);if(P.isRequest)p(P.id,P.value);else{let S=r[P.id];if(delete r[P.id],P.value.error)S(P.value.error,{});else S(null,P.value)}};return{readFromStdout:c,afterClose:l,service:{buildOrContext:({callName:v,refs:P,options:S,isTTY:_,defaultWD:N,callback:F})=>{let K=0,J=o++,C={},L={ref(){if(++K===1){if(P)P.ref()}},unref(){if(--K===0){if(delete t[J],P)P.unref()}}};t[J]=C,L.ref(),qN(v,J,u,d,L,e,C,S,_,N,(G,te)=>{try{F(G,te)}finally{L.unref()}})},transform:({callName:v,refs:P,input:S,options:_,isTTY:N,fs:F,callback:K})=>{let J=sb(),C=(L)=>{try{if(typeof S!=="string"&&!(S instanceof Uint8Array))throw Error('The input to "transform" must be a string or a Uint8Array');let{flags:G,mangleCache:te}=VN(v,_,N,Vx),de={command:"transform",flags:G,inputFS:L!==null,input:L!==null?Gn(L):typeof S==="string"?Gn(S):S};if(te)de.mangleCache=te;u(P,de,(ae,ne)=>{if(ae)return K(Error(ae),null);let se=di(ne.errors,J),xe=di(ne.warnings,J),z=1,ye=()=>{if(--z===0){let pe={warnings:xe,code:ne.code,map:ne.map,mangleCache:void 0,legalComments:void 0};if("legalComments"in ne)pe.legalComments=ne==null?void 0:ne.legalComments;if(ne.mangleCache)pe.mangleCache=ne==null?void 0:ne.mangleCache;K(null,pe)}};if(se.length>0)return K(La("Transform failed",se,xe),null);if(ne.codeFS)z++,F.readFile(ne.code,(pe,ee)=>{if(pe!==null)K(pe,null);else ne.code=ee,ye()});if(ne.mapFS)z++,F.readFile(ne.map,(pe,ee)=>{if(pe!==null)K(pe,null);else ne.map=ee,ye()});ye()})}catch(G){let te=[];try{Il(te,_,{},N,Vx)}catch{}let de=go(G,e,J,void 0,"");u(P,{command:"error",flags:te,error:de},()=>{de.detail=J.load(de.detail),K(La("Transform failed",[de],[]),null)})}};if((typeof S==="string"||S instanceof Uint8Array)&&S.length>1048576){let L=C;C=()=>F.writeFile(S,L)}C(null)},formatMessages:({callName:v,refs:P,messages:S,options:_,callback:N})=>{if(!_)throw Error(`Missing second argument in ${v}() call`);let F={},K=R(_,F,"kind",re),J=R(_,F,"color",et),C=R(_,F,"terminalWidth",yo),L=R(_,F,"logStyle",re);if(gt(_,F,`in ${v}() call`),K===void 0)throw Error(`Missing "kind" in ${v}() call`);if(K!=="error"&&K!=="warning")throw Error(`Expected "kind" to be "error" or "warning" in ${v}() call`);let G={command:"format-msgs",messages:Kr(S,"messages",null,"",C),isWarning:K==="warning"};if(J!==void 0)G.color=J;if(C!==void 0)G.terminalWidth=C;if(L!==void 0)G.logStyle=L;u(P,G,(te,de)=>{if(te)return N(Error(te),null);N(null,de.messages)})},analyzeMetafile:({callName:v,refs:P,metafile:S,options:_,callback:N})=>{if(_===void 0)_={};let F={},K=R(_,F,"color",et),J=R(_,F,"verbose",et);gt(_,F,`in ${v}() call`);let C={command:"analyze-metafile",metafile:S};if(K!==void 0)C.color=K;if(J!==void 0)C.verbose=J;u(P,C,(L,G)=>{if(L)return N(Error(L),null);N(null,G.result)})}}}}function qN(e,t,n,r,s,o,i,a,c,l,u){let d=sb(),p=e==="context",m=(g,b)=>{let j=[];try{Il(j,a,{},c,Lx)}catch{}let v=go(g,o,d,void 0,b);n(s,{command:"error",flags:j,error:v},()=>{v.detail=d.load(v.detail),u(La(p?"Context failed":"Build failed",[v],[]),null)})},x;if(typeof a==="object"){let g=a.plugins;if(g!==void 0){if(!Array.isArray(g))return m(Error('"plugins" must be an array'),"");x=g}}if(x&&x.length>0){if(o.isSync)return m(Error("Cannot use plugins in synchronous API calls"),"");WN(t,n,r,s,o,i,a,x,d).then((g)=>{if(!g.ok)return m(g.error,g.pluginName);try{h(g.requestPlugins,g.runOnEndCallbacks,g.scheduleOnDisposeCallbacks)}catch(b){m(b,"")}},(g)=>m(g,""));return}try{h(null,(g,b)=>b([],[]),()=>{})}catch(g){m(g,"")}function h(g,b,j){let v=o.hasFS,{entries:P,flags:S,write:_,stdinContents:N,stdinResolveDir:F,absWorkingDir:K,nodePaths:J,mangleCache:C}=LN(e,a,c,Lx,v);if(_&&!o.hasFS)throw Error('The "write" option is unavailable in this environment');let L={command:"build",key:t,entries:P,flags:S,write:_,stdinContents:N,stdinResolveDir:F,absWorkingDir:K||l,nodePaths:J,context:p};if(g)L.plugins=g;if(C)L.mangleCache=C;let G=(ae,ne)=>{let se={errors:di(ae.errors,d),warnings:di(ae.warnings,d),outputFiles:void 0,metafile:void 0,mangleCache:void 0},xe=se.errors.slice(),z=se.warnings.slice();if(ae.outputFiles)se.outputFiles=ae.outputFiles.map(UN);if(ae.metafile&&ae.metafile.length)se.metafile=BN(ae.metafile);if(ae.mangleCache)se.mangleCache=ae.mangleCache;if(ae.writeToStdout!==void 0)console.log($o(ae.writeToStdout).replace(/\n$/,""));b(se,(ye,pe)=>{if(xe.length>0||ye.length>0){let ee=La("Build failed",xe.concat(ye),z.concat(pe));return ne(ee,null,ye,pe)}ne(null,se,ye,pe)})},te,de;if(p)i["on-end"]=(ae,ne)=>new Promise((se)=>{G(ne,(xe,z,ye,pe)=>{let ee={errors:ye,warnings:pe};if(de)de(xe,z);te=void 0,de=void 0,r(ae,ee),se()})});n(s,L,(ae,ne)=>{if(ae)return u(Error(ae),null);if(!p)return G(ne,(z,ye)=>(j(),u(z,ye)));if(ne.errors.length>0)return u(La("Context failed",ne.errors,ne.warnings),null);let se=!1,xe={rebuild:()=>{if(!te)te=new Promise((z,ye)=>{let pe;de=(Qe,Me)=>{if(!pe)pe=()=>Qe?ye(Qe):z(Me)};let ee=()=>{n(s,{command:"rebuild",key:t},(Me,Ge)=>{if(Me)ye(Error(Me));else if(pe)pe();else ee()})};ee()});return te},watch:(z={})=>new Promise((ye,pe)=>{if(!o.hasFS)throw Error('Cannot use the "watch" API in this environment');let ee={},Qe=R(z,ee,"delay",yo);gt(z,ee,"in watch() call");let Me={command:"watch",key:t};if(Qe)Me.delay=Qe;n(s,Me,(Ge)=>{if(Ge)pe(Error(Ge));else ye(void 0)})}),serve:(z={})=>new Promise((ye,pe)=>{if(!o.hasFS)throw Error('Cannot use the "serve" API in this environment');let ee={},Qe=R(z,ee,"port",TN),Me=R(z,ee,"host",re),Ge=R(z,ee,"servedir",re),X=R(z,ee,"keyfile",re),Bt=R(z,ee,"certfile",re),Et=R(z,ee,"fallback",re),ce=R(z,ee,"cors",wn),be=R(z,ee,"onRequest",Yx);gt(z,ee,"in serve() call");let Fe={command:"serve",key:t,onRequest:!!be};if(Qe!==void 0)Fe.port=Qe;if(Me!==void 0)Fe.host=Me;if(Ge!==void 0)Fe.servedir=Ge;if(X!==void 0)Fe.keyfile=X;if(Bt!==void 0)Fe.certfile=Bt;if(Et!==void 0)Fe.fallback=Et;if(ce){let Le={},ot=R(ce,Le,"origin",Qx);if(gt(ce,Le,'on "cors" object'),Array.isArray(ot))Fe.corsOrigin=ot;else if(ot!==void 0)Fe.corsOrigin=[ot]}n(s,Fe,(Le,ot)=>{if(Le)return pe(Error(Le));if(be)i["serve-request"]=(Nr,nr)=>{be(nr.args),r(Nr,{})};ye(ot)})}),cancel:()=>new Promise((z)=>{if(se)return z();n(s,{command:"cancel",key:t},()=>{z()})}),dispose:()=>new Promise((z)=>{if(se)return z();se=!0,n(s,{command:"dispose",key:t},()=>{z(),j(),s.unref()})})};s.ref(),u(null,xe)})}}var WN=async(e,t,n,r,s,o,i,a,c)=>{let l=[],u=[],d={},p={},m=[],x=0,h=0,g=[],b=!1;a=[...a];for(let P of a){let S={};if(typeof P!=="object")throw Error(`Plugin at index ${h} must be an object`);let _=R(P,S,"name",re);if(typeof _!=="string"||_==="")throw Error(`Plugin at index ${h} is missing a name`);try{let N=R(P,S,"setup",Yx);if(typeof N!=="function")throw Error("Plugin is missing a setup function");gt(P,S,`on plugin ${bt(_)}`);let F={name:_,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};h++;let J=N({initialOptions:i,resolve:(C,L={})=>{if(!b)throw Error('Cannot call "resolve" before plugin setup has completed');if(typeof C!=="string")throw Error("The path to resolve must be a string");let G=Object.create(null),te=R(L,G,"pluginName",re),de=R(L,G,"importer",re),ae=R(L,G,"namespace",re),ne=R(L,G,"resolveDir",re),se=R(L,G,"kind",re),xe=R(L,G,"pluginData",Al),z=R(L,G,"with",wn);return gt(L,G,"in resolve() call"),new Promise((ye,pe)=>{let ee={command:"resolve",path:C,key:e,pluginName:_};if(te!=null)ee.pluginName=te;if(de!=null)ee.importer=de;if(ae!=null)ee.namespace=ae;if(ne!=null)ee.resolveDir=ne;if(se!=null)ee.kind=se;else throw Error('Must specify "kind" when calling "resolve"');if(xe!=null)ee.pluginData=c.store(xe);if(z!=null)ee.with=HN(z,"with");t(r,ee,(Qe,Me)=>{if(Qe!==null)pe(Error(Qe));else ye({errors:di(Me.errors,c),warnings:di(Me.warnings,c),path:Me.path,external:Me.external,sideEffects:Me.sideEffects,namespace:Me.namespace,suffix:Me.suffix,pluginData:c.load(Me.pluginData)})})})},onStart(C){let G=kl(Error('This error came from the "onStart" callback registered here:'),s,"onStart");l.push({name:_,callback:C,note:G}),F.onStart=!0},onEnd(C){let G=kl(Error('This error came from the "onEnd" callback registered here:'),s,"onEnd");u.push({name:_,callback:C,note:G}),F.onEnd=!0},onResolve(C,L){let te=kl(Error('This error came from the "onResolve" callback registered here:'),s,"onResolve"),de={},ae=R(C,de,"filter",Rl),ne=R(C,de,"namespace",re);if(gt(C,de,`in onResolve() call for plugin ${bt(_)}`),ae==null)throw Error("onResolve() call is missing a filter");let se=x++;d[se]={name:_,callback:L,note:te},F.onResolve.push({id:se,filter:Cl(ae),namespace:ne||""})},onLoad(C,L){let te=kl(Error('This error came from the "onLoad" callback registered here:'),s,"onLoad"),de={},ae=R(C,de,"filter",Rl),ne=R(C,de,"namespace",re);if(gt(C,de,`in onLoad() call for plugin ${bt(_)}`),ae==null)throw Error("onLoad() call is missing a filter");let se=x++;p[se]={name:_,callback:L,note:te},F.onLoad.push({id:se,filter:Cl(ae),namespace:ne||""})},onDispose(C){m.push(C)},esbuild:s.esbuild});if(J)await J;g.push(F)}catch(N){return{ok:!1,error:N,pluginName:_}}}o["on-start"]=async(P,S)=>{c.clear();let _={errors:[],warnings:[]};await Promise.all(l.map(async({name:N,callback:F,note:K})=>{try{let J=await F();if(J!=null){if(typeof J!=="object")throw Error(`Expected onStart() callback in plugin ${bt(N)} to return an object`);let C={},L=R(J,C,"errors",zr),G=R(J,C,"warnings",zr);if(gt(J,C,`from onStart() callback in plugin ${bt(N)}`),L!=null)_.errors.push(...Kr(L,"errors",c,N,void 0));if(G!=null)_.warnings.push(...Kr(G,"warnings",c,N,void 0))}}catch(J){_.errors.push(go(J,s,c,K&&K(),N))}})),n(P,_)},o["on-resolve"]=async(P,S)=>{let _={},N="",F,K;for(let J of S.ids)try{({name:N,callback:F,note:K}=d[J]);let C=await F({path:S.path,importer:S.importer,namespace:S.namespace,resolveDir:S.resolveDir,kind:S.kind,pluginData:c.load(S.pluginData),with:S.with});if(C!=null){if(typeof C!=="object")throw Error(`Expected onResolve() callback in plugin ${bt(N)} to return an object`);let L={},G=R(C,L,"pluginName",re),te=R(C,L,"path",re),de=R(C,L,"namespace",re),ae=R(C,L,"suffix",re),ne=R(C,L,"external",et),se=R(C,L,"sideEffects",et),xe=R(C,L,"pluginData",Al),z=R(C,L,"errors",zr),ye=R(C,L,"warnings",zr),pe=R(C,L,"watchFiles",on),ee=R(C,L,"watchDirs",on);if(gt(C,L,`from onResolve() callback in plugin ${bt(N)}`),_.id=J,G!=null)_.pluginName=G;if(te!=null)_.path=te;if(de!=null)_.namespace=de;if(ae!=null)_.suffix=ae;if(ne!=null)_.external=ne;if(se!=null)_.sideEffects=se;if(xe!=null)_.pluginData=c.store(xe);if(z!=null)_.errors=Kr(z,"errors",c,N,void 0);if(ye!=null)_.warnings=Kr(ye,"warnings",c,N,void 0);if(pe!=null)_.watchFiles=Ol(pe,"watchFiles");if(ee!=null)_.watchDirs=Ol(ee,"watchDirs");break}}catch(C){_={id:J,errors:[go(C,s,c,K&&K(),N)]};break}n(P,_)},o["on-load"]=async(P,S)=>{let _={},N="",F,K;for(let J of S.ids)try{({name:N,callback:F,note:K}=p[J]);let C=await F({path:S.path,namespace:S.namespace,suffix:S.suffix,pluginData:c.load(S.pluginData),with:S.with});if(C!=null){if(typeof C!=="object")throw Error(`Expected onLoad() callback in plugin ${bt(N)} to return an object`);let L={},G=R(C,L,"pluginName",re),te=R(C,L,"contents",eb),de=R(C,L,"resolveDir",re),ae=R(C,L,"pluginData",Al),ne=R(C,L,"loader",re),se=R(C,L,"errors",zr),xe=R(C,L,"warnings",zr),z=R(C,L,"watchFiles",on),ye=R(C,L,"watchDirs",on);if(gt(C,L,`from onLoad() callback in plugin ${bt(N)}`),_.id=J,G!=null)_.pluginName=G;if(te instanceof Uint8Array)_.contents=te;else if(te!=null)_.contents=Gn(te);if(de!=null)_.resolveDir=de;if(ae!=null)_.pluginData=c.store(ae);if(ne!=null)_.loader=ne;if(se!=null)_.errors=Kr(se,"errors",c,N,void 0);if(xe!=null)_.warnings=Kr(xe,"warnings",c,N,void 0);if(z!=null)_.watchFiles=Ol(z,"watchFiles");if(ye!=null)_.watchDirs=Ol(ye,"watchDirs");break}}catch(C){_={id:J,errors:[go(C,s,c,K&&K(),N)]};break}n(P,_)};let j=(P,S)=>S([],[]);if(u.length>0)j=(P,S)=>{(async()=>{let _=[],N=[];for(let{name:F,callback:K,note:J}of u){let C,L;try{let G=await K(P);if(G!=null){if(typeof G!=="object")throw Error(`Expected onEnd() callback in plugin ${bt(F)} to return an object`);let te={},de=R(G,te,"errors",zr),ae=R(G,te,"warnings",zr);if(gt(G,te,`from onEnd() callback in plugin ${bt(F)}`),de!=null)C=Kr(de,"errors",c,F,void 0);if(ae!=null)L=Kr(ae,"warnings",c,F,void 0)}}catch(G){C=[go(G,s,c,J&&J(),F)]}if(C){_.push(...C);try{P.errors.push(...C)}catch{}}if(L){N.push(...L);try{P.warnings.push(...L)}catch{}}}S(_,N)})()};let v=()=>{for(let P of m)setTimeout(()=>P(),0)};return b=!0,{ok:!0,requestPlugins:g,runOnEndCallbacks:j,scheduleOnDisposeCallbacks:v}};function sb(){let e=new Map,t=0;return{clear(){e.clear()},load(n){return e.get(n)},store(n){if(n===void 0)return-1;let r=t++;return e.set(r,n),r}}}function kl(e,t,n){let r,s=!1;return()=>{if(s)return r;s=!0;try{let o=(e.stack+"").split(`
61
- `);o.splice(1,1);let i=ob(t,o,n);if(i)return r={text:e.message,location:i},r}catch{}}}function go(e,t,n,r,s){let o="Internal error",i=null;try{o=(e&&e.message||e)+""}catch{}try{i=ob(t,(e.stack+"").split(`
62
- `),"")}catch{}return{id:"",pluginName:s,text:o,location:i,notes:r?[r]:[],detail:n?n.store(e):-1}}function ob(e,t,n){let r=" at ";if(e.readFileSync&&!t[0].startsWith(r)&&t[1].startsWith(r))for(let s=1;s<t.length;s++){let o=t[s];if(!o.startsWith(r))continue;o=o.slice(r.length);while(!0){let i=/^(?:new |async )?\S+ \((.*)\)$/.exec(o);if(i){o=i[1];continue}if(i=/^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec(o),i){o=i[1];continue}if(i=/^(\S+):(\d+):(\d+)$/.exec(o),i){let a;try{a=e.readFileSync(i[1],"utf8")}catch{break}let c=a.split(/\r\n|\r|\n|\u2028|\u2029/)[+i[2]-1]||"",l=+i[3]-1,u=c.slice(l,l+n.length)===n?n.length:0;return{file:i[1],namespace:"file",line:+i[2],column:Gn(c.slice(0,l)).length,length:Gn(c.slice(l,l+u)).length,lineText:c+`
59
+ `);function Z$(e,t){return(e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)>>>0}function jp(e,t,n){e[n++]=t,e[n++]=t>>8,e[n++]=t>>16,e[n++]=t>>24}var zr=String.fromCharCode;function Cn(e,t,n){let r=e[t],s=1,o=0;for(let i=0;i<t;i++)if(e[i]===10)s++,o=0;else o++;throw SyntaxError(n?n:t===e.length?"Unexpected end of input while parsing JSON":r>=32&&r<=126?`Unexpected character ${zr(r)} in JSON at position ${t} (line ${s}, column ${o})`:`Unexpected byte 0x${r.toString(16)} in JSON at position ${t} (line ${s}, column ${o})`)}function DT(e){if(!(e instanceof Uint8Array))throw Error("JSON input must be a Uint8Array");let t=[],n=[],r=[],s=e.length,o=null,i=0,a,c=0;while(c<s){let l=e[c++];if(l<=32)continue;let u;if(i===2&&o===null&&l!==34&&l!==125)Cn(e,--c);switch(l){case 116:{if(e[c++]!==114||e[c++]!==117||e[c++]!==101)Cn(e,--c);u=!0;break}case 102:{if(e[c++]!==97||e[c++]!==108||e[c++]!==115||e[c++]!==101)Cn(e,--c);u=!1;break}case 110:{if(e[c++]!==117||e[c++]!==108||e[c++]!==108)Cn(e,--c);u=null;break}case 45:case 46:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:{let d=c;u=zr(l),l=e[c];while(!0){switch(l){case 43:case 45:case 46:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 101:case 69:{u+=zr(l),l=e[++c];continue}}break}if(u=+u,isNaN(u))Cn(e,--d,"Invalid number");break}case 34:{u="";while(!0){if(c>=s)Cn(e,s);if(l=e[c++],l===34)break;else if(l===92)switch(e[c++]){case 34:u+='"';break;case 47:u+="/";break;case 92:u+="\\";break;case 98:u+="\b";break;case 102:u+="\f";break;case 110:u+=`
60
+ `;break;case 114:u+="\r";break;case 116:u+="\t";break;case 117:{let d=0;for(let p=0;p<4;p++)if(l=e[c++],d<<=4,l>=48&&l<=57)d|=l-48;else if(l>=97&&l<=102)d|=l+-87;else if(l>=65&&l<=70)d|=l+-55;else Cn(e,--c);u+=zr(d);break}default:Cn(e,--c);break}else if(l<=127)u+=zr(l);else if((l&224)===192)u+=zr((l&31)<<6|e[c++]&63);else if((l&240)===224)u+=zr((l&15)<<12|(e[c++]&63)<<6|e[c++]&63);else if((l&248)==240){let d=(l&7)<<18|(e[c++]&63)<<12|(e[c++]&63)<<6|e[c++]&63;if(d>65535)d-=65536,u+=zr(d>>10&1023|55296),d=56320|d&1023;u+=zr(d)}}u[0];break}case 91:{u=[],t.push(o),n.push(a),r.push(i),o=null,a=u,i=1;continue}case 123:{u={},t.push(o),n.push(a),r.push(i),o=null,a=u,i=2;continue}case 93:{if(i!==1)Cn(e,--c);u=a,o=t.pop(),a=n.pop(),i=r.pop();break}case 125:{if(i!==2)Cn(e,--c);u=a,o=t.pop(),a=n.pop(),i=r.pop();break}default:Cn(e,--c)}l=e[c];while(l<=32)l=e[++c];switch(i){case 0:{if(c===s)return u;break}case 1:{if(a.push(u),l===44){c++;continue}if(l===93)continue;break}case 2:{if(o===null){if(o=u,l===58){c++;continue}}else{if(a[o]=u,o=null,l===44){c++;continue}if(l===125)continue}break}}break}Cn(e,c)}var St=JSON.stringify,q$="warning",W$="silent";function ci(e,t){let n=[];for(let r of e){if(rn(r,t),r.indexOf(",")>=0)throw Error(`Invalid ${t}: ${r}`);n.push(r)}return n.join(",")}var Hl=()=>null,Ye=(e)=>typeof e==="boolean"?null:"a boolean",se=(e)=>typeof e==="string"?null:"a string",Ul=(e)=>e instanceof RegExp?null:"a RegExp object",bo=(e)=>typeof e==="number"&&e===(e|0)?null:"an integer",MT=(e)=>typeof e==="number"&&e===(e|0)&&e>=0&&e<=65535?null:"a valid port number",Q$=(e)=>typeof e==="function"?null:"a function",Kr=(e)=>Array.isArray(e)?null:"an array",sn=(e)=>Array.isArray(e)&&e.every((t)=>typeof t==="string")?null:"an array of strings",Sn=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)?null:"an object",FT=(e)=>typeof e==="object"&&e!==null?null:"an array or an object",LT=(e)=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",H$=(e)=>typeof e==="object"&&!Array.isArray(e)?null:"an object or null",eS=(e)=>typeof e==="string"||typeof e==="boolean"?null:"a string or a boolean",VT=(e)=>typeof e==="string"||typeof e==="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",tS=(e)=>typeof e==="string"||Array.isArray(e)&&e.every((t)=>typeof t==="string")?null:"a string or an array of strings",nS=(e)=>typeof e==="string"||e instanceof Uint8Array?null:"a string or a Uint8Array",qT=(e)=>typeof e==="string"||e instanceof URL?null:"a string or a URL";function C(e,t,n,r){let s=e[n];if(t[n+""]=!0,s===void 0)return;let o=r(s);if(o!==null)throw Error(`${St(n)} must be ${o}`);return s}function ht(e,t,n){for(let r in e)if(!(r in t))throw Error(`Invalid option ${n}: ${St(r)}`)}function WT(e){let t=Object.create(null),n=C(e,t,"wasmURL",qT),r=C(e,t,"wasmModule",LT),s=C(e,t,"worker",Ye);return ht(e,t,"in initialize() call"),{wasmURL:n,wasmModule:r,worker:s}}function rS(e){let t;if(e!==void 0){t=Object.create(null);for(let n in e){let r=e[n];if(typeof r==="string"||r===!1)t[n]=r;else throw Error(`Expected ${St(n)} in mangle cache to map to either a string or false`)}}return t}function Xl(e,t,n,r,s){let o=C(t,n,"color",Ye),i=C(t,n,"logLevel",se),a=C(t,n,"logLimit",bo),c=C(t,n,"logStyle",se);if(o!==void 0)e.push(`--color=${o}`);else if(r)e.push("--color=true");if(e.push(`--log-level=${i||s}`),e.push(`--log-limit=${a||0}`),c)e.push(`--log-style=${c}`)}function rn(e,t,n){if(typeof e!=="string")throw Error(`Expected value for ${t}${n!==void 0?" "+St(n):""} to be a string, got ${typeof e} instead`);return e}function sS(e,t,n){let r=C(t,n,"legalComments",se),s=C(t,n,"sourceRoot",se),o=C(t,n,"sourcesContent",Ye),i=C(t,n,"target",tS),a=C(t,n,"format",se),c=C(t,n,"globalName",se),l=C(t,n,"mangleProps",Ul),u=C(t,n,"reserveProps",Ul),d=C(t,n,"mangleQuoted",Ye),p=C(t,n,"minify",Ye),m=C(t,n,"minifySyntax",Ye),x=C(t,n,"minifyWhitespace",Ye),g=C(t,n,"minifyIdentifiers",Ye),y=C(t,n,"lineLimit",bo),S=C(t,n,"drop",sn),E=C(t,n,"dropLabels",sn),v=C(t,n,"charset",se),j=C(t,n,"treeShaking",Ye),P=C(t,n,"ignoreAnnotations",Ye),O=C(t,n,"jsx",se),T=C(t,n,"jsxFactory",se),U=C(t,n,"jsxFragment",se),F=C(t,n,"jsxImportSource",se),H=C(t,n,"jsxDev",Ye),A=C(t,n,"jsxSideEffects",Ye),N=C(t,n,"define",Sn),B=C(t,n,"logOverride",Sn),M=C(t,n,"supported",Sn),D=C(t,n,"pure",sn),X=C(t,n,"keepNames",Ye),re=C(t,n,"platform",se),ue=C(t,n,"tsconfigRaw",VT),xe=C(t,n,"absPaths",sn);if(r)e.push(`--legal-comments=${r}`);if(s!==void 0)e.push(`--source-root=${s}`);if(o!==void 0)e.push(`--sources-content=${o}`);if(i)e.push(`--target=${ci(Array.isArray(i)?i:[i],"target")}`);if(a)e.push(`--format=${a}`);if(c)e.push(`--global-name=${c}`);if(re)e.push(`--platform=${re}`);if(ue)e.push(`--tsconfig-raw=${typeof ue==="string"?ue:JSON.stringify(ue)}`);if(p)e.push("--minify");if(m)e.push("--minify-syntax");if(x)e.push("--minify-whitespace");if(g)e.push("--minify-identifiers");if(y)e.push(`--line-limit=${y}`);if(v)e.push(`--charset=${v}`);if(j!==void 0)e.push(`--tree-shaking=${j}`);if(P)e.push("--ignore-annotations");if(S)for(let z of S)e.push(`--drop:${rn(z,"drop")}`);if(E)e.push(`--drop-labels=${ci(E,"drop label")}`);if(xe)e.push(`--abs-paths=${ci(xe,"abs paths")}`);if(l)e.push(`--mangle-props=${Bl(l)}`);if(u)e.push(`--reserve-props=${Bl(u)}`);if(d!==void 0)e.push(`--mangle-quoted=${d}`);if(O)e.push(`--jsx=${O}`);if(T)e.push(`--jsx-factory=${T}`);if(U)e.push(`--jsx-fragment=${U}`);if(F)e.push(`--jsx-import-source=${F}`);if(H)e.push("--jsx-dev");if(A)e.push("--jsx-side-effects");if(N)for(let z in N){if(z.indexOf("=")>=0)throw Error(`Invalid define: ${z}`);e.push(`--define:${z}=${rn(N[z],"define",z)}`)}if(B)for(let z in B){if(z.indexOf("=")>=0)throw Error(`Invalid log override: ${z}`);e.push(`--log-override:${z}=${rn(B[z],"log override",z)}`)}if(M)for(let z in M){if(z.indexOf("=")>=0)throw Error(`Invalid supported: ${z}`);let be=M[z];if(typeof be!=="boolean")throw Error(`Expected value for supported ${St(z)} to be a boolean, got ${typeof be} instead`);e.push(`--supported:${z}=${be}`)}if(D)for(let z of D)e.push(`--pure:${rn(z,"pure")}`);if(X)e.push("--keep-names")}function HT(e,t,n,r,s){var o;let i=[],a=[],c=Object.create(null),l=null,u=null;Xl(i,t,c,n,r),sS(i,t,c);let d=C(t,c,"sourcemap",eS),p=C(t,c,"bundle",Ye),m=C(t,c,"splitting",Ye),x=C(t,c,"preserveSymlinks",Ye),g=C(t,c,"metafile",Ye),y=C(t,c,"outfile",se),S=C(t,c,"outdir",se),E=C(t,c,"outbase",se),v=C(t,c,"tsconfig",se),j=C(t,c,"resolveExtensions",sn),P=C(t,c,"nodePaths",sn),O=C(t,c,"mainFields",sn),T=C(t,c,"conditions",sn),U=C(t,c,"external",sn),F=C(t,c,"packages",se),H=C(t,c,"alias",Sn),A=C(t,c,"loader",Sn),N=C(t,c,"outExtension",Sn),B=C(t,c,"publicPath",se),M=C(t,c,"entryNames",se),D=C(t,c,"chunkNames",se),X=C(t,c,"assetNames",se),re=C(t,c,"inject",sn),ue=C(t,c,"banner",Sn),xe=C(t,c,"footer",Sn),z=C(t,c,"entryPoints",FT),be=C(t,c,"absWorkingDir",se),ae=C(t,c,"stdin",Sn),ee=(o=C(t,c,"write",Ye))!=null?o:s,ot=C(t,c,"allowOverwrite",Ye),Te=C(t,c,"mangleCache",Sn);if(c.plugins=!0,ht(t,c,`in ${e}() call`),d)i.push(`--sourcemap${d===!0?"":`=${d}`}`);if(p)i.push("--bundle");if(ot)i.push("--allow-overwrite");if(m)i.push("--splitting");if(x)i.push("--preserve-symlinks");if(g)i.push("--metafile");if(y)i.push(`--outfile=${y}`);if(S)i.push(`--outdir=${S}`);if(E)i.push(`--outbase=${E}`);if(v)i.push(`--tsconfig=${v}`);if(F)i.push(`--packages=${F}`);if(j)i.push(`--resolve-extensions=${ci(j,"resolve extension")}`);if(B)i.push(`--public-path=${B}`);if(M)i.push(`--entry-names=${M}`);if(D)i.push(`--chunk-names=${D}`);if(X)i.push(`--asset-names=${X}`);if(O)i.push(`--main-fields=${ci(O,"main field")}`);if(T)i.push(`--conditions=${ci(T,"condition")}`);if(U)for(let te of U)i.push(`--external:${rn(te,"external")}`);if(H)for(let te in H){if(te.indexOf("=")>=0)throw Error(`Invalid package name in alias: ${te}`);i.push(`--alias:${te}=${rn(H[te],"alias",te)}`)}if(ue)for(let te in ue){if(te.indexOf("=")>=0)throw Error(`Invalid banner file type: ${te}`);i.push(`--banner:${te}=${rn(ue[te],"banner",te)}`)}if(xe)for(let te in xe){if(te.indexOf("=")>=0)throw Error(`Invalid footer file type: ${te}`);i.push(`--footer:${te}=${rn(xe[te],"footer",te)}`)}if(re)for(let te of re)i.push(`--inject:${rn(te,"inject")}`);if(A)for(let te in A){if(te.indexOf("=")>=0)throw Error(`Invalid loader extension: ${te}`);i.push(`--loader:${te}=${rn(A[te],"loader",te)}`)}if(N)for(let te in N){if(te.indexOf("=")>=0)throw Error(`Invalid out extension: ${te}`);i.push(`--out-extension:${te}=${rn(N[te],"out extension",te)}`)}if(z)if(Array.isArray(z))for(let te=0,tt=z.length;te<tt;te++){let Xe=z[te];if(typeof Xe==="object"&&Xe!==null){let xt=Object.create(null),de=C(Xe,xt,"in",se),dt=C(Xe,xt,"out",se);if(ht(Xe,xt,"in entry point at index "+te),de===void 0)throw Error('Missing property "in" for entry point at index '+te);if(dt===void 0)throw Error('Missing property "out" for entry point at index '+te);a.push([dt,de])}else a.push(["",rn(Xe,"entry point at index "+te)])}else for(let te in z)a.push([te,rn(z[te],"entry point",te)]);if(ae){let te=Object.create(null),tt=C(ae,te,"contents",nS),Xe=C(ae,te,"resolveDir",se),xt=C(ae,te,"sourcefile",se),de=C(ae,te,"loader",se);if(ht(ae,te,'in "stdin" object'),xt)i.push(`--sourcefile=${xt}`);if(de)i.push(`--loader=${de}`);if(Xe)u=Xe;if(typeof tt==="string")l=zn(tt);else if(tt instanceof Uint8Array)l=tt}let et=[];if(P)for(let te of P)te+="",et.push(te);return{entries:a,flags:i,write:ee,stdinContents:l,stdinResolveDir:u,absWorkingDir:be,nodePaths:et,mangleCache:rS(Te)}}function UT(e,t,n,r){let s=[],o=Object.create(null);Xl(s,t,o,n,r),sS(s,t,o);let i=C(t,o,"sourcemap",eS),a=C(t,o,"sourcefile",se),c=C(t,o,"loader",se),l=C(t,o,"banner",se),u=C(t,o,"footer",se),d=C(t,o,"mangleCache",Sn);if(ht(t,o,`in ${e}() call`),i)s.push(`--sourcemap=${i===!0?"external":i}`);if(a)s.push(`--sourcefile=${a}`);if(c)s.push(`--loader=${c}`);if(l)s.push(`--banner=${l}`);if(u)s.push(`--footer=${u}`);return{flags:s,mangleCache:rS(d)}}function oS(e){let t={},n={didClose:!1,reason:""},r={},s=0,o=0,i=new Uint8Array(16384),a=0,c=(v)=>{let j=a+v.length;if(j>i.length){let O=new Uint8Array(j*2);O.set(i),i=O}i.set(v,a),a+=v.length;let P=0;while(P+4<=a){let O=Z$(i,P);if(P+4+O>a)break;P+=4,x(i.subarray(P,P+O)),P+=O}if(P>0)i.copyWithin(0,P,a),a-=P},l=(v)=>{if(n.didClose=!0,v)n.reason=": "+(v.message||v);let j="The service was stopped"+n.reason;for(let P in r)r[P](j,null);r={}},u=(v,j,P)=>{if(n.didClose)return P("The service is no longer running"+n.reason,null);let O=s++;if(r[O]=(T,U)=>{try{P(T,U)}finally{if(v)v.unref()}},v)v.ref();e.writeToStdin(V$({id:O,isRequest:!0,value:j}))},d=(v,j)=>{if(n.didClose)throw Error("The service is no longer running"+n.reason);e.writeToStdin(V$({id:v,isRequest:!1,value:j}))},p=async(v,j)=>{try{if(j.command==="ping"){d(v,{});return}if(typeof j.key==="number"){let P=t[j.key];if(!P)return;let O=P[j.command];if(O){await O(v,j);return}}throw Error("Invalid command: "+j.command)}catch(P){let O=[xo(P,e,null,void 0,"")];try{d(v,{errors:O})}catch{}}},m=!0,x=(v)=>{if(m){m=!1;let P=String.fromCharCode(...v);if(P!=="0.28.2")throw Error(`Cannot start service: Host version "0.28.2" does not match binary version ${St(P)}`);return}let j=IT(v);if(j.isRequest)p(j.id,j.value);else{let P=r[j.id];if(delete r[j.id],j.value.error)P(j.value.error,{});else P(null,j.value)}};return{readFromStdout:c,afterClose:l,service:{buildOrContext:({callName:v,refs:j,options:P,isTTY:O,defaultWD:T,callback:U})=>{let F=0,H=o++,A={},N={ref(){if(++F===1){if(j)j.ref()}},unref(){if(--F===0){if(delete t[H],j)j.unref()}}};t[H]=A,N.ref(),BT(v,H,u,d,N,e,A,P,O,T,(B,M)=>{try{U(B,M)}finally{N.unref()}})},transform:({callName:v,refs:j,input:P,options:O,isTTY:T,fs:U,callback:F})=>{let H=iS(),A=(N)=>{try{if(typeof P!=="string"&&!(P instanceof Uint8Array))throw Error('The input to "transform" must be a string or a Uint8Array');let{flags:B,mangleCache:M}=UT(v,O,T,W$),D={command:"transform",flags:B,inputFS:N!==null,input:N!==null?zn(N):typeof P==="string"?zn(P):P};if(M)D.mangleCache=M;u(j,D,(X,re)=>{if(X)return F(Error(X),null);let ue=li(re.errors,H),xe=li(re.warnings,H),z=1,be=()=>{if(--z===0){let ae={warnings:xe,code:re.code,map:re.map,mangleCache:void 0,legalComments:void 0};if("legalComments"in re)ae.legalComments=re==null?void 0:re.legalComments;if(re.mangleCache)ae.mangleCache=re==null?void 0:re.mangleCache;F(null,ae)}};if(ue.length>0)return F(Ia("Transform failed",ue,xe),null);if(re.codeFS)z++,U.readFile(re.code,(ae,ee)=>{if(ae!==null)F(ae,null);else re.code=ee,be()});if(re.mapFS)z++,U.readFile(re.map,(ae,ee)=>{if(ae!==null)F(ae,null);else re.map=ee,be()});be()})}catch(B){let M=[];try{Xl(M,O,{},T,W$)}catch{}let D=xo(B,e,H,void 0,"");u(j,{command:"error",flags:M,error:D},()=>{D.detail=H.load(D.detail),F(Ia("Transform failed",[D],[]),null)})}};if((typeof P==="string"||P instanceof Uint8Array)&&P.length>1048576){let N=A;A=()=>U.writeFile(P,N)}A(null)},formatMessages:({callName:v,refs:j,messages:P,options:O,callback:T})=>{if(!O)throw Error(`Missing second argument in ${v}() call`);let U={},F=C(O,U,"kind",se),H=C(O,U,"color",Ye),A=C(O,U,"terminalWidth",bo),N=C(O,U,"logStyle",se);if(ht(O,U,`in ${v}() call`),F===void 0)throw Error(`Missing "kind" in ${v}() call`);if(F!=="error"&&F!=="warning")throw Error(`Expected "kind" to be "error" or "warning" in ${v}() call`);let B={command:"format-msgs",messages:Gr(P,"messages",null,"",A),isWarning:F==="warning"};if(H!==void 0)B.color=H;if(A!==void 0)B.terminalWidth=A;if(N!==void 0)B.logStyle=N;u(j,B,(M,D)=>{if(M)return T(Error(M),null);T(null,D.messages)})},analyzeMetafile:({callName:v,refs:j,metafile:P,options:O,callback:T})=>{if(O===void 0)O={};let U={},F=C(O,U,"color",Ye),H=C(O,U,"verbose",Ye);ht(O,U,`in ${v}() call`);let A={command:"analyze-metafile",metafile:P};if(F!==void 0)A.color=F;if(H!==void 0)A.verbose=H;u(j,A,(N,B)=>{if(N)return T(Error(N),null);T(null,B.result)})}}}}function BT(e,t,n,r,s,o,i,a,c,l,u){let d=iS(),p=e==="context",m=(y,S)=>{let E=[];try{Xl(E,a,{},c,q$)}catch{}let v=xo(y,o,d,void 0,S);n(s,{command:"error",flags:E,error:v},()=>{v.detail=d.load(v.detail),u(Ia(p?"Context failed":"Build failed",[v],[]),null)})},x;if(typeof a==="object"){let y=a.plugins;if(y!==void 0){if(!Array.isArray(y))return m(Error('"plugins" must be an array'),"");x=y}}if(x&&x.length>0){if(o.isSync)return m(Error("Cannot use plugins in synchronous API calls"),"");zT(t,n,r,s,o,i,a,x,d).then((y)=>{if(!y.ok)return m(y.error,y.pluginName);try{g(y.requestPlugins,y.runOnEndCallbacks,y.scheduleOnDisposeCallbacks)}catch(S){m(S,"")}},(y)=>m(y,""));return}try{g(null,(y,S)=>S([],[]),()=>{})}catch(y){m(y,"")}function g(y,S,E){let v=o.hasFS,{entries:j,flags:P,write:O,stdinContents:T,stdinResolveDir:U,absWorkingDir:F,nodePaths:H,mangleCache:A}=HT(e,a,c,q$,v);if(O&&!o.hasFS)throw Error('The "write" option is unavailable in this environment');let N={command:"build",key:t,entries:j,flags:P,write:O,stdinContents:T,stdinResolveDir:U,absWorkingDir:F||l,nodePaths:H,context:p};if(y)N.plugins=y;if(A)N.mangleCache=A;let B=(X,re)=>{let ue={errors:li(X.errors,d),warnings:li(X.warnings,d),outputFiles:void 0,metafile:void 0,mangleCache:void 0},xe=ue.errors.slice(),z=ue.warnings.slice();if(X.outputFiles)ue.outputFiles=X.outputFiles.map(GT);if(X.metafile&&X.metafile.length)ue.metafile=XT(X.metafile);if(X.mangleCache)ue.mangleCache=X.mangleCache;if(X.writeToStdout!==void 0)console.log(wo(X.writeToStdout).replace(/\n$/,""));S(ue,(be,ae)=>{if(xe.length>0||be.length>0){let ee=Ia("Build failed",xe.concat(be),z.concat(ae));return re(ee,null,be,ae)}re(null,ue,be,ae)})},M,D;if(p)i["on-end"]=(X,re)=>new Promise((ue)=>{B(re,(xe,z,be,ae)=>{let ee={errors:be,warnings:ae};if(D)D(xe,z);M=void 0,D=void 0,r(X,ee),ue()})});n(s,N,(X,re)=>{if(X)return u(Error(X),null);if(!p)return B(re,(z,be)=>(E(),u(z,be)));if(re.errors.length>0)return u(Ia("Context failed",re.errors,re.warnings),null);let ue=!1,xe={rebuild:()=>{if(!M)M=new Promise((z,be)=>{let ae;D=(ot,Te)=>{if(!ae)ae=()=>ot?be(ot):z(Te)};let ee=()=>{n(s,{command:"rebuild",key:t},(Te,et)=>{if(Te)be(Error(Te));else if(ae)ae();else ee()})};ee()});return M},watch:(z={})=>new Promise((be,ae)=>{if(!o.hasFS)throw Error('Cannot use the "watch" API in this environment');let ee={},ot=C(z,ee,"delay",bo);ht(z,ee,"in watch() call");let Te={command:"watch",key:t};if(ot)Te.delay=ot;n(s,Te,(et)=>{if(et)ae(Error(et));else be(void 0)})}),serve:(z={})=>new Promise((be,ae)=>{if(!o.hasFS)throw Error('Cannot use the "serve" API in this environment');let ee={},ot=C(z,ee,"port",MT),Te=C(z,ee,"host",se),et=C(z,ee,"servedir",se),te=C(z,ee,"keyfile",se),tt=C(z,ee,"certfile",se),Xe=C(z,ee,"fallback",se),xt=C(z,ee,"cors",Sn),de=C(z,ee,"onRequest",Q$);ht(z,ee,"in serve() call");let dt={command:"serve",key:t,onRequest:!!de};if(ot!==void 0)dt.port=ot;if(Te!==void 0)dt.host=Te;if(et!==void 0)dt.servedir=et;if(te!==void 0)dt.keyfile=te;if(tt!==void 0)dt.certfile=tt;if(Xe!==void 0)dt.fallback=Xe;if(xt){let Be={},ce=C(xt,Be,"origin",tS);if(ht(xt,Be,'on "cors" object'),Array.isArray(ce))dt.corsOrigin=ce;else if(ce!==void 0)dt.corsOrigin=[ce]}n(s,dt,(Be,ce)=>{if(Be)return ae(Error(Be));if(de)i["serve-request"]=(Et,Jr)=>{de(Jr.args),r(Et,{})};be(ce)})}),cancel:()=>new Promise((z)=>{if(ue)return z();n(s,{command:"cancel",key:t},()=>{z()})}),dispose:()=>new Promise((z)=>{if(ue)return z();ue=!0,n(s,{command:"dispose",key:t},()=>{z(),E(),s.unref()})})};s.ref(),u(null,xe)})}}var zT=async(e,t,n,r,s,o,i,a,c)=>{let l=[],u=[],d={},p={},m=[],x=0,g=0,y=[],S=!1;a=[...a];for(let j of a){let P={};if(typeof j!=="object")throw Error(`Plugin at index ${g} must be an object`);let O=C(j,P,"name",se);if(typeof O!=="string"||O==="")throw Error(`Plugin at index ${g} is missing a name`);try{let T=C(j,P,"setup",Q$);if(typeof T!=="function")throw Error("Plugin is missing a setup function");ht(j,P,`on plugin ${St(O)}`);let U={name:O,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};g++;let H=T({initialOptions:i,resolve:(A,N={})=>{if(!S)throw Error('Cannot call "resolve" before plugin setup has completed');if(typeof A!=="string")throw Error("The path to resolve must be a string");let B=Object.create(null),M=C(N,B,"pluginName",se),D=C(N,B,"importer",se),X=C(N,B,"namespace",se),re=C(N,B,"resolveDir",se),ue=C(N,B,"kind",se),xe=C(N,B,"pluginData",Hl),z=C(N,B,"with",Sn);return ht(N,B,"in resolve() call"),new Promise((be,ae)=>{let ee={command:"resolve",path:A,key:e,pluginName:O};if(M!=null)ee.pluginName=M;if(D!=null)ee.importer=D;if(X!=null)ee.namespace=X;if(re!=null)ee.resolveDir=re;if(ue!=null)ee.kind=ue;else throw Error('Must specify "kind" when calling "resolve"');if(xe!=null)ee.pluginData=c.store(xe);if(z!=null)ee.with=KT(z,"with");t(r,ee,(ot,Te)=>{if(ot!==null)ae(Error(ot));else be({errors:li(Te.errors,c),warnings:li(Te.warnings,c),path:Te.path,external:Te.external,sideEffects:Te.sideEffects,namespace:Te.namespace,suffix:Te.suffix,pluginData:c.load(Te.pluginData)})})})},onStart(A){let B=ql(Error('This error came from the "onStart" callback registered here:'),s,"onStart");l.push({name:O,callback:A,note:B}),U.onStart=!0},onEnd(A){let B=ql(Error('This error came from the "onEnd" callback registered here:'),s,"onEnd");u.push({name:O,callback:A,note:B}),U.onEnd=!0},onResolve(A,N){let M=ql(Error('This error came from the "onResolve" callback registered here:'),s,"onResolve"),D={},X=C(A,D,"filter",Ul),re=C(A,D,"namespace",se);if(ht(A,D,`in onResolve() call for plugin ${St(O)}`),X==null)throw Error("onResolve() call is missing a filter");let ue=x++;d[ue]={name:O,callback:N,note:M},U.onResolve.push({id:ue,filter:Bl(X),namespace:re||""})},onLoad(A,N){let M=ql(Error('This error came from the "onLoad" callback registered here:'),s,"onLoad"),D={},X=C(A,D,"filter",Ul),re=C(A,D,"namespace",se);if(ht(A,D,`in onLoad() call for plugin ${St(O)}`),X==null)throw Error("onLoad() call is missing a filter");let ue=x++;p[ue]={name:O,callback:N,note:M},U.onLoad.push({id:ue,filter:Bl(X),namespace:re||""})},onDispose(A){m.push(A)},esbuild:s.esbuild});if(H)await H;y.push(U)}catch(T){return{ok:!1,error:T,pluginName:O}}}o["on-start"]=async(j,P)=>{c.clear();let O={errors:[],warnings:[]};await Promise.all(l.map(async({name:T,callback:U,note:F})=>{try{let H=await U();if(H!=null){if(typeof H!=="object")throw Error(`Expected onStart() callback in plugin ${St(T)} to return an object`);let A={},N=C(H,A,"errors",Kr),B=C(H,A,"warnings",Kr);if(ht(H,A,`from onStart() callback in plugin ${St(T)}`),N!=null)O.errors.push(...Gr(N,"errors",c,T,void 0));if(B!=null)O.warnings.push(...Gr(B,"warnings",c,T,void 0))}}catch(H){O.errors.push(xo(H,s,c,F&&F(),T))}})),n(j,O)},o["on-resolve"]=async(j,P)=>{let O={},T="",U,F;for(let H of P.ids)try{({name:T,callback:U,note:F}=d[H]);let A=await U({path:P.path,importer:P.importer,namespace:P.namespace,resolveDir:P.resolveDir,kind:P.kind,pluginData:c.load(P.pluginData),with:P.with});if(A!=null){if(typeof A!=="object")throw Error(`Expected onResolve() callback in plugin ${St(T)} to return an object`);let N={},B=C(A,N,"pluginName",se),M=C(A,N,"path",se),D=C(A,N,"namespace",se),X=C(A,N,"suffix",se),re=C(A,N,"external",Ye),ue=C(A,N,"sideEffects",Ye),xe=C(A,N,"pluginData",Hl),z=C(A,N,"errors",Kr),be=C(A,N,"warnings",Kr),ae=C(A,N,"watchFiles",sn),ee=C(A,N,"watchDirs",sn);if(ht(A,N,`from onResolve() callback in plugin ${St(T)}`),O.id=H,B!=null)O.pluginName=B;if(M!=null)O.path=M;if(D!=null)O.namespace=D;if(X!=null)O.suffix=X;if(re!=null)O.external=re;if(ue!=null)O.sideEffects=ue;if(xe!=null)O.pluginData=c.store(xe);if(z!=null)O.errors=Gr(z,"errors",c,T,void 0);if(be!=null)O.warnings=Gr(be,"warnings",c,T,void 0);if(ae!=null)O.watchFiles=Wl(ae,"watchFiles");if(ee!=null)O.watchDirs=Wl(ee,"watchDirs");break}}catch(A){O={id:H,errors:[xo(A,s,c,F&&F(),T)]};break}n(j,O)},o["on-load"]=async(j,P)=>{let O={},T="",U,F;for(let H of P.ids)try{({name:T,callback:U,note:F}=p[H]);let A=await U({path:P.path,namespace:P.namespace,suffix:P.suffix,pluginData:c.load(P.pluginData),with:P.with});if(A!=null){if(typeof A!=="object")throw Error(`Expected onLoad() callback in plugin ${St(T)} to return an object`);let N={},B=C(A,N,"pluginName",se),M=C(A,N,"contents",nS),D=C(A,N,"resolveDir",se),X=C(A,N,"pluginData",Hl),re=C(A,N,"loader",se),ue=C(A,N,"errors",Kr),xe=C(A,N,"warnings",Kr),z=C(A,N,"watchFiles",sn),be=C(A,N,"watchDirs",sn);if(ht(A,N,`from onLoad() callback in plugin ${St(T)}`),O.id=H,B!=null)O.pluginName=B;if(M instanceof Uint8Array)O.contents=M;else if(M!=null)O.contents=zn(M);if(D!=null)O.resolveDir=D;if(X!=null)O.pluginData=c.store(X);if(re!=null)O.loader=re;if(ue!=null)O.errors=Gr(ue,"errors",c,T,void 0);if(xe!=null)O.warnings=Gr(xe,"warnings",c,T,void 0);if(z!=null)O.watchFiles=Wl(z,"watchFiles");if(be!=null)O.watchDirs=Wl(be,"watchDirs");break}}catch(A){O={id:H,errors:[xo(A,s,c,F&&F(),T)]};break}n(j,O)};let E=(j,P)=>P([],[]);if(u.length>0)E=(j,P)=>{(async()=>{let O=[],T=[];for(let{name:U,callback:F,note:H}of u){let A,N;try{let B=await F(j);if(B!=null){if(typeof B!=="object")throw Error(`Expected onEnd() callback in plugin ${St(U)} to return an object`);let M={},D=C(B,M,"errors",Kr),X=C(B,M,"warnings",Kr);if(ht(B,M,`from onEnd() callback in plugin ${St(U)}`),D!=null)A=Gr(D,"errors",c,U,void 0);if(X!=null)N=Gr(X,"warnings",c,U,void 0)}}catch(B){A=[xo(B,s,c,H&&H(),U)]}if(A){O.push(...A);try{j.errors.push(...A)}catch{}}if(N){T.push(...N);try{j.warnings.push(...N)}catch{}}}P(O,T)})()};let v=()=>{for(let j of m)setTimeout(()=>j(),0)};return S=!0,{ok:!0,requestPlugins:y,runOnEndCallbacks:E,scheduleOnDisposeCallbacks:v}};function iS(){let e=new Map,t=0;return{clear(){e.clear()},load(n){return e.get(n)},store(n){if(n===void 0)return-1;let r=t++;return e.set(r,n),r}}}function ql(e,t,n){let r,s=!1;return()=>{if(s)return r;s=!0;try{let o=(e.stack+"").split(`
61
+ `);o.splice(1,1);let i=aS(t,o,n);if(i)return r={text:e.message,location:i},r}catch{}}}function xo(e,t,n,r,s){let o="Internal error",i=null;try{o=(e&&e.message||e)+""}catch{}try{i=aS(t,(e.stack+"").split(`
62
+ `),"")}catch{}return{id:"",pluginName:s,text:o,location:i,notes:r?[r]:[],detail:n?n.store(e):-1}}function aS(e,t,n){let r=" at ";if(e.readFileSync&&!t[0].startsWith(r)&&t[1].startsWith(r))for(let s=1;s<t.length;s++){let o=t[s];if(!o.startsWith(r))continue;o=o.slice(r.length);while(!0){let i=/^(?:new |async )?\S+ \((.*)\)$/.exec(o);if(i){o=i[1];continue}if(i=/^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec(o),i){o=i[1];continue}if(i=/^(\S+):(\d+):(\d+)$/.exec(o),i){let a;try{a=e.readFileSync(i[1],"utf8")}catch{break}let c=a.split(/\r\n|\r|\n|\u2028|\u2029/)[+i[2]-1]||"",l=+i[3]-1,u=c.slice(l,l+n.length)===n?n.length:0;return{file:i[1],namespace:"file",line:+i[2],column:zn(c.slice(0,l)).length,length:zn(c.slice(l,l+u)).length,lineText:c+`
63
63
  `+t.slice(1).join(`
64
- `),suggestion:""}}break}}return null}function La(e,t,n){let r=5;e+=t.length<1?"":` with ${t.length} error${t.length<2?"":"s"}:`+t.slice(0,r+1).map((o,i)=>{if(i===r)return`
64
+ `),suggestion:""}}break}}return null}function Ia(e,t,n){let r=5;e+=t.length<1?"":` with ${t.length} error${t.length<2?"":"s"}:`+t.slice(0,r+1).map((o,i)=>{if(i===r)return`
65
65
  ...`;if(!o.location)return`
66
66
  error: ${o.text}`;let{file:a,line:c,column:l}=o.location,u=o.pluginName?`[plugin: ${o.pluginName}] `:"";return`
67
- ${a}:${c}:${l}: ERROR: ${u}${o.text}`}).join("");let s=Error(e);for(let[o,i]of[["errors",t],["warnings",n]])Object.defineProperty(s,o,{configurable:!0,enumerable:!0,get:()=>i,set:(a)=>Object.defineProperty(s,o,{configurable:!0,enumerable:!0,value:a})});return s}function di(e,t){for(let n of e)n.detail=t.load(n.detail);return e}function Wx(e,t,n){if(e==null)return null;let r={},s=R(e,r,"file",re),o=R(e,r,"namespace",re),i=R(e,r,"line",yo),a=R(e,r,"column",yo),c=R(e,r,"length",yo),l=R(e,r,"lineText",re),u=R(e,r,"suggestion",re);if(gt(e,r,t),l){let d=l.slice(0,(a&&a>0?a:0)+(c&&c>0?c:0)+(n&&n>0?n:80));if(!/[\x7F-\uFFFF]/.test(d)&&!/\n/.test(l))l=d}return{file:s||"",namespace:o||"",line:i||0,column:a||0,length:c||0,lineText:l||"",suggestion:u||""}}function Kr(e,t,n,r,s){let o=[],i=0;for(let a of e){let c={},l=R(a,c,"id",re),u=R(a,c,"pluginName",re),d=R(a,c,"text",re),p=R(a,c,"location",qx),m=R(a,c,"notes",zr),x=R(a,c,"detail",Al),h=`in element ${i} of "${t}"`;gt(a,c,h);let g=[];if(m)for(let b of m){let j={},v=R(b,j,"text",re),P=R(b,j,"location",qx);gt(b,j,h),g.push({text:v||"",location:Wx(P,h,s)})}o.push({id:l||"",pluginName:u||r,text:d||"",location:Wx(p,h,s),notes:g,detail:n?n.store(x):-1}),i++}return o}function Ol(e,t){let n=[];for(let r of e){if(typeof r!=="string")throw Error(`${bt(t)} must be an array of strings`);n.push(r)}return n}function HN(e,t){let n=Object.create(null);for(let r in e){let s=e[r];if(typeof s!=="string")throw Error(`key ${bt(r)} in object ${bt(t)} must be a string`);n[r]=s}return n}function UN({path:e,contents:t,hash:n}){let r=null;return{path:e,contents:t,hash:n,get text(){let s=this.contents;if(r===null||s!==t)t=s,r=$o(s);return r}}}function Cl(e){let t=e.source;if(e.flags)t=`(?${e.flags})${t}`;return t}function BN(e){let t;try{t=$o(e)}catch{return NN(e)}return JSON.parse(t)}var gs=it("fs"),Hx=it("os"),Nn=it("path"),ui=process.env.ESBUILD_BINARY_PATH||ui,zN=(e)=>!!e&&e!=="/usr/bin/esbuild",Ux="@esbuild/darwin-arm64",Bx="@esbuild/darwin-x64",Nl={"win32 arm64 LE":"@esbuild/win32-arm64","win32 ia32 LE":"@esbuild/win32-ia32","win32 x64 LE":"@esbuild/win32-x64"},Tl={"aix ppc64 BE":"@esbuild/aix-ppc64","android arm64 LE":"@esbuild/android-arm64","darwin arm64 LE":"@esbuild/darwin-arm64","darwin x64 LE":"@esbuild/darwin-x64","freebsd arm64 LE":"@esbuild/freebsd-arm64","freebsd x64 LE":"@esbuild/freebsd-x64","linux arm LE":"@esbuild/linux-arm","linux arm64 LE":"@esbuild/linux-arm64","linux ia32 LE":"@esbuild/linux-ia32","linux mips64el LE":"@esbuild/linux-mips64el","linux ppc64 LE":"@esbuild/linux-ppc64","linux riscv64 LE":"@esbuild/linux-riscv64","linux s390x BE":"@esbuild/linux-s390x","linux x64 LE":"@esbuild/linux-x64","linux loong64 LE":"@esbuild/linux-loong64","netbsd arm64 LE":"@esbuild/netbsd-arm64","netbsd x64 LE":"@esbuild/netbsd-x64","openbsd arm64 LE":"@esbuild/openbsd-arm64","openbsd x64 LE":"@esbuild/openbsd-x64","sunos x64 LE":"@esbuild/sunos-x64"},zx={"android arm LE":"@esbuild/android-arm","android x64 LE":"@esbuild/android-x64","openharmony arm64 LE":"@esbuild/openharmony-arm64"};function KN(){let e,t,n=!1,r=`${process.platform} ${Hx.arch()} ${Hx.endianness()}`;if(r in Nl)e=Nl[r],t="esbuild.exe";else if(r in Tl)e=Tl[r],t="bin/esbuild";else if(r in zx)e=zx[r],t="bin/esbuild",n=!0;else throw Error(`Unsupported platform: ${r}`);return{pkg:e,subpath:t,isWASM:n}}function GN(){let e=it.resolve("esbuild"),t=Nn.dirname(Nn.dirname(Nn.dirname(e)));if(Nn.basename(t)==="node_modules"){for(let n in Tl)try{let r=Tl[n];if(gs.existsSync(Nn.join(t,r)))return r}catch{}for(let n in Nl)try{let r=Nl[n];if(gs.existsSync(Nn.join(t,r)))return r}catch{}}return null}function XN(e,t){let n=Nn.dirname(it.resolve("esbuild"));return Nn.join(n,`downloaded-${e.replace("/","-")}-${Nn.basename(t)}`)}function YN(){if(zN(ui))if(!gs.existsSync(ui))console.warn(`[esbuild] Ignoring bad configuration: ESBUILD_BINARY_PATH=${ui}`);else return{binPath:ui,isWASM:!1};let{pkg:e,subpath:t,isWASM:n}=KN(),r;try{r=it.resolve(`${e}/${t}`)}catch(s){if(r=XN(e,t),!gs.existsSync(r)){try{it.resolve(e)}catch{let o=GN();if(o){let i=`
67
+ ${a}:${c}:${l}: ERROR: ${u}${o.text}`}).join("");let s=Error(e);for(let[o,i]of[["errors",t],["warnings",n]])Object.defineProperty(s,o,{configurable:!0,enumerable:!0,get:()=>i,set:(a)=>Object.defineProperty(s,o,{configurable:!0,enumerable:!0,value:a})});return s}function li(e,t){for(let n of e)n.detail=t.load(n.detail);return e}function U$(e,t,n){if(e==null)return null;let r={},s=C(e,r,"file",se),o=C(e,r,"namespace",se),i=C(e,r,"line",bo),a=C(e,r,"column",bo),c=C(e,r,"length",bo),l=C(e,r,"lineText",se),u=C(e,r,"suggestion",se);if(ht(e,r,t),l){let d=l.slice(0,(a&&a>0?a:0)+(c&&c>0?c:0)+(n&&n>0?n:80));if(!/[\x7F-\uFFFF]/.test(d)&&!/\n/.test(l))l=d}return{file:s||"",namespace:o||"",line:i||0,column:a||0,length:c||0,lineText:l||"",suggestion:u||""}}function Gr(e,t,n,r,s){let o=[],i=0;for(let a of e){let c={},l=C(a,c,"id",se),u=C(a,c,"pluginName",se),d=C(a,c,"text",se),p=C(a,c,"location",H$),m=C(a,c,"notes",Kr),x=C(a,c,"detail",Hl),g=`in element ${i} of "${t}"`;ht(a,c,g);let y=[];if(m)for(let S of m){let E={},v=C(S,E,"text",se),j=C(S,E,"location",H$);ht(S,E,g),y.push({text:v||"",location:U$(j,g,s)})}o.push({id:l||"",pluginName:u||r,text:d||"",location:U$(p,g,s),notes:y,detail:n?n.store(x):-1}),i++}return o}function Wl(e,t){let n=[];for(let r of e){if(typeof r!=="string")throw Error(`${St(t)} must be an array of strings`);n.push(r)}return n}function KT(e,t){let n=Object.create(null);for(let r in e){let s=e[r];if(typeof s!=="string")throw Error(`key ${St(r)} in object ${St(t)} must be a string`);n[r]=s}return n}function GT({path:e,contents:t,hash:n}){let r=null;return{path:e,contents:t,hash:n,get text(){let s=this.contents;if(r===null||s!==t)t=s,r=wo(s);return r}}}function Bl(e){let t=e.source;if(e.flags)t=`(?${e.flags})${t}`;return t}function XT(e){let t;try{t=wo(e)}catch{return DT(e)}return JSON.parse(t)}var xs=it("fs"),B$=it("os"),Rn=it("path"),ai=process.env.ESBUILD_BINARY_PATH||ai,YT=(e)=>!!e&&e!=="/usr/bin/esbuild",z$="@esbuild/darwin-arm64",K$="@esbuild/darwin-x64",zl={"win32 arm64 LE":"@esbuild/win32-arm64","win32 ia32 LE":"@esbuild/win32-ia32","win32 x64 LE":"@esbuild/win32-x64"},Kl={"aix ppc64 BE":"@esbuild/aix-ppc64","android arm64 LE":"@esbuild/android-arm64","darwin arm64 LE":"@esbuild/darwin-arm64","darwin x64 LE":"@esbuild/darwin-x64","freebsd arm64 LE":"@esbuild/freebsd-arm64","freebsd x64 LE":"@esbuild/freebsd-x64","linux arm LE":"@esbuild/linux-arm","linux arm64 LE":"@esbuild/linux-arm64","linux ia32 LE":"@esbuild/linux-ia32","linux mips64el LE":"@esbuild/linux-mips64el","linux ppc64 LE":"@esbuild/linux-ppc64","linux riscv64 LE":"@esbuild/linux-riscv64","linux s390x BE":"@esbuild/linux-s390x","linux x64 LE":"@esbuild/linux-x64","linux loong64 LE":"@esbuild/linux-loong64","netbsd arm64 LE":"@esbuild/netbsd-arm64","netbsd x64 LE":"@esbuild/netbsd-x64","openbsd arm64 LE":"@esbuild/openbsd-arm64","openbsd x64 LE":"@esbuild/openbsd-x64","sunos x64 LE":"@esbuild/sunos-x64"},G$={"android arm LE":"@esbuild/android-arm","android x64 LE":"@esbuild/android-x64","openharmony arm64 LE":"@esbuild/openharmony-arm64"};function ZT(){let e,t,n=!1,r=`${process.platform} ${B$.arch()} ${B$.endianness()}`;if(r in zl)e=zl[r],t="esbuild.exe";else if(r in Kl)e=Kl[r],t="bin/esbuild";else if(r in G$)e=G$[r],t="bin/esbuild",n=!0;else throw Error(`Unsupported platform: ${r}`);return{pkg:e,subpath:t,isWASM:n}}function QT(){let e=it.resolve("esbuild"),t=Rn.dirname(Rn.dirname(Rn.dirname(e)));if(Rn.basename(t)==="node_modules"){for(let n in Kl)try{let r=Kl[n];if(xs.existsSync(Rn.join(t,r)))return r}catch{}for(let n in zl)try{let r=zl[n];if(xs.existsSync(Rn.join(t,r)))return r}catch{}}return null}function eJ(e,t){let n=Rn.dirname(it.resolve("esbuild"));return Rn.join(n,`downloaded-${e.replace("/","-")}-${Rn.basename(t)}`)}function tJ(){if(YT(ai))if(!xs.existsSync(ai))console.warn(`[esbuild] Ignoring bad configuration: ESBUILD_BINARY_PATH=${ai}`);else return{binPath:ai,isWASM:!1};let{pkg:e,subpath:t,isWASM:n}=ZT(),r;try{r=it.resolve(`${e}/${t}`)}catch(s){if(r=eJ(e,t),!xs.existsSync(r)){try{it.resolve(e)}catch{let o=QT();if(o){let i=`
68
68
  Specifically the "${o}" package is present but this platform
69
69
  needs the "${e}" package instead. People often get into this
70
70
  situation by installing esbuild on Windows or macOS and copying "node_modules"
@@ -81,7 +81,7 @@ If you are installing with yarn, you can try listing both this platform and the
81
81
  other platform in your ".yarnrc.yml" file using the "supportedArchitectures"
82
82
  feature: https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
83
83
  Keep in mind that this means multiple copies of esbuild will be present.
84
- `;if(e===Bx&&o===Ux||e===Ux&&o===Bx)i=`
84
+ `;if(e===K$&&o===z$||e===z$&&o===K$)i=`
85
85
  Specifically the "${o}" package is present but this platform
86
86
  needs the "${e}" package instead. People often get into this
87
87
  situation by installing esbuild with npm running inside of Rosetta 2 and then
@@ -113,53 +113,61 @@ want to do that.
113
113
  If you are installing esbuild with npm, make sure that you don't specify the
114
114
  "--no-optional" or "--omit=optional" flags. The "optionalDependencies" feature
115
115
  of "package.json" is used by esbuild to install the correct binary executable
116
- for your current platform.`)}throw s}}if(/\.zip\//.test(r)){let s;try{s=(()=>{throw new Error("Cannot require module "+"pnpapi");})()}catch(o){}if(s){let o=s.getPackageInformation(s.topLevel).packageLocation,i=Nn.join(o,"node_modules",".cache","esbuild",`pnpapi-${e.replace("/","-")}-0.28.2-${Nn.basename(t)}`);if(!gs.existsSync(i))gs.mkdirSync(Nn.dirname(i),{recursive:!0}),gs.copyFileSync(r,i),gs.chmodSync(i,493);return{binPath:i,isWASM:n}}}return{binPath:r,isWASM:n}}var ib=it("child_process"),ZN=it("crypto"),ep=it("path"),xo=it("fs"),QN=it("os"),eT=it("tty"),Kt;if(process.env.ESBUILD_WORKER_THREADS!=="0"){try{Kt=it("worker_threads")}catch{}let[e,t]=process.versions.node.split(".");if(+e<12||+e===12&&+t<17||+e===13&&+t<13)Kt=void 0}var Kx,Wa=((Kx=Kt==null?void 0:Kt.workerData)==null?void 0:Kx.esbuildVersion)==="0.28.2",ab=()=>{if((!ui||!1)&&(ep.basename(__filename)!=="main.js"||ep.basename(__dirname)!=="lib"))throw Error(`The esbuild JavaScript API cannot be bundled. Please mark the "esbuild" package as external so it's not included in the bundle.
116
+ for your current platform.`)}throw s}}if(/\.zip\//.test(r)){let s;try{s=(()=>{throw new Error("Cannot require module "+"pnpapi");})()}catch(o){}if(s){let o=s.getPackageInformation(s.topLevel).packageLocation,i=Rn.join(o,"node_modules",".cache","esbuild",`pnpapi-${e.replace("/","-")}-0.28.2-${Rn.basename(t)}`);if(!xs.existsSync(i))xs.mkdirSync(Rn.dirname(i),{recursive:!0}),xs.copyFileSync(r,i),xs.chmodSync(i,493);return{binPath:i,isWASM:n}}}return{binPath:r,isWASM:n}}var cS=it("child_process"),nJ=it("crypto"),Pp=it("path"),$o=it("fs"),rJ=it("os"),sJ=it("tty"),Kt;if(process.env.ESBUILD_WORKER_THREADS!=="0"){try{Kt=it("worker_threads")}catch{}let[e,t]=process.versions.node.split(".");if(+e<12||+e===12&&+t<17||+e===13&&+t<13)Kt=void 0}var X$,Fa=((X$=Kt==null?void 0:Kt.workerData)==null?void 0:X$.esbuildVersion)==="0.28.2",lS=()=>{if((!ai||!1)&&(Pp.basename(__filename)!=="main.js"||Pp.basename(__dirname)!=="lib"))throw Error(`The esbuild JavaScript API cannot be bundled. Please mark the "esbuild" package as external so it's not included in the bundle.
117
117
 
118
- More information: The file containing the code for esbuild's JavaScript API (${__filename}) does not appear to be inside the esbuild package on the file system, which usually means that the esbuild package was bundled into another file. This is problematic because the API needs to run a binary executable inside the esbuild package which is located using a relative path from the API code to the executable. If the esbuild package is bundled, the relative path will be incorrect and the executable won't be found.`);{let{binPath:e,isWASM:t}=YN();if(t)return["node",[e]];else return[e,[]]}},Va=()=>eT.isatty(2),tT={readFile(e,t){try{let n=xo.readFileSync(e,"utf8");try{xo.unlinkSync(e)}catch{}t(null,n)}catch(n){t(n,null)}},writeFile(e,t){try{let n=cb();xo.writeFileSync(n,e),t(n)}catch{t(null)}}},nT={readFile(e,t){try{xo.readFile(e,"utf8",(n,r)=>{try{xo.unlink(e,()=>t(n,r))}catch{t(n,r)}})}catch(n){t(n,null)}},writeFile(e,t){try{let n=cb();xo.writeFile(n,e,(r)=>r!==null?t(null):t(n))}catch{t(null)}}},rT="0.28.2",sT=(e)=>wo().build(e),oT=(e)=>wo().context(e),iT=(e,t)=>wo().transform(e,t),aT=(e,t)=>wo().formatMessages(e,t),cT=(e,t)=>wo().analyzeMetafile(e,t),lT=(e)=>{if(Kt&&!Wa){if(!Gt)Gt=Dl(Kt);return Gt.buildSync(e)}let t;return Ml((n)=>n.buildOrContext({callName:"buildSync",refs:null,options:e,isTTY:Va(),defaultWD:bo,callback:(r,s)=>{if(r)throw r;t=s}})),t},uT=(e,t)=>{if(Kt&&!Wa){if(!Gt)Gt=Dl(Kt);return Gt.transformSync(e,t)}let n;return Ml((r)=>r.transform({callName:"transformSync",refs:null,input:e,options:t||{},isTTY:Va(),fs:tT,callback:(s,o)=>{if(s)throw s;n=o}})),n},fT=(e,t)=>{if(Kt&&!Wa){if(!Gt)Gt=Dl(Kt);return Gt.formatMessagesSync(e,t)}let n;return Ml((r)=>r.formatMessages({callName:"formatMessagesSync",refs:null,messages:e,options:t,callback:(s,o)=>{if(s)throw s;n=o}})),n},dT=(e,t)=>{if(Kt&&!Wa){if(!Gt)Gt=Dl(Kt);return Gt.analyzeMetafileSync(e,t)}let n;return Ml((r)=>r.analyzeMetafile({callName:"analyzeMetafileSync",refs:null,metafile:typeof e==="string"?e:JSON.stringify(e),options:t,callback:(s,o)=>{if(s)throw s;n=o}})),n},pT=()=>{if(Jl)Jl();if(Gt)Gt.stop();return Promise.resolve()},tp=!1,mT=(e)=>{if(e=FN(e||{}),e.wasmURL)throw Error('The "wasmURL" option only works in the browser');if(e.wasmModule)throw Error('The "wasmModule" option only works in the browser');if(e.worker)throw Error('The "worker" option only works in the browser');if(tp)throw Error('Cannot call "initialize" more than once');return wo(),tp=!0,Promise.resolve()},bo=process.cwd(),Fa,Jl,wo=()=>{if(Fa)return Fa;let[e,t]=ab(),n=ib.spawn(e,t.concat("--service=0.28.2","--ping"),{windowsHide:!0,stdio:["pipe","pipe","inherit"],cwd:bo}),{readFromStdout:r,afterClose:s,service:o}=rb({writeToStdin(u){n.stdin.write(u,(d)=>{if(d)s(d)})},readFileSync:xo.readFileSync,isSync:!1,hasFS:!0,esbuild:qa});n.stdin.on("error",s),n.on("error",s);let{stdin:i,stdout:a}=n;a.on("data",r),a.on("end",s),Jl=()=>{i.destroy(),a.destroy(),n.kill(),tp=!1,Fa=void 0,Jl=void 0};let c=0;if(n.unref(),i.unref)i.unref();if(a.unref)a.unref();let l={ref(){if(++c===1)n.ref()},unref(){if(--c===0)n.unref()}};return Fa={build:(u)=>new Promise((d,p)=>{o.buildOrContext({callName:"build",refs:l,options:u,isTTY:Va(),defaultWD:bo,callback:(m,x)=>m?p(m):d(x)})}),context:(u)=>new Promise((d,p)=>o.buildOrContext({callName:"context",refs:l,options:u,isTTY:Va(),defaultWD:bo,callback:(m,x)=>m?p(m):d(x)})),transform:(u,d)=>new Promise((p,m)=>o.transform({callName:"transform",refs:l,input:u,options:d||{},isTTY:Va(),fs:nT,callback:(x,h)=>x?m(x):p(h)})),formatMessages:(u,d)=>new Promise((p,m)=>o.formatMessages({callName:"formatMessages",refs:l,messages:u,options:d,callback:(x,h)=>x?m(x):p(h)})),analyzeMetafile:(u,d)=>new Promise((p,m)=>o.analyzeMetafile({callName:"analyzeMetafile",refs:l,metafile:typeof u==="string"?u:JSON.stringify(u),options:d,callback:(x,h)=>x?m(x):p(h)}))},Fa},Ml=(e)=>{let[t,n]=ab(),r=new Uint8Array,{readFromStdout:s,afterClose:o,service:i}=rb({writeToStdin(c){if(r.length!==0)throw Error("Must run at most one command");r=c},isSync:!0,hasFS:!0,esbuild:qa});e(i);let a=ib.execFileSync(t,n.concat("--service=0.28.2"),{cwd:bo,windowsHide:!0,input:r,maxBuffer:+process.env.ESBUILD_MAX_BUFFER||16777216});s(a),o(null)},cb=()=>ep.join(QN.tmpdir(),`esbuild-${ZN.randomBytes(32).toString("hex")}`),Gt=null,Dl=(e)=>{let{port1:t,port2:n}=new e.MessageChannel,r=new e.Worker(__filename,{workerData:{workerPort:n,defaultWD:bo,esbuildVersion:"0.28.2"},transferList:[n],execArgv:[]}),s=0,o=(l)=>{let u=Error(`Build failed with 1 error:
119
- error: ${l}`),d=[{id:"",pluginName:"",text:l,location:null,notes:[],detail:void 0}];return u.errors=d,u.warnings=[],u},i=(l)=>{if(!l)return;let u=l.plugins;if(u&&u.length>0)throw o("Cannot use plugins in synchronous API calls")},a=(l,u)=>{for(let d in u)l[d]=u[d]},c=(l,u)=>{let d=s++,p=new SharedArrayBuffer(8),m=new Int32Array(p),x={sharedBuffer:p,id:d,command:l,args:u};r.postMessage(x);let h=Atomics.wait(m,0,0);if(h!=="ok"&&h!=="not-equal")throw Error("Internal error: Atomics.wait() failed: "+h);let{message:{id:g,resolve:b,reject:j,properties:v}}=e.receiveMessageOnPort(t);if(d!==g)throw Error(`Internal error: Expected id ${d} but got id ${g}`);if(j)throw a(j,v),j;return b};return r.unref(),{buildSync(l){return i(l),c("build",[l])},transformSync(l,u){return c("transform",[l,u])},formatMessagesSync(l,u){return c("formatMessages",[l,u])},analyzeMetafileSync(l,u){return c("analyzeMetafile",[l,u])},stop(){r.terminate(),Gt=null}}},hT=()=>{let e=Kt.workerData.workerPort,t=Kt.parentPort,n=(r)=>{let s={};if(r&&typeof r==="object")for(let o in r)s[o]=r[o];return s};try{let r=wo();bo=Kt.workerData.defaultWD,t.on("message",(s)=>{(async()=>{let{sharedBuffer:o,id:i,command:a,args:c}=s,l=new Int32Array(o);try{switch(a){case"build":e.postMessage({id:i,resolve:await r.build(c[0])});break;case"transform":e.postMessage({id:i,resolve:await r.transform(c[0],c[1])});break;case"formatMessages":e.postMessage({id:i,resolve:await r.formatMessages(c[0],c[1])});break;case"analyzeMetafile":e.postMessage({id:i,resolve:await r.analyzeMetafile(c[0],c[1])});break;default:throw Error(`Invalid command: ${a}`)}}catch(u){e.postMessage({id:i,reject:u,properties:n(u)})}Atomics.add(l,0,1),Atomics.notify(l,0,1/0)})()})}catch(r){t.on("message",(s)=>{let{sharedBuffer:o,id:i}=s,a=new Int32Array(o);e.postMessage({id:i,reject:r,properties:n(r)}),Atomics.add(a,0,1),Atomics.notify(a,0,1/0)})}};if(Wa)hT();var gT=qa});import{createRequire as yT}from"node:module";import{join as xT}from"node:path";function rp(e,t){return yT(xT(t,"package.json")).resolve(e)}function bT(e){return e==="node"||e==="bun"?"node":"browser"}function $T(e){return new RegExp(`^${e.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}$`)}function wT(e,t){let n=$T(e);return{name:"jx-in-memory-entry",setup:(r)=>{r.onResolve({filter:n},()=>({path:e})),r.onLoad({filter:n},()=>({contents:t,loader:"ts"}))}}}async function sp(e){let t=await Promise.resolve().then(() => Jr(Fl(),1)),{entry:n}=e,r={bundle:!0,external:e.external,format:"esm",logLevel:"silent",minify:e.minify,platform:bT(e.target),plugins:e.plugins,write:!1};if(e.conditions)r.conditions=e.conditions;if(e.define)r.define=e.define;if("path"in n){if(r.entryPoints=[n.path],n.contents!==void 0)r.plugins=[wT(n.path,n.contents),...e.plugins]}else r.stdin={contents:n.source,loader:"js",resolveDir:n.resolveDir,sourcefile:"jx-entry.js"};return(await t.build({...r,write:!1})).outputFiles[0].text}var ub=()=>{};var fb=".jx-entry-";import{rmSync as vT,writeFileSync as db}from"node:fs";import{tmpdir as ET}from"node:os";import{basename as jT,join as PT,resolve as _T}from"node:path";function mb(e){return mo(e)||e.startsWith("./")||e.startsWith("../")}function op(e,t,n){if(mo(e))return rp(e.slice(jl.length),n);return _T(t,e)}function hb(e,t){return rp(e,t)}function kT(e){let{onFileLoaded:t,resolver:n}=e,r=e.plugins??[];if(n===void 0&&t===void 0)return[...r];return[{name:"jx-bundle-hooks",setup:(o)=>{if(n!==void 0)o.onResolve({filter:n.filter},(i)=>n.resolve(i));if(t!==void 0)o.onLoad({filter:/.*/},(i)=>{t(i.path)})}},...r]}function OT(e){if(e==="cloudflare-workers"||e==="cloudflare-pages")return{conditions:["workerd","worker"],external:["cloudflare:*","node:*"],target:"workerd"};return{target:e==="bun"?"bun":"node"}}function RT(e){return e.minify??e.target==="browser"}function CT(e){let t={};if(e.conditions)t.conditions=e.conditions;if(e.target==="browser")t.define={...AT};return t}function gb(e){return{...CT(e),external:e.external??[],minify:RT(e),plugins:kT(e),target:e.target}}async function yb(e,t){let n={path:e.entryPath};if(e.contents!==void 0)n.contents=e.contents;let r=await sp({entry:n,...gb(t)});db(e.outfile,r,"utf8")}function ip(e){return e==="<stdin>"||jT(e).startsWith(fb)}async function xb(e,t,n){let r=[],s=PT(ET(),`jx-resolve-${process.pid}.js`);try{await So(`export * from ${JSON.stringify(e)};
120
- `,{outfile:s,resolveDir:t},{...n,minify:!1,onFileLoaded:(o)=>r.push(o)})}catch{return}finally{vT(s,{force:!0})}return r.find((o)=>!ip(o))}async function So(e,{resolveDir:t,outfile:n},r){let s=await sp({entry:{resolveDir:t,source:e},...gb(r)});db(n,s,"utf8")}async function bb(e,{projectRoot:t,outfile:n,adapter:r,plugins:s}){let o=OT(r);if(s!==void 0)o.plugins=s;await So(e,{outfile:n,resolveDir:t},o)}var pb,AT;var ap=T(()=>{$n();ub();pb=["@vue/reactivity","lit-html"];AT={"process.env.NODE_ENV":'"production"'}});function NT(e,t){let n=e.slice(0,t),r=n.split(`
118
+ More information: The file containing the code for esbuild's JavaScript API (${__filename}) does not appear to be inside the esbuild package on the file system, which usually means that the esbuild package was bundled into another file. This is problematic because the API needs to run a binary executable inside the esbuild package which is located using a relative path from the API code to the executable. If the esbuild package is bundled, the relative path will be incorrect and the executable won't be found.`);{let{binPath:e,isWASM:t}=tJ();if(t)return["node",[e]];else return[e,[]]}},Da=()=>sJ.isatty(2),oJ={readFile(e,t){try{let n=$o.readFileSync(e,"utf8");try{$o.unlinkSync(e)}catch{}t(null,n)}catch(n){t(n,null)}},writeFile(e,t){try{let n=uS();$o.writeFileSync(n,e),t(n)}catch{t(null)}}},iJ={readFile(e,t){try{$o.readFile(e,"utf8",(n,r)=>{try{$o.unlink(e,()=>t(n,r))}catch{t(n,r)}})}catch(n){t(n,null)}},writeFile(e,t){try{let n=uS();$o.writeFile(n,e,(r)=>r!==null?t(null):t(n))}catch{t(null)}}},aJ="0.28.2",cJ=(e)=>vo().build(e),lJ=(e)=>vo().context(e),uJ=(e,t)=>vo().transform(e,t),fJ=(e,t)=>vo().formatMessages(e,t),dJ=(e,t)=>vo().analyzeMetafile(e,t),pJ=(e)=>{if(Kt&&!Fa){if(!Gt)Gt=Zl(Kt);return Gt.buildSync(e)}let t;return Yl((n)=>n.buildOrContext({callName:"buildSync",refs:null,options:e,isTTY:Da(),defaultWD:So,callback:(r,s)=>{if(r)throw r;t=s}})),t},mJ=(e,t)=>{if(Kt&&!Fa){if(!Gt)Gt=Zl(Kt);return Gt.transformSync(e,t)}let n;return Yl((r)=>r.transform({callName:"transformSync",refs:null,input:e,options:t||{},isTTY:Da(),fs:oJ,callback:(s,o)=>{if(s)throw s;n=o}})),n},hJ=(e,t)=>{if(Kt&&!Fa){if(!Gt)Gt=Zl(Kt);return Gt.formatMessagesSync(e,t)}let n;return Yl((r)=>r.formatMessages({callName:"formatMessagesSync",refs:null,messages:e,options:t,callback:(s,o)=>{if(s)throw s;n=o}})),n},gJ=(e,t)=>{if(Kt&&!Fa){if(!Gt)Gt=Zl(Kt);return Gt.analyzeMetafileSync(e,t)}let n;return Yl((r)=>r.analyzeMetafile({callName:"analyzeMetafileSync",refs:null,metafile:typeof e==="string"?e:JSON.stringify(e),options:t,callback:(s,o)=>{if(s)throw s;n=o}})),n},yJ=()=>{if(Gl)Gl();if(Gt)Gt.stop();return Promise.resolve()},_p=!1,xJ=(e)=>{if(e=WT(e||{}),e.wasmURL)throw Error('The "wasmURL" option only works in the browser');if(e.wasmModule)throw Error('The "wasmModule" option only works in the browser');if(e.worker)throw Error('The "worker" option only works in the browser');if(_p)throw Error('Cannot call "initialize" more than once');return vo(),_p=!0,Promise.resolve()},So=process.cwd(),Ja,Gl,vo=()=>{if(Ja)return Ja;let[e,t]=lS(),n=cS.spawn(e,t.concat("--service=0.28.2","--ping"),{windowsHide:!0,stdio:["pipe","pipe","inherit"],cwd:So}),{readFromStdout:r,afterClose:s,service:o}=oS({writeToStdin(u){n.stdin.write(u,(d)=>{if(d)s(d)})},readFileSync:$o.readFileSync,isSync:!1,hasFS:!0,esbuild:Ma});n.stdin.on("error",s),n.on("error",s);let{stdin:i,stdout:a}=n;a.on("data",r),a.on("end",s),Gl=()=>{i.destroy(),a.destroy(),n.kill(),_p=!1,Ja=void 0,Gl=void 0};let c=0;if(n.unref(),i.unref)i.unref();if(a.unref)a.unref();let l={ref(){if(++c===1)n.ref()},unref(){if(--c===0)n.unref()}};return Ja={build:(u)=>new Promise((d,p)=>{o.buildOrContext({callName:"build",refs:l,options:u,isTTY:Da(),defaultWD:So,callback:(m,x)=>m?p(m):d(x)})}),context:(u)=>new Promise((d,p)=>o.buildOrContext({callName:"context",refs:l,options:u,isTTY:Da(),defaultWD:So,callback:(m,x)=>m?p(m):d(x)})),transform:(u,d)=>new Promise((p,m)=>o.transform({callName:"transform",refs:l,input:u,options:d||{},isTTY:Da(),fs:iJ,callback:(x,g)=>x?m(x):p(g)})),formatMessages:(u,d)=>new Promise((p,m)=>o.formatMessages({callName:"formatMessages",refs:l,messages:u,options:d,callback:(x,g)=>x?m(x):p(g)})),analyzeMetafile:(u,d)=>new Promise((p,m)=>o.analyzeMetafile({callName:"analyzeMetafile",refs:l,metafile:typeof u==="string"?u:JSON.stringify(u),options:d,callback:(x,g)=>x?m(x):p(g)}))},Ja},Yl=(e)=>{let[t,n]=lS(),r=new Uint8Array,{readFromStdout:s,afterClose:o,service:i}=oS({writeToStdin(c){if(r.length!==0)throw Error("Must run at most one command");r=c},isSync:!0,hasFS:!0,esbuild:Ma});e(i);let a=cS.execFileSync(t,n.concat("--service=0.28.2"),{cwd:So,windowsHide:!0,input:r,maxBuffer:+process.env.ESBUILD_MAX_BUFFER||16777216});s(a),o(null)},uS=()=>Pp.join(rJ.tmpdir(),`esbuild-${nJ.randomBytes(32).toString("hex")}`),Gt=null,Zl=(e)=>{let{port1:t,port2:n}=new e.MessageChannel,r=new e.Worker(__filename,{workerData:{workerPort:n,defaultWD:So,esbuildVersion:"0.28.2"},transferList:[n],execArgv:[]}),s=0,o=(l)=>{let u=Error(`Build failed with 1 error:
119
+ error: ${l}`),d=[{id:"",pluginName:"",text:l,location:null,notes:[],detail:void 0}];return u.errors=d,u.warnings=[],u},i=(l)=>{if(!l)return;let u=l.plugins;if(u&&u.length>0)throw o("Cannot use plugins in synchronous API calls")},a=(l,u)=>{for(let d in u)l[d]=u[d]},c=(l,u)=>{let d=s++,p=new SharedArrayBuffer(8),m=new Int32Array(p),x={sharedBuffer:p,id:d,command:l,args:u};r.postMessage(x);let g=Atomics.wait(m,0,0);if(g!=="ok"&&g!=="not-equal")throw Error("Internal error: Atomics.wait() failed: "+g);let{message:{id:y,resolve:S,reject:E,properties:v}}=e.receiveMessageOnPort(t);if(d!==y)throw Error(`Internal error: Expected id ${d} but got id ${y}`);if(E)throw a(E,v),E;return S};return r.unref(),{buildSync(l){return i(l),c("build",[l])},transformSync(l,u){return c("transform",[l,u])},formatMessagesSync(l,u){return c("formatMessages",[l,u])},analyzeMetafileSync(l,u){return c("analyzeMetafile",[l,u])},stop(){r.terminate(),Gt=null}}},bJ=()=>{let e=Kt.workerData.workerPort,t=Kt.parentPort,n=(r)=>{let s={};if(r&&typeof r==="object")for(let o in r)s[o]=r[o];return s};try{let r=vo();So=Kt.workerData.defaultWD,t.on("message",(s)=>{(async()=>{let{sharedBuffer:o,id:i,command:a,args:c}=s,l=new Int32Array(o);try{switch(a){case"build":e.postMessage({id:i,resolve:await r.build(c[0])});break;case"transform":e.postMessage({id:i,resolve:await r.transform(c[0],c[1])});break;case"formatMessages":e.postMessage({id:i,resolve:await r.formatMessages(c[0],c[1])});break;case"analyzeMetafile":e.postMessage({id:i,resolve:await r.analyzeMetafile(c[0],c[1])});break;default:throw Error(`Invalid command: ${a}`)}}catch(u){e.postMessage({id:i,reject:u,properties:n(u)})}Atomics.add(l,0,1),Atomics.notify(l,0,1/0)})()})}catch(r){t.on("message",(s)=>{let{sharedBuffer:o,id:i}=s,a=new Int32Array(o);e.postMessage({id:i,reject:r,properties:n(r)}),Atomics.add(a,0,1),Atomics.notify(a,0,1/0)})}};if(Fa)bJ();var $J=Ma});import{createRequire as SJ}from"node:module";import{mkdirSync as wJ,writeFileSync as vJ}from"node:fs";import{dirname as EJ,join as jJ}from"node:path";function Op(e,t){return SJ(jJ(t,"package.json")).resolve(e)}function dS(e){return e==="node"||e==="bun"?"node":"browser"}function PJ(e){return new RegExp(`^${e.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}$`)}function _J(e,t){let n=PJ(e);return{name:"jx-in-memory-entry",setup:(r)=>{r.onResolve({filter:n},()=>({path:e})),r.onLoad({filter:n},()=>({contents:t,loader:"ts"}))}}}async function Ap(e){let t=await Promise.resolve().then(() => ar(La(),1)),{entry:n}=e,r={bundle:!0,external:e.external,format:"esm",logLevel:"silent",minify:e.minify,platform:dS(e.target),plugins:e.plugins,write:!1};if(e.conditions)r.conditions=e.conditions;if(e.define)r.define=e.define;if("path"in n){if(r.entryPoints=[n.path],n.contents!==void 0)r.plugins=[_J(n.path,n.contents),...e.plugins]}else r.stdin={contents:n.source,loader:"js",resolveDir:n.resolveDir,sourcefile:"jx-entry.js"};return(await t.build({...r,write:!1})).outputFiles[0].text}async function pS(e){let t=await Promise.resolve().then(() => ar(La(),1)),n={bundle:!0,chunkNames:"chunk-[hash]",entryNames:"[name]",entryPoints:e.entries,external:e.external,format:"esm",logLevel:"silent",minify:e.minify,outdir:e.outdir,platform:dS(e.target),plugins:e.plugins,splitting:!0};if(e.conditions)n.conditions=e.conditions;if(e.define)n.define=e.define;return(await t.build({...n,write:!1})).outputFiles.map((s)=>(wJ(EJ(s.path),{recursive:!0}),vJ(s.path,s.contents),s.path))}var mS=()=>{};var hS=".jx-entry-";import{rmSync as OJ,writeFileSync as gS}from"node:fs";import{builtinModules as AJ}from"node:module";import{tmpdir as CJ}from"node:os";import{basename as RJ,join as NJ,resolve as TJ}from"node:path";function yS(e){return go(e)||e.startsWith("./")||e.startsWith("../")}function Rp(e,t,n){if(go(e))return Op(e.slice(Ml.length),n);return TJ(t,e)}function xS(e,t){return Op(e,t)}function JJ(e){let{onFileLoaded:t,resolver:n}=e,r=e.plugins??[];if(n===void 0&&t===void 0)return[...r];return[{name:"jx-bundle-hooks",setup:(o)=>{if(n!==void 0)o.onResolve({filter:n.filter},(i)=>n.resolve(i));if(t!==void 0)o.onLoad({filter:/.*/},(i)=>{t(i.path)})}},...r]}function DJ(e){if(e==="cloudflare-workers"||e==="cloudflare-pages")return{conditions:["workerd","worker"],external:["cloudflare:*","node:*"],plugins:[IJ],target:"workerd"};return{target:e==="bun"?"bun":"node"}}function FJ(e){return e.minify??e.target==="browser"}function LJ(e){let t={};if(e.conditions)t.conditions=e.conditions;if(e.target==="browser")t.define={...MJ};return t}function Np(e){return{...LJ(e),external:e.external??[],minify:FJ(e),plugins:JJ(e),target:e.target}}async function bS(e,t){let n={path:e.entryPath};if(e.contents!==void 0)n.contents=e.contents;let r=await Ap({entry:n,...Np(t)});gS(e.outfile,r,"utf8")}async function $S(e,t,n){return pS({entries:e,outdir:t,...Np(n)})}function Tp(e){return e==="<stdin>"||RJ(e).startsWith(hS)}async function SS(e,t,n){let r=[],s=NJ(CJ(),`jx-resolve-${process.pid}.js`);try{await Eo(`export * from ${JSON.stringify(e)};
120
+ `,{outfile:s,resolveDir:t},{...n,minify:!1,onFileLoaded:(o)=>r.push(o)})}catch{return}finally{OJ(s,{force:!0})}return r.find((o)=>!Tp(o))}async function Eo(e,{resolveDir:t,outfile:n},r){let s=await Ap({entry:{resolveDir:t,source:e},...Np(r)});gS(n,s,"utf8")}async function wS(e,{projectRoot:t,outfile:n,adapter:r,plugins:s}){let o=DJ(r);if(s!==void 0)o.plugins=[...o.plugins??[],...s];await Eo(e,{outfile:n,resolveDir:t},o)}var Cp,IJ,MJ;var Jp=R(()=>{$n();mS();Cp=["@vue/reactivity","lit-html"];IJ={name:"jx-bare-node-builtins",setup(e){let t=AJ.filter((r)=>!r.startsWith("_")&&!r.includes(":")),n=new RegExp(`^(${t.map((r)=>r.replaceAll("/",String.raw`\/`)).join("|")})$`);e.onResolve({filter:n},(r)=>({external:!0,path:`node:${r.path}`}))}};MJ={"process.env.NODE_ENV":'"production"'}});function VJ(e,t){let n=e.slice(0,t),r=n.split(`
121
121
  `).length;return{column:t-n.lastIndexOf(`
122
- `),line:r}}function lp(e,t,n,r){return{...NT(e,t),kind:n,message:r,offset:t}}function TT(e,t){let n=t;while(n<e.length&&/\s/u.test(e.charAt(n)))n+=1;return n}function vb(e){for(let t of[e,`return async function () {
122
+ `),line:r}}function Dp(e,t,n,r){return{...VJ(e,t),kind:n,message:r,offset:t}}function qJ(e,t){let n=t;while(n<e.length&&/\s/u.test(e.charAt(n)))n+=1;return n}function PS(e){for(let t of[e,`return async function () {
123
123
  ${e}
124
- }`])try{return Reflect.construct(Function,[t])!==null}catch{}return!1}function Eb(e){up=e,Ll=null}function IT(e,t){if(!Ll){if(!up)throw Error("@jxsuite/erase was imported without an entry that loads its stripper");Ll=up()}return Ll(e,t)}function jb(e,t,n){return IT(e,(r)=>{let s=TT(e,r.pos),[o="this"]=/^[\w$]+/u.exec(e.slice(s))??[];n.push(lp(e,s,"unsupported",`\`${o}\` is TypeScript that has to be compiled rather than erased. ${t} may use only types that can be removed: no enum, value namespace or parameter property`))})}function MT(e){return to(e).includes("<")||!vb(e)}function DT(e){let t=cp.get(e);if(t)return t;if(!MT(e)){let i={code:e,problems:[]};return cp.set(e,i),i}let n=[],r=jb(e,"A function body",n),s=to(r);for(let i of s.matchAll(JT)){let a=i.index+(i[1]?.length??0)+(i[2]?.length??0);n.push(lp(e,a,"unsupported",`A function body cannot ${i[3]??"import"}. Move code that needs a module into one of its own, named by $src`))}if(r!==e&&n.length===0&&vb(e)){let i=[...e].findIndex((a,c)=>a!==r[c]);n.push(lp(e,Math.max(i,0),"meaning","This was already JavaScript, and reading it as TypeScript changes it: `a < b > (c)` is a generic call in TypeScript and two comparisons in JavaScript. Add parentheses if a comparison is meant"))}let o={code:r,problems:n};return cp.set(e,o),o}function Pb(e){let t=$b.get(e);if(t)return t;let n=[],s={code:jb(e,"A script",n),problems:n};return $b.set(e,s),s}function FT(e){return String(e).replaceAll("~","~0").replaceAll("/","~1")}function wb(e,t,n){if(k(e))return Sb(e,t,n);if(Array.isArray(e)&&e.length>0&&e.every((r)=>k(r)))return Sb(e.join(`
124
+ }`])try{return Reflect.construct(Function,[t])!==null}catch{}return!1}function _S(e){Mp=e,Ql=null}function HJ(e,t){if(!Ql){if(!Mp)throw Error("@jxsuite/erase was imported without an entry that loads its stripper");Ql=Mp()}return Ql(e,t)}function kS(e,t,n){return HJ(e,(r)=>{let s=qJ(e,r.pos),[o="this"]=/^[\w$]+/u.exec(e.slice(s))??[];n.push(Dp(e,s,"unsupported",`\`${o}\` is TypeScript that has to be compiled rather than erased. ${t} may use only types that can be removed: no enum, value namespace or parameter property`))})}function UJ(e){return ro(e).includes("<")||!PS(e)}function BJ(e){let t=Ip.get(e);if(t)return t;if(!UJ(e)){let i={code:e,problems:[]};return Ip.set(e,i),i}let n=[],r=kS(e,"A function body",n),s=ro(r);for(let i of s.matchAll(WJ)){let a=i.index+(i[1]?.length??0)+(i[2]?.length??0);n.push(Dp(e,a,"unsupported",`A function body cannot ${i[3]??"import"}. Move code that needs a module into one of its own, named by $src`))}if(r!==e&&n.length===0&&PS(e)){let i=[...e].findIndex((a,c)=>a!==r[c]);n.push(Dp(e,Math.max(i,0),"meaning","This was already JavaScript, and reading it as TypeScript changes it: `a < b > (c)` is a generic call in TypeScript and two comparisons in JavaScript. Add parentheses if a comparison is meant"))}let o={code:r,problems:n};return Ip.set(e,o),o}function OS(e){let t=vS.get(e);if(t)return t;let n=[],s={code:kS(e,"A script",n),problems:n};return vS.set(e,s),s}function zJ(e){return String(e).replaceAll("~","~0").replaceAll("/","~1")}function ES(e,t,n){if(k(e))return jS(e,t,n);if(Array.isArray(e)&&e.length>0&&e.every((r)=>k(r)))return jS(e.join(`
125
125
  `),t,n).split(`
126
- `);return e}function Sb(e,t,n){let{code:r,problems:s}=DT(e),[o,...i]=s.filter((a)=>a.kind==="unsupported");if(o)throw new Vl(t,[o,...i]);for(let a of s)n.push({...t,problem:a});return r}function fp(e,t,n){if(Array.isArray(e))return e.map((i,a)=>fp(i,{...t,pointer:`${t.pointer}/${a}`},n));if(!V(e))return e;let r=td(e),s=[],o={set:(i,a)=>{s.push([i,a])}};for(let[i,a]of Object.entries(e)){let c={...t,pointer:`${t.pointer}/${FT(i)}`};if(r&&i==="body")o.set(i,wb(a,c,n));else if(r&&(i==="getter"||i==="setter")&&V(a)){let l={...a};if(a.body!==void 0)l.body=wb(a.body,{...c,pointer:`${c.pointer}/body`},n);o.set(i,l)}else o.set(i,fp(a,c,n))}return Object.fromEntries(s)}function Ha(e,t,n=[]){return fp(e,{path:t,pointer:""},n)}function _b(e,t,n=[]){return Ha(e,t,n)}var JT,cp,Ll=null,up=null,$b,Vl;var dp=T(()=>{le();JT=/(^|[\n;{}])(\s*)(import|export)(?=[\s{*"'])/gu;cp=new Map;$b=new Map;Vl=class Vl extends Error{problems;site;constructor(e,t){let[n]=t;super(`${e.path}${e.pointer}: ${n.message} (line ${n.line}, column ${n.column})`);this.name="EraseError",this.problems=t,this.site=e}}});import{createRequire as LT}from"node:module";var ql=T(()=>{dp();dp();Eb(()=>LT(import.meta.url)("ts-blank-space").default)});function Ob(e){for(let{path:t,pointer:n,problem:r}of e){let s=`${t}${n} (line ${r.line}, column ${r.column}): ${r.message}`;if(!kb.has(s))kb.add(s),console.warn(`Warning: ${s}`)}}function ur(e,t){let n=[],r=Ha(e,t,n);return Ob(n),r}function Ab(e,t){let n=[],r=_b(e,t,n);return Ob(n),r}var kb;var pi=T(()=>{ql();kb=new Set});function qT(e){return e.split("\\").join("/").replace(/^\.\//,"").replace(/^\//,"").replace(/^pages\//,"")}function Rb(e){let t=qT(e),n=t.slice(t.lastIndexOf("/")+1),r=n.lastIndexOf(".");if(r>0)t=t.slice(0,t.length-(n.length-r));if(t.endsWith("/index"))t=t.slice(0,-6)||"/";else if(t==="index")t="/";if(!t.startsWith("/"))t=`/${t}`;let s=[],o=!1,i=!1,a=t.replaceAll(VT,(c,l,u)=>{if(o=!0,l)return i=!0,s.push(l),"*";return s.push(u),`:${u}`});return{isCatchAll:i,isDynamic:o,params:s,urlPattern:a}}function Cb(e,t){if(e.isDynamic!==t.isDynamic)return e.isDynamic?1:-1;if(e.isCatchAll!==t.isCatchAll)return e.isCatchAll?1:-1;return e.urlPattern.localeCompare(t.urlPattern)}var VT;var Nb=T(()=>{VT=/\[\.\.\.(\w+)\]|\[(\w+)\]/g});function HT(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function Tb(e){if(!V(e)||!("paginate"in e))return null;let{each:t,pageSize:n,paginate:r}=e,s=V(r)?r.$ref:void 0,o=k(s)?WT.exec(s)?.[1]:void 0;if(o===void 0)throw TypeError('$paths.paginate must be { "$ref": "#/state/<key>" }');if(!St(n)||!Number.isInteger(n)||n<1)throw TypeError("$paths.pageSize must be a positive integer");let i={key:HT(o),pageSize:n};if(t!==void 0){if(!V(t)&&!Array.isArray(t))throw TypeError("$paths.each must be a $paths source");if(V(t)&&"paginate"in t)throw TypeError("$paths.each cannot itself be paged");i.each=t}return i}function pp(e,t){return Math.max(1,Math.ceil(e/t))}function Jb(e,t,n){let r=(t-1)*n;return e.slice(r,r+n)}function vo(e,t){if(e.endsWith("*")){if(t===1){let n=e.slice(0,-1).replace(/\/$/,"");return n===""?"/":n}return`${e.slice(0,-1)}${t}`}return e.replace(/:[^/]+/,String(t))}function Ib(e,t,n,r){let s=pp(r,n),o=[];for(let i=1;i<=s;i++)o.push({current:i===t,number:i,url:vo(e,i)});return{first:vo(e,1),itemCount:r,last:vo(e,s),next:t<s?vo(e,t+1):null,number:t,pageCount:s,pageSize:n,pages:o,prev:t>1?vo(e,t-1):null}}var WT;var Mb=T(()=>{le();WT=/^#\/state\/([^/]+)$/});function Tn(e){if(!k(e)||e.trim()==="")return null;try{return new Intl.Locale(e.trim()).toString()}catch{return null}}function Ua(e){let t=Tn(e);if(t===null)return"ltr";let n=new Intl.Locale(t),r=n.script??n.maximize().script;return r!==void 0&&UT.has(r)?"rtl":"ltr"}function Db(e){let t=Tn(e);if(t===null)return k(e)?e:"";return new Intl.DisplayNames([t],{type:"language"}).of(t)??t}function mp(e){let t=e.i18n,n=[];if(!D(t))return{errors:n,i18n:null};let r=Array.isArray(t.locales)?t.locales:[],s=[];for(let a of r){let c=Tn(a);if(c===null){n.push(`i18n.locales: "${String(a)}" is not a well-formed BCP 47 language tag.`);continue}if(!s.includes(c))s.push(c)}let o=Tn(t.defaultLocale)??s[0]??null;if(t.defaultLocale!==void 0&&Tn(t.defaultLocale)===null)n.push(`i18n.defaultLocale: "${String(t.defaultLocale)}" is not a well-formed BCP 47 language tag.`);if(o===null)return n.push("i18n is declared with no usable locale — set `defaultLocale` or `locales`."),{errors:n,i18n:null};if(!s.includes(o))s.unshift(o);let i=t.routing==="prefix-always"||t.routing==="prefix-except-default"?t.routing:BT;return{errors:n,i18n:{defaultLocale:o,locales:s,routing:i}}}function Xn(e,t){if(t===null)return null;let n=e.split("/").find(Boolean);if(n===void 0)return t.defaultLocale;let r=Tn(n);return r!==null&&t.locales.includes(r)?r:t.defaultLocale}var UT,Wl="^[A-Za-z]{2,8}(-[A-Za-z0-9]{1,8})*$",BT="prefix-except-default";var Eo=T(()=>{le();UT=new Set(["Adlm","Arab","Aran","Armi","Avst","Cprt","Egyd","Egyh","Elym","Gara","Hatr","Hebr","Hluw","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogd","Sogo","Syrc","Thaa","Todr","Yezi"])});function KT(e){let t=new Set,n=new Set,r=(o)=>{if(o.startsWith("#/state/"))t.add(o.slice(8).split("/")[0])},s=(o)=>{if(k(o)){for(let i of o.matchAll(/\bstate\.([A-Za-z_$][\w$]*)\s*\(/gu))t.add(i[1]);return}if(Array.isArray(o)){if(!n.has(o)){n.add(o);for(let i of o)s(i)}return}if(!V(o)||n.has(o))return;if(n.add(o),o.operator==="call"&&Ne(o.target))r(o.target.$ref);for(let[i,a]of Object.entries(o)){if(i==="$defs")continue;if(i.startsWith("on")&&Ne(a))r(a.$ref);s(a)}};s(e);for(let o of zT)if(V(e.state)&&o in e.state)t.add(o);return t}function hp(e){return"body"in e&&"$src"in e}function Ba(e){return Fc(e.parameters??e.arguments).length>0}function fr(e){let t=["state"];for(let n of Fc(e.parameters??e.arguments))if(n!=="state")t.push(n);return t}function GT(e,t,n){if(sr(t))return"callable";if(Fc(t.parameters??t.arguments).length>0)return"callable";if(k(t.body))return Lg(t.body)?"computed":"callable";if(t.$src)return n().has(e)?"callable":"computed";return"callable"}function jo(e){let t=new Map,n=null,r=()=>n??=KT(e);for(let[s,o]of Object.entries(e.state??{}))if(jt(o))t.set(s,GT(s,o,r));return t}var zT;var za=T(()=>{le();zT=new Set(["onMount","onUnmount","onAdopted"])});function an(e){return e.replaceAll(/[A-Z]/g,(t)=>`-${t.toLowerCase()}`)}function Fb(e,t){if(e.startsWith("@--"))return t[e.slice(1)]??e.slice(1);if(e.startsWith("@(")){let n=e.slice(2,-1).trim();return XT.has(n.toLowerCase())?n:e.slice(1)}return null}function Ka(e){return e.startsWith("@position-try")||e.startsWith("@property")||e.startsWith("@font-face")||e.startsWith("@counter-style")}function Xa(e){return e.startsWith("@keyframes")}function Lb(e,t){let n=[];for(let r of Ga(e))for(let s of Ga(t))n.push(YT(r,s));return n.join(", ")}function YT(e,t){let n=Ul(t,e);if(n!==null)return n;if(t.startsWith("[")||t.startsWith(":")||t.startsWith("."))return`${e}${t}`;return`${e} ${t}`}function gp(e){let t=[],n=null,r=0;for(let s=0;s<e.length;s+=1){let o=e[s];if(n){if(o==="\\")s+=1;else if(o===n)n=null;continue}if(o==="\\")s+=1;else if(o==='"'||o==="'")n=o;else if(o==="[")r+=1;else if(o==="]")r=Math.max(0,r-1);else if(o==="&"&&r===0)t.push(s)}return t}function Ul(e,t){return gp(e).length>0?ZT(e,t):null}function ZT(e,t){let n="",r=0;for(let s of gp(e))n+=e.slice(r,s)+t,r=s+1;return n+e.slice(r)}function Ga(e){let t=[],n=0,r=null,s=0;for(let i=0;i<e.length;i+=1){let a=e[i];if(r){if(a==="\\")i+=1;else if(a===r)r=null;continue}if(a==='"'||a==="'")r=a;else if(a==="("||a==="[")n+=1;else if(a===")"||a==="]")n=Math.max(0,n-1);else if(a===","&&n===0)t.push(e.slice(s,i)),s=i+1}t.push(e.slice(s));let o=t.flatMap((i)=>{let a=i.trim();return a===""?[]:[a]});return o.length>0?o:[e]}function Zn(e){let t=/^\(\s*prefers-color-scheme\s*:\s*(light|dark)\s*\)$/.exec(e.trim())?.[1];return t==="light"||t==="dark"?t:null}function yp(e,t){if(e===":root"||e==="html")return{auto:`${e}:where(:not([${Yn}]))`,forced:`${e}:where([${Yn}="${t}"])`};return{auto:`:where(:root:not([${Yn}])) ${e}`,forced:`:where(:root[${Yn}="${t}"]) ${e}`}}function ys(e){return e.startsWith(":")||e.startsWith(".")||e.startsWith("&")||e.startsWith("[")}function xp(e){return e.startsWith("--")?e:an(e)}function Hl(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function Vb(e,t,n){let r=n.map(([o,i])=>`${o}: ${i}`).join("; "),s=t===null?r:`${t} { ${r} }`;for(let o=e.length-1;o>=0;o-=1)s=`${e[o]} { ${s} }`;return s}function QT(e,t,n){let r=n.map(({selector:o,declarations:i})=>`${o} { ${i.map(([a,c])=>`${a}: ${c}`).join("; ")} }`).join(" "),s=`@keyframes ${t} { ${r} }`;for(let o=e.length-1;o>=0;o-=1)s=`${e[o]} { ${s} }`;return s}function eJ(e){let t=Object.keys(e).filter((r)=>Xa(r));if(t.length===0)return e;let n={...e};for(let r of t)delete n[r];return n}function tJ(e){let n=gp(e).at(-1),r=n===void 0?e:e.slice(n+1);return r===""||r.startsWith(":")||r.startsWith(".")||r.startsWith("[")}function mi(e,t={}){let{scope:n=null,mediaQueries:r={},transposeValue:s=(g)=>g,transposeSelector:o=(g)=>g,resolveValue:i}=t,a=[],c=(g)=>g!==null&&typeof g==="object"&&!Array.isArray(g)&&!Ne(g),l=(g,b)=>{if(c(b))return[b];if(!Ka(g)||!Array.isArray(b)||b.length===0)return[];return b.every((j)=>c(j))?b:[]},u=(g,b,j,v)=>{if(b===void 0||b===null)return null;if(Ne(b))return j?i?.(g,b,v)??null:null;if(D(b))return null;let P=String(b);if(me(P))return j?i?.(g,P,v)??null:null;return s(P)},d=(g,b,j=!0,v="self")=>{let P=[];for(let[S,_]of Object.entries(g)){if(l(S,_).length>0)continue;if(b&&(S.startsWith("@")||ys(S)))continue;if(S.startsWith("$"))continue;let N=u(S,_,j,v);if(N!==null)P.push([xp(S),N])}return P},p=(g,b,j,v,P)=>{if(j.length===0)return;let S=b;if(S!==null){let F=o(S);if(F===null)return;S=F}let _=Vb(g,S,j),N={text:_,conditions:[...g],selector:S,declarations:j,target:v,key:Hl(_)};if(k(P)&&P!=="")N.description=P;a.push(N)},m=(g,b,j)=>{let v=g.slice(10).trim();if(v==="")return;let P=[];for(let[_,N]of Object.entries(b)){if(!c(N))continue;let F=d(N,!0,!1,"unscoped");if(F.length>0)P.push({declarations:F,selector:_.trim()})}if(P.length===0)return;let S=QT(j,v,P);a.push({blocks:P,conditions:[...j],declarations:[],key:Hl(S),selector:null,target:"unscoped",text:S})},x=(g,b,j,v,P)=>{if(g==="@--")return;if(Ka(g)){p([...v,g],null,d(b,!1,!0,"unscoped"),"unscoped",b.$description);return}if(Xa(g)){m(g,b,v);return}let S=Fb(g,r),_=S===null?g:`@media ${S}`,N=S===null?null:Zn(S);if(N!==null&&j!==null){let{auto:F,forced:K}=yp(j,N);h(b,F,[...v,_],P),h(eJ(b),K,v,P);return}h(b,j,[...v,_],P)};function h(g,b,j,v){p(j,b,d(g,!0,!0,v),v,g.$description);for(let[P,S]of Object.entries(g))for(let _ of l(P,S))if(P.startsWith("@"))x(P,_,b,j,v);else if(b!==null)h(_,Lb(b,P),j,tJ(P)?v:"descendant")}return h(e,n,[],"self"),a}var XT,Yn="data-color-scheme",Bl="jx-color-scheme";var Ya=T(()=>{le();XT=new Set(["all","print","screen","speech"])});function Hb(){return`the Intl helpers ${$p.join(", ")}`}var dr="en-US",bp="UTC",qb,$p,Wb;var wp=T(()=>{qb=[{api:"Intl.NumberFormat",params:["value","locale","options"],path:"Intl/formatNumber",summary:"Format a number for a locale — grouping, decimals, currency, percent, units."},{api:"Intl.DateTimeFormat",params:["value","locale","options"],path:"Intl/formatDate",summary:"Format a date or timestamp for a locale. Pass `timeZone` in options."},{api:"Intl.RelativeTimeFormat",params:["value","unit","locale","options"],path:"Intl/formatRelativeTime",summary:'Format a relative time — `-3, "day"` becomes "3 days ago".'},{api:"Intl.ListFormat",params:["values","locale","options"],path:"Intl/formatList",summary:'Join a list the way a locale does — "a, b, and c", not a hand-written comma join.'},{api:"Intl.PluralRules",params:["value","locale","options"],path:"Intl/plural",summary:'Which plural category a number falls in ("one", "few", "other") — many languages have '+"more than two, so a ternary on `n === 1` is wrong outside English."},{api:"Intl.Collator",params:["a","b","locale","options"],path:"Intl/compare",summary:'Compare two strings for sorting. `<` and `sort()` order by UTF-16 code unit, which puts "Zebra" before "apple" and sorts every accented word into the wrong place.'},{api:"Intl.DisplayNames",params:["code","type","locale","options"],path:"Intl/displayName",summary:'The name of a language, region, script or currency in a locale — "de" as "German" or '+'"Deutsch", from CLDR rather than a hand-kept table.'},{api:"Intl.Segmenter",params:["value","granularity","locale"],path:"Intl/segment",summary:"Split text into graphemes, words or sentences (UAX #29). `[...str]` splits code points, so it cuts an emoji with a skin-tone modifier in half."}],$p=qb.map((e)=>e.path),Wb=Object.fromEntries(qb.map((e)=>[e.path,e.params.indexOf("locale")]))});function nJ(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function Xt(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function pr(e){if(e==="")return[];return e.split("/").map((t)=>nJ(t))}function Jt(e,t){let n=e;for(let r of pr(t))n=n?.[r];return n}function Je(e,t){let n=e;for(let r of pr(t))n+=Sp.test(r)?`.${r}`:`[${JSON.stringify(r)}]`;return n}function Ub(e,t){let n=e;for(let[r,s]of pr(t).entries()){let o=r===0?"":"?.";n+=Sp.test(s)?`${r===0?".":o}${s}`:`${o}[${JSON.stringify(s)}]`}return n}function Gr(e){return Sp.test(e)?e:JSON.stringify(e)}function Bb(e){let t=e.replaceAll(/[^A-Za-z0-9_$]/g,"_");if(t==="")return"ref";return/^\d/.test(t)?`_${t}`:t}var Sp;var hi=T(()=>{Sp=/^[A-Za-z_$][A-Za-z0-9_$]*$/});function vp(e){let t=e.$map;return D(t)?t:void 0}function Gl(e){return D(e)&&!Array.isArray(e)&&"operator"in e}function gi(e){return D(e)&&!Array.isArray(e)&&"$ref"in e}function iJ(e,t,n){let r=Wb[e];if(r===void 0||r<0||t[r]!=null)return t;let s=Jt(n.$page,"locale");if(!k(s)||s==="")return t;let o=[...t];return o[r]=s,o}function Qb(){return globalThis.window??globalThis}function e$(e){return e.startsWith("window#/")&&sJ.has(e.slice(8))}function mr(e){return Xb.has(e)}function zl(e){if(Array.isArray(e))return e.some((t)=>zl(t));if(e===void 0||!Gl(e))return!1;return mr(e.operator)||[e.target,e.value,e.initial,e.default].some((t)=>zl(t))||Object.values(e.cases??{}).some((t)=>zl(t))}function Po(e){return Ir(e)&&!zl(e.$expression)}function Ep(e,t){if(Array.isArray(e)){for(let n of e)Ep(n,t);return}if(e===void 0||!D(e))return;if(gi(e)){if(!aJ.test(e.$ref)){let n=e.$ref.replace(/^(?:#\/state\/|parent#\/)/,"");t.add(pr(n)[0]??"")}return}if(Gl(e)){let n=[e.target,e.value,e.initial,e.default];for(let r of[...n,...Object.values(e.cases??{})])Ep(r,t)}}function Ap(e){let t=new Set;return Ep(e.$expression,t),[...t]}function Rp(e){let t=new Map;for(let[r,s]of Object.entries(e??{}))if(!r.startsWith("$")&&Po(s))t.set(r,s);let n=!1;while(!n){n=!0;for(let[r,s]of t)if(Ap(s).some((o)=>!t.has(o)))t.delete(r),n=!1}return Object.fromEntries(t)}function tt(e,t){if(!e)return;let n=(e.depth??0)+1;if(n>cJ)return;return{depth:n,path:[...e.path??[],...Array.isArray(t)?t:[t]],report:e.report}}function Ye(e,t,n,r,s){if(e===null||e===void 0)return e;if(Gl(e))return Sn(e,t,n,r,s);if(gi(e)){let o=Kl(e.$ref,t,n,r);return s?.report(s.path??[],o),o}if(Array.isArray(e))return t$(e,t,n,r,s);return s?.report(s.path??[],e),e}function t$(e,t,n,r,s){return e.map((o,i)=>Ye(o,t,n,r,tt(s,i)))}function lJ(e,t,n,r){let s=(o)=>{if(!e.slice(o.length).includes("/"))return t;return Kl(e.slice(0,e.lastIndexOf("/")),t,n,r)};if(e.startsWith("#/state/"))return s("#/state/");if(e.startsWith("parent#/"))return s("parent#/");if(e.startsWith("$map/")||e.startsWith("$args/"))return e.split("/").length>2?Kl(e.slice(0,e.lastIndexOf("/")),t,n,r):void 0;return}function Kl(e,t,n,r){if(e==="$reduce/acc")return r?.acc;if(e.startsWith("$reduce/"))return r?.acc;if(e.startsWith("$args/")){let s=e.slice(6).split("/"),o=r?.args?.[s[0]];return s.length>1?Jt(o,s.slice(1).join("/")):o}if(e.startsWith("event#/")){let s=e.slice(7);return Jt(n,s)}if(e.startsWith("$map/")){let s=e.split("/"),[,o]=s,i,a=vp(t);if(o==="item")i=r?.item??a?.item??t["$map/item"];else if(o==="index")i=r?.index??a?.index??t["$map/index"];else i=a?.[o]??t[`$map/${o}`];return s.length>2?Jt(i,s.slice(2).join("/")):i}if(e.startsWith("#/state/"))return Jt(t,e.slice(8));if(e.startsWith("parent#/"))return Jt(t,e.slice(8));if(e.startsWith("window#/"))return Jt(Qb(),e.slice(8));if(e.startsWith("document#/"))return Jt(globalThis.document,e.slice(10));return Jt(t,e)??null}function uJ(e,t,n,r){if(e.startsWith("$map/")){let s=e.split("/"),[,o]=s,i,a=vp(t);if(o==="item")i=r?.item??a?.item??t["$map/item"];else if(o==="index")i=r?.index??a?.index??t["$map/index"];else i=a?.[o]??t[`$map/${o}`];if(s.length>2){let c=s.slice(2),l=c.pop(),u=c.length>0?Jt(i,c.join("/")):i;return{key:l,obj:u}}return{key:o==="item"?"$map/item":"$map/index",obj:vp(t)??t}}if(e.startsWith("#/state/")){let s=e.slice(8);if(s.indexOf("/")===-1)return{key:s,obj:t};let i=pr(s),a=i.pop(),c=t;for(let l of i)c=c[l];return{key:a,obj:c}}return{key:e,obj:t}}function Sn(e,t,n,r,s){let o=fJ(e,t,n,r,s);return s?.report(s.path??[],o),o}function Kb(e,t,n){switch(e){case"+":return t+n;case"-":return t-n;case"*":return t*n;case"/":return t/n;case"%":return t%n;case"<":return t<n;case"<=":return t<=n;case">":return t>n;default:return t>=n}}function fJ(e,t,n,r,s){let{operator:o,target:i,value:a,initial:c}=e;if(!rJ.has(o))throw Error(`$expression: unknown operator "${o}"`);if(jp.has(o)&&!("value"in e)){let l=Ye(i,t,n,r,tt(s,"target"));if(o==="!")return!l;if(o==="-")return-l}if(o==="call"){let l=gi(i)?i.$ref:void 0;if(!k(l))throw TypeError("$expression: call target must be a $ref pointer");let u=(r?.callDepth??0)+1;if(u>zb)throw Error(`$expression: call depth exceeded (${zb})`);let d=Array.isArray(a)?a.map((m,x)=>Ye(m,t,n,r,tt(s,["value",x]))):[];if(l.startsWith("window#/")){if(!e$(l))throw Error(`$expression: "${l}" is not a blessed pure global`);let m=l.slice(8),x=oJ.get(m);if(x)return x(...iJ(m,d,t));let h=Qb(),g=Jt(h,m),b=m.lastIndexOf("/"),j=b===-1?h:Jt(h,m.slice(0,b));return g.apply(j,d)}let p=Kl(l,t,n,r);if(At(p))return p.apply(lJ(l,t,n,r),d);if(D(p)&&"$expression"in p){let m=p,x={};for(let[h,g]of(m.parameters??[]).entries()){let b=k(g)?g:g?.name??"";if(!b)continue;x[b]=d[h]===void 0&&D(g)&&"default"in g?g.default:d[h]}return Sn(m.$expression,t,n,{args:x,callDepth:u})}throw TypeError(`$expression: call target "${l}" is not callable`)}if(kp.has(o)){if(o==="?:"){let m=Ye(i,t,n,r,tt(s,"target"));if(s){let x=Ye(a,t,n,r,tt(s,"value")),h=Ye(c,t,n,r,tt(s,"initial"));return m?x:h}return m?Ye(a,t,n,r):Ye(c,t,n,r)}let l=Ye(i,t,n,r,tt(s,"target")),u=String(l),d=e.cases??{},p=Object.hasOwn(d,u);if(s){let m;for(let[h,g]of Object.entries(d)){let b=Ye(g,t,n,r,tt(s,["cases",h]));if(h===u)m=b}let x=Ye(e.default,t,n,r,tt(s,"default"));return p?m:x}return p?Ye(d[u],t,n,r):Ye(e.default,t,n,r)}if(Pp.has(o)){let l=Ye(i,t,n,r,tt(s,"target")),u=Ye(a,t,n,r,tt(s,"value"));switch(o){case"===":return l===u;case"!==":return l!==u;case"&&":return l&&u;case"||":return l||u;case"??":return l??u;default:return Kb(o,l,u)}}if(Yb.has(o)){let l=Ye(a,t,n,r,tt(s,"value")),{obj:u,key:d}=uJ(i.$ref,t,n,r);u[d]=o==="="?l:Kb(o.slice(0,-1),u[d],l);return}if(Zb.has(o)){let l=Ye(i,t,n,r,tt(s,"target"));switch(o){case"push":return l.push(Ye(a,t,n,r,tt(s,"value")));case"unshift":return l.unshift(Ye(a,t,n,r,tt(s,"value")));case"pop":return l.pop();case"shift":return l.shift();case"splice":{let u=Ye(a,t,n,r,tt(s,"value"));return l.splice(...u)}default:break}}if(Op.has(o)){let l=Ye(i,t,n,r,tt(s,"target")),u=a===void 0?[]:Array.isArray(a)?t$(a,t,n,r,tt(s,"value")):[Ye(a,t,n,r,tt(s,"value"))],d=Jt(l,o);if(!At(d))return;return d.apply(l,u)}if(_p.has(o)){let l=Ye(i,t,n,r,tt(s,"target")),u=a;if(o==="reduce"){let d=Ye(c,t,n,r,tt(s,"initial"));for(let[p,m]of l.entries())d=Sn(u,t,n,{acc:d,index:p,item:m},p===0?tt(s,"value"):void 0);return d}if(o==="map")return l.map((d,p)=>Sn(u,t,n,{...r,index:p,item:d},p===0?tt(s,"value"):void 0));if(o==="filter")return l.filter((d,p)=>Sn(u,t,n,{...r,index:p,item:d},p===0?tt(s,"value"):void 0))}return}function st(e,t){if(e===null)return"null";if(e===void 0)return"undefined";if(Gl(e))return Yt(e,t);if(gi(e))return Cp(e.$ref,t);if(Array.isArray(e))return e.map((n)=>st(n,t)).join(", ");return JSON.stringify(e)}function dJ(e){return`_fx_${e.replaceAll(/[^A-Za-z0-9_$]/g,"_")}`}function Cp(e,t){let n=t.statePrefix??"state",r=t.eventParam??"event";if(e==="$reduce/acc")return"_acc";if(e.startsWith("$reduce/"))return"_acc";if(e.startsWith("$args/"))return Je("_args",e.slice(6));if(e.startsWith("event#/"))return Je(r,e.slice(7));if(e.startsWith("$map/")){let s=e.split("/"),[,o]=s;if(o==="item")return s.length>2?Je("_item",s.slice(2).join("/")):"_item";if(o==="index")return"_index";return`_${o}`}if(e.startsWith("#/state/"))return Je(n,e.slice(8));if(e.startsWith("parent#/"))return Je(n,e.slice(8));if(e.startsWith("window#/"))return Je("window",e.slice(8));if(e.startsWith("document#/"))return Je("document",e.slice(10));return Je(n,e)}function Gb(e,t){if(gi(e))return Cp(e.$ref,t);return st(e,t)}function pJ(e,t,n){let r=(i)=>t[i]??"undefined",s=`(${n.statePrefix??"state"}?.$page?.locale ?? ${JSON.stringify(dr)})`,o=JSON.stringify(bp);switch(e){case"Intl/formatNumber":return`new Intl.NumberFormat(${r(1)} ?? ${s}, ${r(2)}).format(${r(0)})`;case"Intl/formatDate":return`new Intl.DateTimeFormat(${r(1)} ?? ${s}, {timeZone: ${o}, ...${r(2)}}).format(new Date(${r(0)}))`;case"Intl/formatRelativeTime":return`new Intl.RelativeTimeFormat(${r(2)} ?? ${s}, ${r(3)}).format(${r(0)}, ${r(1)})`;case"Intl/formatList":return`new Intl.ListFormat(${r(1)} ?? ${s}, ${r(2)}).format(${r(0)})`;case"Intl/plural":return`new Intl.PluralRules(${r(1)} ?? ${s}, ${r(2)}).select(${r(0)})`;case"Intl/compare":return`new Intl.Collator(${r(2)} ?? ${s}, ${r(3)}).compare(${r(0)}, ${r(1)})`;case"Intl/displayName":return`new Intl.DisplayNames(${r(2)} ?? ${s}, {...${r(3)}, type: ${r(1)} ?? 'language'}).of(${r(0)})`;case"Intl/segment":return`[...new Intl.Segmenter(${r(2)} ?? ${s}, {granularity: ${r(1)} ?? 'grapheme'}).segment(${r(0)})].map((p) => p.segment)`;default:return null}}function Yt(e,t={}){let{operator:n,target:r,value:s,initial:o}=e;if(jp.has(n)&&!("value"in e)){let i=st(r,t);if(n==="!")return`!(${i})`;if(n==="-")return`-(${i})`}if(n==="call"){let i=(gi(r)?r.$ref:void 0)??"",a=Array.isArray(s)?s.map((c)=>st(c,t)):[];if(i.startsWith("window#/")){if(!e$(i))throw Error(`$expression: "${i}" is not a blessed pure global`);let c=pJ(i.slice(8),a,t);if(c)return c;return`window.${i.slice(8).replaceAll("/",".")}(${a.join(", ")})`}if(i.startsWith("#/state/")){let c=i.slice(8),l=t.formulaParams?.[c];if(l){let u=l.map((d,p)=>`${JSON.stringify(d)}: ${a[p]??"undefined"}`).join(", ");return`${dJ(c)}(${t.statePrefix??"state"}, { ${u} })`}}return`${Cp(i,t)}(${a.join(", ")})`}if(kp.has(n)){if(n==="?:"){let l=st(r,t),u=st(s,t),d=st(o,t);return`(${l} ? ${u} : ${d})`}let i=st(r,t),a=Object.entries(e.cases??{}).map(([l,u])=>`_d === ${JSON.stringify(l)} ? ${st(u,t)} : `).join(""),c="default"in e?st(e.default,t):"undefined";return`((_d) => ${a}${c})(String(${i}))`}if(Pp.has(n)){let i=st(r,t),a=st(s,t);return`(${i} ${n} ${a})`}if(Yb.has(n)){let i=Gb(r,t),a=st(s,t);return`${i} ${n} ${a}`}if(Zb.has(n)){let i=Gb(r,t);switch(n){case"push":return`${i}.push(${st(s,t)})`;case"unshift":return`${i}.unshift(${st(s,t)})`;case"pop":return`${i}.pop()`;case"shift":return`${i}.shift()`;case"splice":{let a=Array.isArray(s)?s.map((c)=>st(c,t)).join(", "):st(s,t);return`${i}.splice(${a})`}default:break}}if(Op.has(n)){let i=st(r,t),a=s===void 0?"":Array.isArray(s)?s.map((c)=>st(c,t)).join(", "):st(s,t);return`(${i})?.${n}?.(${a})`}if(_p.has(n)){let i=st(r,t),a=Yt(s,t);if(n==="reduce"){let c=st(o,t);return`${i}.reduce((_acc, _item, _index) => ${a}, ${c})`}if(n==="map")return`${i}.map((_item, _index) => ${a})`;if(n==="filter")return`${i}.filter((_item, _index) => ${a})`}return"undefined"}function yi(e,t,n,r){return Ye(e,t,n,r)}function Xr(e,t={}){return st(e,t)}var Xb,jp,Pp,Yb,Zb,_p,kp,Op,rJ,sJ,oJ,aJ,zb=64,cJ=64;var xi=T(()=>{wp();le();hi();Xb=new Set(["=","+=","-=","*=","/=","push","pop","shift","unshift","splice"]),jp=new Set(["!","-"]),Pp=new Set(["+","-","*","/","%","===","!==","<","<=",">",">=","&&","||","??"]),Yb=new Set(["=","+=","-=","*=","/="]),Zb=new Set(["push","pop","shift","unshift","splice"]),_p=new Set(["reduce","map","filter"]),kp=new Set(["?:","switch"]),Op=new Set(["includes","indexOf","lastIndexOf","join","slice","concat","at","flat","toSorted","toReversed","toSpliced","with","toUpperCase","toLowerCase","trim","trimStart","trimEnd","split","startsWith","endsWith","padStart","padEnd","replaceAll","repeat","charAt","normalize","toLocaleUpperCase","toLocaleLowerCase","toFixed","toPrecision","toLocaleString"]),rJ=new Set([...Xb,...jp,...Pp,..._p,...kp,...Op,"call"]),sJ=new Set(["isNaN","isFinite","parseFloat","parseInt","encodeURIComponent","decodeURIComponent","structuredClone","Math/abs","Math/ceil","Math/floor","Math/round","Math/trunc","Math/sign","Math/sqrt","Math/cbrt","Math/pow","Math/exp","Math/log","Math/log2","Math/log10","Math/min","Math/max","Math/hypot","Number/isInteger","Number/isFinite","Number/isNaN","Number/parseFloat","Number/parseInt","JSON/parse","JSON/stringify","Object/keys","Object/values","Object/entries","Object/fromEntries","Array/from","Array/isArray","Array/of","String/fromCharCode","String/fromCodePoint",...$p]),oJ=new Map([["Intl/compare",(e,t,n,r)=>new Intl.Collator(n??dr,r).compare(e,t)],["Intl/displayName",(e,t,n,r)=>new Intl.DisplayNames(n??dr,{...r,type:t??"language"}).of(e)],["Intl/formatDate",(e,t,n)=>new Intl.DateTimeFormat(t??dr,{timeZone:bp,...n}).format(new Date(e))],["Intl/formatList",(e,t,n)=>new Intl.ListFormat(t??dr,n).format(e)],["Intl/formatNumber",(e,t,n)=>new Intl.NumberFormat(t??dr,n).format(e)],["Intl/formatRelativeTime",(e,t,n,r)=>new Intl.RelativeTimeFormat(n??dr,r).format(e,t)],["Intl/plural",(e,t,n)=>new Intl.PluralRules(t??dr,n).select(e)],["Intl/segment",(e,t,n)=>[...new Intl.Segmenter(n??dr,{granularity:t??"grapheme"}).segment(e)].map((r)=>r.segment)]]);aJ=/^(?:\$args\/|\$reduce\/|\$map\/|window#\/|document#\/|event#\/)/});function n$(e){if("operator"in e)return{kind:"expression",node:e};if("if"in e)return{kind:"if",node:e};if("$switch"in e)return{kind:"switch",node:e};if("stopPropagation"in e)return{kind:"stopPropagation"};if("preventDefault"in e)return{kind:"preventDefault"};return{kind:"dispatch",node:e}}function mJ(e){return(D(e)||At(e))&&"then"in e&&At(e.then)}async function bi(e,t,n,r={}){let s=r.args?{args:r.args}:void 0;for(let o of e){let i=n$(o);switch(i.kind){case"expression":{let a=Sn(i.node,t,n,s);if(mJ(a))await a;break}case"if":{let a=i.node,c=yi(a.if,t,n,s)?a.then:a.else;if(Array.isArray(c))await bi(c,t,n,r);break}case"switch":{let a=i.node,c=String(yi(a.$switch,t,n,s)),l=a.cases??{},u=Object.hasOwn(l,c)?l[c]:a.default;if(Array.isArray(u))await bi(u,t,n,r);break}case"dispatch":{let a=i.node,c=At(r.target)?r.target():r.target,l=n?.currentTarget??c;if(!l)break;let u={};if("detail"in a)u.detail=yi(a.detail,t,n,s);if(a.bubbles!==void 0)u.bubbles=a.bubbles;if(a.composed!==void 0)u.composed=a.composed;l.dispatchEvent(new CustomEvent(a.dispatchEvent,u));break}case"stopPropagation":{n?.stopPropagation();break}case"preventDefault":{n?.preventDefault();break}default:break}}}function Jn(e,t={}){let n=t.indent??"",r=[];for(let s of e){let o=n$(s);switch(o.kind){case"expression":{r.push(`${n}${Yt(o.node,t)};`);break}case"if":{let i=o.node,a=Xr(i.if,t),c={...t,indent:`${n} `};if(r.push(`${n}if (${a}) {`,Jn(i.then??[],c)),i.else)r.push(`${n}} else {`,Jn(i.else,c));r.push(`${n}}`);break}case"switch":{let i=o.node,a=Xr(i.$switch,t),c={...t,indent:`${n} `};r.push(`${n}switch (String(${a})) {`);for(let[l,u]of Object.entries(i.cases??{}))r.push(`${n} case ${JSON.stringify(l)}: {`,Jn(u,c),`${n} break;`,`${n} }`);if(i.default)r.push(`${n} default: {`,Jn(i.default,c),`${n} }`);r.push(`${n}}`);break}case"dispatch":{let i=o.node,a=t.eventParam??"event",c=t.dispatchTarget??`(${a} && ${a}.currentTarget)`,l=[];if("detail"in i)l.push(`detail: ${Xr(i.detail,t)}`);if(i.bubbles!==void 0)l.push(`bubbles: ${JSON.stringify(i.bubbles)}`);if(i.composed!==void 0)l.push(`composed: ${JSON.stringify(i.composed)}`);let u=l.length>0?`, { ${l.join(", ")} }`:"";r.push(`${n}${c}?.dispatchEvent(new CustomEvent(${JSON.stringify(i.dispatchEvent)}${u}));`);break}case"stopPropagation":{r.push(`${n}${t.eventParam??"event"}?.stopPropagation();`);break}case"preventDefault":{r.push(`${n}${t.eventParam??"event"}?.preventDefault();`);break}default:break}}return r.join(`
127
- `)}var Xl=T(()=>{le();xi()});var Np=T(()=>{le()});function $i(e){if(e===hJ)return"client";if(e===gJ)return"server";return null}function yJ(e){return e.replaceAll("\\","/").replace(/^(?:\.\/)+/,"")}function s$(e,t){return`${Ip}${yJ(e)}#${t}`}function Yl(e){return e.startsWith(Ip)}function wi(e){if(!Yl(e))return null;let t=e.slice(Ip.length),n=t.lastIndexOf("#");if(n<=0)return null;let r=t.slice(n+1);if(r!=="client"&&r!=="server")return null;return{path:t.slice(0,n),side:r}}function Tp(e,t){if(Array.isArray(e)){let r=e.map((s)=>Tp(s,t));return r.some((s,o)=>s!==e[o])?r:e}if(!V(e))return e;let n=null;for(let[r,s]of Object.entries(e)){let o=s;if(r==="$src"&&k(s)){let i=$i(s);o=i===null?s:s$(t,i)}else if(r!=="$script")o=Tp(s,t);if(o!==s)n??={...e},n[r]=o}return n===null?e:n}function Za(e,t){return Tp(e,t)}function $J(e){return xJ.test(e)&&!bJ.test(e)}function r$(e){return $i(e)==="client"||wi(e)?.side==="client"}function Jp(e,t,n){if(Array.isArray(e)){for(let[r,s]of e.entries())Jp(s,[...t,r],n);return n}if(!V(e))return n;if(k(e.$src))n.push({lazy:e.$lazy===!0,path:t,src:e.$src});for(let[r,s]of Object.entries(e))if(r!=="$script")Jp(s,[...t,r],n);return n}function wJ(e){let t=e.at(-1);return k(t)?`"${t}"`:"this entry"}function o$(e){let t=Jp(e,[],[]),n=t.some((s)=>!s.lazy&&r$(s.src)),r=[];for(let s of t){let o=wJ(s.path);if(!s.lazy&&$J(s.src))r.push({detail:'A module only this document uses can be the document\'s own script: move the code into the client script (the server script for a `timing: "server"` entry) and name it with `$src: "#client"` or `$src: "#server"`. A module several documents import stays a file, and this one keeps working as it is.',message:`${o} imports ${s.src}, which the document could carry as its own script`,path:s.path,rule:"relative-src"});else if(s.lazy&&n&&r$(s.src))r.push({detail:"A document has one client script, and another entry imports it as the page loads, so `$lazy` defers nothing here. Move this export to a `$src` module of its own to load it on its first call.",message:`${o} is $lazy, but the script it is in loads with the page`,path:s.path,rule:"lazy-shares-script"})}return r}var Ip="jx-script:",hJ="#client",gJ="#server",xJ,bJ;var Si=T(()=>{le();xJ=/^\.{1,2}\//u,bJ=/\.json$/iu});function vi(e){if(!e.startsWith("${")||!e.endsWith("}"))return!1;let[t,...n]=qg(e);return t!==void 0&&n.length===0&&t.start===0&&t.end===e.length}function a$(){return[...i$].toSorted()}function _o(e,t){let n=e.toLowerCase();if(n.startsWith("aria-")||i$.has(n))return String(t);return t?"":null}var Yr,i$,q6,Mp=32,Zl,Ql="jx-slot",Qa="data-jx-slots",Dp="jx.slot.group",W6;var Ei=T(()=>{Ya();xi();hi();le();za();$n();Xl();Np();Si();Np();Ya();Yr=new Set(["$schema","$id","$defs","state","$ref","$props","$elements","$title","$description","$switch","$prototype","$src","$export","$script","$media","$map","timing","default","description","body","parameters","arguments","name","tagName","children","style","attributes","items","map","filter","sort","cases","observedAttributes"]),i$=new Set(["contenteditable","draggable","spellcheck"]);q6=Object.freeze({emptyRow:!0}),Zl=/^[\t\n\f\r ]+$/u,W6=(()=>{let e=Symbol.for(Dp),t=globalThis;return t[e]??=new WeakMap,t[e]})()});function c$(e,t,n,r,s=EJ){let o=[],i=(d,p)=>{let m={mediaQueries:t,scope:p,transposeValue:n};if(r)m.resolveValue=(x,h)=>r(x,h,p);for(let x of mi(d,m))o.push(x.text)},a={},c={},l=[],u=[];for(let[d,p]of Object.entries(e)){if(D(p)&&!Array.isArray(p)){if(d.startsWith("@"))l.push([d,p]);else if(!d.startsWith("--"))u.push([d,p]);continue}if(ys(d)||d.startsWith("@"))continue;if(d.startsWith("--")||d==="colorScheme"||d==="color-scheme")a[d]=p;else c[d]=p}i(a,s.root),i(c,s.body);for(let[d,p]of u)if(d.startsWith("&"))i({[d]:p},s.root);else i(p,d);for(let[d,p]of l){if(Ka(d)||Xa(d)){i({[d]:p},null);continue}let m={},x={},h=[];for(let[g,b]of Object.entries(p)){if(D(b)&&!Array.isArray(b)){if(!g.startsWith("@"))h.push([g,b]);continue}if(g.startsWith("--"))m[g]=b;else x[g]=b}i({[d]:m},s.root),i({[d]:x},s.body);for(let[g,b]of h)i({[d]:b},g)}if(Object.values(t).some((d)=>Zn(d)!==null)&&!("colorScheme"in e))o.push(`${s.root} { color-scheme: light dark }`,`${s.root}:where([${Yn}="light"]) { color-scheme: light }`,`${s.root}:where([${Yn}="dark"]) { color-scheme: dark }`);return o.join(`
128
- `)}var EJ;var l$=T(()=>{Ya();le();EJ={body:"body",root:":root"}});function u$(e){return e===!1||e==="open"||e==="closed"}function ko(e,t){let n=e?.$shadow;if(u$(n))return n===!1?null:n;let r=t?.shadow;return u$(r)&&r!==!1?r:null}function f$(e,t){return t===null?e:":host"}function nc(e,t){let n=[];for(let[r,s]of(e.parameters??[]).entries()){let o=d$(s);if(!o)continue;let i=p$(s)?`_a[${r}] === undefined ? ${JSON.stringify(s.default)} : _a[${r}]`:`_a[${r}]`;n.push(`${JSON.stringify(o)}: ${i}`)}return`(..._a) => { const _args = { ${n.join(", ")} }; return ${t}; }`}function d$(e){return k(e)?e:e?.name??""}function p$(e){return D(e)&&"default"in e}function jJ(e,t){let n=m$(e,t);return n===e?e:`${n} as ${e}`}function m$(e,t){let n=t?.$export;return k(n)&&n!==""?n:e}function nu(e,t,n={}){let{statePrefix:r="state",indent:s="",collect:o}=n,{url:i}=t,a=me(i),c=t.method??"GET";if(t.manual)return`${s}// ${e}: manual Request — fetch triggered by user action`;let l=[`// ${e}: auto-fetch from ${a?"(dynamic URL)":i}`,o?`${o}.push(effect(() => {`:"effect(() => {"];if(a)l.push(` const url = \`${_J(i,r)}\`;`,' if (!url || url === "undefined" || url.includes("undefined")) return;');else l.push(` const url = ${JSON.stringify(i)};`);let u=[];if(c!=="GET")u.push(`method: ${JSON.stringify(c)}`);if(t.headers)u.push(`headers: ${JSON.stringify(t.headers)}`);if(t.body){let p=D(t.body)?JSON.stringify(JSON.stringify(t.body)):JSON.stringify(t.body);u.push(`body: ${p}`)}let d=u.length>0?`, { ${u.join(", ")} }`:"";return l.push(` fetch(url${d})`," .then(r => r.ok ? r.json() : Promise.reject(r.statusText))",` .then(d => { ${r}.${e} = d; })`,` .catch(e => { ${r}.${e} = { error: String(e) }; });`,o?"}));":"});"),l.map((p)=>`${s}${p}`).join(`
129
- `)}function ru(e,t,n={}){let{statePrefix:r="state",indent:s="",collect:o,serverBaseUrl:i="/_jx/server"}=n,a=JSON.stringify(`${i}/${t.$export}`),c=Object.entries(t.arguments??{}),l=c.map(([h,g])=>{if(!Ne(g))return`${Gr(h)}: ${JSON.stringify(g)}`;if(PJ.some((b)=>g.$ref.startsWith(b)))throw Error(`Server function "${e}": argument "${h}" references "${g.$ref}", which a state entry cannot read. Use a #/state/, parent#/, window#/ or document#/ reference.`);return`${Gr(h)}: ${Xr({$ref:g.$ref},{statePrefix:r})}`}),u=c.some(([,h])=>Ne(h)),d=`${w$}(${a}, ${l.length>0?`{ ${l.join(", ")} }`:"{}"})`,p=Je(r,Xt(e)),m=`console.error(${JSON.stringify(`Jx server function ${t.$export}:`)}, e)`;return(u?[`// ${e}: server function ${t.$export}, called again when an argument changes`,"{"," let _jxSeq = 0;",o?` ${o}.push(effect(() => {`:" effect(() => {"," const _seq = ++_jxSeq;",` ${d}`,` .then((d) => { if (_seq === _jxSeq) ${p} = d; })`,` .catch((e) => { if (_seq === _jxSeq) ${m}; });`,o?" }));":" });","}"]:[`// ${e}: server function ${t.$export}, called once`,d,` .then((d) => { ${p} = d; })`,` .catch((e) => { ${m}; });`]).map((h)=>`${s}${h}`).join(`
130
- `)}function _J(e,t){if(t==="state")return e;return e.replaceAll(/\$\{([^}]*)\}/g,(n,r)=>`\${${r.replaceAll(/(?<!this\.)\bstate\./g,`${t}.`)}}`)}function su(e,t){let n=t.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`),r=String.raw`\bstate${ec}\??\.${ec}${n}(?![\w$])`,s="(?:\\\\\"|['`])",o=String.raw`\bstate${ec}(?:\?\.)?\[${ec}${"(?:\\\\\"|['`])"}${n}${"(?:\\\\\"|['`])"}`,i=String.raw`#/state/${n}(?=["/])`;return new RegExp(`${r}|${o}|${i}`).test(e)||kJ.test(e)}function ou(e,t){let n=Rp(t),r=e.state??{},s=Object.keys(n).filter((l)=>!(l in r));if(s.length===0)return e;let o=JSON.stringify(e),i=Object.values(r).some((l)=>D(l)&&!Array.isArray(l)&&k(l.$src)),a=new Set(s.filter((l)=>i||su(o,l)));for(let l of a)for(let u of Ap(n[l]))if(!(u in r))a.add(u);if(a.size===0)return e;let c=Object.fromEntries(s.filter((l)=>a.has(l)).map((l)=>[l,n[l]]));return{...e,state:{...c,...r}}}function OJ(e){let t=Object.fromEntries(Object.entries(e.state??{}).filter(([,n])=>!Po(n)));return JSON.stringify({...e,state:t})}function iu(e){if(!D(e))return!1;if(e.state){let t;for(let[n,r]of Object.entries(e.state)){if(n==="$site"||n==="$page")continue;if(!D(r)||Array.isArray(r))return!0;if(r.timing==="compiler")continue;if(Po(r)){if(t??=OJ(e),su(t,n))return!0;continue}if(r.$prototype)return!0;if("default"in r)return!0;if(rs(r))continue;return!0}}if(e.$switch)return!0;if(at(e)||ed(e.children))return!0;if(Array.isArray(e.children)&&e.children.some((t)=>iu(t)))return!0;for(let[t,n]of Object.entries(e)){if(Yr.has(t))continue;if(Ne(n))return!0;if(me(n))return!0}if(D(e.style)){for(let t of Object.values(e.style))if(me(t))return!0}if(D(e.attributes)){for(let t of Object.values(e.attributes))if(me(t))return!0}return!1}function g$(e){if(!D(e))return!1;if(e.$switch)return!0;if(at(e)||ed(e.children))return!0;for(let[t,n]of Object.entries(e)){if(Yr.has(t))continue;if(Ne(n))return!0;if(me(n))return!0}if(D(e.style)){for(let t of Object.values(e.style))if(me(t))return!0}if(D(e.attributes)){for(let t of Object.values(e.attributes))if(me(t))return!0}return!1}function _i(e,t=null,n={},r={}){let s=e?.state?ji(e.state,t):t??y$();return{media:r,scope:s,scopeDefs:n}}function y$(e=null){return Object.create(e)}function Wp(e){return e[h$]}function x$(e,t){return Wp(e)?.has(t)??!1}function TJ(e,t,n){if(t>0&&CJ.test(e.charAt(t-1)))return!1;let r=t+5;if(n)return!NJ.test(e.charAt(r));while(/\s/u.test(e.charAt(r)))r+=1;return e.charAt(r)==="."}function ki(e,t,n={}){if(!e.includes("state"))return e;let r=n.bare===!0,s=n.code===!1?e:to(e),o="",i=0;for(let a=s.indexOf("state");a!==-1;a=s.indexOf("state",a+1))if(TJ(s,a,r))o+=e.slice(i,a)+t,i=a+5;return o+e.slice(i)}function Vp(e,t){if(k(e)){if(!e.includes("state."))return;let o=to(e);for(let i of o.matchAll(AJ))t.add(i[1]);for(let i of o.matchAll(RJ))t.add(i[1]);return}if(Array.isArray(e)){for(let o of e)Vp(o,t);return}if(!D(e))return;let n=e,{operator:r,target:s}=n;if(k(r)&&mr(r)&&Ne(s)&&s.$ref.startsWith("#/state/"))t.add(s.$ref.slice(8).split("/")[0]);for(let o of Object.values(n))Vp(o,t)}function Ss(e,t){if(jt(t)&&hp(t))throw Error(`${e} declares both "body" and "$src"; they are mutually exclusive (spec.md §5.3 4d). Keep one.`)}function au(e,t){let n={eager:new Map,lazy:new Map};for(let[r,s]of Object.entries(e)){if(Ss(`state entry "${r}"`,s),!jt(s)||!s.$src)continue;if(s.$lazy===!0){if(t.get(r)==="computed")throw Error(`"${r}" declares "$lazy": true but is used as a computed value, not called. A lazily loaded function resolves to a promise; a computed must resolve now. Remove "$lazy", or call ${r}() from a handler instead of binding its value.`);let i=n.lazy.get(s.$src);if(!i)i=[],n.lazy.set(s.$src,i);i.push({binding:r,exportName:m$(r,s)});continue}let o=n.eager.get(s.$src);if(!o)o=new Set,n.eager.set(s.$src,o);o.add(jJ(r,s))}return n}function cu(e,t){let n=[];for(let[o,i]of e.eager)n.push(`import { ${[...i].join(", ")} } from '${t?t(o):o}';`);let r=[],s=0;for(let[o,i]of e.lazy){let a=`_jxLazy${s}`;s+=1,r.push(`let ${a};`,`const ${a}Load = () => (${a} ??= import('${t?t(o):o}'));`,...i.map(({binding:c,exportName:l})=>`const ${c} = (...args) => ${a}Load().then((m) => m.${l}(...args));`))}return{imports:n,loaders:r}}function ji(e={},t=null){let n=y$(t),r=t?Wp(t):void 0,s=new Set(r);Object.defineProperty(n,h$,{configurable:!0,enumerable:!1,value:s,writable:!0});let o=new Set;for(let u of Object.values(e))if(jt(u)||yn(u))Vp(u.body??u.$expression,o);for(let u of o)if(u in e)s.add(u);let i=jo({state:e});for(let[u,d]of Object.entries(e)){if(!D(d)||Array.isArray(d)){Zr(n,u,eu(d));continue}if("default"in d){Zr(n,u,eu(d.default));continue}if(Mr(d)){s.add(u);continue}if(!d.$prototype&&!("$expression"in d)&&!rs(d))Zr(n,u,eu(d))}let a=[],c=[];for(let[u,d]of Object.entries(e)){if(me(d)){a.push([u,d]);continue}if(!D(d))continue;if(yn(d)){let p=d.$expression;if(Ir(d)){let m=d.parameters;Zr(n,u,(...x)=>{let h={};for(let[g,b]of m.entries()){let j=d$(b);if(!j)continue;h[j]=x[g]===void 0&&p$(b)?b.default:x[g]}return Sn(p,n,null,{args:h})})}else if(mr(p.operator))Zr(n,u,(m,x)=>Sn(p,m,x));else Fp(n,u,()=>Sn(p,n,null));continue}if(jt(d)){if(Ss(`state entry "${u}"`,d),sr(d)){let{body:p}=d;Zr(n,u,(m,x)=>{bi(p,m??n,x??null)})}else if(k(d.body)){let{body:p}=d,m=Function(...fr(d),p);if(i.get(u)==="computed")Fp(n,u,()=>m(n)),c.push([u,p]);else Zr(n,u,m)}else Zr(n,u,()=>{}),s.add(u);continue}if(_n(d)&&(d.$prototype==="LocalStorage"||d.$prototype==="SessionStorage")){Zr(n,u,eu(d.default??null));continue}if(_n(d)&&d.$prototype==="Request")s.add(u)}let l=!0;while(l){l=!1;for(let[u,d]of[...c,...a])if(!s.has(u)&&b$(d,n))s.add(u),l=!0}for(let[u,d]of a)Fp(n,u,()=>Vt(d,n));return n}function Zr(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0})}function Fp(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:n})}function Be(e,t){if(Ne(e))return Hp(e.$ref,t);if(me(e))return Vt(e,t);return e}function cn(e){return Ne(e)}function Hp(e,t){if(!k(e))return e;if(e.startsWith("$map/")){let n=e.split("/"),r=n[1],o=t.$map?.[r]??t[`$map/${r}`];return n.length>2?Lp(o,n.slice(2).join("/")):o}if(e.startsWith("#/state/"))return Lp(t,e.slice(8));return Lp(t,e)??null}function b$(e,t){if(!t)return!1;let n=Wp(t);for(let r of e.matchAll(/\bstate\.([A-Za-z_$][\w$]*)\s*(\()?/g)){if(r[2])continue;let s=r[1];if(n?.has(s))return!0;let o;try{o=t[s]}catch{continue}if(At(o))return!0}return!1}function lu(e){return vi(e)?`(${e.slice(2,-1)})`:`\`${e}\``}function Vt(e,t){if(b$(e,t))return null;let n=["state","$map","$site","$page"],r=[t,t?.$map,t?.$site,t?.$page];try{let s=vi(e)?`return (${e.slice(2,-1)})`:`return \`${e}\``;return Function(...n,s)(...r)}catch{return null}}function Lp(e,t){return Jt(e,t)}function eu(e){if(!D(e))return e;return structuredClone(e)}function JJ(e,t){if(!e||!t)return"";return Object.entries(e).filter(([n,r])=>!n.startsWith(":")&&!n.startsWith(".")&&!n.startsWith("&")&&!n.startsWith("[")&&!n.startsWith("@")&&me(r)).map(([n,r])=>{let s=Be(r,t);return s==null?null:`${an(n)}: ${s}`}).filter(Boolean).join("; ")}function Oo(e,t,n=""){let r="",s=Be(e.id,t),o=Be(e.className,t),i=Be(e.hidden,t),a=Be(e.tabIndex,t),c=Be(e.title,t),l=Be(e.lang,t),u=Be(e.dir,t);if(s)r+=` id="${Ee(String(s))}"`;if(o)r+=` class="${Ee(String(o))}"`;if(i)r+=" hidden";if(a!==void 0&&a!==null)r+=` tabindex="${Ee(String(a))}"`;if(c)r+=` title="${Ee(String(c))}"`;if(l)r+=` lang="${Ee(String(l))}"`;if(u)r+=` dir="${Ee(String(u))}"`;let d=[JJ(e.style,t),n].filter(Boolean).join("; ");if(d)r+=` style="${Ee(d)}"`;if(e.attributes)for(let[p,m]of Object.entries(e.attributes)){let x=Be(m,t);if(Mt(x)){let h=_o(p,x);if(h!==null)r+=h===""?` ${p}`:` ${p}="${Ee(h)}"`;continue}if(k(x)||St(x))r+=` ${p}="${Ee(String(x))}"`}if(e.$static)r+=" data-jx-static";else if(e.$prerendered)r+=" data-jx-prerendered";return r}function rc(e,t=" "){return e?"":`
131
- ${t}`}function Oi(){let e=JSON.stringify(Bl),t=JSON.stringify(Yn);return`(function(){try{var s=localStorage.getItem(${e});if(s==="light"||s==="dark"){document.documentElement.setAttribute(${t},s)}}catch(e){}})()`}function tu(e,t,n,r){for(let s of mi(t,{mediaQueries:r,resolveValue:(o,i)=>$$(o,i,n),scope:n}))e.push(s.text)}function $$(e,t,n){let r=k(t)?t:t.$ref;return IJ.push({property:e,selector:n,source:r}),null}function uu(){return`const __jxEnumAttrs = new Set(${JSON.stringify(a$())});
132
- function ${Ai}(n, v) {
126
+ `);return e}function jS(e,t,n){let{code:r,problems:s}=BJ(e),[o,...i]=s.filter((a)=>a.kind==="unsupported");if(o)throw new eu(t,[o,...i]);for(let a of s)n.push({...t,problem:a});return r}function Fp(e,t,n){if(Array.isArray(e))return e.map((i,a)=>Fp(i,{...t,pointer:`${t.pointer}/${a}`},n));if(!L(e))return e;let r=_d(e),s=[],o={set:(i,a)=>{s.push([i,a])}};for(let[i,a]of Object.entries(e)){let c={...t,pointer:`${t.pointer}/${zJ(i)}`};if(r&&i==="body")o.set(i,ES(a,c,n));else if(r&&(i==="getter"||i==="setter")&&L(a)){let l={...a};if(a.body!==void 0)l.body=ES(a.body,{...c,pointer:`${c.pointer}/body`},n);o.set(i,l)}else o.set(i,Fp(a,c,n))}return Object.fromEntries(s)}function Va(e,t,n=[]){return Fp(e,{path:t,pointer:""},n)}function AS(e,t,n=[]){return Va(e,t,n)}var WJ,Ip,Ql=null,Mp=null,vS,eu;var Lp=R(()=>{le();WJ=/(^|[\n;{}])(\s*)(import|export)(?=[\s{*"'])/gu;Ip=new Map;vS=new Map;eu=class eu extends Error{problems;site;constructor(e,t){let[n]=t;super(`${e.path}${e.pointer}: ${n.message} (line ${n.line}, column ${n.column})`);this.name="EraseError",this.problems=t,this.site=e}}});import{createRequire as KJ}from"node:module";var tu=R(()=>{Lp();Lp();_S(()=>KJ(import.meta.url)("ts-blank-space").default)});function RS(e){for(let{path:t,pointer:n,problem:r}of e){let s=`${t}${n} (line ${r.line}, column ${r.column}): ${r.message}`;if(!CS.has(s))CS.add(s),console.warn(`Warning: ${s}`)}}function mr(e,t){let n=[],r=Va(e,t,n);return RS(n),r}function NS(e,t){let n=[],r=AS(e,t,n);return RS(n),r}var CS;var ui=R(()=>{tu();CS=new Set});function XJ(e){return e.split("\\").join("/").replace(/^\.\//,"").replace(/^\//,"").replace(/^pages\//,"")}function TS(e){let t=XJ(e),n=t.slice(t.lastIndexOf("/")+1),r=n.lastIndexOf(".");if(r>0)t=t.slice(0,t.length-(n.length-r));if(t.endsWith("/index"))t=t.slice(0,-6)||"/";else if(t==="index")t="/";if(!t.startsWith("/"))t=`/${t}`;let s=[],o=!1,i=!1,a=t.replaceAll(GJ,(c,l,u)=>{if(o=!0,l)return i=!0,s.push(l),"*";return s.push(u),`:${u}`});return{isCatchAll:i,isDynamic:o,params:s,urlPattern:a}}function JS(e,t){if(e.isDynamic!==t.isDynamic)return e.isDynamic?1:-1;if(e.isCatchAll!==t.isCatchAll)return e.isCatchAll?1:-1;return e.urlPattern.localeCompare(t.urlPattern)}var GJ;var IS=R(()=>{GJ=/\[\.\.\.(\w+)\]|\[(\w+)\]/g});function ZJ(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function DS(e){if(!L(e)||!("paginate"in e))return null;let{each:t,pageSize:n,paginate:r}=e,s=L(r)?r.$ref:void 0,o=k(s)?YJ.exec(s)?.[1]:void 0;if(o===void 0)throw TypeError('$paths.paginate must be { "$ref": "#/state/<key>" }');if(!We(n)||!Number.isInteger(n)||n<1)throw TypeError("$paths.pageSize must be a positive integer");let i={key:ZJ(o),pageSize:n};if(t!==void 0){if(!L(t)&&!Array.isArray(t))throw TypeError("$paths.each must be a $paths source");if(L(t)&&"paginate"in t)throw TypeError("$paths.each cannot itself be paged");i.each=t}return i}function Vp(e,t){return Math.max(1,Math.ceil(e/t))}function MS(e,t,n){let r=(t-1)*n;return e.slice(r,r+n)}function jo(e,t){if(e.endsWith("*")){if(t===1){let n=e.slice(0,-1).replace(/\/$/,"");return n===""?"/":n}return`${e.slice(0,-1)}${t}`}return e.replace(/:[^/]+/,String(t))}function FS(e,t,n,r){let s=Vp(r,n),o=[];for(let i=1;i<=s;i++)o.push({current:i===t,number:i,url:jo(e,i)});return{first:jo(e,1),itemCount:r,last:jo(e,s),next:t<s?jo(e,t+1):null,number:t,pageCount:s,pageSize:n,pages:o,prev:t>1?jo(e,t-1):null}}var YJ;var LS=R(()=>{le();YJ=/^#\/state\/([^/]+)$/});function Nn(e){if(!k(e)||e.trim()==="")return null;try{return new Intl.Locale(e.trim()).toString()}catch{return null}}function qa(e){let t=Nn(e);if(t===null)return"ltr";let n=new Intl.Locale(t),r=n.script??n.maximize().script;return r!==void 0&&QJ.has(r)?"rtl":"ltr"}function VS(e){let t=Nn(e);if(t===null)return k(e)?e:"";return new Intl.DisplayNames([t],{type:"language"}).of(t)??t}function qp(e){let t=e.i18n,n=[];if(!I(t))return{errors:n,i18n:null};let r=Array.isArray(t.locales)?t.locales:[],s=[];for(let a of r){let c=Nn(a);if(c===null){n.push(`i18n.locales: "${String(a)}" is not a well-formed BCP 47 language tag.`);continue}if(!s.includes(c))s.push(c)}let o=Nn(t.defaultLocale)??s[0]??null;if(t.defaultLocale!==void 0&&Nn(t.defaultLocale)===null)n.push(`i18n.defaultLocale: "${String(t.defaultLocale)}" is not a well-formed BCP 47 language tag.`);if(o===null)return n.push("i18n is declared with no usable locale — set `defaultLocale` or `locales`."),{errors:n,i18n:null};if(!s.includes(o))s.unshift(o);let i=t.routing==="prefix-always"||t.routing==="prefix-except-default"?t.routing:e1;return{errors:n,i18n:{defaultLocale:o,locales:s,routing:i}}}function Kn(e,t){if(t===null)return null;let n=e.split("/").find(Boolean);if(n===void 0)return t.defaultLocale;let r=Nn(n);return r!==null&&t.locales.includes(r)?r:t.defaultLocale}var QJ,nu="^[A-Za-z]{2,8}(-[A-Za-z0-9]{1,8})*$",e1="prefix-except-default";var Po=R(()=>{le();QJ=new Set(["Adlm","Arab","Aran","Armi","Avst","Cprt","Egyd","Egyh","Elym","Gara","Hatr","Hebr","Hluw","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogd","Sogo","Syrc","Thaa","Todr","Yezi"])});function n1(e){let t=new Set,n=new Set,r=(o)=>{if(o.startsWith("#/state/"))t.add(o.slice(8).split("/")[0])},s=(o)=>{if(k(o)){for(let i of o.matchAll(/\bstate\.([A-Za-z_$][\w$]*)\s*\(/gu))t.add(i[1]);return}if(Array.isArray(o)){if(!n.has(o)){n.add(o);for(let i of o)s(i)}return}if(!L(o)||n.has(o))return;if(n.add(o),o.operator==="call"&&Ce(o.target))r(o.target.$ref);for(let[i,a]of Object.entries(o)){if(i==="$defs")continue;if(i.startsWith("on")&&Ce(a))r(a.$ref);s(a)}};s(e);for(let o of t1)if(L(e.state)&&o in e.state)t.add(o);return t}function Wp(e){return"body"in e&&"$src"in e}function Wa(e){return Yc(e.parameters??e.arguments).length>0}function hr(e){let t=["state"];for(let n of Yc(e.parameters??e.arguments))if(n!=="state")t.push(n);return t}function r1(e,t,n){if(cr(t))return"callable";if(Yc(t.parameters??t.arguments).length>0)return"callable";if(k(t.body))return Fx(t.body)?"computed":"callable";if(t.$src)return n().has(e)?"callable":"computed";return"callable"}function _o(e){let t=new Map,n=null,r=()=>n??=n1(e);for(let[s,o]of Object.entries(e.state??{}))if(kt(o))t.set(s,r1(s,o,r));return t}var t1;var Ha=R(()=>{le();t1=new Set(["onMount","onUnmount","onAdopted"])});function on(e){return e.replaceAll(/[A-Z]/g,(t)=>`-${t.toLowerCase()}`)}function qS(e,t){if(e.startsWith("@--"))return t[e.slice(1)]??e.slice(1);if(e.startsWith("@(")){let n=e.slice(2,-1).trim();return s1.has(n.toLowerCase())?n:e.slice(1)}return null}function Ua(e){return e.startsWith("@position-try")||e.startsWith("@property")||e.startsWith("@font-face")||e.startsWith("@counter-style")}function za(e){return e.startsWith("@keyframes")}function WS(e,t){let n=[];for(let r of Ba(e))for(let s of Ba(t))n.push(o1(r,s));return n.join(", ")}function o1(e,t){let n=su(t,e);if(n!==null)return n;if(t.startsWith("[")||t.startsWith(":")||t.startsWith("."))return`${e}${t}`;return`${e} ${t}`}function Hp(e){let t=[],n=null,r=0;for(let s=0;s<e.length;s+=1){let o=e[s];if(n){if(o==="\\")s+=1;else if(o===n)n=null;continue}if(o==="\\")s+=1;else if(o==='"'||o==="'")n=o;else if(o==="[")r+=1;else if(o==="]")r=Math.max(0,r-1);else if(o==="&"&&r===0)t.push(s)}return t}function su(e,t){return Hp(e).length>0?i1(e,t):null}function i1(e,t){let n="",r=0;for(let s of Hp(e))n+=e.slice(r,s)+t,r=s+1;return n+e.slice(r)}function Ba(e){let t=[],n=0,r=null,s=0;for(let i=0;i<e.length;i+=1){let a=e[i];if(r){if(a==="\\")i+=1;else if(a===r)r=null;continue}if(a==='"'||a==="'")r=a;else if(a==="("||a==="[")n+=1;else if(a===")"||a==="]")n=Math.max(0,n-1);else if(a===","&&n===0)t.push(e.slice(s,i)),s=i+1}t.push(e.slice(s));let o=t.flatMap((i)=>{let a=i.trim();return a===""?[]:[a]});return o.length>0?o:[e]}function Xn(e){let t=/^\(\s*prefers-color-scheme\s*:\s*(light|dark)\s*\)$/.exec(e.trim())?.[1];return t==="light"||t==="dark"?t:null}function Up(e,t){if(e===":root"||e==="html")return{auto:`${e}:where(:not([${Gn}]))`,forced:`${e}:where([${Gn}="${t}"])`};return{auto:`:where(:root:not([${Gn}])) ${e}`,forced:`:where(:root[${Gn}="${t}"]) ${e}`}}function bs(e){return e.startsWith(":")||e.startsWith(".")||e.startsWith("&")||e.startsWith("[")}function Bp(e){return e.startsWith("--")?e:on(e)}function ru(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function HS(e,t,n){let r=n.map(([o,i])=>`${o}: ${i}`).join("; "),s=t===null?r:`${t} { ${r} }`;for(let o=e.length-1;o>=0;o-=1)s=`${e[o]} { ${s} }`;return s}function Ka(e){if(e.description===void 0)return e.text;return`/* ${e.description.replaceAll("*/","* /")} */
127
+ ${e.text}`}function a1(e,t,n){let r=n.map(({selector:o,declarations:i})=>`${o} { ${i.map(([a,c])=>`${a}: ${c}`).join("; ")} }`).join(" "),s=`@keyframes ${t} { ${r} }`;for(let o=e.length-1;o>=0;o-=1)s=`${e[o]} { ${s} }`;return s}function c1(e){let t=Object.keys(e).filter((r)=>za(r));if(t.length===0)return e;let n={...e};for(let r of t)delete n[r];return n}function l1(e){let n=Hp(e).at(-1),r=n===void 0?e:e.slice(n+1);return r===""||r.startsWith(":")||r.startsWith(".")||r.startsWith("[")}function fi(e,t={}){let{scope:n=null,mediaQueries:r={},transposeValue:s=(S)=>S,transposeSelector:o=(S)=>S,resolveValue:i}=t,a=[],c=(S)=>S!==null&&typeof S==="object"&&!Array.isArray(S)&&!Ce(S),l=(S,E)=>{if(c(E))return[E];if(!Ua(S)||!Array.isArray(E)||E.length===0)return[];return E.every((v)=>c(v))?E:[]},u=(S,E,v,j)=>{if(E===void 0||E===null)return null;if(Ce(E))return v?i?.(S,E,j)??null:null;if(I(E))return null;let P=String(E);if(me(P))return v?i?.(S,P,j)??null:null;return s(P)},d=(S,E,v=!0,j="self")=>{let P=[];for(let[O,T]of Object.entries(S)){if(l(O,T).length>0)continue;if(E&&(O.startsWith("@")||bs(O)))continue;if(O.startsWith("$"))continue;let U=u(O,T,v,j);if(U!==null)P.push([Bp(O),U])}return P},p=(S)=>k(S)&&S!==""?{description:S}:{},m=(S,E,v,j,P)=>{if(v.length===0)return;let O=E;if(O!==null){let F=o(O);if(F===null)return;O=F}let T=HS(S,O,v),U={text:T,conditions:[...S],selector:O,declarations:v,target:j,key:ru(T)};a.push({...U,...p(P)})},x=(S,E,v)=>{let j=S.slice(10).trim();if(j==="")return;let P=[];for(let[T,U]of Object.entries(E)){if(!c(U))continue;let F=d(U,!0,!1,"unscoped");if(F.length>0)P.push({declarations:F,selector:T.trim()})}if(P.length===0)return;let O=a1(v,j,P);a.push({blocks:P,conditions:[...v],declarations:[],key:ru(O),selector:null,target:"unscoped",text:O,...p(E.$description)})},g=(S,E,v,j,P)=>{if(S==="@--")return;if(Ua(S)){m([...j,S],null,d(E,!1,!0,"unscoped"),"unscoped",E.$description);return}if(za(S)){x(S,E,j);return}let O=qS(S,r),T=O===null?S:`@media ${O}`,U=O===null?null:Xn(O);if(U!==null&&v!==null){let{auto:F,forced:H}=Up(v,U);y(E,F,[...j,T],P),y(c1(E),H,j,P);return}y(E,v,[...j,T],P)};function y(S,E,v,j){m(v,E,d(S,!0,!0,j),j,S.$description);for(let[P,O]of Object.entries(S))for(let T of l(P,O))if(P.startsWith("@"))g(P,T,E,v,j);else if(E!==null)y(T,WS(E,P),v,l1(P)?j:"descendant")}return y(e,n,[],"self"),a}var s1,Gn="data-color-scheme",ou="jx-color-scheme";var Ga=R(()=>{le();s1=new Set(["all","print","screen","speech"])});function zS(){return`the Intl helpers ${Kp.join(", ")}`}var gr="en-US",zp="UTC",US,Kp,BS;var Gp=R(()=>{US=[{api:"Intl.NumberFormat",params:["value","locale","options"],path:"Intl/formatNumber",summary:"Format a number for a locale — grouping, decimals, currency, percent, units."},{api:"Intl.DateTimeFormat",params:["value","locale","options"],path:"Intl/formatDate",summary:"Format a date or timestamp for a locale. Pass `timeZone` in options."},{api:"Intl.RelativeTimeFormat",params:["value","unit","locale","options"],path:"Intl/formatRelativeTime",summary:'Format a relative time — `-3, "day"` becomes "3 days ago".'},{api:"Intl.ListFormat",params:["values","locale","options"],path:"Intl/formatList",summary:'Join a list the way a locale does — "a, b, and c", not a hand-written comma join.'},{api:"Intl.PluralRules",params:["value","locale","options"],path:"Intl/plural",summary:'Which plural category a number falls in ("one", "few", "other") — many languages have '+"more than two, so a ternary on `n === 1` is wrong outside English."},{api:"Intl.Collator",params:["a","b","locale","options"],path:"Intl/compare",summary:'Compare two strings for sorting. `<` and `sort()` order by UTF-16 code unit, which puts "Zebra" before "apple" and sorts every accented word into the wrong place.'},{api:"Intl.DisplayNames",params:["code","type","locale","options"],path:"Intl/displayName",summary:'The name of a language, region, script or currency in a locale — "de" as "German" or '+'"Deutsch", from CLDR rather than a hand-kept table.'},{api:"Intl.Segmenter",params:["value","granularity","locale"],path:"Intl/segment",summary:"Split text into graphemes, words or sentences (UAX #29). `[...str]` splits code points, so it cuts an emoji with a skin-tone modifier in half."}],Kp=US.map((e)=>e.path),BS=Object.fromEntries(US.map((e)=>[e.path,e.params.indexOf("locale")]))});function u1(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function qt(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function yr(e){if(e==="")return[];return e.split("/").map((t)=>u1(t))}function Dt(e,t){let n=e;for(let r of yr(t))n=n?.[r];return n}function Re(e,t){let n=e;for(let r of yr(t))n+=Xp.test(r)?`.${r}`:`[${JSON.stringify(r)}]`;return n}function KS(e,t){let n=e;for(let[r,s]of yr(t).entries()){let o=r===0?"":"?.";n+=Xp.test(s)?`${r===0?".":o}${s}`:`${o}[${JSON.stringify(s)}]`}return n}function Xr(e){return Xp.test(e)?e:JSON.stringify(e)}function GS(e){let t=e.replaceAll(/[^A-Za-z0-9_$]/g,"_");if(t==="")return"ref";return/^\d/.test(t)?`_${t}`:t}var Xp;var di=R(()=>{Xp=/^[A-Za-z_$][A-Za-z0-9_$]*$/});function Yp(e){let t=e.$map;return I(t)?t:void 0}function cu(e){return I(e)&&!Array.isArray(e)&&"operator"in e}function pi(e){return I(e)&&!Array.isArray(e)&&"$ref"in e}function m1(e,t,n){let r=BS[e];if(r===void 0||r<0||t[r]!=null)return t;let s=Dt(n.$page,"locale");if(!k(s)||s==="")return t;let o=[...t];return o[r]=s,o}function nw(){return globalThis.window??globalThis}function rw(e){return e.startsWith("window#/")&&d1.has(e.slice(8))}function xr(e){return QS.has(e)}function iu(e){if(Array.isArray(e))return e.some((t)=>iu(t));if(e===void 0||!cu(e))return!1;return xr(e.operator)||[e.target,e.value,e.initial,e.default].some((t)=>iu(t))||Object.values(e.cases??{}).some((t)=>iu(t))}function ko(e){return Dr(e)&&!iu(e.$expression)}function Zp(e,t){if(Array.isArray(e)){for(let n of e)Zp(n,t);return}if(e===void 0||!I(e))return;if(pi(e)){if(!h1.test(e.$ref)){let n=e.$ref.replace(/^(?:#\/state\/|parent#\/)/,"");t.add(yr(n)[0]??"")}return}if(cu(e)){let n=[e.target,e.value,e.initial,e.default];for(let r of[...n,...Object.values(e.cases??{})])Zp(r,t)}}function sm(e){let t=new Set;return Zp(e.$expression,t),[...t]}function om(e){let t=new Map;for(let[r,s]of Object.entries(e??{}))if(!r.startsWith("$")&&ko(s))t.set(r,s);let n=!1;while(!n){n=!0;for(let[r,s]of t)if(sm(s).some((o)=>!t.has(o)))t.delete(r),n=!1}return Object.fromEntries(t)}function Ze(e,t){if(!e)return;let n=(e.depth??0)+1;if(n>g1)return;return{depth:n,path:[...e.path??[],...Array.isArray(t)?t:[t]],report:e.report}}function Ke(e,t,n,r,s){if(e===null||e===void 0)return e;if(cu(e))return wn(e,t,n,r,s);if(pi(e)){let o=au(e.$ref,t,n,r);return s?.report(s.path??[],o),o}if(Array.isArray(e))return sw(e,t,n,r,s);return s?.report(s.path??[],e),e}function sw(e,t,n,r,s){return e.map((o,i)=>Ke(o,t,n,r,Ze(s,i)))}function y1(e,t,n,r){let s=(o)=>{if(!e.slice(o.length).includes("/"))return t;return au(e.slice(0,e.lastIndexOf("/")),t,n,r)};if(e.startsWith("#/state/"))return s("#/state/");if(e.startsWith("parent#/"))return s("parent#/");if(e.startsWith("$map/")||e.startsWith("$args/"))return e.split("/").length>2?au(e.slice(0,e.lastIndexOf("/")),t,n,r):void 0;return}function au(e,t,n,r){if(e==="$reduce/acc")return r?.acc;if(e.startsWith("$reduce/"))return r?.acc;if(e.startsWith("$args/")){let s=e.slice(6).split("/"),o=r?.args?.[s[0]];return s.length>1?Dt(o,s.slice(1).join("/")):o}if(e.startsWith("event#/")){let s=e.slice(7);return Dt(n,s)}if(e.startsWith("$map/")){let s=e.split("/"),[,o]=s,i,a=Yp(t);if(o==="item")i=r?.item??a?.item??t["$map/item"];else if(o==="index")i=r?.index??a?.index??t["$map/index"];else i=a?.[o]??t[`$map/${o}`];return s.length>2?Dt(i,s.slice(2).join("/")):i}if(e.startsWith("#/state/"))return Dt(t,e.slice(8));if(e.startsWith("parent#/"))return Dt(t,e.slice(8));if(e.startsWith("window#/"))return Dt(nw(),e.slice(8));if(e.startsWith("document#/"))return Dt(globalThis.document,e.slice(10));return Dt(t,e)??null}function x1(e,t,n,r){if(e.startsWith("$map/")){let s=e.split("/"),[,o]=s,i,a=Yp(t);if(o==="item")i=r?.item??a?.item??t["$map/item"];else if(o==="index")i=r?.index??a?.index??t["$map/index"];else i=a?.[o]??t[`$map/${o}`];if(s.length>2){let c=s.slice(2),l=c.pop(),u=c.length>0?Dt(i,c.join("/")):i;return{key:l,obj:u}}return{key:o==="item"?"$map/item":"$map/index",obj:Yp(t)??t}}if(e.startsWith("#/state/")){let s=e.slice(8);if(s.indexOf("/")===-1)return{key:s,obj:t};let i=yr(s),a=i.pop(),c=t;for(let l of i)c=c[l];return{key:a,obj:c}}return{key:e,obj:t}}function wn(e,t,n,r,s){let o=b1(e,t,n,r,s);return s?.report(s.path??[],o),o}function YS(e,t,n){switch(e){case"+":return t+n;case"-":return t-n;case"*":return t*n;case"/":return t/n;case"%":return t%n;case"<":return t<n;case"<=":return t<=n;case">":return t>n;default:return t>=n}}function b1(e,t,n,r,s){let{operator:o,target:i,value:a,initial:c}=e;if(!f1.has(o))throw Error(`$expression: unknown operator "${o}"`);if(Qp.has(o)&&!("value"in e)){let l=Ke(i,t,n,r,Ze(s,"target"));if(o==="!")return!l;if(o==="-")return-l}if(o==="call"){let l=pi(i)?i.$ref:void 0;if(!k(l))throw TypeError("$expression: call target must be a $ref pointer");let u=(r?.callDepth??0)+1;if(u>XS)throw Error(`$expression: call depth exceeded (${XS})`);let d=Array.isArray(a)?a.map((m,x)=>Ke(m,t,n,r,Ze(s,["value",x]))):[];if(l.startsWith("window#/")){if(!rw(l))throw Error(`$expression: "${l}" is not a blessed pure global`);let m=l.slice(8),x=p1.get(m);if(x)return x(...m1(m,d,t));let g=nw(),y=Dt(g,m),S=m.lastIndexOf("/"),E=S===-1?g:Dt(g,m.slice(0,S));return y.apply(E,d)}let p=au(l,t,n,r);if(_t(p))return p.apply(y1(l,t,n,r),d);if(I(p)&&"$expression"in p){let m=p,x={};for(let[g,y]of(m.parameters??[]).entries()){let S=k(y)?y:y?.name??"";if(!S)continue;x[S]=d[g]===void 0&&I(y)&&"default"in y?y.default:d[g]}return wn(m.$expression,t,n,{args:x,callDepth:u})}throw TypeError(`$expression: call target "${l}" is not callable`)}if(nm.has(o)){if(o==="?:"){let m=Ke(i,t,n,r,Ze(s,"target"));if(s){let x=Ke(a,t,n,r,Ze(s,"value")),g=Ke(c,t,n,r,Ze(s,"initial"));return m?x:g}return m?Ke(a,t,n,r):Ke(c,t,n,r)}let l=Ke(i,t,n,r,Ze(s,"target")),u=String(l),d=e.cases??{},p=Object.hasOwn(d,u);if(s){let m;for(let[g,y]of Object.entries(d)){let S=Ke(y,t,n,r,Ze(s,["cases",g]));if(g===u)m=S}let x=Ke(e.default,t,n,r,Ze(s,"default"));return p?m:x}return p?Ke(d[u],t,n,r):Ke(e.default,t,n,r)}if(em.has(o)){let l=Ke(i,t,n,r,Ze(s,"target")),u=Ke(a,t,n,r,Ze(s,"value"));switch(o){case"===":return l===u;case"!==":return l!==u;case"&&":return l&&u;case"||":return l||u;case"??":return l??u;default:return YS(o,l,u)}}if(ew.has(o)){let l=Ke(a,t,n,r,Ze(s,"value")),{obj:u,key:d}=x1(i.$ref,t,n,r);u[d]=o==="="?l:YS(o.slice(0,-1),u[d],l);return}if(tw.has(o)){let l=Ke(i,t,n,r,Ze(s,"target"));switch(o){case"push":return l.push(Ke(a,t,n,r,Ze(s,"value")));case"unshift":return l.unshift(Ke(a,t,n,r,Ze(s,"value")));case"pop":return l.pop();case"shift":return l.shift();case"splice":{let u=Ke(a,t,n,r,Ze(s,"value"));return l.splice(...u)}default:break}}if(rm.has(o)){let l=Ke(i,t,n,r,Ze(s,"target")),u=a===void 0?[]:Array.isArray(a)?sw(a,t,n,r,Ze(s,"value")):[Ke(a,t,n,r,Ze(s,"value"))],d=Dt(l,o);if(!_t(d))return;return d.apply(l,u)}if(tm.has(o)){let l=Ke(i,t,n,r,Ze(s,"target")),u=a;if(o==="reduce"){let d=Ke(c,t,n,r,Ze(s,"initial"));for(let[p,m]of l.entries())d=wn(u,t,n,{acc:d,index:p,item:m},p===0?Ze(s,"value"):void 0);return d}if(o==="map")return l.map((d,p)=>wn(u,t,n,{...r,index:p,item:d},p===0?Ze(s,"value"):void 0));if(o==="filter")return l.filter((d,p)=>wn(u,t,n,{...r,index:p,item:d},p===0?Ze(s,"value"):void 0))}return}function st(e,t){if(e===null)return"null";if(e===void 0)return"undefined";if(cu(e))return Xt(e,t);if(pi(e))return im(e.$ref,t);if(Array.isArray(e))return e.map((n)=>st(n,t)).join(", ");return JSON.stringify(e)}function $1(e){return`_fx_${e.replaceAll(/[^A-Za-z0-9_$]/g,"_")}`}function im(e,t){let n=t.statePrefix??"state",r=t.eventParam??"event";if(e==="$reduce/acc")return"_acc";if(e.startsWith("$reduce/"))return"_acc";if(e.startsWith("$args/"))return Re("_args",e.slice(6));if(e.startsWith("event#/"))return Re(r,e.slice(7));if(e.startsWith("$map/")){let s=e.split("/"),[,o]=s;if(o==="item")return s.length>2?Re("_item",s.slice(2).join("/")):"_item";if(o==="index")return"_index";return`_${o}`}if(e.startsWith("#/state/"))return Re(n,e.slice(8));if(e.startsWith("parent#/"))return Re(n,e.slice(8));if(e.startsWith("window#/"))return Re("window",e.slice(8));if(e.startsWith("document#/"))return Re("document",e.slice(10));return Re(n,e)}function ZS(e,t){if(pi(e))return im(e.$ref,t);return st(e,t)}function S1(e,t,n){let r=(i)=>t[i]??"undefined",s=`(${n.statePrefix??"state"}?.$page?.locale ?? ${JSON.stringify(gr)})`,o=JSON.stringify(zp);switch(e){case"Intl/formatNumber":return`new Intl.NumberFormat(${r(1)} ?? ${s}, ${r(2)}).format(${r(0)})`;case"Intl/formatDate":return`new Intl.DateTimeFormat(${r(1)} ?? ${s}, {timeZone: ${o}, ...${r(2)}}).format(new Date(${r(0)}))`;case"Intl/formatRelativeTime":return`new Intl.RelativeTimeFormat(${r(2)} ?? ${s}, ${r(3)}).format(${r(0)}, ${r(1)})`;case"Intl/formatList":return`new Intl.ListFormat(${r(1)} ?? ${s}, ${r(2)}).format(${r(0)})`;case"Intl/plural":return`new Intl.PluralRules(${r(1)} ?? ${s}, ${r(2)}).select(${r(0)})`;case"Intl/compare":return`new Intl.Collator(${r(2)} ?? ${s}, ${r(3)}).compare(${r(0)}, ${r(1)})`;case"Intl/displayName":return`new Intl.DisplayNames(${r(2)} ?? ${s}, {...${r(3)}, type: ${r(1)} ?? 'language'}).of(${r(0)})`;case"Intl/segment":return`[...new Intl.Segmenter(${r(2)} ?? ${s}, {granularity: ${r(1)} ?? 'grapheme'}).segment(${r(0)})].map((p) => p.segment)`;default:return null}}function Xt(e,t={}){let{operator:n,target:r,value:s,initial:o}=e;if(Qp.has(n)&&!("value"in e)){let i=st(r,t);if(n==="!")return`!(${i})`;if(n==="-")return`-(${i})`}if(n==="call"){let i=(pi(r)?r.$ref:void 0)??"",a=Array.isArray(s)?s.map((c)=>st(c,t)):[];if(i.startsWith("window#/")){if(!rw(i))throw Error(`$expression: "${i}" is not a blessed pure global`);let c=S1(i.slice(8),a,t);if(c)return c;return`window.${i.slice(8).replaceAll("/",".")}(${a.join(", ")})`}if(i.startsWith("#/state/")){let c=i.slice(8),l=t.formulaParams?.[c];if(l){let u=l.map((d,p)=>`${JSON.stringify(d)}: ${a[p]??"undefined"}`).join(", ");return`${$1(c)}(${t.statePrefix??"state"}, { ${u} })`}}return`${im(i,t)}(${a.join(", ")})`}if(nm.has(n)){if(n==="?:"){let l=st(r,t),u=st(s,t),d=st(o,t);return`(${l} ? ${u} : ${d})`}let i=st(r,t),a=Object.entries(e.cases??{}).map(([l,u])=>`_d === ${JSON.stringify(l)} ? ${st(u,t)} : `).join(""),c="default"in e?st(e.default,t):"undefined";return`((_d) => ${a}${c})(String(${i}))`}if(em.has(n)){let i=st(r,t),a=st(s,t);return`(${i} ${n} ${a})`}if(ew.has(n)){let i=ZS(r,t),a=st(s,t);return`${i} ${n} ${a}`}if(tw.has(n)){let i=ZS(r,t);switch(n){case"push":return`${i}.push(${st(s,t)})`;case"unshift":return`${i}.unshift(${st(s,t)})`;case"pop":return`${i}.pop()`;case"shift":return`${i}.shift()`;case"splice":{let a=Array.isArray(s)?s.map((c)=>st(c,t)).join(", "):st(s,t);return`${i}.splice(${a})`}default:break}}if(rm.has(n)){let i=st(r,t),a=s===void 0?"":Array.isArray(s)?s.map((c)=>st(c,t)).join(", "):st(s,t);return`(${i})?.${n}?.(${a})`}if(tm.has(n)){let i=st(r,t),a=Xt(s,t);if(n==="reduce"){let c=st(o,t);return`${i}.reduce((_acc, _item, _index) => ${a}, ${c})`}if(n==="map")return`${i}.map((_item, _index) => ${a})`;if(n==="filter")return`${i}.filter((_item, _index) => ${a})`}return"undefined"}function mi(e,t,n,r){return Ke(e,t,n,r)}function Yr(e,t={}){return st(e,t)}var QS,Qp,em,ew,tw,tm,nm,rm,f1,d1,p1,h1,XS=64,g1=64;var hi=R(()=>{Gp();le();di();QS=new Set(["=","+=","-=","*=","/=","push","pop","shift","unshift","splice"]),Qp=new Set(["!","-"]),em=new Set(["+","-","*","/","%","===","!==","<","<=",">",">=","&&","||","??"]),ew=new Set(["=","+=","-=","*=","/="]),tw=new Set(["push","pop","shift","unshift","splice"]),tm=new Set(["reduce","map","filter"]),nm=new Set(["?:","switch"]),rm=new Set(["includes","indexOf","lastIndexOf","join","slice","concat","at","flat","toSorted","toReversed","toSpliced","with","toUpperCase","toLowerCase","trim","trimStart","trimEnd","split","startsWith","endsWith","padStart","padEnd","replaceAll","repeat","charAt","normalize","toLocaleUpperCase","toLocaleLowerCase","toFixed","toPrecision","toLocaleString"]),f1=new Set([...QS,...Qp,...em,...tm,...nm,...rm,"call"]),d1=new Set(["isNaN","isFinite","parseFloat","parseInt","encodeURIComponent","decodeURIComponent","structuredClone","Math/abs","Math/ceil","Math/floor","Math/round","Math/trunc","Math/sign","Math/sqrt","Math/cbrt","Math/pow","Math/exp","Math/log","Math/log2","Math/log10","Math/min","Math/max","Math/hypot","Number/isInteger","Number/isFinite","Number/isNaN","Number/parseFloat","Number/parseInt","JSON/parse","JSON/stringify","Object/keys","Object/values","Object/entries","Object/fromEntries","Array/from","Array/isArray","Array/of","String/fromCharCode","String/fromCodePoint",...Kp]),p1=new Map([["Intl/compare",(e,t,n,r)=>new Intl.Collator(n??gr,r).compare(e,t)],["Intl/displayName",(e,t,n,r)=>new Intl.DisplayNames(n??gr,{...r,type:t??"language"}).of(e)],["Intl/formatDate",(e,t,n)=>new Intl.DateTimeFormat(t??gr,{timeZone:zp,...n}).format(new Date(e))],["Intl/formatList",(e,t,n)=>new Intl.ListFormat(t??gr,n).format(e)],["Intl/formatNumber",(e,t,n)=>new Intl.NumberFormat(t??gr,n).format(e)],["Intl/formatRelativeTime",(e,t,n,r)=>new Intl.RelativeTimeFormat(n??gr,r).format(e,t)],["Intl/plural",(e,t,n)=>new Intl.PluralRules(t??gr,n).select(e)],["Intl/segment",(e,t,n)=>[...new Intl.Segmenter(n??gr,{granularity:t??"grapheme"}).segment(e)].map((r)=>r.segment)]]);h1=/^(?:\$args\/|\$reduce\/|\$map\/|window#\/|document#\/|event#\/)/});function ow(e){if("operator"in e)return{kind:"expression",node:e};if("if"in e)return{kind:"if",node:e};if("$switch"in e)return{kind:"switch",node:e};if("stopPropagation"in e)return{kind:"stopPropagation"};if("preventDefault"in e)return{kind:"preventDefault"};return{kind:"dispatch",node:e}}function w1(e){return(I(e)||_t(e))&&"then"in e&&_t(e.then)}async function gi(e,t,n,r={}){let s=r.args?{args:r.args}:void 0;for(let o of e){let i=ow(o);switch(i.kind){case"expression":{let a=wn(i.node,t,n,s);if(w1(a))await a;break}case"if":{let a=i.node,c=mi(a.if,t,n,s)?a.then:a.else;if(Array.isArray(c))await gi(c,t,n,r);break}case"switch":{let a=i.node,c=String(mi(a.$switch,t,n,s)),l=a.cases??{},u=Object.hasOwn(l,c)?l[c]:a.default;if(Array.isArray(u))await gi(u,t,n,r);break}case"dispatch":{let a=i.node,c=_t(r.target)?r.target():r.target,l=n?.currentTarget??c;if(!l)break;let u={};if("detail"in a)u.detail=mi(a.detail,t,n,s);if(a.bubbles!==void 0)u.bubbles=a.bubbles;if(a.composed!==void 0)u.composed=a.composed;l.dispatchEvent(new CustomEvent(a.dispatchEvent,u));break}case"stopPropagation":{n?.stopPropagation();break}case"preventDefault":{n?.preventDefault();break}default:break}}}function Tn(e,t={}){let n=t.indent??"",r=[];for(let s of e){let o=ow(s);switch(o.kind){case"expression":{r.push(`${n}${Xt(o.node,t)};`);break}case"if":{let i=o.node,a=Yr(i.if,t),c={...t,indent:`${n} `};if(r.push(`${n}if (${a}) {`,Tn(i.then??[],c)),i.else)r.push(`${n}} else {`,Tn(i.else,c));r.push(`${n}}`);break}case"switch":{let i=o.node,a=Yr(i.$switch,t),c={...t,indent:`${n} `};r.push(`${n}switch (String(${a})) {`);for(let[l,u]of Object.entries(i.cases??{}))r.push(`${n} case ${JSON.stringify(l)}: {`,Tn(u,c),`${n} break;`,`${n} }`);if(i.default)r.push(`${n} default: {`,Tn(i.default,c),`${n} }`);r.push(`${n}}`);break}case"dispatch":{let i=o.node,a=t.eventParam??"event",c=t.dispatchTarget??`(${a} && ${a}.currentTarget)`,l=[];if("detail"in i)l.push(`detail: ${Yr(i.detail,t)}`);if(i.bubbles!==void 0)l.push(`bubbles: ${JSON.stringify(i.bubbles)}`);if(i.composed!==void 0)l.push(`composed: ${JSON.stringify(i.composed)}`);let u=l.length>0?`, { ${l.join(", ")} }`:"";r.push(`${n}${c}?.dispatchEvent(new CustomEvent(${JSON.stringify(i.dispatchEvent)}${u}));`);break}case"stopPropagation":{r.push(`${n}${t.eventParam??"event"}?.stopPropagation();`);break}case"preventDefault":{r.push(`${n}${t.eventParam??"event"}?.preventDefault();`);break}default:break}}return r.join(`
128
+ `)}var lu=R(()=>{le();hi()});var am=R(()=>{le()});function yi(e){if(e===v1)return"client";if(e===E1)return"server";return null}function j1(e){return e.replaceAll("\\","/").replace(/^(?:\.\/)+/,"")}function aw(e,t){return`${um}${j1(e)}#${t}`}function uu(e){return e.startsWith(um)}function xi(e){if(!uu(e))return null;let t=e.slice(um.length),n=t.lastIndexOf("#");if(n<=0)return null;let r=t.slice(n+1);if(r!=="client"&&r!=="server")return null;return{path:t.slice(0,n),side:r}}function cm(e,t){if(Array.isArray(e)){let r=e.map((s)=>cm(s,t));return r.some((s,o)=>s!==e[o])?r:e}if(!L(e))return e;let n=null;for(let[r,s]of Object.entries(e)){let o=s;if(r==="$src"&&k(s)){let i=yi(s);o=i===null?s:aw(t,i)}else if(r!=="$script")o=cm(s,t);if(o!==s)n??={...e},n[r]=o}return n===null?e:n}function Xa(e,t){return cm(e,t)}function k1(e){return P1.test(e)&&!_1.test(e)}function iw(e){return yi(e)==="client"||xi(e)?.side==="client"}function lm(e,t,n){if(Array.isArray(e)){for(let[r,s]of e.entries())lm(s,[...t,r],n);return n}if(!L(e))return n;if(k(e.$src))n.push({lazy:e.$lazy===!0,path:t,src:e.$src});for(let[r,s]of Object.entries(e))if(r!=="$script")lm(s,[...t,r],n);return n}function O1(e){let t=e.at(-1);return k(t)?`"${t}"`:"this entry"}function cw(e){let t=lm(e,[],[]),n=t.some((s)=>!s.lazy&&iw(s.src)),r=[];for(let s of t){let o=O1(s.path);if(!s.lazy&&k1(s.src))r.push({detail:'A module only this document uses can be the document\'s own script: move the code into the client script (the server script for a `timing: "server"` entry) and name it with `$src: "#client"` or `$src: "#server"`. A module several documents import stays a file, and this one keeps working as it is.',message:`${o} imports ${s.src}, which the document could carry as its own script`,path:s.path,rule:"relative-src"});else if(s.lazy&&n&&iw(s.src))r.push({detail:"A document has one client script, and another entry imports it as the page loads, so `$lazy` defers nothing here. Move this export to a `$src` module of its own to load it on its first call.",message:`${o} is $lazy, but the script it is in loads with the page`,path:s.path,rule:"lazy-shares-script"})}return r}var um="jx-script:",v1="#client",E1="#server",P1,_1;var bi=R(()=>{le();P1=/^\.{1,2}\//u,_1=/\.json$/iu});function N1(e){for(let t of Object.keys(e))if(R1.has(t))return!0;return!1}function $i(e){if(!e.startsWith("${")||!e.endsWith("}"))return!1;let[t,...n]=Vx(e);return t!==void 0&&n.length===0&&t.start===0&&t.end===e.length}function uw(){return[...lw].toSorted()}function Ss(e,t){let n=e.toLowerCase();if(n.startsWith("aria-")||lw.has(n))return String(t);return t?"":null}function fw(e,t,n,r){let s=t.replaceAll(/-([a-z])/g,(i,a)=>a.toUpperCase());if(r?.has(s)&&r.get(s)===void 0)return;let o=e[s];if(bt(o)){e[s]=n!==null&&n!=="false";return}if(n===null){let i=r?.get(s);e[s]=i===void 0?We(o)?0:"":i;return}e[s]=We(o)?Number(n):n}function fm(e){let t=new Map;for(let[n,r]of Object.entries(e.state??{})){if(k(r)&&me(r)){t.set(n,void 0);continue}if(I(r)&&!Array.isArray(r)){if("default"in r){t.set(n,r.default);continue}if(T1.some((s)=>(s in r))){t.set(n,void 0);continue}if(N1(r))continue}t.set(n,r)}return t}var R1,$s,lw,mG,T1,dm=32,fu,du="jx-slot",Ya="data-jx-slots",pm="jx.slot.group",hG;var Si=R(()=>{Ga();hi();di();le();Ha();$n();lu();am();bi();am();Ga();R1=new Set(["type","properties","items","enum","minimum","maximum","minLength","maxLength","pattern","required","examples"]);$s=new Set(["$schema","$id","$defs","state","$ref","$props","$elements","$title","$description","$switch","$prototype","$src","$export","$script","$media","$map","timing","default","description","body","parameters","arguments","name","tagName","children","style","attributes","items","map","filter","sort","cases","observedAttributes"]),lw=new Set(["contenteditable","draggable","spellcheck"]);mG=Object.freeze({emptyRow:!0});T1=["$expression","$prototype","$ref","$src"],fu=/^[\t\n\f\r ]+$/u,hG=(()=>{let e=Symbol.for(pm),t=globalThis;return t[e]??=new WeakMap,t[e]})()});var mm,hm;var gm=R(()=>{mm={anyOf:[{additionalProperties:!1,description:"Two-way: `target` is the test, `value` the tag when it is truthy, `initial` the tag when it is not.",properties:{initial:{$ref:"#/$defs/TagName"},operator:{const:"?:",type:"string"},target:{$ref:"#/$defs/ExpressionOperand"},value:{$ref:"#/$defs/TagName"}},required:["operator","target","value","initial"],title:"?: — the tag when the test holds, and the tag when it does not"},{additionalProperties:!1,description:"Multiway: `target` is the discriminant, matched against case keys by its string form. "+"`default` is required — an element with no tag cannot exist.",properties:{cases:{additionalProperties:{$ref:"#/$defs/TagName"},type:"object"},default:{$ref:"#/$defs/TagName"},operator:{const:"switch",type:"string"},target:{$ref:"#/$defs/ExpressionOperand"}},required:["operator","target","cases","default"],title:"switch — one tag per discriminant value, with a required fallback"}],description:"A tag name chosen at element creation. Every branch resolves to a `TagName`, so the candidate set is enumerable without evaluating anything."},hm={anyOf:[{$ref:"#/$defs/TagName"},{additionalProperties:!1,properties:{$expression:{$ref:"#/$defs/TagExpression"}},required:["$expression"],type:"object"}]}});var ym;var xm=R(()=>{ym={description:"HTML element tag name or custom element name (must contain a hyphen per Web Components spec). "+"A NAME, never an expression: no `${…}` position in the pipeline evaluates a tagName. Use "+"`$switch`/`cases` to vary the element.",minLength:1,pattern:"^[a-zA-Z][a-zA-Z0-9._-]*$",type:"string"}});var bm,$m,Sm;var wm=R(()=>{bm={oneOf:[{type:"string"},{$ref:"#/$defs/RefObject"}]},$m={oneOf:[{type:"boolean"},{$ref:"#/$defs/RefObject"}]},Sm={oneOf:[{type:"number"},{$ref:"#/$defs/RefObject"}]}});var vm;var Em=R(()=>{vm={additionalProperties:!0,description:"A page-level <head> entry. Defines meta tags, link tags, script tags, etc.",properties:{attributes:{additionalProperties:{oneOf:[{type:"string"},{type:"boolean"}]},type:"object"},children:{items:{$ref:"#/$defs/HeadEntry"},type:"array"},tagName:{type:"string"},textContent:{description:"Element content. An object is serialized to JSON inside the tag — that is how a "+'JSON-LD block (`<script type="application/ld+json">`) is authored.',oneOf:[{type:"string"},{type:"object"}]}},required:["tagName"],type:"object"}});var jm,Pm;var _m=R(()=>{jm={description:"A CEM-compatible parameter definition for a function. Follows the Custom Elements Manifest Parameter shape.",properties:{default:{description:"Default value for the parameter."},description:{description:"Parameter documentation.",type:"string"},name:{description:"Parameter name.",type:"string"},optional:{description:"Whether the parameter is optional.",type:"boolean"},type:{description:"Parameter type (JSON Schema or CEM { text } format)."}},required:["name"],type:"object"},Pm={description:"A CEM-compatible event definition. Describes a CustomEvent the function dispatches.",properties:{deprecated:{description:"Deprecation notice.",oneOf:[{type:"boolean"},{type:"string"}]},description:{description:"Event documentation.",type:"string"},name:{description:"Event name (e.g. 'task-toggled').",type:"string"},type:{description:"Event type (e.g. { text: 'CustomEvent' })."}},required:["name"],type:"object"}});var Za;var km=R(()=>{Za={description:"Image optimization configuration for the project.",properties:{formats:{description:'Output formats, each one of "avif", "jpeg", "png" or "webp" (default ["avif", "jpeg"]). AVIF and JPEG are lossy; PNG and WebP are written losslessly, so listing WebP produces larger files than either. A source with transparency is written as PNG wherever JPEG is listed.',items:{type:"string"},type:"array"},lazyLoad:{type:"boolean"},optimize:{type:"boolean"},picture:{description:"Wrap a multi-format image in a <picture> with one <source> per format (default true). With it off the <img> carries a srcset in the preferred format alone, which browsers that cannot decode that format will still select from.",type:"boolean"},quality:{description:"Lossy quality per format, 1 to 100 (defaults: avif 65, jpeg 80). The build writes png and webp losslessly, so png is never read and webp is read only by the cloudflare service, as the quality of its transform URLs (default 80).",properties:{avif:{type:"number"},jpeg:{type:"number"},png:{type:"number"},webp:{type:"number"}},type:"object"},remoteDomains:{description:'Hostnames whose remote (https) images are optimized through /cdn-cgi/image transform URLs (cloudflare service only), e.g. ["drive.usercontent.google.com"]. Remote sources from other hosts are left untouched.',items:{type:"string"},type:"array"},service:{description:'How images are optimized: "build" encodes variants at build time; "cloudflare" emits /cdn-cgi/image transform URLs served by Cloudflare Image Transformations (requires the feature to be enabled on the serving zone).',enum:["build","cloudflare"],type:"string"},sizes:{type:"string"},widths:{items:{type:"number"},type:"array"}},type:"object"}});var Om;var Am=R(()=>{Om={enum:["string","number","integer","boolean","array","object","null"],type:"string"}});var Cm,Rm,Nm,Tm,Jm,Im,Dm,Mm,Fm;var Lm=R(()=>{Cm={description:"Reference to a $defs type definition in the current component.",examples:["#/$defs/Count","#/$defs/TodoItem","#/$defs/Status"],pattern:String.raw`^#/\$defs/`,type:"string"},Rm={description:"Reference to a state entry (runtime variable) in the current component.",examples:["#/state/count","#/state/addTask","#/state/items"],pattern:"^#/state/",type:"string"},Nm={description:"Reference to an external Jx component file.",examples:["./card.json","https://cdn.example.com/button.json"],pattern:String.raw`^(\./|\.\./).*\.json$|^https?://`,type:"string"},Tm={description:"Reference to a window or document global.",examples:["window#/currentUser","document#/appConfig"],pattern:"^(window|document)#/",type:"string"},Jm={description:"Reference to a named state entry passed via $props from a parent component.",examples:["parent#/sharedState","parent#/theme"],pattern:"^parent#/",type:"string"},Im={description:"Reference to the current Array map iteration context.",examples:["$map/item","$map/index","$map/item/text","$map/item/done"],pattern:String.raw`^\$map/(item|index)(/.*)?$`,type:"string"},Dm={oneOf:[{$ref:"#/$defs/InternalRef"},{$ref:"#/$defs/StateRef"},{$ref:"#/$defs/ExternalRef"},{$ref:"#/$defs/GlobalRef"},{$ref:"#/$defs/ParentRef"},{$ref:"#/$defs/MapRef"}],type:"string"},Mm={additionalProperties:!1,description:"A $ref binding. Resolves to a state entry (reactive) or plain value (static).",properties:{$ref:{$ref:"#/$defs/AnyRef"}},required:["$ref"],type:"object"},Fm={properties:{$props:{$ref:"#/$defs/PropsObject"},$ref:{$ref:"#/$defs/ExternalRef"}},required:["$ref"],type:"object"}});var Qa;var Vm=R(()=>{Qa={additionalProperties:{anyOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/RefObject"},{$ref:"#/$defs/StyleObject"}]},description:"CSS style definition. camelCase property names follow CSSOM convention. Keys starting with :, ., &, or [ are treated as nested CSS selectors. Keys matching $media breakpoint names (or other @-prefixed at-rules) group nested rules. Nesting is recursive: selector and at-rule groups may nest to arbitrary depth "+"(e.g. breakpoint → selector → pseudo-class), mirroring the compiler's recursive emission. "+"An object carrying $ref is a reactive VALUE, and the runtime reads it as one. It also matches the nested-block branch vacuously, since a block admits a string under any key, which is why these branches are anyOf rather than oneOf. A DECLARATION at-rule (@font-face, @property, @position-try, @counter-style) may hold an ARRAY of blocks, which is that key written more than once, in order: an object's keys are "+"unique, so @font-face — the at-rule whose identity is not in its key — could not otherwise "+"state a family's second weight at all.",patternProperties:{"^@(font-face|property|position-try|counter-style)":{anyOf:[{$ref:"#/$defs/StyleObject"},{items:{$ref:"#/$defs/StyleObject"},minItems:1,type:"array"}]}},properties:{$description:{description:"Why this rule exists. Emitted as a comment by static builds, ignored at runtime.",type:"string"}},type:"object"}});var qm,Wm;var Hm=R(()=>{qm={additionalProperties:!1,description:"Dynamic mapped list. Re-renders when the items state entry changes.",properties:{$prototype:{const:"Array",type:"string"},filter:{$ref:"#/$defs/RefObject"},items:{oneOf:[{$ref:"#/$defs/RefObject"},{type:"array"}]},key:{additionalProperties:!1,description:"The identity of each rendered row: a $map/item pointer read per item. A row whose key survives a change keeps its DOM node and its effects across reorders, insertions and "+"removals; without a key, rows are keyed by index. $map/index is not a key — an index "+"names a position, not a row.",properties:{$ref:{pattern:String.raw`^\$map/item(/.+)?$`,type:"string"}},required:["$ref"],type:"object"},map:{$ref:"#/$defs/ElementDef"},sort:{$ref:"#/$defs/RefObject"}},required:["$prototype","items","map"],type:"object"},Wm={description:"Array of child definitions — elements, text, or Array namespaces (dynamic lists) mixed "+"freely. A bare Array namespace (the whole children slot is one dynamic list) is also "+"accepted for backward compatibility, as is a ${…} template string that resolves at build "+"time to an array of child definitions.",oneOf:[{items:{anyOf:[{$ref:"#/$defs/ElementDef"},{$ref:"#/$defs/SwitchNode"},{$ref:"#/$defs/ArrayNamespace"},{type:"string"},{type:"number"}]},type:"array"},{$ref:"#/$defs/ArrayNamespace"},{description:"Computed children — a ${…} template that resolves at build time to an array of child "+'definitions (e.g. "${state.entry.$children}" for parsed content). A bare plain-text string is NOT a valid children value; text children must be array items.',pattern:String.raw`\$\{`,type:"string"}]}});var Um,Bm,zm,Km,Gm,pu;var Xm=R(()=>{Um={additionalProperties:{oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{$ref:"#/$defs/RefObject"}]},description:"HTML attributes and ARIA attributes set via element.setAttribute().",type:"object"},Bm={additionalProperties:{anyOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"array"},{type:"object"},{$ref:"#/$defs/RefObject"}]},description:"Explicit prop passing at a component boundary.",type:"object"},zm={oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"null"},{$ref:"#/$defs/RefObject"}]},Km={additionalProperties:!1,description:"Reactive $ref that drives which case to render: a state entry, or inside a mapped array's template the row's $map/item or $map/index (spec §14.1).",properties:{$ref:{oneOf:[{$ref:"#/$defs/StateRef"},{$ref:"#/$defs/MapRef"}],type:"string"}},required:["$ref"],type:"object"},Gm={properties:{$switch:{$ref:"#/$defs/SwitchDef"},cases:{additionalProperties:{oneOf:[{$ref:"#/$defs/ElementDef"},{$ref:"#/$defs/ExternalComponentRef"}]},type:"object"},tagName:{$ref:"#/$defs/TagName"}},required:["$switch","cases"],type:"object"},pu={additionalProperties:{$ref:"#/$defs/ElementPropertyValue"},description:"A Jx element definition. Maps directly to a DOM element.",properties:{"$map/index":{$ref:"#/$defs/RefObject"},"$map/item":{$ref:"#/$defs/RefObject"},$props:{$ref:"#/$defs/PropsObject"},$ref:{$ref:"#/$defs/ExternalRef"},$switch:{$ref:"#/$defs/SwitchDef"},alt:{$ref:"#/$defs/StringOrRef"},attributes:{$ref:"#/$defs/AttributesObject"},cases:{additionalProperties:{oneOf:[{$ref:"#/$defs/ElementDef"},{$ref:"#/$defs/ExternalComponentRef"}]},description:"Switch cases for this element. Maps case values to element definitions or external component refs, rendered according to the reactive $switch discriminant.",type:"object"},checked:{$ref:"#/$defs/BoolOrRef"},children:{$ref:"#/$defs/ChildrenValue"},className:{$ref:"#/$defs/StringOrRef"},dir:{enum:["ltr","rtl","auto"],type:"string"},disabled:{$ref:"#/$defs/BoolOrRef"},hidden:{$ref:"#/$defs/BoolOrRef"},href:{$ref:"#/$defs/StringOrRef"},id:{type:"string"},innerHTML:{$ref:"#/$defs/StringOrRef"},innerText:{$ref:"#/$defs/StringOrRef"},lang:{$ref:"#/$defs/StringOrRef"},name:{$ref:"#/$defs/StringOrRef"},placeholder:{$ref:"#/$defs/StringOrRef"},selected:{$ref:"#/$defs/BoolOrRef"},src:{$ref:"#/$defs/StringOrRef"},style:{$ref:"#/$defs/StyleObject"},tabIndex:{$ref:"#/$defs/NumberOrRef"},tagName:{$ref:"#/$defs/ElementTagName"},textContent:{$ref:"#/$defs/StringOrRef"},title:{$ref:"#/$defs/StringOrRef"},type:{$ref:"#/$defs/StringOrRef"},value:{$ref:"#/$defs/StringOrRef"}},required:["tagName"],type:"object"}});var Ym;var Zm=R(()=>{Ym={description:"A typed reactive state variable with explicit type and default value. The type property is a JSON Schema or $ref to a $defs type definition. The default property is the initial runtime value.",not:{required:["$prototype"]},properties:{$ref:{description:"Reference to a shared type definition.",type:"string"},attribute:{description:"Linked HTML attribute name for CEM extraction.",type:"string"},default:{description:"Initial state value."},deprecated:{description:"Deprecation notice for CEM extraction.",oneOf:[{type:"boolean"},{type:"string"}]},description:{type:"string"},examples:{type:"array"},reflects:{description:"Whether property changes reflect back to the HTML attribute.",type:"boolean"},type:{description:"JSON Schema type definition, $ref to a $defs type, or JSON Schema type string.",oneOf:[{type:"string"},{type:"object"}]}},required:["default"],type:"object"}});var Qm;var eh=R(()=>{Qm={additionalProperties:!1,description:'A function declaration. $prototype must be "Function". body (inline) and $src (external) are mutually exclusive; declaring both is an error. First parameter is always state (the reactive scope).',not:{required:["body","$src"]},properties:{$export:{description:"Named export in $src module. Defaults to the state key name.",type:"string"},$lazy:{description:"Load $src on first call instead of importing it up front. The function then returns a "+"promise, so it may only be called from a handler or lifecycle hook — never bound as a "+"computed value. Use it for code most visitors never reach.",type:"boolean"},$prototype:{const:"Function",type:"string"},$src:{description:"External module specifier. Mutually exclusive with body.",examples:["./counter.js","npm:@myorg/validators"],type:"string"},arguments:{description:"Legacy alias for parameters: bare string parameter names (state may be listed explicitly as the first name). Superseded by parameters.",examples:[["state","event"]],items:{type:"string"},type:"array"},body:{description:"Inline function body: a source string in erasable TypeScript, which plain JavaScript already is (spec §23.1; types are erased before it is analysed or run; first implicit parameter is state), or a structured statement array (spec §20) — explicit structured function declaration, analyzable by tooling and editable visually. The escalation ladder within the shape is structured statements → source string.",examples:["state.count++",'state.items.push({ id: Date.now(), text: "", done: false })','return state.score >= 90 ? "gold" : "silver"',"const input = event.target as HTMLInputElement; state.label = input.value",[{operator:"push",target:{$ref:"#/state/cart"},value:1},{dispatchEvent:"cart-changed",detail:{$ref:"#/state/cart"}}]],oneOf:[{type:"string"},{$ref:"#/$defs/StatementList"}]},description:{type:"string"},emits:{description:"Array of CEM-compatible Event objects this function dispatches. Used for CEM extraction and studio event discovery.",items:{$ref:"#/$defs/CemEvent"},type:"array"},name:{description:"Explicit function name. Defaults to the state key name.",type:"string"},parameters:{description:"Function parameters (after the implicit state parameter). Accepts CEM-compatible parameter objects or bare string names for backward compatibility.",examples:[["event"],[{name:"event",type:{text:"Event"}}],[{description:"Item identifier",name:"id",type:{text:"number"}}]],items:{oneOf:[{type:"string"},{$ref:"#/$defs/CemParameter"}]},type:"array"},type:{description:"Return type for tooling (JSON Schema or CEM { text } format)."}},required:["$prototype"],type:"object"}});var th,nh;var rh=R(()=>{th={description:"One statement of a structured function body. Either a bare expression node in statement position (a mutation like =/push, or a call — its result discarded unless captured by an assignment), an if/then/else branch (JSON Schema conditional keywords; if holds a pure expression, then/else hold statement lists), a $switch multiway branch (discriminant matched by string form against cases keys, like element-level $switch), a dispatchEvent statement (WHATWG DOM: dispatches a CustomEvent from the handler's current target, with CustomEventInit members detail/bubbles/composed), or the two WHATWG event verbs stopPropagation and preventDefault, each spelled as the member set to true.",oneOf:[{$ref:"#/$defs/ExpressionNode"},{additionalProperties:!1,properties:{else:{items:{$ref:"#/$defs/Statement"},type:"array"},if:{$ref:"#/$defs/ExpressionOperand"},then:{items:{$ref:"#/$defs/Statement"},type:"array"}},required:["if","then"],title:"if / then / else — conditional branch (JSON Schema keyword triple)",type:"object"},{additionalProperties:!1,properties:{$switch:{$ref:"#/$defs/ExpressionOperand"},cases:{additionalProperties:{items:{$ref:"#/$defs/Statement"},type:"array"},type:"object"},default:{items:{$ref:"#/$defs/Statement"},type:"array"}},required:["$switch","cases"],title:"$switch / cases — multiway branch (element-level convention, ECMA switch semantics)",type:"object"},{additionalProperties:!1,properties:{bubbles:{type:"boolean"},composed:{type:"boolean"},detail:{$ref:"#/$defs/ExpressionOperand"},dispatchEvent:{description:"The CustomEvent type to dispatch (WHATWG DOM dispatchEvent).",type:"string"}},required:["dispatchEvent"],title:"dispatchEvent — emit a CustomEvent (WHATWG naming, CustomEventInit members)",type:"object"},{additionalProperties:!1,properties:{stopPropagation:{const:!0,description:"Stop the handler's event at the current target (WHATWG DOM stopPropagation), so an ancestor's handler for the same event does not run. A body run without an event has nothing to stop."}},required:["stopPropagation"],title:"stopPropagation — stop the event here (WHATWG DOM)",type:"object"},{additionalProperties:!1,properties:{preventDefault:{const:!0,description:"Cancel the handler's event's default action (WHATWG DOM preventDefault): a link's navigation, a form's submission, a key's scroll."}},required:["preventDefault"],title:"preventDefault — cancel the event's default action (WHATWG DOM)",type:"object"}]},nh={description:"A structured function body: statements executed sequentially (one yielding a promise is awaited before the next, per ECMA async/await semantics).",items:{$ref:"#/$defs/Statement"},type:"array"}});var sh,oh;var ih=R(()=>{sh=["Function","Request","URLSearchParams","FormData","LocalStorage","SessionStorage","Cookie","IndexedDB","Array","Set","Map","Blob","ReadableStream"],oh={description:'An external class / data source. $prototype is a constructor name (not "Function"). When $prototype is not in the built-in registry, $src is required. All state entries are reactive by default.',properties:{$export:{description:"Named export in $src module. Defaults to the $prototype value.",type:"string"},$prototype:{description:"Constructor name — built-in Web API class or external class name.",examples:["Request","URLSearchParams","FormData","LocalStorage","SessionStorage","Cookie","IndexedDB","Array","Set","Map","Blob","ReadableStream","MarkdownCollection","MyParser"],not:{const:"Function"},type:"string"},$src:{description:"External module specifier. Required when $prototype is not a built-in.",examples:["@jxsuite/md","./lib/my-parser.js","npm:@myorg/data"],type:"string"},autoIncrement:{type:"boolean"},body:{},database:{type:"string"},debounce:{minimum:0,type:"integer"},default:{},description:{type:"string"},domain:{type:"string"},filter:{anyOf:[{$ref:"#/$defs/RefObject"},{description:"A single filter object, e.g. an equality shorthand.",type:"object"},{description:'Ordered filter rules, e.g. [{ field: "Slug", op: "not empty" }].',items:{type:"object"},type:"array"}],description:"Filter configuration: a reactive $ref binding, a single filter object, or an ordered array of rules."},headers:{additionalProperties:{type:"string"},type:"object"},indexes:{items:{properties:{keyPath:{oneOf:[{type:"string"},{items:{type:"string"},type:"array"}]},name:{type:"string"},unique:{type:"boolean"}},required:["name","keyPath"],type:"object"},type:"array"},items:{},key:{type:"string"},keyPath:{type:"string"},manual:{type:"boolean"},map:{$ref:"#/$defs/ElementDef"},maxAge:{type:"integer"},method:{enum:["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],type:"string"},name:{type:"string"},path:{type:"string"},responseType:{enum:["json","text","blob","arraybuffer","document",""],type:"string"},sameSite:{enum:["strict","lax","none"],type:"string"},secure:{type:"boolean"},sort:{anyOf:[{$ref:"#/$defs/RefObject"},{description:"A single sort rule, e.g. { field, order }.",type:"object"},{description:'Ordered sort rules, e.g. [{ field: "date", order: "desc" }].',items:{type:"object"},type:"array"}],description:"Sort configuration: a reactive $ref binding, a single { field, order } rule, or an ordered array of rules."},src:{description:"Configuration property passed to external class constructor.",type:"string"},store:{type:"string"},timing:{enum:["compiler","server","client"],type:"string"},url:{$ref:"#/$defs/StringOrRef"},version:{minimum:1,type:"integer"}},required:["$prototype"],type:"object"}});var ah;var ch=R(()=>{ah={description:"A reusable JSON Schema type definition for tooling only. No function, no runtime artifact. Referenced from state entries via $ref. Naming convention: PascalCase.",not:{anyOf:[{required:["default"]},{required:["$prototype"]}]},properties:{description:{type:"string"},enum:{type:"array"},examples:{type:"array"},items:{},maxLength:{minimum:0,type:"integer"},maximum:{type:"number"},minLength:{minimum:0,type:"integer"},minimum:{type:"number"},pattern:{type:"string"},properties:{type:"object"},required:{items:{type:"string"},type:"array"},type:{$ref:"#/$defs/JsonSchemaType"}},required:["type"],type:"object"}});var lh,uh,fh,dh,ph,mh,hh,gh,yh,xh,bh,$h,Sh,wh,vh,Eh,jh;var Ph=R(()=>{Gp();lh={additionalProperties:!1,description:"A JSON Pointer $ref operand within an expression node. $args/<name> resolves a named formula's parameter (callable entries only).",properties:{$ref:{pattern:String.raw`^(\$map/|\$reduce/|\$args/|event#/|#/|parent#/|window#/|document#/)`,type:"string"}},required:["$ref"],type:"object"},uh={anyOf:[{not:{pattern:String.raw`\$\{`},type:"string"},{type:"number"},{type:"boolean"},{type:"null"},{items:{$ref:"#/$defs/ExpressionOperand"},type:"array"},{description:"Plain-object literal (e.g. an Intl options bag). Objects carrying $ref or operator keys are pointers/nodes, never literals.",not:{anyOf:[{required:["$ref"]},{required:["operator"]}]},type:"object"}],description:"A non-reactive operand: scalar, plain-object literal, or array of operands."},fh={anyOf:[{$ref:"#/$defs/ExpressionPointer"},{$ref:"#/$defs/ExpressionNode"},{$ref:"#/$defs/ExpressionLiteral"}],description:"Anything that may appear in target or value: a pointer, a literal, or a nested expression node."},dh={enum:["!","-"]},ph={enum:["+","-","*","/","%","===","!==","<","<=",">",">=","&&","||","??"]},mh={const:"?:"},hh={const:"switch"},gh={const:"call"},yh={description:"A genuine pure String.prototype / Array.prototype / Number.prototype method (spec §19.4d). The ES2023 change-by-copy family (toSorted, toReversed, toSpliced, with) stands in where mutation would otherwise occur. Receiver in target; value carries the argument (bare scalar) or argument list (array).",enum:["includes","indexOf","lastIndexOf","join","slice","concat","at","flat","toSorted","toReversed","toSpliced","with","toUpperCase","toLowerCase","trim","trimStart","trimEnd","split","startsWith","endsWith","padStart","padEnd","replaceAll","repeat","charAt","normalize","toLocaleUpperCase","toLocaleLowerCase","toFixed","toPrecision","toLocaleString"]},xh={enum:["=","+=","-=","*=","/="]},bh={enum:["pop","shift"]},$h={enum:["push","unshift"]},Sh={const:"splice"},wh={const:"reduce"},vh={enum:["map","filter"]},Eh={additionalProperties:!1,description:"The core expression node. operator + target, with value gated by arity.",oneOf:[{not:{anyOf:[{required:["value"]},{required:["initial"]}]},properties:{operator:{$ref:"#/$defs/UnaryOperator"}},required:["operator"],title:"Unary — target only, no value"},{not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/BinaryOperator"}},required:["operator","value"],title:"Binary — left in target, right in value"},{not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/AssignmentOperator"},target:{$ref:"#/$defs/ExpressionPointer"}},required:["operator","value"],title:"Assignment — writable target, value required"},{not:{anyOf:[{required:["value"]},{required:["initial"]}]},properties:{operator:{$ref:"#/$defs/NoArgMethod"},target:{$ref:"#/$defs/ExpressionPointer"}},required:["operator"],title:"pop / shift — array receiver, no value"},{not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/OneArgMethod"},target:{$ref:"#/$defs/ExpressionPointer"}},required:["operator","value"],title:"push / unshift — array receiver, single value argument"},{not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/SpliceMethod"},target:{$ref:"#/$defs/ExpressionPointer"},value:{items:{$ref:"#/$defs/ExpressionOperand"},minItems:1,type:"array"}},required:["operator","value"],title:"splice — array receiver, [start, deleteCount, ...items]"},{properties:{operator:{$ref:"#/$defs/ReduceMethod"},target:{anyOf:[{$ref:"#/$defs/ExpressionPointer"},{$ref:"#/$defs/ExpressionNode"}]},value:{$ref:"#/$defs/ExpressionNode"}},required:["operator","value","initial"],title:"reduce — pure fold over a pointer or derived array; seed in initial"},{not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/MapFilterMethod"},target:{anyOf:[{$ref:"#/$defs/ExpressionPointer"},{$ref:"#/$defs/ExpressionNode"}]},value:{$ref:"#/$defs/ExpressionNode"}},required:["operator","value"],title:"map / filter — pure over a pointer or derived array; per-item expression in value"},{description:"The ECMAScript conditional (ternary) operator, pure: target is the test, value the consequent, initial the alternate (the reduce precedent for repurposing initial). Chain else-if by nesting another ?: node in initial.",properties:{operator:{$ref:"#/$defs/ConditionalOperator"}},required:["operator","value","initial"],title:"?: — pure conditional; test in target, consequent in value, alternate in initial"},{description:"Value-keyed multiway selection, pure: target is the discriminant (matched against case keys by its string form, like element-level $switch), cases maps matched values to result operands, default is the operand when no case matches (result is undefined without it). Condition-chain branching composes from nested ?: nodes instead.",not:{anyOf:[{required:["value"]},{required:["initial"]}]},properties:{cases:{additionalProperties:{$ref:"#/$defs/ExpressionOperand"},type:"object"},default:{$ref:"#/$defs/ExpressionOperand"},operator:{$ref:"#/$defs/SwitchOperator"}},required:["operator","cases"],title:"switch — pure value-keyed selection; discriminant in target, results in cases/default"},{description:"A pure standard-library method call: target is the receiver (any operand — never mutated; change-by-copy names replace the mutating originals), value the optional argument (bare scalar) or argument list (array). A missing receiver or method yields undefined, matching null-safe path reads.",not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/PureMethod"}},required:["operator"],title:"Pure method — genuine prototype methods; receiver in target, args in value"},{description:"Invoke a callable, pure in formula position: target is the callee pointer — a named formula entry (#/state/…) or a blessed pure global via window#/ (Math.*, JSON.*, Object.keys/values/entries, and "+`${zS()}) — and value is the positional argument list (the splice args-in-value precedent). Argument order follows the callee's declared parameters.`,not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/CallOperator"},target:{$ref:"#/$defs/ExpressionPointer"},value:{items:{$ref:"#/$defs/ExpressionOperand"},type:"array"}},required:["operator"],title:"call — invoke a named formula or blessed global; callee in target, args in value"}],properties:{cases:{additionalProperties:{$ref:"#/$defs/ExpressionOperand"},description:"switch only: matched discriminant value (string form) → result operand.",type:"object"},default:{$ref:"#/$defs/ExpressionOperand",description:"switch only: result operand when no case key matches."},initial:{$ref:"#/$defs/ExpressionOperand"},operator:{type:"string"},target:{$ref:"#/$defs/ExpressionOperand"},value:{$ref:"#/$defs/ExpressionOperand"}},required:["operator","target"],type:"object"},jh={additionalProperties:!1,description:"A declarative expression entry (Shape 5). Used as a state entry or inline event handler. With parameters it is a named formula: a pure, reusable computation invoked via the call operator, its parameters resolved through $args/<name> refs in the body.",properties:{$description:{type:"string"},$expression:{$ref:"#/$defs/ExpressionNode"},$title:{type:"string"},parameters:{description:"Named-formula parameters (CEM convention, as on Function entries): bare names or CEM parameter objects. Present ⇒ the entry is callable, not a computed value.",items:{anyOf:[{type:"string"},{$ref:"#/$defs/CemParameter"}]},type:"array"}},required:["$expression"],type:"object"}});var _h,kh,Oh,Ah;var Ch=R(()=>{_h={description:"A single state entry. Shape is determined by value type: "+"scalar/array → naked reactive property, string with ${} → computed, "+'object with $prototype: "Function" → function, '+"object with $prototype: <other> → data source, "+"object with type and default → typed reactive property, "+"plain object → naked object reactive property.",oneOf:[{type:"number"},{type:"boolean"},{type:"null"},{type:"string"},{type:"array"},{$ref:"#/$defs/TypedStateDef"},{$ref:"#/$defs/FunctionDef"},{$ref:"#/$defs/ExternalClassDef"},{$ref:"#/$defs/ExpressionEntry"},{not:{anyOf:[{required:["$prototype"]},{required:["default"]},{required:["type"]},{required:["$expression"]}]},type:"object"}]},kh={additionalProperties:{$ref:"#/$defs/StateEntry"},description:"Map of runtime variables. Keys are camelCase (public) or #-prefixed (private). All entries are reactive by default.",type:"object"},Oh={additionalProperties:{$ref:"#/$defs/TypeDefEntry"},description:"Map of reusable JSON Schema type definitions. Keys are PascalCase type names. No runtime artifacts are produced.",type:"object"},Ah={description:"A $defs type definition entry. Must be a pure JSON Schema type definition or a class definition (.class.json format).",oneOf:[{$ref:"#/$defs/PureTypeDef"},{$ref:"#/$defs/ClassDef"}]}});var dw,mu,hu,gu,yu,xu,bu,$u,Su,wu,Rh;var Nh=R(()=>{dw=["method","accessor","parse","serialize","rewrite","discover","load","projectData","resolvePaths","lower","emit","head","assets","mount","dialect","deploySchema","bindings","testConnection"],mu={description:"A typed parameter definition for a class.",properties:{default:{},description:{type:"string"},examples:{type:"array"},format:{description:`When "json-schema", this parameter's value is itself a JSON Schema.`,type:"string"},identifier:{type:"string"},type:{}},required:["identifier"],type:"object"},hu={description:"A class field definition with access control and scope.",properties:{$prototype:{description:'Data source prototype for this field (e.g., "Request").',type:"string"},access:{enum:["public","private","protected"],type:"string"},default:{},description:{type:"string"},examples:{type:"array"},identifier:{type:"string"},initializer:{},role:{const:"field",type:"string"},scope:{enum:["instance","static"],type:"string"},type:{}},type:"object"},gu={description:"Class constructor definition.",properties:{$prototype:{const:"Function",type:"string"},body:{description:"The member's body in erasable TypeScript, which plain JavaScript already is (spec §23.1), as one string or as an array of lines.",oneOf:[{type:"string"},{items:{type:"string"},type:"array"}]},description:{type:"string"},parameters:{items:{oneOf:[{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"},{$ref:"#/$defs/ClassParameterDef"}]},type:"array"},role:{const:"constructor",type:"string"},superCall:{properties:{arguments:{items:{type:"string"},type:"array"}},type:"object"}},type:"object"},yu={description:"A class method or accessor definition. Capability roles (parse, serialize, rewrite, discover, load) mark static methods that hosts (compiler, server, studio) invoke for format dispatch.",properties:{$prototype:{const:"Function",type:"string"},access:{enum:["public","private","protected"],type:"string"},body:{description:"The member's body in erasable TypeScript, which plain JavaScript already is (spec §23.1), as one string or as an array of lines.",oneOf:[{type:"string"},{items:{type:"string"},type:"array"}]},description:{type:"string"},getter:{properties:{body:{type:"string"}},type:"object"},identifier:{type:"string"},parameters:{items:{oneOf:[{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"},{$ref:"#/$defs/ClassParameterDef"}]},type:"array"},returnType:{},role:{enum:dw,type:"string"},scope:{enum:["instance","static"],type:"string"},setter:{properties:{body:{type:"string"},parameters:{type:"array"}},type:"object"},timing:{description:"Execution environments allowed to call this capability directly. Hosts outside the list round-trip through the dev server.",items:{enum:["compiler","server","client"],type:"string"},type:"array"}},type:"object"},xu={description:"Format participation marker. A class carrying this block is auto-discovered from the project imports map and used for file-extension dispatch by the compiler, server, and studio.",properties:{documentKinds:{description:'"page"/"component" allow the extension in pages/components discovery; "content" allows it as a content-type source.',items:{enum:["page","component","content"],type:"string"},type:"array"},exportTarget:{description:"When true, site builds emit a serialized sidecar per page in this format.",type:"boolean"},extensions:{description:'File extensions this format claims, with leading dot (e.g. [".md"]).',items:{pattern:String.raw`^\.`,type:"string"},minItems:1,type:"array"},mediaType:{description:"MIME type for the format (icons, labels, HTTP).",type:"string"},remote:{description:"When true, the load capability accepts http(s) URLs as sources.",type:"boolean"}},required:["extensions"],type:"object"},bu={additionalProperties:!1,description:"Project-section admission block (specs/extensions.md §9). A class carrying this block owns "+"the project.json section named by `key`; hosts dispatch that section's data through the class's projectData/resolvePaths capabilities.",properties:{description:{type:"string"},key:{description:"The project.json top-level section this class owns (exclusive per project).",type:"string"},referenceable:{description:"Whether section entries can be referenced from documents (e.g. content types).",type:"boolean"},title:{type:"string"}},required:["key"],type:"object"},$u={additionalProperties:!1,description:"Server-mount admission block (specs/extensions.md §11). A class carrying this block mounts "+"routes under its /_jx/ basePath in the site worker and dev server.",properties:{basePath:{description:"Route subtree this class mounts — must be under /_jx/ (exclusive per project).",examples:["/_jx/data","/_jx/auth"],type:"string"},module:{description:"Module specifier exporting the mount handler.",type:"string"},order:{description:"Mount order (ascending; default 100).",type:"number"}},required:["basePath"],type:"object"},Su={description:"Connection-provider admission block (specs/extensions.md §12). A class carrying this block "+"provides database connections of the given provider/kind.",properties:{kind:{description:"SQL dialect family the provider speaks.",enum:["sqlite","postgres"],type:"string"},local:{description:"Local-development substitute provider (e.g. sqlite for D1).",type:"string"},module:{description:"Module specifier exporting the provider implementation.",type:"string"},provider:{description:"Provider identifier (e.g. d1, supabase, sqlite).",type:"string"},serve:{description:"Module specifier exporting the serve-time worker binding.",type:"string"}},required:["provider","kind"],type:"object"},wu={description:"Studio control-surface hints for a format class: editor modes, document-mode rules, templates, and the element/nesting constraints that gate structural editing.",properties:{documentMode:{properties:{componentWhen:{description:"Treat the document as a component when this top-level/frontmatter key matches the regex.",properties:{frontmatterKey:{type:"string"},matches:{type:"string"}},type:"object"},default:{enum:["content","component"],type:"string"}},type:"object"},elements:{description:"Element allowlist and nesting constraints for structural editing.",properties:{block:{items:{type:"string"},type:"array"},inline:{items:{type:"string"},type:"array"},nesting:{additionalProperties:{properties:{block:{type:"boolean"},directive:{type:"boolean"},inline:{type:"boolean"},only:{items:{type:"string"},type:"array"}},type:"object"},description:'Per-parent child rules keyed by tag (or "_root"): { block, inline, directive } booleans or { only: [tags] }.',type:"object"},textOnly:{items:{type:"string"},type:"array"},void:{items:{type:"string"},type:"array"}},type:"object"},icon:{type:"string"},modes:{description:"Editor modes the studio offers for documents of this format.",items:{type:"string"},type:"array"},newFileTemplate:{description:"Initial source text for newly created files of this format.",type:"string"}},type:"object"},Rh={additionalProperties:!1,description:'A .class.json schema-defined class. $prototype must be "Class". Defines fields, constructor, methods, and type parameters via $defs. Optionally points to a JS module via $implementation for hybrid execution.',properties:{$defs:{description:"Class members: parameters, returnTypes, fields, constructor, methods.",properties:{constructor:{$ref:"#/$defs/ClassConstructorDef"},fields:{additionalProperties:{$ref:"#/$defs/ClassFieldDef"},description:"Class fields with role, access, scope, and type information.",type:"object"},methods:{additionalProperties:{$ref:"#/$defs/ClassMethodDef"},description:"Class methods and accessors.",type:"object"},parameters:{additionalProperties:{$ref:"#/$defs/ClassParameterDef"},description:"Reusable typed parameter schemas, keyed by name.",type:"object"},returnTypes:{additionalProperties:{type:"object"},description:"Output type schemas, keyed by name.",type:"object"}},type:"object"},$id:{type:"string"},$implementation:{description:"Relative path to a JS module containing the actual class implementation.",type:"string"},$prototype:{const:"Class",type:"string"},$schema:{type:"string"},$studio:{$ref:"#/$defs/StudioHints"},connector:{$ref:"#/$defs/ConnectorBlockDef"},description:{type:"string"},extends:{description:"Base class — string name or $ref to another .class.json.",oneOf:[{type:"string"},{properties:{$ref:{type:"string"}},required:["$ref"],type:"object"}]},format:{$ref:"#/$defs/FormatDef"},project:{$ref:"#/$defs/ProjectBlockDef"},server:{$ref:"#/$defs/ServerBlockDef"},title:{description:"PascalCase class name, used as the export name.",type:"string"}},required:["$prototype","title"],type:"object"}});var pw,vu;var Th=R(()=>{Po();pw=[301,302,303,307,308],vu={description:"Schema for Jx project.json files. A project.json file is the root anchor file for a Jx project, declaring site metadata, default settings, global styles, extensions, and build configuration. Open by design: extension-contributed sections (e.g. `content`) are opaque top-level keys; the generated per-project entry document (project.schema.json) closes the composition.",properties:{$defs:{description:"Global type definitions available to all pages.",type:"object"},$elements:{description:"Global custom element dependencies available to all pages. Items are $ref objects or npm package specifier strings.",items:{oneOf:[{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"},{type:"string"}]},type:"array"},$head:{description:"Global <head> entries applied to all pages. Array of element definitions for meta tags, link tags, script tags, etc.",examples:[[{attributes:{href:"/favicon.svg",rel:"icon"},tagName:"link"},{attributes:{content:"Jx",name:"generator"},tagName:"meta"}]],items:{properties:{attributes:{additionalProperties:{type:"string"},type:"object"},tagName:{type:"string"}},type:"object"},type:"array"},$media:{additionalProperties:{type:"string"},description:'Named media breakpoints following CSS @custom-media convention. Available in all component style objects. Declaring a pure color-scheme query (e.g. "--dark": "(prefers-color-scheme: dark)") additionally opts the site into the forced-scheme contract: @--dark style blocks are dual-emitted so a data-color-scheme attribute on <html> overrides the OS preference, color-scheme is declared on :root, and a pre-paint script restores the '+"visitor's persisted choice (spec §9.5).",examples:[{"--dark":"(prefers-color-scheme: dark)","--lg":"(min-width: 1024px)","--md":"(min-width: 768px)","--sm":"(min-width: 640px)"}],type:"object"},$schema:{description:"Relative path to the generated per-project schema (conventionally ./project.schema.json, written by `jx schema`).",type:"string"},build:{description:"Build configuration.",properties:{adapter:{description:"Platform adapter for deployment-specific output.",enum:["static","cloudflare-pages","cloudflare-workers","node","bun"],type:"string"},deploy:{additionalProperties:!1,description:"Deployment tracking: the hosting project this repo publishes to. Identifiers "+"only (no secrets) — safe to commit; Studio uses it to tell whether the publish "+"workflow already exists. `adapter` says how the build is packaged; `deploy` says where it ships.",properties:{accountId:{description:"Hosting account id (e.g. the Cloudflare account id).",type:"string"},productionUrl:{description:"Production URL of the connected hosting project.",type:"string"},projectName:{description:"Hosting project name (e.g. the Cloudflare Pages project).",pattern:"^[a-z0-9][a-z0-9-]*$",type:"string"},provider:{description:"Hosting provider the project is connected to.",enum:["cloudflare-pages"],type:"string"}},required:["provider","accountId","projectName"],type:"object"},format:{default:"directory",description:"Reserved; currently unused. Accepted for forward compatibility with single-file output (desktop single-file mode) — the build emits per-route directories regardless.",enum:["directory","single"],type:"string"},outDir:{default:"./dist",description:"Output directory for compiled site.",type:"string"},headers:{additionalProperties:!1,description:"Emit dist/_headers — the response headers only the build can know. Honored by "+"Cloudflare Pages/Workers assets and Netlify; on the node/bun adapters the file documents what a reverse proxy in front of them must send.",properties:{cache:{default:"auto",description:'"auto" marks the content-addressed image variants immutable (RFC 8246) and revalidates everything else (RFC 9111). "off" emits no Cache-Control at all.',enum:["auto","off"],type:"string"},enabled:{default:!0,type:"boolean"},rules:{additionalProperties:{additionalProperties:{type:"string"},type:"object"},description:"Verbatim rules, merged after the generated block.",propertyNames:{pattern:"^/"},type:"object"},security:{additionalProperties:!1,properties:{contentTypeOptions:{default:!0,type:"boolean"},csp:{default:!1,description:"CSP Level 3. Off by default: unlike the other security headers this one "+"governs code the build cannot see — a third-party script that loads a "+"second script, a widget that opens a frame — so turning it on is a change "+"to verify in the browser console, not a safe default. `script-src` is derived from the inline scripts and external origins the build emitted; `style-src` keeps 'unsafe-inline', because per-page <style> blocks and per-element style attributes have no site-wide hash.",oneOf:[{type:"boolean"},{const:"report-only"},{additionalProperties:!1,properties:{directives:{additionalProperties:{oneOf:[{type:"string"},{const:!1}]},description:"Replace (string) or remove (false) a computed directive. A replacement is wholesale, so an addition restates the defaults.",type:"object"},mode:{default:"enforce",enum:["enforce","report-only"]},reportUri:{format:"uri-reference",type:"string"}},type:"object"}]},frameOptions:{default:"SAMEORIGIN",oneOf:[{enum:["DENY","SAMEORIGIN"],type:"string"},{const:!1}]},hsts:{default:!1,description:"RFC 6797. Off by default: a wrong max-age locks the apex domain to HTTPS for that long, and the mistake is invisible until a certificate lapses. `preload` requires `includeSubDomains` and is a build error without it.",oneOf:[{type:"boolean"},{additionalProperties:!1,properties:{includeSubDomains:{default:!0,type:"boolean"},maxAge:{default:31536000,minimum:0,type:"integer"},preload:{default:!1,type:"boolean"}},type:"object"}]},permissionsPolicy:{default:"camera=(), microphone=(), geolocation=()",oneOf:[{type:"string"},{const:!1}]},referrerPolicy:{default:"strict-origin-when-cross-origin",oneOf:[{enum:["no-referrer","no-referrer-when-downgrade","origin","origin-when-cross-origin","same-origin","strict-origin","strict-origin-when-cross-origin","unsafe-url"],type:"string"},{const:!1}]}},type:"object"}},type:"object"},sitemap:{default:!0,description:"Generate sitemap.xml from the route table (requires `url`). Set false to disable.",type:"boolean"},trailingSlash:{default:"always",description:"Trailing slash behavior for generated URLs.",enum:["always","never","ignore"],type:"string"}},type:"object"},copy:{additionalProperties:{type:"string"},description:"Declarative file copy map. Keys are source paths (relative to project root), values are destination paths (relative to outDir).",type:"object"},defaults:{description:"Default settings applied to all pages unless overridden.",properties:{charset:{default:"utf8",description:"Default charset for the page.",type:"string"},dir:{description:"Base direction for the <html> element. Omitted when unset — a page's `$dir` "+"overrides it. Right-to-left content renders left-to-right without this.",enum:["ltr","rtl","auto"],type:"string"},lang:{default:"en",description:"Default lang attribute for the <html> element. A page's `$lang` overrides it.",type:"string"},layout:{default:null,description:"Default layout file path applied to all pages. Set to null to render pages without a layout.",examples:["./layouts/base.json"],oneOf:[{type:"string"},{type:"null"}]},shadow:{default:!1,description:"Default shadow-DOM mode for every component (spec.md §16.6). Off unless set: a "+"shadow root isolates component styles from the page and replaces the <slot> emulation with real slot distribution. A component's own `$shadow` overrides this in both directions.",oneOf:[{enum:["open","closed"],type:"string"},{const:!1,type:"boolean"}]}},type:"object"},extensions:{description:"Extension packages: bare package names (resolved project-first through the package exports map) or relative paths. Each must export jx-extension.json.",examples:[["@jxsuite/parser"]],items:{type:"string"},type:"array"},manifest:{additionalProperties:!1,description:'W3C Web App Manifest, emitted as manifest.webmanifest with a <link rel="manifest"> on every page. Absent means no manifest: it is a claim that a site is meant to be installed, and most are not.',properties:{backgroundColor:{type:"string"},categories:{items:{type:"string"},type:"array"},description:{type:"string"},dir:{enum:["ltr","rtl","auto"],type:"string"},display:{default:"standalone",enum:["fullscreen","standalone","minimal-ui","browser"],type:"string"},enabled:{default:!0,type:"boolean"},icons:{description:"Icons at 192px and 512px are what browsers require before offering to install the site; the build warns when either is missing.",items:{additionalProperties:!1,properties:{purpose:{type:"string"},sizes:{examples:["192x192"],type:"string"},src:{type:"string"},type:{type:"string"}},required:["src"],type:"object"},type:"array"},lang:{type:"string"},name:{description:"Defaults to the project name.",type:"string"},orientation:{type:"string"},scope:{type:"string"},shortName:{type:"string"},startUrl:{default:"/",type:"string"},themeColor:{type:"string"}},type:"object"},serviceWorker:{default:!1,description:"W3C Service Worker, emitted as sw.js. Off unless declared — a worker is sticky, so it "+"is the one output that can keep breaking visitors after a deploy tries to fix them. **Turning it off means `false`, not deleting the key**: `false` emits a tombstone at the same URL that unregisters the old worker and clears its caches, and a 404 there is not an instruction to stop. HTML is always network-first; only the content-addressed /images/_optimized/* is served cache-first.",oneOf:[{type:"boolean"},{additionalProperties:!1,properties:{enabled:{default:!0,type:"boolean"},offlineFallback:{description:"Page served for a failed navigation. Added to `precache` if not already there.",type:"string"},precache:{description:"Site-absolute URLs fetched at install time. Each must be a file this build produces; one that is not fails the build, because a single unreachable entry stops the worker installing at all.",items:{pattern:"^/",type:"string"},type:"array"},scope:{default:"/",type:"string"}},type:"object"}]},securityTxt:{additionalProperties:!1,description:"RFC 9116 security.txt, emitted at .well-known/security.txt. `expires` is required by "+"§2.5.5 and an absent or past value is a build error — an expired file advertises a "+"reporting channel while telling the reporter not to trust it. A hand-placed public/.well-known/security.txt shadows this, which is how a clearsigned file ships.",properties:{acknowledgments:{items:{type:"string"},type:"array"},canonical:{type:"string"},contact:{description:"At least one mailto:, https: or tel: URI (§2.5.3).",items:{type:"string"},type:"array"},enabled:{default:!0,type:"boolean"},encryption:{items:{type:"string"},type:"array"},expires:{format:"date-time",type:"string"},hiring:{items:{type:"string"},type:"array"},policy:{items:{type:"string"},type:"array"},preferredLanguages:{description:"BCP 47 tags, validated and canonicalized like i18n.locales.",items:{pattern:nu,type:"string"},type:"array"}},type:"object"},i18n:{description:"Internationalization configuration.",properties:{defaultLocale:{description:"Default locale, as a BCP 47 language tag. The pattern catches shape errors (`en_US`, `en--US`); the build is the authority on well-formedness.",examples:["en"],pattern:nu,type:"string"},locales:{description:"Available locales, as BCP 47 language tags.",examples:[["en","fr","de"]],items:{pattern:nu,type:"string"},type:"array"},routing:{description:"Locale routing strategy.",enum:["prefix-except-default","prefix-always"],type:"string"}},type:"object"},images:{$ref:"#/$defs/ImageConfig"},imports:{additionalProperties:{type:"string"},description:"Global import map: $prototype names to .class.json file paths. Makes external classes available by name in all pages.",examples:[{Markdown:"@jxsuite/parser/Markdown.class.json",MarkdownCollection:"@jxsuite/parser/MarkdownCollection.class.json"}],type:"object"},name:{default:"Jx Site",description:"Human-readable project name.",examples:["My Portfolio","Jx Example Site"],type:"string"},redirects:{additionalProperties:{oneOf:[{description:"Destination path or URL; implies a 301.",type:"string"},{additionalProperties:!1,description:"A redirect with an explicit RFC 9110 §15.4 status.",properties:{destination:{type:"string"},status:{default:301,description:"RFC 9110 §15.4 redirection status. 307 and 308 preserve the request method; "+"301 and 302 historically do not.",enum:[...pw],type:"integer"}},required:["destination"],type:"object"},{additionalProperties:!1,description:"A rewrite (proxy): the destination's content is served AT the source URL, with no "+"redirect. Emitted as status 200 in `_redirects`, which is the host convention — "+"not an HTTP redirection status.",properties:{destination:{type:"string"},rewrite:{const:!0,type:"boolean"}},required:["destination","rewrite"],type:"object"}]},description:"Static redirect and rewrite rules. Keys are source paths in URLPattern pathname syntax.",examples:[{"/api/*":{destination:"https://api.example.com/*",rewrite:!0},"/legacy/*":{destination:"/archive/*",status:308},"/old-about":"/about"}],propertyNames:{pattern:"^/"},type:"object"},state:{description:"Site-wide reactive state available to all pages.",type:"object"},style:{additionalProperties:{oneOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/StyleObject"}]},description:"Global CSS styles applied to the <body> element. Uses the same camelCase CSSOM convention and recursive selector/at-rule nesting as component styles.",type:"object"},url:{description:"Production URL of the deployed site.",examples:["https://example.com","https://jxsuite.com"],type:"string"}},type:"object"}});var Jh;var Ih=R(()=>{Jh={additionalProperties:!1,description:"Schema for jx-extension.json manifests. Located at the extension package root and exported so hosts can resolve <package>/jx-extension.json through the exports map.",properties:{$schema:{type:"string"},classes:{additionalProperties:{type:"string"},description:"$prototype-visible class name → class descriptor path, relative to the manifest.",type:"object"},description:{description:"One-line description.",type:"string"},name:{description:"Package name; must match package.json.",type:"string"},schemas:{additionalProperties:!1,description:"Schema fragments this package contributes, relative to the manifest.",properties:{document:{description:"Document-schema fragment (positions like $paths values).",type:"string"},fields:{description:"Field-union fragment: its $defs members are unioned into the per-project "+"field-schema resource as extension field extras (specs/extensions.md §5.3).",type:"string"},project:{description:"Project-schema fragment (top-level project.json sections).",type:"string"}},type:"object"},title:{description:"Human-readable name for studio surfaces.",type:"string"}},required:["name"],type:"object"}});var ec="https://jxsuite.com/schema/project/fields/v2",Oo="https://jxsuite.com/schema/document/paths/v2",Dh,Mh,tc,Fh;var nc=R(()=>{Dh={description:"A single field definition inside a section entry schema — a small, recursive subset of "+"JSON Schema. Recursive positions reference the effective field union via the well-known fields resource $id.",properties:{default:{},description:{type:"string"},enum:{type:"array"},format:{type:"string"},items:{$ref:"https://jxsuite.com/schema/project/fields/v2"},properties:{additionalProperties:{$ref:"https://jxsuite.com/schema/project/fields/v2"},type:"object"},required:{items:{type:"string"},type:"array"},type:{enum:["string","number","integer","boolean","array","object"],type:"string"}},required:["type"],type:"object"},Mh={description:`Relationship reference field: points at a named entry of a referenceable section via "#/<sectionKey>/<name>" (specs/relationships.md). A bare reference is to-one; wrap in an array field's items for to-many.`,properties:{$ref:{pattern:"^#/[A-Za-z][A-Za-z0-9_-]*/[A-Za-z0-9._-]+$",type:"string"},description:{type:"string"}},required:["$ref"],type:"object"},tc=[{additionalProperties:!1,description:'Explicit value list: generates one page per value, bound to `param` (default "value").',properties:{param:{description:'Route parameter to fill (default "value").',type:"string"},values:{description:"The values to expand.",type:"array"}},required:["values"],type:"object"},{additionalProperties:!1,description:"JSON data-file source: loads a project-relative file that must contain an array, and generates one page per item.",properties:{$ref:{description:"Project-relative path to a .json file containing an array.",type:"string"},field:{description:'Item field providing the parameter value (default "id").',type:"string"},param:{description:'Route parameter to fill (default "id").',type:"string"}},required:["$ref"],type:"object"},{additionalProperties:!1,description:"Paged list: one route per `pageSize` items of an entry of this page's own state, which must resolve to an array at build time. The page number fills the route's one parameter that `each` does not.",properties:{each:{description:"Another `$paths` source for the route's other parameter: the list is paged once per value of it, as a paged archive per tag is.",type:["object","array"]},pageSize:{description:"Items on each page.",minimum:1,type:"integer"},paginate:{additionalProperties:!1,description:"The state entry to page.",properties:{$ref:{description:"A pointer to an entry of this page's state: `#/state/<key>`.",pattern:"^#/state/[^/]+$",type:"string"}},required:["$ref"],type:"object"}},required:["paginate","pageSize"],type:"object"},{description:"Legacy explicit form: an array of ready-made parameter objects, used as-is with no expansion. Prefer one of the source shapes above.",items:{additionalProperties:{type:"string"},type:"object"},type:"array"}],Fh={description:"A source shape contributed by an extension this schema cannot see. The project's generated document.schema.json validates these exactly; enable the owning extension and regenerate with `jx schema` to get precise checking here.",minProperties:1,type:"object"}});var mw=R(()=>{gm();xm();wm();Em();_m();km();Am();Lm();Vm();Hm();Xm();Zm();eh();rh();ih();ch();Ph();Ch();Nh();Th();Ih();nc()});function hw(e,t,n){let r=e.$description;if(k(r))(Object.keys(t).length>0?t:n).$description=r}function gw(e,t,n,r,s=J1,o={}){let i=[],a=(p,m)=>{let x={mediaQueries:t,scope:m,transposeValue:n};if(r)x.resolveValue=(g,y)=>r(g,y,m);for(let g of fi(p,x))i.push(o.comments===!0?Ka(g):g.text)},c={},l={},u=[],d=[];for(let[p,m]of Object.entries(e)){if(I(m)&&!Array.isArray(m)){if(p.startsWith("@"))u.push([p,m]);else if(!p.startsWith("--"))d.push([p,m]);continue}if(bs(p)||p.startsWith("@")||p.startsWith("$"))continue;if(p.startsWith("--")||p==="colorScheme"||p==="color-scheme")c[p]=m;else l[p]=m}hw(e,c,l),a(c,s.root),a(l,s.body);for(let[p,m]of d)if(p.startsWith("&"))a({[p]:m},s.root);else a(m,p);for(let[p,m]of u){if(Ua(p)||za(p)){a({[p]:m},null);continue}let x={},g={},y=[];for(let[S,E]of Object.entries(m)){if(I(E)&&!Array.isArray(E)){if(!S.startsWith("@"))y.push([S,E]);continue}if(S.startsWith("$"))continue;if(S.startsWith("--"))x[S]=E;else g[S]=E}hw(m,x,g),a({[p]:x},s.root),a({[p]:g},s.body);for(let[S,E]of y)a({[p]:E},S)}if(Object.values(t).some((p)=>Xn(p)!==null)&&!("colorScheme"in e))i.push(`${s.root} { color-scheme: light dark }`,`${s.root}:where([${Gn}="light"]) { color-scheme: light }`,`${s.root}:where([${Gn}="dark"]) { color-scheme: dark }`);return i.join(`
129
+ `)}var J1;var yw=R(()=>{Ga();le();J1={body:"body",root:":root"}});function xw(e){return e===!1||e==="open"||e==="closed"}function Ao(e,t){let n=e?.$shadow;if(xw(n))return n===!1?null:n;let r=t?.shadow;return xw(r)&&r!==!1?r:null}function bw(e,t){return t===null?e:":host"}function ic(e,t){let n=[];for(let[r,s]of(e.parameters??[]).entries()){let o=$w(s);if(!o)continue;let i=Sw(s)?`_a[${r}] === undefined ? ${JSON.stringify(s.default)} : _a[${r}]`:`_a[${r}]`;n.push(`${JSON.stringify(o)}: ${i}`)}return`(..._a) => { const _args = { ${n.join(", ")} }; return ${t}; }`}function $w(e){return k(e)?e:e?.name??""}function Sw(e){return I(e)&&"default"in e}function I1(e,t){let n=ww(e,t);return n===e?e:`${n} as ${e}`}function ww(e,t){let n=t?.$export;return k(n)&&n!==""?n:e}function Pu(e,t,n={}){let{statePrefix:r="state",indent:s="",collect:o}=n,{url:i}=t,a=me(i),c=t.method??"GET";if(t.manual)return`${s}// ${e}: manual Request — fetch triggered by user action`;let l=[`// ${e}: auto-fetch from ${a?"(dynamic URL)":i}`,o?`${o}.push(effect(() => {`:"effect(() => {"];if(a)l.push(` const url = \`${M1(i,r)}\`;`,' if (!url || url === "undefined" || url.includes("undefined")) return;');else l.push(` const url = ${JSON.stringify(i)};`);let u=[];if(c!=="GET")u.push(`method: ${JSON.stringify(c)}`);if(t.headers)u.push(`headers: ${JSON.stringify(t.headers)}`);if(t.body){let p=I(t.body)?JSON.stringify(JSON.stringify(t.body)):JSON.stringify(t.body);u.push(`body: ${p}`)}let d=u.length>0?`, { ${u.join(", ")} }`:"";return l.push(` fetch(url${d})`," .then(r => r.ok ? r.json() : Promise.reject(r.statusText))",` .then(d => { ${r}.${e} = d; })`,` .catch(e => { ${r}.${e} = { error: String(e) }; });`,o?"}));":"});"),l.map((p)=>`${s}${p}`).join(`
130
+ `)}function _u(e,t,n={}){let{statePrefix:r="state",indent:s="",collect:o,serverBaseUrl:i="/_jx/server"}=n,a=JSON.stringify(`${i}/${t.$export}`),c=Object.entries(t.arguments??{}),l=c.map(([g,y])=>{if(!Ce(y))return`${Xr(g)}: ${JSON.stringify(y)}`;if(D1.some((S)=>y.$ref.startsWith(S)))throw Error(`Server function "${e}": argument "${g}" references "${y.$ref}", which a state entry cannot read. Use a #/state/, parent#/, window#/ or document#/ reference.`);return`${Xr(g)}: ${Yr({$ref:y.$ref},{statePrefix:r})}`}),u=c.some(([,g])=>Ce(g)),d=`${Rw}(${a}, ${l.length>0?`{ ${l.join(", ")} }`:"{}"})`,p=Re(r,qt(e)),m=`console.error(${JSON.stringify(`Jx server function ${t.$export}:`)}, e)`;return(u?[`// ${e}: server function ${t.$export}, called again when an argument changes`,"{"," let _jxSeq = 0;",o?` ${o}.push(effect(() => {`:" effect(() => {"," const _seq = ++_jxSeq;",` ${d}`,` .then((d) => { if (_seq === _jxSeq) ${p} = d; })`,` .catch((e) => { if (_seq === _jxSeq) ${m}; });`,o?" }));":" });","}"]:[`// ${e}: server function ${t.$export}, called once`,d,` .then((d) => { ${p} = d; })`,` .catch((e) => { ${m}; });`]).map((g)=>`${s}${g}`).join(`
131
+ `)}function M1(e,t){if(t==="state")return e;return e.replaceAll(/\$\{([^}]*)\}/g,(n,r)=>`\${${r.replaceAll(/(?<!this\.)\bstate\./g,`${t}.`)}}`)}function ku(e,t){let n=t.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`),r=String.raw`\bstate${rc}\??\.${rc}${n}(?![\w$])`,s="(?:\\\\\"|['`])",o=String.raw`\bstate${rc}(?:\?\.)?\[${rc}${"(?:\\\\\"|['`])"}${n}${"(?:\\\\\"|['`])"}`,i=String.raw`#/state/${n}(?=["/])`;return new RegExp(`${r}|${o}|${i}`).test(e)||F1.test(e)}function Ou(e,t){let n=om(t),r=e.state??{},s=Object.keys(n).filter((l)=>!(l in r));if(s.length===0)return e;let o=JSON.stringify(e),i=Object.values(r).some((l)=>I(l)&&!Array.isArray(l)&&k(l.$src)),a=new Set(s.filter((l)=>i||ku(o,l)));for(let l of a)for(let u of sm(n[l]))if(!(u in r))a.add(u);if(a.size===0)return e;let c=Object.fromEntries(s.filter((l)=>a.has(l)).map((l)=>[l,n[l]]));return{...e,state:{...c,...r}}}function L1(e){let t=Object.fromEntries(Object.entries(e.state??{}).filter(([,n])=>!ko(n)));return JSON.stringify({...e,state:t})}function Au(e){if(k(e))return me(e);if(!I(e))return!1;if(e.state){let t;for(let[n,r]of Object.entries(e.state)){if(n==="$site"||n==="$page")continue;if(!I(r)||Array.isArray(r))return!0;if(r.timing==="compiler")continue;if(ko(r)){if(t??=L1(e),ku(t,n))return!0;continue}if(r.$prototype)return!0;if("default"in r)return!0;if(os(r))continue;return!0}}if(e.$switch)return!0;if(nt(e)||Dx(e.children))return!0;if(Array.isArray(e.children)&&e.children.some((t)=>Au(t)))return!0;for(let[t,n]of Object.entries(e)){if($s.has(t))continue;if(Ce(n))return!0;if(me(n))return!0}if(I(e.style)){for(let t of Object.values(e.style))if(me(t))return!0}if(I(e.attributes)){for(let t of Object.values(e.attributes))if(me(t))return!0}return!1}function Ei(e,t=null,n={},r={}){let s=e?.state?wi(e.state,t):t??Ew();return{media:r,scope:s,scopeDefs:n}}function Ew(e=null){return Object.create(e)}function Hh(e){return e[vw]}function jw(e,t){return Hh(e)?.has(t)??!1}function U1(e,t,n){if(t>0&&W1.test(e.charAt(t-1)))return!1;let r=t+5;if(n)return!H1.test(e.charAt(r));while(/\s/u.test(e.charAt(r)))r+=1;return e.charAt(r)==="."}function ji(e,t,n={}){if(!e.includes("state"))return e;let r=n.bare===!0,s=n.code===!1?e:ro(e),o="",i=0;for(let a=s.indexOf("state");a!==-1;a=s.indexOf("state",a+1))if(U1(s,a,r))o+=e.slice(i,a)+t,i=a+5;return o+e.slice(i)}function qh(e,t){if(k(e)){if(!e.includes("state."))return;let o=ro(e);for(let i of o.matchAll(V1))t.add(i[1]);for(let i of o.matchAll(q1))t.add(i[1]);return}if(Array.isArray(e)){for(let o of e)qh(o,t);return}if(!I(e))return;let n=e,{operator:r,target:s}=n;if(k(r)&&xr(r)&&Ce(s)&&s.$ref.startsWith("#/state/"))t.add(s.$ref.slice(8).split("/")[0]);for(let o of Object.values(n))qh(o,t)}function js(e,t){if(kt(t)&&Wp(t))throw Error(`${e} declares both "body" and "$src"; they are mutually exclusive (spec.md §5.3 4d). Keep one.`)}function Cu(e,t){let n={eager:new Map,lazy:new Map};for(let[r,s]of Object.entries(e)){if(js(`state entry "${r}"`,s),!kt(s)||!s.$src)continue;if(s.$lazy===!0){if(t.get(r)==="computed")throw Error(`"${r}" declares "$lazy": true but is used as a computed value, not called. A lazily loaded function resolves to a promise; a computed must resolve now. Remove "$lazy", or call ${r}() from a handler instead of binding its value.`);let i=n.lazy.get(s.$src);if(!i)i=[],n.lazy.set(s.$src,i);i.push({binding:r,exportName:ww(r,s)});continue}let o=n.eager.get(s.$src);if(!o)o=new Set,n.eager.set(s.$src,o);o.add(I1(r,s))}return n}function Ru(e,t){let n=[];for(let[o,i]of e.eager)n.push(`import { ${[...i].join(", ")} } from '${t?t(o):o}';`);let r=[],s=0;for(let[o,i]of e.lazy){let a=`_jxLazy${s}`;s+=1,r.push(`let ${a};`,`const ${a}Load = () => (${a} ??= import('${t?t(o):o}'));`,...i.map(({binding:c,exportName:l})=>`const ${c} = (...args) => ${a}Load().then((m) => m.${l}(...args));`))}return{imports:n,loaders:r}}function wi(e={},t=null){let n=Ew(t),r=t?Hh(t):void 0,s=new Set(r);Object.defineProperty(n,vw,{configurable:!0,enumerable:!1,value:s,writable:!0});let o=new Set;for(let u of Object.values(e))if(kt(u)||gn(u))qh(u.body??u.$expression,o);for(let u of o)if(u in e)s.add(u);let i=_o({state:e});for(let[u,d]of Object.entries(e)){if(!I(d)||Array.isArray(d)){Zr(n,u,Eu(d));continue}if("default"in d){Zr(n,u,Eu(d.default));continue}if(Mr(d)){s.add(u);continue}if(!d.$prototype&&!("$expression"in d)&&!os(d))Zr(n,u,Eu(d))}let a=[],c=[];for(let[u,d]of Object.entries(e)){if(me(d)){a.push([u,d]);continue}if(!I(d))continue;if(gn(d)){let p=d.$expression;if(Dr(d)){let m=d.parameters;Zr(n,u,(...x)=>{let g={};for(let[y,S]of m.entries()){let E=$w(S);if(!E)continue;g[E]=x[y]===void 0&&Sw(S)?S.default:x[y]}return wn(p,n,null,{args:g})})}else if(xr(p.operator))Zr(n,u,(m,x)=>wn(p,m,x));else Lh(n,u,()=>wn(p,n,null));continue}if(kt(d)){if(js(`state entry "${u}"`,d),cr(d)){let{body:p}=d;Zr(n,u,(m,x)=>{gi(p,m??n,x??null)})}else if(k(d.body)){let{body:p}=d,m=Function(...hr(d),p);if(i.get(u)==="computed")Lh(n,u,()=>m(n)),c.push([u,p]);else Zr(n,u,m)}else Zr(n,u,()=>{}),s.add(u);continue}if(yn(d)&&(d.$prototype==="LocalStorage"||d.$prototype==="SessionStorage")){Zr(n,u,Eu(d.default??null));continue}if(yn(d)&&d.$prototype==="Request")s.add(u);if(ki(d))s.add(u)}let l=!0;while(l){l=!1;for(let[u,d]of[...c,...a])if(!s.has(u)&&Pw(d,n))s.add(u),l=!0}for(let[u,d]of a)Lh(n,u,()=>Wt(d,n));return n}function Zr(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0})}function Lh(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:n})}function Le(e,t){if(Ce(e))return Uh(e.$ref,t);if(me(e))return Wt(e,t);return e}function Mt(e){return Ce(e)}function Uh(e,t){if(!k(e))return e;if(e.startsWith("$map/")){let n=e.split("/"),r=n[1],o=t.$map?.[r]??t[`$map/${r}`];return n.length>2?Vh(o,n.slice(2).join("/")):o}if(e.startsWith("#/state/"))return Vh(t,e.slice(8));return Vh(t,e)??null}function Pw(e,t){if(!t)return!1;let n=Hh(t);for(let r of e.matchAll(/\bstate\.([A-Za-z_$][\w$]*)\s*(\()?/g)){if(r[2])continue;let s=r[1];if(n?.has(s))return!0;let o;try{o=t[s]}catch{continue}if(_t(o))return!0}return!1}function Nu(e){return $i(e)?`(${e.slice(2,-1)})`:`\`${e}\``}function Wt(e,t){if(Pw(e,t))return null;let n=["state","$map","$site","$page"],r=[t,t?.$map,t?.$site,t?.$page];try{let s=$i(e)?`return (${e.slice(2,-1)})`:`return \`${e}\``;return Function(...n,s)(...r)}catch{return null}}function Vh(e,t){return Dt(e,t)}function Eu(e){if(!I(e))return e;return structuredClone(e)}function B1(e,t){if(!e||!t)return"";return Object.entries(e).filter(([n,r])=>!n.startsWith(":")&&!n.startsWith(".")&&!n.startsWith("&")&&!n.startsWith("[")&&!n.startsWith("@")&&me(r)).map(([n,r])=>{let s=Le(r,t);return s==null?null:`${on(n)}: ${s}`}).filter(Boolean).join("; ")}function Co(e,t,n=""){let r="",s=Le(e.id,t),o=lc(e),i=o?Le(uc(e),t):null,a=[k(i)||We(i)?String(i):"",_s(e)??""].filter((x)=>x!=="").join(" "),c=Le(e.hidden,t),l=Le(e.tabIndex,t),u=Le(e.title,t),d=Le(e.lang,t),p=Le(e.dir,t);if(s)r+=` id="${ve(String(s))}"`;if(a)r+=` class="${ve(a)}"`;if(c)r+=" hidden";if(l!==void 0&&l!==null)r+=` tabindex="${ve(String(l))}"`;if(u)r+=` title="${ve(String(u))}"`;if(d)r+=` lang="${ve(String(d))}"`;if(p)r+=` dir="${ve(String(p))}"`;let m=[B1(e.style,t),n].filter(Boolean).join("; ");if(m)r+=` style="${ve(m)}"`;if(e.attributes)for(let[x,g]of Object.entries(e.attributes)){if(o&&x==="class")continue;let y=Le(g,t);if(bt(y)){let S=Ss(x,y);if(S!==null)r+=S===""?` ${x}`:` ${x}="${ve(S)}"`;continue}if(k(y)||We(y))r+=` ${x}="${ve(String(y))}"`}if(e.$static)r+=" data-jx-static";else if(e.$prerendered)r+=" data-jx-prerendered";return r}function ac(e,t=" "){return e?"":`
132
+ ${t}`}function Pi(){let e=JSON.stringify(ou),t=JSON.stringify(Gn);return`(function(){try{var s=localStorage.getItem(${e});if(s==="light"||s==="dark"){document.documentElement.setAttribute(${t},s)}}catch(e){}})()`}function ju(e,t,n,r){for(let s of fi(t,{mediaQueries:r,resolveValue:(o,i)=>_w(o,i,n),scope:n}))e.push(Ka(s))}function _w(e,t,n){let r=k(t)?t:t.$ref;return z1.push({property:e,selector:n,source:r}),null}function Tu(){return`const __jxEnumAttrs = new Set(${JSON.stringify(uw())});
133
+ function ${_i}(n, v) {
133
134
  if (typeof v !== 'boolean') return v;
134
135
  const l = n.toLowerCase();
135
136
  if (l.startsWith('aria-') || __jxEnumAttrs.has(l)) return String(v);
136
137
  return v ? '' : null;
137
- }`}function fu(){return[`async function ${w$}(url, args) {`," const r = await fetch(url, {"," method: 'POST',"," headers: { 'Content-Type': 'application/json' },"," body: JSON.stringify(args),"," });"," const text = await r.text();"," let body = null;"," if (text !== '') {"," try { body = JSON.parse(text); } catch (e) { if (r.ok) throw e; }"," }"," if (!r.ok) throw new Error((body && body.error) || text || r.statusText);"," return body;","}"].join(`
138
- `)}function S$(){let e=`new RegExp(${JSON.stringify(Zl.source)}, ${JSON.stringify(Zl.flags)})`,t=`Symbol.for(${JSON.stringify(Dp)})`,n=JSON.stringify(Qa),r=JSON.stringify(Ql);return[`const __jxSlotWs = ${e};`,`const __jxSlotRec = globalThis[${t}] || (globalThis[${t}] = new WeakMap());`,`function ${Up}(host) {`,` const id = host.getAttribute(${n});`," if (id === null) return Array.from(host.childNodes);",` host.removeAttribute(${n});`,` const open = ${r} + ' ' + id + ' ';`,` const close = '/' + ${r} + ' ' + id;`," const openers = [];"," const w = host.ownerDocument.createTreeWalker(host, 128);"," for (let n = w.nextNode(); n; n = w.nextNode()) if (n.data.startsWith(open)) openers.push(n);"," const out = [];"," for (const o of openers) {"," const name = decodeURIComponent(o.data.slice(open.length));"," for (let n = o.nextSibling; n; n = n.nextSibling) {"," if (n.nodeType === 8 && n.data === close) break;"," __jxSlotRec.set(n, name);"," out.push(n);"," }"," }"," return out;","}",`function ${Bp}(host, captured) {`," const slots = Array.from(host.querySelectorAll('slot'));"," if (slots.length === 0) return;"," const groups = new Map();"," for (const n of captured) {"," if (n.nodeType === 3 && __jxSlotWs.test(n.data)) continue;"," const r = __jxSlotRec.get(n);"," __jxSlotRec.delete(n);"," const name = r !== undefined ? r : n.nodeType === 1 ? n.getAttribute('slot') || '' : '';"," let g = groups.get(name);"," if (!g) { g = []; groups.set(name, g); }"," g.push(n);"," }"," const taken = new Set();"," for (const slot of slots) {"," const name = slot.getAttribute('name') || '';"," let g = [];"," if (!taken.has(name)) { taken.add(name); g = groups.get(name) || []; }"," const content = g.some((n) => n.nodeType === 1 || (n.nodeType === 3 && n.data !== ''));"," const placed = content ? g : g.concat(Array.from(slot.childNodes));"," const p = slot.parentElement;"," if (p && p !== host && p.localName.includes('-')) {"," const r = __jxSlotRec.get(slot);"," const f = r !== undefined ? r : slot.getAttribute('slot') || '';"," for (const n of placed) __jxSlotRec.set(n, f);"," }"," slot.replaceWith(...placed);"," }","}"].join(`
139
- `)}function xs(e){for(let t of zp(e)){if(at(t)){if(t.map&&xs([t.map]))return!0;continue}if(!nn(t))continue;if(t.tagName==="slot")return!0;let n=Object.values(t.cases??{}).filter((r)=>nn(r)&&!cn(r));if(xs(n)||xs(t.children))return!0}return!1}function zp(e){if(at(e))return[e];if(!Array.isArray(e))return[];return e}function Ci(e,t={},n=null){let r=[],s=c$(D(n)?n:{},t,(i)=>i,$$);if(s!=="")r.push(s);if(bs(e,r,t,"",{n:0}),r.length===0)return"";return`<style>
140
- ${du(r.join(`
138
+ }`}function kw(){return[`function ${Bh}(el, k) {`," if (Object.hasOwn(el, k)) return true;"," if (el.hasAttribute(k)) return true;"," const kebab = k.replace(/[A-Z]/g, (c) => '-' + c.toLowerCase());"," return kebab !== k && el.hasAttribute(kebab);","}",`function ${zh}(el, k) {`," for (let p = Object.getPrototypeOf(el); p; p = Object.getPrototypeOf(p)) {"," const d = Object.getOwnPropertyDescriptor(p, k);"," if (d) return d.set;"," }"," return undefined;","}"].join(`
139
+ `)}function Ow(){return[`function ${Ju}(state, name, value, defaults) {`," const key = name.replace(/-([a-z])/g, (_, c) => c.toUpperCase());"," if (defaults && defaults.has(key) && defaults.get(key) === undefined) return;"," const current = state[key];"," if (typeof current === 'boolean') {"," state[key] = value !== null && value !== 'false';"," return;"," }"," if (value === null) {"," const declared = defaults ? defaults.get(key) : undefined;"," state[key] = declared === undefined ? (typeof current === 'number' ? 0 : '') : declared;"," return;"," }"," state[key] = typeof current === 'number' ? Number(value) : value;","}"].join(`
140
+ `)}function Aw(e){return e.replaceAll(/-([a-z])/g,(t,n)=>n.toUpperCase())}function cc(e){let{observedAttributes:t}=e;return Array.isArray(t)?t.filter((n)=>k(n)):[]}function Cw(e){let t=fm(e),n=new Set(cc(e).map((s)=>Aw(s)));return`new Map([${[...t].flatMap(([s,o])=>n.has(s)?[`[${JSON.stringify(s)}, ${o===void 0?"undefined":JSON.stringify(o)}]`]:[]).join(", ")}])`}function Iu(){return[`async function ${Rw}(url, args) {`," const r = await fetch(url, {"," method: 'POST',"," headers: { 'Content-Type': 'application/json' },"," body: JSON.stringify(args),"," });"," const text = await r.text();"," let body = null;"," if (text !== '') {"," try { body = JSON.parse(text); } catch (e) { if (r.ok) throw e; }"," }"," if (!r.ok) throw new Error((body && body.error) || text || r.statusText);"," return body;","}"].join(`
141
+ `)}function Kh(e){let t={};for(let[n,r]of Object.entries(e))if(!K1.has(n)&&r!==void 0)t[n]=r;return t}function Gh(e){return yn(e)&&!G1.has(e.$prototype)}function ki(e){return Gh(e)&&e.timing==="client"}function Du(){return[`async function ${Nw}(C, name, config) {`,` if (typeof C !== 'function') throw new TypeError('Jx: "' + name + '" is not a class');`," const i = new C(config);"," const v = typeof i.resolve === 'function' ? await i.resolve() : 'value' in i ? i.value : i;"," return [v, i];","}"].join(`
142
+ `)}function Mu(e,t){let n=[],r=new Map;for(let[s,o]of Object.entries(e)){if(!ki(o))continue;if(t===void 0)throw Error(`"${s}": external class "${o.$prototype}" with timing "client" compiles only in a site build`);let i=t(o),a=r.get(i);if(a===void 0)a=`_JxClass${r.size}`,r.set(i,a);n.push({binding:a,config:Kh(o),key:s,name:o.$prototype})}return{entries:n,imports:[...r].map(([s,o])=>`import ${o} from '${s}';`)}}function Fu(e,t){let{indent:n,instances:r,statePrefix:s}=t,o=["Promise.all(["];for(let{binding:i,config:a,key:c,name:l}of e){let u=Re(s,qt(c)),d=JSON.stringify(c);o.push(`${n} ${Nw}(${i}, ${JSON.stringify(l)}, ${JSON.stringify(a)}).then(([v, i]) => {`,`${n} ${u} = v;`,`${n} ${r}.set(${d}, i);`,`${n} if (typeof i.subscribe === 'function') i.subscribe((n) => { ${u} = n; });`,`${n} }).catch((e) => { console.error(${JSON.stringify(`Jx: external class "${c}" failed`)}, e); }),`)}return o.push(`${n}])`),o.join(`
143
+ `)}function Tw(){let e=`new RegExp(${JSON.stringify(fu.source)}, ${JSON.stringify(fu.flags)})`,t=`Symbol.for(${JSON.stringify(pm)})`,n=JSON.stringify(Ya),r=JSON.stringify(du);return[`const __jxSlotWs = ${e};`,`const __jxSlotRec = globalThis[${t}] || (globalThis[${t}] = new WeakMap());`,`function ${Xh}(host) {`,` const id = host.getAttribute(${n});`," if (id === null) return Array.from(host.childNodes);",` host.removeAttribute(${n});`,` const open = ${r} + ' ' + id + ' ';`,` const close = '/' + ${r} + ' ' + id;`," const openers = [];"," const w = host.ownerDocument.createTreeWalker(host, 128);"," for (let n = w.nextNode(); n; n = w.nextNode()) if (n.data.startsWith(open)) openers.push(n);"," const out = [];"," for (const o of openers) {"," const name = decodeURIComponent(o.data.slice(open.length));"," for (let n = o.nextSibling; n; n = n.nextSibling) {"," if (n.nodeType === 8 && n.data === close) break;"," __jxSlotRec.set(n, name);"," out.push(n);"," }"," }"," return out;","}",`function ${Yh}(host, captured) {`," const slots = Array.from(host.querySelectorAll('slot'));"," if (slots.length === 0) return;"," const groups = new Map();"," for (const n of captured) {"," if (n.nodeType === 3 && __jxSlotWs.test(n.data)) continue;"," const r = __jxSlotRec.get(n);"," __jxSlotRec.delete(n);"," const name = r !== undefined ? r : n.nodeType === 1 ? n.getAttribute('slot') || '' : '';"," let g = groups.get(name);"," if (!g) { g = []; groups.set(name, g); }"," g.push(n);"," }"," const taken = new Set();"," for (const slot of slots) {"," const name = slot.getAttribute('name') || '';"," let g = [];"," if (!taken.has(name)) { taken.add(name); g = groups.get(name) || []; }"," const content = g.some((n) => n.nodeType === 1 || (n.nodeType === 3 && n.data !== ''));"," const placed = content ? g : g.concat(Array.from(slot.childNodes));"," const p = slot.parentElement;"," if (p && p !== host && p.localName.includes('-')) {"," const r = __jxSlotRec.get(slot);"," const f = r !== undefined ? r : slot.getAttribute('slot') || '';"," for (const n of placed) __jxSlotRec.set(n, f);"," }"," slot.replaceWith(...placed);"," }","}"].join(`
144
+ `)}function ws(e){for(let t of Zh(e)){if(nt(t)){if(t.map&&ws([t.map]))return!0;continue}if(!tn(t))continue;if(t.tagName==="slot")return!0;let n=Object.values(t.cases??{}).filter((r)=>tn(r)&&!Mt(r));if(ws(n)||ws(t.children))return!0}return!1}function Zh(e){if(nt(e))return[e];if(!Array.isArray(e))return[];return e}function Ai(e,t={},n=null){let r=[],s=gw(I(n)?n:{},t,(i)=>i,_w,void 0,{comments:!0});if(s!=="")r.push(s);if(qu(e,r,t,"",{n:0}),r.length===0)return"";return`<style>
145
+ ${Lu(r.join(`
141
146
  `))}
142
- </style>`}function du(e){return e.replaceAll(/<\/(?=style)/gi,String.raw`<\/`)}function bs(e,t,n,r="",s,o="jx"){let i=s??{n:0};if(!D(e))return;if(e.style&&!e.id&&!e.className)e.className=`${o}-${i.n}`,i.n+=1;let a=Ho(e.tagName).join(", ")||"*",c=e.id?`#${e.id}`:e.className?`.${e.className.split(" ")[0]}`:a;if(e.style)tu(t,e.style,c,n);if(Array.isArray(e.children))for(let l of e.children)bs(l,t,n,c,i,o);if(D(e.cases))for(let l of Object.values(e.cases))bs(l,t,n,c,i,o)}function Ee(e){return String(e).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#39;")}function pu(e){return e.split("-").map((t)=>t.charAt(0).toUpperCase()+t.slice(1)).join("")}function v$(e){let t=new Set;return E$(e,t),[...t]}function E$(e,t){if(!D(e))return;if(e.state){for(let n of Object.values(e.state))if(jt(n)&&n.$src)t.add(n.$src)}if(Array.isArray(e.children))for(let n of e.children)E$(n,t)}function j$(e){let t=[];return P$(e,t),t}function P$(e,t){if(!D(e))return;if(e.state){for(let[n,r]of Object.entries(e.state))if(Mr(r))t.push({exportName:r.$export,key:n,src:r.$src})}if(Array.isArray(e.children))for(let n of e.children)P$(n,t)}function Gp(e,t){if(k(e))return e;let n=Ho(e);if(n.length===0)return"div";if(!or(e))return n[0];let r=e.$expression,s=r.target;if(r.operator==="?:")return Be(s,t)?r.value:r.initial;let o=Be(s,t);return r.cases[String(o)]??r.default}function Xp(e){if(!e?.slotIds)return null;return e.slotIds.n+=1,e.slotIds.n}function Yp(e,t,n,r=null){let s=new Map;for(let o of zp(e)){let i="",a=!0,c;if(k(o)||St(o)||Mt(o)){if(c=n(o),Zl.test(c))continue;a=c!==""}else if(at(o))c="";else if(!nn(o))c=n(o),a=c!=="";else{let u=Be(o.attributes?.slot,t),d=k(o.slot)?Be(o.slot,t):null;if(k(u)&&u!=="")i=u,c=n(o);else if(k(d)&&d!==""){i=d;let{slot:p,...m}=o;c=n({...m,attributes:{...m.attributes,slot:d}})}else c=n(o)}let l=s.get(i);if(l)l.html=l.html===""?c:`${l.html}
143
- ${c}`,l.content||=a;else s.set(i,{content:a,html:c})}return{groups:s,id:r,taken:new Set}}function _$(e,t,n){for(let r of zp(e)){if(at(r)||!nn(r))continue;if(r.tagName==="slot"){let s=Be(r.attributes?.name,t);n.taken.add(k(s)?s:"")}_$(r.children,t,n)}}function Zp(e){let t=null,n={};for(let[r,s]of Object.entries(e??{}))if(r.startsWith("props.")&&r.length>6)t??={},t[r.slice(6)]=s;else n[r]=s;return{lifted:t,rest:n}}function mu(e,t){if(!t)return ji(e.state??{},null);let n={...e.state};for(let[r,s]of Object.entries(t)){let o=n[r];n[r]=D(o)&&!Array.isArray(o)&&"default"in o?{...o,default:s}:s}return ji(n,null)}function Qp(e,t){return Object.fromEntries(Object.entries(e??{}).flatMap(([n,r])=>{if(!me(r))return[];let s=Be(r,t);return s==null?[]:[[n,s]]}))}function tc(e,t,n,r){if(e.textContent!==void 0){let s=Be(e.textContent,t);return s!=null?Ee(String(s)):""}if(e.innerHTML){let s=Be(e.innerHTML,t);return s!=null?String(s):e.innerHTML}if(Array.isArray(e.children))return e.children.map((s)=>Pi(s,t,n,r)).join(`
144
- `);return""}function Pi(e,t,n=null,r=null){if(k(e)){if(me(e)&&t){let a=Vt(e,t);return a!=null?Ee(String(a)):Ee(e)}return Ee(e)}if(St(e)||Mt(e))return Ee(String(e));if(Array.isArray(e))return e.map((a)=>Pi(a,t,n,r)).join(`
145
- `);if(!D(e))return"";if(e.$prototype==="Array")return"";if(e.$switch){let a=e.tagName??"div",c=Oo(e,t),l=Be(e.$switch,t),u=l==null?void 0:e.cases?.[String(l)],d=u!==void 0&&!cn(u)?Pi(u,t,n,r):"";return`<${a}${c}>${d}</${a}>`}let s=Gp(e.tagName,t);if(s==="slot"&&n){let a=Be(e.attributes?.name,t),c=k(a)?a:"",l;if(!n.taken.has(c))n.taken.add(c),l=n.groups.get(c);let u=l?.html??"";if(u!==""&&n.id!==null)u=`<!--${Ql} ${n.id} ${encodeURIComponent(c)}-->${u}<!--/${Ql} ${n.id}-->`;if(l?.content)return _$(e.children,t,n),u;let d=tc(e,t,n,r);return u===""?d:d===""?u:`${u}
146
- ${d}`}let o=r?.componentDefs.get(s);if(o&&r)return MJ(e,o,t,n,r);let i=Oo(e,t);if(Kp.has(s))return`<${s}${i}>`;return`<${s}${i}>${tc(e,t,n,r)}</${s}>`}function MJ(e,t,n,r,s){let o=t.tagName,{lifted:i,rest:a}=Zp(e.attributes),c={...i,...e.$props},l={};for(let[F,K]of Object.entries(c))l[F]=Be(K,n)??K;let u=Object.keys(l).length>0,d=s.path??[],p={key:JSON.stringify(l),tag:o},m=[...d.map((F)=>F.tag),o].join(" → ");if(d.some((F)=>F.tag===p.tag&&F.key===p.key))throw Error(`Component <${o}> renders itself: ${m}. A component cannot appear inside its own `+"definition with the same props — the expansion would never end.");if(d.length>=Mp)throw Error(`Component nesting exceeds ${Mp} levels: ${m}. A component that renders itself with changing props needs a case that stops.`);let x={...s,path:[...d,p]},{children:h}=e,g=(F)=>Pi(F,n,r,s),b=ko(t,s.defaults),j=hu(t),v=mu(t,u?l:null),P,S=null;if(b){let F=Array.isArray(h)?h.map((K)=>g(K)).join(`
147
- `):"";P=`<template shadowrootmode="${b}"><link rel="stylesheet" href="/components/${o}.css">${tc(t,v,null,x)}</template>${F}`}else{S=!j&&xs(t.children)?Xp(s):null;let F=Yp(h,n,g,S);P=tc(t,v,F,x)}let _=Object.entries(Qp(t.style,v)).map(([F,K])=>`${an(F)}: ${K}`).join("; "),N={...e};if(delete N.$props,delete N.children,N.attributes=!j&&u?{...a,"data-jx-props":JSON.stringify(l)}:a,S!==null)N.attributes={...N.attributes,[Qa]:String(S)};if(j)N.$static=!0;else N.$prerendered=!0;return`<${o}${Oo(N,n,_)}>${P}</${o}>`}function k$(e,t=null,n=null,r=null){return tc(e,mu(e,t),n,r)}function hu(e){return qp(e)}function qp(e){if(!D(e))return!0;if(Array.isArray(e))return e.every((t)=>qp(t));if(e.$prototype)return!1;if(e.$ref)return!1;if(e.state)for(let t of Object.values(e.state)){if(!D(t)||Array.isArray(t))continue;if(t.$prototype)return!1;if(t.$ref)return!1}for(let t of Object.keys(e))if(t.startsWith("on")&&t!=="observedAttributes")return!1;if(Array.isArray(e.children))return e.children.every((t)=>qp(t));if(at(e.children))return!1;return!0}function FJ(e,t){return Ga(e).map((n)=>LJ(n,t)).join(", ")}function LJ(e,t){let n=Ul(e,t);if(n!==null)return n;if(e.startsWith(":host")){let r=/^:host\((.*)\)$/.exec(e)?.[1];if(t===":host")return e;return r===void 0?t:`${t}${r}`}if(t===":host"&&DJ.test(e))return e;return`${t}${e}`}function O$(e,t,n=null,r={},s=null){let o=[],i=f$(e,s);if(D(t)){let a={},c=[];for(let[l,u]of Object.entries(t))if(Ne(u))a[l]=u;else if(D(u)&&!Array.isArray(u))c.push([l,u]);else if(!l.startsWith("@")&&!ys(l))a[l]=u;tu(o,a,i,r);for(let[l,u]of c)if(l.startsWith("@"))tu(o,{[l]:u},i,r);else if(ys(l))tu(o,u,FJ(l,i),r)}if(n&&Array.isArray(n.children)){let a={n:0};for(let c of n.children)bs(c,o,r,"",a,e)}return o.length>0?`${o.join(`
147
+ </style>`}function Lu(e){return e.replaceAll(/<\/(?=style)/gi,String.raw`<\/`)}function _s(e){return e[Jw]}function Iw(e,t,n){let r=_s(e);if(r!==void 0)return r;let s=`${n}-${t.n}`;return t.n+=1,e[Jw]=s,s}function Vu(e){let{children:t}=e;if(Array.isArray(t))return t;return nt(t)?[t]:[]}function sc(e,t){if(!I(e))return;if(nt(e)){if(e.map)sc(e.map,t);return}t(e);for(let n of Vu(e))sc(n,t);if(I(e.cases))for(let n of Object.values(e.cases))sc(n,t)}function Dw(e,t,n){sc(e,(r)=>{if(r.style)Iw(r,t,n)})}function lc(e){return _s(e)!==void 0||Boolean(e.className)}function uc(e){let{attributes:t}=e;return I(t)&&Object.hasOwn(t,"class")?t.class:e.className}function qu(e,t,n,r="",s,o="jx"){let i=s??{n:0};sc(e,(a)=>{if(a.style)ju(t,a.style,`.${Iw(a,i,o)}`,n)})}function ve(e){return String(e).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#39;")}function Wu(e){return e.split("-").map((t)=>t.charAt(0).toUpperCase()+t.slice(1)).join("")}function Mw(e){let t=new Set;return Fw(e,t),[...t]}function Fw(e,t){if(!I(e))return;if(e.state){for(let n of Object.values(e.state))if(kt(n)&&n.$src)t.add(n.$src)}if(Array.isArray(e.children))for(let n of e.children)Fw(n,t)}function Lw(e){let t=[];return Vw(e,t),t}function Vw(e,t){if(!I(e))return;if(e.state){for(let[n,r]of Object.entries(e.state))if(Mr(r))t.push({exportName:r.$export,key:n,src:r.$src})}if(Array.isArray(e.children))for(let n of e.children)Vw(n,t)}function eg(e,t){if(k(e))return e;let n=xa(e);if(n.length===0)return"div";if(!lr(e))return n[0];let r=e.$expression,s=r.target;if(r.operator==="?:")return Le(s,t)?r.value:r.initial;let o=Le(s,t);return r.cases[String(o)]??r.default}function tg(e){if(!e?.slotIds)return null;return e.slotIds.n+=1,e.slotIds.n}function ng(e,t,n,r=null){let s=new Map;for(let o of Zh(e)){let i="",a=!0,c;if(k(o)||We(o)||bt(o)){if(c=n(o),fu.test(c))continue;a=c!==""}else if(nt(o))c="";else if(!tn(o))c=n(o),a=c!=="";else{let u=Le(o.attributes?.slot,t),d=k(o.slot)?Le(o.slot,t):null;if(k(u)&&u!=="")i=u,c=n(o);else if(k(d)&&d!==""){i=d;let{slot:p,...m}=o;c=n({...m,attributes:{...m.attributes,slot:d}})}else c=n(o)}let l=s.get(i);if(l)l.html=l.html===""?c:`${l.html}
148
+ ${c}`,l.content||=a;else s.set(i,{content:a,html:c})}return{groups:s,id:r,taken:new Set}}function qw(e,t,n){for(let r of Zh(e)){if(nt(r)||!tn(r))continue;if(r.tagName==="slot"){let s=Le(r.attributes?.name,t);n.taken.add(k(s)?s:"")}qw(r.children,t,n)}}function rg(e){let t=null,n={};for(let[r,s]of Object.entries(e??{}))if(r.startsWith("props.")&&r.length>6)t??={},t[r.slice(6)]=s;else n[r]=s;return{lifted:t,rest:n}}function fc(e,t){if(!t)return wi(e.state??{},null);let n={...e.state};for(let[r,s]of Object.entries(t)){let o=n[r];n[r]=I(o)&&!Array.isArray(o)&&"default"in o?{...o,default:s}:s}return wi(n,null)}function sg(e,t,n){let r=cc(e).filter((a)=>Object.hasOwn(t??{},a));if(!t||r.length===0)return null;let s=fm(e),o=fc(e,null),i=null;for(let a of r){let c=Le(t[a],n),l=null;if(bt(c))l=Ss(a,c);else if(k(c)||We(c))l=String(c);let u=Aw(a);if(l===null||s.has(u)&&s.get(u)===void 0)continue;fw(o,a,l,s),i??={},i[u]=o[u]}return i}function og(e,t){return Object.fromEntries(Object.entries(e??{}).flatMap(([n,r])=>{if(!me(r))return[];let s=Le(r,t);return s==null?[]:[[n,s]]}))}function oc(e,t,n,r){if(e.textContent!==void 0){let s=Le(e.textContent,t);return s!=null?ve(String(s)):""}if(e.innerHTML){let s=Le(e.innerHTML,t);return s!=null?String(s):e.innerHTML}if(Array.isArray(e.children))return e.children.map((s)=>vi(s,t,n,r)).join(`
149
+ `);return""}function vi(e,t,n=null,r=null){if(k(e)){if(me(e)&&t){let a=Wt(e,t);return a!=null?ve(String(a)):ve(e)}return ve(e)}if(We(e)||bt(e))return ve(String(e));if(Array.isArray(e))return e.map((a)=>vi(a,t,n,r)).join(`
150
+ `);if(!I(e))return"";if(e.$prototype==="Array")return"";if(e.$switch){let a=e.tagName??"div",c=Co(e,t),l=Le(e.$switch,t),u=l==null?void 0:e.cases?.[String(l)],d=u!==void 0&&!Mt(u)?vi(u,t,n,r):"";return`<${a}${c}>${d}</${a}>`}let s=eg(e.tagName,t);if(s==="slot"&&n){let a=Le(e.attributes?.name,t),c=k(a)?a:"",l;if(!n.taken.has(c))n.taken.add(c),l=n.groups.get(c);let u=l?.html??"";if(u!==""&&n.id!==null)u=`<!--${du} ${n.id} ${encodeURIComponent(c)}-->${u}<!--/${du} ${n.id}-->`;if(l?.content)return qw(e.children,t,n),u;let d=oc(e,t,n,r);return u===""?d:d===""?u:`${u}
151
+ ${d}`}let o=r?.componentDefs.get(s);if(o&&r)return X1(e,o,t,n,r);let i=Co(e,t);if(Qh.has(s))return`<${s}${i}>`;return`<${s}${i}>${oc(e,t,n,r)}</${s}>`}function X1(e,t,n,r,s){let o=t.tagName,{lifted:i,rest:a}=rg(e.attributes),c={...i,...e.$props},l={};for(let[H,A]of Object.entries(c))l[H]=Le(A,n)??A;let u=Object.keys(l).length>0,d={...sg(t,a,n),...l},p=Object.keys(d).length>0,m=s.path??[],x={key:JSON.stringify(d),tag:o},g=[...m.map((H)=>H.tag),o].join(" → ");if(m.some((H)=>H.tag===x.tag&&H.key===x.key))throw Error(`Component <${o}> renders itself: ${g}. A component cannot appear inside its own `+"definition with the same props — the expansion would never end.");if(m.length>=dm)throw Error(`Component nesting exceeds ${dm} levels: ${g}. A component that renders itself with changing props needs a case that stops.`);let y={...s,path:[...m,x]},{children:S}=e,E=(H)=>vi(H,n,r,s),v=Ao(t,s.defaults),j=Hu(t),P=fc(t,p?d:null),O,T=null;if(v){let H=Array.isArray(S)?S.map((A)=>E(A)).join(`
152
+ `):"";O=`<template shadowrootmode="${v}"><link rel="stylesheet" href="/components/${o}.css">${oc(t,P,null,y)}</template>${H}`}else{T=!j&&ws(t.children)?tg(s):null;let H=ng(S,n,E,T);O=oc(t,P,H,y)}let U=Object.entries(og(t.style,P)).map(([H,A])=>`${on(H)}: ${A}`).join("; "),F={...e};if(delete F.$props,delete F.children,F.attributes=!j&&u?{...a,"data-jx-props":JSON.stringify(l)}:a,T!==null)F.attributes={...F.attributes,[Ya]:String(T)};if(j)F.$static=!0;else F.$prerendered=!0;return`<${o}${Co(F,n,U)}>${O}</${o}>`}function Ww(e,t=null,n=null,r=null){return oc(e,fc(e,t),n,r)}function Hu(e){if(cc(e).length>0)return!1;return Wh(e)}function Wh(e){if(!I(e))return!0;if(Array.isArray(e))return e.every((t)=>Wh(t));if(e.$prototype)return!1;if(e.$ref)return!1;if(e.state)for(let t of Object.values(e.state)){if(!I(t)||Array.isArray(t))continue;if(t.$prototype)return!1;if(t.$ref)return!1}for(let t of Object.keys(e))if(t.startsWith("on")&&t!=="observedAttributes")return!1;if(Array.isArray(e.children))return e.children.every((t)=>Wh(t));if(nt(e.children))return!1;return!0}function Z1(e,t){return Ba(e).map((n)=>Q1(n,t)).join(", ")}function Q1(e,t){let n=su(e,t);if(n!==null)return n;if(e.startsWith(":host")){let r=/^:host\((.*)\)$/.exec(e)?.[1];if(t===":host")return e;return r===void 0?t:`${t}${r}`}if(t===":host"&&Y1.test(e))return e;return`${t}${e}`}function Hw(e,t,n=null,r={},s=null){let o=[],i=bw(e,s);if(I(t)){let a={},c=[];for(let[l,u]of Object.entries(t))if(Ce(u))a[l]=u;else if(I(u)&&!Array.isArray(u))c.push([l,u]);else if(!l.startsWith("@")&&!bs(l))a[l]=u;ju(o,a,i,r);for(let[l,u]of c)if(l.startsWith("@"))ju(o,{[l]:u},i,r);else if(bs(l))ju(o,u,Z1(l,i),r)}if(n){let a={n:0};for(let c of Vu(n))qu(c,o,r,"",a,e)}return o.length>0?`${o.join(`
148
153
  `)}
149
- `:""}var PJ,h$,$s="https://esm.sh/@vue/reactivity@3.5.40",ws="https://esm.sh/lit-html@3.3.0",ec,kJ,AJ,RJ,CJ,NJ,vs,IJ,Ai="__jxAttrText",w$="__jxServerCall",Up="__jxCaptureSlotted",Bp="__jxDistributeSlots",Ri="<!---->",Kp,DJ;var hr=T(()=>{za();Ei();Ya();xi();Xl();l$();le();hi();Ei();xi();Xl();le();xi();PJ=["$map/","event#/","$args/","$reduce/"];h$=Symbol("jx.runtimeOnlyStateKeys"),ec=String.raw`(?:\s|\\[nrt])*`,kJ=new RegExp(String.raw`(?:=|\.\.\.)${ec}state[ \t]*(?:[;,)}\]"]|\\[nr])`);AJ=/\bstate\.([A-Za-z_$][\w$]*)\s*(?:\+\+|--|(?:\*\*|\|\||&&|\?\?|<<|>>>|>>|[-+*/%&|^])?=(?!=))/g,RJ=/\bstate\.([A-Za-z_$][\w$]*)\s*\.\s*(?:push|pop|shift|unshift|splice|sort|reverse|fill|copyWithin)\s*\(/g,CJ=/[\w$.]/u,NJ=/[\w$]/u;vs=new Set(["pre","textarea","listing","plaintext","xmp"]);IJ=[];Kp=new Set(["input","br","hr","img","meta","link","area","col","source"]);DJ=/^(?:::slotted\(|::part\()/});import{relative as VJ,sep as qJ}from"node:path";function sc(e){return e===WJ}function Ni(e,t){if(e==="/")return"/";if(t==="always")return e.endsWith("/")?e:`${e}/`;if(t==="never")return e.replace(/\/+$/,"")||"/";return e}function gu(e,t){let n=new RegExp(`\\s${t}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s"'>]+))`,"i").exec(e);return n===null?null:n[1]??n[2]??n[3]??""}function A$(e){let t=e.search(/<\/head\s*>/i),n=t===-1?e:e.slice(0,t);for(let[r]of n.matchAll(/<meta\b[^>]*>/gi)){if(gu(r,"name")?.trim().toLowerCase()!=="robots")continue;let s=new Set((gu(r,"content")??"").toLowerCase().split(",").map((o)=>o.trim()));if(s.has("noindex")||s.has("none"))return!0}return!1}function R$(e){let t=e.search(/<\/head\s*>/i);return{end:t,head:t===-1?e:e.slice(0,t)}}function HJ(e,t){let n=t.trim().toLowerCase();for(let[r]of R$(e).head.matchAll(/<link\b[^>]*>/gi)){let s=(gu(r,"rel")??"").toLowerCase().split(/\s+/),o=(gu(r,"type")??"").split(";")[0]?.trim().toLowerCase();if(s.includes("alternate")&&o===n)return!0}return!1}function C$(e,t){let{end:n}=R$(e);if(n===-1||HJ(e,t.type))return e;let r=`<link href="${Ee(t.href)}" rel="alternate" type="${Ee(t.type)}">`;return`${e.slice(0,n)}${r}
150
- ${e.slice(n)}`}function N$(e,t){return new URL(`/${VJ(e,t).split(qJ).join("/")}`,"http://localhost").pathname}var WJ="/404";var em=T(()=>{hr()});function T$(e,t){if(t===null||t.routing!=="prefix-always")return[];let n=[];for(let r of e){if(r.urlPattern==="/")continue;let s=r.urlPattern.split("/").find(Boolean),o=Tn(s);if(o===null||!t.locales.includes(o))n.push(r.urlPattern)}return n}function J$(e,t){if(t===null)return null;let n=e.split("/").find(Boolean),r=Tn(n);if(n===void 0||r===null||t.locales.includes(r))return null;let s=t.locales.find((o)=>o!==r&&o.split("-")[0]===r.split("-")[0]);return s===void 0?null:{meant:s,segment:n}}function UJ(e,t){let n=e.split("/").filter(Boolean),r=Tn(n[0]);if(t!==null&&r!==null&&t.locales.includes(r))return n.slice(1).join("/");return n.join("/")}function tm(e,t){let n=new Map,r=[];if(t===null)return{conflicts:r,sets:n};let s=new Map,o=new Set;for(let i of e){let a=i.translationKey===void 0?UJ(i.urlPattern,t):i.translationKey.replaceAll(/^\/+|\/+$/g,"");if(i.translationKey!==void 0)o.add(i.urlPattern);let c=Xn(i.urlPattern,t);if(c===null)continue;let l=s.get(a)??[],u=l.find((d)=>d.locale===c);if(u===void 0)l.push({locale:c,urlPattern:i.urlPattern});else r.push({declared:o.has(u.urlPattern)||i.translationKey!==void 0,key:a,locale:c,urlPatterns:[u.urlPattern,i.urlPattern]});s.set(a,l)}for(let i of s.values()){let a=i.toSorted((c,l)=>c.locale===l.locale?0:c.locale<l.locale?-1:1);for(let c of i)n.set(c.urlPattern,a)}return{conflicts:r,sets:n}}function I$(e,t,n,r){let s=new Map;if(t===null||n==="")return s;let o=new Map;for(let[i,a]of tm(e,t).sets){if(a.length<2)continue;let c=o.get(a);if(c===void 0){c=a.map((u)=>({href:hs(Ni(u.urlPattern,r),n),hreflang:u.locale}));let l=a.find((u)=>u.locale===t.defaultLocale);if(l!==void 0)c.push({href:hs(Ni(l.urlPattern,r),n),hreflang:"x-default"});o.set(a,c)}s.set(i,c)}return s}function M$({pageLang:e,pageDir:t,routeLocale:n,defaults:r}){let s=e??n??r?.lang??"en",o=t??r?.dir;if(o!==void 0)return{dir:o,lang:s};return Ua(s)==="rtl"?{dir:"rtl",lang:s}:{lang:s}}var nm=T(()=>{$n();Eo();em();Eo();Eo()});function D$(e,t,n,r=null,s=null,o=[]){if(!e.state)e.state={};let i={};if(s!==null)i.defaultLocale=s.defaultLocale,i.locales=s.locales;e.state.$site={...Object.fromEntries(Object.entries(t.state??{}).filter(([u])=>!BJ.has(u))),name:t.name??"Jx Site",url:t.url??"",...i};let a=(k(e.$lang)?e.$lang:void 0)??Xn(n.urlPattern,s)??t.defaults?.lang,c=o.map((u)=>({code:u.locale,current:u.urlPattern===n.urlPattern,dir:Ua(u.locale),label:Db(u.locale),url:u.urlPattern})),l={params:n._pathParams??{},title:e.title??e._pageTitle??t.name??"",url:n.urlPattern};if(c.length>0)l.alternates=c;if(n.pagination){let{first:u,itemCount:d,last:p,next:m,number:x,pageCount:h,pageSize:g,pages:b,prev:j}=n.pagination;l.pagination={first:u,itemCount:d,last:p,next:m,number:x,pageCount:h,pageSize:g,pages:b.map(({current:v,number:P,url:S})=>({current:v,number:P,url:S})),prev:j}}if(a!==void 0)l.dir=Ua(a),l.locale=a;if(e.state.$page=l,t.state){for(let[u,d]of Object.entries(t.state))if(u!=="$site"&&u!=="$page"&&!(u in e.state))e.state[u]=d}if(t.$media)e.$media={...t.$media,...e.$media};if(t.imports&&Object.keys(t.imports).length>0){if(!e.imports)e.imports={};for(let[u,d]of Object.entries(t.imports))if(!(u in e.imports))e.imports[u]=r&&(d.startsWith("./")||d.startsWith("../"))?r(d,n):d}if(t.$elements?.length)if(!e.$elements?.length)e.$elements=[...t.$elements];else{let u=new Set,d=[];for(let p of[...t.$elements,...e.$elements]){let m=k(p)?p:D(p)?p.$ref:void 0;if(m&&!u.has(m))u.add(m),d.push(p)}e.$elements=d}return e}var BJ;var F$=T(()=>{le();Eo();BJ=new Set(["defaultLocale","locales","name","url"])});import{dirname as zJ,relative as KJ,resolve as GJ}from"node:path";function rm(e){return(t,n)=>{if(!n.sourcePath)return t;return`./${KJ(zJ(n.sourcePath),GJ(e,t))}`}}function L$(e,t,n,r=null,s=null,o=[]){return D$(e,t,n,r===null?null:rm(r),s,o)}var sm=T(()=>{F$()});import{readFileSync as XJ}from"node:fs";import{dirname as om,resolve as yu}from"node:path";import{createRequire as YJ}from"node:module";function e1(e){return At(e.resolve)}async function xu(e,t,n,r={}){let s=e.imports??{},{state:o}=e;if(!o)return;for(let[i,a]of Object.entries(o)){if(!_n(a))continue;if(ZJ.has(a.$prototype))continue;if(a.timing&&a.timing!=="compiler"){let c=r.registry?.byName(a.$prototype);if(c?.capabilities.lower)try{let l=await c.call("lower",a,{projectConfig:r.config,root:n,route:t});if(V(l)){let u=l.$bundle;if(Array.isArray(u)){for(let d of u)if(k(d))r.registerBundle?.(d)}delete l.$bundle}o[i]=l}catch(l){console.warn(`prototype-resolver: failed to lower "${i}" ($prototype: "${a.$prototype}"):`,$e(l))}continue}if(!a.$src){let c=s[a.$prototype]??t1(r,a.$prototype);if(!c)continue;a.$src=c}try{let c=await n1(a,t,n,o,r);if(a.timing&&V(c))c.timing=a.timing;o[i]=c}catch(c){console.warn(`prototype-resolver: failed to resolve "${i}" ($prototype: "${a.$prototype}"):`,$e(c))}}}function t1(e,t){return e.registry?.byName(t)?.classPath}async function n1(e,t,n,r,s){let o=e.$src;if(!o)throw Error(`$prototype "${e.$prototype}" has no $src to resolve`);let i;if(o.startsWith("./")||o.startsWith("../"))i=t.sourcePath?yu(om(t.sourcePath),o):yu(n,o);else i=YJ(yu(n,"package.json")).resolve(o);let a=XJ(i,"utf8"),c=Zg(a,i);if(!c.$implementation)throw Error(`${o} has no $implementation field`);let l=yu(om(i),c.$implementation),u=await Hd(l),d=e.$export??c.title??e.$prototype,p=u[d]??u.default?.[d];if(!p)throw Error(`Module ${c.$implementation} does not export "${d}"`);let m={};for(let[h,g]of Object.entries(e))if(!QJ.has(h))m[h]=g;if(m.src&&!m.basePath&&t.sourcePath)m.basePath=om(t.sourcePath);m._project={config:s.config??null,root:n,...s.sections},m._document={route:t,state:r};let x=new p(m);if(e1(x))return await x.resolve();return x}var ZJ,QJ;var im=T(()=>{Ur();le();Dt();ZJ=new Set(["Function","LocalStorage","SessionStorage","Array"]),QJ=new Set(["$prototype","$src","$export","timing","default","description"])});import{readFileSync as am,readdirSync as r1,statSync as s1}from"node:fs";import{extname as q$,join as o1,relative as i1,resolve as a1}from"node:path";async function Qr(e,t){let n=am(e,"utf8");if(Wr(e))return ur(Kn(n,e),e);let r=q$(e).toLowerCase(),s=t?.byExtension(r,"parse");if(!s)throw Error(`No format class registered for "${r}" (${e}). Enable an extension providing this format in project.json "extensions", e.g. "@jxsuite/parser".`);return ur(await s.parseDocument(n),e)}async function W$(e,t){let n=new Map,r=new Map;for(let s of e){if(!r.has(s.sourcePath))r.set(s.sourcePath,await l1(s.sourcePath,t));let o=r.get(s.sourcePath);if(o!==null&&o!==void 0)n.set(s.urlPattern,c1(o,s._pathParams))}return n}function c1(e,t){if(!e.includes("${"))return e;return e.replaceAll(/\$\{(\w+)\}/g,(n,r)=>t?.[r]??n)}async function l1(e,t){if(!am(e,"utf8").includes("$translationKey"))return null;let n;try{n=await Qr(e,t)}catch{return null}return k(n.$translationKey)&&n.$translationKey!==""?n.$translationKey:null}async function H$(e,t){let n=[],r=new Set([".json",".jxn",...t?.documentExtensions("page")??[]]);return await U$(e,e,n,r,t),n.sort(Cb),n}async function U$(e,t,n,r,s){let o=r1(e,{withFileTypes:!0});for(let i of o){let a=o1(e,i.name);if(i.isDirectory()){if(i.name.startsWith("_"))continue;await U$(a,t,n,r,s);continue}let c=q$(i.name).toLowerCase();if(!r.has(c))continue;if(i.name.startsWith("_"))continue;let l=i1(t,a);n.push(await u1(l,a,s))}}async function u1(e,t,n){let{isCatchAll:r,isDynamic:s,params:o,urlPattern:i}=Rb(e),a=null;try{let l=(await Qr(t,n)).$layout;if(k(l))a=l}catch{}return{$layout:a,isCatchAll:r,isDynamic:s,params:o,relativePath:e,sourcePath:t,urlPattern:i}}function f1(e){let t=e[bu];if(!V(t))return null;let{mtime:n}=t;return k(n)&&n!==""?n:null}function B$(e){if(e.includes("\x00"))return"has a NUL character";for(let t of e.split("/")){if(t==="."||t==="..")return'has a "." or ".." segment';if(t.includes("\\"))return"has a backslash"}return null}async function z$(e,t,n={},r,s,o,i={}){let a=[],c=(u,d)=>{let p=`Dynamic route ${u.urlPattern}: ${d}`;if(i.errors===void 0)throw Error(p);i.errors.push(p)},l=e.flatMap((u)=>u.isDynamic?[u.urlPattern]:[]);for(let u of e){if(!u.isDynamic){a.push(u);continue}let d;try{d=await Qr(u.sourcePath,r?.formats)}catch{a.push(u);continue}if(!d.$paths){console.warn(`Warning: dynamic route ${u.urlPattern} has no $paths — skipping`);continue}let p;try{p=Tb(d.$paths)}catch(x){c(u,$e(x));continue}if(p!==null){let x=Xn(u.urlPattern,o??null),h=p.each===void 0?[{}]:await V$(p.each,t,n,r,s,x,u,l);for(let g of h){let b=await d1(u,d,p,g,{locale:x,projectConfig:s,projectRoot:t,registry:r,report:c,sections:n});a.push(...b)}continue}let m=await V$(d.$paths,t,n,r,s,Xn(u.urlPattern,o??null),u,l);for(let x of m){let h=u.urlPattern,g={};for(let[P,S]of Object.entries(x)){if(P===bu)continue;g[P]=String(S),h=h.replace(`:${P}`,g[P]),h=h.replace("*",g[P])}let b=B$(h);if(b!==null){console.warn(`Warning: $paths for ${u.urlPattern} produced "${h}", which ${b}; skipping it`);continue}let j=f1(x),v={...u,_pathParams:g,isCatchAll:!1,isDynamic:!1,params:[],urlPattern:h};if(j!==null)v.sourceMtime=j;a.push(v)}}return a}function K$(e,t){let n=e;for(let[r,s]of Object.entries(t)){let o=new RegExp(`:${r.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}(?=/|$)`);n=o.test(n)?n.replace(o,()=>s):n.replace("*",()=>s)}return n}async function d1(e,t,n,r,s){let o={};for(let[x,h]of Object.entries(r))if(x!==bu)o[x]=String(h);let i=e.params.filter((x)=>!(x in o));if(i.length!==1)return s.report(e,`a paged route takes exactly one parameter besides those its each source fills; this one has ${i.length}`),[];let a=i[0];if(t.state?.[n.key]===void 0)return s.report(e,`$paths.paginate names state entry "${n.key}", which this page does not declare`),[];let c=K$(e.urlPattern,o),l=B$(c);if(l!==null)return console.warn(`Warning: $paths for ${e.urlPattern} produced "${c}", which ${l}; skipping it`),[];let u=await m1(t,n.key,e,o,s);if(!Array.isArray(u))return s.report(e,`state entry "${n.key}" did not resolve to an array at build time`),[];let d=p1(u,e.sourcePath),p=pp(u.length,n.pageSize),m=[];for(let x=1;x<=p;x++){let h={...e,_pathParams:{...o,[a]:String(x)},isCatchAll:!1,isDynamic:!1,pagedState:{items:Jb(u,x,n.pageSize),key:n.key},pagination:Ib(c,x,n.pageSize,u.length),params:[],urlPattern:vo(c,x)};if(d!==null)h.sourceMtime=d;m.push(h)}return m}function p1(e,t){let n=null,r=s1(t).mtime.getTime();for(let s of e){let o=V(s)?s[bu]:void 0,i=V(o)?o.mtime:void 0;if(k(i)&&Date.parse(i)>r)r=Date.parse(i),n=i}return n}async function m1(e,t,n,r,s){let o=e.state?.[t];if(o===void 0||Array.isArray(o))return o;let i={},a=rm(s.projectRoot);for(let[u,d]of Object.entries(s.projectConfig?.imports??{}))i[u]=d.startsWith("./")||d.startsWith("../")?a(d,n):d;Object.assign(i,e.imports);let c={imports:i,state:{[t]:structuredClone(o)}},l={_pathParams:r,locale:s.locale,sourcePath:n.sourcePath,urlPattern:K$(n.urlPattern,r)};return await xu(c,l,s.projectRoot,{...s.projectConfig&&{config:s.projectConfig},...s.registry&&{registry:s.registry},sections:s.sections}),c.state?.[t]}async function V$(e,t,n,r,s,o,i,a){if(Array.isArray(e))return e;if("values"in e&&Array.isArray(e.values)){let c=k(e.param)?e.param:"value";return e.values.map((l)=>({[c]:l}))}if("$ref"in e&&k(e.$ref)&&e.$ref){let c=e.$ref,l=a1(t,c),u;try{u=JSON.parse(am(l,"utf8"))}catch(m){return console.warn(`Warning: $paths.$ref could not load "${c}": ${$e(m)}`),[]}if(!Array.isArray(u))return console.warn(`Warning: $paths.$ref "${c}" must be a JSON array`),[];let d=k(e.param)?e.param:"id",p=k(e.field)?e.field:"id";return u.map((m)=>{if(m===null)throw TypeError(`$paths.$ref "${c}" contains a null entry`);return{[d]:(V(m)?m[p]??m.id:void 0)??String(m)}})}for(let c of Object.keys(e)){let l=r?.byPathsDiscriminator(c);if(!l?.project)continue;let u={data:n[l.project.key],locale:o,projectConfig:s,root:t};if(i!==void 0)u.params=i.params,u.urlPattern=i.urlPattern;if(a!==void 0)u.patterns=a;return await l.call("resolvePaths",e,u)}return console.warn("Warning: unrecognized $paths shape — skipping"),[]}var bu="_meta";var cm=T(()=>{pi();le();ds();Dt();Nb();Mb();nm();sm();im()});import{createHash as h1}from"node:crypto";function G$(){return{fontOrigins:new Set,frameOrigins:new Set,imgOrigins:new Set,scriptHashes:new Set,scriptOrigins:new Set,styleOrigins:new Set}}function Ao(e,t){let n=new RegExp(`\\b${t}\\s*=\\s*("([^"]*)"|'([^']*)')`,"i").exec(e);return n?.[2]??n?.[3]}function lm(e){if(e===void 0||!/^https?:\/\//i.test(e))return null;try{return new URL(e).origin}catch{return null}}function v1(e){return`'sha256-${h1("sha256").update(e,"utf8").digest("base64")}'`}function X$(e,t){for(let n of e.matchAll(y1)){let r=n[1]??"",s=Ao(r,"src"),o=(Ao(r,"type")??"").trim().toLowerCase();if(s!==void 0){let i=lm(s);if(i)t.scriptOrigins.add(i);continue}if(g1.has(o))t.scriptHashes.add(v1(n[2]??""))}for(let n of e.matchAll(x1)){let r=n[1]??"",s=(Ao(r,"rel")??"").toLowerCase(),o=Ao(r,"href"),i=lm(o);if(!i)continue;if(s.includes("stylesheet"))t.styleOrigins.add(i);if(S1.test(o??"")||(Ao(r,"as")??"")==="font")t.fontOrigins.add(i)}for(let[n,r]of[[b1,t.imgOrigins],[$1,t.imgOrigins],[w1,t.frameOrigins]])for(let s of e.matchAll(n)){let o=s[1]??"";for(let i of[Ao(o,"src"),...E1(Ao(o,"srcset"))]){let a=lm(i);if(a)r.add(a)}}}function E1(e){return e===void 0?[]:e.split(",").map((t)=>t.trim().split(/\s+/)[0]??"").filter(Boolean)}function j1(e){if(e===!1)return!1;return e==="DENY"?"'none'":"'self'"}function Y$(e){let t=e?.csp;if(t===void 0||t===!1)return null;if(t===!0)return{};if(t==="report-only")return{mode:"report-only"};return t}function Z$(e,t,n="SAMEORIGIN"){let r=(a,c)=>[...a,...c].join(" "),s={"base-uri":"'self'","default-src":"'self'","font-src":r(["'self'"],e.fontOrigins),"form-action":"'self'","frame-ancestors":j1(n),"frame-src":r(["'self'"],e.frameOrigins),"img-src":r(["'self'","data:"],e.imgOrigins),"object-src":"'none'","script-src":r(["'self'",...[...e.scriptHashes].toSorted()],e.scriptOrigins),"style-src":r(["'self'","'unsafe-inline'"],e.styleOrigins)};if(t.reportUri!==void 0&&t.reportUri!=="")s["report-to"]="csp-endpoint",s["report-uri"]=t.reportUri;for(let[a,c]of Object.entries(t.directives??{}))s[a]=c;let o=Object.entries(s).filter(([,a])=>a!==!1&&a!=="").toSorted(([a],[c])=>a<c?-1:1).map(([a,c])=>`${a} ${String(c)}`).join("; "),i=t.mode==="report-only"?{"Content-Security-Policy-Report-Only":o}:{"Content-Security-Policy":o};if(t.reportUri!==void 0&&t.reportUri!=="")i["Reporting-Endpoints"]=`csp-endpoint="${t.reportUri}"`;return i}var g1,y1,x1,b1,$1,w1,S1;var um=T(()=>{g1=new Set(["","module","importmap","text/javascript","module-shim","speculationrules"]),y1=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,x1=/<link\b([^>]*)>/gi,b1=/<img\b([^>]*)>/gi,$1=/<source\b([^>]*)>/gi,w1=/<iframe\b([^>]*)>/gi,S1=/\.(woff2?|ttf|otf|eot)(\?|#|$)/i});import{existsSync as $u,readFileSync as P1,writeFileSync as ew}from"node:fs";import{join as wu}from"node:path";function tw(e,t){let n=e?.headers??{},r=[];if(n.enabled===!1)return{errors:r,rules:[]};let s=n.security??{},o={};if(s.contentTypeOptions!==!1)o["X-Content-Type-Options"]="nosniff";if(s.referrerPolicy!==!1)o["Referrer-Policy"]=s.referrerPolicy??"strict-origin-when-cross-origin";if(s.permissionsPolicy!==!1)o["Permissions-Policy"]=s.permissionsPolicy??"camera=(), microphone=(), geolocation=()";if(s.frameOptions!==!1)o["X-Frame-Options"]=s.frameOptions??"SAMEORIGIN";let{hsts:i}=s;if(i){let u=i===!0?{}:i,d=u.maxAge??Q$,p=u.includeSubDomains??!0,m=u.preload??!1;if(m&&!p)r.push("build.headers.security.hsts: `preload` requires `includeSubDomains` — the preload list "+"will not accept the header without it.");else o["Strict-Transport-Security"]=[`max-age=${d}`,p?"includeSubDomains":null,m?"preload":null].filter(Boolean).join("; ")}let a=Y$(s);if(a)if(t===void 0)r.push("build.headers.security.csp is set, but no page was scanned for inline scripts — the "+"policy would block every one of them.");else Object.assign(o,Z$(t,a,s.frameOptions));let c=n.cache??"auto";if(c==="auto")o["Cache-Control"]="public, max-age=0, must-revalidate";let l=[];if(Object.keys(o).length>0)l.push({headers:o,pattern:"/*"});if(c==="auto")l.push({headers:{"Cache-Control":`public, max-age=${Q$}, immutable`},pattern:_1});for(let[u,d]of Object.entries(n.rules??{}))l.push({headers:d,pattern:u});return{errors:r,rules:l}}function nw(e){let t=[["feed.xml","application/atom+xml; charset=utf-8"],["feed.json","application/feed+json; charset=utf-8"],["manifest.webmanifest","application/manifest+json; charset=utf-8"],[".well-known/security.txt","text/plain; charset=utf-8"]],n=[];for(let[r,s]of t)if($u(wu(e,r)))n.push({headers:{"Content-Type":s},pattern:`/${r}`});if($u(wu(e,"feed","archive")))n.push({headers:{"Content-Type":"application/atom+xml; charset=utf-8"},pattern:"/feed/archive/*"});return n}function rw(e,t){if(t==="")return[...e];return e.map((n)=>({headers:n.headers,pattern:We(t,n.pattern)}))}function A1(e){let t=e.map((n)=>{let r=Object.entries(n.headers).map(([s,o])=>` ${s}: ${o}`);return[n.pattern,...r].join(`
151
- `)});return`${[k1,"",...t].join(`
154
+ `:""}var D1,vw,vs="https://esm.sh/@vue/reactivity@3.5.40",Es="https://esm.sh/lit-html@3.3.0",rc,F1,V1,q1,W1,H1,Ps,z1,_i="__jxAttrText",Bh="__jxSupplies",zh="__jxNativeSetter",Ju="__jxAbsorbAttr",Rw="__jxServerCall",K1,G1,Nw="__jxInstantiate",Xh="__jxCaptureSlotted",Yh="__jxDistributeSlots",Oi="<!---->",Jw,Qh,Y1;var Yn=R(()=>{Ha();Si();Ga();hi();lu();mw();yw();le();di();Si();hi();lu();le();hi();D1=["$map/","event#/","$args/","$reduce/"];vw=Symbol("jx.runtimeOnlyStateKeys"),rc=String.raw`(?:\s|\\[nrt])*`,F1=new RegExp(String.raw`(?:=|\.\.\.)${rc}state[ \t]*(?:[;,)}\]"]|\\[nr])`);V1=/\bstate\.([A-Za-z_$][\w$]*)\s*(?:\+\+|--|(?:\*\*|\|\||&&|\?\?|<<|>>>|>>|[-+*/%&|^])?=(?!=))/g,q1=/\bstate\.([A-Za-z_$][\w$]*)\s*\.\s*(?:push|pop|shift|unshift|splice|sort|reverse|fill|copyWithin)\s*\(/g,W1=/[\w$.]/u,H1=/[\w$]/u;Ps=new Set(["pre","textarea","listing","plaintext","xmp"]);z1=[];K1=new Set(["$prototype","$src","$export","timing","default","description"]);G1=new Set(sh);Jw=Symbol("jx.styleHandle");Qh=new Set(["input","br","hr","img","meta","link","area","col","source"]);Y1=/^(?:::slotted\(|::part\()/});import{relative as eI,sep as tI}from"node:path";function dc(e){return e===nI}function Ci(e,t){if(e==="/")return"/";if(t==="always")return e.endsWith("/")?e:`${e}/`;if(t==="never")return e.replace(/\/+$/,"")||"/";return e}function Uu(e,t){let n=new RegExp(`\\s${t}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s"'>]+))`,"i").exec(e);return n===null?null:n[1]??n[2]??n[3]??""}function Uw(e){let t=e.search(/<\/head\s*>/i),n=t===-1?e:e.slice(0,t);for(let[r]of n.matchAll(/<meta\b[^>]*>/gi)){if(Uu(r,"name")?.trim().toLowerCase()!=="robots")continue;let s=new Set((Uu(r,"content")??"").toLowerCase().split(",").map((o)=>o.trim()));if(s.has("noindex")||s.has("none"))return!0}return!1}function Bw(e){let t=e.search(/<\/head\s*>/i);return{end:t,head:t===-1?e:e.slice(0,t)}}function rI(e,t){let n=t.trim().toLowerCase();for(let[r]of Bw(e).head.matchAll(/<link\b[^>]*>/gi)){let s=(Uu(r,"rel")??"").toLowerCase().split(/\s+/),o=(Uu(r,"type")??"").split(";")[0]?.trim().toLowerCase();if(s.includes("alternate")&&o===n)return!0}return!1}function zw(e,t){let{end:n}=Bw(e);if(n===-1||rI(e,t.type))return e;let r=`<link href="${ve(t.href)}" rel="alternate" type="${ve(t.type)}">`;return`${e.slice(0,n)}${r}
155
+ ${e.slice(n)}`}function Kw(e,t){return new URL(`/${eI(e,t).split(tI).join("/")}`,"http://localhost").pathname}var nI="/404";var ig=R(()=>{Yn()});function Gw(e,t){if(t===null||t.routing!=="prefix-always")return[];let n=[];for(let r of e){if(r.urlPattern==="/")continue;let s=r.urlPattern.split("/").find(Boolean),o=Nn(s);if(o===null||!t.locales.includes(o))n.push(r.urlPattern)}return n}function Xw(e,t){if(t===null)return null;let n=e.split("/").find(Boolean),r=Nn(n);if(n===void 0||r===null||t.locales.includes(r))return null;let s=t.locales.find((o)=>o!==r&&o.split("-")[0]===r.split("-")[0]);return s===void 0?null:{meant:s,segment:n}}function sI(e,t){let n=e.split("/").filter(Boolean),r=Nn(n[0]);if(t!==null&&r!==null&&t.locales.includes(r))return n.slice(1).join("/");return n.join("/")}function ag(e,t){let n=new Map,r=[];if(t===null)return{conflicts:r,sets:n};let s=new Map,o=new Set;for(let i of e){let a=i.translationKey===void 0?sI(i.urlPattern,t):i.translationKey.replaceAll(/^\/+|\/+$/g,"");if(i.translationKey!==void 0)o.add(i.urlPattern);let c=Kn(i.urlPattern,t);if(c===null)continue;let l=s.get(a)??[],u=l.find((d)=>d.locale===c);if(u===void 0)l.push({locale:c,urlPattern:i.urlPattern});else r.push({declared:o.has(u.urlPattern)||i.translationKey!==void 0,key:a,locale:c,urlPatterns:[u.urlPattern,i.urlPattern]});s.set(a,l)}for(let i of s.values()){let a=i.toSorted((c,l)=>c.locale===l.locale?0:c.locale<l.locale?-1:1);for(let c of i)n.set(c.urlPattern,a)}return{conflicts:r,sets:n}}function Yw(e,t,n,r){let s=new Map;if(t===null||n==="")return s;let o=new Map;for(let[i,a]of ag(e,t).sets){if(a.length<2)continue;let c=o.get(a);if(c===void 0){c=a.map((u)=>({href:ys(Ci(u.urlPattern,r),n),hreflang:u.locale}));let l=a.find((u)=>u.locale===t.defaultLocale);if(l!==void 0)c.push({href:ys(Ci(l.urlPattern,r),n),hreflang:"x-default"});o.set(a,c)}s.set(i,c)}return s}function Zw({pageLang:e,pageDir:t,routeLocale:n,defaults:r}){let s=e??n??r?.lang??"en",o=t??r?.dir;if(o!==void 0)return{dir:o,lang:s};return qa(s)==="rtl"?{dir:"rtl",lang:s}:{lang:s}}var cg=R(()=>{$n();Po();ig();Po();Po()});function Qw(e,t,n,r=null,s=null,o=[]){if(!e.state)e.state={};let i={};if(s!==null)i.defaultLocale=s.defaultLocale,i.locales=s.locales;e.state.$site={...Object.fromEntries(Object.entries(t.state??{}).filter(([u])=>!oI.has(u))),name:t.name??"Jx Site",url:t.url??"",...i};let a=(k(e.$lang)?e.$lang:void 0)??Kn(n.urlPattern,s)??t.defaults?.lang,c=o.map((u)=>({code:u.locale,current:u.urlPattern===n.urlPattern,dir:qa(u.locale),label:VS(u.locale),url:u.urlPattern})),l={params:n._pathParams??{},title:e.title??e._pageTitle??t.name??"",url:n.urlPattern};if(c.length>0)l.alternates=c;if(n.pagination){let{first:u,itemCount:d,last:p,next:m,number:x,pageCount:g,pageSize:y,pages:S,prev:E}=n.pagination;l.pagination={first:u,itemCount:d,last:p,next:m,number:x,pageCount:g,pageSize:y,pages:S.map(({current:v,number:j,url:P})=>({current:v,number:j,url:P})),prev:E}}if(a!==void 0)l.dir=qa(a),l.locale=a;if(e.state.$page=l,t.state){for(let[u,d]of Object.entries(t.state))if(u!=="$site"&&u!=="$page"&&!(u in e.state))e.state[u]=d}if(t.$media)e.$media={...t.$media,...e.$media};if(t.imports&&Object.keys(t.imports).length>0){if(!e.imports)e.imports={};for(let[u,d]of Object.entries(t.imports))if(!(u in e.imports))e.imports[u]=r&&(d.startsWith("./")||d.startsWith("../"))?r(d,n):d}if(t.$elements?.length)if(!e.$elements?.length)e.$elements=[...t.$elements];else{let u=new Set,d=[];for(let p of[...t.$elements,...e.$elements]){let m=k(p)?p:I(p)?p.$ref:void 0;if(m&&!u.has(m))u.add(m),d.push(p)}e.$elements=d}return e}var oI;var ev=R(()=>{le();Po();oI=new Set(["defaultLocale","locales","name","url"])});import{dirname as iI,relative as aI,resolve as cI}from"node:path";function lg(e){return(t,n)=>{if(!n.sourcePath)return t;return`./${aI(iI(n.sourcePath),cI(e,t))}`}}function tv(e,t,n,r=null,s=null,o=[]){return Qw(e,t,n,r===null?null:lg(r),s,o)}var ug=R(()=>{ev()});function pc(e){let t=NS(e,e.title??"a class"),n=t.title;if(!n)throw Error("compileClassJson: missing title (class name)");let r=uI(t.extends),s=t.$defs,o=s?.fields??{},i=s?.constructor,a=lI(i)?i:void 0,c=s?.methods??{},l=["// Generated by @jxsuite/compiler from .class.json — do not edit manually"];if(t.$id)l.push(`// Source: ${t.$id}`);l.push("");let u=fI(t.extends);if(u!==null)l.push(u,"");let d=r!=="Object"?` extends ${r}`:"";l.push(`class ${n}${d} {`);for(let[p,m]of Object.entries(o)){if(m.scope!=="static")continue;let x=m.identifier??p,g=m.access==="private"?"#":"",y=m.initializer!==void 0?JSON.stringify(m.initializer):m.default!==void 0?JSON.stringify(m.default):"null";l.push(` static ${g}${x} = ${y};`)}for(let[p,m]of Object.entries(o)){if(m.scope==="static")continue;if(m.access!=="private")continue;let x=m.identifier??p;l.push(` #${x};`)}if(Object.keys(o).length>0)l.push("");if(l.push(" constructor(config = {}) {"),a?.superCall||r!=="Object"){let p=a?.superCall?.arguments?a.superCall.arguments.join(", "):"";l.push(` super(${p});`)}for(let[p,m]of Object.entries(o)){if(m.scope==="static")continue;let x=m.identifier??p,g=m.access==="private"?"#":"",y=m.initializer!==void 0?JSON.stringify(m.initializer):m.default!==void 0?JSON.stringify(m.default):"null";l.push(` this.${g}${x} = config.${x} !== undefined ? config.${x} : ${y};`)}if(a?.body){let p=Array.isArray(a.body)?a.body:[a.body];for(let m of p)l.push(` ${m}`)}l.push(" }");for(let[p,m]of Object.entries(c)){let x=m.identifier??p,g=m.scope==="static",S=m.access==="private"?"#":"",E=g?"static ":"",v=m.returnType?.$ref?.includes("Promise")||pI(m)?"async ":"",j=nv(m.parameters??[]),P=dI(m.body);if(l.push(""),m.role==="accessor"){if(m.getter)l.push(` ${E}get ${S}${x}() {`,` ${m.getter.body}`," }");if(m.setter){let O=nv(m.setter.parameters??[])||"v";l.push(` ${E}set ${S}${x}(${O}) {`,` ${m.setter.body}`," }")}}else{l.push(` ${E}${v}${S}${x}(${j}) {`);for(let O of P)l.push(` ${O}`);l.push(" }")}}return l.push("}","",`export { ${n} };`,`export default ${n};`,""),l.join(`
156
+ `)}function lI(e){return typeof e==="object"}function uI(e){if(!e)return"Object";if(k(e))return e;if(e.$ref){let t=e.$ref.match(rv);return t?t[1]:"Object"}return"Object"}function fI(e){if(!e||k(e)||!e.$ref)return null;let t=e.$ref.match(rv);if(!t)return null;let[n=""]=e.$ref.split("#"),r=n.replace(/\.class\.json$/,".js"),s=/^(?:\.{0,2}\/|[a-z][a-z0-9+.-]*:)/i.test(r)?r:`./${r}`;return`import ${t[1]} from ${JSON.stringify(s)};`}function nv(e){return e.map((t)=>{if(t.$ref)return t.$ref.split("/").pop();let n=t.identifier??t.name;return k(n)?n:"arg"}).join(", ")}function dI(e){if(!e)return[""];return Array.isArray(e)?e:[e]}function pI(e){return(Array.isArray(e.body)?e.body.join(`
157
+ `):e.body??"").includes("await ")}var rv;var fg=R(()=>{ui();le();rv=/([A-Za-z0-9_]+)\.class\.json/});import{createHash as mI}from"node:crypto";import{mkdirSync as hI,readFileSync as gI,rmSync as yI,writeFileSync as xI}from"node:fs";import{createRequire as bI}from"node:module";import{tmpdir as $I}from"node:os";import{dirname as iv,join as sv,resolve as Bu}from"node:path";import{pathToFileURL as SI}from"node:url";function zu(e,t){let n=e.$src??t.imports?.[e.$prototype]??t.registry?.byName(e.$prototype)?.classPath;if(!n)return;let r;if(n.startsWith("./")||n.startsWith("../"))r=Bu(t.docDir??t.projectRoot,n);else r=bI(Bu(t.projectRoot,"package.json")).resolve(n);let s=Yx(gI(r,"utf8"),r);return{classDef:s,classJsonPath:r,exportName:e.$export??s.title??e.$prototype}}function av(e){let t=e.classDef.extends;if(t!==void 0&&!k(t))throw Error(`${e.classJsonPath} has no $implementation and extends another class document ("${t.$ref}"), which a site build does not compile: give it an $implementation`)}function wI(e){av(e);let t=pc(e.classDef),n=mI("sha256").update(t).digest("hex").slice(0,16),r=ov.get(n);if(r===void 0){let s=sv($I(),`jx-class-${process.pid}`);hI(s,{recursive:!0});let o=sv(s,`${e.classDef.title}-${n}.mjs`);xI(o,t,"utf8"),r=import(SI(o).href).then((i)=>i.default).finally(()=>{yI(o,{force:!0})}),ov.set(n,r)}return r}async function cv(e){let{classDef:t,classJsonPath:n,exportName:r}=e;if(!t.$implementation)return wI(e);let s=await yp(Bu(iv(n),t.$implementation)),o=s[r]??s.default?.[r];if(!_t(o))throw Error(`Module ${t.$implementation} does not export "${r}"`);return o}function vI(e){return"resolve"in e&&_t(e.resolve)}function EI(e){return"value"in e}async function lv(e,t){let n=new e(t);if(vI(n))return{instance:n,value:await n.resolve()};if(EI(n))return{instance:n,value:n.value};return{instance:n,value:n}}function uv(e){return JSON.stringify(e).includes('"#/$context/')}function fv(e){let{classDef:t,classJsonPath:n,exportName:r}=e;if(!t.$implementation)return av(e),pc(t);let s=O$(Bu(iv(n),t.$implementation)),o=JSON.stringify(r);return[`import * as m from ${JSON.stringify(s)};`,`export default m[${o}] ?? m.default?.[${o}];`,""].join(`
158
+ `)}var ov;var dg=R(()=>{le();Rt();fg();Br();ov=new Map});import{dirname as dv}from"node:path";async function mc(e,t,n,r={}){let s={},{state:o}=e;if(!o)return s;let i=[],a={docDir:t.sourcePath?dv(t.sourcePath):null,imports:e.imports,projectRoot:n,registry:r.registry};for(let[c,l]of Object.entries(o)){if(!yn(l))continue;if(jI.has(l.$prototype))continue;let u=`"${c}" ($prototype "${l.$prototype}")`;if(l.timing&&l.timing!=="compiler"){let d=r.registry?.byName(l.$prototype);if(d?.capabilities.lower)try{let p=await d.call("lower",l,{projectConfig:r.config,root:n,route:t});if(L(p)){let m=p.$bundle;if(Array.isArray(m)){for(let x of m)if(k(x))r.registerBundle?.(x)}delete p.$bundle}o[c]=p,s[c]=p}catch(p){i.push(`${u}: its class could not lower it: ${ge(p)}`)}continue}try{let d=zu(l,a);if(d===void 0){if(l.timing==="compiler"&&Gh(l))i.push(`${u} names no class: give it a $src or an imports entry, or enable the extension that provides "${l.$prototype}"`);continue}let p=await cv(d),{value:m}=await lv(p,PI(l,t,n,o,r));if(r.asInitialValues)o[c]={default:m??null};else{if(l.timing&&L(m))m.timing=l.timing;o[c]=m}s[c]=o[c]}catch(d){let p=l.timing?"":' (set "timing": "client" if it must run in the browser)';i.push(`${u}: ${ge(d)}${p}`)}}if(i.length>0)throw Error(i.length===1?`state entry ${i[0]}`:`${i.length} state entries could not be resolved: ${i.join("; ")}`);return s}function PI(e,t,n,r,s){let o={...Kh(e)};if(o.src&&!o.basePath&&t.sourcePath)o.basePath=dv(t.sourcePath);return o._project={config:s.config??null,root:n,...s.sections},o._document={route:t,state:r},o}var jI;var pg=R(()=>{le();Rt();Yn();dg();jI=new Set(["Function","LocalStorage","SessionStorage","Array"])});import{readFileSync as mg,readdirSync as _I,statSync as kI}from"node:fs";import{extname as mv,join as OI,relative as AI,resolve as CI}from"node:path";async function Qr(e,t){let n=mg(e,"utf8");if(Hr(e))return mr(Bn(n,e),e);let r=mv(e).toLowerCase(),s=t?.byExtension(r,"parse");if(!s)throw Error(`No format class registered for "${r}" (${e}). Enable an extension providing this format in project.json "extensions", e.g. "@jxsuite/parser".`);return mr(await s.parseDocument(n),e)}async function hv(e,t){let n=new Map,r=new Map;for(let s of e){if(!r.has(s.sourcePath))r.set(s.sourcePath,await NI(s.sourcePath,t));let o=r.get(s.sourcePath);if(o!==null&&o!==void 0)n.set(s.urlPattern,RI(o,s._pathParams))}return n}function RI(e,t){if(!e.includes("${"))return e;return e.replaceAll(/\$\{(\w+)\}/g,(n,r)=>t?.[r]??n)}async function NI(e,t){if(!mg(e,"utf8").includes("$translationKey"))return null;let n;try{n=await Qr(e,t)}catch{return null}return k(n.$translationKey)&&n.$translationKey!==""?n.$translationKey:null}async function gv(e,t){let n=[],r=new Set([".json",".jxn",...t?.documentExtensions("page")??[]]);return await yv(e,e,n,r,t),n.sort(JS),n}async function yv(e,t,n,r,s){let o=_I(e,{withFileTypes:!0});for(let i of o){let a=OI(e,i.name);if(i.isDirectory()){if(i.name.startsWith("_"))continue;await yv(a,t,n,r,s);continue}let c=mv(i.name).toLowerCase();if(!r.has(c))continue;if(i.name.startsWith("_"))continue;let l=AI(t,a);n.push(await TI(l,a,s))}}async function TI(e,t,n){let{isCatchAll:r,isDynamic:s,params:o,urlPattern:i}=TS(e),a=null;try{let l=(await Qr(t,n)).$layout;if(k(l))a=l}catch{}return{$layout:a,isCatchAll:r,isDynamic:s,params:o,relativePath:e,sourcePath:t,urlPattern:i}}function JI(e){let t=e[Ku];if(!L(t))return null;let{mtime:n}=t;return k(n)&&n!==""?n:null}function xv(e){if(e.includes("\x00"))return"has a NUL character";for(let t of e.split("/")){if(t==="."||t==="..")return'has a "." or ".." segment';if(t.includes("\\"))return"has a backslash"}return null}async function bv(e,t,n={},r,s,o,i={}){let a=[],c=(u,d)=>{let p=`Dynamic route ${u.urlPattern}: ${d}`;if(i.errors===void 0)throw Error(p);i.errors.push(p)},l=e.flatMap((u)=>u.isDynamic?[u.urlPattern]:[]);for(let u of e){if(!u.isDynamic){a.push(u);continue}let d;try{d=await Qr(u.sourcePath,r?.formats)}catch{a.push(u);continue}if(!d.$paths){console.warn(`Warning: dynamic route ${u.urlPattern} has no $paths — skipping`);continue}let p;try{p=DS(d.$paths)}catch(x){c(u,ge(x));continue}if(p!==null){let x=Kn(u.urlPattern,o??null),g=p.each===void 0?[{}]:await pv(p.each,t,n,r,s,x,u,l);for(let y of g){let S=await II(u,d,p,y,{locale:x,projectConfig:s,projectRoot:t,registry:r,report:c,sections:n});a.push(...S)}continue}let m=await pv(d.$paths,t,n,r,s,Kn(u.urlPattern,o??null),u,l);for(let x of m){let g=u.urlPattern,y={};for(let[j,P]of Object.entries(x)){if(j===Ku)continue;y[j]=String(P),g=g.replace(`:${j}`,y[j]),g=g.replace("*",y[j])}let S=xv(g);if(S!==null){console.warn(`Warning: $paths for ${u.urlPattern} produced "${g}", which ${S}; skipping it`);continue}let E=JI(x),v={...u,_pathParams:y,isCatchAll:!1,isDynamic:!1,params:[],urlPattern:g};if(E!==null)v.sourceMtime=E;a.push(v)}}return a}function $v(e,t){let n=e;for(let[r,s]of Object.entries(t)){let o=new RegExp(`:${r.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}(?=/|$)`);n=o.test(n)?n.replace(o,()=>s):n.replace("*",()=>s)}return n}async function II(e,t,n,r,s){let o={};for(let[x,g]of Object.entries(r))if(x!==Ku)o[x]=String(g);let i=e.params.filter((x)=>!(x in o));if(i.length!==1)return s.report(e,`a paged route takes exactly one parameter besides those its each source fills; this one has ${i.length}`),[];let a=i[0];if(t.state?.[n.key]===void 0)return s.report(e,`$paths.paginate names state entry "${n.key}", which this page does not declare`),[];let c=$v(e.urlPattern,o),l=xv(c);if(l!==null)return console.warn(`Warning: $paths for ${e.urlPattern} produced "${c}", which ${l}; skipping it`),[];let u;try{u=await MI(t,n.key,e,o,s)}catch(x){return s.report(e,ge(x)),[]}if(!Array.isArray(u))return s.report(e,`state entry "${n.key}" did not resolve to an array at build time`),[];let d=DI(u,e.sourcePath),p=Vp(u.length,n.pageSize),m=[];for(let x=1;x<=p;x++){let g={...e,_pathParams:{...o,[a]:String(x)},isCatchAll:!1,isDynamic:!1,pagedState:{items:MS(u,x,n.pageSize),key:n.key},pagination:FS(c,x,n.pageSize,u.length),params:[],urlPattern:jo(c,x)};if(d!==null)g.sourceMtime=d;m.push(g)}return m}function DI(e,t){let n=null,r=kI(t).mtime.getTime();for(let s of e){let o=L(s)?s[Ku]:void 0,i=L(o)?o.mtime:void 0;if(k(i)&&Date.parse(i)>r)r=Date.parse(i),n=i}return n}async function MI(e,t,n,r,s){let o=e.state?.[t];if(o===void 0||Array.isArray(o))return o;let i={},a=lg(s.projectRoot);for(let[u,d]of Object.entries(s.projectConfig?.imports??{}))i[u]=d.startsWith("./")||d.startsWith("../")?a(d,n):d;Object.assign(i,e.imports);let c={imports:i,state:{[t]:structuredClone(o)}},l={_pathParams:r,locale:s.locale,sourcePath:n.sourcePath,urlPattern:$v(n.urlPattern,r)};return await mc(c,l,s.projectRoot,{...s.projectConfig&&{config:s.projectConfig},...s.registry&&{registry:s.registry},sections:s.sections}),c.state?.[t]}async function pv(e,t,n,r,s,o,i,a){if(Array.isArray(e))return e;if("values"in e&&Array.isArray(e.values)){let c=k(e.param)?e.param:"value";return e.values.map((l)=>({[c]:l}))}if("$ref"in e&&k(e.$ref)&&e.$ref){let c=e.$ref,l=CI(t,c),u;try{u=JSON.parse(mg(l,"utf8"))}catch(m){return console.warn(`Warning: $paths.$ref could not load "${c}": ${ge(m)}`),[]}if(!Array.isArray(u))return console.warn(`Warning: $paths.$ref "${c}" must be a JSON array`),[];let d=k(e.param)?e.param:"id",p=k(e.field)?e.field:"id";return u.map((m)=>{if(m===null)throw TypeError(`$paths.$ref "${c}" contains a null entry`);return{[d]:(L(m)?m[p]??m.id:void 0)??String(m)}})}for(let c of Object.keys(e)){let l=r?.byPathsDiscriminator(c);if(!l?.project)continue;let u={data:n[l.project.key],locale:o,projectConfig:s,root:t};if(i!==void 0)u.params=i.params,u.urlPattern=i.urlPattern;if(a!==void 0)u.patterns=a;return await l.call("resolvePaths",e,u)}return console.warn("Warning: unrecognized $paths shape — skipping"),[]}var Ku="_meta";var hg=R(()=>{ui();le();ms();Rt();IS();LS();cg();ug();pg()});import{createHash as FI}from"node:crypto";function Sv(){return{fontOrigins:new Set,frameOrigins:new Set,imgOrigins:new Set,scriptHashes:new Set,scriptOrigins:new Set,styleOrigins:new Set}}function Ro(e,t){let n=new RegExp(`\\b${t}\\s*=\\s*("([^"]*)"|'([^']*)')`,"i").exec(e);return n?.[2]??n?.[3]}function gg(e){if(e===void 0||!/^https?:\/\//i.test(e))return null;try{return new URL(e).origin}catch{return null}}function zI(e){return`'sha256-${FI("sha256").update(e,"utf8").digest("base64")}'`}function wv(e,t){for(let n of e.matchAll(VI)){let r=n[1]??"",s=Ro(r,"src"),o=(Ro(r,"type")??"").trim().toLowerCase();if(s!==void 0){let i=gg(s);if(i)t.scriptOrigins.add(i);continue}if(LI.has(o))t.scriptHashes.add(zI(n[2]??""))}for(let n of e.matchAll(qI)){let r=n[1]??"",s=(Ro(r,"rel")??"").toLowerCase(),o=Ro(r,"href"),i=gg(o);if(!i)continue;if(s.includes("stylesheet"))t.styleOrigins.add(i);if(BI.test(o??"")||(Ro(r,"as")??"")==="font")t.fontOrigins.add(i)}for(let[n,r]of[[WI,t.imgOrigins],[HI,t.imgOrigins],[UI,t.frameOrigins]])for(let s of e.matchAll(n)){let o=s[1]??"";for(let i of[Ro(o,"src"),...KI(Ro(o,"srcset"))]){let a=gg(i);if(a)r.add(a)}}}function KI(e){return e===void 0?[]:e.split(",").map((t)=>t.trim().split(/\s+/)[0]??"").filter(Boolean)}function GI(e){if(e===!1)return!1;return e==="DENY"?"'none'":"'self'"}function vv(e){let t=e?.csp;if(t===void 0||t===!1)return null;if(t===!0)return{};if(t==="report-only")return{mode:"report-only"};return t}function Ev(e,t,n="SAMEORIGIN"){let r=(a,c)=>[...a,...c].join(" "),s={"base-uri":"'self'","default-src":"'self'","font-src":r(["'self'"],e.fontOrigins),"form-action":"'self'","frame-ancestors":GI(n),"frame-src":r(["'self'"],e.frameOrigins),"img-src":r(["'self'","data:"],e.imgOrigins),"object-src":"'none'","script-src":r(["'self'",...[...e.scriptHashes].toSorted()],e.scriptOrigins),"style-src":r(["'self'","'unsafe-inline'"],e.styleOrigins)};if(t.reportUri!==void 0&&t.reportUri!=="")s["report-to"]="csp-endpoint",s["report-uri"]=t.reportUri;for(let[a,c]of Object.entries(t.directives??{}))s[a]=c;let o=Object.entries(s).filter(([,a])=>a!==!1&&a!=="").toSorted(([a],[c])=>a<c?-1:1).map(([a,c])=>`${a} ${String(c)}`).join("; "),i=t.mode==="report-only"?{"Content-Security-Policy-Report-Only":o}:{"Content-Security-Policy":o};if(t.reportUri!==void 0&&t.reportUri!=="")i["Reporting-Endpoints"]=`csp-endpoint="${t.reportUri}"`;return i}var LI,VI,qI,WI,HI,UI,BI;var yg=R(()=>{LI=new Set(["","module","importmap","text/javascript","module-shim","speculationrules"]),VI=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,qI=/<link\b([^>]*)>/gi,WI=/<img\b([^>]*)>/gi,HI=/<source\b([^>]*)>/gi,UI=/<iframe\b([^>]*)>/gi,BI=/\.(woff2?|ttf|otf|eot)(\?|#|$)/i});import{existsSync as Gu,readFileSync as XI,writeFileSync as Pv}from"node:fs";import{join as Xu}from"node:path";function _v(e,t){let n=e?.headers??{},r=[];if(n.enabled===!1)return{errors:r,rules:[]};let s=n.security??{},o={};if(s.contentTypeOptions!==!1)o["X-Content-Type-Options"]="nosniff";if(s.referrerPolicy!==!1)o["Referrer-Policy"]=s.referrerPolicy??"strict-origin-when-cross-origin";if(s.permissionsPolicy!==!1)o["Permissions-Policy"]=s.permissionsPolicy??"camera=(), microphone=(), geolocation=()";if(s.frameOptions!==!1)o["X-Frame-Options"]=s.frameOptions??"SAMEORIGIN";let{hsts:i}=s;if(i){let u=i===!0?{}:i,d=u.maxAge??jv,p=u.includeSubDomains??!0,m=u.preload??!1;if(m&&!p)r.push("build.headers.security.hsts: `preload` requires `includeSubDomains` — the preload list "+"will not accept the header without it.");else o["Strict-Transport-Security"]=[`max-age=${d}`,p?"includeSubDomains":null,m?"preload":null].filter(Boolean).join("; ")}let a=vv(s);if(a)if(t===void 0)r.push("build.headers.security.csp is set, but no page was scanned for inline scripts — the "+"policy would block every one of them.");else Object.assign(o,Ev(t,a,s.frameOptions));let c=n.cache??"auto";if(c==="auto")o["Cache-Control"]="public, max-age=0, must-revalidate";let l=[];if(Object.keys(o).length>0)l.push({headers:o,pattern:"/*"});if(c==="auto")l.push({headers:{"Cache-Control":`public, max-age=${jv}, immutable`},pattern:YI});for(let[u,d]of Object.entries(n.rules??{}))l.push({headers:d,pattern:u});return{errors:r,rules:l}}function kv(e){let t=[["feed.xml","application/atom+xml; charset=utf-8"],["feed.json","application/feed+json; charset=utf-8"],["manifest.webmanifest","application/manifest+json; charset=utf-8"],[".well-known/security.txt","text/plain; charset=utf-8"]],n=[];for(let[r,s]of t)if(Gu(Xu(e,r)))n.push({headers:{"Content-Type":s},pattern:`/${r}`});if(Gu(Xu(e,"feed","archive")))n.push({headers:{"Content-Type":"application/atom+xml; charset=utf-8"},pattern:"/feed/archive/*"});return n}function Ov(e,t){if(t==="")return[...e];return e.map((n)=>({headers:n.headers,pattern:Ie(t,n.pattern)}))}function eD(e){let t=e.map((n)=>{let r=Object.entries(n.headers).map(([s,o])=>` ${s}: ${o}`);return[n.pattern,...r].join(`
159
+ `)});return`${[ZI,"",...t].join(`
152
160
  `)}
153
- `}function sw(e,t){if(t.length===0)return 0;let n=wu(e,"_headers"),r=$u(n)?P1(n,"utf8").trim():"",s=A1(t),o=r===""?s:`${s}
154
- ${O1}
161
+ `}function Av(e,t){if(t.length===0)return 0;let n=Xu(e,"_headers"),r=Gu(n)?XI(n,"utf8").trim():"",s=eD(t),o=r===""?s:`${s}
162
+ ${QI}
155
163
  ${r}
156
- `;return ew(n,o,"utf8"),1}function ow(e){let t=wu(e,".nojekyll");if($u(t))return 0;return ew(t,"","utf8"),1}var _1="/images/_optimized/*",Q$=31536000,k1="# Generated by @jxsuite/compiler — configure via build.headers in project.json.",O1="# ─── public/_headers (hand-authored; these rules override the block above) ───";var iw=T(()=>{$n();um()});async function aw(e,t,n,r={}){let s={},o=Bd(e);for(let i of n.projectContributions()){let a=i.project?.key;if(!a||!i.capabilities.projectData)continue;if(!t||!(a in t))continue;s[a]=await i.call("projectData",t[a],{io:o,projectConfig:t,registry:n,root:e,...r.lazy===!0&&{lazy:!0},...r.includeHeld===!0&&{includeHeld:!0}})}return s}var cw=T(()=>{Ur()});import{cpSync as R1,existsSync as C1,mkdirSync as N1}from"node:fs";import{dirname as T1,resolve as J1}from"node:path";async function lw(e,t,n){let r=[],s=[],o=new Map;for(let i of e.assetProviders()){let a=i.project?.key,c=a?t[a]:void 0;if(a&&(c==null||D(c)&&Object.keys(c).length===0))continue;try{let l=await i.call("assets",c??null,{projectConfig:t,root:n});for(let u of l??[]){if(!D(u)||!u.urlPrefix||!u.dir)continue;let d={dir:u.dir,urlPrefix:Pl(u.urlPrefix)};if(At(u.filter))d.filter=u.filter;let p=o.get(d.urlPrefix);if(p){if(p.dir!==d.dir)s.push(`Asset mount conflict: "${d.urlPrefix}" is claimed by both "${p.dir}" and "${d.dir}"`);continue}o.set(d.urlPrefix,d),r.push(d)}}catch(l){s.push(`Error in ${i.name}.assets: ${$e(l)}`)}}return{errors:s,mounts:r}}function fm(e,t,n){if(t.length===0||!e)return;for(let r of Jx(e,t))n.add(r)}function uw(e,t,n){let r=0,s=[];for(let o of e){let i=_l(t,o);if(!i||!C1(i)){s.push(o);continue}let a=J1(n,decodeURIComponent(o).replace(/^\//,""));N1(T1(a),{recursive:!0}),R1(i,a),r+=1}return{copied:r,missing:s}}var fw=T(()=>{$n();le();Dt()});import{readFileSync as I1}from"node:fs";import{dirname as M1,isAbsolute as D1,relative as F1,resolve as dw,sep as L1}from"node:path";function Su(e,t){return`${e}${t==="client"?dm:pm}`}function H1(e){if(e.endsWith(dm))return{documentPath:e.slice(0,-dm.length),side:"client"};if(e.endsWith(pm))return{documentPath:e.slice(0,-pm.length),side:"server"};return null}function Ti(e,t,n){return Za(e,pw(t,n))}function pw(e,t){return F1(t,e).split(L1).join("/")}function U1(e){return Kn(I1(e,"utf8"),e)}function mw(e,t=U1){let n=new Map,r=(l)=>pw(l,e),s=(l)=>{let u=n.get(l);if(u===void 0)u=(async()=>t(l))(),n.set(l,u);return u},o=async(l,u)=>{let d;try{d=await s(l)}catch(h){throw Error(`Cannot read ${r(l)} for its ${u} script`,{cause:h})}let p=d.$script?.[u];if(p===void 0)throw Error(`${r(l)} has no ${u} script: nothing in it is $script.${u}, but something names its ${u} module`);let[m,...x]=Pb(p).problems;if(m!==void 0)throw new Vl({path:r(l),pointer:`/$script/${u}`},[m,...x]);return p},i=(l)=>{let u=wi(l);if(u===null)return null;return{documentPath:dw(e,u.path),side:u.side}},a=(l)=>({name:`jx-document-scripts-${l}`,setup:(u)=>{u.onResolve({filter:q1},({path:d})=>{let p=i(d);if(p===null)return;if(p.side==="server"&&l==="client")throw Error(`${r(p.documentPath)}: its server script cannot be imported by code a browser runs`);return{path:Su(p.documentPath,p.side)}}),u.onResolve({filter:W1},({importer:d,path:p})=>{if(D1(p))return{path:Su(p,"client")};return p.startsWith("./")||p.startsWith("../")?{path:Su(dw(M1(d),p),"client")}:void 0}),u.onLoad({filter:V1},async({path:d})=>{let p=H1(d);return{contents:await o(p.documentPath,p.side),loader:"ts"}})}}),c=async(l)=>{let u=i(l);if(u===null)throw Error(`"${l}" does not name a document's script`);return{contents:await o(u.documentPath,u.side),path:Su(u.documentPath,u.side)}};return{clientPlugin:a("client"),module:c,serverPlugin:a("server")}}var dm=".jx-client.ts",pm=".jx-server.ts",V1,q1,W1;var vu=T(()=>{ql();Si();ds();V1=/\.jx-(?:client|server)\.ts$/,q1=/^jx-script:/,W1=/\.jxn$/});async function mm(e,t,n){let r=e.$layout??t.defaults?.layout??null;if(!r)return e;let s=await n(r);if(s.$layout)s=await mm(s,t,n);let o=e.children??[],i=k(o)?[o]:Array.isArray(o)?o:[],a=z1(s);if(B1(a,i),e.state)a.state={...a.state,...e.state};if(e.$media)a.$media={...a.$media,...e.$media};if(e.style)a.style={...a.style,...e.style};if(e.attributes)a.attributes={...a.attributes,...e.attributes};if(e.$head)a._pageHead=e.$head;if(e.title)a._pageTitle=e.title;return delete a.$layout,a}function B1(e,t){let n=new Map,r=[];for(let s of t){let o=D(s)?s.attributes?.slot:void 0;if(o){let i=n.get(o);if(!i)i=[],n.set(o,i);i.push(s)}else r.push(s)}hw(e,n,r)}function hw(e,t,n){if(!D(e))return;if(!Array.isArray(e.children))return;let r=[];for(let s of e.children)if(D(s)&&s.tagName==="slot"){let o=s.attributes?.name,i=o?t.get(o):void 0;if(o&&i)r.push(...i),t.delete(o);else if(!o&&n.length>0)r.push(...n);else if(Array.isArray(s.children))r.push(...s.children)}else hw(s,t,n),r.push(s);e.children=r}function z1(e){return structuredClone(e)}var gw=T(()=>{le()});import{existsSync as K1,readFileSync as G1}from"node:fs";import{resolve as yw}from"node:path";function xw(e){return(t)=>{let n=yw(e,t);if(!K1(n))throw Error(`Layout not found: ${t} (resolved to ${n})`);try{let r=Kn(G1(n,"utf8"),n);return Ti(ur(r,n),n,e)}catch(r){throw Error(`Invalid layout at ${n}: ${$e(r)}`,{cause:r})}}}function bw(e,t,n){return mm(e,t,xw(n))}function Eu(e,t,n){let r=xw(n),s=[],o=e.$layout??t.defaults?.layout;while(o){let i=yw(n,o);if(s.some((c)=>c.path===i))break;let a=r(o);s.push({doc:a,path:i}),o=a.$layout}return s}var hm=T(()=>{pi();vu();ds();Dt();gw()});import{existsSync as $w,readdirSync as X1}from"node:fs";import{dirname as Y1,isAbsolute as Z1,relative as Q1,resolve as gm}from"node:path";function eI(e){let{$elements:t}=e;if(!Array.isArray(t))return[];let n=[];for(let r of t)if(V(r)&&k(r.$ref)&&r.$ref!=="")n.push(r.$ref);return n}async function ww(e){let{formatRegistry:t,pageSources:n,projectConfig:r,projectRoot:s}=e,o=[],i=[],a=new Set,c=new Map,l=(m)=>Q1(s,m).replaceAll("\\","/"),u=async(m,x)=>{if(a.has(m))return;let h=l(m),g=x?`${x.declarer}: $elements entry "${x.ref}" names`:"";if(x){if(h.startsWith("..")||Z1(h)){a.add(m),i.push(`${g} ${h}, outside the project`);return}if(!$w(m)){a.add(m),i.push(`${g} no file (${h})`);return}}a.add(m);let b;try{b=Ti(await Qr(m,t),m,s)}catch(P){i.push(`Error compiling component ${h}: ${$e(P)}`);return}let j=k(b.tagName)?b.tagName:"";if(!j.includes("-")){i.push(x?`${g} ${h}, which is not a component (no hyphenated tagName)`:`Error compiling component ${h}: tagName "${j}" must contain a hyphen`);return}let v=c.get(j);if(v!==void 0){i.push(`${l(v)} and ${h} both declare tagName "${j}"; rename one`);return}c.set(j,m),o.push({doc:b,path:m,tagName:j}),await d(b,m)},d=async(m,x,h=Y1(x))=>{for(let g of eI(m))await u(gm(h,g),{declarer:l(x),ref:g})},p=gm(s,"components");if($w(p)){let m=[".json",...t.documentExtensions("component")],x=X1(p).filter((h)=>m.some((g)=>h.endsWith(g))).toSorted();for(let h of x)await u(gm(p,h),null)}await d(r,Rn(s),s);for(let m of new Set(n))try{let x=await Qr(m,t),h=Eu(x,r,s);await d(x,m);for(let g of h)await d(g.doc,g.path)}catch{}return{components:o,errors:i}}var Sw=T(()=>{le();Dt();po();vu();hm();cm()});import{dirname as tI,relative as nI,resolve as rI,sep as sI}from"node:path";function vw(e,t){return nI(t,e).split(sI).join("/")}function oI(e,t,n){if(!e.startsWith("./")&&!e.startsWith("../"))return e;return`./${vw(rI(t,e),n)}`}function oc(e,t,n){let r=tI(t),s=vw(t,n);return j$(e).map((o)=>({exportName:o.exportName,src:oI(o.src,r,n),declaredIn:s}))}function Ew(e){let t=new Map;for(let{exportName:s,src:o,declaredIn:i}of e){let a=t.get(s)??new Map;if(t.set(s,a),!a.has(o))a.set(o,i)}let n=[],r=[];for(let[s,o]of t){let i=[...o];if(n.push({exportName:s,src:i[0][0]}),i.length>1){let a=i.map(([c,l])=>`${c} (declared in ${l})`);r.push(`Server function "${s}" is exported by ${i.length} different modules: ${a.join(", ")}. The site worker serves one function per export name, at /_jx/server/${s}, so a call meant for any but the first would get the first's answer. Rename the export in all but one module, and the $export that names it.`)}}return{entries:n,errors:r}}var jw=T(()=>{hr()});function Pw(e,t){if(!k(t)||t.trim()==="")return[...e];return[{attributes:{content:t,name:"description"},tagName:"meta"},...e]}function _w(e=[],t=[],n=[],r={}){let s=[{attributes:{charset:r.charset??"utf8"},tagName:"meta"},{attributes:{content:"width=device-width, initial-scale=1",name:"viewport"},tagName:"meta"}],o=new Map;for(let a of[...s,...e,...t,...n]){let c=ym(a);o.set(c,a)}let i=r.title??r.siteName??"Jx Site";if(o.set("title",{children:[i],tagName:"title"}),r.pageUrl&&r.siteUrl){let a=hs(r.pageUrl,r.siteUrl);if(![...o.values()].some((l)=>D(l)&&l.tagName==="link"&&l.attributes?.rel==="canonical")){let l={attributes:{href:a,rel:"canonical"},tagName:"link"};o.set(ym(l),l)}if(!o.has("meta:og:url"))o.set("meta:og:url",{attributes:{content:a,property:"og:url"},tagName:"meta"})}if(r.siteName&&!o.has("meta:og:site_name"))o.set("meta:og:site_name",{attributes:{content:r.siteName,property:"og:site_name"},tagName:"meta"});for(let a of r.alternates??[]){let c={attributes:{href:a.href,hreflang:a.hreflang,rel:"alternate"},tagName:"link"},l=ym(c);if(!o.has(l))o.set(l,c)}return[...o.values()]}function ym(e){if(!D(e))return String(e);let t=e.tagName??"unknown",n=e.attributes??{};if(t==="title")return"title";if(n.charset)return"meta:charset";if(t==="meta"&&n.name)return`meta:${n.name}`;if(t==="meta"&&n.property)return`meta:${n.property}`;if(t==="link"&&n.rel){let r=n.hreflang??n.type??n.media??n.sizes??"";return`link:${n.rel}:${n.href??""}:${String(r)}`}if(t==="script"&&n.src)return`script:${n.src}`;if(t==="style"){let r=Array.isArray(e.children)?e.children.join(""):e.textContent,s=D(r)?JSON.stringify(r):r??"";return`style:${iI(s)}`}return`${t}:${JSON.stringify(e)}`}function iI(e){let t=0;for(let n=0;n<e.length;n++)t=Math.trunc((t<<5)-t+(e.codePointAt(n)??0));return t.toString(36)}function kw(e){return e.map((t)=>aI(t)).join(`
157
- `)}function aI(e){if(k(e))return e;if(!D(e))return"";let t=e.tagName,n=e.attributes??{},r=Object.entries(n).map(([c,l])=>l===!0?c:`${c}="${cI(l)}"`).join(" "),s=r?`<${t} ${r}>`:`<${t}>`;if(t!==void 0&&new Set(["meta","link","base","br","hr","img","input"]).has(t))return s;let i=Array.isArray(e.children)?e.children.join(""):e.textContent,a=D(i)?JSON.stringify(i,null,2):i??"";return`${s}${a}</${t}>`}function cI(e){return String(e).replaceAll("&","&amp;").replaceAll('"',"&quot;").replaceAll("<","&lt;")}var Ow=T(()=>{$n();le()});function fI(e){let t=e.indexOf(":");if(t===-1)return!1;if(t===e.length-1)return!1;try{return new URL(e).protocol!==""}catch{return!1}}function dI(e){if(!k(e))return[];return e.split(/\s+/).filter((t)=>{if(t==="")return!1;let n=t.toLowerCase();return!lI.has(n)&&!uI.has(n)&&!fI(t)})}function Aw(e){let t=new Set;for(let n of e){if(!D(n)||n.tagName!=="link")continue;for(let r of dI(n.attributes?.rel))t.add(r)}return[...t]}var lI,uI;var Rw=T(()=>{le();lI=new Set(["about","acl","alternate","amphtml","api-catalog","appendix","apple-touch-icon","apple-touch-startup-image","archives","author","blocked-by","bookmark","c2pa-manifest","canonical","chapter","cite-as","collection","compression-dictionary","contents","convertedfrom","copyright","create-form","current","deprecation","describedby","describes","disclosure","dns-prefetch","dpp","duplicate","edit","edit-form","edit-media","enclosure","external","first","geofeed","glossary","help","hosts","hub","ice-server","icon","index","intervalafter","intervalbefore","intervalcontains","intervaldisjoint","intervalduring","intervalequals","intervalfinishedby","intervalfinishes","intervalin","intervalmeets","intervalmetby","intervaloverlappedby","intervaloverlaps","intervalstartedby","intervalstarts","item","last","latest-version","license","linkset","lrdd","manifest","mask-icon","me","media-feed","memento","micropub","modulepreload","monitor","monitor-group","next","next-archive","nofollow","noopener","noreferrer","opener","openid2.local_id","openid2.provider","original","p3pv1","payment","pingback","preconnect","predecessor-version","prefetch","preload","prerender","prev","prev-archive","preview","previous","privacy-policy","profile","publication","rdap-active","rdap-bottom","rdap-down","rdap-top","rdap-up","related","replies","restconf","ruleinput","search","section","self","service","service-desc","service-doc","service-meta","sip-trunking-capability","sponsored","start","status","stylesheet","subsection","successor-version","sunset","tag","terms-of-service","timegate","timemap","type","ugc","up","version-history","via","webmention","working-copy","working-copy-of"]),uI=new Set(["shortcut"])});async function _u(e,t={}){let{resolveElementPath:n,$media:r,formats:s}=t,o=[],i=new Set;async function a(c,l){let u,d;if(k(c)){let{readFileSync:P}=await import("node:fs"),{resolve:S}=await import("node:path");if(d=l?S(l,c):S(c),i.has(d))return;if(i.add(d),Wr(d))u=Kn(P(d,"utf8"),d);else{let{extname:_}=await import("node:path"),N=_(d).toLowerCase(),F=s?.byExtension(N,"parse");if(!F){await Promise.resolve().then(() => Ur());throw El(d,N)}u=await F.parseDocument(P(d,"utf8"))}if(u=ur(u,d),t.projectRoot!==void 0){let{relative:_}=await import("node:path");u=Za(u,_(t.projectRoot,d))}}else{if(u=ur(c,c.tagName??"a component"),d=null,u.tagName&&i.has(u.tagName))return;if(u.tagName)i.add(u.tagName)}u=ou(u,t.projectState);let{tagName:p}=u;if(!p||!p.includes("-"))throw Error(`compileElement: tagName "${p}" must contain a hyphen`);let{dirname:m}=await import("node:path"),x=d?m(d):null,h=[];if(Array.isArray(u.$elements))for(let P of u.$elements){let S=Ne(P)?P.$ref:P;if(!k(S))continue;if(x)await a(S,x);let _=n?n(S,x):S.replace(/\.(?:json|jxn)$/i,".js");h.push(_)}let g=pu(p);if(r)u.$media={...r,...u.$media};let{rewriteSrc:b}=t,j=ic(u,g,h,b?(P)=>b(P,x):void 0,ko(u,t.defaults),t.serverBaseUrl),v=d?d.replace(/\.(?:json|jxn)$/i,".js"):`${p}.js`;o.push({content:j,path:v,tagName:p})}return await a(e,t.basePath??null),{files:o}}async function pI(e,t={}){let{title:n="Jx App",reactivitySrc:r=$s,litHtmlSrc:s=ws}=t,o=await _u(e,t),i=o.files.at(-1);if(!i)throw Error("compileElementPage: no element modules were produced");let{basename:a}=await import("node:path"),c=a(i.path),l=`<!DOCTYPE html>
164
+ `;return Pv(n,o,"utf8"),1}function Cv(e){let t=Xu(e,".nojekyll");if(Gu(t))return 0;return Pv(t,"","utf8"),1}var YI="/images/_optimized/*",jv=31536000,ZI="# Generated by @jxsuite/compiler — configure via build.headers in project.json.",QI="# ─── public/_headers (hand-authored; these rules override the block above) ───";var Rv=R(()=>{$n();yg()});async function Nv(e,t,n,r={}){let s={},o=bp(e);for(let i of n.projectContributions()){let a=i.project?.key;if(!a||!i.capabilities.projectData)continue;if(!t||!(a in t))continue;s[a]=await i.call("projectData",t[a],{io:o,projectConfig:t,registry:n,root:e,...r.lazy===!0&&{lazy:!0},...r.includeHeld===!0&&{includeHeld:!0}})}return s}var Tv=R(()=>{Br()});import{cpSync as tD,existsSync as nD,mkdirSync as rD}from"node:fs";import{dirname as sD,resolve as oD}from"node:path";async function Jv(e,t,n){let r=[],s=[],o=new Map;for(let i of e.assetProviders()){let a=i.project?.key,c=a?t[a]:void 0;if(a&&(c==null||I(c)&&Object.keys(c).length===0))continue;try{let l=await i.call("assets",c??null,{projectConfig:t,root:n});for(let u of l??[]){if(!I(u)||!u.urlPrefix||!u.dir)continue;let d={dir:u.dir,urlPrefix:Ll(u.urlPrefix)};if(_t(u.filter))d.filter=u.filter;let p=o.get(d.urlPrefix);if(p){if(p.dir!==d.dir)s.push(`Asset mount conflict: "${d.urlPrefix}" is claimed by both "${p.dir}" and "${d.dir}"`);continue}o.set(d.urlPrefix,d),r.push(d)}}catch(l){s.push(`Error in ${i.name}.assets: ${ge(l)}`)}}return{errors:s,mounts:r}}function xg(e,t,n){if(t.length===0||!e)return;for(let r of D$(e,t))n.add(r)}function Iv(e,t,n){let r=0,s=[];for(let o of e){let i=Vl(t,o);if(!i||!nD(i)){s.push(o);continue}let a=oD(n,decodeURIComponent(o).replace(/^\//,""));rD(sD(a),{recursive:!0}),tD(i,a),r+=1}return{copied:r,missing:s}}var Dv=R(()=>{$n();le();Rt()});import{readFileSync as iD}from"node:fs";import{dirname as aD,isAbsolute as cD,relative as lD,resolve as Mv,sep as uD}from"node:path";function Yu(e,t){return`${e}${t==="client"?bg:$g}`}function mD(e){if(e.endsWith(bg))return{documentPath:e.slice(0,-bg.length),side:"client"};if(e.endsWith($g))return{documentPath:e.slice(0,-$g.length),side:"server"};return null}function Ri(e,t,n){return Xa(e,Fv(t,n))}function Fv(e,t){return lD(t,e).split(uD).join("/")}function hD(e){return Bn(iD(e,"utf8"),e)}function Lv(e,t=hD){let n=new Map,r=(l)=>Fv(l,e),s=(l)=>{let u=n.get(l);if(u===void 0)u=(async()=>t(l))(),n.set(l,u);return u},o=async(l,u)=>{let d;try{d=await s(l)}catch(g){throw Error(`Cannot read ${r(l)} for its ${u} script`,{cause:g})}let p=d.$script?.[u];if(p===void 0)throw Error(`${r(l)} has no ${u} script: nothing in it is $script.${u}, but something names its ${u} module`);let[m,...x]=OS(p).problems;if(m!==void 0)throw new eu({path:r(l),pointer:`/$script/${u}`},[m,...x]);return p},i=(l)=>{let u=xi(l);if(u===null)return null;return{documentPath:Mv(e,u.path),side:u.side}},a=(l)=>({name:`jx-document-scripts-${l}`,setup:(u)=>{u.onResolve({filter:dD},({path:d})=>{let p=i(d);if(p===null)return;if(p.side==="server"&&l==="client")throw Error(`${r(p.documentPath)}: its server script cannot be imported by code a browser runs`);return{path:Yu(p.documentPath,p.side)}}),u.onResolve({filter:pD},({importer:d,path:p})=>{if(cD(p))return{path:Yu(p,"client")};return p.startsWith("./")||p.startsWith("../")?{path:Yu(Mv(aD(d),p),"client")}:void 0}),u.onLoad({filter:fD},async({path:d})=>{let p=mD(d);return{contents:await o(p.documentPath,p.side),loader:"ts"}})}}),c=async(l)=>{let u=i(l);if(u===null)throw Error(`"${l}" does not name a document's script`);return{contents:await o(u.documentPath,u.side),path:Yu(u.documentPath,u.side)}};return{clientPlugin:a("client"),module:c,serverPlugin:a("server")}}var bg=".jx-client.ts",$g=".jx-server.ts",fD,dD,pD;var Zu=R(()=>{tu();bi();ms();fD=/\.jx-(?:client|server)\.ts$/,dD=/^jx-script:/,pD=/\.jxn$/});async function Sg(e,t,n){let r=e.$layout??t.defaults?.layout??null;if(!r)return e;let s=await n(r);if(s.$layout)s=await Sg(s,t,n);let o=e.children??[],i=k(o)?[o]:Array.isArray(o)?o:[],a=yD(s);if(gD(a,i),e.state)a.state={...a.state,...e.state};if(e.$media)a.$media={...a.$media,...e.$media};if(e.style)a.style={...a.style,...e.style};if(e.attributes)a.attributes={...a.attributes,...e.attributes};if(e.$head)a._pageHead=e.$head;if(e.title)a._pageTitle=e.title;return delete a.$layout,a}function gD(e,t){let n=new Map,r=[];for(let s of t){let o=I(s)?s.attributes?.slot:void 0;if(o){let i=n.get(o);if(!i)i=[],n.set(o,i);i.push(s)}else r.push(s)}Vv(e,n,r)}function Vv(e,t,n){if(!I(e))return;if(!Array.isArray(e.children))return;let r=[];for(let s of e.children)if(I(s)&&s.tagName==="slot"){let o=s.attributes?.name,i=o?t.get(o):void 0;if(o&&i)r.push(...i),t.delete(o);else if(!o&&n.length>0)r.push(...n);else if(Array.isArray(s.children))r.push(...s.children)}else Vv(s,t,n),r.push(s);e.children=r}function yD(e){return structuredClone(e)}var qv=R(()=>{le()});import{existsSync as xD,readFileSync as bD}from"node:fs";import{resolve as Wv}from"node:path";function Hv(e){return(t)=>{let n=Wv(e,t);if(!xD(n))throw Error(`Layout not found: ${t} (resolved to ${n})`);try{let r=Bn(bD(n,"utf8"),n);return Ri(mr(r,n),n,e)}catch(r){throw Error(`Invalid layout at ${n}: ${ge(r)}`,{cause:r})}}}function Uv(e,t,n){return Sg(e,t,Hv(n))}function Qu(e,t,n){let r=Hv(n),s=[],o=e.$layout??t.defaults?.layout;while(o){let i=Wv(n,o);if(s.some((c)=>c.path===i))break;let a=r(o);s.push({doc:a,path:i}),o=a.$layout}return s}var wg=R(()=>{ui();Zu();ms();Rt();qv()});import{existsSync as Bv,readdirSync as $D}from"node:fs";import{dirname as SD,isAbsolute as wD,relative as vD,resolve as vg}from"node:path";function ED(e){let{$elements:t}=e;if(!Array.isArray(t))return[];let n=[];for(let r of t)if(L(r)&&k(r.$ref)&&r.$ref!=="")n.push(r.$ref);return n}async function zv(e){let{formatRegistry:t,pageSources:n,projectConfig:r,projectRoot:s}=e,o=[],i=[],a=new Set,c=new Map,l=(m)=>vD(s,m).replaceAll("\\","/"),u=async(m,x)=>{if(a.has(m))return;let g=l(m),y=x?`${x.declarer}: $elements entry "${x.ref}" names`:"";if(x){if(g.startsWith("..")||wD(g)){a.add(m),i.push(`${y} ${g}, outside the project`);return}if(!Bv(m)){a.add(m),i.push(`${y} no file (${g})`);return}}a.add(m);let S;try{S=Ri(await Qr(m,t),m,s)}catch(j){i.push(`Error compiling component ${g}: ${ge(j)}`);return}let E=k(S.tagName)?S.tagName:"";if(!E.includes("-")){i.push(x?`${y} ${g}, which is not a component (no hyphenated tagName)`:`Error compiling component ${g}: tagName "${E}" must contain a hyphen`);return}let v=c.get(E);if(v!==void 0){i.push(`${l(v)} and ${g} both declare tagName "${E}"; rename one`);return}c.set(E,m),o.push({doc:S,path:m,tagName:E}),await d(S,m)},d=async(m,x,g=SD(x))=>{for(let y of ED(m))await u(vg(g,y),{declarer:l(x),ref:y})},p=vg(s,"components");if(Bv(p)){let m=[".json",...t.documentExtensions("component")],x=$D(p).filter((g)=>m.some((y)=>g.endsWith(y))).toSorted();for(let g of x)await u(vg(p,g),null)}await d(r,An(s),s);for(let m of new Set(n))try{let x=await Qr(m,t),g=Qu(x,r,s);await d(x,m);for(let y of g)await d(y.doc,y.path)}catch{}return{components:o,errors:i}}var Kv=R(()=>{le();Rt();ho();Zu();wg();hg()});import{dirname as jD,relative as PD,resolve as _D,sep as kD}from"node:path";function Gv(e,t){return PD(t,e).split(kD).join("/")}function OD(e,t,n){if(!e.startsWith("./")&&!e.startsWith("../"))return e;return`./${Gv(_D(t,e),n)}`}function hc(e,t,n){let r=jD(t),s=Gv(t,n);return Lw(e).map((o)=>({exportName:o.exportName,src:OD(o.src,r,n),declaredIn:s}))}function Xv(e){let t=new Map;for(let{exportName:s,src:o,declaredIn:i}of e){let a=t.get(s)??new Map;if(t.set(s,a),!a.has(o))a.set(o,i)}let n=[],r=[];for(let[s,o]of t){let i=[...o];if(n.push({exportName:s,src:i[0][0]}),i.length>1){let a=i.map(([c,l])=>`${c} (declared in ${l})`);r.push(`Server function "${s}" is exported by ${i.length} different modules: ${a.join(", ")}. The site worker serves one function per export name, at /_jx/server/${s}, so a call meant for any but the first would get the first's answer. Rename the export in all but one module, and the $export that names it.`)}}return{entries:n,errors:r}}var Yv=R(()=>{Yn()});function Zv(e,t){if(!k(t)||t.trim()==="")return[...e];return[{attributes:{content:t,name:"description"},tagName:"meta"},...e]}function Qv(e=[],t=[],n=[],r={}){let s=[{attributes:{charset:r.charset??"utf8"},tagName:"meta"},{attributes:{content:"width=device-width, initial-scale=1",name:"viewport"},tagName:"meta"}],o=new Map;for(let a of[...s,...e,...t,...n]){let c=Eg(a);o.set(c,a)}let i=r.title??r.siteName??"Jx Site";if(o.set("title",{children:[i],tagName:"title"}),r.pageUrl&&r.siteUrl){let a=ys(r.pageUrl,r.siteUrl);if(![...o.values()].some((l)=>I(l)&&l.tagName==="link"&&l.attributes?.rel==="canonical")){let l={attributes:{href:a,rel:"canonical"},tagName:"link"};o.set(Eg(l),l)}if(!o.has("meta:og:url"))o.set("meta:og:url",{attributes:{content:a,property:"og:url"},tagName:"meta"})}if(r.siteName&&!o.has("meta:og:site_name"))o.set("meta:og:site_name",{attributes:{content:r.siteName,property:"og:site_name"},tagName:"meta"});for(let a of r.alternates??[]){let c={attributes:{href:a.href,hreflang:a.hreflang,rel:"alternate"},tagName:"link"},l=Eg(c);if(!o.has(l))o.set(l,c)}return[...o.values()]}function Eg(e){if(!I(e))return String(e);let t=e.tagName??"unknown",n=e.attributes??{};if(t==="title")return"title";if(n.charset)return"meta:charset";if(t==="meta"&&n.name)return`meta:${n.name}`;if(t==="meta"&&n.property)return`meta:${n.property}`;if(t==="link"&&n.rel){let r=n.hreflang??n.type??n.media??n.sizes??"";return`link:${n.rel}:${n.href??""}:${String(r)}`}if(t==="script"&&n.src)return`script:${n.src}`;if(t==="style"){let r=Array.isArray(e.children)?e.children.join(""):e.textContent,s=I(r)?JSON.stringify(r):r??"";return`style:${AD(s)}`}return`${t}:${JSON.stringify(e)}`}function AD(e){let t=0;for(let n=0;n<e.length;n++)t=Math.trunc((t<<5)-t+(e.codePointAt(n)??0));return t.toString(36)}function e0(e){return e.map((t)=>CD(t)).join(`
165
+ `)}function CD(e){if(k(e))return e;if(!I(e))return"";let t=e.tagName,n=e.attributes??{},r=Object.entries(n).map(([c,l])=>l===!0?c:`${c}="${RD(l)}"`).join(" "),s=r?`<${t} ${r}>`:`<${t}>`;if(t!==void 0&&new Set(["meta","link","base","br","hr","img","input"]).has(t))return s;let i=Array.isArray(e.children)?e.children.join(""):e.textContent,a=I(i)?JSON.stringify(i,null,2):i??"";return`${s}${a}</${t}>`}function RD(e){return String(e).replaceAll("&","&amp;").replaceAll('"',"&quot;").replaceAll("<","&lt;")}var t0=R(()=>{$n();le()});function JD(e){let t=e.indexOf(":");if(t===-1)return!1;if(t===e.length-1)return!1;try{return new URL(e).protocol!==""}catch{return!1}}function ID(e){if(!k(e))return[];return e.split(/\s+/).filter((t)=>{if(t==="")return!1;let n=t.toLowerCase();return!ND.has(n)&&!TD.has(n)&&!JD(t)})}function n0(e){let t=new Set;for(let n of e){if(!I(n)||n.tagName!=="link")continue;for(let r of ID(n.attributes?.rel))t.add(r)}return[...t]}var ND,TD;var r0=R(()=>{le();ND=new Set(["about","acl","alternate","amphtml","api-catalog","appendix","apple-touch-icon","apple-touch-startup-image","archives","author","blocked-by","bookmark","c2pa-manifest","canonical","chapter","cite-as","collection","compression-dictionary","contents","convertedfrom","copyright","create-form","current","deprecation","describedby","describes","disclosure","dns-prefetch","dpp","duplicate","edit","edit-form","edit-media","enclosure","external","first","geofeed","glossary","help","hosts","hub","ice-server","icon","index","intervalafter","intervalbefore","intervalcontains","intervaldisjoint","intervalduring","intervalequals","intervalfinishedby","intervalfinishes","intervalin","intervalmeets","intervalmetby","intervaloverlappedby","intervaloverlaps","intervalstartedby","intervalstarts","item","last","latest-version","license","linkset","lrdd","manifest","mask-icon","me","media-feed","memento","micropub","modulepreload","monitor","monitor-group","next","next-archive","nofollow","noopener","noreferrer","opener","openid2.local_id","openid2.provider","original","p3pv1","payment","pingback","preconnect","predecessor-version","prefetch","preload","prerender","prev","prev-archive","preview","previous","privacy-policy","profile","publication","rdap-active","rdap-bottom","rdap-down","rdap-top","rdap-up","related","replies","restconf","ruleinput","search","section","self","service","service-desc","service-doc","service-meta","sip-trunking-capability","sponsored","start","status","stylesheet","subsection","successor-version","sunset","tag","terms-of-service","timegate","timemap","type","ugc","up","version-history","via","webmention","working-copy","working-copy-of"]),TD=new Set(["shortcut"])});async function rf(e,t={}){let{resolveElementPath:n,$media:r,formats:s}=t,o=[],i=new Set;async function a(c,l){let u,d;if(k(c)){let{readFileSync:T}=await import("node:fs"),{resolve:U}=await import("node:path");if(d=l?U(l,c):U(c),i.has(d))return;if(i.add(d),Hr(d))u=Bn(T(d,"utf8"),d);else{let{extname:F}=await import("node:path"),H=F(d).toLowerCase(),A=s?.byExtension(H,"parse");if(!A){await Promise.resolve().then(() => Br());throw Dl(d,H)}u=await A.parseDocument(T(d,"utf8"))}if(u=mr(u,d),t.projectRoot!==void 0){let{relative:F}=await import("node:path");u=Xa(u,F(t.projectRoot,d))}}else{if(u=mr(c,c.tagName??"a component"),d=null,u.tagName&&i.has(u.tagName))return;if(u.tagName)i.add(u.tagName)}await t.prepareDocument?.(u,d);let p=u.state??{};u=Ou(u,t.projectState);let{tagName:m}=u;if(!m||!m.includes("-"))throw Error(`compileElement: tagName "${m}" must contain a hyphen`);let{dirname:x}=await import("node:path"),g=d?x(d):null,y=[];if(Array.isArray(u.$elements))for(let T of u.$elements){let U=Ce(T)?T.$ref:T;if(!k(U))continue;if(g)await a(U,g);let F=n?n(U,g):U.replace(/\.(?:json|jxn)$/i,".js");y.push(F)}let S=Wu(m);if(r)u.$media={...r,...u.$media};let{resolveClass:E,rewriteSrc:v}=t,j=u.imports??{},P=jg(u,S,y,v?(T)=>v(T,g):void 0,Ao(u,t.defaults),t.serverBaseUrl,Object.keys(u.state??{}).filter((T)=>!(T in p)),E?(T)=>E(T,g,j):void 0),O=d?d.replace(/\.(?:json|jxn)$/i,".js"):`${m}.js`;o.push({content:P,path:O,tagName:m})}return await a(e,t.basePath??null),{files:o}}async function MD(e,t={}){let{title:n="Jx App",reactivitySrc:r=vs,litHtmlSrc:s=Es}=t,o=await rf(e,t),i=o.files.at(-1);if(!i)throw Error("compileElementPage: no element modules were produced");let{basename:a}=await import("node:path"),c=a(i.path),l=`<!DOCTYPE html>
158
166
  <html lang="en">
159
167
  <head>
160
168
  <meta charset="utf-8">
161
169
  <meta name="viewport" content="width=device-width, initial-scale=1">
162
- <title>${Ee(n)}</title>
170
+ <title>${ve(n)}</title>
163
171
  <script type="importmap">
164
172
  {
165
173
  "imports": {
@@ -173,78 +181,69 @@ ${r}
173
181
  <${i.tagName}></${i.tagName}>
174
182
  <script type="module" src="./${c}"></script>
175
183
  </body>
176
- </html>`;return{files:o.files,html:l}}function mI(e){if(!D(e)||Array.isArray(e))return JSON.stringify(e);if("default"in e)return JSON.stringify(e.default);if(rs(e))return;if(e.$prototype==="LocalStorage"||e.$prototype==="SessionStorage")return JSON.stringify(e.default??null);if(e.$prototype==="Request")return"null";if(Mr(e))return"null";return JSON.stringify(e)}function ic(e,t,n,r,s=null,o="/_jx/server"){let i=["// Generated by @jxsuite/compiler — do not edit manually"];if(e.$id)i.push(`// Source: ${e.$id}`);for(let S of n)i.push(`import '${S}';`);let a=e.state??{},c=jo(e),l=cu(au(a,c),r);i.push(...l.imports);let u=Object.entries(a).flatMap(([S,_])=>_n(_)&&_.$prototype==="Request"?[[S,_]]:[]),d=Object.entries(a).flatMap(([S,_])=>Mr(_)?[[S,_]]:[]);if(i.push("import { reactive, computed, effect, stop } from '@vue/reactivity';","import { render, html, nothing } from 'lit-html';",uu()),d.length>0)i.push(fu());let p=s===null&&xs(e.children);if(p)i.push(S$());i.push(...l.loaders,"",`class ${t} extends HTMLElement {`," #effects = [];"," #rendered = false;",...s===null?[]:[" #root = null;"],""," constructor() {"," super();");let m=[],x=[],h=[],g=[],b=[];for(let[S,_]of Object.entries(a))if(yn(_))if(Ir(_))g.push([S,_]);else if(mr(_.$expression.operator))h.push([S,_]);else x.push([S,_]);else if(jt(_))(c.get(S)==="computed"?x:h).push([S,_]);else if(k(_)&&_.includes("${"))b.push([S,_]);else{let N=mI(_);if(N!==void 0)m.push([S,N])}i.push(" this.state = reactive({");for(let[S,_]of m)i.push(` ${Gr(S)}: ${_},`);i.push(" });");for(let[S,_]of h)if(i.push(""),yn(_)){let N=Yt(_.$expression,{eventParam:"e",statePrefix:"s"});i.push(` ${Je("this.state",Xt(S))} = (s, e) => { ${N}; };`)}else if(sr(_)){let N=Jn(_.body,{dispatchTarget:"this",eventParam:"e",indent:" ",statePrefix:"this.state"});i.push(` ${Je("this.state",Xt(S))} = (s, e) => {`,N," };")}else{let N=Je("this.state",Xt(S));if(_.$src)i.push(` ${N} = ${S};`);else{let F=k(_.body)?_.body:"";i.push(` ${N} = (${fr(_).join(", ")}) => {`,` ${F}`," };")}}for(let[S,_]of g){i.push("");let N=Yt(_.$expression,{eventParam:"e",statePrefix:"this.state"});i.push(` ${Je("this.state",Xt(S))} = ${nc(_,N)};`)}for(let[S,_]of b)i.push("",` ${Je("this.state",Xt(S))} = computed(() => ${lu(ki(_,"this.state",{code:!1}))});`);for(let[S,_]of x)if(i.push(""),yn(_)){let N=Yt(_.$expression,{eventParam:"e",statePrefix:"this.state"});i.push(` ${Je("this.state",Xt(S))} = computed(() => ${N});`)}else if(_.$src)i.push(` ${Je("this.state",Xt(S))} = computed(() => ${S}(this.state));`);else{i.push(` ${Je("this.state",Xt(S))} = computed(() => {`);let N=ki(k(_.body)?_.body:"","this.state");i.push(` ${N}`," });")}i.push(" }","");let j=[];if(Array.isArray(e.children)){let S={n:0};for(let _ of e.children)bs(_,j,e.$media??{},"",S,e.tagName)}let v=Tw(),P=!Array.isArray(e.children)&&e.textContent!==void 0?` ${ku(e.textContent)}`:Pu(e.children,e.style," ",!1,!1,v);i.push(" template() {"," const s = this.state;",...v.decls," return html`",P," `;"," }","",...s===null?[]:[" #renderRoot() {"," if (this.#root) return this.#root;",s==="closed"?" this.#root = this.attachInternals().shadowRoot ?? this.attachShadow({ mode: 'closed' });":" this.#root = this.shadowRoot ?? this.attachShadow({ mode: 'open' });"," return this.#root;"," }",""]," connectedCallback() {"," const _pa = this.getAttribute('data-jx-props');"," if (_pa) {"," try {"," const _p = JSON.parse(_pa);"," for (const [k, v] of Object.entries(_p)) {"," if (k.startsWith('#')) continue;"," if (k in this.state) this.state[k] = v;"," }"," } catch {}"," this.removeAttribute('data-jx-props');"," }"," const _pn = this.getAttributeNames().filter(n => n.startsWith('props.') && n.length > 6);"," for (const _n of _pn) {"," const _k = _n.slice(6);"," if (_k.startsWith('#')) { this.removeAttribute(_n); continue; }"," if (_k in this.state) {"," this.state[_k] = this.getAttribute(_n);"," this.removeAttribute(_n);"," }"," }"," for (const key of Object.keys(this.state)) {"," if (key.startsWith('#')) continue;"," if (this.hasOwnProperty(key) && this[key] !== undefined) {"," this.state[key] = this[key];"," }"," }");for(let[S,_]of u)i.push(nu(S,_,{collect:"this.#effects",indent:" ",statePrefix:"this.state"}));for(let[S,_]of d)i.push(ru(S,_,{collect:"this.#effects",indent:" ",serverBaseUrl:o,statePrefix:"this.state"}));if(D(e.style)){let S=[];for(let[_,N]of Object.entries(e.style)){if(_.startsWith(":")||_.startsWith(".")||_.startsWith("&")||_.startsWith("[")||_.startsWith("@"))continue;if(k(N)&&N.includes("${"))S.push([an(_),N])}if(S.length>0){i.push(" this.#effects.push(effect(() => {");for(let[_,N]of S){let F=N.replaceAll(/\$\{([^}]+)\}/g,(K,J)=>`\${${ki(J,"this.state")}}`);i.push(` this.style['${_}'] = \`${F}\`;`)}i.push(" }));")}}if(i.push(" const _first = !this.#rendered;"," this.#rendered = true;"),p)i.push(` const _slotted = _first ? ${Up}(this) : null;`);if(i.push(" if (this.hasAttribute('data-jx-prerendered')) {"," this.removeAttribute('data-jx-prerendered');"," }"),s===null)i.push(" if (_first) this.replaceChildren();"," this.#effects.push(effect(() => render(this.template(), this)));");else i.push(" const _root = this.#renderRoot();"," if (_first) {"," for (const _n of [..._root.childNodes]) {"," if (!(_n.nodeType === 1 && _n.tagName === 'LINK')) _n.remove();"," }"," }"," this.#effects.push(effect(() => render(this.template(), _root)));");if(p)i.push(` if (_first) ${Bp}(this, _slotted);`);return i.push(" if (typeof this.state.onMount === 'function') {"," queueMicrotask(() => this.state.onMount(this.state));"," }"," }",""," disconnectedCallback() {"," for (const _e of this.#effects) { stop(_e); }"," this.#effects.length = 0;"," if (typeof this.state.onUnmount === 'function') { this.state.onUnmount(this.state); }"," }","}","",`customElements.define('${e.tagName}', ${t});`,""),i.join(`
177
- `)}function Tw(){return{byText:new Map,decls:[]}}function Jw(e,t){let n=e.byText.get(t);if(n)return n;let r=`_c${e.decls.length}`;e.decls.push(` const ${r} = html\`
184
+ </html>`;return{files:o.files,html:l}}function FD(e){if(!I(e)||Array.isArray(e))return JSON.stringify(e);if("default"in e)return JSON.stringify(e.default);if(os(e))return;if(e.$prototype==="LocalStorage"||e.$prototype==="SessionStorage")return JSON.stringify(e.default??null);if(e.$prototype==="Request")return"null";if(ki(e))return"null";if(Mr(e))return"null";return JSON.stringify(e)}function jg(e,t,n,r,s=null,o="/_jx/server",i=[],a){let c=["// Generated by @jxsuite/compiler — do not edit manually"];if(e.$id)c.push(`// Source: ${e.$id}`);for(let M of n)c.push(`import '${M}';`);let l=e.state??{},u=_o(e),d=Ru(Cu(l,u),r);c.push(...d.imports);let p=Mu(l,a),m=p.entries.length>0;c.push(...p.imports);let x=Object.entries(l).flatMap(([M,D])=>yn(D)&&D.$prototype==="Request"?[[M,D]]:[]),g=Object.entries(l).flatMap(([M,D])=>Mr(D)?[[M,D]]:[]);c.push("import { reactive, computed, effect, stop } from '@vue/reactivity';","import { render, html, nothing } from 'lit-html';",Tu());let y=Object.keys(l).filter((M)=>!kd(M)),S=y.filter((M)=>!DD.has(M)),E=S.filter((M)=>i.includes(M)),v=E.length>0;if(c.push(`const __jxProps = ${JSON.stringify(y)};`),S.length>0)c.push(`const __jxBridged = ${JSON.stringify(S)};`,kw());if(v)c.push(`const __jxInherited = new Set(${JSON.stringify(E)});`);let j=cc(e);if(j.length>0)c.push(Ow(),`const __jxObserved = ${JSON.stringify(j)};`,`const __jxObservedDefaults = () => ${Cw(e)};`);if(g.length>0)c.push(Iu());if(m)c.push(Du());let P=s===null&&ws(e.children);if(P)c.push(Tw());c.push(...d.loaders,"",`class ${t} extends HTMLElement {`," #effects = [];"," #rendered = false;",...s===null?[]:[" #root = null;"],...m?[" #jxInstances = new Map();"," #jxReady = null;"," #jxConnection = 0;"," #jxDrawn = false;"]:[],"",...j.length>0?[" static get observedAttributes() { return __jxObserved; }",""]:[]," constructor() {"," super();");let O=[],T=[],U=[],F=[],H=[];for(let[M,D]of Object.entries(l))if(gn(D))if(Dr(D))F.push([M,D]);else if(xr(D.$expression.operator))U.push([M,D]);else T.push([M,D]);else if(kt(D))(u.get(M)==="computed"?T:U).push([M,D]);else if(k(D)&&D.includes("${"))H.push([M,D]);else{let X=FD(D);if(X!==void 0)O.push([M,X])}c.push(" this.state = reactive({");for(let[M,D]of O)c.push(` ${Xr(M)}: ${D},`);c.push(" });");for(let[M,D]of U)if(c.push(""),gn(D)){let X=Xt(D.$expression,{eventParam:"e",statePrefix:"s"});c.push(` ${Re("this.state",qt(M))} = (s, e) => { ${X}; };`)}else if(cr(D)){let X=Tn(D.body,{dispatchTarget:"this",eventParam:"e",indent:" ",statePrefix:"this.state"});c.push(` ${Re("this.state",qt(M))} = (s, e) => {`,X," };")}else{let X=Re("this.state",qt(M));if(D.$src)c.push(` ${X} = ${M};`);else{let re=k(D.body)?D.body:"";c.push(` ${X} = (${hr(D).join(", ")}) => {`,` ${re}`," };")}}for(let[M,D]of F){c.push("");let X=Xt(D.$expression,{eventParam:"e",statePrefix:"this.state"});c.push(` ${Re("this.state",qt(M))} = ${ic(D,X)};`)}for(let[M,D]of H)c.push("",` ${Re("this.state",qt(M))} = computed(() => ${Nu(ji(D,"this.state",{code:!1}))});`);for(let[M,D]of T)if(c.push(""),gn(D)){let X=Xt(D.$expression,{eventParam:"e",statePrefix:"this.state"});c.push(` ${Re("this.state",qt(M))} = computed(() => ${X});`)}else if(D.$src)c.push(` ${Re("this.state",qt(M))} = computed(() => ${M}(this.state));`);else{c.push(` ${Re("this.state",qt(M))} = computed(() => {`);let X=ji(k(D.body)?D.body:"","this.state");c.push(` ${X}`," });")}c.push(" }","");let A={n:0};for(let M of Vu(e))Dw(M,A,e.tagName??"jx");let N=i0(),B=!Array.isArray(e.children)&&e.textContent!==void 0?` ${sf(e.textContent)}`:nf(e.children,e.style," ",!1,!1,N);if(c.push(" template() {"," const s = this.state;",...N.decls," return html`",B," `;"," }","",...s===null?[]:[" #renderRoot() {"," if (this.#root) return this.#root;",s==="closed"?" this.#root = this.attachInternals().shadowRoot ?? this.attachShadow({ mode: 'closed' });":" this.#root = this.shadowRoot ?? this.attachShadow({ mode: 'open' });"," return this.#root;"," }",""]," connectedCallback() {"," const _first = !this.#rendered;"," this.#rendered = true;",...v?[" const _given = new Set();"]:[],...j.length>0?[" if (_first) {"," const _d = __jxObservedDefaults();"," for (const _a of __jxObserved) {",` if (this.hasAttribute(_a)) ${Ju}(this.state, _a, this.getAttribute(_a), _d);`," }"," }"]:[]," const _pa = this.getAttribute('data-jx-props');"," if (_pa) {"," try {"," const _p = JSON.parse(_pa);"," for (const [k, v] of Object.entries(_p)) {"," if (k.startsWith('#')) continue;",v?" if (__jxProps.includes(k)) { this.state[k] = v; _given.add(k); }":" if (__jxProps.includes(k)) this.state[k] = v;"," }"," } catch {}"," this.removeAttribute('data-jx-props');"," }"," const _pn = this.getAttributeNames().filter(n => n.startsWith('props.') && n.length > 6);"," for (const _n of _pn) {"," const _k = _n.slice(6);"," if (_k.startsWith('#')) { this.removeAttribute(_n); continue; }"," if (__jxProps.includes(_k)) {"," this.state[_k] = this.getAttribute(_n);",...v?[" _given.add(_k);"]:[]," this.removeAttribute(_n);"," }"," }"),S.length>0)c.push(" if (_first) {"," for (const _k of __jxBridged) {",` if (_k in this && this[_k] !== undefined && ${Bh}(this, _k)) {`," this.state[_k] = this[_k];",...v?[" _given.add(_k);"]:[]," }"," }"," for (const _k of __jxBridged) {",...v?[" if (__jxInherited.has(_k) && !_given.has(_k)) continue;"]:[],` const _set = ${zh}(this, _k);`," Object.defineProperty(this, _k, {"," configurable: true,"," get: () => this.state[_k],"," set: (v) => { if (_set) _set.call(this, v); this.state[_k] = v; },"," });"," }"," }");if(m)c.push(` this.#jxReady ??= ${Fu(p.entries,{indent:" ",instances:"this.#jxInstances",statePrefix:"this.state"})};`," const _c = ++this.#jxConnection;"," this.#jxReady.then(() => {"," if (_c === this.#jxConnection && this.isConnected) this.#jxRender();"," });"," }",""," #jxRender() {"," const _first = !this.#jxDrawn;"," this.#jxDrawn = true;");for(let[M,D]of x)c.push(Pu(M,D,{collect:"this.#effects",indent:" ",statePrefix:"this.state"}));for(let[M,D]of g)c.push(_u(M,D,{collect:"this.#effects",indent:" ",serverBaseUrl:o,statePrefix:"this.state"}));if(I(e.style)){let M=[];for(let[D,X]of Object.entries(e.style)){if(D.startsWith(":")||D.startsWith(".")||D.startsWith("&")||D.startsWith("[")||D.startsWith("@"))continue;if(k(X)&&X.includes("${"))M.push([on(D),X])}if(M.length>0){c.push(" this.#effects.push(effect(() => {");for(let[D,X]of M){let re=X.replaceAll(/\$\{([^}]+)\}/g,(ue,xe)=>`\${${ji(xe,"this.state")}}`);c.push(` this.style['${D}'] = \`${re}\`;`)}c.push(" }));")}}if(P)c.push(` const _slotted = _first ? ${Xh}(this) : null;`);if(c.push(" if (this.hasAttribute('data-jx-prerendered')) {"," this.removeAttribute('data-jx-prerendered');"," }"),s===null)c.push(" if (_first) this.replaceChildren();"," this.#effects.push(effect(() => render(this.template(), this)));");else c.push(" const _root = this.#renderRoot();"," if (_first) {"," for (const _n of [..._root.childNodes]) {"," if (!(_n.nodeType === 1 && _n.tagName === 'LINK')) _n.remove();"," }"," }"," this.#effects.push(effect(() => render(this.template(), _root)));");if(P)c.push(` if (_first) ${Yh}(this, _slotted);`);if(c.push(" if (_first && typeof this.state.onMount === 'function') {"," queueMicrotask(() => this.state.onMount.call(this, this.state, this));"," }"," }",""," disconnectedCallback() {"," for (const _e of this.#effects) { stop(_e); }"," this.#effects.length = 0;"," if (typeof this.state.onUnmount === 'function') { this.state.onUnmount(this.state); }"," }"),"onAdopted"in l)c.push(""," adoptedCallback() {"," if (typeof this.state.onAdopted === 'function') { this.state.onAdopted(this.state); }"," }");if(j.length>0)c.push(""," attributeChangedCallback(name, oldVal, newVal) {"," if (oldVal === newVal) return;",` ${Ju}(this.state, name, newVal, __jxObservedDefaults());`," }");return c.push("}","",`customElements.define('${e.tagName}', ${t});`,""),c.join(`
185
+ `)}function i0(){return{byText:new Map,decls:[]}}function a0(e,t){let n=e.byText.get(t);if(n)return n;let r=`_c${e.decls.length}`;e.decls.push(` const ${r} = html\`
178
186
  ${t}
179
- \`;`);let s=`\${${r}}`;return e.byText.set(t,s),s}function Pu(e,t,n,r=!1,s=!1,o=null,i=!1){if(!e)return"";let a=i?Ri:"";if(at(e))return`${Nw(e,n)}${a}`;if(!Array.isArray(e))return"";return e.map((c)=>{if(at(c))return`${Nw(c,n)}${a}`;let l=bm(c,r?"":n,r,s,o);return k(c)&&c.includes("${")||D(c)&&or(c.tagName)?`${l}${a}`:l}).join(r?"":`
180
- `)}function bm(e,t,n=!1,r=!1,s=null,o=null){if(k(e)){if(e.includes("${"))return`${t}${ku(e)}`;return`${t}${Ee(e)}`}if(St(e)||Mt(e))return`${t}${Ee(String(e))}`;if(!D(e))return"";if(or(e.tagName)){let h=e.tagName.$expression,g=Xr(h.target,{eventParam:"e",statePrefix:"s"}),b=h.operator==="?:"?[[!0,h.value],[!1,h.initial]]:[...Object.entries(h.cases),["__default__",h.default]],j=b.map(([,F])=>F),v=j.map((F)=>n||vs.has(F)),P=null;if(s&&v.every((F)=>F===v[0])){let F=Cw(e,`${t} `,v[0]===!0,r,s,j.some((K)=>K.includes("-")));if(F.trim()!=="")P=Jw(s,F)}let S=b.map(([F,K])=>{let J={...e,tagName:K};return[F,bm(J,`${t} `,n,r,s,P)]});if(h.operator==="?:"){let[,F]=S[0],[,K]=S[1];return`${t}\${${g}
187
+ \`;`);let s=`\${${r}}`;return e.byText.set(t,s),s}function nf(e,t,n,r=!1,s=!1,o=null,i=!1){if(!e)return"";let a=i?Oi:"";if(nt(e))return`${o0(e,n)}${a}`;if(!Array.isArray(e))return"";return e.map((c)=>{if(nt(c))return`${o0(c,n)}${a}`;let l=Pg(c,r?"":n,r,s,o);return k(c)&&c.includes("${")||I(c)&&lr(c.tagName)?`${l}${a}`:l}).join(r?"":`
188
+ `)}function Pg(e,t,n=!1,r=!1,s=null,o=null){if(k(e)){if(e.includes("${"))return`${t}${sf(e)}`;return`${t}${ve(e)}`}if(We(e)||bt(e))return`${t}${ve(String(e))}`;if(!I(e))return"";if(lr(e.tagName)){let y=e.tagName.$expression,S=Yr(y.target,{eventParam:"e",statePrefix:"s"}),E=y.operator==="?:"?[[!0,y.value],[!1,y.initial]]:[...Object.entries(y.cases),["__default__",y.default]],v=E.map(([,F])=>F),j=v.map((F)=>n||Ps.has(F)),P=null;if(s&&j.every((F)=>F===j[0])){let F=s0(e,`${t} `,j[0]===!0,r,s,v.some((H)=>H.includes("-")));if(F.trim()!=="")P=a0(s,F)}let O=E.map(([F,H])=>{let A={...e,tagName:H};return[F,Pg(A,`${t} `,n,r,s,P)]});if(y.operator==="?:"){let[,F]=O[0],[,H]=O[1];return`${t}\${${S}
181
189
  ? html\`
182
190
  ${F}
183
191
  \`
184
192
  : html\`
185
- ${K}
186
- \`}`}let _=S.flatMap(([F,K])=>F==="__default__"?[]:[` ${JSON.stringify(F)}: html\`
187
- ${K}
188
- \``]),[,N]=S.at(-1);return`${t}\${{
189
- ${_.join(`,
193
+ ${H}
194
+ \`}`}let T=O.flatMap(([F,H])=>F==="__default__"?[]:[` ${JSON.stringify(F)}: html\`
195
+ ${H}
196
+ \``]),[,U]=O.at(-1);return`${t}\${{
197
+ ${T.join(`,
190
198
  `)}
191
- }[String(${g})] ?? html\`
192
- ${N}
193
- \`}`}let i=e.tagName??"div",a=n||vs.has(i),c=[];if(e.attributes)for(let[h,g]of Object.entries(e.attributes))if(Ne(g))c.push(`${h}="\${${Ai}('${h}', ${gr(g.$ref)}) ?? nothing}"`);else if(k(g)&&hI(g))c.push(`${h}="\${${Ai}('${h}', ${vn(g).slice(2,-1)}) ?? nothing}"`);else if(k(g)&&g.includes("${"))c.push(`${h}="${vn(g)}"`);else if(Mt(g)){let b=_o(h,g);if(b!==null)c.push(b===""?h:`${h}="${b}"`)}else c.push(`${h}="${g}"`);if(e.id)c.push(`id="${vn(String(e.id))}"`);if(e.className)c.push(`class="${vn(String(e.className))}"`);for(let[h,g]of Object.entries(e)){if(Yr.has(h)||h.startsWith("$")||h.startsWith("on")||h==="tagName"||h==="id"||h==="className"||h==="style"||h==="children"||h==="textContent"||h==="innerHTML"||h==="attributes")continue;if(ju(g))c.push(`.${h}="\${${gr(g.$ref)}}"`);else if(k(g)&&g.includes("${"))c.push(`.${h}="${vn(g)}"`);else c.push(`.${h}="\${${JSON.stringify(g)}}"`)}if(e.$props)for(let[h,g]of Object.entries(e.$props))if(ju(g))c.push(`.${h}="\${${gr(g.$ref)}}"`);else if(k(g)&&g.includes("${"))c.push(`.${h}="${vn(g)}"`);else c.push(`.${h}="\${${JSON.stringify(g)}}"`);let l=r?"s.$map = $map; ":"";for(let[h,g]of Object.entries(e)){if(!h.startsWith("on")||h==="observedAttributes")continue;Ss(`inline "${h}" handler`,g);let b=h.slice(2).toLowerCase();if(ju(g))c.push(l?`@${b}="\${(e) => { ${l}${gr(g.$ref)}(s, e); }}"`:`@${b}="\${(e) => ${gr(g.$ref)}(s, e)}"`);else if(D(g)&&"$expression"in g){let j=Yt(g.$expression,{eventParam:"e",statePrefix:"s"});c.push(`@${b}="\${(e) => { ${l}${j}; }}"`)}else if(jt(g))c.push(`@${b}="\${(e) => { ${l}${Mw(g)} }}"`)}let u=Dw(e.style);if(u)c.push(`style="${u}"`);let d=c.length>0?`
199
+ }[String(${S})] ?? html\`
200
+ ${U}
201
+ \`}`}let i=e.tagName??"div",a=n||Ps.has(i),c=[],l=c0(e,vn,Zn);if(e.attributes)for(let[y,S]of Object.entries(e.attributes)){if(y==="class"&&l!==null)continue;if(Ce(S))c.push(`${y}="\${${_i}('${y}', ${Zn(S.$ref)}) ?? nothing}"`);else if(k(S)&&LD(S))c.push(`${y}="\${${_i}('${y}', ${vn(S).slice(2,-1)}) ?? nothing}"`);else if(k(S)&&S.includes("${"))c.push(`${y}="${vn(S)}"`);else if(bt(S)){let E=Ss(y,S);if(E!==null)c.push(E===""?y:`${y}="${E}"`)}else c.push(`${y}="${S}"`)}if(e.id)c.push(`id="${vn(String(e.id))}"`);if(l!==null)c.push(l);for(let[y,S]of Object.entries(e)){if($s.has(y)||y.startsWith("$")||y.startsWith("on")||y==="tagName"||y==="id"||y==="className"||y==="style"||y==="children"||y==="textContent"||y==="innerHTML"||y==="attributes")continue;if(tf(S))c.push(`.${y}="\${${Zn(S.$ref)}}"`);else if(k(S)&&S.includes("${"))c.push(`.${y}="${vn(S)}"`);else c.push(`.${y}="\${${JSON.stringify(S)}}"`)}if(e.$props)for(let[y,S]of Object.entries(e.$props))if(tf(S))c.push(`.${y}="\${${Zn(S.$ref)}}"`);else if(k(S)&&S.includes("${"))c.push(`.${y}="${vn(S)}"`);else c.push(`.${y}="\${${JSON.stringify(S)}}"`);let u=r?"s.$map = $map; ":"";for(let[y,S]of Object.entries(e)){if(!y.startsWith("on")||y==="observedAttributes")continue;js(`inline "${y}" handler`,S);let E=y.slice(2).toLowerCase();if(tf(S))c.push(u?`@${E}="\${(e) => { ${u}${Zn(S.$ref)}(s, e); }}"`:`@${E}="\${(e) => ${Zn(S.$ref)}(s, e)}"`);else if(I(S)&&"$expression"in S){let v=Xt(S.$expression,{eventParam:"e",statePrefix:"s"});c.push(`@${E}="\${(e) => { ${u}${v}; }}"`)}else if(kt(S))c.push(`@${E}="\${(e) => { ${u}${u0(S)} }}"`)}let d=f0(e.style);if(d)c.push(`style="${d}"`);let p=c.length>0?`
194
202
  ${t} ${c.join(`
195
- ${t} `)}`:"";if(new Set(["input","br","hr","img","meta","link"]).has(i))return`${t}<${i}${d}
196
- ${t}>`;let m=o??Cw(e,t,a,r,s,i.includes("-")),x=i==="slot"?Ri:"";return a?`${x}<${i}${d}>${m}${x}</${i}>`:`${t}${x}<${i}${d}
197
- ${t}>${m}${x}</${i}>`}function Cw(e,t,n,r,s,o=!1){if(e.$switch){let i=Ne(e.$switch)?e.$switch.$ref:e.$switch,a=gr(i),c=[];for(let[p,m]of Object.entries(e.cases??{})){if(!m||Ne(m))continue;c.push([p,bm(m,`${t} `,!1,r,s)])}let l=c.map(([,p])=>p),u=new Set(l.filter((p,m)=>l.indexOf(p)!==m&&p.trim()!==""));return`\${{
198
- ${c.map(([p,m])=>{let x=s&&u.has(m)?Jw(s,m):m;return` ${JSON.stringify(p)}: html\`
203
+ ${t} `)}`:"";if(new Set(["input","br","hr","img","meta","link"]).has(i))return`${t}<${i}${p}
204
+ ${t}>`;let x=o??s0(e,t,a,r,s,i.includes("-")),g=i==="slot"?Oi:"";return a?`${g}<${i}${p}>${x}${g}</${i}>`:`${t}${g}<${i}${p}
205
+ ${t}>${x}${g}</${i}>`}function s0(e,t,n,r,s,o=!1){if(e.$switch){let i=Ce(e.$switch)?e.$switch.$ref:e.$switch,a=Zn(i),c=[];for(let[p,m]of Object.entries(e.cases??{})){if(!m||Ce(m))continue;c.push([p,Pg(m,`${t} `,!1,r,s)])}let l=c.map(([,p])=>p),u=new Set(l.filter((p,m)=>l.indexOf(p)!==m&&p.trim()!==""));return`\${{
206
+ ${c.map(([p,m])=>{let x=s&&u.has(m)?a0(s,m):m;return` ${JSON.stringify(p)}: html\`
199
207
  ${x}
200
208
  \``}).join(`,
201
209
  `)}
202
- }[${a}]}`}if(e.textContent!==void 0){let i=ku(e.textContent),a=Ne(e.textContent)||k(e.textContent)&&e.textContent.includes("${");return o&&a?`${i}${Ri}`:i}if(e.innerHTML!==void 0)return e.innerHTML;if(e.children)return n?Pu(e.children,e.style,"",!0,r,s,o):`
203
- ${Pu(e.children,e.style,`${t} `,!1,r,s,o)}
204
- ${t}`;return""}function Nw(e,t){let n=Ne(e.items)?gr(e.items.$ref):"ITEMS",r=e.map;if(!r)return"";let s=r.tagName??"div",o=[];if(r.attributes)for(let[m,x]of Object.entries(r.attributes))if(Ne(x))o.push(`${m}="\${${xm(x.$ref)}}"`);else if(k(x)&&x.includes("${"))o.push(`${m}="${vn(x)}"`);else o.push(`${m}="${x}"`);if(r.id)o.push(`id="${vn(String(r.id))}"`);if(r.className)o.push(`class="${vn(String(r.className))}"`);for(let[m,x]of Object.entries(r)){if(Yr.has(m)||m.startsWith("$")||m.startsWith("on")||m==="tagName"||m==="id"||m==="className"||m==="style"||m==="children"||m==="textContent"||m==="innerHTML"||m==="attributes")continue;if(ju(x))o.push(`.${m}="\${${xm(x.$ref)}}"`);else if(k(x)&&x.includes("${"))o.push(`.${m}="${vn(x)}"`);else o.push(`.${m}="\${${JSON.stringify(x)}}"`)}if(r.$props)for(let[m,x]of Object.entries(r.$props))if(Ne(x))o.push(`.${m}="\${${xm(x.$ref)}}"`);else if(k(x)&&x.includes("${"))o.push(`.${m}="${vn(x)}"`);else o.push(`.${m}="\${${JSON.stringify(x)}}"`);let i=Dw(r.style);if(i)o.push(`style="${i}"`);for(let[m,x]of Object.entries(r)){if(!m.startsWith("on"))continue;Ss(`inline "${m}" handler`,x);let h=m.slice(2).toLowerCase();if(Ne(x))o.push(`@${h}="\${(e) => { s.$map = $map; ${gr(x.$ref)}(s, e); }}"`);else if(yn(x)){let g=Yt(x.$expression,{eventParam:"e",statePrefix:"s"});o.push(`@${h}="\${(e) => { s.$map = $map; ${g}; }}"`)}else if(jt(x))o.push(`@${h}="\${(e) => { s.$map = $map; ${Mw(x)} }}"`)}let a=o.length>0?`
210
+ }[${a}]}`}if(e.textContent!==void 0){let i=sf(e.textContent),a=Ce(e.textContent)||k(e.textContent)&&e.textContent.includes("${");return o&&a?`${i}${Oi}`:i}if(e.innerHTML!==void 0)return e.innerHTML;if(e.children)return n?nf(e.children,e.style,"",!0,r,s,o):`
211
+ ${nf(e.children,e.style,`${t} `,!1,r,s,o)}
212
+ ${t}`;return""}function o0(e,t){let n=Ce(e.items)?Zn(e.items.$ref):"ITEMS",r=e.map;if(!r)return"";let s=r.tagName??"div",o=[],i=c0(r,vn,ef);if(r.attributes)for(let[x,g]of Object.entries(r.attributes)){if(x==="class"&&i!==null)continue;if(Ce(g))o.push(`${x}="\${${ef(g.$ref)}}"`);else if(k(g)&&g.includes("${"))o.push(`${x}="${vn(g)}"`);else o.push(`${x}="${g}"`)}if(r.id)o.push(`id="${vn(String(r.id))}"`);if(i!==null)o.push(i);for(let[x,g]of Object.entries(r)){if($s.has(x)||x.startsWith("$")||x.startsWith("on")||x==="tagName"||x==="id"||x==="className"||x==="style"||x==="children"||x==="textContent"||x==="innerHTML"||x==="attributes")continue;if(tf(g))o.push(`.${x}="\${${ef(g.$ref)}}"`);else if(k(g)&&g.includes("${"))o.push(`.${x}="${vn(g)}"`);else o.push(`.${x}="\${${JSON.stringify(g)}}"`)}if(r.$props)for(let[x,g]of Object.entries(r.$props))if(Ce(g))o.push(`.${x}="\${${ef(g.$ref)}}"`);else if(k(g)&&g.includes("${"))o.push(`.${x}="${vn(g)}"`);else o.push(`.${x}="\${${JSON.stringify(g)}}"`);let a=f0(r.style);if(a)o.push(`style="${a}"`);for(let[x,g]of Object.entries(r)){if(!x.startsWith("on"))continue;js(`inline "${x}" handler`,g);let y=x.slice(2).toLowerCase();if(Ce(g))o.push(`@${y}="\${(e) => { s.$map = $map; ${Zn(g.$ref)}(s, e); }}"`);else if(gn(g)){let S=Xt(g.$expression,{eventParam:"e",statePrefix:"s"});o.push(`@${y}="\${(e) => { s.$map = $map; ${S}; }}"`)}else if(kt(g))o.push(`@${y}="\${(e) => { s.$map = $map; ${u0(g)} }}"`)}let c=o.length>0?`
205
213
  ${t} ${o.join(`
206
- ${t} `)}`:"",c=Tw(),l="";if(r.textContent!==void 0)l=ku(r.textContent);else if(r.children)l=`
207
- ${Pu(r.children,null,`${t} `,!1,!0,c)}
208
- ${t} `;let u=`html\`
209
- ${t} <${s}${a}
210
- ${t} >${l}</${s}>
211
- ${t}\``,d=(u.includes("$map")?"const $map = { item, index }; ":"")+c.decls.map((m)=>`${m.trim()} `).join(""),p=d?`(item, index) => { ${d}return ${u}; }`:`(item, index) => ${u}`;return`${t}\${${n}.map(${p})}`}function ju(e){return Ne(e)&&e.$ref!==""}function gr(e){if(e.startsWith("#/state/"))return Je("s",e.slice(8));if(e.startsWith("$map/"))return Iw(e.slice(5));if(e.startsWith("parent#/"))return Je("s",e.slice(8));if(e.startsWith("window#/"))return Je("window",e.slice(8));if(e.startsWith("document#/"))return Je("document",e.slice(10));return Je("s",e)}function Iw(e){let[t,...n]=pr(e);return Je(t??"",n.map((r)=>Xt(r)).join("/"))}function xm(e){if(e.startsWith("$map/"))return Iw(e.slice(5));return gr(e)}function vn(e){return ki(e,"s",{code:!1})}function hI(e){return e.startsWith("${")&&e.endsWith("}")&&!e.slice(2).includes("${")}function ku(e){if(Ne(e))return`\${${gr(e.$ref)}}`;if(k(e)&&e.includes("${"))return vn(e);return String(e)}function Mw(e){if(sr(e))return Jn(e.body,{dispatchTarget:"e.currentTarget",eventParam:"e",statePrefix:"s"});let t=k(e.body)?e.body:"";if(Ba(e))return`((${fr(e).join(", ")}) => { ${t}
212
- })(s, e);`;return`${ki(t,"s",{bare:!0})}
213
- `}function Dw(e){if(!D(e))return"";let t=[];for(let[n,r]of Object.entries(e)){if(n.startsWith(":")||n.startsWith(".")||n.startsWith("&")||n.startsWith("[")||n.startsWith("@"))continue;if(k(r)&&r.includes("${")){let s=an(n);t.push(`${s}: ${vn(r)}`)}}return t.join("; ")}var ac=T(()=>{pi();Si();za();Ei();hr();le();ds();hi()});function Fw(e,t){let{title:n="Jx App",reactivitySrc:r,litHtmlSrc:s}=t,o=_i(e,null,e.state??{},e.$media??{}),i=Ci(e,e.$media??{},t.projectStyle??null),a=[],c=Lw(e,!1,o,a),l=[],u="",d="";if(a.length>0){for(let x of a){let h=ic(x.def,x.className,[],t.rewriteSrc);l.push({content:h,path:`_islands/${x.tagName}.js`,tagName:x.tagName})}u=`<script type="importmap">
214
- {
215
- "imports": {
216
- "@vue/reactivity": "${r}",
217
- "lit-html": "${s}"
218
- }
219
- }
220
- </script>`,d=l.map((x)=>`<script type="module" src="./${x.path}"></script>`).join(`
221
- `)}let p=t.prePaintScheme!==!1&&Object.values(e.$media??{}).some((x)=>Zn(String(x))!==null)?`<script>${Oi()}</script>
222
- `:"",m=`<!DOCTYPE html>
214
+ ${t} `)}`:"",l=i0(),u="";if(r.textContent!==void 0)u=sf(r.textContent);else if(r.children)u=`
215
+ ${nf(r.children,null,`${t} `,!1,!0,l)}
216
+ ${t} `;let d=`html\`
217
+ ${t} <${s}${c}
218
+ ${t} >${u}</${s}>
219
+ ${t}\``,p=(d.includes("$map")?"const $map = { item, index }; ":"")+l.decls.map((x)=>`${x.trim()} `).join(""),m=p?`(item, index) => { ${p}return ${d}; }`:`(item, index) => ${d}`;return`${t}\${${n}.map(${m})}`}function c0(e,t,n){if(!lc(e))return null;let r=uc(e),s="";if(Ce(r))s=`\${${n(r.$ref)} ?? ""}`;else if(k(r))s=t(r);else if(We(r))s=String(r);let o=_s(e)??"";return`class="${[s,o].filter((i)=>i!=="").join(" ")}"`}function tf(e){return Ce(e)&&e.$ref!==""}function Zn(e){if(e.startsWith("#/state/"))return Re("s",e.slice(8));if(e.startsWith("$map/"))return l0(e.slice(5));if(e.startsWith("parent#/"))return Re("s",e.slice(8));if(e.startsWith("window#/"))return Re("window",e.slice(8));if(e.startsWith("document#/"))return Re("document",e.slice(10));return Re("s",e)}function l0(e){let[t,...n]=yr(e);return Re(t??"",n.map((r)=>qt(r)).join("/"))}function ef(e){if(e.startsWith("$map/"))return l0(e.slice(5));return Zn(e)}function vn(e){return ji(e,"s",{code:!1})}function LD(e){return e.startsWith("${")&&e.endsWith("}")&&!e.slice(2).includes("${")}function sf(e){if(Ce(e))return`\${${Zn(e.$ref)}}`;if(k(e)&&e.includes("${"))return vn(e);return String(e)}function u0(e){if(cr(e))return Tn(e.body,{dispatchTarget:"e.currentTarget",eventParam:"e",statePrefix:"s"});let t=k(e.body)?e.body:"";if(Wa(e))return`((${hr(e).join(", ")}) => { ${t}
220
+ })(s, e);`;return`${ji(t,"s",{bare:!0})}
221
+ `}function f0(e){if(!I(e))return"";let t=[];for(let[n,r]of Object.entries(e)){if(n.startsWith(":")||n.startsWith(".")||n.startsWith("&")||n.startsWith("[")||n.startsWith("@"))continue;if(k(r)&&r.includes("${")){let s=on(n);t.push(`${s}: ${vn(r)}`)}}return t.join("; ")}var DD;var of=R(()=>{ui();bi();Ha();Si();Yn();le();ms();di();DD=new Set(["state","template","constructor","connectedCallback","disconnectedCallback","adoptedCallback","attributeChangedCallback"])});function d0(e,t){let{title:n="Jx App"}=t,r=Ei(e,null,e.state??{},e.$media??{}),s=Ai(e,e.$media??{},t.projectStyle??null),o=p0(e,r),i=[],a=t.prePaintScheme!==!1&&Object.values(e.$media??{}).some((l)=>Xn(String(l))!==null)?`<script>${Pi()}</script>
222
+ `:"",c=`<!DOCTYPE html>
223
223
  <html lang="en">
224
224
  <head>
225
225
  <meta charset="utf-8">
226
226
  <meta name="viewport" content="width=device-width, initial-scale=1">
227
- <title>${Ee(n)}</title>
228
- ${p}${u}
229
- ${i}
227
+ <title>${ve(n)}</title>
228
+ ${a}
229
+ ${s}
230
230
  </head>
231
231
  <body>
232
- ${c}
233
- ${d}
232
+ ${o}
234
233
  </body>
235
- </html>`;return{files:l,html:m}}function Lw(e,t,n,r){if(k(e))return Ee(e);if(St(e)||Mt(e))return Ee(String(e));if(!D(e))return"";let s=_i(e,n.scope,e.state??n.scopeDefs,e.$media??n.media);if(t){let l=r.length,u=`jx-island-${l}`,d=`JxIsland${l}`,p={...e,tagName:u};return r.push({className:d,def:p,tagName:u}),`<${u}></${u}>`}let o=Gp(e.tagName,s.scope),i=Oo(e,s.scope);if(Kp.has(o))return`<${o}${i}>`;let a=n.preformatted===!0||vs.has(o),c=gI(e,{...s,preformatted:a},r);return`<${o}${i}>${c}</${o}>`}function gI(e,t,n){if(e.textContent!==void 0){let r=Be(e.textContent,t.scope);return r==null?"":Ee(String(r))}if(e.innerHTML){let r=Be(e.innerHTML,t.scope);return r==null?e.innerHTML:String(r)}if(Array.isArray(e.children))return e.children.map((r)=>Lw(r,g$(r),t,n)).join(rc(t.preformatted));return""}var Vw=T(()=>{hr();ac();le()});function vm(e,t){let{title:n="Jx App",reactivitySrc:r=$s,litHtmlSrc:s=ws,modulePath:o="app.js",serverBaseUrl:i="/_jx/server"}=t,a=_i(e,null,e.state??{},e.$media??{}),c=jo(e),l=Ci(e,e.$media??{},t.projectStyle??null),u={h:0,l:0,m:0,needsLit:!1,s:0,sw:0,t:0},d=new Map,p=new Map,m=[],x=[],h=[],g=[],b=[],j=[],v=e.state??{};for(let[J,C]of Object.entries(v)){if(!D(C)||Array.isArray(C)){if(me(C))x.push([J,`() => ${lu(C)}`]);else m.push([J,C]);continue}if(yn(C)){let L=C.$expression,G=Yt(L,{eventParam:"e",statePrefix:"state"});if(Ir(C))b.push(`state[${JSON.stringify(J)}] = ${nc(C,G)};`);else if(mr(L.operator))g.push([J,{args:["state","e"],body:G}]);else x.push([J,`() => ${G}`]);continue}if(jt(C)){let{body:L}=C;if(Array.isArray(L)){let G=Jn(L,{eventParam:"e",statePrefix:"state"});if(C.parameters&&C.parameters.length>0)b.push(`state[${JSON.stringify(J)}] = ${nc(C,`(() => {
236
- ${G}
237
- })()`)};`);else g.push([J,{args:["state","e"],body:G}])}else if(C.$src)if(c.get(J)==="computed")x.push([J,`() => { return ${J}(state); }`]);else b.push(`state[${JSON.stringify(J)}] = ${J};`),g.push([J,{args:["state","event"],body:`return ${J}(state, event);`}]);else if(k(L)&&c.get(J)==="computed")x.push([J,`() => { ${L} }`]);else g.push([J,{args:fr(C),body:L}]);continue}if(rs(C))continue;if(Mg(C)){m.push([J,C.default]);continue}if(_n(C)){if(C.$prototype==="LocalStorage"||C.$prototype==="SessionStorage"){let L=C.$prototype==="LocalStorage"?"localStorage":"sessionStorage",G=C.key??J,te=C.default??null;m.push([J,null]),b.push(bI(J,L,G,te));continue}if(C.$prototype==="Request"){m.push([J,null]),b.push(nu(J,C));continue}if(C.$prototype==="Cookie"){m.push([J,null]),b.push($I(J,C.name??J,C.default??null));continue}}if(Mr(C)){m.push([J,null]),j.push(ru(J,C,{serverBaseUrl:i}));continue}m.push([J,C])}let P=qw(e,a,d,p,u);for(let[J,C]of d)if(!h.some(([L])=>L===J))h.push([J,C]);for(let[J,C]of p)if(!g.some(([L])=>L===J))g.push([J,C]);let S=au(v,c),_=xI(m,x,h,g,b,j,S,u,r,t.rewriteSrc),N=[` "@vue/reactivity": "${r}"`,` "lit-html": "${s}"`],F=t.prePaintScheme!==!1&&Object.values(e.$media??{}).some((J)=>Zn(String(J))!==null)?`<script>${Oi()}</script>
238
- `:"",K=`<!DOCTYPE html>
234
+ </html>`;return{files:i,html:c}}function p0(e,t){if(k(e))return ve(e);if(We(e)||bt(e))return ve(String(e));if(!I(e))return"";let n=Ei(e,t.scope,e.state??t.scopeDefs,e.$media??t.media),r=eg(e.tagName,n.scope),s=Co(e,n.scope);if(Qh.has(r))return`<${r}${s}>`;let o=t.preformatted===!0||Ps.has(r),i=VD(e,{...n,preformatted:o});return`<${r}${s}>${i}</${r}>`}function VD(e,t){if(e.textContent!==void 0){let n=Le(e.textContent,t.scope);return n==null?"":ve(String(n))}if(e.innerHTML){let n=Le(e.innerHTML,t.scope);return n==null?e.innerHTML:String(n)}if(Array.isArray(e.children))return e.children.map((n)=>p0(n,t)).join(ac(t.preformatted));return""}var m0=R(()=>{Yn();le()});function Og(e,t){let{title:n="Jx App",reactivitySrc:r=vs,litHtmlSrc:s=Es,modulePath:o="app.js",serverBaseUrl:i="/_jx/server"}=t,a=Ei(e,null,e.state??{},e.$media??{}),c=_o(e),l=Ai(e,e.$media??{},t.projectStyle??null),u={h:0,l:0,m:0,needsLit:!1,s:0,sw:0,t:0,textParts:!1},d=new Map,p=new Map,m=[],x=[],g=[],y=[],S=[],E=[],v=e.state??{},j=Mu(v,t.resolveClass);for(let[A,N]of Object.entries(v)){if(!I(N)||Array.isArray(N)){if(me(N))x.push([A,`() => ${Nu(N)}`]);else m.push([A,N]);continue}if(gn(N)){let B=N.$expression,M=Xt(B,{eventParam:"e",statePrefix:"state"});if(Dr(N))S.push(`state[${JSON.stringify(A)}] = ${ic(N,M)};`);else if(xr(B.operator))y.push([A,{args:["state","e"],body:M}]);else x.push([A,`() => ${M}`]);continue}if(kt(N)){let{body:B}=N;if(Array.isArray(B)){let M=Tn(B,{eventParam:"e",statePrefix:"state"});if(N.parameters&&N.parameters.length>0)S.push(`state[${JSON.stringify(A)}] = ${ic(N,`(() => {
235
+ ${M}
236
+ })()`)};`);else y.push([A,{args:["state","e"],body:M}])}else if(N.$src)if(c.get(A)==="computed")x.push([A,`() => { return ${A}(state); }`]);else S.push(`state[${JSON.stringify(A)}] = ${A};`),y.push([A,{args:["state","event"],body:`return ${A}(state, event);`}]);else if(k(B)&&c.get(A)==="computed")x.push([A,`() => { ${B} }`]);else y.push([A,{args:hr(N),body:B}]);continue}if(os(N))continue;if(Jx(N)){m.push([A,N.default]);continue}if(yn(N)){if(N.$prototype==="LocalStorage"||N.$prototype==="SessionStorage"){let B=N.$prototype==="LocalStorage"?"localStorage":"sessionStorage",M=N.key??A,D=N.default??null;m.push([A,null]),S.push(UD(A,B,M,D));continue}if(N.$prototype==="Request"){m.push([A,null]),S.push(Pu(A,N));continue}if(N.$prototype==="Cookie"){m.push([A,null]),S.push(BD(A,N.name??A,N.default??null));continue}if(ki(N)){m.push([A,null]);continue}}if(Mr(N)){m.push([A,null]),E.push(_u(A,N,{serverBaseUrl:i}));continue}m.push([A,N])}let P=g0(e,a,d,p,u);for(let[A,N]of d)if(!g.some(([B])=>B===A))g.push([A,N]);for(let[A,N]of p)if(!y.some(([B])=>B===A))y.push([A,N]);let O=Cu(v,c),T=HD(m,x,g,y,S,E,O,u,r,t.rewriteSrc,j),U=[` "@vue/reactivity": "${r}"`,` "lit-html": "${s}"`],F=t.prePaintScheme!==!1&&Object.values(e.$media??{}).some((A)=>Xn(String(A))!==null)?`<script>${Pi()}</script>
237
+ `:"",H=`<!DOCTYPE html>
239
238
  <html lang="en">
240
239
  <head>
241
240
  <meta charset="utf-8">
242
241
  <meta name="viewport" content="width=device-width, initial-scale=1">
243
- <title>${Ee(n)}</title>
242
+ <title>${ve(n)}</title>
244
243
  ${F}<script type="importmap">
245
244
  {
246
245
  "imports": {
247
- ${N.join(`,
246
+ ${U.join(`,
248
247
  `)}
249
248
  }
250
249
  }
@@ -255,20 +254,20 @@ ${N.join(`,
255
254
  <body>
256
255
  ${P}
257
256
  </body>
258
- </html>`;return{files:[{content:_,path:o}],html:K}}function qw(e,t,n,r,s){if(k(e))return Ee(e);if(St(e)||Mt(e))return Ee(String(e));if(!D(e))return"";let o=_i(e,t.scope,e.state??t.scopeDefs,e.$media??t.media);if(or(e.tagName))throw Error(`A tag chosen at creation is not supported on a dynamic page yet (candidates: ${Ho(e.tagName).join(", ")}). Move the element into a component, or give it a literal tagName.`);let i=e.tagName??"div";o.preformatted=t.preformatted===!0||vs.has(i);let a=[],c=!1;if(e.textContent!==void 0){let h=e.textContent;if(cn(h)){let g=Ji(h.$ref);a.push(`:text-content="${g}"`),$m(n,g,h.$ref),c=!0}else if(me(h)){let g=`_t${s.t}`;s.t+=1,a.push(`:text-content="${g}"`),n.set(g,`() => \`${h}\``),c=!0}}for(let[h,g]of Object.entries(e)){if(!h.startsWith("on")||h==="observedAttributes")continue;Ss(`inline "${h}" handler`,g);let b=h.slice(2).toLowerCase();if(cn(g)){let j=Ji(g.$ref);a.push(`@${b}="${j}"`),c=!0}else if(jt(g)){let j=`_h${s.h}`;s.h+=1,a.push(`@${b}="${j}"`);let{body:v}=g;r.set(j,Array.isArray(v)?{args:["state","e"],body:Jn(v,{eventParam:"e",statePrefix:"state"})}:{args:Ba(g)?fr(g):["state","event"],body:v}),c=!0}else if(yn(g)){let j=`_h${s.h}`;s.h+=1,a.push(`@${b}="${j}"`);let v=Yt(g.$expression,{eventParam:"e",statePrefix:"state"});r.set(j,{args:["state","e"],body:v}),c=!0}}if(D(e.style))for(let[h,g]of Object.entries(e.style)){if(h.startsWith(":")||h.startsWith(".")||h.startsWith("&")||h.startsWith("[")||h.startsWith("@"))continue;if(Hw(g))continue;if(me(g)){let b=`_s${s.s}`;s.s+=1,a.push(`:style.${an(h)}="${b}"`),n.set(b,`() => \`${g}\``),c=!0}}if(D(e.attributes)){for(let[h,g]of Object.entries(e.attributes))if(cn(g)){let b=Ji(g.$ref);a.push(`:attr.${h}="${b}"`),$m(n,b,g.$ref),c=!0}else if(me(g)){let b=`_t${s.t}`;s.t+=1,a.push(`:attr.${h}="${b}"`),n.set(b,`() => \`${g}\``),c=!0}}for(let[h,g]of Object.entries(e)){if(Yr.has(h)||h.startsWith("on")||h.startsWith("$")||h==="tagName"||h==="id"||h==="className"||h==="style"||h==="children"||h==="textContent"||h==="innerHTML"||h==="attributes")continue;if(cn(g)){let b=Ji(g.$ref);a.push(`:${an(h)}="${b}"`),$m(n,b,g.$ref),c=!0}else if(me(g)){let b=`_t${s.t}`;s.t+=1,a.push(`:${an(h)}="${b}"`),n.set(b,`() => \`${g}\``),c=!0}}let l=Oo(e,o.scope),u=c?" data-bind":"",d=a.length>0?` ${a.join(" ")}`:"",p="",m=e;if(m.$switch){s.needsLit=!0;let h=`_sw${s.sw}`;s.sw+=1;let g=cn(m.$switch)?Sm(m.$switch.$ref):`\`${String(m.$switch)}\``,b=m.cases??{},j=Object.entries(b).filter(([,P])=>P&&!cn(P)).map(([P,S])=>`${JSON.stringify(P)}: html\`${wm(S,o.preformatted)}\``);n.set(h,`() => ({${j.join(", ")}})[String(${g})] ?? html\`\``),a.push(`:render="${h}"`);let v=` ${a.join(" ")}`;return`<${i}${l} data-bind${v}></${i}>`}if(m.textContent!==void 0&&!c){let h=Be(m.textContent,o.scope);p=h==null?"":Ee(String(h))}else if(m.textContent!==void 0&&c){let h=Be(m.textContent,o.scope);p=h==null?"":Ee(String(h))}else if(m.innerHTML){let h=Be(m.innerHTML,o.scope);p=h==null?m.innerHTML:String(h)}else if(at(m.children)){s.needsLit=!0;let h=`_list${s.l}`;s.l+=1;let g=m.children,b=cn(g.items)?Sm(g.items.$ref):JSON.stringify(g.items),j=Em(g.map);n.set(h,`() => (${b} ?? []).map((item, index) => html\`${j}\`)`),a.push(`:render="${h}"`),c=!0;let v=" data-bind",P=` ${a.join(" ")}`;if(new Set(["input","br","hr","img","meta","link"]).has(i))return`<${i}${l}${v}${P}>`;return`<${i}${l}${v}${P}></${i}>`}else if(Array.isArray(m.children)&&m.children.some((h)=>at(h))){s.needsLit=!0;let h=`_children${s.l}`;s.l+=1;let g=m.children.map((j)=>wm(j,o.preformatted)).join(rc(o.preformatted," "));n.set(h,o.preformatted?`() => html\`${g}\``:`() => html\`
259
- ${g}
260
- \``),a.push(`:render="${h}"`),c=!0;let b=` ${a.join(" ")}`;return`<${i}${l} data-bind${b}></${i}>`}else if(Array.isArray(m.children))p=m.children.map((h)=>qw(h,o,n,r,s)).join(rc(o.preformatted));if(new Set(["input","br","hr","img","meta","link"]).has(i))return`<${i}${l}${u}${d}>`;return`<${i}${l}${u}${d}>${p}</${i}>`}function Em(e,t=!1){if(!e)return"";if(or(e.tagName))throw Error(`A tag chosen at creation is not supported inside a dynamic page's repeater yet (candidates: ${Ho(e.tagName).join(", ")}). Move the item into a component, or give it a literal tagName.`);let n=e.tagName??"div",r=t||vs.has(n),s="";if(e.id)s+=` id="${e.id}"`;if(e.className)s+=` class="${Ro(e.className)}"`;if(D(e.$props))for(let[c,l]of Object.entries(e.$props))if(cn(l))s+=` .${c}="\${${wI(l.$ref)}}"`;else if(me(l))s+=` .${c}="${Ro(l)}"`;else s+=` .${c}="\${${JSON.stringify(l)}}"`;if(D(e.attributes))for(let[c,l]of Object.entries(e.attributes)){if(me(l)){s+=` ${c}="${Ro(l)}"`;continue}if(Mt(l)){let u=_o(c,l);if(u!==null)s+=u===""?` ${c}`:` ${c}="${Ee(u)}"`;continue}s+=` ${c}="${Ee(String(l))}"`}if(D(e.style)){let c=[];for(let[l,u]of Object.entries(e.style)){if(l.startsWith(":")||l.startsWith(".")||l.startsWith("&")||l.startsWith("[")||l.startsWith("@"))continue;if(Hw(u))continue;let d=an(l);if(me(String(u)))c.push(`${d}: ${Ro(String(u))}`);else c.push(`${d}: ${u}`)}if(c.length>0)s+=` style="${c.join("; ")}"`}for(let[c,l]of Object.entries(e)){if(!c.startsWith("on")||c==="observedAttributes")continue;Ss(`inline "${c}" handler`,l);let u=c.slice(2).toLowerCase();if(cn(l)){let d=Ji(l.$ref);s+=` @${u}=\${(e) => { state.$map = { item, index }; on.${d}(e); }}`}else if(sr(l)){let d=Jn(l.body,{eventParam:"e",statePrefix:"state"});s+=` @${u}=\${(e) => { state.$map = { item, index }; ${d} }}`}else if(jt(l)){let d=yI(l.body),p=Ba(l)?`((${fr(l).join(", ")}) => { ${d}
261
- })(state, e);`:`${d}
262
- `;s+=` @${u}=\${(e) => { state.$map = { item, index }; ${p}}}`}else if(D(l)&&"$expression"in l){let d=Yt(l.$expression,{eventParam:"e",statePrefix:"state"});s+=` @${u}=\${(e) => { state.$map = { item, index }; ${d}; }}`}}if(e.contentEditable)s+=` contenteditable="${e.contentEditable}"`;let o=n.includes("-")?Ri:"",i="";if(e.textContent!==void 0){let c=String(e.textContent);if(me(c))i=`${Ro(c)}${o}`;else if(cn(e.textContent))i=`\${state.${Ji(e.textContent.$ref)}}${o}`;else i=Ee(c)}else if(e.innerHTML)i=Ro(String(e.innerHTML));else if(at(e.children))i=`
263
- ${Ww(e.children)}${o}
264
- `;else if(Array.isArray(e.children)){let c=e.children.map((l)=>{let u=wm(l,r);return at(l)||k(l)&&me(l)?`${u}${o}`:u});i=r?c.join(""):`
265
- ${c.join(`
257
+ </html>`;return{files:[{content:T,path:o}],html:H}}function g0(e,t,n,r,s){if(k(e)){if(!me(e))return ve(e);let g=`_t${s.t}`;s.t+=1,s.textParts=!0,n.set(g,`() => \`${e}\``);let y=Le(e,t.scope),S=y==null?"":ve(String(y));return`<!--jx-text:${g}-->${S}<!--/jx-text-->`}if(We(e)||bt(e))return ve(String(e));if(!I(e))return"";let o=Ei(e,t.scope,e.state??t.scopeDefs,e.$media??t.media);if(lr(e.tagName))throw Error(`A tag chosen at creation is not supported on a dynamic page yet (candidates: ${xa(e.tagName).join(", ")}). Move the element into a component, or give it a literal tagName.`);let i=e.tagName??"div";o.preformatted=t.preformatted===!0||Ps.has(i);let a=[],c=!1;if(e.textContent!==void 0){let g=e.textContent;if(Mt(g)){let y=Ni(g.$ref);a.push(`:text-content="${y}"`),_g(n,y,g.$ref),c=!0}else if(me(g)){let y=`_t${s.t}`;s.t+=1,a.push(`:text-content="${y}"`),n.set(y,`() => \`${g}\``),c=!0}}for(let[g,y]of Object.entries(e)){if(!g.startsWith("on")||g==="observedAttributes")continue;js(`inline "${g}" handler`,y);let S=g.slice(2).toLowerCase();if(Mt(y)){let E=Ni(y.$ref);a.push(`@${S}="${E}"`),c=!0}else if(kt(y)){let E=`_h${s.h}`;s.h+=1,a.push(`@${S}="${E}"`);let{body:v}=y;r.set(E,Array.isArray(v)?{args:["state","e"],body:Tn(v,{eventParam:"e",statePrefix:"state"})}:{args:Wa(y)?hr(y):["state","event"],body:v}),c=!0}else if(gn(y)){let E=`_h${s.h}`;s.h+=1,a.push(`@${S}="${E}"`);let v=Xt(y.$expression,{eventParam:"e",statePrefix:"state"});r.set(E,{args:["state","e"],body:v}),c=!0}}if(I(e.style))for(let[g,y]of Object.entries(e.style)){if(g.startsWith(":")||g.startsWith(".")||g.startsWith("&")||g.startsWith("[")||g.startsWith("@"))continue;if(x0(y))continue;if(me(y)){let S=`_s${s.s}`;s.s+=1,a.push(`:style.${on(g)}="${S}"`),n.set(S,`() => \`${y}\``),c=!0}}if(I(e.attributes))for(let[g,y]of Object.entries(e.attributes)){let S=g==="class"?_s(e):void 0;if(S!==void 0&&(Mt(y)||me(y))){let E=`_t${s.t}`;s.t+=1;let v=Mt(y)?af(y.$ref):`\`${y}\``;a.push(`:attr.class="${E}"`),n.set(E,`() => [${v}, ${JSON.stringify(S)}].filter((c) => c != null && c !== "").join(" ")`),c=!0;continue}if(Mt(y)){let E=Ni(y.$ref);a.push(`:attr.${g}="${E}"`),_g(n,E,y.$ref),c=!0}else if(me(y)){let E=`_t${s.t}`;s.t+=1,a.push(`:attr.${g}="${E}"`),n.set(E,`() => \`${y}\``),c=!0}}for(let[g,y]of Object.entries(e)){if($s.has(g)||g.startsWith("on")||g.startsWith("$")||g==="tagName"||g==="id"||g==="className"||g==="style"||g==="children"||g==="textContent"||g==="innerHTML"||g==="attributes")continue;if(Mt(y)){let S=Ni(y.$ref);a.push(`:${on(g)}="${S}"`),_g(n,S,y.$ref),c=!0}else if(me(y)){let S=`_t${s.t}`;s.t+=1,a.push(`:${on(g)}="${S}"`),n.set(S,`() => \`${y}\``),c=!0}}let l=Co(e,o.scope),u=c?" data-bind":"",d=a.length>0?` ${a.join(" ")}`:"",p="",m=e;if(m.$switch){s.needsLit=!0;let g=`_sw${s.sw}`;s.sw+=1;let y=Mt(m.$switch)?af(m.$switch.$ref):`\`${String(m.$switch)}\``,S=m.cases??{},E=Object.entries(S).filter(([,j])=>j&&!Mt(j)).map(([j,P])=>`${JSON.stringify(j)}: html\`${kg(P,o.preformatted)}\``);n.set(g,`() => ({${E.join(", ")}})[String(${y})] ?? html\`\``),a.push(`:render="${g}"`);let v=` ${a.join(" ")}`;return`<${i}${l} data-bind${v}></${i}>`}if(m.textContent!==void 0&&!c){let g=Le(m.textContent,o.scope);p=g==null?"":ve(String(g))}else if(m.textContent!==void 0&&c){let g=Le(m.textContent,o.scope);p=g==null?"":ve(String(g))}else if(m.innerHTML){let g=Le(m.innerHTML,o.scope);p=g==null?m.innerHTML:String(g)}else if(nt(m.children)){s.needsLit=!0;let g=`_list${s.l}`;s.l+=1;let y=m.children,S=Mt(y.items)?af(y.items.$ref):JSON.stringify(y.items),E=Ag(y.map);n.set(g,`() => (${S} ?? []).map((item, index) => html\`${E}\`)`),a.push(`:render="${g}"`),c=!0;let v=" data-bind",j=` ${a.join(" ")}`;if(new Set(["input","br","hr","img","meta","link"]).has(i))return`<${i}${l}${v}${j}>`;return`<${i}${l}${v}${j}></${i}>`}else if(Array.isArray(m.children)&&m.children.some((g)=>nt(g))){s.needsLit=!0;let g=`_children${s.l}`;s.l+=1;let y=m.children.map((E)=>kg(E,o.preformatted)).join(ac(o.preformatted," "));n.set(g,o.preformatted?`() => html\`${y}\``:`() => html\`
258
+ ${y}
259
+ \``),a.push(`:render="${g}"`),c=!0;let S=` ${a.join(" ")}`;return`<${i}${l} data-bind${S}></${i}>`}else if(Array.isArray(m.children)){if(qD.has(i)&&m.children.some((g)=>me(g)))throw Error(`A template text child of <${i}> cannot be bound: HTML reads its content as text. Write it as the element's textContent.`);p=m.children.map((g)=>g0(g,o,n,r,s)).join(ac(o.preformatted))}if(new Set(["input","br","hr","img","meta","link"]).has(i))return`<${i}${l}${u}${d}>`;return`<${i}${l}${u}${d}>${p}</${i}>`}function Ag(e,t=!1){if(!e)return"";if(lr(e.tagName))throw Error(`A tag chosen at creation is not supported inside a dynamic page's repeater yet (candidates: ${xa(e.tagName).join(", ")}). Move the item into a component, or give it a literal tagName.`);let n=e.tagName??"div",r=t||Ps.has(n),s="";if(e.id)s+=` id="${e.id}"`;let o=lc(e);if(o){let l=uc(e),u="";if(Mt(l))u=`\${${h0(l.$ref)} ?? ""}`;else if(k(l))u=No(l);else if(We(l))u=String(l);let d=[u,_s(e)??""].filter((p)=>p!=="").join(" ");s+=` class="${d}"`}if(I(e.$props))for(let[l,u]of Object.entries(e.$props))if(Mt(u))s+=` .${l}="\${${h0(u.$ref)}}"`;else if(me(u))s+=` .${l}="${No(u)}"`;else s+=` .${l}="\${${JSON.stringify(u)}}"`;if(I(e.attributes))for(let[l,u]of Object.entries(e.attributes)){if(o&&l==="class")continue;if(me(u)){s+=` ${l}="${No(u)}"`;continue}if(bt(u)){let d=Ss(l,u);if(d!==null)s+=d===""?` ${l}`:` ${l}="${ve(d)}"`;continue}s+=` ${l}="${ve(String(u))}"`}if(I(e.style)){let l=[];for(let[u,d]of Object.entries(e.style)){if(u.startsWith(":")||u.startsWith(".")||u.startsWith("&")||u.startsWith("[")||u.startsWith("@"))continue;if(x0(d))continue;if(me(String(d)))l.push(`${on(u)}: ${No(String(d))}`)}if(l.length>0)s+=` style="${l.join("; ")}"`}for(let[l,u]of Object.entries(e)){if(!l.startsWith("on")||l==="observedAttributes")continue;js(`inline "${l}" handler`,u);let d=l.slice(2).toLowerCase();if(Mt(u)){let p=Ni(u.$ref);s+=` @${d}=\${(e) => { state.$map = { item, index }; on.${p}(e); }}`}else if(cr(u)){let p=Tn(u.body,{eventParam:"e",statePrefix:"state"});s+=` @${d}=\${(e) => { state.$map = { item, index }; ${p} }}`}else if(kt(u)){let p=WD(u.body),m=Wa(u)?`((${hr(u).join(", ")}) => { ${p}
260
+ })(state, e);`:`${p}
261
+ `;s+=` @${d}=\${(e) => { state.$map = { item, index }; ${m}}}`}else if(I(u)&&"$expression"in u){let p=Xt(u.$expression,{eventParam:"e",statePrefix:"state"});s+=` @${d}=\${(e) => { state.$map = { item, index }; ${p}; }}`}}if(e.contentEditable)s+=` contenteditable="${e.contentEditable}"`;let i=n.includes("-")?Oi:"",a="";if(e.textContent!==void 0){let l=String(e.textContent);if(me(l))a=`${No(l)}${i}`;else if(Mt(e.textContent))a=`\${state.${Ni(e.textContent.$ref)}}${i}`;else a=ve(l)}else if(e.innerHTML)a=No(String(e.innerHTML));else if(nt(e.children))a=`
262
+ ${y0(e.children)}${i}
263
+ `;else if(Array.isArray(e.children)){let l=e.children.map((u)=>{let d=kg(u,r);return nt(u)||k(u)&&me(u)?`${d}${i}`:d});a=r?l.join(""):`
264
+ ${l.join(`
266
265
  `)}
267
- `}if(new Set(["input","br","hr","img","meta","link"]).has(n))return`<${n}${s}>`;return`<${n}${s}>${i}</${n}>`}function wm(e,t=!1){if(k(e))return me(e)?Ro(e):Ee(e);if(St(e)||Mt(e))return Ee(String(e));if(at(e))return Ww(e);return Em(e,t)}function Ww(e){let{items:t}=e,n=cn(t)?Sm(t.$ref):JSON.stringify(t??[]),r=Em(e.map);return`\${(${n} ?? []).map((item, index) => html\`${r}\`)}`}function Ro(e){return e.replaceAll("$map.","")}function yI(e){return e.replaceAll(/(?<![\w$.])\$map\./gu,"")}function xI(e,t,n,r,s,o,i,a,c,l){let u=[],{needsLit:d}=a,p=t.length>0;u.push("// Generated by @jxsuite/compiler — do not edit manually");let m=["reactive","effect"];if(p)m.push("computed");if(u.push(`import { ${m.join(", ")} } from '@vue/reactivity';`),d)u.push("import { html, render } from 'lit-html';");let x=cu(i,l);if(u.push(...x.imports,...x.loaders,"",uu()),o.length>0)u.push("",fu());u.push("","const state = reactive({");for(let[h,g]of e)u.push(` ${Gr(h)}: ${JSON.stringify(g)},`);if(u.push("});",""),s.length>0){for(let h of s)u.push(h);u.push("")}if(t.length>0){for(let[h,g]of t)u.push(`${Je("state",Xt(h))} = computed(${g});`);u.push("")}if(o.length>0){for(let h of o)u.push(h);u.push("")}if(n.length>0){u.push("const bind = {");for(let[h,g]of n)u.push(` ${Gr(h)}: ${g},`);u.push("};")}else u.push("const bind = {};");if(u.push(""),r.length>0){u.push("const on = {");for(let[h,g]of r)u.push(` ${Gr(h)}: (e) => { const fn = (${g.args.join(", ")}) => { ${g.body}
268
- }; fn(state, e); },`);u.push("};")}else u.push("const on = {};");if(u.push("","function hydrate(root) {"," root.querySelectorAll('[data-bind]').forEach(el => {"," [...el.attributes].forEach(a => {"," if (a.name.startsWith(':')) {"," const parts = a.name.slice(1).split('.');"," const key = a.value;"),d)u.push(" if (parts[0] === 'render') {"," effect(() => { render(bind[key](), el); });"," } else if (parts[0] === 'style' && parts.length > 1) {");else u.push(" if (parts[0] === 'style' && parts.length > 1) {");return u.push(" effect(() => { el.style[parts[1]] = bind[key](); });"," } else if (parts[0] === 'attr' && parts.length > 1) {"," effect(() => {",` const _t = ${Ai}(parts[1], bind[key]());`," if (_t === null) { el.removeAttribute(parts[1]); }"," else { el.setAttribute(parts[1], _t); }"," });"," } else {"," const prop = parts[0].replace(/-([a-z])/g, (_, c) => c.toUpperCase());"," effect(() => { el[prop] = bind[key](); });"," }"," } else if (a.name.startsWith('@')) {"," el.addEventListener(a.name.slice(1), on[a.value]);"," }"," });"," });","}","","hydrate(document);",""),u.join(`
269
- `)}function bI(e,t,n,r){return[`// ${e}: ${t} (key: "${n}")`,"try {",` const _s = ${t}.getItem(${JSON.stringify(n)});`,` state.${e} = _s !== null ? JSON.parse(_s) : ${JSON.stringify(r)};`,`} catch { state.${e} = ${JSON.stringify(r)}; }`,"effect(() => {",` const v = state.${e};`," try {",` if (v === null) ${t}.removeItem(${JSON.stringify(n)});`,` else ${t}.setItem(${JSON.stringify(n)}, JSON.stringify(v));`," } catch {}","});"].join(`
270
- `)}function $I(e,t,n){return[`// ${e}: Cookie (name: "${t}")`,"{",` const _m = document.cookie.match(new RegExp("(?:^|; )${t}=([^;]*)"));`,` try { state.${e} = _m ? JSON.parse(decodeURIComponent(_m[1])) : ${JSON.stringify(n)}; }`,` catch { state.${e} = _m ? _m[1] : ${JSON.stringify(n)}; }`,"}"].join(`
271
- `)}function Hw(e){return e===null||D(e)}function wI(e){if(e.startsWith("$map/")){let[t,...n]=pr(e.slice(5));return Je(t??"",n.map((r)=>Xt(r)).join("/"))}if(e.startsWith("#/state/"))return Je("state",e.slice(8));return Je("state",e)}function Sm(e){return Ub("state",e.startsWith("#/state/")?e.slice(8):e)}function Ji(e){return Bb(e.startsWith("#/state/")?e.slice(8):e)}function $m(e,t,n){if(e.has(t))return;e.set(t,`() => ${Je("state",n.startsWith("#/state/")?n.slice(8):n)}`)}var jm=T(()=>{za();Ei();hr();le();hi()});function SI(e,t){if(t.routing==="prefix-except-default"&&e===t.defaultLocale)return"/";return`/${e.toLowerCase()}/`}function Uw(e){if(e===null||e.locales.length<2)return"";let t=JSON.stringify(e.locales),n=JSON.stringify(e.defaultLocale),r=JSON.stringify(Object.fromEntries(e.locales.map((s)=>[s,SI(s,e)])));return`
266
+ `}if(new Set(["input","br","hr","img","meta","link"]).has(n))return`<${n}${s}>`;return`<${n}${s}>${a}</${n}>`}function kg(e,t=!1){if(k(e))return me(e)?No(e):ve(e);if(We(e)||bt(e))return ve(String(e));if(nt(e))return y0(e);return Ag(e,t)}function y0(e){let{items:t}=e,n=Mt(t)?af(t.$ref):JSON.stringify(t??[]),r=Ag(e.map);return`\${(${n} ?? []).map((item, index) => html\`${r}\`)}`}function No(e){return e.replaceAll("$map.","")}function WD(e){return e.replaceAll(/(?<![\w$.])\$map\./gu,"")}function HD(e,t,n,r,s,o,i,a,c,l,u){let d=[],{needsLit:p,textParts:m}=a,x=t.length>0;d.push("// Generated by @jxsuite/compiler — do not edit manually");let g=["reactive","effect"];if(x)g.push("computed");if(d.push(`import { ${g.join(", ")} } from '@vue/reactivity';`),p)d.push("import { html, render } from 'lit-html';");let y=Ru(i,l);if(d.push(...y.imports,...u.imports,...y.loaders,"",Tu()),o.length>0)d.push("",Iu());let S=u.entries.length>0;if(S)d.push("",Du(),"const _jxInstances = new Map();");d.push("","const state = reactive({");for(let[E,v]of e)d.push(` ${Xr(E)}: ${JSON.stringify(v)},`);if(d.push("});",""),s.length>0){for(let E of s)d.push(E);d.push("")}if(t.length>0){for(let[E,v]of t)d.push(`${Re("state",qt(E))} = computed(${v});`);d.push("")}if(o.length>0){for(let E of o)d.push(E);d.push("")}if(n.length>0){d.push("const bind = {");for(let[E,v]of n)d.push(` ${Xr(E)}: ${v},`);d.push("};")}else d.push("const bind = {};");if(d.push(""),r.length>0){d.push("const on = {");for(let[E,v]of r)d.push(` ${Xr(E)}: (e) => { const fn = (${v.args.join(", ")}) => { ${v.body}
267
+ }; fn(state, e); },`);d.push("};")}else d.push("const on = {};");if(d.push("","function hydrate(root) {"),m)d.push(" const texts = [];"," const walker = document.createTreeWalker(root, 128);"," while (walker.nextNode()) {"," const c = walker.currentNode;"," if (c.data.startsWith('jx-text:') && c.data.slice(8) in bind) { texts.push(c); }"," }");if(d.push(" root.querySelectorAll('[data-bind]').forEach(el => {"," [...el.attributes].forEach(a => {"," if (a.name.startsWith(':')) {"," const parts = a.name.slice(1).split('.');"," const key = a.value;"),p)d.push(" if (parts[0] === 'render') {"," effect(() => { render(bind[key](), el); });"," } else if (parts[0] === 'style' && parts.length > 1) {");else d.push(" if (parts[0] === 'style' && parts.length > 1) {");if(d.push(" effect(() => { el.style[parts[1]] = bind[key](); });"," } else if (parts[0] === 'attr' && parts.length > 1) {"," effect(() => {",` const _t = ${_i}(parts[1], bind[key]());`," if (_t === null) { el.removeAttribute(parts[1]); }"," else { el.setAttribute(parts[1], _t); }"," });"," } else {"," const prop = parts[0].replace(/-([a-z])/g, (_, c) => c.toUpperCase());"," effect(() => { el[prop] = bind[key](); });"," }"," } else if (a.name.startsWith('@')) {"," el.addEventListener(a.name.slice(1), on[a.value]);"," }"," });"," });"),m)d.push(" texts.forEach(c => {"," const key = c.data.slice(8);"," let text = c.nextSibling;"," if (!text || text.nodeType !== 3) {"," text = document.createTextNode('');"," c.after(text);"," }"," effect(() => { text.data = bind[key](); });"," });");if(d.push("}",""),S)d.push(`await ${Fu(u.entries,{indent:"",instances:"_jxInstances",statePrefix:"state"})};`);return d.push("hydrate(document);",""),d.join(`
268
+ `)}function UD(e,t,n,r){return[`// ${e}: ${t} (key: "${n}")`,"try {",` const _s = ${t}.getItem(${JSON.stringify(n)});`,` state.${e} = _s !== null ? JSON.parse(_s) : ${JSON.stringify(r)};`,`} catch { state.${e} = ${JSON.stringify(r)}; }`,"effect(() => {",` const v = state.${e};`," try {",` if (v === null) ${t}.removeItem(${JSON.stringify(n)});`,` else ${t}.setItem(${JSON.stringify(n)}, JSON.stringify(v));`," } catch {}","});"].join(`
269
+ `)}function BD(e,t,n){return[`// ${e}: Cookie (name: "${t}")`,"{",` const _m = document.cookie.match(new RegExp("(?:^|; )${t}=([^;]*)"));`,` try { state.${e} = _m ? JSON.parse(decodeURIComponent(_m[1])) : ${JSON.stringify(n)}; }`,` catch { state.${e} = _m ? _m[1] : ${JSON.stringify(n)}; }`,"}"].join(`
270
+ `)}function x0(e){return e===null||I(e)}function h0(e){if(e.startsWith("$map/")){let[t,...n]=yr(e.slice(5));return Re(t??"",n.map((r)=>qt(r)).join("/"))}if(e.startsWith("#/state/"))return Re("state",e.slice(8));return Re("state",e)}function af(e){return KS("state",e.startsWith("#/state/")?e.slice(8):e)}function Ni(e){return GS(e.startsWith("#/state/")?e.slice(8):e)}function _g(e,t,n){if(e.has(t))return;e.set(t,`() => ${Re("state",n.startsWith("#/state/")?n.slice(8):n)}`)}var qD;var Cg=R(()=>{Ha();Si();Yn();le();di();qD=new Set(["script","style","textarea","title"])});function zD(e,t){if(t.routing==="prefix-except-default"&&e===t.defaultLocale)return"/";return`/${e.toLowerCase()}/`}function b0(e){if(e===null||e.locales.length<2)return"";let t=JSON.stringify(e.locales),n=JSON.stringify(e.defaultLocale),r=JSON.stringify(Object.fromEntries(e.locales.map((s)=>[s,zD(s,e)])));return`
272
271
  // ─── Locale negotiation (RFC 4647 Lookup over Accept-Language) ───────────────
273
272
  const JX_LOCALES = ${t}
274
273
  const JX_DEFAULT_LOCALE = ${n}
@@ -337,12 +336,12 @@ app.use('/', async (c, next) => {
337
336
  res.headers.set('Content-Language', locale)
338
337
  c.res = res
339
338
  })
340
- `}function Ou(e,t="/_jx/server"){return We(e,t)}function Pm(e,t={}){let{adapter:n=null,mounts:r=[],connectors:s=[],i18n:o=null,base:i=""}=t,a=Ou(i,t.baseUrl);if(e.length===0&&r.length===0&&!n)return null;let c=e.map(({exportName:x,src:h})=>`import { ${x} } from '${h}'`).join(`
341
- `),l=vI(r,s),u=e.map(({exportName:x})=>PI(x,a)).join(`
339
+ `}function cf(e,t="/_jx/server"){return Ie(e,t)}function Rg(e,t={}){let{adapter:n=null,mounts:r=[],connectors:s=[],i18n:o=null,base:i=""}=t,a=cf(i,t.baseUrl);if(e.length===0&&r.length===0&&!n)return null;let c=e.map(({exportName:x,src:g})=>`import { ${x} } from '${g}'`).join(`
340
+ `),l=KD(r,s),u=e.map(({exportName:x})=>YD(x,a)).join(`
342
341
  `),d=n==="cloudflare-workers"||n==="cloudflare-pages"?`
343
342
  app.all('*', (c) => c.env.ASSETS.fetch(c.req.raw))
344
343
  `:`
345
- `,p=Uw(o),m=e.length===0&&r.length===0?"":jI(i,a);return`// Generated by @jxsuite/compiler — do not edit manually
344
+ `,p=b0(o),m=e.length===0&&r.length===0?"":XD(i,a);return`// Generated by @jxsuite/compiler — do not edit manually
346
345
  import { Hono } from 'hono'
347
346
  ${c}${l.imports}
348
347
 
@@ -350,11 +349,11 @@ const app = new Hono()
350
349
  ${p}${m}${l.routes}${u}
351
350
  ${d}
352
351
  export default app
353
- `}function vI(e,t){if(e.length===0)return{imports:"",routes:""};let n=e.toSorted((o,i)=>o.order-i.order),r=[];for(let o of n)r.push(`import { ${o.className} } from '${o.module}'`);for(let o of t)r.push(`import { ${o.className} } from '${o.module}'`);let s=["// Extension server mounts (specs/extensions.md §11): one shared ctx, mounted in order.","const jxCtx = {}",`const jxConnectors = { ${t.map((o)=>`${JSON.stringify(o.provider)}: ${o.className}`).join(", ")} }`];for(let[o,i]of n.entries()){let a=JSON.stringify(i.options);s.push(`const jxMount${o} = await ${i.className}.mount({ ...${a}, connectors: jxConnectors }, jxCtx)`,`app.all('${i.basePath}/*', (c) => jxMount${o}(c.req.raw, c.env))`,`app.all('${i.basePath}', (c) => jxMount${o}(c.req.raw, c.env))`)}return{imports:`
352
+ `}function KD(e,t){if(e.length===0)return{imports:"",routes:""};let n=e.toSorted((o,i)=>o.order-i.order),r=[];for(let o of n)r.push(`import { ${o.className} } from '${o.module}'`);for(let o of t)r.push(`import { ${o.className} } from '${o.module}'`);let s=["// Extension server mounts (specs/extensions.md §11): one shared ctx, mounted in order.","const jxCtx = {}",`const jxConnectors = { ${t.map((o)=>`${JSON.stringify(o.provider)}: ${o.className}`).join(", ")} }`];for(let[o,i]of n.entries()){let a=JSON.stringify(i.options);s.push(`const jxMount${o} = await ${i.className}.mount({ ...${a}, connectors: jxConnectors }, jxCtx)`,`app.all('${i.basePath}/*', (c) => jxMount${o}(c.req.raw, c.env))`,`app.all('${i.basePath}', (c) => jxMount${o}(c.req.raw, c.env))`)}return{imports:`
354
353
  ${r.join(`
355
354
  `)}`,routes:`${s.join(`
356
355
  `)}
357
- `}}function jI(e,t){let n=We(e,EI);return`// Request gate (specs/compiler.md §6.4): another site may link here, never call here.
356
+ `}}function XD(e,t){let n=Ie(e,GD);return`// Request gate (specs/compiler.md §6.4): another site may link here, never call here.
358
357
  const jxGate = async (c, next) => {
359
358
  const site = c.req.header('sec-fetch-site')
360
359
  const foreign = site !== undefined && site !== 'same-origin' && site !== 'none'
@@ -371,7 +370,7 @@ const jxGate = async (c, next) => {
371
370
  }
372
371
  ${(t===n||t.startsWith(`${n}/`)?[n]:[n,t]).map((o)=>`app.use('${o}/*', jxGate)`).join(`
373
372
  `)}
374
- `}function PI(e,t){return`
373
+ `}function YD(e,t){return`
375
374
  app.post('${t}/${e}', async (c) => {
376
375
  if (!/^application\\/([\\w.-]+\\+)?json\\b/i.test(c.req.header('content-type') ?? '')) {
377
376
  return c.json({ ok: false, error: 'Expected an application/json body' }, 415)
@@ -383,14 +382,12 @@ app.post('${t}/${e}', async (c) => {
383
382
  console.error('jx: server function ${e} threw:', e)
384
383
  return c.json({ ok: false, error: 'Server error' }, 500)
385
384
  }
386
- })`}var EI="/_jx";var _m=T(()=>{$n()});function zw(e){let t=Ab(e,e.title??"a class"),n=t.title;if(!n)throw Error("compileClassJson: missing title (class name)");let r=kI(t.extends),s=t.$defs,o=s?.fields??{},i=s?.constructor,a=_I(i)?i:void 0,c=s?.methods??{},l=["// Generated by @jxsuite/compiler from .class.json — do not edit manually"];if(t.$id)l.push(`// Source: ${t.$id}`);l.push("");let u=r!=="Object"?` extends ${r}`:"";l.push(`class ${n}${u} {`);for(let[d,p]of Object.entries(o)){if(p.scope!=="static")continue;let m=p.identifier??d,x=p.access==="private"?"#":"",h=p.initializer!==void 0?JSON.stringify(p.initializer):p.default!==void 0?JSON.stringify(p.default):"null";l.push(` static ${x}${m} = ${h};`)}for(let[d,p]of Object.entries(o)){if(p.scope==="static")continue;if(p.access!=="private")continue;let m=p.identifier??d;l.push(` #${m};`)}if(Object.keys(o).length>0)l.push("");if(l.push(" constructor(config = {}) {"),a?.superCall||r!=="Object"){let d=a?.superCall?.arguments?a.superCall.arguments.join(", "):"";l.push(` super(${d});`)}for(let[d,p]of Object.entries(o)){if(p.scope==="static")continue;let m=p.identifier??d,x=p.access==="private"?"#":"",h=p.initializer!==void 0?JSON.stringify(p.initializer):p.default!==void 0?JSON.stringify(p.default):"null";l.push(` this.${x}${m} = config.${m} !== undefined ? config.${m} : ${h};`)}if(a?.body){let d=Array.isArray(a.body)?a.body:[a.body];for(let p of d)l.push(` ${p}`)}l.push(" }");for(let[d,p]of Object.entries(c)){let m=p.identifier??d,x=p.scope==="static",g=p.access==="private"?"#":"",b=x?"static ":"",j=p.returnType?.$ref?.includes("Promise")||AI(p)?"async ":"",v=Bw(p.parameters??[]),P=OI(p.body);if(l.push(""),p.role==="accessor"){if(p.getter)l.push(` ${b}get ${g}${m}() {`,` ${p.getter.body}`," }");if(p.setter){let S=Bw(p.setter.parameters??[]);l.push(` ${b}set ${g}${m}(${S}) {`,` ${p.setter.body}`," }")}}else{l.push(` ${b}${j}${g}${m}(${v}) {`);for(let S of P)l.push(` ${S}`);l.push(" }")}}return l.push("}","",`export { ${n} };`,`export default ${n};`,""),l.join(`
387
- `)}function _I(e){return typeof e==="object"}function kI(e){if(!e)return"Object";if(k(e))return e;if(e.$ref){let t=e.$ref.match(/([A-Za-z0-9_]+)\.class\.json/);return t?t[1]:"Object"}return"Object"}function Bw(e){return e.map((t)=>{if(t.$ref)return t.$ref.split("/").pop();let n=t.identifier??t.name;return k(n)?n:"arg"}).join(", ")}function OI(e){if(!e)return[""];return Array.isArray(e)?e:[e]}function AI(e){return(Array.isArray(e.body)?e.body.join(`
388
- `):e.body??"").includes("await ")}var Kw=T(()=>{pi();le()});import{readFileSync as RI}from"node:fs";async function km(e,t={}){let{title:n="Jx App",reactivitySrc:r=$s,litHtmlSrc:s=ws,projectStyle:o=null}=t,i;if(k(e)){let c=RI(e,"utf8");if(Wr(e))i=Kn(c,e);else{let{extname:l}=await import("node:path"),u=l(e).toLowerCase(),d=t.formats?.byExtension(u,"parse");if(!d){await Promise.resolve().then(() => Ur());throw El(e,u)}i=await d.parseDocument(c)}}else i=e;if(i=ur(i,k(e)?e:"the document"),Fg(i)){await Promise.resolve().then(() => Kw());let l=zw(i),u=k(e)?e.replace(/\.class\.json$/,".js"):`${i.title}.js`;return{files:[{content:l,path:u}],html:""}}if(!iu(i))return Fw(i,{litHtmlSrc:s,projectStyle:o,reactivitySrc:r,...Gw(t),title:n});if(i.tagName&&i.tagName.includes("-")){let{tagName:c}=i,l=pu(c),d={content:ic(i,l,[],t.rewriteSrc,null,t.serverBaseUrl),path:`${c}.js`,tagName:c},p=Ci(i,i.$media??{},o),m=`<!DOCTYPE html>
385
+ })`}var GD="/_jx";var Ng=R(()=>{$n()});import{readFileSync as ZD}from"node:fs";async function Tg(e,t={}){let{title:n="Jx App",reactivitySrc:r=vs,litHtmlSrc:s=Es,projectStyle:o=null}=t,i;if(k(e)){let c=ZD(e,"utf8");if(Hr(e))i=Bn(c,e);else{let{extname:l}=await import("node:path"),u=l(e).toLowerCase(),d=t.formats?.byExtension(u,"parse");if(!d){await Promise.resolve().then(() => Br());throw Dl(e,u)}i=await d.parseDocument(c)}}else i=e;if(i=mr(i,k(e)?e:"the document"),Mx(i)){await Promise.resolve().then(() => fg());let l=pc(i),u=k(e)?e.replace(/(\.class)?\.[^./\\]+$/,".js"):`${i.title}.js`;return{files:[{content:l,path:u}],html:""}}if(!Au(i)){let c={projectStyle:o,title:n};if(t.prePaintScheme===!1)c.prePaintScheme=!1;return d0(i,c)}if(i.tagName&&i.tagName.includes("-")){let{tagName:c}=i,l=Wu(c),d={content:jg(i,l,[],t.rewriteSrc,null,t.serverBaseUrl,[],t.resolveClass),path:`${c}.js`,tagName:c},p=Ai(i,i.$media??{},o),m=`<!DOCTYPE html>
389
386
  <html lang="en">
390
387
  <head>
391
388
  <meta charset="utf-8">
392
389
  <meta name="viewport" content="width=device-width, initial-scale=1">
393
- <title>${Ee(n)}</title>
390
+ <title>${ve(n)}</title>
394
391
  <script type="importmap">
395
392
  {
396
393
  "imports": {
@@ -405,10 +402,10 @@ app.post('${t}/${e}', async (c) => {
405
402
  <${c}></${c}>
406
403
  <script type="module" src="./${c}.js"></script>
407
404
  </body>
408
- </html>`;return{files:[d],html:m}}let a={litHtmlSrc:s,projectStyle:o,reactivitySrc:r,...Gw(t),title:n};if(t.serverBaseUrl!==void 0)a.serverBaseUrl=t.serverBaseUrl;return vm(i,a)}function Gw(e){let t={};if(e.prePaintScheme===!1)t.prePaintScheme=!1;if(e.rewriteSrc)t.rewriteSrc=e.rewriteSrc;return t}async function SX(e,t){let n=await km(e),{writeFileSync:r,mkdirSync:s}=await import("node:fs"),{dirname:o,join:i}=await import("node:path");if(t){r(t,n.html,"utf8"),console.error(`Written to ${t}`);let a=o(t);for(let c of n.files){let l=i(a,c.path);s(o(l),{recursive:!0}),r(l,c.content,"utf8"),console.error(`Written to ${l}`)}}else process.stdout.write(n.html)}var Xw=T(()=>{pi();hr();ac();Vw();jm();le();ds();hr();_m();ac();jm()});function Yw(e){let t=e.arch==="x64"||e.arch==="arm64"?e.arch:null;if(!t)return[];if(e.platform==="linux"){let[n,r]=e.musl?["musl","gnu"]:["gnu","musl"];return[`linux-${t}-${n}`,`linux-${t}-${r}`]}if(e.platform==="darwin")return[`darwin-${t}`];if(e.platform==="win32")return[`win32-${t}-msvc`];return[]}function Zw(e){return`jx-compiler.${e}.node`}function Qw(e){return`@jxsuite/compiler-binding-${e}`}var eS=()=>{};import{createRequire as CI}from"node:module";import{existsSync as NI}from"node:fs";import{dirname as rS,join as TI}from"node:path";function JI(e,t){return e==="linux"&&t!==void 0&&!t.header?.glibcVersionRuntime}function II(e){try{return[rS(e("@jxsuite/compiler-binding/package.json"))]}catch{return[]}}function MI(){return{arch:process.arch,exists:NI,load:(e)=>{let t=tS(e);return DI(t)?t:void 0},localDirs:[...new Set([rS(import.meta.dirname),import.meta.dirname,...II((e)=>tS.resolve(e))])],musl:JI(process.platform,process.report.getReport()),platform:process.platform}}function DI(e){return typeof e==="object"&&e!==null&&"processImage"in e&&typeof e.processImage==="function"}function FI(e){let t=Yw(e);if(t.length===0)throw Error(`@jxsuite/compiler-binding has no build for ${e.platform}-${e.arch}. Image optimization needs one; set images.optimize to false to build without it.`);let n=[];for(let s of t){let o=[...e.localDirs.map((i)=>TI(i,Zw(s))).filter((i)=>e.exists(i)),Qw(s)];for(let i of o)try{let a=e.load(i);if(a)return a;n.push(`${i}: loaded, but it is not the Jx compiler addon`)}catch(a){n.push(`${i}: ${a instanceof Error?a.message:String(a)}`)}}let r=n.map((s)=>` - ${s}`).join(`
405
+ </html>`;return{files:[d],html:m}}let a={litHtmlSrc:s,projectStyle:o,reactivitySrc:r,...QD(t),title:n};if(t.serverBaseUrl!==void 0)a.serverBaseUrl=t.serverBaseUrl;if(t.resolveClass!==void 0)a.resolveClass=t.resolveClass;return Og(i,a)}function QD(e){let t={};if(e.prePaintScheme===!1)t.prePaintScheme=!1;if(e.rewriteSrc)t.rewriteSrc=e.rewriteSrc;return t}async function Y7(e,t){let n=await Tg(e),{writeFileSync:r,mkdirSync:s}=await import("node:fs"),{dirname:o,join:i}=await import("node:path");if(t){r(t,n.html,"utf8"),console.error(`Written to ${t}`);let a=o(t);for(let c of n.files){let l=i(a,c.path);s(o(l),{recursive:!0}),r(l,c.content,"utf8"),console.error(`Written to ${l}`)}}else process.stdout.write(n.html)}var $0=R(()=>{ui();Yn();of();m0();Cg();le();ms();Yn();Ng();of();Cg()});function S0(e){let t=e.arch==="x64"||e.arch==="arm64"?e.arch:null;if(!t)return[];if(e.platform==="linux"){let[n,r]=e.musl?["musl","gnu"]:["gnu","musl"];return[`linux-${t}-${n}`,`linux-${t}-${r}`]}if(e.platform==="darwin")return[`darwin-${t}`];if(e.platform==="win32")return[`win32-${t}-msvc`];return[]}function w0(e){return`jx-compiler.${e}.node`}function v0(e){return`@jxsuite/compiler-binding-${e}`}var E0=()=>{};import{createRequire as eM}from"node:module";import{existsSync as tM}from"node:fs";import{dirname as _0,join as nM}from"node:path";function rM(e,t){return e==="linux"&&t!==void 0&&!t.header?.glibcVersionRuntime}function sM(e){try{return[_0(e("@jxsuite/compiler-binding/package.json"))]}catch{return[]}}function oM(){return{arch:process.arch,exists:tM,load:(e)=>{let t=j0(e);return iM(t)?t:void 0},localDirs:[...new Set([_0(import.meta.dirname),import.meta.dirname,...sM((e)=>j0.resolve(e))])],musl:rM(process.platform,process.report.getReport()),platform:process.platform}}function iM(e){return typeof e==="object"&&e!==null&&"processImage"in e&&typeof e.processImage==="function"}function aM(e){let t=S0(e);if(t.length===0)throw Error(`@jxsuite/compiler-binding has no build for ${e.platform}-${e.arch}. Image optimization needs one; set images.optimize to false to build without it.`);let n=[];for(let s of t){let o=[...e.localDirs.map((i)=>nM(i,w0(s))).filter((i)=>e.exists(i)),v0(s)];for(let i of o)try{let a=e.load(i);if(a)return a;n.push(`${i}: loaded, but it is not the Jx compiler addon`)}catch(a){n.push(`${i}: ${a instanceof Error?a.message:String(a)}`)}}let r=n.map((s)=>` - ${s}`).join(`
409
406
  `);throw Error(`The Jx compiler's native addon could not be loaded.
410
407
  ${r}
411
- In a checkout of the Jx repository, build it with \`bun run build:addon\` (needs Rust). In a project, reinstall dependencies without --no-optional so the package for this platform is installed.`)}function sS(){return nS??=FI(MI()),nS}async function oS(e){return sS().imageMetadata(e)}async function iS(e){return sS().processImage(e)}var tS,nS;var aS=T(()=>{eS();tS=CI(import.meta.url)});import{createHash as Om}from"node:crypto";import{readFileSync as LI}from"node:fs";import{basename as VI,extname as qI,resolve as cS}from"node:path";async function lS(e){return oS(e)}function Ii(e){let t=LI(e);return Om("md5").update(t).digest("hex").slice(0,8)}function HI(e){return Om("md5").update(`${Ii(e)}:${uS}`).digest("hex").slice(0,8)}function fS(e){let t=JSON.stringify({formats:e.formats,quality:e.quality,v:uS,widths:e.widths});return Om("md5").update(t).digest("hex").slice(0,8)}async function dS(e,t,n){let r=cS(t,"_optimized"),s={};if(n.quality.avif!==void 0)s.avif=n.quality.avif;if(n.quality.jpeg!==void 0)s.jpeg=n.quality.jpeg;let o=await iS({formats:n.formats,hash:HI(e),outDir:r,quality:s,source:e,stem:VI(e,qI(e)),widths:n.widths});return{contentHash:Ii(e),original:o.original,variants:o.variants.map((i)=>({absolutePath:cS(r,i.fileName),format:i.format,outputPath:`/${WI}/${i.fileName}`,width:i.width}))}}function pS(e,t){return e.flatMap((n)=>n.format===t?[`${Am(n.outputPath)} ${n.width}w`]:[]).join(", ")}function Am(e){return e.split("/").map((t)=>encodeURIComponent(t)).join("/")}var WI="images/_optimized",uS=3;var Rm=T(()=>{aS()});import{existsSync as UI,mkdirSync as BI,readFileSync as zI,rmSync as KI,writeFileSync as GI}from"node:fs";import{basename as mS,extname as XI,resolve as Ru}from"node:path";import{execSync as YI}from"node:child_process";import{tmpdir as ZI}from"node:os";function eM(){let e=process.env.npm_config_cache??process.env.NPM_CONFIG_CACHE;if(e)return e;try{let t=YI("npm config get cache",{cwd:ZI(),encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:QI}).trim();return t&&t!=="undefined"?t:null}catch{return null}}function Mi(e){if(Au===void 0)Au=eM();if(Au)return Ru(Au,"jxsuite-images",mS(e));return Ru(e,".cache/images")}function hS(e,t){return`${Ii(e)}:${fS(t)}:${mS(e,XI(e))}`}function gS(e){let t=Ru(Mi(e),"manifest.json");if(!UI(t))return{entries:{},touched:new Set,version:1};try{let n=JSON.parse(zI(t,"utf8"));return n.touched=new Set,n}catch{return{entries:{},touched:new Set,version:1}}}function yS(e,t,n={}){if(n.prune&&t.touched)tM(t,t.touched);let r=Mi(e);BI(r,{recursive:!0}),GI(Ru(r,"manifest.json"),JSON.stringify({entries:t.entries,version:t.version},null,2),"utf8")}function tM(e,t){let n=new Set,r=Object.entries(e.entries);for(let[s,o]of r)if(t.has(s))for(let i of o.manifest.variants??[])n.add(i.absolutePath);for(let[s,o]of r){if(t.has(s))continue;for(let i of o.manifest.variants??[])if(!n.has(i.absolutePath))KI(i.absolutePath,{force:!0});delete e.entries[s]}}function xS(e,t){e.touched?.add(t);let n=e.entries[t];if(!n)return null;return n.manifest}function bS(e,t,n,r){e.touched?.add(t),e.entries[t]={manifest:r,source:n,timestamp:Date.now()}}var Au,QI=3000;var Cm=T(()=>{Rm()});function Nm(e,t){if(!t||$S(e.loading))return{};if(String(e.fetchpriority??"").toLowerCase()==="high")return{};return $S(e.decoding)?{loading:"lazy"}:{decoding:"async",loading:"lazy"}}var $S=(e)=>e!==void 0&&e!==null&&e!=="";function SS(e){let t=e.lastIndexOf(".");return nM.get(t>0?e.slice(t).toLowerCase():"")??null}function Nu(e){try{return sM.decode(e)}catch{throw new En("The metadata is not valid UTF-8.")}}function Cu(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function cc(e,t,n){return String.fromCodePoint(...e.subarray(t,t+n))}function vS(e,t){switch(t){case"jpeg":return aM(e).packet;case"png":return fM(e).packet;case"webp":return pM(e).packet;default:return yM(Nu(e)).packet}}function oM(e){if(e[0]!==255||e[1]!==216)throw new En("Not a JPEG file.");let t=[],n=2;while(n+4<=e.length){if(e[n]!==255)throw new En("The JPEG's markers are damaged.");let r=e[n+1]??0;if(r===255){n+=1;continue}if(r===218||r===217)break;let s=Cu(e).getUint16(n+2),o=n+2+s;if(s<2||o>e.length)throw new En("The JPEG's markers are damaged.");t.push({end:o,marker:r,start:n}),n=o}return t}function iM(e,t){let n=t.start+4;return t.marker===225&&t.end-n>=Tm.length&&Tm.every((r,s)=>e[n+s]===r)}function aM(e){let t=oM(e),n=t.find((s)=>iM(e,s));return{packet:n===void 0?null:Nu(e.subarray(n.start+4+Tm.length,n.end)),parts:t}}function lM(e){if(!wS.every((r,s)=>e[s]===r))throw new En("Not a PNG file.");let t=[],n=wS.length;while(n+12<=e.length){let r=Cu(e).getUint32(n),s=n+12+r;if(s>e.length)throw new En("The PNG's chunks are damaged.");let o=cc(e,n+4,4);if(t.push({dataStart:n+8,end:s,start:n,type:o}),n=s,o==="IEND")break}return t}function uM(e,t){if(t.type!=="iTXt")return null;let n=e.subarray(t.dataStart,t.end-4),r=n.indexOf(0);if(r===-1||cc(n,0,r)!==cM)return null;if(n[r+1]!==0)throw new En("The PNG's metadata is compressed, which Studio does not rewrite.");let s=n.indexOf(0,r+3),o=s===-1?-1:n.indexOf(0,s+1);if(o===-1)throw new En("The PNG's metadata chunk is damaged.");return Nu(n.subarray(o+1))}function fM(e){let t=lM(e);return{packet:t.map((r)=>uM(e,r)).find((r)=>r!==null)??null,parts:t}}function dM(e){if(cc(e,0,4)!=="RIFF"||cc(e,8,4)!=="WEBP")throw new En("Not a WebP file.");let t=Math.min(e.length,8+Cu(e).getUint32(4,!0)),n=[],r=12;while(r+8<=t){let s=Cu(e).getUint32(r+4,!0),o=r+8,i=o+s+s%2;if(o+s>t)throw new En("The WebP's chunks are damaged.");n.push({dataStart:o,end:Math.min(i,t),fourcc:cc(e,r,4),size:s,start:r}),r=i}return n}function pM(e){let t=dM(e),n=t.find((s)=>s.fourcc==="XMP ");return{packet:n===void 0?null:Nu(e.subarray(n.dataStart,n.dataStart+n.size)),parts:t}}function hM(e,t){let n=null;for(let r=t+1;r<e.length;r++){let s=e[r];if(n!==null){if(s===n)n=null}else if(s==='"'||s==="'")n=s;else if(s===">")return r}return-1}function gM(e){let t=/<svg[\s>/]/.exec(e);if(t===null)throw new En("Not an SVG file.");let n=hM(e,t.index);if(n===-1)throw new En("The SVG's root element is damaged.");return{end:n,selfClosing:e[n-1]==="/",start:t.index}}function yM(e){gM(e);let t=mM.exec(e);return t===null?{end:-1,packet:null,start:-1}:{end:t.index+t[0].length,packet:t[0],start:t.index}}var En,nM,rM,sM,Tm,wS,cM="XML:com.adobe.xmp",mM;var ES=T(()=>{En=class En extends Error{name="XmpContainerError"};nM=new Map([[".jpeg","jpeg"],[".jpg","jpeg"],[".png","png"],[".svg","svg"],[".webp","webp"]]);rM=new TextEncoder,sM=new TextDecoder("utf-8",{fatal:!0});Tm=rM.encode("http://ns.adobe.com/xap/1.0/\x00");wS=Uint8Array.of(137,80,78,71,13,10,26,10);mM=/<([\w.-]+:)?xmpmeta\b[\s\S]*?<\/\1?xmpmeta\s*>/});function jS(){return{alt:"",focus:null,tags:[]}}function bM(e){if(e.startsWith("#x")||e.startsWith("#X"))return Number.parseInt(e.slice(2),16);return e.startsWith("#")?Number(e.slice(1)):null}function Jm(e){return e.replaceAll(/&(#x[\da-f]+|#\d+|\w+);/gi,(t,n)=>{let r=bM(n),s=r===null?xM.get(n):r<=1114111?String.fromCodePoint(r):void 0;if(s===void 0)throw new jn(`Unknown entity ${t}`);return s})}function $M(e){let t={attrs:[],children:[],name:"#root",type:"element"},n=[t],r=0,s=()=>n.at(-1)??t;while(r<e.length){let o=e.indexOf("<",r);if(o===-1){s().children.push({type:"text",value:Jm(e.slice(r))});break}if(o>r)s().children.push({type:"text",value:Jm(e.slice(r,o))});let i=e.slice(o,o+9),a;if(i.startsWith("<!--"))a=e.indexOf("-->",o),a=a===-1?-1:a+3;else if(i.startsWith("<![CDATA["))a=e.indexOf("]]>",o),a=a===-1?-1:a+3;else if(i.startsWith("<?"))a=e.indexOf("?>",o),a=a===-1?-1:a+2;else if(i.startsWith("<!"))throw new jn("A packet may not declare a document type.");else if(i.startsWith("</")){let c=e.indexOf(">",o);if(c===-1)throw new jn("Unclosed end tag.");let l=e.slice(o+2,c).trim(),u=n.pop();if(u===void 0||u===t||u.name!==l)throw new jn(`Unexpected </${l}>.`);r=c+1;continue}else{r=wM(e,o,n);continue}if(a===-1)throw new jn("Unterminated markup.");s().children.push({source:e.slice(o,a),type:"raw"}),r=a}if(n.length!==1)throw new jn(`<${s().name}> is never closed.`);return t.children}function wM(e,t,n){let r=t+1,s=PS.exec(e.slice(r));if(s===null)throw new jn("A tag has no name.");let o={attrs:[],children:[],name:s[0],type:"element"};r+=s[0].length;for(;;){while(/\s/.test(e[r]??""))r+=1;let i=e[r];if(i===void 0)throw new jn(`<${o.name}> is never finished.`);if(i===">"||e.startsWith("/>",r)){if(n.at(-1)?.children.push(o),i===">")return n.push(o),r+1;return r+2}let a=PS.exec(e.slice(r));if(a===null)throw new jn(`<${o.name}> has a malformed attribute.`);r+=a[0].length;while(/\s/.test(e[r]??""))r+=1;if(e[r]!=="=")throw new jn(`${a[0]} has no value.`);r+=1;while(/\s/.test(e[r]??""))r+=1;let c=e[r];if(c!=='"'&&c!=="'")throw new jn(`${a[0]} is not quoted.`);let l=e.indexOf(c,r+1);if(l===-1)throw new jn(`${a[0]} is never closed.`);o.attrs.push([a[0],Jm(e.slice(r+1,l))]),r=l+1}}function Di(e,t){let n=e.attrs.filter(([s])=>s==="xmlns"||s.startsWith("xmlns:"));if(n.length===0)return t;let r=new Map(t);for(let[s,o]of n)r.set(s==="xmlns"?"":s.slice(6),o);return r}function SM(e,t,n=!1){let r=e.indexOf(":");if(r===-1)return n?["",e]:[t.get("")??"",e];let s=e.slice(0,r),o=s==="xml"?"http://www.w3.org/XML/1998/namespace":t.get(s);return o===void 0?null:[o,e.slice(r+1)]}function Qn(e,t,n,r,s=!1){let o=SM(e,t,s);return o!==null&&o[0]===n&&o[1]===r}function Fi(e){return e.filter((t)=>t.type==="element")}function Li(e){return e.children.map((t)=>t.type==="text"?t.value:t.type==="element"?Li(t):"").join("")}function kS(e,t=new Map){let n=[];for(let r of Fi(e)){let s=Di(r,t);if(Qn(r.name,s,"http://www.w3.org/1999/02/22-rdf-syntax-ns#","Description"))n.push([r,s]);else n.push(...kS(r.children,s))}return n}function Vi(e,t){let n=[];for(let r of Fi(e.children)){let s=Di(r,t);for(let o of Fi(r.children)){let i=Di(o,s);if(Qn(o.name,i,"http://www.w3.org/1999/02/22-rdf-syntax-ns#","li"))n.push([o,i])}}return n}function vM(e,t){let n=e.attrs.find(([r])=>Qn(r,t,"http://www.w3.org/XML/1998/namespace","lang",!0));return n===void 0?null:n[1]}function EM(e,t){let n=Vi(e,t),r=n.find(([s,o])=>vM(s,o)?.toLowerCase()==="x-default")??n[0];return r===void 0?Li(e).trim():Li(r[0])}function Tu(e,t){if(!e.attrs.some(([r,s])=>s==="Resource"&&Qn(r,t,"http://www.w3.org/1999/02/22-rdf-syntax-ns#","parseType",!0)))for(let r of Fi(e.children)){let s=Di(r,t);if(Qn(r.name,s,"http://www.w3.org/1999/02/22-rdf-syntax-ns#","Description"))return[r,s]}return[e,t]}function uc(e,t,n,r){for(let s of Fi(e.children)){let o=Di(s,t);if(Qn(s.name,o,n,r))return[s,o]}return null}function lc(e,t,n,r){let s=e.attrs.find(([i])=>Qn(i,t,n,r,!0));if(s!==void 0)return s[1].trim();let o=uc(e,t,n,r);return o===null?null:Li(o[0]).trim()}function _S(e){if(e===null||e==="")return null;let t=Number(e);return Number.isFinite(t)&&t>=0&&t<=1?t:null}function jM(e,t){let n=uc(e,t,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rRole");if(n===null)return!1;return Vi(...n).some(([r,s])=>{let[o,i]=Tu(r,s),a=uc(o,i,"http://ns.adobe.com/xap/1.0/","Identifier");return(a===null?[lc(o,i,"http://ns.adobe.com/xap/1.0/","Identifier")??""]:Vi(...a).map(([l])=>Li(l).trim())).some((l)=>l.replace(/^https:/,"http:")==="http://cv.iptc.org/newscodes/imageregionrole/areaOfInterest")})}function PM(e,t){let[n,r]=Tu(e,t),s=uc(n,r,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","RegionBoundary");if(s===null||!jM(n,r))return null;let[o,i]=Tu(...s),a=uc(o,i,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbVertices");if(lc(o,i,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbShape")!=="polygon"||lc(o,i,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbUnit")!=="relative"||a===null)return null;let c=Vi(...a);if(c.length!==1)return null;let[l,u]=Tu(...c[0]),d=_S(lc(l,u,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbX")),p=_S(lc(l,u,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbY"));return d===null||p===null?null:{x:d,y:p}}function _M(e){let t=new Set,n=[];for(let r of e){let s=r.trim(),o=s.toLowerCase();if(s!==""&&!t.has(o))t.add(o),n.push(s)}return n}function OS(e){if(e===null)return jS();let t=jS(),n=!1;for(let[r,s]of kS($M(e))){for(let[o,i]of r.attrs)if(!n&&Qn(o,s,"http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/","AltTextAccessibility",!0))t.alt=i,n=!0;for(let o of Fi(r.children)){let i=Di(o,s);if(!n&&Qn(o.name,i,"http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/","AltTextAccessibility"))t.alt=EM(o,i),n=!0;else if(Qn(o.name,i,"http://purl.org/dc/elements/1.1/","subject"))t.tags.push(...Vi(o,i).map(([a])=>Li(a)));else if(t.focus===null&&Qn(o.name,i,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","ImageRegion"))for(let[a,c]of Vi(o,i))t.focus??=PM(a,c)}}return t.tags=_M(t.tags),t.alt=t.alt.trim(),t}var jn,xM,PS;var AS=T(()=>{jn=class jn extends Error{name="XmpParseError"};xM=new Map([["amp","&"],["apos","'"],["gt",">"],["lt","<"],["quot",'"']]);PS=/^[A-Za-z_][\w.:-]*/});import{existsSync as DS,readFileSync as kM,statSync as OM}from"node:fs";import{basename as AM,extname as Im,resolve as RS}from"node:path";async function CM(e,t){let n=t.get(e);if(!n){let r=Ii(e);try{let s=await lS(e);n={width:s.width,height:s.height,hash:r}}catch(s){if(!CS)CS=!0,console.warn(`Could not read image dimensions (${$e(s)}) — `+"emitting srcsets without width/height attributes.");n={width:null,height:null,hash:r}}t.set(e,n)}return n}function NS(e,t,n,r){let s=t.quality.webp??80,o=e.startsWith("/")?"":"/",i=r?`?v=${r}`:"",a=NM(e);return t.widths.filter((c)=>c<=n).toSorted((c,l)=>c-l).map((c)=>`/cdn-cgi/image/width=${c},quality=${s},fit=scale-down,format=auto${o}${a}${i} ${c}w`).join(", ")}function NM(e){return e.replaceAll(/[\s,]/g,(t)=>encodeURIComponent(t))}async function TM(e,t,n,r,s){let o=hS(e,n),i=xS(s,o);if(i){if(i.variants.every((l)=>DS(l.absolutePath)))return i}if(!i)console.log(` Optimizing ${AM(e)}...`);let a=await dS(e,Mi(r),n);return bS(s,o,t,a),a}function JM(e){if(!e)return!0;if(e.includes("${"))return!0;if(LS.some((t)=>e.startsWith(t)))return!0;if(FS.has(Im(e).toLowerCase()))return!0;return!1}function IM(e,t){if(t.service!=="cloudflare")return!1;if(!t.remoteDomains?.length)return!1;if(!e.startsWith("https://"))return!1;if(e.includes("${"))return!1;try{let n=new URL(e);if(FS.has(Im(n.pathname).toLowerCase()))return!1;return t.remoteDomains.includes(n.hostname)}catch{return!1}}function VS(e,t,n){let r=n?.length?_l(n,e):null;if(r)return r;if(e.startsWith("/"))return RS(t,"public",e.slice(1));return RS(t,e)}function JS(e){return`${Math.round(e*1000)/10}%`}function MM(e){let t=SS(e);if(t===null)return null;let n;try{let o=OM(e);n=`${e}|${o.mtimeMs}|${o.size}`}catch{return null}let r=TS.get(n);if(r!==void 0)return r;let s=null;try{let o=new Uint8Array(kM(e)),{focus:i}=OS(vS(o,t));s=i===null?null:`${JS(i.x)} ${JS(i.y)}`}catch{s=null}return TS.set(n,s),s}function DM(e,t,n,r){if(!k(t)||t===""||t.includes("${"))return;if(LS.some((a)=>t.startsWith(a)))return;let{style:s}=e;if(s!==void 0&&!D(s))return;if(s?.objectPosition!==void 0)return;let[o=""]=t.split(/[?#]/),i=MM(VS(o,n,r));if(i!==null)e.style={...s,objectPosition:i}}async function qS(e,t,n,r,s,o=[]){let i=new Map;return await WS(e,t,n,r,s??new Map,i,o),{imageRefs:i}}async function WS(e,t,n,r,s,o,i,a=null){if(e.tagName==="img"){if(await UM(e,t,n,r,s,o,i,a))return}if(k(e.innerHTML)&&e.innerHTML.includes("<img"))e.innerHTML=await XM(e.innerHTML,t,n,r,s,o,i);if(Array.isArray(e.children)){let c=US(e,a);for(let l of e.children){if(!nn(l))continue;await WS(l,t,n,r,s,o,i,c)}}}async function HS(e,t,n,r,s,o,i,a){if(!k(e)||t)return null;let c=IM(e,n);if(!c&&JM(e))return null;if(c)return{dims:null,sources:[],srcset:NS(e,n,1/0,null)};let l=VS(e,r,a);if(!DS(l))return null;if(n.service==="cloudflare"){let g=await CM(l,o),b=NS(e,n,g.width??1/0,g.hash);return{dims:g.width&&g.height?{height:g.height,width:g.width}:null,sources:[],srcset:b}}if(RM.has(Im(l).toLowerCase()))return null;let u=i.get(l);if(!u)u=await TM(l,e,n,r,s),i.set(l,u);let d=LM(n.formats,u.variants),m=[...IS.filter((g)=>d.includes(g)),...d.filter((g)=>!IS.includes(g))].flatMap((g)=>{let b=pS(u.variants,g);return b===""?[]:[{srcset:b,type:FM.get(g)??`image/${g}`}]}),x=u.original?.width&&u.original.height?{height:u.original.height,width:u.original.width}:null,h=n.picture!==!1&&m.length>1;return{dims:x,fallbackSrc:qM(u.variants,d),sources:h?m:[],srcset:m[0]?.srcset??""}}function LM(e,t){return e.includes("jpeg")&&!e.includes("png")&&t.some((r)=>r.format==="png")&&!t.some((r)=>r.format==="jpeg")?[...e,"png"]:e}function qM(e,t){let n=VM.find((s)=>t.includes(s)&&e.some((o)=>o.format===s));if(n===void 0)return;let r;for(let s of e)if(s.format===n&&(r===void 0||s.width>r.width))r=s;return r&&Am(r.outputPath)}function MS(e){if(!k(e))return null;let t=WM.exec(e.trim());if(!t)return null;let n=Number(t[1]);return t[2]==="rem"?n*16:n}function US(e,t){let{style:n}=e;if(!D(n))return t;let r=MS(n.maxWidth)??MS(n.width);if(r===null)return t;return t===null?r:Math.min(t,r)}function HM(e){if(e===null)return;let t=Math.round(e);return`(max-width: ${t}px) 100vw, ${t}px`}async function UM(e,t,n,r,s,o,i,a=null){if(!e.attributes)e.attributes={};let c=e.attributes;if(c.src===void 0&&k(e.src))c.src=e.src,delete e.src;DM(e,c.src,n,i);let l=t.optimize?await HS(c.src,c["data-no-optimize"]!==void 0,t,n,r,s,o,i):null,u=US(e,a),d=c.sizes??HM(u)??t.sizes;if(l){if(l.srcset!==""){if(c.srcset=l.srcset,c.sizes=d,l.fallbackSrc!==void 0)c.src=l.fallbackSrc}if(l.dims&&c.width===void 0&&c.height===void 0)c.width=String(l.dims.width),c.height=String(l.dims.height)}if(Object.assign(c,Nm(c,t.lazyLoad)),l&&l.sources.length>0)return BM(e,l.sources,d),!0;return!1}function BM(e,t,n){let r={...e.attributes},s=r.sizes??n;delete r.srcset,delete r.sizes;let o={attributes:r,tagName:"img"};if(e.style!==void 0)o.style=e.style,delete e.style;let i=t.map((a)=>{let c={};if(s!=="")c.sizes=s;return c.srcset=a.srcset,c.type=a.type,{attributes:c,tagName:"source"}});i.push(o),e.tagName="picture",e.attributes={},e.children=i}async function XM(e,t,n,r,s,o,i){let a=[];for(let l of e.matchAll(zM)){let u=l[0],d=l[1],p=(fc(d,"src")??"").replaceAll("&amp;","&"),m=KM.test(d),x=t.optimize&&p!==""&&!m?await HS(p,GM.test(d),t,n,r,s,o,i):null,h="";if(x&&x.srcset!=="")h+=` srcset="${x.srcset}" sizes="${t.sizes}"`;if(x?.dims&&!/\bwidth=/.test(d)&&!/\bheight=/.test(d))h+=` width="${x.dims.width}" height="${x.dims.height}"`;let g=Nm({decoding:fc(d,"decoding"),fetchpriority:fc(d,"fetchpriority"),loading:fc(d,"loading")},t.lazyLoad);for(let[j,v]of Object.entries(g))h+=` ${j}="${v}"`;if(h==="")continue;let b=x&&x.sources.length>0?YM(d,x.sources,t.sizes,h):`<img${d}${h}>`;a.push({match:u,replacement:b})}let c=e;for(let{match:l,replacement:u}of a)c=c.replace(l,u);return c}function YM(e,t,n,r){let s=fc(e,"sizes")??n,o=r.replace(/ srcset="[^"]*"/,"").replace(/ sizes="[^"]*"/,"");return`<picture>${t.map((a)=>`<source type="${a.type}" srcset="${a.srcset}" sizes="${s}">`).join("")}<img${e}${o}></picture>`}function fc(e,t){return new RegExp(`\\b${t}="([^"]*)"`,"i").exec(e)?.[1]}var FS,RM,LS,CS=!1,TS,IS,FM,VM,WM,zM,KM,GM;var BS=T(()=>{Rm();Cm();$n();le();Dt();ES();AS();FS=new Set([".svg",".gif"]),RM=new Set([".avif"]),LS=["http://","https://","data:","//"];TS=new Map;IS=["avif","webp","jpeg","png"],FM=new Map([["avif","image/avif"],["jpeg","image/jpeg"],["png","image/png"],["webp","image/webp"]]);VM=["jpeg","png"];WM=/^(\d+(?:\.\d+)?)(px|rem)$/;zM=/<img\b([^>]*)>/gi,KM=/\bsrcset="/,GM=/\bdata-no-optimize\b/});import{createHash as ZM}from"node:crypto";import{existsSync as QM}from"node:fs";import{join as zS}from"node:path";function nD(e,t){let n=e.replace(/^\//,"");return e.endsWith("/")||n===""?zS(t,n,"index.html"):zS(t,n)}function Dm(e){if(e===void 0)return null;if(e===!1)return!1;if(e===!0)return{};return e.enabled===!1?!1:e}function rD(e){let t=JSON.stringify({fallback:e.offlineFallback??null,precache:[...e.precache??[]].toSorted(),scope:e.scope??"/"});return ZM("sha256").update(t,"utf8").digest("hex").slice(0,8)}function KS(e,t,n=""){let r=[],s=[],o=[...e.precache??[]],i=e.offlineFallback;if(i!==void 0&&!o.includes(i))o.push(i),r.push(`serviceWorker: "${i}" is the offline fallback but was not in \`precache\` — `+"added, since a page that was never cached cannot be served offline.");if(t!==void 0){for(let m of o)if(!m.startsWith("/"))s.push(`serviceWorker.precache: "${m}" must be a site-absolute URL starting with /.`);else if(!QM(nD(m,t)))s.push(`serviceWorker.precache: "${m}" is not a file this build produced — `+"`cache.addAll()` is all-or-nothing, so one bad entry stops the worker installing.")}let a=o.map((m)=>We(n,m)),c=We(n,eD),l=i===void 0?null:We(n,i),u=`${We(n,tD)}/`,d=`jx-${rD(e)}`,p=`/*
408
+ In a checkout of the Jx repository, build it with \`bun run build:addon\` (needs Rust). In a project, reinstall dependencies without --no-optional so the package for this platform is installed.`)}function O0(){return P0??=aM(oM()),P0}async function A0(e){return O0().imageMetadata(e)}async function C0(e){return O0().processImage(e)}var k0,j0,P0;var R0=R(()=>{E0();k0={avif:65,jpeg:80},j0=eM(import.meta.url)});import{createHash as Jg}from"node:crypto";import{readFileSync as cM}from"node:fs";import{basename as lM,extname as uM,resolve as N0}from"node:path";async function T0(e){return A0(e)}function Ti(e){let t=cM(e);return Jg("md5").update(t).digest("hex").slice(0,8)}function pM(e,t){let n=new Map(Object.entries(e)).get(t);if(n!==void 0)return n;return new Map(Object.entries(k0)).get(t)??dM}function mM(e,t,n){return Jg("md5").update(`${Ti(e)}:${J0}:${t}:${n}`).digest("hex").slice(0,8)}function I0(e){let t=JSON.stringify({formats:e.formats,quality:e.quality,v:J0,widths:e.widths});return Jg("md5").update(t).digest("hex").slice(0,8)}async function D0(e,t,n){let r=N0(t,"_optimized"),s={};if(n.quality.avif!==void 0)s.avif=n.quality.avif;if(n.quality.jpeg!==void 0)s.jpeg=n.quality.jpeg;let o=await C0({formats:n.formats,hashes:Object.fromEntries(n.formats.map((i)=>[i,mM(e,i,pM(n.quality,i))])),outDir:r,quality:s,source:e,stem:lM(e,uM(e)),widths:n.widths});return{contentHash:Ti(e),original:o.original,variants:o.variants.map((i)=>({absolutePath:N0(r,i.fileName),format:i.format,outputPath:`/${fM}/${i.fileName}`,width:i.width}))}}function M0(e,t){return e.flatMap((n)=>n.format===t?[`${Ig(n.outputPath)} ${n.width}w`]:[]).join(", ")}function Ig(e){return e.split("/").map((t)=>encodeURIComponent(t)).join("/")}var fM="images/_optimized",J0=4,dM=100;var Dg=R(()=>{R0()});import{existsSync as hM,mkdirSync as gM,readFileSync as yM,rmSync as xM,writeFileSync as bM}from"node:fs";import{basename as F0,extname as $M,resolve as gc}from"node:path";import{execSync as SM}from"node:child_process";import{createHash as wM}from"node:crypto";import{tmpdir as vM}from"node:os";function jM(){let e=process.env.npm_config_cache??process.env.NPM_CONFIG_CACHE;if(e)return e;try{let t=SM("npm config get cache",{cwd:vM(),encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:EM}).trim();return t&&t!=="undefined"?t:null}catch{return null}}function uf(e){if(lf===void 0)lf=jM();if(lf){let t=gc(e),n=wM("md5").update(t).digest("hex").slice(0,8);return gc(lf,"jxsuite-images",`${F0(t)}-${n}`)}return gc(e,".cache/images")}function L0(e,t){return`${Ti(e)}:${I0(t)}:${F0(e,$M(e))}`}function V0(e){let t=gc(uf(e),"manifest.json");if(!hM(t))return{entries:{},touched:new Set,version:1};try{let n=JSON.parse(yM(t,"utf8"));return n.touched=new Set,n}catch{return{entries:{},touched:new Set,version:1}}}function q0(e,t,n={}){if(n.prune&&t.touched)PM(t,t.touched);let r=uf(e);gM(r,{recursive:!0}),bM(gc(r,"manifest.json"),JSON.stringify({entries:t.entries,version:t.version},null,2),"utf8")}function PM(e,t){let n=new Set,r=Object.entries(e.entries);for(let[s,o]of r)if(t.has(s))for(let i of o.manifest.variants??[])n.add(i.absolutePath);for(let[s,o]of r){if(t.has(s))continue;for(let i of o.manifest.variants??[])if(!n.has(i.absolutePath))xM(i.absolutePath,{force:!0});delete e.entries[s]}}function W0(e){let t=new Set,n=new Map(Object.entries(e.entries));for(let r of e.touched??[])for(let s of n.get(r)?.manifest.variants??[])t.add(s.absolutePath);return[...t]}function H0(e,t){e.touched?.add(t);let n=e.entries[t];if(!n)return null;return n.manifest}function U0(e,t,n,r){e.touched?.add(t),e.entries[t]={manifest:r,source:n,timestamp:Date.now()}}var lf,EM=3000;var Mg=R(()=>{Dg()});function Fg(e,t){if(!t||B0(e.loading))return{};if(String(e.fetchpriority??"").toLowerCase()==="high")return{};return B0(e.decoding)?{loading:"lazy"}:{decoding:"async",loading:"lazy"}}var B0=(e)=>e!==void 0&&e!==null&&e!=="";function K0(e){let t=e.lastIndexOf(".");return _M.get(t>0?e.slice(t).toLowerCase():"")??null}function df(e){try{return OM.decode(e)}catch{throw new En("The metadata is not valid UTF-8.")}}function ff(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function yc(e,t,n){return String.fromCodePoint(...e.subarray(t,t+n))}function G0(e,t){switch(t){case"jpeg":return RM(e).packet;case"png":return IM(e).packet;case"webp":return MM(e).packet;default:return qM(df(e)).packet}}function AM(e){if(e[0]!==255||e[1]!==216)throw new En("Not a JPEG file.");let t=[],n=2;while(n+4<=e.length){if(e[n]!==255)throw new En("The JPEG's markers are damaged.");let r=e[n+1]??0;if(r===255){n+=1;continue}if(r===218||r===217)break;let s=ff(e).getUint16(n+2),o=n+2+s;if(s<2||o>e.length)throw new En("The JPEG's markers are damaged.");t.push({end:o,marker:r,start:n}),n=o}return t}function CM(e,t){let n=t.start+4;return t.marker===225&&t.end-n>=Lg.length&&Lg.every((r,s)=>e[n+s]===r)}function RM(e){let t=AM(e),n=t.find((s)=>CM(e,s));return{packet:n===void 0?null:df(e.subarray(n.start+4+Lg.length,n.end)),parts:t}}function TM(e){if(!z0.every((r,s)=>e[s]===r))throw new En("Not a PNG file.");let t=[],n=z0.length;while(n+12<=e.length){let r=ff(e).getUint32(n),s=n+12+r;if(s>e.length)throw new En("The PNG's chunks are damaged.");let o=yc(e,n+4,4);if(t.push({dataStart:n+8,end:s,start:n,type:o}),n=s,o==="IEND")break}return t}function JM(e,t){if(t.type!=="iTXt")return null;let n=e.subarray(t.dataStart,t.end-4),r=n.indexOf(0);if(r===-1||yc(n,0,r)!==NM)return null;if(n[r+1]!==0)throw new En("The PNG's metadata is compressed, which Studio does not rewrite.");let s=n.indexOf(0,r+3),o=s===-1?-1:n.indexOf(0,s+1);if(o===-1)throw new En("The PNG's metadata chunk is damaged.");return df(n.subarray(o+1))}function IM(e){let t=TM(e);return{packet:t.map((r)=>JM(e,r)).find((r)=>r!==null)??null,parts:t}}function DM(e){if(yc(e,0,4)!=="RIFF"||yc(e,8,4)!=="WEBP")throw new En("Not a WebP file.");let t=Math.min(e.length,8+ff(e).getUint32(4,!0)),n=[],r=12;while(r+8<=t){let s=ff(e).getUint32(r+4,!0),o=r+8,i=o+s+s%2;if(o+s>t)throw new En("The WebP's chunks are damaged.");n.push({dataStart:o,end:Math.min(i,t),fourcc:yc(e,r,4),size:s,start:r}),r=i}return n}function MM(e){let t=DM(e),n=t.find((s)=>s.fourcc==="XMP ");return{packet:n===void 0?null:df(e.subarray(n.dataStart,n.dataStart+n.size)),parts:t}}function LM(e,t){let n=null;for(let r=t+1;r<e.length;r++){let s=e[r];if(n!==null){if(s===n)n=null}else if(s==='"'||s==="'")n=s;else if(s===">")return r}return-1}function VM(e){let t=/<svg[\s>/]/.exec(e);if(t===null)throw new En("Not an SVG file.");let n=LM(e,t.index);if(n===-1)throw new En("The SVG's root element is damaged.");return{end:n,selfClosing:e[n-1]==="/",start:t.index}}function qM(e){VM(e);let t=FM.exec(e);return t===null?{end:-1,packet:null,start:-1}:{end:t.index+t[0].length,packet:t[0],start:t.index}}var En,_M,kM,OM,Lg,z0,NM="XML:com.adobe.xmp",FM;var X0=R(()=>{En=class En extends Error{name="XmpContainerError"};_M=new Map([[".jpeg","jpeg"],[".jpg","jpeg"],[".png","png"],[".svg","svg"],[".webp","webp"]]);kM=new TextEncoder,OM=new TextDecoder("utf-8",{fatal:!0});Lg=kM.encode("http://ns.adobe.com/xap/1.0/\x00");z0=Uint8Array.of(137,80,78,71,13,10,26,10);FM=/<([\w.-]+:)?xmpmeta\b[\s\S]*?<\/\1?xmpmeta\s*>/});function Y0(){return{alt:"",focus:null,tags:[]}}function HM(e){if(e.startsWith("#x")||e.startsWith("#X"))return Number.parseInt(e.slice(2),16);return e.startsWith("#")?Number(e.slice(1)):null}function Vg(e){return e.replaceAll(/&(#x[\da-f]+|#\d+|\w+);/gi,(t,n)=>{let r=HM(n),s=r===null?WM.get(n):r<=1114111?String.fromCodePoint(r):void 0;if(s===void 0)throw new jn(`Unknown entity ${t}`);return s})}function UM(e){let t={attrs:[],children:[],name:"#root",type:"element"},n=[t],r=0,s=()=>n.at(-1)??t;while(r<e.length){let o=e.indexOf("<",r);if(o===-1){s().children.push({type:"text",value:Vg(e.slice(r))});break}if(o>r)s().children.push({type:"text",value:Vg(e.slice(r,o))});let i=e.slice(o,o+9),a;if(i.startsWith("<!--"))a=e.indexOf("-->",o),a=a===-1?-1:a+3;else if(i.startsWith("<![CDATA["))a=e.indexOf("]]>",o),a=a===-1?-1:a+3;else if(i.startsWith("<?"))a=e.indexOf("?>",o),a=a===-1?-1:a+2;else if(i.startsWith("<!"))throw new jn("A packet may not declare a document type.");else if(i.startsWith("</")){let c=e.indexOf(">",o);if(c===-1)throw new jn("Unclosed end tag.");let l=e.slice(o+2,c).trim(),u=n.pop();if(u===void 0||u===t||u.name!==l)throw new jn(`Unexpected </${l}>.`);r=c+1;continue}else{r=BM(e,o,n);continue}if(a===-1)throw new jn("Unterminated markup.");s().children.push({source:e.slice(o,a),type:"raw"}),r=a}if(n.length!==1)throw new jn(`<${s().name}> is never closed.`);return t.children}function BM(e,t,n){let r=t+1,s=Z0.exec(e.slice(r));if(s===null)throw new jn("A tag has no name.");let o={attrs:[],children:[],name:s[0],type:"element"};r+=s[0].length;for(;;){while(/\s/.test(e[r]??""))r+=1;let i=e[r];if(i===void 0)throw new jn(`<${o.name}> is never finished.`);if(i===">"||e.startsWith("/>",r)){if(n.at(-1)?.children.push(o),i===">")return n.push(o),r+1;return r+2}let a=Z0.exec(e.slice(r));if(a===null)throw new jn(`<${o.name}> has a malformed attribute.`);r+=a[0].length;while(/\s/.test(e[r]??""))r+=1;if(e[r]!=="=")throw new jn(`${a[0]} has no value.`);r+=1;while(/\s/.test(e[r]??""))r+=1;let c=e[r];if(c!=='"'&&c!=="'")throw new jn(`${a[0]} is not quoted.`);let l=e.indexOf(c,r+1);if(l===-1)throw new jn(`${a[0]} is never closed.`);o.attrs.push([a[0],Vg(e.slice(r+1,l))]),r=l+1}}function Ji(e,t){let n=e.attrs.filter(([s])=>s==="xmlns"||s.startsWith("xmlns:"));if(n.length===0)return t;let r=new Map(t);for(let[s,o]of n)r.set(s==="xmlns"?"":s.slice(6),o);return r}function zM(e,t,n=!1){let r=e.indexOf(":");if(r===-1)return n?["",e]:[t.get("")??"",e];let s=e.slice(0,r),o=s==="xml"?"http://www.w3.org/XML/1998/namespace":t.get(s);return o===void 0?null:[o,e.slice(r+1)]}function Qn(e,t,n,r,s=!1){let o=zM(e,t,s);return o!==null&&o[0]===n&&o[1]===r}function Ii(e){return e.filter((t)=>t.type==="element")}function Di(e){return e.children.map((t)=>t.type==="text"?t.value:t.type==="element"?Di(t):"").join("")}function eE(e,t=new Map){let n=[];for(let r of Ii(e)){let s=Ji(r,t);if(Qn(r.name,s,"http://www.w3.org/1999/02/22-rdf-syntax-ns#","Description"))n.push([r,s]);else n.push(...eE(r.children,s))}return n}function Mi(e,t){let n=[];for(let r of Ii(e.children)){let s=Ji(r,t);for(let o of Ii(r.children)){let i=Ji(o,s);if(Qn(o.name,i,"http://www.w3.org/1999/02/22-rdf-syntax-ns#","li"))n.push([o,i])}}return n}function KM(e,t){let n=e.attrs.find(([r])=>Qn(r,t,"http://www.w3.org/XML/1998/namespace","lang",!0));return n===void 0?null:n[1]}function GM(e,t){let n=Mi(e,t),r=n.find(([s,o])=>KM(s,o)?.toLowerCase()==="x-default")??n[0];return r===void 0?Di(e).trim():Di(r[0])}function pf(e,t){if(!e.attrs.some(([r,s])=>s==="Resource"&&Qn(r,t,"http://www.w3.org/1999/02/22-rdf-syntax-ns#","parseType",!0)))for(let r of Ii(e.children)){let s=Ji(r,t);if(Qn(r.name,s,"http://www.w3.org/1999/02/22-rdf-syntax-ns#","Description"))return[r,s]}return[e,t]}function bc(e,t,n,r){for(let s of Ii(e.children)){let o=Ji(s,t);if(Qn(s.name,o,n,r))return[s,o]}return null}function xc(e,t,n,r){let s=e.attrs.find(([i])=>Qn(i,t,n,r,!0));if(s!==void 0)return s[1].trim();let o=bc(e,t,n,r);return o===null?null:Di(o[0]).trim()}function Q0(e){if(e===null||e==="")return null;let t=Number(e);return Number.isFinite(t)&&t>=0&&t<=1?t:null}function XM(e,t){let n=bc(e,t,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rRole");if(n===null)return!1;return Mi(...n).some(([r,s])=>{let[o,i]=pf(r,s),a=bc(o,i,"http://ns.adobe.com/xap/1.0/","Identifier");return(a===null?[xc(o,i,"http://ns.adobe.com/xap/1.0/","Identifier")??""]:Mi(...a).map(([l])=>Di(l).trim())).some((l)=>l.replace(/^https:/,"http:")==="http://cv.iptc.org/newscodes/imageregionrole/areaOfInterest")})}function YM(e,t){let[n,r]=pf(e,t),s=bc(n,r,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","RegionBoundary");if(s===null||!XM(n,r))return null;let[o,i]=pf(...s),a=bc(o,i,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbVertices");if(xc(o,i,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbShape")!=="polygon"||xc(o,i,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbUnit")!=="relative"||a===null)return null;let c=Mi(...a);if(c.length!==1)return null;let[l,u]=pf(...c[0]),d=Q0(xc(l,u,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbX")),p=Q0(xc(l,u,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbY"));return d===null||p===null?null:{x:d,y:p}}function ZM(e){let t=new Set,n=[];for(let r of e){let s=r.trim(),o=s.toLowerCase();if(s!==""&&!t.has(o))t.add(o),n.push(s)}return n}function tE(e){if(e===null)return Y0();let t=Y0(),n=!1;for(let[r,s]of eE(UM(e))){for(let[o,i]of r.attrs)if(!n&&Qn(o,s,"http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/","AltTextAccessibility",!0))t.alt=i,n=!0;for(let o of Ii(r.children)){let i=Ji(o,s);if(!n&&Qn(o.name,i,"http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/","AltTextAccessibility"))t.alt=GM(o,i),n=!0;else if(Qn(o.name,i,"http://purl.org/dc/elements/1.1/","subject"))t.tags.push(...Mi(o,i).map(([a])=>Di(a)));else if(t.focus===null&&Qn(o.name,i,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","ImageRegion"))for(let[a,c]of Mi(o,i))t.focus??=YM(a,c)}}return t.tags=ZM(t.tags),t.alt=t.alt.trim(),t}var jn,WM,Z0;var nE=R(()=>{jn=class jn extends Error{name="XmpParseError"};WM=new Map([["amp","&"],["apos","'"],["gt",">"],["lt","<"],["quot",'"']]);Z0=/^[A-Za-z_][\w.:-]*/});import{existsSync as uE,readFileSync as QM,statSync as eF}from"node:fs";import{basename as tF,extname as Hg,resolve as rE}from"node:path";async function sF(e,t){let n=t.get(e);if(!n){let r=Ti(e);try{let s=await T0(e);n={width:s.width,height:s.height,hash:r}}catch(s){if(!sE)sE=!0,console.warn(`Could not read image dimensions (${ge(s)}) — `+"emitting srcsets without width/height attributes.");n={width:null,height:null,hash:r}}t.set(e,n)}return n}function oE(e,t,n,r){let s=t.quality.webp??80,o=e.startsWith("/")?"":"/",i=r?`?v=${r}`:"",a=oF(e);return t.widths.filter((c)=>c<=n).toSorted((c,l)=>c-l).map((c)=>`/cdn-cgi/image/width=${c},quality=${s},fit=scale-down,format=auto${o}${a}${i} ${c}w`).join(", ")}function oF(e){return e.replaceAll(/[\s,]/g,(t)=>encodeURIComponent(t))}async function iF(e,t,n,r,s){let o=L0(e,n),i=H0(s,o);if(i){if(i.variants.every((l)=>uE(l.absolutePath)))return i}if(!i)console.log(` Optimizing ${tF(e)}...`);let a=await D0(e,uf(r),n);return U0(s,o,t,a),a}function aF(e){if(!e)return!0;if(e.includes("${"))return!0;if(dE.some((n)=>e.startsWith(n)))return!0;let t=Hg(e).toLowerCase();return!nF.has(t)&&!fE.has(t)}function cF(e,t){if(t.service!=="cloudflare")return!1;if(!t.remoteDomains?.length)return!1;if(!e.startsWith("https://"))return!1;if(e.includes("${"))return!1;try{let n=new URL(e);if(rF.has(Hg(n.pathname).toLowerCase()))return!1;return t.remoteDomains.includes(n.hostname)}catch{return!1}}function pE(e,t,n){let r=n?.length?Vl(n,e):null;if(r)return r;if(e.startsWith("/"))return rE(t,"public",e.slice(1));return rE(t,e)}function aE(e){return`${Math.round(e*1000)/10}%`}function lF(e){let t=K0(e);if(t===null)return null;let n;try{let o=eF(e);n=`${e}|${o.mtimeMs}|${o.size}`}catch{return null}let r=iE.get(n);if(r!==void 0)return r;let s=null;try{let o=new Uint8Array(QM(e)),{focus:i}=tE(G0(o,t));s=i===null?null:`${aE(i.x)} ${aE(i.y)}`}catch{s=null}return iE.set(n,s),s}function uF(e,t,n,r){if(!k(t)||t===""||t.includes("${"))return;if(dE.some((a)=>t.startsWith(a)))return;let{style:s}=e;if(s!==void 0&&!I(s))return;if(s?.objectPosition!==void 0)return;let[o=""]=t.split(/[?#]/),i=lF(pE(o,n,r));if(i!==null)e.style={...s,objectPosition:i}}async function mE(e,t,n,r,s,o=[]){let i=new Map;return await hE(e,t,n,r,s??new Map,i,o),{imageRefs:i}}async function hE(e,t,n,r,s,o,i,a=null){if(e.tagName==="img"){if(await gF(e,t,n,r,s,o,i,a))return}if(k(e.innerHTML)&&e.innerHTML.includes("<img"))e.innerHTML=await wF(e.innerHTML,t,n,r,s,o,i,Wg(e,a));if(Array.isArray(e.children)){let c=Wg(e,a);for(let l of e.children){if(!tn(l))continue;await hE(l,t,n,r,s,o,i,c)}}}async function gE(e,t,n,r,s,o,i,a){if(!k(e)||t)return null;let c=cF(e,n);if(!c&&aF(e))return null;if(c)return{dims:null,sources:[],srcset:oE(e,n,1/0,null)};let l=pE(e,r,a);if(!uE(l))return null;if(n.service==="cloudflare"){let y=await sF(l,o),S=oE(e,n,y.width??1/0,y.hash);return{dims:y.width&&y.height?{height:y.height,width:y.width}:null,sources:[],srcset:S}}if(fE.has(Hg(l).toLowerCase()))return null;let u=i.get(l);if(!u)u=await iF(l,e,n,r,s),i.set(l,u);let d=dF(n.formats,u.variants),m=[...cE.filter((y)=>d.includes(y)),...d.filter((y)=>!cE.includes(y))].flatMap((y)=>{let S=M0(u.variants,y);return S===""?[]:[{srcset:S,type:fF.get(y)??`image/${y}`}]}),x=u.original?.width&&u.original.height?{height:u.original.height,width:u.original.width}:null,g=n.picture!==!1&&m.length>1;return{dims:x,fallbackSrc:mF(u.variants,d),sources:g?m:[],srcset:m[0]?.srcset??""}}function dF(e,t){return e.includes("jpeg")&&!e.includes("png")&&t.some((r)=>r.format==="png")&&!t.some((r)=>r.format==="jpeg")?[...e,"png"]:e}function mF(e,t){let n=pF.find((s)=>t.includes(s)&&e.some((o)=>o.format===s));if(n===void 0)return;let r;for(let s of e)if(s.format===n&&(r===void 0||s.width>r.width))r=s;return r&&Ig(r.outputPath)}function lE(e){if(!k(e))return null;let t=hF.exec(e.trim());if(!t)return null;let n=Number(t[1]);return t[2]==="rem"?n*16:n}function Wg(e,t){let{style:n}=e;if(!I(n))return t;let r=t;for(let s of[lE(n.maxWidth),lE(n.width)])if(s!==null&&(r===null||s<r))r=s;return r}function yE(e){if(e===null)return;let t=Math.round(e);return`(max-width: ${t}px) 100vw, ${t}px`}async function gF(e,t,n,r,s,o,i,a=null){if(!e.attributes)e.attributes={};let c=e.attributes;if(c.src===void 0&&k(e.src))c.src=e.src,delete e.src;uF(e,c.src,n,i);let l=t.optimize?await gE(c.src,c["data-no-optimize"]!==void 0||c.srcset!==void 0,t,n,r,s,o,i):null,u=Wg(e,a),d=c.sizes??yE(u)??t.sizes;if(l){if(l.srcset!==""){if(c.srcset=l.srcset,d!==void 0)c.sizes=d;if(l.fallbackSrc!==void 0)c.src=l.fallbackSrc}if(l.dims&&c.width===void 0&&c.height===void 0)c.width=String(l.dims.width),c.height=String(l.dims.height)}if(Object.assign(c,Fg(c,t.lazyLoad)),l&&l.sources.length>0)return yF(e,l.sources,d),!0;return!1}function yF(e,t,n){let r={...e.attributes},s=r.sizes??n;delete r.srcset,delete r.sizes;let o={attributes:r,tagName:"img"};if(e.style!==void 0)o.style=e.style,delete e.style;let i=t.map((a)=>{let c={};if(s!==void 0&&s!=="")c.sizes=s;return c.srcset=a.srcset,c.type=a.type,{attributes:c,tagName:"source"}});i.push(o),e.tagName="picture",e.attributes={},e.children=i}async function wF(e,t,n,r,s,o,i,a){let c=[];for(let u of e.matchAll(xF)){let d=u[0],p=u[1],m=($c(p,"src")??"").replaceAll("&amp;","&"),x=t.optimize&&m!==""?await gE(m,bF.test(p)||qg(p,"srcset"),t,n,r,s,o,i):null,g=$c(p,"sizes"),y=g??yE(a)??t.sizes,S=p,E="";if(x&&x.srcset!==""){if(E+=` srcset="${x.srcset}"`,g===void 0&&y!==void 0&&y!=="")E+=` sizes="${y}"`;let{fallbackSrc:P}=x;if(P!==void 0)S=p.replace($F,(O,T)=>`${T}src="${P}"`)}if(x?.dims&&!qg(p,"width")&&!qg(p,"height"))E+=` width="${x.dims.width}" height="${x.dims.height}"`;let v=Fg({decoding:$c(p,"decoding"),fetchpriority:$c(p,"fetchpriority"),loading:$c(p,"loading")},t.lazyLoad);for(let[P,O]of Object.entries(v))E+=` ${P}="${O}"`;if(E==="")continue;let j=x&&x.sources.length>0?vF(S,x.sources,y,E):`<img${S}${E}>`;c.push({match:d,replacement:j})}let l=e;for(let{match:u,replacement:d}of c)l=l.replace(u,d);return l}function vF(e,t,n,r){let s=e.replace(SF,""),o=r.replace(/ srcset="[^"]*"/,"").replace(/ sizes="[^"]*"/,""),i=n===void 0||n===""?"":` sizes="${n}"`;return`<picture>${t.map((c)=>`<source type="${c.type}" srcset="${c.srcset}"${i}>`).join("")}<img${s}${o}></picture>`}function $c(e,t){return new RegExp(`(?:^|\\s)${t}="([^"]*)"`,"i").exec(e)?.[1]}function qg(e,t){return new RegExp(`(?:^|\\s)${t}=`,"i").test(e)}var nF,fE,rF,dE,sE=!1,iE,cE,fF,pF,hF,xF,bF,$F,SF;var xE=R(()=>{Dg();Mg();$n();le();Rt();X0();nE();nF=new Set([".jpg",".jpeg",".png",".webp",".tif",".tiff",".bmp"]),fE=new Set([".avif"]),rF=new Set([".svg",".gif"]),dE=["http://","https://","data:","//"];iE=new Map;cE=["avif","webp","jpeg","png"],fF=new Map([["avif","image/avif"],["jpeg","image/jpeg"],["png","image/png"],["webp","image/webp"]]);pF=["jpeg","png"];hF=/^(\d+(?:\.\d+)?)(px|rem)$/;xF=/<img\b([^>]*)>/gi,bF=/\bdata-no-optimize\b/,$F=/(^|\s)src="[^"]*"/i,SF=/(?:^|\s)sizes="[^"]*"/i});import{createHash as EF}from"node:crypto";import{existsSync as jF}from"node:fs";import{join as bE}from"node:path";function kF(e,t){let n=e.replace(/^\//,"");return e.endsWith("/")||n===""?bE(t,n,"index.html"):bE(t,n)}function Bg(e){if(e===void 0)return null;if(e===!1)return!1;if(e===!0)return{};return e.enabled===!1?!1:e}function OF(e){let t=JSON.stringify({fallback:e.offlineFallback??null,precache:[...e.precache??[]].toSorted(),scope:e.scope??"/"});return EF("sha256").update(t,"utf8").digest("hex").slice(0,8)}function $E(e,t,n=""){let r=[],s=[],o=[...e.precache??[]],i=e.offlineFallback;if(i!==void 0&&!o.includes(i))o.push(i),r.push(`serviceWorker: "${i}" is the offline fallback but was not in \`precache\` — `+"added, since a page that was never cached cannot be served offline.");if(t!==void 0){for(let m of o)if(!m.startsWith("/"))s.push(`serviceWorker.precache: "${m}" must be a site-absolute URL starting with /.`);else if(!jF(kF(m,t)))s.push(`serviceWorker.precache: "${m}" is not a file this build produced — `+"`cache.addAll()` is all-or-nothing, so one bad entry stops the worker installing.")}let a=o.map((m)=>Ie(n,m)),c=Ie(n,PF),l=i===void 0?null:Ie(n,i),u=`${Ie(n,_F)}/`,d=`jx-${OF(e)}`,p=`/*
412
409
  * Generated by @jxsuite/compiler — configure via \`serviceWorker\` in project.json.
413
410
  * Set \`"serviceWorker": false\` to replace this with a worker that removes itself.
414
411
  */
@@ -509,7 +506,7 @@ self.addEventListener("fetch", (event) => {
509
506
  })(),
510
507
  );
511
508
  });
512
- `;return{errors:s,path:Mm,source:p,warnings:r}}function GS(){return{errors:[],path:Mm,source:`/*
509
+ `;return{errors:s,path:Ug,source:p,warnings:r}}function SE(){return{errors:[],path:Ug,source:`/*
513
510
  * Generated by @jxsuite/compiler. This site had a service worker and no longer does.
514
511
  *
515
512
  * A worker is sticky: removing the file would leave every previous visitor running the old one
@@ -532,96 +529,96 @@ self.addEventListener("activate", (event) => {
532
529
  })(),
533
530
  );
534
531
  });
535
- `,warnings:[]}}function XS(e,t=""){return`if('serviceWorker' in navigator){addEventListener('load',function(){navigator.serviceWorker.register('${We(t,`/${Mm}`)}',{scope:${JSON.stringify(We(t,e))}}).catch(function(){})})}`}var Mm="sw.js",eD="/images/_optimized/",tD="/_jx";var YS=T(()=>{$n()});import{mkdirSync as sD,writeFileSync as oD}from"node:fs";import{dirname as iD,join as aD}from"node:path";function Es(e,t,n){if(n!==void 0)e[t]=n}function ZS(e){let t=e.manifest,n=[],r=[];if(t===void 0||t.enabled===!1)return{errors:n,files:[],warnings:r};let s=t.name??e.name??"Jx Site",o=ho(e.url),i=[];for(let u of t.icons??[])i.push(k(u.src)?{...u,src:We(o,u.src)}:u);let a={display:t.display??"standalone",icons:i,name:s,short_name:t.shortName??s,start_url:We(o,t.startUrl??"/")};Es(a,"description",t.description),Es(a,"theme_color",t.themeColor),Es(a,"background_color",t.backgroundColor),Es(a,"scope",t.scope===void 0?void 0:We(o,t.scope)),Es(a,"orientation",t.orientation),Es(a,"lang",t.lang),Es(a,"dir",t.dir),Es(a,"categories",t.categories);let c=new Set(i.flatMap((u)=>(u.sizes??"").split(/\s+/).map((d)=>Math.trunc(Number(d.split("x")[0]))))),l=cD.filter((u)=>!c.has(u));if(l.length>0)r.push(`manifest: no ${l.join("px and no ")}px icon declared — browsers will not offer to `+"install the site without one at each size.");return{errors:n,files:[{content:`${JSON.stringify(a,null,2)}
536
- `,path:"manifest.webmanifest"}],warnings:r}}function QS(e){let t=e.manifest;if(t===void 0||t.enabled===!1)return[];let n=[{attributes:{href:"/manifest.webmanifest",rel:"manifest"},tagName:"link"}];if(t.themeColor!==void 0)n.push({attributes:{content:t.themeColor,name:"theme-color"},tagName:"meta"});return n}function ev(e,t){let n=e.securityTxt,r=[],s=[];if(n===void 0||n.enabled===!1)return{errors:r,files:[],warnings:s};let o=n.contact??[];if(o.length===0)r.push("securityTxt: at least one `contact` is required (RFC 9116 §2.5.3).");if(n.expires===void 0)r.push("securityTxt: `expires` is required (RFC 9116 §2.5.5) — a security.txt with no expiry "+"never goes stale visibly, which is how they end up pointing at people who left.");else{let c=new Date(n.expires);if(Number.isNaN(c.getTime()))r.push(`securityTxt: \`expires\` is not a valid date: "${n.expires}".`);else if(c.getTime()<=t.getTime())r.push(`securityTxt: \`expires\` is in the past (${c.toISOString()}) — an expired `+"security.txt tells a reporter not to trust what it says.")}let i=[];for(let c of n.preferredLanguages??[]){let l=Tn(c);if(l===null)r.push(`securityTxt.preferredLanguages: "${c}" is not a well-formed language tag.`);else i.push(l)}if(r.length>0)return{errors:r,files:[],warnings:s};let a=["# Generated by @jxsuite/compiler — configure via securityTxt in project.json.",...o.map((c)=>`Contact: ${c}`),`Expires: ${new Date(n.expires).toISOString().replace(/\.\d{3}Z$/,"Z")}`,...(n.encryption??[]).map((c)=>`Encryption: ${c}`),...(n.acknowledgments??[]).map((c)=>`Acknowledgments: ${c}`),...i.length>0?[`Preferred-Languages: ${i.join(", ")}`]:[],...n.canonical===void 0?[]:[`Canonical: ${n.canonical}`],...(n.policy??[]).map((c)=>`Policy: ${c}`),...(n.hiring??[]).map((c)=>`Hiring: ${c}`)];return{errors:r,files:[{content:`${a.join(`
532
+ `,warnings:[]}}function wE(e,t=""){return`if('serviceWorker' in navigator){addEventListener('load',function(){navigator.serviceWorker.register('${Ie(t,`/${Ug}`)}',{scope:${JSON.stringify(Ie(t,e))}}).catch(function(){})})}`}var Ug="sw.js",PF="/images/_optimized/",_F="/_jx";var vE=R(()=>{$n()});import{mkdirSync as AF,writeFileSync as CF}from"node:fs";import{dirname as RF,join as NF}from"node:path";function ks(e,t,n){if(n!==void 0)e[t]=n}function EE(e){let t=e.manifest,n=[],r=[];if(t===void 0||t.enabled===!1)return{errors:n,files:[],warnings:r};let s=t.name??e.name??"Jx Site",o=yo(e.url),i=[];for(let u of t.icons??[])i.push(k(u.src)?{...u,src:Ie(o,u.src)}:u);let a={display:t.display??"standalone",icons:i,name:s,short_name:t.shortName??s,start_url:Ie(o,t.startUrl??"/")};ks(a,"description",t.description),ks(a,"theme_color",t.themeColor),ks(a,"background_color",t.backgroundColor),ks(a,"scope",t.scope===void 0?void 0:Ie(o,t.scope)),ks(a,"orientation",t.orientation),ks(a,"lang",t.lang),ks(a,"dir",t.dir),ks(a,"categories",t.categories);let c=new Set(i.flatMap((u)=>(u.sizes??"").split(/\s+/).map((d)=>Math.trunc(Number(d.split("x")[0]))))),l=TF.filter((u)=>!c.has(u));if(l.length>0)r.push(`manifest: no ${l.join("px and no ")}px icon declared — browsers will not offer to `+"install the site without one at each size.");return{errors:n,files:[{content:`${JSON.stringify(a,null,2)}
533
+ `,path:"manifest.webmanifest"}],warnings:r}}function jE(e){let t=e.manifest;if(t===void 0||t.enabled===!1)return[];let n=[{attributes:{href:"/manifest.webmanifest",rel:"manifest"},tagName:"link"}];if(t.themeColor!==void 0)n.push({attributes:{content:t.themeColor,name:"theme-color"},tagName:"meta"});return n}function PE(e,t){let n=e.securityTxt,r=[],s=[];if(n===void 0||n.enabled===!1)return{errors:r,files:[],warnings:s};let o=n.contact??[];if(o.length===0)r.push("securityTxt: at least one `contact` is required (RFC 9116 §2.5.3).");if(n.expires===void 0)r.push("securityTxt: `expires` is required (RFC 9116 §2.5.5) — a security.txt with no expiry "+"never goes stale visibly, which is how they end up pointing at people who left.");else{let c=new Date(n.expires);if(Number.isNaN(c.getTime()))r.push(`securityTxt: \`expires\` is not a valid date: "${n.expires}".`);else if(c.getTime()<=t.getTime())r.push(`securityTxt: \`expires\` is in the past (${c.toISOString()}) — an expired `+"security.txt tells a reporter not to trust what it says.")}let i=[];for(let c of n.preferredLanguages??[]){let l=Nn(c);if(l===null)r.push(`securityTxt.preferredLanguages: "${c}" is not a well-formed language tag.`);else i.push(l)}if(r.length>0)return{errors:r,files:[],warnings:s};let a=["# Generated by @jxsuite/compiler — configure via securityTxt in project.json.",...o.map((c)=>`Contact: ${c}`),`Expires: ${new Date(n.expires).toISOString().replace(/\.\d{3}Z$/,"Z")}`,...(n.encryption??[]).map((c)=>`Encryption: ${c}`),...(n.acknowledgments??[]).map((c)=>`Acknowledgments: ${c}`),...i.length>0?[`Preferred-Languages: ${i.join(", ")}`]:[],...n.canonical===void 0?[]:[`Canonical: ${n.canonical}`],...(n.policy??[]).map((c)=>`Policy: ${c}`),...(n.hiring??[]).map((c)=>`Hiring: ${c}`)];return{errors:r,files:[{content:`${a.join(`
537
534
  `)}
538
- `,path:".well-known/security.txt"}],warnings:s}}function tv(e,t,n){let r=0,s=[];for(let o of e){let i=aD(t,o.path);if(n(i)){s.push(o.path);continue}sD(iD(i),{recursive:!0}),oD(i,o.content,"utf8"),r+=1}return{skipped:s,written:r}}var cD;var nv=T(()=>{$n();Eo();le();cD=[192,512]});import{existsSync as lD,mkdirSync as Lm,readFileSync as uD,readdirSync as fD,writeFileSync as dD}from"node:fs";import{dirname as dc,join as pD,relative as mD,resolve as pc}from"node:path";function hD(e){return e.endsWith("/")}function sv(e=Vm){let t={},n=[],r=[];for(let s of Ju)if(gD(s.specifier,e))t[s.specifier]=s.assetPath,t[`${s.specifier}/`]=s.assetDir,r.push(s.assetPath);else t[s.specifier]=s.fallback,n.push(`Could not resolve "${s.specifier}" — the import map falls back to ${s.fallback}. Interactive pages will load it from a third party, and a \`default-src 'self'\` policy will block them.`);return{assetPaths:r,imports:t,warnings:n}}async function ov(e,t,n=Vm,r=!0){let s=[],o=0;for(let i of Ju){if(!e.assetPaths.includes(i.assetPath))continue;let a=pc(t,i.assetPath.replace(/^\//,""));Lm(dc(a),{recursive:!0});try{await So(`export * from ${JSON.stringify(i.specifier)};
539
- `,{outfile:a,resolveDir:n},{minify:r,target:"browser"}),o+=1}catch(c){s.push(`Bundling client runtime "${i.specifier}": ${$e(c)}`)}}return{errors:s,written:o}}function qm(e){return Object.entries(e).filter(([t,n])=>!hD(t)&&n.startsWith("/")).map(([,t])=>t)}function iv(e){let t=[];for(let n of e.matchAll(/<script type="importmap">([\s\S]*?)<\/script>/g)){let r;try{r=JSON.parse(n[1])}catch{continue}let s=V(r)?r.imports:void 0;if(!D(s))continue;let o=Object.entries(s).flatMap(([i,a])=>k(a)?[[i,a]]:[]);t.push(...qm(Object.fromEntries(o)))}return t}function av(e){return`<script type="importmap">
535
+ `,path:".well-known/security.txt"}],warnings:s}}function _E(e,t,n){let r=0,s=[];for(let o of e){let i=NF(t,o.path);if(n(i)){s.push(o.path);continue}AF(RF(i),{recursive:!0}),CF(i,o.content,"utf8"),r+=1}return{skipped:s,written:r}}var TF;var kE=R(()=>{$n();Po();le();TF=[192,512]});import{existsSync as JF,mkdirSync as Kg,readFileSync as IF,readdirSync as DF,writeFileSync as MF}from"node:fs";import{dirname as Sc,join as FF,relative as LF,resolve as wc}from"node:path";function VF(e){return e.endsWith("/")}function AE(e=Gg){let t={},n=[],r=[];for(let s of mf)if(qF(s.specifier,e))t[s.specifier]=s.assetPath,t[`${s.specifier}/`]=s.assetDir,r.push(s.assetPath);else t[s.specifier]=s.fallback,n.push(`Could not resolve "${s.specifier}" — the import map falls back to ${s.fallback}. Interactive pages will load it from a third party, and a \`default-src 'self'\` policy will block them.`);return{assetPaths:r,imports:t,warnings:n}}async function CE(e,t,n=Gg,r=!0){let s=[],o=0;for(let i of mf){if(!e.assetPaths.includes(i.assetPath))continue;let a=wc(t,i.assetPath.replace(/^\//,""));Kg(Sc(a),{recursive:!0});try{await Eo(`export * from ${JSON.stringify(i.specifier)};
536
+ `,{outfile:a,resolveDir:n},{minify:r,target:"browser"}),o+=1}catch(c){s.push(`Bundling client runtime "${i.specifier}": ${ge(c)}`)}}return{errors:s,written:o}}function Xg(e){return Object.entries(e).filter(([t,n])=>!VF(t)&&n.startsWith("/")).map(([,t])=>t)}function RE(e){let t=[];for(let n of e.matchAll(/<script type="importmap">([\s\S]*?)<\/script>/g)){let r;try{r=JSON.parse(n[1])}catch{continue}let s=L(r)?r.imports:void 0;if(!I(s))continue;let o=Object.entries(s).flatMap(([i,a])=>k(a)?[[i,a]]:[]);t.push(...Xg(Object.fromEntries(o)))}return t}function NE(e){return`<script type="importmap">
540
537
  {
541
538
  "imports": {
542
539
  ${Object.entries(e).map(([n,r])=>` ${JSON.stringify(n)}: ${JSON.stringify(r)}`).join(`,
543
540
  `)}
544
541
  }
545
542
  }
546
- </script>`}function gD(e,t){try{return hb(e,t),!0}catch{return!1}}async function cv(e,t=Vm,n=!0){let r=[],s=new Set,o=new Map,i=new Map,a=pc(e,"assets"),c=0,l=async(d)=>{if(!i.has(d.specifier))i.set(d.specifier,await xb(d.specifier,t,{target:"browser"}));return i.get(d.specifier)},u=async(d)=>[...uD(d,"utf8").matchAll(/(?:from|import)\s*["']([^"']+)["']/g)].map((m)=>m[1]);for(let d=0;d<rv;d++){let p=0,m=[];try{m=fD(a,{recursive:!0}).map(String).filter((x)=>x.endsWith(".js")).map((x)=>pD(a,x))}catch{return Fm(e,o,r,c)}for(let x of m){let h=[];try{h=await u(x)}catch{continue}for(let g of h){let b=Ju.find((P)=>g.startsWith(`${P.specifier}/`));if(!b||s.has(g))continue;s.add(g);let j=g.slice(b.specifier.length+1),v=pc(e,`${b.assetDir.replace(/^\//,"")}${j}`);Lm(dc(v),{recursive:!0});try{await So(`export * from ${JSON.stringify(g)};
547
- `,{outfile:v,resolveDir:t},{minify:n,resolver:yD(b,v,await l(b),o),target:"browser"}),c+=1,p+=1}catch(P){r.push(`Bundling runtime subpath "${g}": ${$e(P)}`)}}}if(p===0)return Fm(e,o,r,c)}return r.push(`Runtime subpath resolution did not settle in ${rv} passes — a package subpath `+"graph this deep is more likely a cycle in the scan than a real dependency chain."),Fm(e,o,r,c)}function yD(e,t,n,r){return{filter:/.*/,resolve:({importer:s,path:o})=>{if(ip(s))return;if(Ju.find((a)=>o===a.specifier||o.startsWith(`${a.specifier}/`))!==void 0)return{external:!0,path:o};if(n===void 0||!o.startsWith("."))return;if(pc(dc(s),o)!==n)return;return r.set(pc(dc(t),o),e.specifier),{external:!0,path:o}}}}function Fm(e,t,n,r){let s=r;for(let[o,i]of t){if(lD(o))continue;try{Lm(dc(o),{recursive:!0}),dD(o,`export * from ${JSON.stringify(i)};
548
- `,"utf8"),s+=1}catch(a){n.push(`Writing shared core stub ${mD(e,o)}: ${$e(a)}`)}}return{errors:n,written:s}}var Ju,Vm,rv=10;var lv=T(()=>{ap();hr();le();Dt();Ju=[{assetDir:"/assets/@vue/reactivity/",assetPath:"/assets/vue-reactivity.js",fallback:$s,specifier:"@vue/reactivity"},{assetDir:"/assets/lit-html/",assetPath:"/assets/lit-html.js",fallback:ws,specifier:"lit-html"}];Vm=import.meta.dirname});import{cpSync as Iu,existsSync as js,mkdirSync as er,readFileSync as xD,rmSync as bD,statSync as $D,writeFileSync as In}from"node:fs";import{createHash as wD}from"node:crypto";import{basename as SD,dirname as yr,join as Ps,relative as uv,resolve as $t,sep as vD}from"node:path";async function mv(e,t={}){let{clean:n=!0,includeHeld:r=!1,verbose:s=!1}=t,o=[],i=s?console.log.bind(console):()=>{},a={bundles:0,components:0,content:0,outputs:0,routes:0,setup:0,total:0},c=performance.now(),l=c,u=(A)=>{let H=performance.now();a[A]=H-l,l=H};i("Loading project.json...");let{config:d}=ms(e);if("contentTypes"in d)throw Error('project.json declares "contentTypes", which is no longer supported. Run `bun scripts/migrate-project-extensions.ts <project>` to migrate to "extensions" + "content", then `jx schema`.');let p=$t(e,d.build.outDir),m=$t(e,"pages"),x=$t(e,"public"),h=d.build.trailingSlash??"always",g=d.build.minify!==!1,b=new Map,j=new Map,v=new Map,P=(A)=>{let H=A.toSorted(),f=`/assets/elements-${wD("sha1").update(H.join("\x00")).digest("hex").slice(0,12)}.js`;return v.set(f,H),f},S=sv(),_=S.imports,N=new Set,F=G$(),{errors:K,i18n:J}=mp(d);for(let A of K)o.push(A),console.error(A);for(let A of S.warnings)console.warn(A);let C=new Map,L=(A,H,U)=>{let f=C.get(A);if(f!==void 0&&f.entryPath!==H)throw Error(`"${U}" and "${f.specifier}" both map to ${A} — rename one`);C.set(A,{entryPath:H,specifier:U})},G=new Set,te=(A)=>{if(!G.has(A))G.add(A),o.push(A),console.error(A)},de=(A)=>{let H=wi(A);if(H===null)return te(`$src "${A}" is not a document script specifier`),A;if(H.side==="server")return te(`${H.path}: a client function names "#server". A server module is called by a timing: "server" entry and never imported by a page`),A;try{let U=Gd(`./${H.path}`);return L(U,A,A),b.set(U,{entryPath:A,script:!0,specifier:A}),U}catch(U){return te(`Script of ${H.path}: ${$e(U)}`),A}},ae=(A,H)=>{if(Yl(A))return de(A);if($i(A)!==null)return te(`$src "${A}" names its own document's script, but it is not in a document: project.json has no $script. Move the entry into the page, layout or component that carries the script`),A;if(!mb(A))return A;try{let U=op(A,H??e,e);if(!mo(A)&&!js(U))return console.warn(`Sidecar "${A}" not found at ${U} — emitting unbundled`),A;let f=mo(A)?A:`./${uv(e,U)}`,y=Gd(f);return L(y,U,A),b.set(y,{entryPath:U,specifier:A}),y}catch(U){return o.push(`Sidecar "${A}": ${$e(U)}`),A}},ne=(A)=>{let H=Nx(A);try{let U=op(`npm:${A}`,e,e);return L(H,U,A),j.set(H,U),H}catch(U){return o.push(`$head specifier "${A}": ${$e(U)}`),A}},se=await ps(e,d),xe=se.formats,z=mw(e,(A)=>Qr(A,xe));if(xe.entries.length>0)i(` Registered ${xe.entries.length} format(s): ${xe.entries.map((A)=>A.name).join(", ")}`);let ye=se.serverMounts().filter((A)=>{if(!A.project)return!0;let H=d[A.project.key];return D(H)&&Object.keys(H).length>0});if(ye.length>0&&!d.build.adapter){let A=ye.map((H)=>H.project?`"${H.project.key}"`:`"${H.server.basePath}"`).join(", ");throw Error(`project.json declares dynamic section(s) ${A} served by extension mounts, but `+`build.adapter is "static". Dynamic tables need a server-capable adapter — ${fv}`)}if(u("setup"),n&&js(p))bD(p,{force:!0,recursive:!0});if(er(p,{recursive:!0}),!js(m))throw Error(`pages/ directory not found in ${e}`);i("Discovering pages...");let pe=await H$(m,xe);i(` Found ${pe.length} page(s)`),i("Loading project sections...");let ee=await aw(e,d,se,{includeHeld:r}),Qe=Object.keys(ee);if(Qe.length>0)i(` Loaded ${Qe.length} section(s): ${Qe.join(", ")}`);let{errors:Me,mounts:Ge}=await lw(se,d,e);o.push(...Me);for(let A of Me)console.error(A);if(Ge.length>0)i(` Mounted ${Ge.length} asset dir(s): ${Ge.map((A)=>A.urlPrefix).join(", ")}`);let X=new Set,Bt=await PD(se,d,e),ce=(await z$(pe,e,ee,se,d,J,{errors:o})).map((A)=>Object.assign(A,{locale:Xn(A.urlPattern,J)}));i(` ${ce.length} route(s) after expansion`);let be=0;u("content");let Fe=[],Le=new Map,ot=new Map,Nr=new Map,{components:nr,errors:Xs}=await ww({formatRegistry:xe,pageSources:ce.map((A)=>A.sourcePath),projectConfig:d,projectRoot:e});for(let A of Xs)o.push(A),console.error(A);if(nr.length>0){i("Compiling components...");let A=$t(p,"components");er(A,{recursive:!0});let H=new Map(nr.map((y)=>[y.path,y.tagName])),U=ho(d.url),f=Ou(U);for(let{doc:y,path:w}of nr){let E=ou(y,d.state);try{let O={formats:xe,resolveElementPath:(q,Z)=>{let oe=Z?$t(Z,q):$t(q),fe=H.get(oe);return fe?`./${fe}.js`:q.replace(/\.(?:json|jxn)$/i,".js")},projectRoot:e,projectState:d.state,rewriteSrc:(q,Z)=>We(U,ae(q,Z)),serverBaseUrl:f};if(d.$media)O.$media=d.$media;let I=await _u(w,O);for(let q of I.files){let Z=q.tagName?`${q.tagName}.js`:SD(q.path);if(!Fe.includes(q.tagName))In($t(A,Z),q.content,"utf8"),Fe.push(q.tagName),be+=1}if(E.tagName){ot.set(E.tagName,E),Nr.set(E.tagName,w);let q=ko(E,d.defaults),Z=O$(E.tagName,E.style,E,d.$media??{},q);if(Z){if(q===null)Le.set(E.tagName,Z);fm(Z,Ge,X),In($t(A,`${E.tagName}.css`),Z,"utf8"),be+=1}}}catch(O){let I=$e(O),q=uv(e,w).replaceAll("\\","/");o.push(`Error compiling component ${q}: ${I}`),console.error(`Error compiling component ${q}: ${I}`)}}i(` Compiled ${Fe.length} component(s): ${Fe.join(", ")}`)}let pt=[];for(let[A,H]of ot)pt.push(...oc(H,Nr.get(A),e));if(d.state){let A=oc({state:d.state},Rn(e),e);for(let H of A)if($i(H.src)===null)pt.push(H);else te(`Server function "${H.exportName}" in ${H.declaredIn} names "${H.src}", its own document's script, but project.json has no $script. Move the entry into the page, layout or component that carries the script`)}u("components");let Pn=d.images.optimize&&d.images.service==="cloudflare",It=d.images.optimize&&!Pn?gS(e):null,Fo=Pn?new Map:null;if(It&&d.images.formats?.includes("webp"))console.warn('images.formats lists "webp", which this compiler writes losslessly: its files are several times the size of AVIF or JPEG. Keep it only for pixel-exact output; ["avif", "jpeg"] is the default.');if(Pn)console.log('images.service is "cloudflare" — srcsets use /cdn-cgi/image transform URLs. '+"Ensure Image Transformations are enabled for your zone (Cloudflare dashboard → "+"Images → Transformations); these URLs do not work on *.pages.dev / *.workers.dev previews.");let ns=d.url,rr=ho(ns),ya=Boolean(ns)&&d.build.sitemap!==!1,Ys=[],Lo=ce.filter((A)=>!A.urlPattern.includes(":")&&!A.urlPattern.includes("*")),Vo=J===null?new Map:await W$(Lo,xe),Zs=Lo.map((A)=>({translationKey:Vo.get(A.urlPattern),urlPattern:A.urlPattern})),qo=I$(Zs,J,ns,h),{conflicts:Yf,sets:Zf}=tm(Zs,J);for(let A of Yf){let[H,U]=A.urlPatterns,f=A.declared?"Give one of them a different $translationKey.":"Move one out of the locale tree, or give it its own $translationKey.",y=`${U} and ${H} are both the "${A.locale}" version of "${A.key}". A translation set names one URL per language, so ${U} is `+`dropped from it — it carries no alternates and no switcher. ${f}`;if(A.declared)o.push(y),console.error(y);else console.warn(y)}let Ot=T$(ce,J);if(Ot.length>0)console.warn(`i18n.routing is "prefix-always", but ${Ot.length} route(s) sit outside the locale tree and are served as "${J?.defaultLocale}": ${Ot.slice(0,10).join(", ")}${Ot.length>10?`, and ${Ot.length-10} more`:""}. Move them under a locale directory, or use "prefix-except-default".`);if(J!==null&&J.routing==="prefix-always"&&!d.build.adapter&&!ce.some((A)=>A.urlPattern==="/"))console.warn('i18n.routing is "prefix-always" and no page claims "/", so the site root is a 404. '+'Locale negotiation answers "/" only when build.adapter is set — a static deployment has '+`no runtime to read Accept-Language. Add a redirect from "/" to "/${J.defaultLocale.toLowerCase()}/", set build.adapter, or use "prefix-except-default".`);let Wo=new Set,xa=new Set;for(let A of ce){let H=J$(A.urlPattern,J);if(H&&!Wo.has(H.segment))Wo.add(H.segment),console.warn(`Routes under /${H.segment}/ are served as "${J?.defaultLocale}" — `+`i18n.locales declares "${H.meant}", not "${H.segment}". Rename the directory to "${H.meant.toLowerCase()}" or declare the shorter tag.`);try{i(` Compiling ${A.urlPattern} ...`);let U=await ED(A,d,e,ee,It,ot,Fo,xe,se,ae,Ge,Bt,ne,{alternates:qo.get(A.urlPattern)??[],i18n:J,translations:Zf.get(A.urlPattern)??[]},_,P);pt.push(...U.serverEntries);for(let I of U.unregisteredRelations)if(!xa.has(I))xa.add(I),console.warn(`<link rel="${I}"> — "${I}" is not an IANA link relation, and a relation nobody recognizes does nothing. Check the spelling, or use an absolute `+"URI if it is an extension relation (RFC 8288 §2.1.2).");let f=new Set;for(let[I,q]of ot)if(hu(q))f.add(I);if(Fe.length>0)U.html=AD(U.html,Fe,Le,f,U.files.map((I)=>I.content).join(`
549
- `),_);for(let I of iv(U.html))N.add(I);fm(U.html,Ge,X),X$(U.html,F);let y=xv(A.urlPattern,p,h);er(yr(y),{recursive:!0});let w=!A.urlPattern.includes(":")&&!A.urlPattern.includes("*"),E=!sc(A.urlPattern)&&!A$(U.html);if(ya&&!U.excludeFromSitemap&&E&&w){let I=qo.get(A.urlPattern)??[];Ys.push({lastmod:k(A.sourceMtime)&&A.sourceMtime!==""?A.sourceMtime:TD($D(A.sourcePath).mtime),loc:hs(Ni(A.urlPattern,h),ns),...I.length>0&&{alternates:I}})}let O=[];for(let I of xe.withCapability("serialize")){if(!I.exportTarget||sc(A.urlPattern))continue;try{let q=await I.call("serialize",U.doc,{buildScope:(Z)=>ji(Z,null),componentDefs:ot,evaluateTemplate:(Z,oe)=>{if(!me(Z))return;return Vt(Z,oe)??Z},mode:"export"});if(q){let Z=y.replace(/\.html$/,I.extensions[0]);O.push({content:q,path:Z,type:I.mediaTypeEssence})}}catch(q){o.push(`Error exporting ${I.name} for ${A.urlPattern}: ${$e(q)}`)}}for(let I of O)if(I.type!==null)U.html=C$(U.html,{href:N$(p,I.path),type:I.type});In(y,Mx(U.html,rr),"utf8"),be+=1;for(let I of O)In(I.path,I.content,"utf8"),be+=1;for(let I of U.files){let q=$t(yr(y),I.path);er(yr(q),{recursive:!0}),In(q,I.content,"utf8"),be+=1}}catch(U){let f=`Error compiling ${A.urlPattern}: ${$e(U)}`;o.push(f),console.error(f)}}if(u("routes"),It&&d.images.optimize){yS(e,It,{prune:o.length===0});let A=$t(Mi(e),"_optimized");if(js(A)){let U=$t(p,"images/_optimized");er(U,{recursive:!0}),Iu(A,U,{recursive:!0})}let H=Object.keys(It.entries).length;if(H>0)i(` Optimized ${H} image(s)`)}let Qs=[];if(!d.build.adapter&&pt.length>0){let H=`timing: "server" entries ${[...new Set(pt.map(({exportName:U,declaredIn:f})=>`${U} (${f})`))].join(", ")} need a server-capable adapter, but `+`build.adapter is "static": a static deployment has nothing to serve /_jx/server — ${fv}`;o.push(H),console.error(H)}if(d.build.adapter){let{adapter:A}=d.build;i("Generating site-wide server worker...");let{entries:H,errors:U}=Ew(pt);Qs=H;for(let O of U)o.push(O),console.error(O);let{mounts:f,connectors:y}=jD(ye,se,d);if(f.length>0)i(` Mounting ${f.length} extension route(s): ${f.map((O)=>O.basePath).join(", ")}`);let E=A==="cloudflare-pages"&&Qs.length===0&&f.length===0?null:Pm(Qs,{adapter:A,base:rr,connectors:y,i18n:J,mounts:f});if(E){let O=A==="cloudflare-pages"?"_worker.js":"worker.js";try{await bb(E,{adapter:A,outfile:$t(p,O),plugins:[z.serverPlugin],projectRoot:e}),be+=1,i(` Generated dist/${O} (bundled, ${Qs.length} server function(s))`)}catch(I){let q=`Error bundling dist/${O}: ${$e(I)}`;o.push(q),console.error(q)}if(A==="cloudflare-pages")In($t(p,"_routes.json"),`${JSON.stringify({exclude:[],include:(J&&J.locales.length>1?["/","/_jx/*"]:["/_jx/*"]).map((I)=>We(rr,I)),version:1},null,2)}
550
- `,"utf8"),be+=1}}if(N.size>0){i(`Bundling ${N.size} client runtime module(s)...`);let A=await ov({...S,assetPaths:[...N]},p,void 0,g);be+=A.written;for(let H of A.errors)o.push(H),console.error(H)}if(j.size>0){i(`Copying ${j.size} package asset(s)...`);for(let[A,H]of j){let U=$t(p,A.replace(/^\//,""));er(yr(U),{recursive:!0}),Iu(H,U),be+=1,i(` ${H} → ${A}`)}}if(b.size>0){i(`Bundling ${b.size} client sidecar module(s)...`);for(let[A,H]of b)try{let U=$t(p,A.replace(/^\//,""));er(yr(U),{recursive:!0});let f={entryPath:H.entryPath,outfile:U};if(H.script){let y=await z.module(H.specifier);f.entryPath=y.path,f.contents=y.contents}await yb(f,{external:pb,minify:g,plugins:[z.clientPlugin],target:"browser"}),be+=1,i(` ${H.specifier} → ${A}`)}catch(U){let f=`Error bundling sidecar "${H.specifier}": ${$e(U)}`;o.push(f),console.error(f)}}if(v.size>0){i(`Bundling ${v.size} npm element set(s)...`);for(let[A,H]of v){let U=$t(p,A.replace(/^\//,""));er(yr(U),{recursive:!0});try{await So(`${H.map((f)=>`import ${JSON.stringify(f)};`).join(`
543
+ </script>`}function qF(e,t){try{return xS(e,t),!0}catch{return!1}}async function TE(e,t=Gg,n=!0){let r=[],s=new Set,o=new Map,i=new Map,a=wc(e,"assets"),c=0,l=async(d)=>{if(!i.has(d.specifier))i.set(d.specifier,await SS(d.specifier,t,{target:"browser"}));return i.get(d.specifier)},u=async(d)=>[...IF(d,"utf8").matchAll(/(?:from|import)\s*["']([^"']+)["']/g)].map((m)=>m[1]);for(let d=0;d<OE;d++){let p=0,m=[];try{m=DF(a,{recursive:!0}).map(String).filter((x)=>x.endsWith(".js")).map((x)=>FF(a,x))}catch{return zg(e,o,r,c)}for(let x of m){let g=[];try{g=await u(x)}catch{continue}for(let y of g){let S=mf.find((j)=>y.startsWith(`${j.specifier}/`));if(!S||s.has(y))continue;s.add(y);let E=y.slice(S.specifier.length+1),v=wc(e,`${S.assetDir.replace(/^\//,"")}${E}`);Kg(Sc(v),{recursive:!0});try{await Eo(`export * from ${JSON.stringify(y)};
544
+ `,{outfile:v,resolveDir:t},{minify:n,resolver:WF(S,v,await l(S),o),target:"browser"}),c+=1,p+=1}catch(j){r.push(`Bundling runtime subpath "${y}": ${ge(j)}`)}}}if(p===0)return zg(e,o,r,c)}return r.push(`Runtime subpath resolution did not settle in ${OE} passes — a package subpath `+"graph this deep is more likely a cycle in the scan than a real dependency chain."),zg(e,o,r,c)}function WF(e,t,n,r){return{filter:/.*/,resolve:({importer:s,path:o})=>{if(Tp(s))return;if(mf.find((a)=>o===a.specifier||o.startsWith(`${a.specifier}/`))!==void 0)return{external:!0,path:o};if(n===void 0||!o.startsWith("."))return;if(wc(Sc(s),o)!==n)return;return r.set(wc(Sc(t),o),e.specifier),{external:!0,path:o}}}}function zg(e,t,n,r){let s=r;for(let[o,i]of t){if(JF(o))continue;try{Kg(Sc(o),{recursive:!0}),MF(o,`export * from ${JSON.stringify(i)};
545
+ `,"utf8"),s+=1}catch(a){n.push(`Writing shared core stub ${LF(e,o)}: ${ge(a)}`)}}return{errors:n,written:s}}var mf,Gg,OE=10;var JE=R(()=>{Jp();Yn();le();Rt();mf=[{assetDir:"/assets/@vue/reactivity/",assetPath:"/assets/vue-reactivity.js",fallback:vs,specifier:"@vue/reactivity"},{assetDir:"/assets/lit-html/",assetPath:"/assets/lit-html.js",fallback:Es,specifier:"lit-html"}];Gg=import.meta.dirname});import{copyFileSync as HF,cpSync as Yg,existsSync as Os,mkdirSync as er,mkdtempSync as UF,readFileSync as BF,rmSync as IE,statSync as zF,writeFileSync as Pn}from"node:fs";import{createHash as KF}from"node:crypto";import{tmpdir as GF}from"node:os";import{basename as Zg,dirname as tr,join as br,relative as DE,resolve as gt,sep as XF}from"node:path";async function VE(e,t={}){let{clean:n=!0,includeHeld:r=!1,optimizeImages:s=!0,verbose:o=!1}=t,i=[],a=o?console.log.bind(console):()=>{},c={bundles:0,components:0,content:0,outputs:0,routes:0,setup:0,total:0},l=performance.now(),u=l,d=(f)=>{let h=performance.now();c[f]=h-u,u=h};a("Loading project.json...");let{config:p}=gs(e);if(!s&&p.images.optimize)p.images={...p.images,optimize:!1},console.log("Image optimization is off for this build: images are published as they are.");if("contentTypes"in p)throw Error('project.json declares "contentTypes", which is no longer supported. Run `bun scripts/migrate-project-extensions.ts <project>` to migrate to "extensions" + "content", then `jx schema`.');let m=gt(e,p.build.outDir),x=gt(e,"pages"),g=gt(e,"public"),y=p.build.trailingSlash??"always",S=p.build.minify!==!1,E=new Map,v=new Map,j=new Map,P=(f)=>{let h=f.toSorted(),w=`/assets/elements-${KF("sha1").update(h.join("\x00")).digest("hex").slice(0,12)}.js`;return j.set(w,h),w},O=AE(),T=O.imports,U=new Set,F=Sv(),{errors:H,i18n:A}=qp(p);for(let f of H)i.push(f),console.error(f);for(let f of O.warnings)console.warn(f);let N=new Map,B=(f,h,b)=>{let w=N.get(f);if(w!==void 0&&w.entryPath!==h)throw Error(`"${b}" and "${w.specifier}" both map to ${f} — rename one`);N.set(f,{entryPath:h,specifier:b})},M=new Set,D=(f)=>{if(!M.has(f))M.add(f),i.push(f),console.error(f)},X=(f)=>{let h=xi(f);if(h===null)return D(`$src "${f}" is not a document script specifier`),f;if(h.side==="server")return D(`${h.path}: a client function names "#server". A server module is called by a timing: "server" entry and never imported by a page`),f;try{let b=Fl(`./${h.path}`);return B(b,f,f),E.set(b,{entryPath:f,script:!0,specifier:f}),b}catch(b){return D(`Script of ${h.path}: ${ge(b)}`),f}},re=(f,h)=>{if(uu(f))return X(f);if(yi(f)!==null)return D(`$src "${f}" names its own document's script, but it is not in a document: project.json has no $script. Move the entry into the page, layout or component that carries the script`),f;if(!yS(f))return f;try{let b=Rp(f,h??e,e);if(!go(f)&&!Os(b))return console.warn(`Sidecar "${f}" not found at ${b} — emitting unbundled`),f;let w=go(f)?f:`./${DE(e,b)}`,_=Fl(w);return B(_,b,f),E.set(_,{entryPath:b,specifier:f}),_}catch(b){return i.push(`Sidecar "${f}": ${ge(b)}`),f}},ue=(f)=>{let h=J$(f);try{let b=Rp(`npm:${f}`,e,e);return B(h,b,f),v.set(h,b),h}catch(b){return i.push(`$head specifier "${f}": ${ge(b)}`),f}},xe=await hs(e,p),z=new Map,be=(f,h,b)=>{let w=zu(f,{docDir:h,imports:b,projectRoot:e,registry:xe});if(w===void 0)throw Error(`external class "${f.$prototype}" names no class: give it a $src or an imports entry, or enable the extension that provides "${f.$prototype}"`);if(uv(w.classDef))throw Error(`external class "${f.$prototype}" reads the build's context (#/$context/) and cannot run in a browser: use "timing": "compiler"`);let _=fv(w),W=Fl(`class:${w.exportName}`);return B(W,w.classJsonPath,f.$prototype),z.set(W,_),W},ae=xe.formats,ee=Lv(e,(f)=>Qr(f,ae));if(ae.entries.length>0)a(` Registered ${ae.entries.length} format(s): ${ae.entries.map((f)=>f.name).join(", ")}`);let ot=xe.serverMounts().filter((f)=>{if(!f.project)return!0;let h=p[f.project.key];return I(h)&&Object.keys(h).length>0});if(ot.length>0&&!p.build.adapter){let f=ot.map((h)=>h.project?`"${h.project.key}"`:`"${h.server.basePath}"`).join(", ");throw Error(`project.json declares dynamic section(s) ${f} served by extension mounts, but `+`build.adapter is "static". Dynamic tables need a server-capable adapter — ${ME}`)}if(d("setup"),n&&Os(m))IE(m,{force:!0,recursive:!0});if(er(m,{recursive:!0}),!Os(x))throw Error(`pages/ directory not found in ${e}`);a("Discovering pages...");let Te=await gv(x,ae);a(` Found ${Te.length} page(s)`),a("Loading project sections...");let et=await Nv(e,p,xe,{includeHeld:r}),te=Object.keys(et);if(te.length>0)a(` Loaded ${te.length} section(s): ${te.join(", ")}`);let{errors:tt,mounts:Xe}=await Jv(xe,p,e);i.push(...tt);for(let f of tt)console.error(f);if(Xe.length>0)a(` Mounted ${Xe.length} asset dir(s): ${Xe.map((f)=>f.urlPrefix).join(", ")}`);let xt=new Set,de=await QF(xe,p,e),Be=(await bv(Te,e,et,xe,p,A,{errors:i})).map((f)=>Object.assign(f,{locale:Kn(f.urlPattern,A)}));a(` ${Be.length} route(s) after expansion`);let ce=0;d("content");let Et=[],Jr=new Map,rr=new Map,Ft=new Map,{components:mn,errors:Qs}=await zv({formatRegistry:ae,pageSources:Be.map((f)=>f.sourcePath),projectConfig:p,projectRoot:e});for(let f of Qs)i.push(f),console.error(f);if(mn.length>0){a("Compiling components...");let f=gt(m,"components");er(f,{recursive:!0});let h=new Map(mn.map((K)=>[K.path,K.tagName])),b=yo(p.url),w=cf(b),_=new Map,W=async(K,Y)=>{let V=Y??"",ne=_.get(V);if(ne===void 0){let oe=mc(K,Y===null?{}:{sourcePath:Y},e,{asInitialValues:!0,config:p,registerBundle:(Je)=>{re(Je,null)},registry:xe,sections:et});_.set(V,oe),await oe;return}let fe=await ne;if(K.state)Object.assign(K.state,fe)};for(let{doc:K,path:Y}of mn){let V=Ou(K,p.state);try{await W(V,Y);let ne={formats:ae,prepareDocument:W,resolveClass:(oe,Je,Pt)=>Ie(b,be(oe,Je,Pt)),resolveElementPath:(oe,Je)=>{let Pt=Je?gt(Je,oe):gt(oe),ss=h.get(Pt);return ss?`./${ss}.js`:oe.replace(/\.(?:json|jxn)$/i,".js")},projectRoot:e,projectState:p.state,rewriteSrc:(oe,Je)=>Ie(b,re(oe,Je)),serverBaseUrl:w};if(p.$media)ne.$media=p.$media;let fe=await rf(Y,ne);for(let oe of fe.files){let Je=oe.tagName?`${oe.tagName}.js`:Zg(oe.path);if(!Et.includes(oe.tagName))Pn(gt(f,Je),oe.content,"utf8"),Et.push(oe.tagName),ce+=1}if(V.tagName){rr.set(V.tagName,V),Ft.set(V.tagName,Y);let oe=Ao(V,p.defaults),Je=Hw(V.tagName,V.style,V,p.$media??{},oe);if(Je){if(oe===null)Jr.set(V.tagName,Je);xg(Je,Xe,xt),Pn(gt(f,`${V.tagName}.css`),Je,"utf8"),ce+=1}}}catch(ne){let fe=ge(ne),oe=DE(e,Y).replaceAll("\\","/");i.push(`Error compiling component ${oe}: ${fe}`),console.error(`Error compiling component ${oe}: ${fe}`)}}a(` Compiled ${Et.length} component(s): ${Et.join(", ")}`)}let jt=[];for(let[f,h]of rr)jt.push(...hc(h,Ft.get(f),e));if(p.state){let f=hc({state:p.state},An(e),e);for(let h of f)if(yi(h.src)===null)jt.push(h);else D(`Server function "${h.exportName}" in ${h.declaredIn} names "${h.src}", its own document's script, but project.json has no $script. Move the entry into the page, layout or component that carries the script`)}d("components");let ma=p.images.optimize&&p.images.service==="cloudflare",sr=p.images.optimize&&!ma?V0(e):null,Ed=ma?new Map:null;if(sr&&p.images.formats?.includes("webp"))console.warn('images.formats lists "webp", which this compiler writes losslessly: its files are several times the size of AVIF or JPEG. Keep it only for pixel-exact output; ["avif", "jpeg"] is the default.');if(ma)console.log('images.service is "cloudflare" — srcsets use /cdn-cgi/image transform URLs. '+"Ensure Image Transformations are enabled for your zone (Cloudflare dashboard → "+"Images → Transformations); these URLs do not work on *.pages.dev / *.workers.dev previews.");let or=p.url,ir=yo(or),ns=Boolean(or)&&p.build.sitemap!==!1,rs=[],Lo=Be.filter((f)=>!f.urlPattern.includes(":")&&!f.urlPattern.includes("*")),jd=A===null?new Map:await hv(Lo,ae),Uc=Lo.map((f)=>({translationKey:jd.get(f.urlPattern),urlPattern:f.urlPattern})),en=Yw(Uc,A,or,y),{conflicts:ha,sets:Bc}=ag(Uc,A);for(let f of ha){let[h,b]=f.urlPatterns,w=f.declared?"Give one of them a different $translationKey.":"Move one out of the locale tree, or give it its own $translationKey.",_=`${b} and ${h} are both the "${f.locale}" version of "${f.key}". A translation set names one URL per language, so ${b} is `+`dropped from it — it carries no alternates and no switcher. ${w}`;if(f.declared)i.push(_),console.error(_);else console.warn(_)}let eo=Gw(Be,A);if(eo.length>0)console.warn(`i18n.routing is "prefix-always", but ${eo.length} route(s) sit outside the locale tree and are served as "${A?.defaultLocale}": ${eo.slice(0,10).join(", ")}${eo.length>10?`, and ${eo.length-10} more`:""}. Move them under a locale directory, or use "prefix-except-default".`);if(A!==null&&A.routing==="prefix-always"&&!p.build.adapter&&!Be.some((f)=>f.urlPattern==="/"))console.warn('i18n.routing is "prefix-always" and no page claims "/", so the site root is a 404. '+'Locale negotiation answers "/" only when build.adapter is set — a static deployment has '+`no runtime to read Accept-Language. Add a redirect from "/" to "/${A.defaultLocale.toLowerCase()}/", set build.adapter, or use "prefix-except-default".`);let zc=new Set,Kc=new Set;for(let f of Be){let h=Xw(f.urlPattern,A);if(h&&!zc.has(h.segment))zc.add(h.segment),console.warn(`Routes under /${h.segment}/ are served as "${A?.defaultLocale}" — `+`i18n.locales declares "${h.meant}", not "${h.segment}". Rename the directory to "${h.meant.toLowerCase()}" or declare the shorter tag.`);try{a(` Compiling ${f.urlPattern} ...`);let b=await YF(f,p,e,et,sr,rr,Ed,ae,xe,re,Xe,de,ue,{alternates:en.get(f.urlPattern)??[],i18n:A,translations:Bc.get(f.urlPattern)??[]},T,P,be);jt.push(...b.serverEntries);for(let V of b.unregisteredRelations)if(!Kc.has(V))Kc.add(V),console.warn(`<link rel="${V}"> — "${V}" is not an IANA link relation, and a relation nobody recognizes does nothing. Check the spelling, or use an absolute `+"URI if it is an extension relation (RFC 8288 §2.1.2).");let w=new Set;for(let[V,ne]of rr)if(Hu(ne))w.add(V);if(Et.length>0)b.html=rL(b.html,Et,Jr,w,b.files.map((V)=>V.content).join(`
546
+ `),T);for(let V of RE(b.html))U.add(V);xg(b.html,Xe,xt),wv(b.html,F);let _=BE(f.urlPattern,m,y);er(tr(_),{recursive:!0});let W=!f.urlPattern.includes(":")&&!f.urlPattern.includes("*"),K=!dc(f.urlPattern)&&!Uw(b.html);if(ns&&!b.excludeFromSitemap&&K&&W){let V=en.get(f.urlPattern)??[];rs.push({lastmod:k(f.sourceMtime)&&f.sourceMtime!==""?f.sourceMtime:aL(zF(f.sourcePath).mtime),loc:ys(Ci(f.urlPattern,y),or),...V.length>0&&{alternates:V}})}let Y=[];for(let V of ae.withCapability("serialize")){if(!V.exportTarget||dc(f.urlPattern))continue;try{let ne=await V.call("serialize",b.doc,{buildScope:(fe)=>wi(fe,null),componentDefs:rr,evaluateTemplate:(fe,oe)=>{if(!me(fe))return;return Wt(fe,oe)??fe},mode:"export"});if(ne){let fe=_.replace(/\.html$/,V.extensions[0]);Y.push({content:ne,path:fe,type:V.mediaTypeEssence})}}catch(ne){i.push(`Error exporting ${V.name} for ${f.urlPattern}: ${ge(ne)}`)}}for(let V of Y)if(V.type!==null)b.html=zw(b.html,{href:Kw(m,V.path),type:V.type});Pn(_,F$(b.html,ir),"utf8"),ce+=1;for(let V of Y)Pn(V.path,V.content,"utf8"),ce+=1;for(let V of b.files){let ne=gt(tr(_),V.path);er(tr(ne),{recursive:!0}),Pn(ne,V.content,"utf8"),ce+=1}}catch(b){let w=`Error compiling ${f.urlPattern}: ${ge(b)}`;i.push(w),console.error(w)}}if(d("routes"),sr&&p.images.optimize){q0(e,sr,{prune:i.length===0});let f=W0(sr).filter((b)=>Os(b));if(f.length>0){let b=gt(m,"images/_optimized");er(b,{recursive:!0});for(let w of f)HF(w,gt(b,Zg(w)))}let h=Object.keys(sr.entries).length;if(h>0)a(` Optimized ${h} image(s)`)}let to=[];if(!p.build.adapter&&jt.length>0){let h=`timing: "server" entries ${[...new Set(jt.map(({exportName:b,declaredIn:w})=>`${b} (${w})`))].join(", ")} need a server-capable adapter, but `+`build.adapter is "static": a static deployment has nothing to serve /_jx/server — ${ME}`;i.push(h),console.error(h)}if(p.build.adapter){let{adapter:f}=p.build;a("Generating site-wide server worker...");let{entries:h,errors:b}=Xv(jt);to=h;for(let Y of b)i.push(Y),console.error(Y);let{mounts:w,connectors:_}=ZF(ot,xe,p);if(w.length>0)a(` Mounting ${w.length} extension route(s): ${w.map((Y)=>Y.basePath).join(", ")}`);let K=f==="cloudflare-pages"&&to.length===0&&w.length===0?null:Rg(to,{adapter:f,base:ir,connectors:_,i18n:A,mounts:w});if(K){let Y=f==="cloudflare-pages"?"_worker.js":"worker.js";try{await wS(K,{adapter:f,outfile:gt(m,Y),plugins:[ee.serverPlugin],projectRoot:e}),ce+=1,a(` Generated dist/${Y} (bundled, ${to.length} server function(s))`)}catch(V){let ne=`Error bundling dist/${Y}: ${ge(V)}`;i.push(ne),console.error(ne)}if(f==="cloudflare-pages")Pn(gt(m,"_routes.json"),`${JSON.stringify({exclude:[],include:(A&&A.locales.length>1?["/","/_jx/*"]:["/_jx/*"]).map((V)=>Ie(ir,V)),version:1},null,2)}
547
+ `,"utf8"),ce+=1}}if(U.size>0){a(`Bundling ${U.size} client runtime module(s)...`);let f=await CE({...O,assetPaths:[...U]},m,void 0,S);ce+=f.written;for(let h of f.errors)i.push(h),console.error(h)}if(v.size>0){a(`Copying ${v.size} package asset(s)...`);for(let[f,h]of v){let b=gt(m,f.replace(/^\//,""));er(tr(b),{recursive:!0}),Yg(h,b),ce+=1,a(` ${h} → ${f}`)}}if(E.size>0){a(`Bundling ${E.size} client sidecar module(s)...`);for(let[f,h]of E)try{let b=gt(m,f.replace(/^\//,""));er(tr(b),{recursive:!0});let w={entryPath:h.entryPath,outfile:b};if(h.script){let _=await ee.module(h.specifier);w.entryPath=_.path,w.contents=_.contents}await bS(w,{external:Cp,minify:S,plugins:[ee.clientPlugin],target:"browser"}),ce+=1,a(` ${h.specifier} → ${f}`)}catch(b){let w=`Error bundling sidecar "${h.specifier}": ${ge(b)}`;i.push(w),console.error(w)}}if(z.size>0){a(`Bundling ${z.size} external class module(s)...`);let f=UF(br(GF(),"jx-class-entries-"));try{let h=[...z].map(([w,_])=>{let W=br(f,Zg(w));return Pn(W,_,"utf8"),W}),b=await $S(h,gt(m,"assets"),{external:Cp,minify:S,target:"browser"});ce+=b.length;for(let w of z.keys())a(` ${w}`)}catch(h){let b=`Error bundling external classes: ${ge(h)}`;i.push(b),console.error(b)}finally{IE(f,{force:!0,recursive:!0})}}if(j.size>0){a(`Bundling ${j.size} npm element set(s)...`);for(let[f,h]of j){let b=gt(m,f.replace(/^\//,""));er(tr(b),{recursive:!0});try{await Eo(`${h.map((w)=>`import ${JSON.stringify(w)};`).join(`
551
548
  `)}
552
- `,{outfile:U,resolveDir:e},{minify:g,target:"browser"}),be+=1,i(` ${H.length} element(s) → ${A}`)}catch(f){let y=`Error bundling npm $elements [${H.join(", ")}]: ${$e(f)}`;o.push(y),console.error(y)}}}if(N.size>0){let A=await cv(p,void 0,g);if(A.written>0)i(`Bundling ${A.written} runtime subpath module(s)...`);be+=A.written;for(let H of A.errors)o.push(H),console.error(H)}for(let A of se.emitters()){let H=A.project?.key,U=H?d[H]:void 0;if(H&&(U==null||D(U)&&Object.keys(U).length===0))continue;try{let f=await A.call("emit",U??null,{projectConfig:d,root:e,routes:ce,sections:ee});for(let y of f??[]){let w=$t(p,y.path.replace(/^\//,""));if(!w.startsWith(p+vD))throw Error(`emit path escapes outDir: ${y.path}`);er(yr(w),{recursive:!0}),In(w,y.content),be+=1,i(` ${A.name} emitted ${y.path}`)}}catch(f){let y=`Error in ${A.name}.emit: ${$e(f)}`;o.push(y),console.error(y)}}if(u("bundles"),d.redirects&&Object.keys(d.redirects).length>0){i("Generating redirects...");let A=new Set(ce.map((U)=>U.urlPattern)),H=ND(d.redirects,p,{basePath:rr,compiledUrls:A,trailingSlash:d.build.trailingSlash});be+=H.files,o.push(...H.errors)}if(ya)i(`Generating sitemap (${Ys.length} URL(s))...`),be+=ID(Ys,p);else if(!ns&&d.build.sitemap!==!1)console.warn("sitemap.xml skipped — set `url` in project.json to enable sitemap generation.");if(X.size>0){let{copied:A,missing:H}=uw(X,Ge,p);be+=A,i(`Copying ${A} mounted asset(s)...`);for(let U of H)console.warn(`Referenced asset not found: ${U}`)}if(js(x))i("Copying public/ assets..."),Iu(x,p,{recursive:!0});if(ya)be+=MD(p,ns);{let A=[ZS(d),ev(d,new Date)];for(let f of A){for(let y of f.errors)o.push(y),console.error(y);for(let y of f.warnings)console.warn(y)}let{skipped:H,written:U}=tv(A.flatMap((f)=>f.files),p,js);be+=U;for(let f of H)i(` ${f} — kept the copy from public/`)}{let A=Dm(d.serviceWorker);if(A!==null){let H=A===!1?GS():KS(A,p,rr);for(let U of H.warnings)console.warn(U);for(let U of H.errors)o.push(U),console.error(U);if(H.path!==null)In(Ps(p,H.path),H.source,"utf8"),be+=1,i(A===!1?" sw.js — tombstone (unregisters and clears)":" sw.js")}}{let{errors:A,rules:H}=tw(d.build,F);o.push(...A);let U=rw([...H,...nw(p)],rr);if(U.length>0){i("Writing response headers..."),be+=sw(p,U);let{adapter:f,deploy:y}=d.build;if(f==="node"||f==="bun")console.warn(`The "${f}" adapter serves no static assets, so dist/_headers is documentation `+"rather than configuration — apply these headers at the reverse proxy in front of it.");else if(f===void 0&&y===void 0)if(js($t(x,"CNAME")))console.warn("GitHub Pages ignores dist/_headers and serves its own Cache-Control: max-age=600, so the generated caching and security rules will not take effect. Deploy behind a host that reads _headers (Cloudflare Pages, Cloudflare Workers assets, Netlify) to apply them.");else i(" note: _headers is read by Cloudflare Pages, Cloudflare Workers assets and Netlify; other static hosts ignore it and serve their own Cache-Control.")}be+=ow(p)}if(d.copy){i("Copying mapped files...");for(let[A,H]of Object.entries(d.copy)){if(!k(H))throw TypeError(`project.json copy["${A}"] must be a destination path string`);let U=$t(e,A),f=$t(p,H);er(yr(f),{recursive:!0}),Iu(U,f)}}if(i(`
553
- Build complete: ${ce.length} routes, ${be} files`),o.length>0)i(` ${o.length} error(s)`);return u("outputs"),a.total=performance.now()-c,{errors:o,files:be,routes:ce.length,serverEntries:Qs,timings:a}}async function ED(e,t,n,r,s,o,i,a,c,l,u,d,p,m,x,h){let g=ho(t.url),b=Ti(await Qr(e.sourcePath,a),e.sourcePath,n),j=await bw(b,t,n),v=Eu(b,t,n),P=[...oc(b,e.sourcePath,n),...v.flatMap((ce)=>oc(ce.doc,ce.path,n))],S=Pw(b.$head??j._pageHead??[],b.description),_=j.$head??[],N=b.title??j._pageTitle??null;delete j._pageHead,delete j._pageTitle;let F=new Set(Object.keys(j.state??{}));L$(j,t,e,n,m.i18n,m.translations);let K=Object.keys(t.state??{}).filter((ce)=>ce!=="$site"&&ce!=="$page"&&!F.has(ce)),J=M$({defaults:t.defaults,pageDir:k(b.$dir)?b.$dir:void 0,pageLang:k(b.$lang)?b.$lang:void 0,routeLocale:Xn(e.urlPattern,m.i18n)}),C={...j.state};if(e.pagedState&&j.state&&e.pagedState.key in j.state)j.state[e.pagedState.key]=e.pagedState.items;await xu(j,e,n,{config:t,registerBundle:(ce)=>{l(ce,null)},registry:c,sections:r});let L=kD(C,j.state??{},e.pagedState?.key),G=ji(j.state??{}),te=N??t.name;if(me(te))te=Vt(te,G)??te;let de=Wm(dv(S,G),p),ae=Wm(dv(_,G),p);mc(j,G,L);let ne={counter:{n:0},media:{...t.$media,...j.$media},rules:[]},se={n:0};if(Km(j,o,ne,t.defaults,se),j.state){let ce=new Set,be=new Set(K);for(let[Le,ot]of Object.entries(j.state)){if(Le==="$site"||Le==="$page")continue;if(V(ot)&&ot.timing==="compiler")delete j.state[Le];else if(Array.isArray(ot))ce.add(Le);else if(Po(ot))ce.add(Le),be.add(Le)}for(let Le of K)if(Le in j.state)ce.add(Le);let Fe=!0;while(Fe){Fe=!1;let Le={...j.state};delete Le.$site,delete Le.$page;for(let It of ce)delete Le[It];let{$head:ot,$paths:Nr,title:nr,...Xs}=j,pt={...Xs,state:Le};if(v$(pt).length>0){for(let It of be)if(ce.delete(It))Fe=!0}let Pn=JSON.stringify(pt);for(let It of ce)if(su(Pn,It))ce.delete(It),Fe=!0}for(let Le of ce)delete j.state[Le]}let xe=Dm(t.serviceWorker),z=xe===null||xe===!1?[]:[{tagName:"script",textContent:XS(xe.scope??"/",g)}],ye=[...QS(t),...z,...d,...Wm(t.$head??[],p)],pe=_w(ye,ae,de,{title:te,charset:t.defaults.charset??"utf8",siteName:t.name,siteUrl:t.url,...m.alternates.length>0&&{alternates:m.alternates},...!sc(e.urlPattern)&&{pageUrl:Ni(e.urlPattern,t.build.trailingSlash)}});if(t.$media)j.$media={...t.$media,...j.$media};if(Object.values(j.$media??{}).some((ce)=>Zn(String(ce))!==null))pe.splice(2,0,{tagName:"script",textContent:Oi()});let ee=t.images;await qS(j,ee,n,s,i??void 0,u);let Qe={lang:J.lang,prePaintScheme:!1,projectStyle:t.style??null,rewriteSrc:(ce)=>We(g,l(ce,yr(e.sourcePath))),serverBaseUrl:Ou(g),title:te},Me=x["@vue/reactivity"];if(Me!==void 0)Qe.reactivitySrc=Me;let Ge=x["lit-html"];if(Ge!==void 0)Qe.litHtmlSrc=Ge;let X=await km(j,Qe);if(ne.rules.length>0)X.html=X.html.replace("</head>",`<style>
554
- ${du(ne.rules.join(`
549
+ `,{outfile:b,resolveDir:e},{minify:S,target:"browser"}),ce+=1,a(` ${h.length} element(s) → ${f}`)}catch(w){let _=`Error bundling npm $elements [${h.join(", ")}]: ${ge(w)}`;i.push(_),console.error(_)}}}if(U.size>0){let f=await TE(m,void 0,S);if(f.written>0)a(`Bundling ${f.written} runtime subpath module(s)...`);ce+=f.written;for(let h of f.errors)i.push(h),console.error(h)}for(let f of xe.emitters()){let h=f.project?.key,b=h?p[h]:void 0;if(h&&(b==null||I(b)&&Object.keys(b).length===0))continue;try{let w=await f.call("emit",b??null,{projectConfig:p,root:e,routes:Be,sections:et});for(let _ of w??[]){let W=gt(m,_.path.replace(/^\//,""));if(!W.startsWith(m+XF))throw Error(`emit path escapes outDir: ${_.path}`);er(tr(W),{recursive:!0}),Pn(W,_.content),ce+=1,a(` ${f.name} emitted ${_.path}`)}}catch(w){let _=`Error in ${f.name}.emit: ${ge(w)}`;i.push(_),console.error(_)}}if(d("bundles"),p.redirects&&Object.keys(p.redirects).length>0){a("Generating redirects...");let f=new Set(Be.map((b)=>b.urlPattern)),h=iL(p.redirects,m,{basePath:ir,compiledUrls:f,trailingSlash:p.build.trailingSlash});ce+=h.files,i.push(...h.errors)}if(ns)a(`Generating sitemap (${rs.length} URL(s))...`),ce+=lL(rs,m);else if(!or&&p.build.sitemap!==!1)console.warn("sitemap.xml skipped — set `url` in project.json to enable sitemap generation.");if(xt.size>0){let{copied:f,missing:h}=Iv(xt,Xe,m);ce+=f,a(`Copying ${f} mounted asset(s)...`);for(let b of h)console.warn(`Referenced asset not found: ${b}`)}if(Os(g))a("Copying public/ assets..."),Yg(g,m,{recursive:!0});if(ns)ce+=uL(m,or);{let f=[EE(p),PE(p,new Date)];for(let w of f){for(let _ of w.errors)i.push(_),console.error(_);for(let _ of w.warnings)console.warn(_)}let{skipped:h,written:b}=_E(f.flatMap((w)=>w.files),m,Os);ce+=b;for(let w of h)a(` ${w} — kept the copy from public/`)}{let f=Bg(p.serviceWorker);if(f!==null){let h=f===!1?SE():$E(f,m,ir);for(let b of h.warnings)console.warn(b);for(let b of h.errors)i.push(b),console.error(b);if(h.path!==null)Pn(br(m,h.path),h.source,"utf8"),ce+=1,a(f===!1?" sw.js — tombstone (unregisters and clears)":" sw.js")}}{let{errors:f,rules:h}=_v(p.build,F);i.push(...f);let b=Ov([...h,...kv(m)],ir);if(b.length>0){a("Writing response headers..."),ce+=Av(m,b);let{adapter:w,deploy:_}=p.build;if(w==="node"||w==="bun")console.warn(`The "${w}" adapter serves no static assets, so dist/_headers is documentation `+"rather than configuration — apply these headers at the reverse proxy in front of it.");else if(w===void 0&&_===void 0)if(Os(gt(g,"CNAME")))console.warn("GitHub Pages ignores dist/_headers and serves its own Cache-Control: max-age=600, so the generated caching and security rules will not take effect. Deploy behind a host that reads _headers (Cloudflare Pages, Cloudflare Workers assets, Netlify) to apply them.");else a(" note: _headers is read by Cloudflare Pages, Cloudflare Workers assets and Netlify; other static hosts ignore it and serve their own Cache-Control.")}ce+=Cv(m)}if(p.copy){a("Copying mapped files...");for(let[f,h]of Object.entries(p.copy)){if(!k(h))throw TypeError(`project.json copy["${f}"] must be a destination path string`);let b=gt(e,f),w=gt(m,h);er(tr(w),{recursive:!0}),Yg(b,w)}}if(a(`
550
+ Build complete: ${Be.length} routes, ${ce} files`),i.length>0)a(` ${i.length} error(s)`);return d("outputs"),c.total=performance.now()-l,{errors:i,files:ce,routes:Be.length,serverEntries:to,timings:c}}async function YF(e,t,n,r,s,o,i,a,c,l,u,d,p,m,x,g,y){let S=yo(t.url),E=Ri(await Qr(e.sourcePath,a),e.sourcePath,n),v=await Uv(E,t,n),j=Qu(E,t,n),P=[...hc(E,e.sourcePath,n),...j.flatMap((de)=>hc(de.doc,de.path,n))],O=Zv(E.$head??v._pageHead??[],E.description),T=v.$head??[],U=E.title??v._pageTitle??null;delete v._pageHead,delete v._pageTitle;let F=new Set(Object.keys(v.state??{}));tv(v,t,e,n,m.i18n,m.translations);let H=Object.keys(t.state??{}).filter((de)=>de!=="$site"&&de!=="$page"&&!F.has(de)),A=Zw({defaults:t.defaults,pageDir:k(E.$dir)?E.$dir:void 0,pageLang:k(E.$lang)?E.$lang:void 0,routeLocale:Kn(e.urlPattern,m.i18n)}),N={...v.state};if(e.pagedState&&v.state&&e.pagedState.key in v.state)v.state[e.pagedState.key]=e.pagedState.items;await mc(v,e,n,{config:t,registerBundle:(de)=>{l(de,null)},registry:c,sections:r});let B=tL(N,v.state??{},e.pagedState?.key),M=wi(v.state??{}),D=U??t.name;if(me(D))D=Wt(D,M)??D;let X=Qg(FE(O,M),p),re=Qg(FE(T,M),p);Ec(v,M,B);let ue={counter:{n:0},media:{...t.$media,...v.$media},rules:[]},xe={n:0};if(sy(v,o,ue,t.defaults,xe),v.state){let de=new Set,dt=new Set(H);for(let[ce,Et]of Object.entries(v.state)){if(ce==="$site"||ce==="$page")continue;if(L(Et)&&Et.timing==="compiler")delete v.state[ce];else if(Array.isArray(Et))de.add(ce);else if(ko(Et))de.add(ce),dt.add(ce)}for(let ce of H)if(ce in v.state)de.add(ce);let Be=!0;while(Be){Be=!1;let ce={...v.state};delete ce.$site,delete ce.$page;for(let jt of de)delete ce[jt];let{$head:Et,$paths:Jr,title:rr,...Ft}=v,mn={...Ft,state:ce};if(Mw(mn).length>0){for(let jt of dt)if(de.delete(jt))Be=!0}let Qs=JSON.stringify(mn);for(let jt of de)if(ku(Qs,jt))de.delete(jt),Be=!0}for(let ce of de)delete v.state[ce]}let z=Bg(t.serviceWorker),be=z===null||z===!1?[]:[{tagName:"script",textContent:wE(z.scope??"/",S)}],ae=[...jE(t),...be,...d,...Qg(t.$head??[],p)],ee=Qv(ae,re,X,{title:D,charset:t.defaults.charset??"utf8",siteName:t.name,siteUrl:t.url,...m.alternates.length>0&&{alternates:m.alternates},...!dc(e.urlPattern)&&{pageUrl:Ci(e.urlPattern,t.build.trailingSlash)}});if(t.$media)v.$media={...t.$media,...v.$media};if(Object.values(v.$media??{}).some((de)=>Xn(String(de))!==null))ee.splice(2,0,{tagName:"script",textContent:Pi()});let ot=t.images;await mE(v,ot,n,s,i??void 0,u);let Te={lang:A.lang,prePaintScheme:!1,projectStyle:t.style??null,resolveClass:(de)=>Ie(S,y(de,tr(e.sourcePath),v.imports??{})),rewriteSrc:(de)=>Ie(S,l(de,tr(e.sourcePath))),serverBaseUrl:cf(S),title:D},et=x["@vue/reactivity"];if(et!==void 0)Te.reactivitySrc=et;let te=x["lit-html"];if(te!==void 0)Te.litHtmlSrc=te;let tt=await Tg(v,Te);if(ue.rules.length>0)tt.html=tt.html.replace("</head>",`<style>
551
+ ${Lu(ue.rules.join(`
555
552
  `))}
556
553
  </style>
557
- </head>`);X.html=CD(X.html,pe,J);let Bt=(ce)=>typeof ce==="string"&&!ce.startsWith("./")&&!ce.startsWith("../"),Et=[...new Set([...j.$elements??[],...v.flatMap((ce)=>ce.doc.$elements??[]),...b.$elements??[]].filter((ce)=>Bt(ce)))];if(Et.length>0)X.html=RD(X.html,h(Et));return{doc:j,excludeFromSitemap:b.$sitemap===!1,files:X.files,html:X.html,unregisteredRelations:Aw(pe),serverEntries:P}}function jD(e,t,n){if(e.length===0)return{connectors:[],mounts:[]};let r=ho(n.url),s={};for(let c of t.projectContributions()){let{key:l}=c.project;if(l in n)s[l]=n[l]}let o=e.map((c)=>{let l=c.server,{module:u}=l;if(!k(u)||u==="")throw Error(`Extension class "${c.name}": server.module (a bare import specifier) is required to generate a deployable worker`);let d=We(r,l.basePath);return{basePath:d,className:c.classDef.title??c.name,module:u,options:{basePath:d,sections:s},order:l.order??100}}),i=new Set;for(let c of Object.values(s)){if(!V(c))continue;for(let l of Object.values(c)){let u=V(l)?l.provider:void 0;if(k(u))i.add(u)}}let a=[];for(let c of t.connectors()){let l=String(c.connector.provider);if(!i.has(l))continue;let{module:u}=c.connector;if(!k(u)||u==="")throw Error(`Connector class "${c.name}": connector.module (a bare import specifier) is required to generate a deployable worker`);a.push({className:c.classDef.title??c.name,module:u,provider:l})}return{connectors:a,mounts:o}}async function PD(e,t,n){let r=[];for(let s of e.headProviders()){let o=s.project?.key,i=o===void 0?null:t[o];if(o!==void 0&&(i===void 0||i===null))continue;try{let a=await s.call("head",i??null,{projectConfig:t,root:n});r.push(...a??[])}catch(a){console.warn(`${s.name} head capability failed: ${$e(a)}`)}}return r}function zm(e,t){if(Array.isArray(e))return e.map((n)=>zm(n,t));if(V(e))return Object.fromEntries(Object.entries(e).map(([n,r])=>[n,zm(r,t)]));if(me(e))return Vt(e,t)??e;return e}function dv(e,t){return e.map((n)=>{if(!D(n))return n;let r={...n};if(r.attributes){r.attributes={...r.attributes};for(let[s,o]of Object.entries(r.attributes))if(me(o))r.attributes[s]=Vt(o,t)??o}if(me(r.textContent))r.textContent=Vt(r.textContent,t)??r.textContent;else if(D(r.textContent))r.textContent=zm(r.textContent,t);return r})}function Wm(e,t){return e.map((n)=>{if(!D(n)||!n.attributes)return n;let r={...n,attributes:{...n.attributes}};for(let s of["href","src"]){let o=r.attributes[s];if(k(o)&&_D(o))r.attributes[s]=t(o)}return r})}function _D(e){return!e.startsWith("/")&&!e.startsWith("./")&&!e.startsWith("../")&&!e.startsWith("http")&&!e.startsWith("data:")}function hv(e){return bv(e).replaceAll("${","&#36;{")}function gv(e){return e.replaceAll("${","$​{")}function yv(e,t){if(!D(e))return e;let n={};for(let[r,s]of Object.entries(e))if(r==="children"&&Array.isArray(e.children))n.children=e.children.map((o)=>{if(k(o))return o;return yv(o,t)});else if(r==="style"&&D(e.style)){let o={...e.style};for(let[i,a]of Object.entries(o))if(me(a))o[i]=Mu(a,t)??a;n.style=o}else if(r==="attributes"&&D(e.attributes)){let o={...e.attributes};for(let[i,a]of Object.entries(o))if(me(a)){let c=Mu(a,t);o[i]=k(c)&&c.includes("${")?gv(c):c??a}n.attributes=o}else if(r==="$props"&&D(e.$props)){let o={...e.$props};for(let[i,a]of Object.entries(o))if(me(a)){let c=Mu(a,t);o[i]=c!==null?c??null:a}n.$props=o}else if(me(s)){let o=Mu(s,t);if(r==="textContent"&&k(o)&&o.includes("${"))n.innerHTML=hv(o);else n[r]=o??s}else n[r]=s;return n}function Mu(e,t){try{let n=t.$map,r=D(n)&&"item"in n?n.item:void 0,s=D(n)&&"index"in n?n.index:void 0,o=vi(e)?`return (${e.slice(2,-1)})`:`return \`${e}\``;return Function("state","$map","item","index",o)(t,n,r,s)}catch{return null}}function mc(e,t,n){if(!D(e))return;if(me(e.innerHTML)){let o=Vt(e.innerHTML,t);if(o!=null)e.innerHTML=String(o).replaceAll("${","&#36;{")}let r=e.textContent;if(me(r)){let o=Vt(r,t);if(k(o)&&o.includes("${"))e.innerHTML=hv(o),delete e.textContent;else e.textContent=o??r}if(D(e.style)){for(let[o,i]of Object.entries(e.style))if(me(i))e.style[o]=Vt(i,t)??i}if(D(e.attributes)){for(let[o,i]of Object.entries(e.attributes))if(me(i)){let a=Vt(i,t);e.attributes[o]=k(a)&&a.includes("${")?gv(a):a??i}}if(D(e.$props)){let o=e.$props;for(let[i,a]of Object.entries(o))if(me(a))o[i]=Vt(a,t)??a}let s=e.children;if(at(s)){let o=pv(s,t,n);if(o){e.children=o;return}}if(me(s)){let o=Vt(s,t);if(Array.isArray(o)){let i=o;e.children=i;for(let a of i)mc(a,t,n)}}else if(Array.isArray(e.children)){let o=0;while(o<e.children.length){let i=e.children[o];if(me(i)){let a=Vt(i,t);if(Array.isArray(a)){let c=a;e.children.splice(o,1,...c);for(let l of c)mc(l,t,n);o+=c.length;continue}}if(at(i)){let a=pv(i,t,n);if(a){e.children.splice(o,1,...a),o+=a.length;continue}}mc(i,t,n),o+=1}}}function kD(e,t,n){let r=new Set(["$site","$page"]);if(n!==void 0)r.add(n);for(let[s,o]of Object.entries(e))if(_n(o)&&(o.timing===void 0||o.timing==="compiler")&&t[s]!==o)r.add(s);return r}function OD(e,t,n){if(!Ne(e))return!0;let r=e.$ref;if(r.startsWith("$map/"))return!0;let[s=""]=r.slice(8).split("/"),o=s.replaceAll("~1","/").replaceAll("~0","~");return r.startsWith("#/state/")&&n.has(o)&&!x$(t,o)}function pv(e,t,n){let r=e.items,s=Ne(r)?Hp(r.$ref,t):r,o=e.map;if(!Array.isArray(s)||!o)return null;if(s.length===0&&!OD(r,t,n))return null;return s.map((a,c)=>{let l=Object.create(t);l.$map={index:c,item:a},l["$map/item"]=a,l["$map/index"]=c;let u=yv(o,l);return mc(u,l,n),u})}function Km(e,t,n,r,s){if(!D(e))return;if(Array.isArray(e)){for(let a of e)Km(a,t,n,r,s);return}if(Array.isArray(e.children))for(let a of e.children)Km(a,t,n,r,s);let{tagName:o}=e;if(!k(o))return;let i=t.get(o);if(i){if(e.attributes){let{lifted:b,rest:j}=Zp(e.attributes);if(b)e.attributes=j,e.$props={...b,...e.$props}}let a=(b)=>{if(n&&D(b)&&!Array.isArray(b))bs(b,n.rules,n.media,"",n.counter,"jxs");return Pi(b,{},null)},c=ko(i,r),l=e.$props||null,u={componentDefs:t,defaults:r,path:[{key:JSON.stringify(l??{}),tag:o}],slotIds:s},d=hu(i),{children:p}=e,m=!c&&!d&&xs(i.children)?Xp(u):null,x=c?(Array.isArray(p)?p:[]).map((b)=>a(b)).join(`
558
- `):null,h=k$(i,l,c?null:Yp(p,{},a,m),u);if(m!==null)e.attributes={...e.attributes,[Qa]:String(m)};e.innerHTML=c?`<template shadowrootmode="${c}"><link rel="stylesheet" href="/components/${o}.css">${h}</template>${x??""}`:h,delete e.children;let g=Qp(i.style,mu(i,l));if(Object.keys(g).length>0)e.style={...e.style,...g};if(!d&&e.$props&&Object.keys(e.$props).length>0)e.attributes={...e.attributes,"data-jx-props":JSON.stringify(e.$props)};if(delete e.$props,d)e.$static=!0;else e.$prerendered=!0}}function AD(e,t,n=new Map,r=new Set,s="",o={}){let i=(v)=>e.includes(`<${v}`),a=(v)=>s.includes(`<${v}`),c=t.filter((v)=>i(v)||a(v));if(c.length===0)return e;let l=c.flatMap((v)=>{let P=n.get(v);return P===void 0||P===""?[]:[P]}).join(`
554
+ </head>`);tt.html=oL(tt.html,ee,A);let Xe=(de)=>typeof de==="string"&&!de.startsWith("./")&&!de.startsWith("../"),xt=[...new Set([...v.$elements??[],...j.flatMap((de)=>de.doc.$elements??[]),...E.$elements??[]].filter((de)=>Xe(de)))];if(xt.length>0)tt.html=sL(tt.html,g(xt));return{doc:v,excludeFromSitemap:E.$sitemap===!1,files:tt.files,html:tt.html,unregisteredRelations:n0(ee),serverEntries:P}}function ZF(e,t,n){if(e.length===0)return{connectors:[],mounts:[]};let r=yo(n.url),s={};for(let c of t.projectContributions()){let{key:l}=c.project;if(l in n)s[l]=n[l]}let o=e.map((c)=>{let l=c.server,{module:u}=l;if(!k(u)||u==="")throw Error(`Extension class "${c.name}": server.module (a bare import specifier) is required to generate a deployable worker`);let d=Ie(r,l.basePath);return{basePath:d,className:c.classDef.title??c.name,module:u,options:{basePath:d,sections:s},order:l.order??100}}),i=new Set;for(let c of Object.values(s)){if(!L(c))continue;for(let l of Object.values(c)){let u=L(l)?l.provider:void 0;if(k(u))i.add(u)}}let a=[];for(let c of t.connectors()){let l=String(c.connector.provider);if(!i.has(l))continue;let{module:u}=c.connector;if(!k(u)||u==="")throw Error(`Connector class "${c.name}": connector.module (a bare import specifier) is required to generate a deployable worker`);a.push({className:c.classDef.title??c.name,module:u,provider:l})}return{connectors:a,mounts:o}}async function QF(e,t,n){let r=[];for(let s of e.headProviders()){let o=s.project?.key,i=o===void 0?null:t[o];if(o!==void 0&&(i===void 0||i===null))continue;try{let a=await s.call("head",i??null,{projectConfig:t,root:n});r.push(...a??[])}catch(a){console.warn(`${s.name} head capability failed: ${ge(a)}`)}}return r}function ry(e,t){if(Array.isArray(e))return e.map((n)=>ry(n,t));if(L(e))return Object.fromEntries(Object.entries(e).map(([n,r])=>[n,ry(r,t)]));if(me(e))return Wt(e,t)??e;return e}function FE(e,t){return e.map((n)=>{if(!I(n))return n;let r={...n};if(r.attributes){r.attributes={...r.attributes};for(let[s,o]of Object.entries(r.attributes))if(me(o))r.attributes[s]=Wt(o,t)??o}if(me(r.textContent))r.textContent=Wt(r.textContent,t)??r.textContent;else if(I(r.textContent))r.textContent=ry(r.textContent,t);return r})}function Qg(e,t){return e.map((n)=>{if(!I(n)||!n.attributes)return n;let r={...n,attributes:{...n.attributes}};for(let s of["href","src"]){let o=r.attributes[s];if(k(o)&&eL(o))r.attributes[s]=t(o)}return r})}function eL(e){return!e.startsWith("/")&&!e.startsWith("./")&&!e.startsWith("../")&&!e.startsWith("http")&&!e.startsWith("data:")}function qE(e){return zE(e).replaceAll("${","&#36;{")}function WE(e){return e.replaceAll("${","$​{")}function HE(e){return k(e)||We(e)||bt(e)?String(e):null}function UE(e,t){if(!I(e))return e;let n={};for(let[r,s]of Object.entries(e))if(r==="children"&&Array.isArray(e.children))n.children=e.children.map((o)=>{if(k(o))return me(o)?HE(vc(o,t))??o:o;return UE(o,t)});else if(r==="style"&&I(e.style)){let o={...e.style};for(let[i,a]of Object.entries(o))if(me(a))o[i]=vc(a,t)??a;n.style=o}else if(r==="attributes"&&I(e.attributes)){let o={...e.attributes};for(let[i,a]of Object.entries(o))if(me(a)){let c=vc(a,t);o[i]=k(c)&&c.includes("${")?WE(c):c??a}n.attributes=o}else if(r==="$props"&&I(e.$props)){let o={...e.$props};for(let[i,a]of Object.entries(o))if(me(a)){let c=vc(a,t);o[i]=c!==null?c??null:a}n.$props=o}else if(me(s)){let o=vc(s,t);if(r==="textContent"&&k(o)&&o.includes("${"))n.innerHTML=qE(o);else n[r]=o??s}else n[r]=s;return n}function vc(e,t){try{let n=t.$map,r=I(n)&&"item"in n?n.item:void 0,s=I(n)&&"index"in n?n.index:void 0,o=$i(e)?`return (${e.slice(2,-1)})`:`return \`${e}\``;return Function("state","$map","item","index",o)(t,n,r,s)}catch{return null}}function Ec(e,t,n){if(!I(e))return;if(me(e.innerHTML)){let o=Wt(e.innerHTML,t);if(o!=null)e.innerHTML=String(o).replaceAll("${","&#36;{")}let r=e.textContent;if(me(r)){let o=Wt(r,t);if(k(o)&&o.includes("${"))e.innerHTML=qE(o),delete e.textContent;else e.textContent=o??r}if(I(e.style)){for(let[o,i]of Object.entries(e.style))if(me(i))e.style[o]=Wt(i,t)??i}if(I(e.attributes)){for(let[o,i]of Object.entries(e.attributes))if(me(i)){let a=Wt(i,t);e.attributes[o]=k(a)&&a.includes("${")?WE(a):a??i}}if(I(e.$props)){let o=e.$props;for(let[i,a]of Object.entries(o))if(me(a))o[i]=Wt(a,t)??a}let s=e.children;if(nt(s)){let o=LE(s,t,n);if(o){e.children=o;return}}if(me(s)){let o=Wt(s,t);if(Array.isArray(o)){let i=o;e.children=i;for(let a of i)Ec(a,t,n)}}else if(Array.isArray(e.children)){let o=0;while(o<e.children.length){let i=e.children[o];if(me(i)){let a=Wt(i,t);if(Array.isArray(a)){let l=a;e.children.splice(o,1,...l);for(let u of l)Ec(u,t,n);o+=l.length;continue}let c=HE(a);if(c!==null){e.children[o]=c,o+=1;continue}}if(nt(i)){let a=LE(i,t,n);if(a){e.children.splice(o,1,...a),o+=a.length;continue}}Ec(i,t,n),o+=1}}}function tL(e,t,n){let r=new Set(["$site","$page"]);if(n!==void 0)r.add(n);for(let[s,o]of Object.entries(e))if(yn(o)&&(o.timing===void 0||o.timing==="compiler")&&t[s]!==o)r.add(s);return r}function nL(e,t,n){if(!Ce(e))return!0;let r=e.$ref;if(r.startsWith("$map/"))return!0;let[s=""]=r.slice(8).split("/"),o=s.replaceAll("~1","/").replaceAll("~0","~");return r.startsWith("#/state/")&&n.has(o)&&!jw(t,o)}function LE(e,t,n){let r=e.items,s=Ce(r)?Uh(r.$ref,t):r,o=e.map;if(!Array.isArray(s)||!o)return null;if(s.length===0&&!nL(r,t,n))return null;return s.map((a,c)=>{let l=Object.create(t);l.$map={index:c,item:a},l["$map/item"]=a,l["$map/index"]=c;let u=UE(o,l);return Ec(u,l,n),u})}function sy(e,t,n,r,s){if(!I(e))return;if(Array.isArray(e)){for(let a of e)sy(a,t,n,r,s);return}if(Array.isArray(e.children))for(let a of e.children)sy(a,t,n,r,s);let{tagName:o}=e;if(!k(o))return;let i=t.get(o);if(i){if(e.attributes){let{lifted:E,rest:v}=rg(e.attributes);if(E)e.attributes=v,e.$props={...E,...e.$props}}let a=(E)=>{if(n&&I(E)&&!Array.isArray(E))qu(E,n.rules,n.media,"",n.counter,"jxs");return vi(E,{},null)},c=Ao(i,r),l=sg(i,e.attributes,{}),u=l?{...l,...e.$props}:e.$props||null,d={componentDefs:t,defaults:r,path:[{key:JSON.stringify(u??{}),tag:o}],slotIds:s},p=Hu(i),{children:m}=e,x=!c&&!p&&ws(i.children)?tg(d):null,g=c?(Array.isArray(m)?m:[]).map((E)=>a(E)).join(`
555
+ `):null,y=Ww(i,u,c?null:ng(m,{},a,x),d);if(x!==null)e.attributes={...e.attributes,[Ya]:String(x)};e.innerHTML=c?`<template shadowrootmode="${c}"><link rel="stylesheet" href="/components/${o}.css">${y}</template>${g??""}`:y,delete e.children;let S=og(i.style,fc(i,u));if(Object.keys(S).length>0)e.style={...e.style,...S};if(!p&&e.$props&&Object.keys(e.$props).length>0)e.attributes={...e.attributes,"data-jx-props":JSON.stringify(e.$props)};if(delete e.$props,p)e.$static=!0;else e.$prerendered=!0}}function rL(e,t,n=new Map,r=new Set,s="",o={}){let i=(v)=>e.includes(`<${v}`),a=(v)=>s.includes(`<${v}`),c=t.filter((v)=>i(v)||a(v));if(c.length===0)return e;let l=c.flatMap((v)=>{let j=n.get(v);return j===void 0||j===""?[]:[j]}).join(`
559
556
  `),u=l===""?"":`<style>
560
- ${du(l)}
561
- </style>`,d=(v)=>{let P=v.filter(Boolean).join(`
562
- `);return P===""?e:e.replace("</head>",` ${P}
563
- </head>`)},p=c.filter((v)=>a(v)||!r.has(v));if(p.length===0)return d([u]);let m=av(o),h=[...qm(o),...p.map((v)=>`/components/${v}.js`)].map((v)=>`<link rel="modulepreload" href="${v}">`).join(`
564
- `),g=e.includes('<script type="importmap">'),b=d([g?"":m,h,u]),j=p.map((v)=>`<script type="module" src="/components/${v}.js"></script>`).join(`
565
- `);return b.replace("</body>",` ${j}
566
- </body>`)}function RD(e,t){return e.replace("</body>",` <script type="module" src="${t}"></script>
567
- </body>`)}function CD(e,t,n){let r=kw(t),s=/<head>([\s\S]*?)<\/head>/i,o=e.match(s),i="";if(o){let c=o[1].match(/<style>[\s\S]*?<\/style>/gi);if(c)i+=`
557
+ ${Lu(l)}
558
+ </style>`,d=(v)=>{let j=v.filter(Boolean).join(`
559
+ `);return j===""?e:e.replace("</head>",` ${j}
560
+ </head>`)},p=c.filter((v)=>a(v)||!r.has(v));if(p.length===0)return d([u]);let m=NE(o),g=[...Xg(o),...p.map((v)=>`/components/${v}.js`)].map((v)=>`<link rel="modulepreload" href="${v}">`).join(`
561
+ `),y=e.includes('<script type="importmap">'),S=d([y?"":m,g,u]),E=p.map((v)=>`<script type="module" src="/components/${v}.js"></script>`).join(`
562
+ `);return S.replace("</body>",` ${E}
563
+ </body>`)}function sL(e,t){return e.replace("</body>",` <script type="module" src="${t}"></script>
564
+ </body>`)}function oL(e,t,n){let r=e0(t),s=/<head>([\s\S]*?)<\/head>/i,o=e.match(s),i="";if(o){let c=o[1].match(/<style>[\s\S]*?<\/style>/gi);if(c)i+=`
568
565
  ${c.join(`
569
566
  `)}`;let l=o[1].match(/<script[\s\S]*?<\/script>/gi);if(l)i+=`
570
567
  ${l.join(`
571
568
  `)}`}let a=e;if(s.test(a))a=a.replace(s,`<head>
572
569
  ${r}${i}
573
- </head>`);return a=a.replace(/<html\s[^>]*>/i,(c)=>{let l=/lang=/.test(c)?c.replace(/lang="[^"]*"/,`lang="${n.lang}"`):c.replace("<html",`<html lang="${n.lang}"`);if(n.dir!==void 0)l=/\sdir=/.test(l)?l.replace(/\sdir="[^"]*"/,` dir="${n.dir}"`):l.replace("<html",`<html dir="${n.dir}"`);return l}),a}function xv(e,t,n){if(e==="/")return Ps(t,"index.html");if(sc(e))return Ps(t,"404.html");let r=e.replace(/^\//,"");if(n==="always")return Ps(t,r,"index.html");return Ps(t,`${r}.html`)}function ND(e,t,n={}){let r=0,s=[],o=[],i=(l)=>l.length>1&&l.endsWith("/")?l.slice(0,-1):l,a=new Set([...n.compiledUrls??[]].map((l)=>i(l))),c=n.trailingSlash??"always";for(let[l,u]of Object.entries(e)){let d=k(u)?u:u.destination,p=!k(u)&&"rewrite"in u&&u.rewrite,m=p?200:!k(u)&&("status"in u)?u.status??301:301;if(!p&&!Hm.has(String(m))){s.push(`Redirect "${l}" has status ${m}, which is not an RFC 9110 §15.4 redirection `+`status. Use one of ${[...Hm.keys()].join(", ")}, or { destination, rewrite: true } for a proxy.`);continue}let x=n.basePath??"";if(o.push(`${We(x,l)} ${We(x,d)} ${m}`),l.includes(":")||l.includes("*"))continue;if(a.has(i(l)))console.warn(`The ${p?"rewrite":"redirect"} "${l}" collides with a compiled page at the same route — `+"remove one or the other.");if(p)continue;let h=Hm.get(String(m));if(!h.html)continue;let g=xv(l,t,c),b=h.canonical?`
574
- <link rel="canonical" href="${Um(d)}">`:`
575
- <meta name="robots" content="noindex">`,j=`<!DOCTYPE html>
570
+ </head>`);return a=a.replace(/<html\s[^>]*>/i,(c)=>{let l=/lang=/.test(c)?c.replace(/lang="[^"]*"/,`lang="${n.lang}"`):c.replace("<html",`<html lang="${n.lang}"`);if(n.dir!==void 0)l=/\sdir=/.test(l)?l.replace(/\sdir="[^"]*"/,` dir="${n.dir}"`):l.replace("<html",`<html dir="${n.dir}"`);return l}),a}function BE(e,t,n){if(e==="/")return br(t,"index.html");if(dc(e))return br(t,"404.html");let r=e.replace(/^\//,"");if(n==="always")return br(t,r,"index.html");return br(t,`${r}.html`)}function iL(e,t,n={}){let r=0,s=[],o=[],i=(l)=>l.length>1&&l.endsWith("/")?l.slice(0,-1):l,a=new Set([...n.compiledUrls??[]].map((l)=>i(l))),c=n.trailingSlash??"always";for(let[l,u]of Object.entries(e)){let d=k(u)?u:u.destination,p=!k(u)&&"rewrite"in u&&u.rewrite,m=p?200:!k(u)&&("status"in u)?u.status??301:301;if(!p&&!ey.has(String(m))){s.push(`Redirect "${l}" has status ${m}, which is not an RFC 9110 §15.4 redirection `+`status. Use one of ${[...ey.keys()].join(", ")}, or { destination, rewrite: true } for a proxy.`);continue}let x=n.basePath??"";if(o.push(`${Ie(x,l)} ${Ie(x,d)} ${m}`),l.includes(":")||l.includes("*"))continue;if(a.has(i(l)))console.warn(`The ${p?"rewrite":"redirect"} "${l}" collides with a compiled page at the same route — `+"remove one or the other.");if(p)continue;let g=ey.get(String(m));if(!g.html)continue;let y=BE(l,t,c),S=g.canonical?`
571
+ <link rel="canonical" href="${ty(d)}">`:`
572
+ <meta name="robots" content="noindex">`,E=`<!DOCTYPE html>
576
573
  <html>
577
574
  <head>
578
575
  <meta charset="utf-8">
579
- <meta http-equiv="refresh" content="0;url=${Um(d)}">${b}
576
+ <meta http-equiv="refresh" content="0;url=${ty(d)}">${S}
580
577
  <title>Redirecting...</title>
581
578
  </head>
582
579
  <body>
583
- <p>Redirecting to <a href="${Um(d)}">${bv(d)}</a>...</p>
580
+ <p>Redirecting to <a href="${ty(d)}">${zE(d)}</a>...</p>
584
581
  </body>
585
- </html>`;er(yr(g),{recursive:!0}),In(g,j,"utf8"),r+=1}if(o.length>0)In(Ps(t,"_redirects"),`${o.join(`
582
+ </html>`;er(tr(y),{recursive:!0}),Pn(y,E,"utf8"),r+=1}if(o.length>0)Pn(br(t,"_redirects"),`${o.join(`
586
583
  `)}
587
- `,"utf8"),r+=1;return{errors:s,files:r}}function bv(e){return String(e).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;")}function Um(e){return String(e).replaceAll("&","&amp;").replaceAll('"',"&quot;").replaceAll("<","&lt;")}function Bm(e){return String(e).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&apos;")}function TD(e){return e.toISOString().replace(/\.\d{3}Z$/,"Z")}function ID(e,t){if(e.length===0)return 0;let n=e.map((o)=>{let i=(o.alternates??[]).map((a)=>` <xhtml:link rel="alternate" hreflang="${Bm(a.hreflang)}" href="${Bm(a.href)}"/>`).join(`
584
+ `,"utf8"),r+=1;return{errors:s,files:r}}function zE(e){return String(e).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;")}function ty(e){return String(e).replaceAll("&","&amp;").replaceAll('"',"&quot;").replaceAll("<","&lt;")}function ny(e){return String(e).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&apos;")}function aL(e){return e.toISOString().replace(/\.\d{3}Z$/,"Z")}function lL(e,t){if(e.length===0)return 0;let n=e.map((o)=>{let i=(o.alternates??[]).map((a)=>` <xhtml:link rel="alternate" hreflang="${ny(a.hreflang)}" href="${ny(a.href)}"/>`).join(`
588
585
  `);return` <url>
589
- <loc>${Bm(o.loc)}</loc>
586
+ <loc>${ny(o.loc)}</loc>
590
587
  <lastmod>${o.lastmod}</lastmod>
591
588
  ${i===""?"":`${i}
592
589
  `} </url>`}).join(`
593
590
  `),s=`<?xml version="1.0" encoding="UTF-8"?>
594
- <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"${e.some((o)=>(o.alternates?.length??0)>0)?` xmlns:xhtml="${JD}"`:""}>
591
+ <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"${e.some((o)=>(o.alternates?.length??0)>0)?` xmlns:xhtml="${cL}"`:""}>
595
592
  ${n}
596
593
  </urlset>
597
- `;return In(Ps(t,"sitemap.xml"),s,"utf8"),1}function MD(e,t){let n=Ps(e,"robots.txt"),r=js(n),s=r?xD(n,"utf8"):`User-agent: *
594
+ `;return Pn(br(t,"sitemap.xml"),s,"utf8"),1}function uL(e,t){let n=br(e,"robots.txt"),r=Os(n),s=r?BF(n,"utf8"):`User-agent: *
598
595
  Allow: /
599
596
  `;if(/^Sitemap:/im.test(s))return 0;if(!s.endsWith(`
600
597
  `))s+=`
601
598
  `;return s+=`
602
- Sitemap: ${hs("/sitemap.xml",t)}
603
- `,In(n,s,"utf8"),r?0:1}var fv='set build.adapter to "cloudflare-workers", "cloudflare-pages", "node", or "bun".',Hm,JD="http://www.w3.org/1999/xhtml";var $v=T(()=>{le();Dt();$n();Dx();ap();Da();cm();iw();Ur();cw();fw();Sw();vu();Si();hm();jw();Ow();Rw();sm();Xw();ac();_m();hr();Ei();im();BS();um();YS();em();nv();nm();lv();Cm();po();Hm=new Map([["301",{canonical:!0,html:!0,why:""}],["302",{canonical:!1,html:!0,why:""}],["303",{canonical:!1,html:!0,why:""}],["307",{canonical:!1,html:!1,why:"307 preserves the request method and body; a meta-refresh silently converts POST to GET"}],["308",{canonical:!1,html:!1,why:"308 preserves the request method and body; a meta-refresh silently converts POST to GET"}]])});import{createRequire as DD}from"node:module";import{join as FD}from"node:path";import{spawn as LD}from"node:child_process";function VD(e){try{return DD(FD(e,"package.json")).resolve("@jxsuite/server/dev")}catch{throw Error(`@jxsuite/server is not installed in ${e}. Add it to devDependencies (e.g. \`bun add -d @jxsuite/server\`) and retry.`)}}function wv(e,t,n=LD,r=process){let o=[VD(e),"--root",e];if(t!==void 0)o.push("--port",String(t));let i=n("bun",o,{stdio:"inherit"});return i.on("error",(a)=>{if(a.code==="ENOENT")console.error("The Jx dev server runs on Bun, which was not found on your PATH. Install it from https://bun.sh and retry.");else console.error(`Failed to start the dev server: ${a.message}`);r.exitCode=1}),r.on("SIGINT",()=>{i.kill("SIGINT")}),r.on("SIGTERM",()=>{i.kill("SIGTERM")}),i.on("exit",(a)=>{r.exitCode=a??0}),i}var Sv=()=>{};import{createServer as qD}from"node:http";import{existsSync as Du,readFileSync as vv,statSync as WD}from"node:fs";import{extname as HD,join as Gm,normalize as UD,resolve as Ev,sep as BD}from"node:path";function KD(e,t){let n=UD(t).replaceAll("\\","/"),r=Ev(e,`.${n.startsWith("/")?n:`/${n}`}`);if(r!==e&&!r.startsWith(e+BD))return null;if(Du(r)){if(WD(r).isDirectory()){let o=Gm(r,"index.html");return Du(o)?o:null}return r}let s=Gm(r,"index.html");return Du(s)?s:null}function jv(e,t){let n=Ev(e),r=qD((s,o)=>{let i=new URL(s.url??"/","http://localhost"),a=KD(n,decodeURIComponent(i.pathname));if(a){o.writeHead(200,{"Content-Type":zD.get(HD(a).toLowerCase())??"application/octet-stream"}),o.end(vv(a));return}let c=Gm(n,"404.html");if(Du(c)){o.writeHead(404,{"Content-Type":"text/html; charset=utf-8"}),o.end(vv(c));return}o.writeHead(404,{"Content-Type":"text/plain; charset=utf-8"}),o.end("Not found")});return r.listen(t),r}var zD;var Pv=T(()=>{sd();zD=new Map(Object.entries({".avif":"image/avif",".css":"text/css; charset=utf-8",".gif":"image/gif",".html":"text/html; charset=utf-8",".ico":"image/x-icon",".jpeg":"image/jpeg",".jpg":"image/jpeg",".js":"text/javascript; charset=utf-8",".json":"application/json; charset=utf-8",".png":"image/png",".svg":"image/svg+xml",".txt":"text/plain; charset=utf-8",".webp":"image/webp",".woff2":"font/woff2",".xml":"application/xml; charset=utf-8",...py}))});var hc="https://jxsuite.com/schema/project/fields/v2",Co="https://jxsuite.com/schema/document/paths/v2",_v,kv,gc,Xm;var Fu=T(()=>{_v={description:"A single field definition inside a section entry schema — a small, recursive subset of "+"JSON Schema. Recursive positions reference the effective field union via the well-known fields resource $id.",properties:{default:{},description:{type:"string"},enum:{type:"array"},format:{type:"string"},items:{$ref:"https://jxsuite.com/schema/project/fields/v2"},properties:{additionalProperties:{$ref:"https://jxsuite.com/schema/project/fields/v2"},type:"object"},required:{items:{type:"string"},type:"array"},type:{enum:["string","number","integer","boolean","array","object"],type:"string"}},required:["type"],type:"object"},kv={description:`Relationship reference field: points at a named entry of a referenceable section via "#/<sectionKey>/<name>" (specs/relationships.md). A bare reference is to-one; wrap in an array field's items for to-many.`,properties:{$ref:{pattern:"^#/[A-Za-z][A-Za-z0-9_-]*/[A-Za-z0-9._-]+$",type:"string"},description:{type:"string"}},required:["$ref"],type:"object"},gc=[{additionalProperties:!1,description:'Explicit value list: generates one page per value, bound to `param` (default "value").',properties:{param:{description:'Route parameter to fill (default "value").',type:"string"},values:{description:"The values to expand.",type:"array"}},required:["values"],type:"object"},{additionalProperties:!1,description:"JSON data-file source: loads a project-relative file that must contain an array, and generates one page per item.",properties:{$ref:{description:"Project-relative path to a .json file containing an array.",type:"string"},field:{description:'Item field providing the parameter value (default "id").',type:"string"},param:{description:'Route parameter to fill (default "id").',type:"string"}},required:["$ref"],type:"object"},{additionalProperties:!1,description:"Paged list: one route per `pageSize` items of an entry of this page's own state, which must resolve to an array at build time. The page number fills the route's one parameter that `each` does not.",properties:{each:{description:"Another `$paths` source for the route's other parameter: the list is paged once per value of it, as a paged archive per tag is.",type:["object","array"]},pageSize:{description:"Items on each page.",minimum:1,type:"integer"},paginate:{additionalProperties:!1,description:"The state entry to page.",properties:{$ref:{description:"A pointer to an entry of this page's state: `#/state/<key>`.",pattern:"^#/state/[^/]+$",type:"string"}},required:["$ref"],type:"object"}},required:["paginate","pageSize"],type:"object"},{description:"Legacy explicit form: an array of ready-made parameter objects, used as-is with no expansion. Prefer one of the source shapes above.",items:{additionalProperties:{type:"string"},type:"object"},type:"array"}],Xm={description:"A source shape contributed by an extension this schema cannot see. The project's generated document.schema.json validates these exactly; enable the owning extension and regenerate with `jx schema` to get precise checking here.",minProperties:1,type:"object"}});function GD(e){let{corePath:t,fragments:n,fieldSchemaRefs:r=[]}=e;return{$comment:Cv,$defs:{Fields:{$id:hc,anyOf:[{$ref:`${Ov}#/$defs/JxFieldSchema`},{$ref:`${Ov}#/$defs/RelationshipRef`},...r.map((s)=>({$ref:s}))]}},$schema:"https://json-schema.org/draft/2020-12/schema",allOf:[{$ref:t},...n.map((s)=>({$ref:s}))],type:"object",unevaluatedProperties:!1}}async function xc(e,t,n,r=[]){let s=structuredClone(e),o=new Map,i=new Set;Ym(s,i);let a=0,c=async(u)=>{let d=yc(u),p=o.get(d);if(p!==void 0)return p;let m;try{m=structuredClone(await t(d))}catch(b){throw Error(`bundleSchema: cannot load $ref target "${d}": ${nF(b)}`,{cause:b})}let x=k(m.$id)&&_s(m.$id)?m.$id:null;a+=x===null?1:0;let h=x??`urn:jx:bundled:${a}`;if(o.set(d,h),i.has(h))return h;i.add(h),m.$id=h,await l(m,tF(d),!0);let g=s.$defs??={};return g[h]=m,h},l=async(u,d,p=!1)=>{if(Array.isArray(u)){for(let g of u)await l(g,d);return}if(!V(u))return;let m=u,x=d;if(!p&&k(m.$id)&&_s(m.$id))x=null;let h=m.$ref;if(k(h)&&x!==null&&!h.startsWith("#")&&!_s(h)){let g=h.indexOf("#"),b=g===-1?h:h.slice(0,g),j=g===-1?"":h.slice(g);if(b){let v=await c(`${x}/${b}`);m.$ref=`${v}${j}`}}for(let g of Object.values(m))await l(g,x)};await l(s,yc(n),!0);for(let u of r)await c(`${yc(n)}/${u}`);return s}function QD(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function*Av(e,t){for(let n of XD){let r=e[n];if(Array.isArray(r)){for(let[s,o]of r.entries())if(V(o))yield[o,`${t}/${n}/${s}`]}else if(V(r))yield[r,`${t}/${n}`]}for(let n of YD){let r=e[n];if(!V(r))continue;for(let[s,o]of Object.entries(r))if(V(o))yield[o,`${t}/${n}/${QD(s)}`]}for(let n of ZD){let r=e[n];if(!Array.isArray(r))continue;for(let[s,o]of r.entries())if(V(o))yield[o,`${t}/${n}/${s}`]}}function eF(e,t){let n=e.replace(/^[a-zA-Z][a-zA-Z\d+.-]*:/,"");if(n.startsWith("//")){let o=n.indexOf("/",2);n=o===-1?"":n.slice(o+1)}n=n.replace(/^schema\//,"");let r=n.split(/[^a-zA-Z0-9]+/).filter(Boolean).join("-")||"resource",s=r;for(let o=2;t.has(s);o+=1)s=`${r}-${o}`;return t.add(s),s}function bc(e){let t=structuredClone(e);if(V(t.$defs)){let o=new Set(Object.keys(t.$defs).filter((a)=>!_s(a))),i={};for(let[a,c]of Object.entries(t.$defs)){let l=V(c)&&k(c.$id)?c.$id:a;i[_s(a)?eF(l,o):a]=c}t.$defs=i}let n=new Map,r=(o,i)=>{let{$id:a}=o;if(k(a)&&_s(a)&&!n.has(a))n.set(a,i);for(let[c,l]of Av(o,i))r(c,l)};r(t,"#");let s=(o,i)=>{let a=i,{$id:c}=o;if(k(c)&&_s(c)){if(a=n.get(c)??i,a!=="#")delete o.$id}let l=o.$ref;if(k(l)){let u=l.indexOf("#"),d=u===-1?l:l.slice(0,u),p=u===-1?"":l.slice(u+1);if(d===""){if(p.startsWith("/"))o.$ref=`${a}${p}`}else{let m=n.get(d);if(m!==void 0)o.$ref=p?`${m}${p}`:m}}for(let[u]of Av(o,a))s(u,a)};return s(t,"#"),t}function Ym(e,t){if(Array.isArray(e)){for(let r of e)Ym(r,t);return}if(!V(e))return;let n=e;if(k(n.$id)&&_s(n.$id))t.add(n.$id);for(let r of Object.values(n))Ym(r,t)}function _s(e){return/^[a-zA-Z][a-zA-Z\d+.-]*:/.test(e)}function yc(e){let t=e.replaceAll("\\","/"),n=t.startsWith("/"),r=[];for(let s of t.split("/")){if(s===""||s===".")continue;if(s===".."){if(r.length>0&&r.at(-1)!=="..")r.pop();else if(!n)r.push("..");continue}r.push(s)}return(n?"/":"")+r.join("/")}function tF(e){let t=e.lastIndexOf("/");if(t===-1)return".";return t===0?"/":e.slice(0,t)}function nF(e){return e instanceof Error?e.message:String(e)}function rF(e){let{corePath:t,pathsValueRefs:n}=e;return{$comment:Cv,$defs:{PathsValue:{$id:Co,anyOf:[...gc,...n.map((r)=>({$ref:r}))]}},$schema:"https://json-schema.org/draft/2020-12/schema",allOf:[{$ref:t}]}}async function Nv(e){let{baseDir:t,coreDocumentRef:n,coreProjectRef:r,extensions:s,loadJson:o}=e,i=[],a=[],c=[],l=[];for(let p of s){if(p.project)i.push(p.project);if(p.document){let m=await Rv(p.document,o,t);if(a.push(...m),m.length>0)c.push(p.document)}if(p.fields)l.push(...await Rv(p.fields,o,t)),i.push(p.fields)}let u=GD({corePath:r,fieldSchemaRefs:l,fragments:i}),d=rF({corePath:n,pathsValueRefs:a});return{document:bc(await xc(d,o,t,c)),project:bc(await xc(u,o,t))}}async function Rv(e,t,n){let r;try{r=await t(yc(`${yc(n)}/${e}`))}catch{return[]}let{$id:s}=r;if(!k(s)||!r.$defs)return[];return Object.keys(r.$defs).map((o)=>`${s}#/$defs/${o}`)}var Ov="https://jxsuite.com/schema/project/core/v2",Cv="Generated by `jx schema` from project.json#/extensions — do not edit.",XD,YD,ZD;var Tv=T(()=>{Fu();le();Fu();XD=["additionalItems","additionalProperties","contains","contentSchema","else","if","items","not","propertyNames","then","unevaluatedItems","unevaluatedProperties"],YD=["$defs","definitions","dependencies","dependentSchemas","patternProperties","properties"],ZD=["allOf","anyOf","oneOf","prefixItems"]});import{existsSync as Mv,readFileSync as sF,statSync as Jv,writeFileSync as Lu}from"node:fs";import{createRequire as Qm}from"node:module";import{dirname as oF,isAbsolute as iF,relative as eh,resolve as ks,sep as th}from"node:path";async function Dv(e){let{config:t}=ms(e),n=await ps(e,t),r=ks(e),{document:s,project:o}=await Nv({baseDir:r,coreDocumentRef:Iv(e,cF),coreProjectRef:Iv(e,aF),extensions:n.extensions.map((i)=>({document:i.schemas.document&&Zm(e,i,i.schemas.document),fields:i.schemas.fields&&Zm(e,i,i.schemas.fields),project:i.schemas.project&&Zm(e,i,i.schemas.project)})),loadJson:Vv(r)});return{documentSchema:s,projectSchema:o}}async function Fv(e){let{documentSchema:t,projectSchema:n}=await Dv(e),r=ks(e,"project.schema.json"),s=ks(e,"document.schema.json");return Lu(r,`${JSON.stringify(n,null,2)}
604
- `,"utf8"),Lu(s,`${JSON.stringify(t,null,2)}
605
- `,"utf8"),{documentSchemaPath:s,projectSchemaPath:r}}async function Lv(e,t={}){let{write:n=!0}=t,r=ks(e),s=Rn(r),o=ks(r,"project.schema.json"),i=ks(r,"document.schema.json"),a=(h)=>{if(!Mv(h))return!0;try{return Jv(s).mtimeMs>Jv(h).mtimeMs}catch{return!1}},l=a(o)||a(i)?await Dv(r):null;if(l&&n)Lu(o,`${JSON.stringify(l.projectSchema,null,2)}
606
- `,"utf8"),Lu(i,`${JSON.stringify(l.documentSchema,null,2)}
607
- `,"utf8");let u=Vv(r),d=l?.projectSchema??$c(o),p=l?.documentSchema??$c(i),m=bc(await xc(d,u,r));return{document:bc(await xc(p,u,r)),project:m}}function $c(e){let t=JSON.parse(sF(e,"utf8"));if(!V(t))throw TypeError(`Schema file "${e}" is not a JSON object`);return t}function uF(e){return e.startsWith(lF)&&e.endsWith(".json")}function fF(e,t){try{return Qm(import.meta.url).resolve(e)}catch(n){throw Error(`Schema ref "${t}" names the core schema "${e}", which must resolve from the host workspace and does not. The project's own copy is deliberately not consulted, so the host install is missing "${e.split("/").slice(0,2).join("/")}" — check that `+"the package ships with this build",{cause:n})}}function Vv(e){return async(t)=>{let n=ks(t),r=eh(e,n);if(r.startsWith("..")||iF(r))throw Error(`Schema ref "${t}" escapes the project root ${e}`);let s=r.split(th).join("/"),o="node_modules/",i=s.lastIndexOf(o),a=i===-1?null:s.slice(i+o.length);if(a!==null&&uF(a))return $c(fF(a,t));if(Mv(n))return $c(n);if(a===null)throw Error(`Schema ref "${t}" does not exist`);let c;try{c=Ud(e,a)}catch(l){throw Error(`Schema ref "${t}" does not exist and "${a}" is not resolvable from the `+"project — is the package installed?",{cause:l})}return $c(c)}}function Iv(e,t){let n=null;try{n=Qm(ks(e,"package.json")).resolve(t)}catch{try{n=Qm(import.meta.url).resolve(t)}catch{n=null}}let r=`./node_modules/${t}`;return n?qv(e,n,r):r}function Zm(e,t,n){let r=eh(oF(t.manifestPath),n).split(th).join("/"),s=`./node_modules/${t.specifier}/${r}`;return qv(e,n,s)}function qv(e,t,n){let r=eh(e,t).split(th).join("/");if(r.startsWith(".."))return n;return r.startsWith("./")?r:`./${r}`}var aF="@jxsuite/schema/schemas/project.core.schema.json",cF="@jxsuite/schema/schema.json",lF="@jxsuite/schema/";var nh=T(()=>{Tv();le();Ur();Da();po()});var Uv=W(function(R7,Hv){var __dirname="/home/runner/work/jx/jx/node_modules/@webref/elements",Wv=it("fs").promises,Vu=it("path");async function dF({folder:e=__dirname}={}){let t={},n=await Wv.readdir(e);for(let r of n)if(r.endsWith(".json")&&r!=="package.json"){let s=await Wv.readFile(Vu.join(e,r),"utf8");t[Vu.basename(r,".json")]=JSON.parse(s)}return t}Hv.exports={listAll:dF}});var Gv=W(function(C7,Kv){var __dirname="/home/runner/work/jx/jx/node_modules/@webref/css",pF=it("fs").promises,Bv=it("path");async function zv({folder:e=__dirname}={}){let t=await pF.readFile(Bv.join(e,"css.json"),"utf8");return JSON.parse(t)}async function mF({folder:e=__dirname}={}){let t=await zv(e),n={};for(let[r,s]of Object.entries(t)){n[r]={};for(let o of s){let i=o.name,a=null;if(o.for)a=s.find((c)=>c!==o&&c.name===o.name);if(a)i+=" for "+o.for[0];if(n[r][i]=o,o.descriptors){let c=o.descriptors;o.descriptors={};for(let l of c)o.descriptors[l.name]=l}}}return n}Kv.exports={listAll:zv,index:mF}});var Xv=W(function(qu,rh){(function(e,t){typeof qu=="object"&&typeof rh=="object"?rh.exports=t():typeof define=="function"&&define.amd?define([],t):typeof qu=="object"?qu.WebIDL2=t():e.WebIDL2=t()})(globalThis,()=>(()=>{var e={d:(f,y)=>{for(var w in y)e.o(y,w)&&!e.o(f,w)&&Object.defineProperty(f,w,{enumerable:!0,get:y[w]})},o:(f,y)=>Object.prototype.hasOwnProperty.call(f,y),r:(f)=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(f,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(f,"__esModule",{value:!0})}},t={};function n(f,y,w,E,O,{level:I="error",autofix:q,ruleName:Z}={}){function oe(gn){return gn>0?f.slice(y,y+gn):f.slice(Math.max(y+gn,0),y)}function fe(gn,{precedes:eo}={}){let Tr=gn.map((wa)=>wa.trivia+wa.value).join(""),$a=f[y];return $a.type==="eof"?Tr:eo?Tr+$a.trivia:Tr.slice($a.trivia.length)}let Oe=f[y].type!=="eof"?f[y].line:f.length>1?f[y-1].line:1,Te=function(gn){let eo=gn.split(`
608
- `);return eo[eo.length-1]}(fe(oe(-5),{precedes:!0})),zt=oe(5),tn=fe(zt),ba=Te+tn.split(`
599
+ Sitemap: ${ys("/sitemap.xml",t)}
600
+ `,Pn(n,s,"utf8"),r?0:1}var ME='set build.adapter to "cloudflare-workers", "cloudflare-pages", "node", or "bun".',ey,cL="http://www.w3.org/1999/xhtml";var KE=R(()=>{le();Rt();$n();L$();Jp();ii();hg();Rv();Br();Tv();Dv();Kv();Zu();bi();wg();Yv();t0();r0();ug();$0();of();Ng();Yn();Si();pg();dg();xE();yg();vE();ig();kE();cg();JE();Mg();ho();ey=new Map([["301",{canonical:!0,html:!0,why:""}],["302",{canonical:!1,html:!0,why:""}],["303",{canonical:!1,html:!0,why:""}],["307",{canonical:!1,html:!1,why:"307 preserves the request method and body; a meta-refresh silently converts POST to GET"}],["308",{canonical:!1,html:!1,why:"308 preserves the request method and body; a meta-refresh silently converts POST to GET"}]])});import{createRequire as fL}from"node:module";import{join as dL}from"node:path";import{spawn as pL}from"node:child_process";function mL(e){try{return fL(dL(e,"package.json")).resolve("@jxsuite/server/dev")}catch{throw Error(`@jxsuite/server is not installed in ${e}. Add it to devDependencies (e.g. \`bun add -d @jxsuite/server\`) and retry.`)}}function GE(e,t,n=pL,r=process){let o=[mL(e),"--root",e];if(t!==void 0)o.push("--port",String(t));let i=n("bun",o,{stdio:"inherit"});return i.on("error",(a)=>{if(a.code==="ENOENT")console.error("The Jx dev server runs on Bun, which was not found on your PATH. Install it from https://bun.sh and retry.");else console.error(`Failed to start the dev server: ${a.message}`);r.exitCode=1}),r.on("SIGINT",()=>{i.kill("SIGINT")}),r.on("SIGTERM",()=>{i.kill("SIGTERM")}),i.on("exit",(a)=>{r.exitCode=a??0}),i}var XE=()=>{};import{createServer as hL}from"node:http";import{existsSync as hf,readFileSync as YE,statSync as gL}from"node:fs";import{extname as yL,join as oy,normalize as xL,resolve as ZE,sep as bL}from"node:path";function SL(e,t){let n=xL(t).replaceAll("\\","/"),r=ZE(e,`.${n.startsWith("/")?n:`/${n}`}`);if(r!==e&&!r.startsWith(e+bL))return null;if(hf(r)){if(gL(r).isDirectory()){let o=oy(r,"index.html");return hf(o)?o:null}return r}let s=oy(r,"index.html");return hf(s)?s:null}function QE(e,t){let n=ZE(e),r=hL((s,o)=>{let i=new URL(s.url??"/","http://localhost"),a=SL(n,decodeURIComponent(i.pathname));if(a){o.writeHead(200,{"Content-Type":$L.get(yL(a).toLowerCase())??"application/octet-stream"}),o.end(YE(a));return}let c=oy(n,"404.html");if(hf(c)){o.writeHead(404,{"Content-Type":"text/html; charset=utf-8"}),o.end(YE(c));return}o.writeHead(404,{"Content-Type":"text/plain; charset=utf-8"}),o.end("Not found")});return r.listen(t),r}var $L;var ej=R(()=>{Cd();$L=new Map(Object.entries({".avif":"image/avif",".css":"text/css; charset=utf-8",".gif":"image/gif",".html":"text/html; charset=utf-8",".ico":"image/x-icon",".jpeg":"image/jpeg",".jpg":"image/jpeg",".js":"text/javascript; charset=utf-8",".json":"application/json; charset=utf-8",".png":"image/png",".svg":"image/svg+xml",".txt":"text/plain; charset=utf-8",".webp":"image/webp",".woff2":"font/woff2",".xml":"application/xml; charset=utf-8",...db}))});function wL(e){let{corePath:t,fragments:n,fieldSchemaRefs:r=[]}=e;return{$comment:sj,$defs:{Fields:{$id:ec,anyOf:[{$ref:`${tj}#/$defs/JxFieldSchema`},{$ref:`${tj}#/$defs/RelationshipRef`},...r.map((s)=>({$ref:s}))]}},$schema:"https://json-schema.org/draft/2020-12/schema",allOf:[{$ref:t},...n.map((s)=>({$ref:s}))],type:"object",unevaluatedProperties:!1}}async function Pc(e,t,n,r=[]){let s=structuredClone(e),o=new Map,i=new Set;iy(s,i);let a=0,c=async(u)=>{let d=jc(u),p=o.get(d);if(p!==void 0)return p;let m;try{m=structuredClone(await t(d))}catch(S){throw Error(`bundleSchema: cannot load $ref target "${d}": ${OL(S)}`,{cause:S})}let x=k(m.$id)&&As(m.$id)?m.$id:null;a+=x===null?1:0;let g=x??`urn:jx:bundled:${a}`;if(o.set(d,g),i.has(g))return g;i.add(g),m.$id=g,await l(m,kL(d),!0);let y=s.$defs??={};return y[g]=m,g},l=async(u,d,p=!1)=>{if(Array.isArray(u)){for(let y of u)await l(y,d);return}if(!L(u))return;let m=u,x=d;if(!p&&k(m.$id)&&As(m.$id))x=null;let g=m.$ref;if(k(g)&&x!==null&&!g.startsWith("#")&&!As(g)){let y=g.indexOf("#"),S=y===-1?g:g.slice(0,y),E=y===-1?"":g.slice(y);if(S){let v=await c(`${x}/${S}`);m.$ref=`${v}${E}`}}for(let y of Object.values(m))await l(y,x)};await l(s,jc(n),!0);for(let u of r)await c(`${jc(n)}/${u}`);return s}function PL(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function*nj(e,t){for(let n of vL){let r=e[n];if(Array.isArray(r)){for(let[s,o]of r.entries())if(L(o))yield[o,`${t}/${n}/${s}`]}else if(L(r))yield[r,`${t}/${n}`]}for(let n of EL){let r=e[n];if(!L(r))continue;for(let[s,o]of Object.entries(r))if(L(o))yield[o,`${t}/${n}/${PL(s)}`]}for(let n of jL){let r=e[n];if(!Array.isArray(r))continue;for(let[s,o]of r.entries())if(L(o))yield[o,`${t}/${n}/${s}`]}}function _L(e,t){let n=e.replace(/^[a-zA-Z][a-zA-Z\d+.-]*:/,"");if(n.startsWith("//")){let o=n.indexOf("/",2);n=o===-1?"":n.slice(o+1)}n=n.replace(/^schema\//,"");let r=n.split(/[^a-zA-Z0-9]+/).filter(Boolean).join("-")||"resource",s=r;for(let o=2;t.has(s);o+=1)s=`${r}-${o}`;return t.add(s),s}function _c(e){let t=structuredClone(e);if(L(t.$defs)){let o=new Set(Object.keys(t.$defs).filter((a)=>!As(a))),i={};for(let[a,c]of Object.entries(t.$defs)){let l=L(c)&&k(c.$id)?c.$id:a;i[As(a)?_L(l,o):a]=c}t.$defs=i}let n=new Map,r=(o,i)=>{let{$id:a}=o;if(k(a)&&As(a)&&!n.has(a))n.set(a,i);for(let[c,l]of nj(o,i))r(c,l)};r(t,"#");let s=(o,i)=>{let a=i,{$id:c}=o;if(k(c)&&As(c)){if(a=n.get(c)??i,a!=="#")delete o.$id}let l=o.$ref;if(k(l)){let u=l.indexOf("#"),d=u===-1?l:l.slice(0,u),p=u===-1?"":l.slice(u+1);if(d===""){if(p.startsWith("/"))o.$ref=`${a}${p}`}else{let m=n.get(d);if(m!==void 0)o.$ref=p?`${m}${p}`:m}}for(let[u]of nj(o,a))s(u,a)};return s(t,"#"),t}function iy(e,t){if(Array.isArray(e)){for(let r of e)iy(r,t);return}if(!L(e))return;let n=e;if(k(n.$id)&&As(n.$id))t.add(n.$id);for(let r of Object.values(n))iy(r,t)}function As(e){return/^[a-zA-Z][a-zA-Z\d+.-]*:/.test(e)}function jc(e){let t=e.replaceAll("\\","/"),n=t.startsWith("/"),r=[];for(let s of t.split("/")){if(s===""||s===".")continue;if(s===".."){if(r.length>0&&r.at(-1)!=="..")r.pop();else if(!n)r.push("..");continue}r.push(s)}return(n?"/":"")+r.join("/")}function kL(e){let t=e.lastIndexOf("/");if(t===-1)return".";return t===0?"/":e.slice(0,t)}function OL(e){return e instanceof Error?e.message:String(e)}function AL(e){let{corePath:t,pathsValueRefs:n}=e;return{$comment:sj,$defs:{PathsValue:{$id:Oo,anyOf:[...tc,...n.map((r)=>({$ref:r}))]}},$schema:"https://json-schema.org/draft/2020-12/schema",allOf:[{$ref:t}]}}async function oj(e){let{baseDir:t,coreDocumentRef:n,coreProjectRef:r,extensions:s,loadJson:o}=e,i=[],a=[],c=[],l=[];for(let p of s){if(p.project)i.push(p.project);if(p.document){let m=await rj(p.document,o,t);if(a.push(...m),m.length>0)c.push(p.document)}if(p.fields)l.push(...await rj(p.fields,o,t)),i.push(p.fields)}let u=wL({corePath:r,fieldSchemaRefs:l,fragments:i}),d=AL({corePath:n,pathsValueRefs:a});return{document:_c(await Pc(d,o,t,c)),project:_c(await Pc(u,o,t))}}async function rj(e,t,n){let r;try{r=await t(jc(`${jc(n)}/${e}`))}catch{return[]}let{$id:s}=r;if(!k(s)||!r.$defs)return[];return Object.keys(r.$defs).map((o)=>`${s}#/$defs/${o}`)}var tj="https://jxsuite.com/schema/project/core/v2",sj="Generated by `jx schema` from project.json#/extensions — do not edit.",vL,EL,jL;var ij=R(()=>{nc();le();nc();vL=["additionalItems","additionalProperties","contains","contentSchema","else","if","items","not","propertyNames","then","unevaluatedItems","unevaluatedProperties"],EL=["$defs","definitions","dependencies","dependentSchemas","patternProperties","properties"],jL=["allOf","anyOf","oneOf","prefixItems"]});import{existsSync as lj,readFileSync as CL,statSync as aj,writeFileSync as gf}from"node:fs";import{createRequire as cy}from"node:module";import{dirname as RL,isAbsolute as NL,relative as ly,resolve as Cs,sep as uy}from"node:path";async function uj(e){let{config:t}=gs(e),n=await hs(e,t),r=Cs(e),{document:s,project:o}=await oj({baseDir:r,coreDocumentRef:cj(e,JL),coreProjectRef:cj(e,TL),extensions:n.extensions.map((i)=>({document:i.schemas.document&&ay(e,i,i.schemas.document),fields:i.schemas.fields&&ay(e,i,i.schemas.fields),project:i.schemas.project&&ay(e,i,i.schemas.project)})),loadJson:pj(r)});return{documentSchema:s,projectSchema:o}}async function fj(e){let{documentSchema:t,projectSchema:n}=await uj(e),r=Cs(e,"project.schema.json"),s=Cs(e,"document.schema.json");return gf(r,`${JSON.stringify(n,null,2)}
601
+ `,"utf8"),gf(s,`${JSON.stringify(t,null,2)}
602
+ `,"utf8"),{documentSchemaPath:s,projectSchemaPath:r}}async function dj(e,t={}){let{write:n=!0}=t,r=Cs(e),s=An(r),o=Cs(r,"project.schema.json"),i=Cs(r,"document.schema.json"),a=(g)=>{if(!lj(g))return!0;try{return aj(s).mtimeMs>aj(g).mtimeMs}catch{return!1}},l=a(o)||a(i)?await uj(r):null;if(l&&n)gf(o,`${JSON.stringify(l.projectSchema,null,2)}
603
+ `,"utf8"),gf(i,`${JSON.stringify(l.documentSchema,null,2)}
604
+ `,"utf8");let u=pj(r),d=l?.projectSchema??kc(o),p=l?.documentSchema??kc(i),m=_c(await Pc(d,u,r));return{document:_c(await Pc(p,u,r)),project:m}}function kc(e){let t=JSON.parse(CL(e,"utf8"));if(!L(t))throw TypeError(`Schema file "${e}" is not a JSON object`);return t}function DL(e){return e.startsWith(IL)&&e.endsWith(".json")}function ML(e,t){try{return cy(import.meta.url).resolve(e)}catch(n){throw Error(`Schema ref "${t}" names the core schema "${e}", which must resolve from the host workspace and does not. The project's own copy is deliberately not consulted, so the host install is missing "${e.split("/").slice(0,2).join("/")}" — check that `+"the package ships with this build",{cause:n})}}function pj(e){return async(t)=>{let n=Cs(t),r=ly(e,n);if(r.startsWith("..")||NL(r))throw Error(`Schema ref "${t}" escapes the project root ${e}`);let s=r.split(uy).join("/"),o="node_modules/",i=s.lastIndexOf(o),a=i===-1?null:s.slice(i+o.length);if(a!==null&&DL(a))return kc(ML(a,t));if(lj(n))return kc(n);if(a===null)throw Error(`Schema ref "${t}" does not exist`);let c;try{c=xp(e,a)}catch(l){throw Error(`Schema ref "${t}" does not exist and "${a}" is not resolvable from the `+"project — is the package installed?",{cause:l})}return kc(c)}}function cj(e,t){let n=null;try{n=cy(Cs(e,"package.json")).resolve(t)}catch{try{n=cy(import.meta.url).resolve(t)}catch{n=null}}let r=`./node_modules/${t}`;return n?mj(e,n,r):r}function ay(e,t,n){let r=ly(RL(t.manifestPath),n).split(uy).join("/"),s=`./node_modules/${t.specifier}/${r}`;return mj(e,n,s)}function mj(e,t,n){let r=ly(e,t).split(uy).join("/");if(r.startsWith(".."))return n;return r.startsWith("./")?r:`./${r}`}var TL="@jxsuite/schema/schemas/project.core.schema.json",JL="@jxsuite/schema/schema.json",IL="@jxsuite/schema/";var fy=R(()=>{ij();le();Br();ii();ho()});var yj=q(function(cee,gj){var __dirname="/home/runner/work/jx/jx/node_modules/@webref/elements",hj=it("fs").promises,yf=it("path");async function FL({folder:e=__dirname}={}){let t={},n=await hj.readdir(e);for(let r of n)if(r.endsWith(".json")&&r!=="package.json"){let s=await hj.readFile(yf.join(e,r),"utf8");t[yf.basename(r,".json")]=JSON.parse(s)}return t}gj.exports={listAll:FL}});var Sj=q(function(lee,$j){var __dirname="/home/runner/work/jx/jx/node_modules/@webref/css",LL=it("fs").promises,xj=it("path");async function bj({folder:e=__dirname}={}){let t=await LL.readFile(xj.join(e,"css.json"),"utf8");return JSON.parse(t)}async function VL({folder:e=__dirname}={}){let t=await bj(e),n={};for(let[r,s]of Object.entries(t)){n[r]={};for(let o of s){let i=o.name,a=null;if(o.for)a=s.find((c)=>c!==o&&c.name===o.name);if(a)i+=" for "+o.for[0];if(n[r][i]=o,o.descriptors){let c=o.descriptors;o.descriptors={};for(let l of c)o.descriptors[l.name]=l}}}return n}$j.exports={listAll:bj,index:VL}});var wj=q(function(xf,dy){(function(e,t){typeof xf=="object"&&typeof dy=="object"?dy.exports=t():typeof define=="function"&&define.amd?define([],t):typeof xf=="object"?xf.WebIDL2=t():e.WebIDL2=t()})(globalThis,()=>(()=>{var e={d:(f,h)=>{for(var b in h)e.o(h,b)&&!e.o(f,b)&&Object.defineProperty(f,b,{enumerable:!0,get:h[b]})},o:(f,h)=>Object.prototype.hasOwnProperty.call(f,h),r:(f)=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(f,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(f,"__esModule",{value:!0})}},t={};function n(f,h,b,w,_,{level:W="error",autofix:K,ruleName:Y}={}){function V(hn){return hn>0?f.slice(h,h+hn):f.slice(Math.max(h+hn,0),h)}function ne(hn,{precedes:no}={}){let Ir=hn.map((ya)=>ya.trivia+ya.value).join(""),ga=f[h];return ga.type==="eof"?Ir:no?Ir+ga.trivia:Ir.slice(ga.trivia.length)}let fe=f[h].type!=="eof"?f[h].line:f.length>1?f[h-1].line:1,oe=function(hn){let no=hn.split(`
605
+ `);return no[no.length-1]}(ne(V(-5),{precedes:!0})),Je=V(5),Pt=ne(Je),ss=oe+Pt.split(`
609
606
  `)[0]+`
610
- `+(" ".repeat(Te.length)+"^"),Qf=O==="Syntax"?"since":"inside",Rg=`${O} error at line ${Oe}${f.name?` in ${f.name}`:""}${w&&w.name?`, ${Qf} \`${w.partial?"partial ":""}${function(gn){let eo=[gn];for(;gn&&gn.parent;){let{parent:Tr}=gn;eo.unshift(Tr),gn=Tr}return eo.map((Tr)=>function($a,wa){let Cg=$a;return wa&&(Cg+=` ${wa}`),Cg}(Tr.type,Tr.name)).join(" -> ")}(w)}\``:""}:
611
- ${ba}`;return{message:`${Rg} ${E}`,bareMessage:E,context:Rg,line:Oe,sourceName:f.name,level:I,ruleName:Z,autofix:q,input:tn,tokens:zt}}function r(f,y,w,E){return n(f,y,w,E,"Syntax")}function s(f,y,w,E,O={}){return O.ruleName=w,n(y.source,f.index,y,E,"Validation",O)}e.r(t),e.d(t,{WebIDLParseError:()=>Fe,parse:()=>Zf,validate:()=>U,write:()=>Qs});class o{constructor({source:f,tokens:y}){Object.defineProperties(this,{source:{value:f},tokens:{value:y,writable:!0},parent:{value:null,writable:!0},this:{value:this}})}toJSON(){let f={type:void 0,name:void 0,inheritance:void 0},y=this;for(;y!==Object.prototype;){let w=Object.getOwnPropertyDescriptors(y);for(let[E,O]of Object.entries(w))(O.enumerable||O.get)&&(f[E]=this[E]);y=Object.getPrototypeOf(y)}return f}}function i(f,y,{useNullableInner:w}={}){if(!f.union){let E=y.unique.get(f.idlType);if(!E)return;if(E.type==="typedef"){let{typedefIncludesDictionary:O}=y.cache;if(O.has(E))return O.get(E);y.cache.typedefIncludesDictionary.set(E,void 0);let I=i(E.idlType,y);if(y.cache.typedefIncludesDictionary.set(E,I),I)return{reference:f,dictionary:I.dictionary}}if(E.type==="dictionary"&&(w||!f.nullable))return{reference:f,dictionary:E}}for(let E of f.subtype){let O=i(E,y);if(O)return E.union?O:{reference:E,dictionary:O.dictionary}}}function a(f,y){if(y.cache.dictionaryIncludesRequiredField.has(f))return y.cache.dictionaryIncludesRequiredField.get(f);y.cache.dictionaryIncludesRequiredField.set(f,void 0);let w=f.members.some((E)=>E.required);if(!w&&f.inheritance){let E=y.unique.get(f.inheritance);E?a(E,y)&&(w=!0):w=!0}return y.cache.dictionaryIncludesRequiredField.set(f,w),w}class c extends Array{constructor({source:f,tokens:y}){super(),Object.defineProperties(this,{source:{value:f},tokens:{value:y},parent:{value:null,writable:!0}})}}class l extends o{static parser(f,y){return()=>{let w=f.consumeKind(y);if(w)return new l({source:f.source,tokens:{value:w}})}}get value(){return C(this.tokens.value.value)}write(f){return f.ts.wrap([f.token(this.tokens.value),f.token(this.tokens.separator)])}}class u extends l{static parse(f){let y=f.consumeKind("eof");if(y)return new u({source:f.source,tokens:{value:y}})}get type(){return"eof"}}function d(f,y){return L(f,{parser:l.parser(f,y),listName:y+" list"})}let p=["identifier","decimal","integer","string"],m=new Map([...["NoInterfaceObject","LenientSetter","LenientThis","TreatNonObjectAsNull","Unforgeable"].map((f)=>[f,`Legacy${f}`]),["NamedConstructor","LegacyFactoryFunction"],["OverrideBuiltins","LegacyOverrideBuiltIns"],["TreatNullAs","LegacyNullToEmptyString"]]);function x(f){for(let y of p){let w=d(f,y);if(w.length)return w}f.error("Expected identifiers, strings, decimals, or integers but none found")}class h extends o{static parse(f){let y={assign:f.consume("=")},w=ee(new h({source:f.source,tokens:y}));if(w.list=[],y.assign){if(y.asterisk=f.consume("*"),y.asterisk)return w.this;y.secondaryName=f.consumeKind(...p)}return y.open=f.consume("("),y.open?(w.list=w.rhsIsList?x(f):ae(f),y.close=f.consume(")")||f.error("Unexpected token in extended attribute argument list")):y.assign&&!y.secondaryName&&f.error("No right hand side to extended attribute assignment"),w.this}get rhsIsList(){return this.tokens.assign&&!this.tokens.asterisk&&!this.tokens.secondaryName}get rhsType(){return this.rhsIsList?this.list[0].tokens.value.type+"-list":this.tokens.asterisk?"*":this.tokens.secondaryName?this.tokens.secondaryName.type:null}write(f){let{rhsType:y}=this;return f.ts.wrap([f.token(this.tokens.assign),f.token(this.tokens.asterisk),f.reference_token(this.tokens.secondaryName,this.parent),f.token(this.tokens.open),...this.list.map((w)=>y==="identifier-list"?f.identifier(w,this.parent):w.write(f)),f.token(this.tokens.close)])}}class g extends o{static parse(f){let y=f.consumeKind("identifier");if(y)return new g({source:f.source,tokens:{name:y},params:h.parse(f)})}constructor({source:f,tokens:y,params:w}){super({source:f,tokens:y}),w.parent=this,Object.defineProperty(this,"params",{value:w})}get type(){return"extended-attribute"}get name(){return this.tokens.name.value}get rhs(){let{rhsType:f,tokens:y,list:w}=this.params;if(!f)return null;return{type:f,value:this.params.rhsIsList?w:this.params.tokens.secondaryName?C(y.secondaryName.value):null}}get arguments(){let{rhsIsList:f,list:y}=this.params;return!y||f?[]:y}*validate(f){let{name:y}=this;if(y==="LegacyNoInterfaceObject")yield s(this.tokens.name,this,"no-nointerfaceobject","`[LegacyNoInterfaceObject]` extended attribute is an undesirable feature that may be removed from Web IDL in the future. Refer to the [relevant upstream PR](https://github.com/whatwg/webidl/pull/609) for more information.",{level:"warning"});else if(m.has(y)){let E=`\`[${y}]\` extended attribute is a legacy feature that is now renamed to \`[${m.get(y)}]\`. Refer to the [relevant upstream PR](https://github.com/whatwg/webidl/pull/870) for more information.`;yield s(this.tokens.name,this,"renamed-legacy",E,{level:"warning",autofix:(w=this,()=>{let{name:O}=w;w.tokens.name.value=m.get(O),O==="TreatNullAs"&&(w.params.tokens={})})})}var w;for(let E of this.arguments)yield*E.validate(f)}write(f){return f.ts.wrap([f.ts.trivia(this.tokens.name.trivia),f.ts.extendedAttribute(f.ts.wrap([f.ts.extendedAttributeReference(this.name),this.params.write(f)])),f.token(this.tokens.separator)])}}class b extends c{static parse(f){let y={};y.open=f.consume("[");let w=new b({source:f.source,tokens:y});return y.open?(w.push(...L(f,{parser:g.parse,listName:"extended attribute"})),y.close=f.consume("]")||f.error("Expected a closing token for the extended attribute list"),w.length||(f.unconsume(y.close.index),f.error("An extended attribute list must not be empty")),f.probe("[")&&f.error("Illegal double extended attribute lists, consider merging them"),w):w}*validate(f){for(let y of this)yield*y.validate(f)}write(f){return this.length?f.ts.wrap([f.token(this.tokens.open),...this.map((y)=>y.write(f)),f.token(this.tokens.close)]):""}}function j(f,y){let w=f.consume("?");w&&(y.tokens.nullable=w),f.probe("?")&&f.error("Can't nullable more than once")}function v(f,y){let w=function(E,O){let I=E.consume("FrozenArray","ObservableArray","Promise","async_sequence","sequence","record");if(!I)return;let q=ee(new P({source:E.source,tokens:{base:I}}));switch(q.tokens.open=E.consume("<")||E.error(`No opening bracket after ${I.value}`),I.value){case"Promise":{E.probe("[")&&E.error("Promise type cannot have extended attribute");let Z=se(E,O)||E.error("Missing Promise subtype");q.subtype.push(Z);break}case"async_sequence":case"sequence":case"FrozenArray":case"ObservableArray":{let Z=ne(E,O)||E.error(`Missing ${I.value} subtype`);q.subtype.push(Z);break}case"record":{E.probe("[")&&E.error("Record key cannot have extended attribute");let Z=E.consume(...Ge)||E.error(`Record key must be one of: ${Ge.join(", ")}`),oe=new P({source:E.source,tokens:{base:Z}});oe.tokens.separator=E.consume(",")||E.error("Missing comma after record key type"),oe.type=O;let fe=ne(E,O)||E.error("Error parsing generic type record");q.subtype.push(oe,fe);break}}return q.idlType||E.error(`Error parsing generic type ${I.value}`),q.tokens.close=E.consume(">")||E.error(`Missing closing bracket after ${I.value}`),q.this}(f,y)||de(f);if(!w){let E=f.consumeKind("identifier")||f.consume(...Ge,...Me);if(!E)return;w=new P({source:f.source,tokens:{base:E}}),f.probe("<")&&f.error(`Unsupported generic type ${E.value}`)}return w.generic==="Promise"&&f.probe("?")&&f.error("Promise type cannot be nullable"),w.type=y||null,j(f,w),w.nullable&&w.idlType==="any"&&f.error("Type `any` cannot be made nullable"),w}class P extends o{static parse(f,y){return v(f,y)||function(w,E){let O={};if(O.open=w.consume("("),!O.open)return;let I=ee(new P({source:w.source,tokens:O}));for(I.type=E||null;;){let q=ne(w,E)||w.error("No type after open parenthesis or 'or' in union type");q.idlType==="any"&&w.error("Type `any` cannot be included in a union type"),q.generic==="Promise"&&w.error("Type `Promise` cannot be included in a union type"),I.subtype.push(q);let Z=w.consume("or");if(!Z)break;q.tokens.separator=Z}return I.idlType.length<2&&w.error("At least two types are expected in a union type but found less"),O.close=w.consume(")")||w.error("Unterminated union type"),j(w,I),I.this}(f,y)}constructor({source:f,tokens:y}){super({source:f,tokens:y}),Object.defineProperty(this,"subtype",{value:[],writable:!0}),this.extAttrs=new b({source:f,tokens:{}})}get generic(){return this.subtype.length&&this.tokens.base?this.tokens.base.value:""}get nullable(){return Boolean(this.tokens.nullable)}get union(){return Boolean(this.subtype.length)&&!this.tokens.base}get idlType(){if(this.subtype.length)return this.subtype;return C([this.tokens.prefix,this.tokens.base,this.tokens.postfix].filter((f)=>f).map((f)=>f.value).join(" "))}*validate(f){if(yield*this.extAttrs.validate(f),this.idlType==="BufferSource")for(let O of[this.extAttrs,this.parent?.extAttrs])for(let I of O){if(I.name!=="AllowShared")continue;let q="`[AllowShared] BufferSource` is now replaced with AllowSharedBufferSource.";yield s(this.tokens.base,this,"migrate-allowshared",q,{autofix:S(this,I,O)})}if(this.idlType==="void")yield s(this.tokens.base,this,"replace-void","`void` is now replaced by `undefined`. Refer to the [relevant GitHub issue](https://github.com/whatwg/webidl/issues/60) for more information.",{autofix:(y=this,()=>{y.tokens.base.value="undefined"})});var y;let w=!this.union&&f.unique.get(this.idlType),E=this.union?this:w&&w.type==="typedef"?w.idlType:void 0;if(E&&this.nullable){let{reference:O}=i(E,f)||{};if(O){let I=(this.union?O:this).tokens.base;yield s(I,this,"no-nullable-union-dict","Nullable union cannot include a dictionary type.")}}else for(let O of this.subtype)yield*O.validate(f)}write(f){return f.ts.wrap([this.extAttrs.write(f),(()=>{if(this.union||this.generic)return f.ts.wrap([f.token(this.tokens.base,f.ts.generic),f.token(this.tokens.open),...this.subtype.map((O)=>O.write(f)),f.token(this.tokens.close)]);let y=this.tokens.prefix||this.tokens.base,w=this.tokens.prefix?[this.tokens.prefix.value,f.ts.trivia(this.tokens.base.trivia)]:[],E=f.reference(f.ts.wrap([...w,this.tokens.base.value,f.token(this.tokens.postfix)]),{unescaped:this.idlType,context:this});return f.ts.wrap([f.ts.trivia(y.trivia),E])})(),f.token(this.tokens.nullable),f.token(this.tokens.separator)])}}function S(f,y,w){return()=>{let E=w.indexOf(y);w.splice(E,1),!w.length&&f.tokens.base.trivia.match(/^\s$/)&&(f.tokens.base.trivia=""),f.tokens.base.value="AllowSharedBufferSource"}}class _ extends o{static parse(f){let y=f.consume("=");if(!y)return null;let w=G(f)||f.consumeKind("string")||f.consume("null","[","{")||f.error("No value for default"),E=[w];if(w.value==="["){let O=f.consume("]")||f.error("Default sequence value must be empty");E.push(O)}else if(w.value==="{"){let O=f.consume("}")||f.error("Default dictionary value must be empty");E.push(O)}return new _({source:f.source,tokens:{assign:y},expression:E})}constructor({source:f,tokens:y,expression:w}){super({source:f,tokens:y}),w.parent=this,Object.defineProperty(this,"expression",{value:w})}get type(){return te(this.expression[0]).type}get value(){return te(this.expression[0]).value}get negative(){return te(this.expression[0]).negative}write(f){return f.ts.wrap([f.token(this.tokens.assign),...this.expression.map((y)=>f.token(y))])}}class N extends o{static parse(f){let y=f.position,w={},E=ee(new N({source:f.source,tokens:w}));return E.extAttrs=b.parse(f),w.optional=f.consume("optional"),E.idlType=ne(f,"argument-type"),E.idlType?(w.optional||(w.variadic=f.consume("...")),w.name=f.consumeKind("identifier")||f.consume(...X),w.name?(E.default=w.optional?_.parse(f):null,E.this):f.unconsume(y)):f.unconsume(y)}get type(){return"argument"}get optional(){return!!this.tokens.optional}get variadic(){return!!this.tokens.variadic}get name(){return C(this.tokens.name.value)}*validate(f){yield*this.extAttrs.validate(f),yield*this.idlType.validate(f);let y=i(this.idlType,f,{useNullableInner:!0});if(y){if(this.idlType.nullable)yield s(this.tokens.name,this,"no-nullable-dict-arg","Dictionary arguments cannot be nullable.");else if(this.optional){if(!this.default)yield s(this.tokens.name,this,"dict-arg-default","Optional dictionary arguments must have a default value of `{}`.",{autofix:F(this)})}else if(this.parent&&!a(y.dictionary,f)&&function(E){let O=E.parent.arguments||E.parent.list,I=O.indexOf(E);return!O.slice(I+1).some((Z)=>!Z.optional)}(this))yield s(this.tokens.name,this,"dict-arg-optional","Dictionary argument must be optional if it has no required fields",{autofix:(w=this,()=>{let O=pe(w.idlType);w.tokens.optional={...O,type:"optional",value:"optional"},O.trivia=" ",F(w)()})})}var w}write(f){return f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.optional),f.ts.type(this.idlType.write(f)),f.token(this.tokens.variadic),f.name_token(this.tokens.name,{data:this}),this.default?this.default.write(f):"",f.token(this.tokens.separator)])}}function F(f){return()=>{f.default=_.parse(new be(" = {}"))}}class K extends o{static parse(f,{special:y,regular:w}={}){let E={special:y},O=ee(new K({source:f.source,tokens:E}));return y&&y.value==="stringifier"&&(E.termination=f.consume(";"),E.termination)?(O.arguments=[],O):(y||w||(E.special=f.consume("getter","setter","deleter")),O.idlType=se(f)||f.error("Missing return type"),E.name=f.consumeKind("identifier")||f.consume("includes"),E.open=f.consume("(")||f.error("Invalid operation"),O.arguments=ae(f),E.close=f.consume(")")||f.error("Unterminated operation"),E.termination=f.consume(";")||f.error("Unterminated operation, expected `;`"),O.this)}get type(){return"operation"}get name(){let{name:f}=this.tokens;return f?C(f.value):""}get special(){return this.tokens.special?this.tokens.special.value:""}*validate(f){if(yield*this.extAttrs.validate(f),!this.name&&["","static"].includes(this.special))yield s(this.tokens.open,this,"incomplete-op","Regular or static operations must have both a return type and an identifier.");if(this.idlType){if(this.idlType.generic==="async_sequence")yield s(this.idlType.tokens.base,this,"async-sequence-idl-to-js","async_sequence types cannot be returned by an operation.");yield*this.idlType.validate(f)}for(let y of this.arguments)yield*y.validate(f)}write(f){let{parent:y}=this,w=this.idlType?[f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this,parent:y}),f.token(this.tokens.open),f.ts.wrap(this.arguments.map((E)=>E.write(f))),f.token(this.tokens.close)]:[];return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),this.tokens.name?f.token(this.tokens.special):f.token(this.tokens.special,f.ts.nameless,{data:this,parent:y}),...w,f.token(this.tokens.termination)]),{data:this,parent:y})}}class J extends o{static parse(f,{special:y,noInherit:w=!1,readonly:E=!1}={}){let O=f.position,I={special:y},q=ee(new J({source:f.source,tokens:I}));if(y||w||(I.special=f.consume("inherit")),q.special==="inherit"&&f.probe("readonly")&&f.error("Inherited attributes cannot be read-only"),I.readonly=f.consume("readonly"),E&&!I.readonly&&f.probe("attribute")&&f.error("Attributes must be readonly in this context"),I.base=f.consume("attribute"),I.base)return q.idlType=ne(f,"attribute-type")||f.error("Attribute lacks a type"),I.name=f.consumeKind("identifier")||f.consume("async","required")||f.error("Attribute lacks a name"),I.termination=f.consume(";")||f.error("Unterminated attribute, expected `;`"),q.this;f.unconsume(O)}get type(){return"attribute"}get special(){return this.tokens.special?this.tokens.special.value:""}get readonly(){return!!this.tokens.readonly}get name(){return C(this.tokens.name.value)}*validate(f){if(yield*this.extAttrs.validate(f),yield*this.idlType.validate(f),["async_sequence","sequence","record"].includes(this.idlType.generic)){let y=`Attributes cannot accept ${this.idlType.generic} types.`;yield s(this.tokens.name,this,"attr-invalid-type",y)}{let{reference:y}=i(this.idlType,f)||{};if(y){let w=(this.idlType.union?y:this.idlType).tokens.base;yield s(w,this,"attr-invalid-type","Attributes cannot accept dictionary types.")}}if(this.readonly&&function(y,w){if(y.union)return!1;if(y.extAttrs.some((O)=>O.name==="EnforceRange"))return!0;let E=w.unique.get(y.idlType);return E?.type==="typedef"&&E.idlType.extAttrs.some((O)=>O.name==="EnforceRange")}(this.idlType,f)){let y=this.idlType.tokens.base;yield s(y,this,"attr-invalid-type","Readonly attributes cannot accept [EnforceRange] extended attribute.")}}write(f){let{parent:y}=this;return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.special),f.token(this.tokens.readonly),f.token(this.tokens.base),f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this,parent:y}),f.token(this.tokens.termination)]),{data:this,parent:y})}}function C(f){return f.startsWith("_")?f.slice(1):f}function L(f,{parser:y,allowDangler:w,listName:E="list"}){let O=y(f);if(!O)return[];O.tokens.separator=f.consume(",");let I=[O];for(;O.tokens.separator;){let q=y(f);if(!q){w||f.error(`Trailing comma in ${E}`);break}if(q.tokens.separator=f.consume(","),I.push(q),!q.tokens.separator)break}return I}function G(f){return f.consumeKind("decimal","integer")||f.consume("true","false","Infinity","-Infinity","NaN")}function te({type:f,value:y}){switch(f){case"decimal":case"integer":return{type:"number",value:y};case"string":return{type:"string",value:y.slice(1,-1)}}switch(y){case"true":case"false":return{type:"boolean",value:y==="true"};case"Infinity":case"-Infinity":return{type:"Infinity",negative:y.startsWith("-")};case"[":return{type:"sequence",value:[]};case"{":return{type:"dictionary"};default:return{type:y}}}function de(f){let{source:y}=f,w=function(){let O=f.consume("unsigned"),I=f.consume("short","long");if(I){let q=f.consume("long");return new P({source:y,tokens:{prefix:O,base:I,postfix:q}})}O&&f.error("Failed to parse integer type")}()||function(){let O=f.consume("unrestricted"),I=f.consume("float","double");if(I)return new P({source:y,tokens:{prefix:O,base:I}});O&&f.error("Failed to parse float type")}();if(w)return w;let E=f.consume("bigint","boolean","byte","octet","undefined");return E?new P({source:y,tokens:{base:E}}):void 0}function ae(f){return L(f,{parser:N.parse,listName:"arguments list"})}function ne(f,y){let w=b.parse(f),E=P.parse(f,y);return E&&(ee(E).extAttrs=w),E}function se(f,y){let w=P.parse(f,y||"return-type");if(w)return w;let E=f.consume("void");if(E){let O=new P({source:f.source,tokens:{base:E}});return O.type="return-type",O}}function xe(f){let y=f.consume("stringifier");if(!y)return;return J.parse(f,{special:y})||K.parse(f,{special:y})||f.error("Unterminated stringifier")}function z(f){let y=f.split(`
612
- `);if(y.length){let w=y[y.length-1].match(/^\s+/);if(w)return w[0]}return""}function ye(f){return()=>{if(f.extAttrs.length){let y=new be("Exposed=Window,"),w=g.parse(y);w.tokens.separator=y.consume(",");let E=f.extAttrs[0];/^\s/.test(E.tokens.name.trivia)||(E.tokens.name.trivia=` ${E.tokens.name.trivia}`),f.extAttrs.unshift(w)}else{ee(f).extAttrs=b.parse(new be("[Exposed=Window]"));let y=f.tokens.base.trivia;f.extAttrs.tokens.open.trivia=y,f.tokens.base.trivia=`
613
- ${z(y)}`}}}function pe(f){if(f.extAttrs.length)return f.extAttrs.tokens.open;if(f.type==="operation"&&!f.special)return pe(f.idlType);return Object.values(f.tokens).sort((y,w)=>y.index-w.index)[0]}function ee(f,y){if(y||(y=f),!f)return f;return new Proxy(f,{get(w,E){let O=w[E];return Array.isArray(O)&&E!=="source"?ee(O,w):O},set(w,E,O){if(w[E]=O,!O)return!0;if(Array.isArray(O))for(let I of O)I.parent!==void 0&&(I.parent=y);else O.parent!==void 0&&(O.parent=y);return!0}})}let Qe={decimal:/-?(?=[0-9]*\.|[0-9]+[eE])(([0-9]+\.[0-9]*|[0-9]*\.[0-9]+)([Ee][-+]?[0-9]+)?|[0-9]+[Ee][-+]?[0-9]+)/y,integer:/-?(0([Xx][0-9A-Fa-f]+|[0-7]*)|[1-9][0-9]*)/y,identifier:/[_-]?[A-Za-z][0-9A-Z_a-z-]*/y,string:/"[^"]*"/y,whitespace:/[\t\n\r ]+/y,comment:/\/\/.*|\/\*[\s\S]*?\*\//y,other:/[^\t\n\r 0-9A-Za-z]/y},Me=["ArrayBuffer","SharedArrayBuffer","DataView","Int8Array","Int16Array","Int32Array","Uint8Array","Uint16Array","Uint32Array","Uint8ClampedArray","BigInt64Array","BigUint64Array","Float16Array","Float32Array","Float64Array","any","object","symbol"],Ge=["ByteString","DOMString","USVString"],X=["async","attribute","callback","const","constructor","deleter","dictionary","enum","getter","includes","inherit","interface","iterable","maplike","namespace","partial","required","setlike","setter","static","stringifier","typedef","unrestricted"],Bt=["-Infinity","FrozenArray","Infinity","NaN","ObservableArray","Promise","async_iterable","async_sequence","bigint","boolean","byte","double","false","float","long","mixin","null","octet","optional","or","readonly","record","sequence","short","true","undefined","unsigned","void"].concat(X,Ge,Me),Et=["(",")",",","...",":",";","<","=",">","?","*","[","]","{","}"],ce=["_constructor","toString","_toString"];class be{constructor(f){this.source=function(y){let w=[],E=0,O="",I=1,q=0;for(;E<y.length;){let oe=y.charAt(E),fe=-1;if(/[\t\n\r ]/.test(oe)?fe=Z("whitespace",{noFlushTrivia:!0}):oe==="/"&&(fe=Z("comment",{noFlushTrivia:!0})),fe!==-1){let Oe=w.pop().value;I+=(Oe.match(/\n/g)||[]).length,O+=Oe,q-=1}else if(/[-0-9.A-Z_a-z]/.test(oe)){if(fe=Z("decimal"),fe===-1&&(fe=Z("integer")),fe===-1){fe=Z("identifier");let Oe=w.length-1,Te=w[Oe];if(fe!==-1){if(ce.includes(Te.value)){let zt=`${C(Te.value)} is a reserved identifier and must not be used.`;throw new Fe(r(w,Oe,null,zt))}Bt.includes(Te.value)&&(Te.type="inline")}}}else oe==='"'&&(fe=Z("string"));for(let Oe of Et)if(y.startsWith(Oe,E)){w.push({type:"inline",value:Oe,trivia:O,line:I,index:q}),O="",E+=Oe.length,fe=E;break}if(fe===-1&&(fe=Z("other")),fe===-1)throw Error("Token stream not progressing");E=fe,q+=1}return w.push({type:"eof",value:"",trivia:O,line:I,index:q}),w;function Z(oe,{noFlushTrivia:fe}={}){let Oe=Qe[oe];Oe.lastIndex=E;let Te=Oe.exec(y);return Te?(w.push({type:oe,value:Te[0],trivia:O,line:I,index:q}),fe||(O=""),Oe.lastIndex):-1}}(f),this.position=0}error(f){throw new Fe(r(this.source,this.position,this.current,f))}probeKind(f){return this.source.length>this.position&&this.source[this.position].type===f}probe(f){return this.probeKind("inline")&&this.source[this.position].value===f}consumeKind(...f){for(let y of f){if(!this.probeKind(y))continue;let w=this.source[this.position];return this.position++,w}}consume(...f){if(!this.probeKind("inline"))return;let y=this.source[this.position];for(let w of f)if(y.value===w)return this.position++,y}consumeIdentifier(f){if(this.probeKind("identifier")&&this.source[this.position].value===f)return this.consumeKind("identifier")}unconsume(f){this.position=f}}class Fe extends Error{constructor({message:f,bareMessage:y,context:w,line:E,sourceName:O,input:I,tokens:q}){super(f),this.name="WebIDLParseError",this.bareMessage=y,this.context=w,this.line=E,this.sourceName=O,this.input=I,this.tokens=q}}class Le extends l{static parse(f){let y=f.consumeKind("string");if(y)return new Le({source:f.source,tokens:{value:y}})}get type(){return"enum-value"}get value(){return super.value.slice(1,-1)}write(f){let{parent:y}=this;return f.ts.wrap([f.ts.trivia(this.tokens.value.trivia),f.ts.definition(f.ts.wrap(['"',f.ts.name(this.value,{data:this,parent:y}),'"']),{data:this,parent:y}),f.token(this.tokens.separator)])}}class ot extends o{static parse(f){let y={};if(y.base=f.consume("enum"),!y.base)return;y.name=f.consumeKind("identifier")||f.error("No name for enum");let w=ee(new ot({source:f.source,tokens:y}));return f.current=w.this,y.open=f.consume("{")||f.error("Bodyless enum"),w.values=L(f,{parser:Le.parse,allowDangler:!0,listName:"enumeration"}),f.probeKind("string")&&f.error("No comma between enum values"),y.close=f.consume("}")||f.error("Unexpected value in enum"),w.values.length||f.error("No value in enum"),y.termination=f.consume(";")||f.error("No semicolon after enum"),w.this}get type(){return"enum"}get name(){return C(this.tokens.name.value)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base),f.name_token(this.tokens.name,{data:this}),f.token(this.tokens.open),f.ts.wrap(this.values.map((y)=>y.write(f))),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this})}}class Nr extends o{static parse(f){let y=f.consumeKind("identifier");if(!y)return;let w={target:y};if(w.includes=f.consume("includes"),w.includes)return w.mixin=f.consumeKind("identifier")||f.error("Incomplete includes statement"),w.termination=f.consume(";")||f.error("No terminating ; for includes statement"),new Nr({source:f.source,tokens:w});f.unconsume(y.index)}get type(){return"includes"}get target(){return C(this.tokens.target.value)}get includes(){return C(this.tokens.mixin.value)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.reference_token(this.tokens.target,this),f.token(this.tokens.includes),f.reference_token(this.tokens.mixin,this),f.token(this.tokens.termination)]),{data:this})}}class nr extends o{static parse(f){let y={},w=ee(new nr({source:f.source,tokens:y}));if(y.base=f.consume("typedef"),y.base)return w.idlType=ne(f,"typedef-type")||f.error("Typedef lacks a type"),y.name=f.consumeKind("identifier")||f.error("Typedef lacks a name"),f.current=w.this,y.termination=f.consume(";")||f.error("Unterminated typedef, expected `;`"),w.this}get type(){return"typedef"}get name(){return C(this.tokens.name.value)}*validate(f){yield*this.idlType.validate(f)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base),f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this}),f.token(this.tokens.termination)]),{data:this})}}class Xs extends o{static parse(f,y){let w={base:y},E=ee(new Xs({source:f.source,tokens:w}));return w.name=f.consumeKind("identifier")||f.error("Callback lacks a name"),f.current=E.this,w.assign=f.consume("=")||f.error("Callback lacks an assignment"),E.idlType=se(f)||f.error("Callback lacks a return type"),w.open=f.consume("(")||f.error("Callback lacks parentheses for arguments"),E.arguments=ae(f),w.close=f.consume(")")||f.error("Unterminated callback"),w.termination=f.consume(";")||f.error("Unterminated callback, expected `;`"),E.this}get type(){return"callback"}get name(){return C(this.tokens.name.value)}*validate(f){yield*this.extAttrs.validate(f);for(let y of this.arguments)if(yield*y.validate(f),y.idlType.generic==="async_sequence")yield s(y.tokens.name,y,"async-sequence-idl-to-js","async_sequence types cannot be returned as a callback argument.");yield*this.idlType.validate(f)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base),f.name_token(this.tokens.name,{data:this}),f.token(this.tokens.assign),f.ts.type(this.idlType.write(f)),f.token(this.tokens.open),...this.arguments.map((y)=>y.write(f)),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this})}}class pt extends o{static parse(f,y,{inheritable:w,allowedMembers:E}){let{tokens:O,type:I}=y;for(O.name=f.consumeKind("identifier")||f.error(`Missing name in ${I}`),f.current=y,y=ee(y),w&&Object.assign(O,function(q){let Z=q.consume(":");return Z?{colon:Z,inheritance:q.consumeKind("identifier")||q.error("Inheritance lacks a type")}:{}}(f)),O.open=f.consume("{")||f.error(`Bodyless ${I}`),y.members=[];;){if(O.close=f.consume("}"),O.close)return O.termination=f.consume(";")||f.error(`Missing semicolon after ${I}`),y.this;let q=b.parse(f),Z;for(let[oe,...fe]of E)if(Z=ee(oe(f,...fe)),Z)break;Z||f.error("Unknown member"),Z.extAttrs=q,y.members.push(Z.this)}}get partial(){return!!this.tokens.partial}get name(){return C(this.tokens.name.value)}get inheritance(){return this.tokens.inheritance?C(this.tokens.inheritance.value):null}*validate(f){for(let y of this.members)y.validate&&(yield*y.validate(f))}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.callback),f.token(this.tokens.partial),f.token(this.tokens.base),f.token(this.tokens.mixin),f.name_token(this.tokens.name,{data:this}),(()=>this.tokens.inheritance?f.ts.wrap([f.token(this.tokens.colon),f.ts.trivia(this.tokens.inheritance.trivia),f.ts.inheritance(f.reference(this.tokens.inheritance.value,{context:this}))]):"")(),f.token(this.tokens.open),f.ts.wrap(this.members.map((y)=>y.write(f))),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this})}}class Pn extends o{static parse(f){let y={};if(y.base=f.consume("const"),!y.base)return;let w=de(f);if(!w){let O=f.consumeKind("identifier")||f.error("Const lacks a type");w=new P({source:f.source,tokens:{base:O}})}f.probe("?")&&f.error("Unexpected nullable constant type"),w.type="const-type",y.name=f.consumeKind("identifier")||f.error("Const lacks a name"),y.assign=f.consume("=")||f.error("Const lacks value assignment"),y.value=G(f)||f.error("Const lacks a value"),y.termination=f.consume(";")||f.error("Unterminated const, expected `;`");let E=new Pn({source:f.source,tokens:y});return ee(E).idlType=w,E}get type(){return"const"}get name(){return C(this.tokens.name.value)}get value(){return te(this.tokens.value)}write(f){let{parent:y}=this;return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base),f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this,parent:y}),f.token(this.tokens.assign),f.token(this.tokens.value),f.token(this.tokens.termination)]),{data:this,parent:y})}}class It extends o{static parse(f){let y=f.position,w=ee(new It({source:f.source,tokens:{}})),{tokens:E}=w;if(E.readonly=f.consume("readonly"),E.readonly||(E.async=f.consume("async")),E.base=E.readonly?f.consume("maplike","setlike"):E.async?f.consume("iterable"):f.consume("iterable","async_iterable","maplike","setlike"),!E.base)return void f.unconsume(y);let{type:O}=w,I=O==="maplike",q=I||O==="iterable"||O==="async_iterable",Z=O==="async_iterable"||w.async&&O==="iterable";E.open=f.consume("<")||f.error(`Missing less-than sign \`<\` in ${O} declaration`);let oe=ne(f)||f.error(`Missing a type argument in ${O} declaration`);return w.idlType=[oe],w.arguments=[],q&&(oe.tokens.separator=f.consume(","),oe.tokens.separator?w.idlType.push(ne(f)):I&&f.error(`Missing second type argument in ${O} declaration`)),E.close=f.consume(">")||f.error(`Missing greater-than sign \`>\` in ${O} declaration`),f.probe("(")&&(Z?(E.argsOpen=f.consume("("),w.arguments.push(...ae(f)),E.argsClose=f.consume(")")||f.error("Unterminated async iterable argument list")):f.error("Arguments are only allowed for `async iterable`")),E.termination=f.consume(";")||f.error(`Missing semicolon after ${O} declaration`),w.this}get type(){return this.tokens.base.value}get readonly(){return!!this.tokens.readonly}get async(){return!!this.tokens.async}*validate(f){if(this.async&&this.type==="iterable")yield s(this.tokens.async,this,"obsolete-async-iterable-syntax","`async iterable` is now changed to `async_iterable`.",{autofix:(y=this,()=>{let E=y.tokens.async;y.tokens.base={...E,type:"async_iterable",value:"async_iterable"},delete y.tokens.async})});var y;for(let w of this.idlType)yield*w.validate(f);for(let w of this.arguments)yield*w.validate(f)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.readonly),f.token(this.tokens.async),f.token(this.tokens.base,f.ts.generic),f.token(this.tokens.open),f.ts.wrap(this.idlType.map((y)=>y.write(f))),f.token(this.tokens.close),f.token(this.tokens.argsOpen),f.ts.wrap(this.arguments.map((y)=>y.write(f))),f.token(this.tokens.argsClose),f.token(this.tokens.termination)]),{data:this,parent:this.parent})}}class Fo extends o{static parse(f){let y=f.consume("constructor");if(!y)return;let w={base:y};w.open=f.consume("(")||f.error("No argument list in constructor");let E=ae(f);w.close=f.consume(")")||f.error("Unterminated constructor"),w.termination=f.consume(";")||f.error("No semicolon after constructor");let O=new Fo({source:f.source,tokens:w});return ee(O).arguments=E,O}get type(){return"constructor"}*validate(f){for(let y of this.arguments)yield*y.validate(f)}write(f){let{parent:y}=this;return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base,f.ts.nameless,{data:this,parent:y}),f.token(this.tokens.open),f.ts.wrap(this.arguments.map((w)=>w.write(f))),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this,parent:y})}}function ns(f){let y=f.consume("static");if(!y)return;return J.parse(f,{special:y})||K.parse(f,{special:y})||f.error("No body in static member")}class rr extends pt{static parse(f,y,{extMembers:w=[],partial:E=null}={}){let O={partial:E,base:y};return pt.parse(f,new rr({source:f.source,tokens:O}),{inheritable:!E,allowedMembers:[...w,[Pn.parse],[Fo.parse],[ns],[xe],[It.parse],[J.parse],[K.parse]]})}get type(){return"interface"}*validate(f){if(yield*this.extAttrs.validate(f),!this.partial&&this.extAttrs.every((w)=>w.name!=="Exposed"))yield s(this.tokens.name,this,"require-exposed","Interfaces must have `[Exposed]` extended attribute. To fix, add, for example, `[Exposed=Window]`. Please also consider carefully if your interface should also be exposed in a Worker scope. Refer to the [WebIDL spec section on Exposed](https://heycam.github.io/webidl/#Exposed) for more information.",{autofix:ye(this)});let y=this.extAttrs.filter((w)=>w.name==="Constructor");for(let w of y)yield s(w.tokens.name,this,"constructor-member","Constructors should now be represented as a `constructor()` operation on the interface instead of `[Constructor]` extended attribute. Refer to the [WebIDL spec section on constructor operations](https://heycam.github.io/webidl/#idl-constructors) for more information.",{autofix:ya(this,w)});if(this.extAttrs.some((w)=>w.name==="Global")){let w=this.extAttrs.filter((O)=>O.name==="LegacyFactoryFunction");for(let O of w)yield s(O.tokens.name,this,"no-constructible-global","Interfaces marked as `[Global]` cannot have factory functions.");let E=this.members.filter((O)=>O.type==="constructor");for(let O of E)yield s(O.tokens.base,this,"no-constructible-global","Interfaces marked as `[Global]` cannot have constructors.")}yield*super.validate(f),this.partial||(yield*function*(w,E){let O=function(fe){let Oe=oe(fe);return{statics:new Set(Oe.filter((Te)=>Te.special==="static").map((Te)=>Te.name)),nonstatics:new Set(Oe.filter((Te)=>Te.special!=="static").map((Te)=>Te.name))}}(E),I=w.partials.get(E.name)||[],q=w.mixinMap.get(E.name)||[];for(let fe of[...I,...q]){let Oe=oe(fe),Te=Oe.filter((tn)=>tn.special==="static"),zt=Oe.filter((tn)=>tn.special!=="static");yield*Z(Te,O.statics,fe,E),yield*Z(zt,O.nonstatics,fe,E),Te.forEach((tn)=>O.statics.add(tn.name)),zt.forEach((tn)=>O.nonstatics.add(tn.name))}function*Z(fe,Oe,Te,zt){for(let tn of fe){let{name:ba}=tn;if(ba&&Oe.has(ba)){let Qf=`The ${tn.special==="static"?"static ":""}operation "${ba}" has already been defined for the base interface "${zt.name}" either in itself or in a mixin`;yield s(tn.tokens.name,Te,"no-cross-overload",Qf)}}}function oe(fe){return fe.members.filter(({type:Oe})=>Oe==="operation")}}(f,this))}}function ya(f,y){return f=ee(f),()=>{let w=z(f.extAttrs.tokens.open.trivia),E=f.members.length?z(pe(f.members[0]).trivia):function(Oe){let Te=z(Oe),zt=Te.includes("\t")?"\t":" ";return Te+zt}(w),O=Fo.parse(new be(`
614
- ${E}constructor();`));O.extAttrs=new b({source:f.source,tokens:{}}),ee(O).arguments=y.arguments;let I=function(Oe,Te){let zt=Oe.slice().reverse().findIndex(Te);return zt===-1?zt:Oe.length-zt-1}(f.members,(Oe)=>Oe.type==="constructor");f.members.splice(I+1,0,O);let{close:q}=f.tokens;q.trivia.includes(`
615
- `)||(q.trivia+=`
616
- ${w}`);let{extAttrs:Z}=f,oe=Z.indexOf(y),fe=Z.splice(oe,1);Z.length?Z.length===oe?Z[oe-1].tokens.separator=void 0:Z[oe].tokens.name.trivia.trim()||(Z[oe].tokens.name.trivia=fe[0].tokens.name.trivia):Z.tokens.open=Z.tokens.close=void 0}}class Ys extends pt{static parse(f,y,{extMembers:w=[],partial:E}={}){let O={partial:E,base:y};if(O.mixin=f.consume("mixin"),O.mixin)return pt.parse(f,new Ys({source:f.source,tokens:O}),{allowedMembers:[...w,[Pn.parse],[xe],[J.parse,{noInherit:!0}],[K.parse,{regular:!0}]]})}get type(){return"interface mixin"}}class Lo extends o{static parse(f){let y={},w=ee(new Lo({source:f.source,tokens:y}));return w.extAttrs=b.parse(f),y.required=f.consume("required"),w.idlType=ne(f,"dictionary-type")||f.error("Dictionary member lacks a type"),y.name=f.consumeKind("identifier")||f.error("Dictionary member lacks a name"),w.default=_.parse(f),y.required&&w.default&&f.error("Required member must not have a default"),y.termination=f.consume(";")||f.error("Unterminated dictionary member, expected `;`"),w.this}get type(){return"field"}get name(){return C(this.tokens.name.value)}get required(){return!!this.tokens.required}*validate(f){yield*this.idlType.validate(f)}write(f){let{parent:y}=this;return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.required),f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this,parent:y}),this.default?this.default.write(f):"",f.token(this.tokens.termination)]),{data:this,parent:y})}}class Vo extends pt{static parse(f,{extMembers:y=[],partial:w}={}){let E={partial:w};if(E.base=f.consume("dictionary"),E.base)return pt.parse(f,new Vo({source:f.source,tokens:E}),{inheritable:!w,allowedMembers:[...y,[Lo.parse]]})}get type(){return"dictionary"}}class Zs extends pt{static parse(f,{extMembers:y=[],partial:w}={}){let E={partial:w};if(E.base=f.consume("namespace"),E.base)return pt.parse(f,new Zs({source:f.source,tokens:E}),{allowedMembers:[...y,[J.parse,{noInherit:!0,readonly:!0}],[Pn.parse],[K.parse,{regular:!0}]]})}get type(){return"namespace"}*validate(f){if(!this.partial&&this.extAttrs.every((y)=>y.name!=="Exposed"))yield s(this.tokens.name,this,"require-exposed","Namespaces must have [Exposed] extended attribute. To fix, add, for example, [Exposed=Window]. Please also consider carefully if your namespace should also be exposed in a Worker scope. Refer to the [WebIDL spec section on Exposed](https://heycam.github.io/webidl/#Exposed) for more information.",{autofix:ye(this)});yield*super.validate(f)}}class qo extends pt{static parse(f,y,{extMembers:w=[]}={}){let E={callback:y};if(E.base=f.consume("interface"),E.base)return pt.parse(f,new qo({source:f.source,tokens:E}),{allowedMembers:[...w,[Pn.parse],[K.parse,{regular:!0}]]})}get type(){return"callback interface"}}function Yf(f,y){let w=f.source;function E(oe){f.error(oe)}function O(...oe){return f.consume(...oe)}function I(oe){let fe=O("interface");if(fe)return Ys.parse(f,fe,{...oe,...y?.extensions?.mixin})||rr.parse(f,fe,{...oe,...y?.extensions?.interface})||E("Interface has no proper body")}function q(){if(y.productions)for(let oe of y.productions){let fe=oe(f);if(fe)return fe}return function(){let oe=O("callback");if(oe)return f.probe("interface")?qo.parse(f,oe,{...y?.extensions?.callbackInterface}):Xs.parse(f,oe)}()||I()||function(){let oe=O("partial");if(oe)return Vo.parse(f,{partial:oe,...y?.extensions?.dictionary})||I({partial:oe})||Zs.parse(f,{partial:oe,...y?.extensions?.namespace})||E("Partial doesn't apply to anything")}()||Vo.parse(f,y?.extensions?.dictionary)||ot.parse(f)||nr.parse(f)||Nr.parse(f)||Zs.parse(f,y?.extensions?.namespace)}let Z=function(){if(!w.length)return[];let oe=[];for(;;){let Oe=b.parse(f),Te=q();if(!Te){Oe.length&&E("Stray extended attributes");break}ee(Te).extAttrs=Oe,oe.push(Te)}let fe=u.parse(f);return y.concrete&&oe.push(fe),oe}();return f.position<w.length&&E("Unrecognised tokens"),Z}function Zf(f,y={}){let w=new be(f);return y.sourceName!==void 0&&(w.source.name=y.sourceName),Yf(w,y)}function Ot(f){return f}let Wo={wrap:(f)=>f.join(""),trivia:Ot,name:Ot,reference:Ot,type:Ot,generic:Ot,nameless:Ot,inheritance:Ot,definition:Ot,extendedAttribute:Ot,extendedAttributeReference:Ot};class xa{constructor(f){this.ts=Object.assign({},Wo,f)}reference(f,{unescaped:y,context:w}){return y||(y=f.startsWith("_")?f.slice(1):f),this.ts.reference(f,y,w)}token(f,y=Ot,...w){if(!f)return"";let E=y(f.value,...w);return this.ts.wrap([this.ts.trivia(f.trivia),E])}reference_token(f,y){return this.token(f,this.reference.bind(this),{context:y})}name_token(f,y){return this.token(f,this.ts.name,y)}identifier(f,y){return this.ts.wrap([this.reference_token(f.tokens.value,y),this.token(f.tokens.separator)])}}function Qs(f,{templates:y=Wo}={}){y=Object.assign({},Wo,y);let w=new xa(y);return y.wrap(f.map((E)=>E.write(w)))}function A(f,y){let w=new Map,E=f.filter((O)=>O.type==="includes");for(let O of E){let I=y.get(O.includes);if(!I)continue;let q=w.get(O.target);q?q.push(I):w.set(O.target,[I])}return w}function*H(f){let y=function(w){let E=new Map,O=new Set,I=new Map;for(let q of w)if(q.partial){let Z=I.get(q.name);Z?Z.push(q):I.set(q.name,[q])}else q.name&&(E.has(q.name)?O.add(q):E.set(q.name,q));return{all:w,unique:E,partials:I,duplicates:O,mixinMap:A(w,E),cache:{typedefIncludesDictionary:new WeakMap,dictionaryIncludesRequiredField:new WeakMap}}}(f);for(let w of y.all)w.validate&&(yield*w.validate(y));yield*function*({unique:w,duplicates:E}){for(let O of E){let{name:I}=O,q=`The name "${I}" of type "${w.get(I).type}" was already seen`;yield s(O.tokens.name,O,"no-duplicate",q)}}(y)}function U(f){return[...H((y=f,y.flat?y.flat():[].concat(...y)))];var y}return t})())});var n0=W(function(N7,t0){var __dirname="/home/runner/work/jx/jx/node_modules/@webref/idl",Yv=it("fs").promises,Wu=it("path"),Zv=Xv();class Qv{constructor(e,t){this.filename=t,this.shortname=Wu.basename(t,".idl"),this.path=Wu.join(e,t)}async text(){return await Yv.readFile(this.path,"utf8")}async parse(){let e=await this.text();return Zv.parse(e)}}async function e0({folder:e=__dirname}={}){let t={},n=await Yv.readdir(e);for(let r of n)if(r.endsWith(".idl")){let s=new Qv(e,r);t[s.shortname]=s}return t}async function hF(e){let t=await e0(e);for(let[n,r]of Object.entries(t))t[n]=await r.parse();return t}t0.exports={listAll:e0,parseAll:hF}});var r0,s0;var o0=T(()=>{r0={anyOf:[{additionalProperties:!1,description:"Two-way: `target` is the test, `value` the tag when it is truthy, `initial` the tag when it is not.",properties:{initial:{$ref:"#/$defs/TagName"},operator:{const:"?:",type:"string"},target:{$ref:"#/$defs/ExpressionOperand"},value:{$ref:"#/$defs/TagName"}},required:["operator","target","value","initial"],title:"?: — the tag when the test holds, and the tag when it does not"},{additionalProperties:!1,description:"Multiway: `target` is the discriminant, matched against case keys by its string form. "+"`default` is required — an element with no tag cannot exist.",properties:{cases:{additionalProperties:{$ref:"#/$defs/TagName"},type:"object"},default:{$ref:"#/$defs/TagName"},operator:{const:"switch",type:"string"},target:{$ref:"#/$defs/ExpressionOperand"}},required:["operator","target","cases","default"],title:"switch — one tag per discriminant value, with a required fallback"}],description:"A tag name chosen at element creation. Every branch resolves to a `TagName`, so the candidate set is enumerable without evaluating anything."},s0={anyOf:[{$ref:"#/$defs/TagName"},{additionalProperties:!1,properties:{$expression:{$ref:"#/$defs/TagExpression"}},required:["$expression"],type:"object"}]}});var i0;var a0=T(()=>{i0={description:"HTML element tag name or custom element name (must contain a hyphen per Web Components spec). "+"A NAME, never an expression: no `${…}` position in the pipeline evaluates a tagName. Use "+"`$switch`/`cases` to vary the element.",minLength:1,pattern:"^[a-zA-Z][a-zA-Z0-9._-]*$",type:"string"}});var c0,l0,u0;var f0=T(()=>{c0={oneOf:[{type:"string"},{$ref:"#/$defs/RefObject"}]},l0={oneOf:[{type:"boolean"},{$ref:"#/$defs/RefObject"}]},u0={oneOf:[{type:"number"},{$ref:"#/$defs/RefObject"}]}});var d0;var p0=T(()=>{d0={additionalProperties:!0,description:"A page-level <head> entry. Defines meta tags, link tags, script tags, etc.",properties:{attributes:{additionalProperties:{oneOf:[{type:"string"},{type:"boolean"}]},type:"object"},children:{items:{$ref:"#/$defs/HeadEntry"},type:"array"},tagName:{type:"string"},textContent:{description:"Element content. An object is serialized to JSON inside the tag — that is how a "+'JSON-LD block (`<script type="application/ld+json">`) is authored.',oneOf:[{type:"string"},{type:"object"}]}},required:["tagName"],type:"object"}});var m0,h0;var g0=T(()=>{m0={description:"A CEM-compatible parameter definition for a function. Follows the Custom Elements Manifest Parameter shape.",properties:{default:{description:"Default value for the parameter."},description:{description:"Parameter documentation.",type:"string"},name:{description:"Parameter name.",type:"string"},optional:{description:"Whether the parameter is optional.",type:"boolean"},type:{description:"Parameter type (JSON Schema or CEM { text } format)."}},required:["name"],type:"object"},h0={description:"A CEM-compatible event definition. Describes a CustomEvent the function dispatches.",properties:{deprecated:{description:"Deprecation notice.",oneOf:[{type:"boolean"},{type:"string"}]},description:{description:"Event documentation.",type:"string"},name:{description:"Event name (e.g. 'task-toggled').",type:"string"},type:{description:"Event type (e.g. { text: 'CustomEvent' })."}},required:["name"],type:"object"}});var y0;var x0=T(()=>{y0={enum:["string","number","integer","boolean","array","object","null"],type:"string"}});var b0,$0,w0,S0,v0,E0,j0,P0,_0;var k0=T(()=>{b0={description:"Reference to a $defs type definition in the current component.",examples:["#/$defs/Count","#/$defs/TodoItem","#/$defs/Status"],pattern:String.raw`^#/\$defs/`,type:"string"},$0={description:"Reference to a state entry (runtime variable) in the current component.",examples:["#/state/count","#/state/addTask","#/state/items"],pattern:"^#/state/",type:"string"},w0={description:"Reference to an external Jx component file.",examples:["./card.json","https://cdn.example.com/button.json"],pattern:String.raw`^(\./|\.\./).*\.json$|^https?://`,type:"string"},S0={description:"Reference to a window or document global.",examples:["window#/currentUser","document#/appConfig"],pattern:"^(window|document)#/",type:"string"},v0={description:"Reference to a named state entry passed via $props from a parent component.",examples:["parent#/sharedState","parent#/theme"],pattern:"^parent#/",type:"string"},E0={description:"Reference to the current Array map iteration context.",examples:["$map/item","$map/index","$map/item/text","$map/item/done"],pattern:String.raw`^\$map/(item|index)(/.*)?$`,type:"string"},j0={oneOf:[{$ref:"#/$defs/InternalRef"},{$ref:"#/$defs/StateRef"},{$ref:"#/$defs/ExternalRef"},{$ref:"#/$defs/GlobalRef"},{$ref:"#/$defs/ParentRef"},{$ref:"#/$defs/MapRef"}],type:"string"},P0={additionalProperties:!1,description:"A $ref binding. Resolves to a state entry (reactive) or plain value (static).",properties:{$ref:{$ref:"#/$defs/AnyRef"}},required:["$ref"],type:"object"},_0={properties:{$props:{$ref:"#/$defs/PropsObject"},$ref:{$ref:"#/$defs/ExternalRef"}},required:["$ref"],type:"object"}});var Hu;var O0=T(()=>{Hu={additionalProperties:{anyOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/RefObject"},{$ref:"#/$defs/StyleObject"}]},description:"CSS style definition. camelCase property names follow CSSOM convention. Keys starting with :, ., &, or [ are treated as nested CSS selectors. Keys matching $media breakpoint names (or other @-prefixed at-rules) group nested rules. Nesting is recursive: selector and at-rule groups may nest to arbitrary depth "+"(e.g. breakpoint → selector → pseudo-class), mirroring the compiler's recursive emission. "+"An object carrying $ref is a reactive VALUE, and the runtime reads it as one. It also matches the nested-block branch vacuously, since a block admits a string under any key, which is why these branches are anyOf rather than oneOf. A DECLARATION at-rule (@font-face, @property, @position-try, @counter-style) may hold an ARRAY of blocks, which is that key written more than once, in order: an object's keys are "+"unique, so @font-face — the at-rule whose identity is not in its key — could not otherwise "+"state a family's second weight at all.",patternProperties:{"^@(font-face|property|position-try|counter-style)":{anyOf:[{$ref:"#/$defs/StyleObject"},{items:{$ref:"#/$defs/StyleObject"},minItems:1,type:"array"}]}},properties:{$description:{description:"Why this rule exists. Emitted as a comment by static builds, ignored at runtime.",type:"string"}},type:"object"}});var A0,R0;var C0=T(()=>{A0={additionalProperties:!1,description:"Dynamic mapped list. Re-renders when the items state entry changes.",properties:{$prototype:{const:"Array",type:"string"},filter:{$ref:"#/$defs/RefObject"},items:{oneOf:[{$ref:"#/$defs/RefObject"},{type:"array"}]},key:{additionalProperties:!1,description:"The identity of each rendered row: a $map/item pointer read per item. A row whose key survives a change keeps its DOM node and its effects across reorders, insertions and "+"removals; without a key, rows are keyed by index. $map/index is not a key — an index "+"names a position, not a row.",properties:{$ref:{pattern:String.raw`^\$map/item(/.+)?$`,type:"string"}},required:["$ref"],type:"object"},map:{$ref:"#/$defs/ElementDef"},sort:{$ref:"#/$defs/RefObject"}},required:["$prototype","items","map"],type:"object"},R0={description:"Array of child definitions — elements, text, or Array namespaces (dynamic lists) mixed "+"freely. A bare Array namespace (the whole children slot is one dynamic list) is also "+"accepted for backward compatibility, as is a ${…} template string that resolves at build "+"time to an array of child definitions.",oneOf:[{items:{anyOf:[{$ref:"#/$defs/ElementDef"},{$ref:"#/$defs/SwitchNode"},{$ref:"#/$defs/ArrayNamespace"},{type:"string"},{type:"number"}]},type:"array"},{$ref:"#/$defs/ArrayNamespace"},{description:"Computed children — a ${…} template that resolves at build time to an array of child "+'definitions (e.g. "${state.entry.$children}" for parsed content). A bare plain-text string is NOT a valid children value; text children must be array items.',pattern:String.raw`\$\{`,type:"string"}]}});var N0,T0,J0,I0,M0,sh;var D0=T(()=>{N0={additionalProperties:{oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{$ref:"#/$defs/RefObject"}]},description:"HTML attributes and ARIA attributes set via element.setAttribute().",type:"object"},T0={additionalProperties:{anyOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"array"},{type:"object"},{$ref:"#/$defs/RefObject"}]},description:"Explicit prop passing at a component boundary.",type:"object"},J0={oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"null"},{$ref:"#/$defs/RefObject"}]},I0={additionalProperties:!1,description:"Reactive $ref that drives which case to render: a state entry, or inside a mapped array's template the row's $map/item or $map/index (spec §14.1).",properties:{$ref:{oneOf:[{$ref:"#/$defs/StateRef"},{$ref:"#/$defs/MapRef"}],type:"string"}},required:["$ref"],type:"object"},M0={properties:{$switch:{$ref:"#/$defs/SwitchDef"},cases:{additionalProperties:{oneOf:[{$ref:"#/$defs/ElementDef"},{$ref:"#/$defs/ExternalComponentRef"}]},type:"object"},tagName:{$ref:"#/$defs/TagName"}},required:["$switch","cases"],type:"object"},sh={additionalProperties:{$ref:"#/$defs/ElementPropertyValue"},description:"A Jx element definition. Maps directly to a DOM element.",properties:{"$map/index":{$ref:"#/$defs/RefObject"},"$map/item":{$ref:"#/$defs/RefObject"},$props:{$ref:"#/$defs/PropsObject"},$ref:{$ref:"#/$defs/ExternalRef"},$switch:{$ref:"#/$defs/SwitchDef"},alt:{$ref:"#/$defs/StringOrRef"},attributes:{$ref:"#/$defs/AttributesObject"},cases:{additionalProperties:{oneOf:[{$ref:"#/$defs/ElementDef"},{$ref:"#/$defs/ExternalComponentRef"}]},description:"Switch cases for this element. Maps case values to element definitions or external component refs, rendered according to the reactive $switch discriminant.",type:"object"},checked:{$ref:"#/$defs/BoolOrRef"},children:{$ref:"#/$defs/ChildrenValue"},className:{$ref:"#/$defs/StringOrRef"},dir:{enum:["ltr","rtl","auto"],type:"string"},disabled:{$ref:"#/$defs/BoolOrRef"},hidden:{$ref:"#/$defs/BoolOrRef"},href:{$ref:"#/$defs/StringOrRef"},id:{type:"string"},innerHTML:{$ref:"#/$defs/StringOrRef"},innerText:{$ref:"#/$defs/StringOrRef"},lang:{$ref:"#/$defs/StringOrRef"},name:{$ref:"#/$defs/StringOrRef"},placeholder:{$ref:"#/$defs/StringOrRef"},selected:{$ref:"#/$defs/BoolOrRef"},src:{$ref:"#/$defs/StringOrRef"},style:{$ref:"#/$defs/StyleObject"},tabIndex:{$ref:"#/$defs/NumberOrRef"},tagName:{$ref:"#/$defs/ElementTagName"},textContent:{$ref:"#/$defs/StringOrRef"},title:{$ref:"#/$defs/StringOrRef"},type:{$ref:"#/$defs/StringOrRef"},value:{$ref:"#/$defs/StringOrRef"}},required:["tagName"],type:"object"}});var F0;var L0=T(()=>{F0={description:"A typed reactive state variable with explicit type and default value. The type property is a JSON Schema or $ref to a $defs type definition. The default property is the initial runtime value.",not:{required:["$prototype"]},properties:{$ref:{description:"Reference to a shared type definition.",type:"string"},attribute:{description:"Linked HTML attribute name for CEM extraction.",type:"string"},default:{description:"Initial state value."},deprecated:{description:"Deprecation notice for CEM extraction.",oneOf:[{type:"boolean"},{type:"string"}]},description:{type:"string"},examples:{type:"array"},reflects:{description:"Whether property changes reflect back to the HTML attribute.",type:"boolean"},type:{description:"JSON Schema type definition, $ref to a $defs type, or JSON Schema type string.",oneOf:[{type:"string"},{type:"object"}]}},required:["default"],type:"object"}});var V0;var q0=T(()=>{V0={additionalProperties:!1,description:'A function declaration. $prototype must be "Function". body (inline) and $src (external) are mutually exclusive; declaring both is an error. First parameter is always state (the reactive scope).',not:{required:["body","$src"]},properties:{$export:{description:"Named export in $src module. Defaults to the state key name.",type:"string"},$lazy:{description:"Load $src on first call instead of importing it up front. The function then returns a "+"promise, so it may only be called from a handler or lifecycle hook — never bound as a "+"computed value. Use it for code most visitors never reach.",type:"boolean"},$prototype:{const:"Function",type:"string"},$src:{description:"External module specifier. Mutually exclusive with body.",examples:["./counter.js","npm:@myorg/validators"],type:"string"},arguments:{description:"Legacy alias for parameters: bare string parameter names (state may be listed explicitly as the first name). Superseded by parameters.",examples:[["state","event"]],items:{type:"string"},type:"array"},body:{description:"Inline function body: a source string in erasable TypeScript, which plain JavaScript already is (spec §23.1; types are erased before it is analysed or run; first implicit parameter is state), or a structured statement array (spec §20) — explicit structured function declaration, analyzable by tooling and editable visually. The escalation ladder within the shape is structured statements → source string.",examples:["state.count++",'state.items.push({ id: Date.now(), text: "", done: false })','return state.score >= 90 ? "gold" : "silver"',"const input = event.target as HTMLInputElement; state.label = input.value",[{operator:"push",target:{$ref:"#/state/cart"},value:1},{dispatchEvent:"cart-changed",detail:{$ref:"#/state/cart"}}]],oneOf:[{type:"string"},{$ref:"#/$defs/StatementList"}]},description:{type:"string"},emits:{description:"Array of CEM-compatible Event objects this function dispatches. Used for CEM extraction and studio event discovery.",items:{$ref:"#/$defs/CemEvent"},type:"array"},name:{description:"Explicit function name. Defaults to the state key name.",type:"string"},parameters:{description:"Function parameters (after the implicit state parameter). Accepts CEM-compatible parameter objects or bare string names for backward compatibility.",examples:[["event"],[{name:"event",type:{text:"Event"}}],[{description:"Item identifier",name:"id",type:{text:"number"}}]],items:{oneOf:[{type:"string"},{$ref:"#/$defs/CemParameter"}]},type:"array"},type:{description:"Return type for tooling (JSON Schema or CEM { text } format)."}},required:["$prototype"],type:"object"}});var W0,H0;var U0=T(()=>{W0={description:"One statement of a structured function body. Either a bare expression node in statement position (a mutation like =/push, or a call — its result discarded unless captured by an assignment), an if/then/else branch (JSON Schema conditional keywords; if holds a pure expression, then/else hold statement lists), a $switch multiway branch (discriminant matched by string form against cases keys, like element-level $switch), a dispatchEvent statement (WHATWG DOM: dispatches a CustomEvent from the handler's current target, with CustomEventInit members detail/bubbles/composed), or the two WHATWG event verbs stopPropagation and preventDefault, each spelled as the member set to true.",oneOf:[{$ref:"#/$defs/ExpressionNode"},{additionalProperties:!1,properties:{else:{items:{$ref:"#/$defs/Statement"},type:"array"},if:{$ref:"#/$defs/ExpressionOperand"},then:{items:{$ref:"#/$defs/Statement"},type:"array"}},required:["if","then"],title:"if / then / else — conditional branch (JSON Schema keyword triple)",type:"object"},{additionalProperties:!1,properties:{$switch:{$ref:"#/$defs/ExpressionOperand"},cases:{additionalProperties:{items:{$ref:"#/$defs/Statement"},type:"array"},type:"object"},default:{items:{$ref:"#/$defs/Statement"},type:"array"}},required:["$switch","cases"],title:"$switch / cases — multiway branch (element-level convention, ECMA switch semantics)",type:"object"},{additionalProperties:!1,properties:{bubbles:{type:"boolean"},composed:{type:"boolean"},detail:{$ref:"#/$defs/ExpressionOperand"},dispatchEvent:{description:"The CustomEvent type to dispatch (WHATWG DOM dispatchEvent).",type:"string"}},required:["dispatchEvent"],title:"dispatchEvent — emit a CustomEvent (WHATWG naming, CustomEventInit members)",type:"object"},{additionalProperties:!1,properties:{stopPropagation:{const:!0,description:"Stop the handler's event at the current target (WHATWG DOM stopPropagation), so an ancestor's handler for the same event does not run. A body run without an event has nothing to stop."}},required:["stopPropagation"],title:"stopPropagation — stop the event here (WHATWG DOM)",type:"object"},{additionalProperties:!1,properties:{preventDefault:{const:!0,description:"Cancel the handler's event's default action (WHATWG DOM preventDefault): a link's navigation, a form's submission, a key's scroll."}},required:["preventDefault"],title:"preventDefault — cancel the event's default action (WHATWG DOM)",type:"object"}]},H0={description:"A structured function body: statements executed sequentially (one yielding a promise is awaited before the next, per ECMA async/await semantics).",items:{$ref:"#/$defs/Statement"},type:"array"}});var B0;var z0=T(()=>{B0={description:'An external class / data source. $prototype is a constructor name (not "Function"). When $prototype is not in the built-in registry, $src is required. All state entries are reactive by default.',properties:{$export:{description:"Named export in $src module. Defaults to the $prototype value.",type:"string"},$prototype:{description:"Constructor name — built-in Web API class or external class name.",examples:["Request","URLSearchParams","FormData","LocalStorage","SessionStorage","Cookie","IndexedDB","Array","Set","Map","Blob","ReadableStream","MarkdownCollection","MyParser"],not:{const:"Function"},type:"string"},$src:{description:"External module specifier. Required when $prototype is not a built-in.",examples:["@jxsuite/md","./lib/my-parser.js","npm:@myorg/data"],type:"string"},autoIncrement:{type:"boolean"},body:{},database:{type:"string"},debounce:{minimum:0,type:"integer"},default:{},description:{type:"string"},domain:{type:"string"},filter:{anyOf:[{$ref:"#/$defs/RefObject"},{description:"A single filter object, e.g. an equality shorthand.",type:"object"},{description:'Ordered filter rules, e.g. [{ field: "Slug", op: "not empty" }].',items:{type:"object"},type:"array"}],description:"Filter configuration: a reactive $ref binding, a single filter object, or an ordered array of rules."},headers:{additionalProperties:{type:"string"},type:"object"},indexes:{items:{properties:{keyPath:{oneOf:[{type:"string"},{items:{type:"string"},type:"array"}]},name:{type:"string"},unique:{type:"boolean"}},required:["name","keyPath"],type:"object"},type:"array"},items:{},key:{type:"string"},keyPath:{type:"string"},manual:{type:"boolean"},map:{$ref:"#/$defs/ElementDef"},maxAge:{type:"integer"},method:{enum:["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],type:"string"},name:{type:"string"},path:{type:"string"},responseType:{enum:["json","text","blob","arraybuffer","document",""],type:"string"},sameSite:{enum:["strict","lax","none"],type:"string"},secure:{type:"boolean"},sort:{anyOf:[{$ref:"#/$defs/RefObject"},{description:"A single sort rule, e.g. { field, order }.",type:"object"},{description:'Ordered sort rules, e.g. [{ field: "date", order: "desc" }].',items:{type:"object"},type:"array"}],description:"Sort configuration: a reactive $ref binding, a single { field, order } rule, or an ordered array of rules."},src:{description:"Configuration property passed to external class constructor.",type:"string"},store:{type:"string"},timing:{enum:["compiler","server","client"],type:"string"},url:{$ref:"#/$defs/StringOrRef"},version:{minimum:1,type:"integer"}},required:["$prototype"],type:"object"}});var K0;var G0=T(()=>{K0={description:"A reusable JSON Schema type definition for tooling only. No function, no runtime artifact. Referenced from state entries via $ref. Naming convention: PascalCase.",not:{anyOf:[{required:["default"]},{required:["$prototype"]}]},properties:{description:{type:"string"},enum:{type:"array"},examples:{type:"array"},items:{},maxLength:{minimum:0,type:"integer"},maximum:{type:"number"},minLength:{minimum:0,type:"integer"},minimum:{type:"number"},pattern:{type:"string"},properties:{type:"object"},required:{items:{type:"string"},type:"array"},type:{$ref:"#/$defs/JsonSchemaType"}},required:["type"],type:"object"}});var X0,Y0,Z0,Q0,eE,tE,nE,rE,sE,oE,iE,aE,cE,lE,uE,fE,dE;var pE=T(()=>{wp();X0={additionalProperties:!1,description:"A JSON Pointer $ref operand within an expression node. $args/<name> resolves a named formula's parameter (callable entries only).",properties:{$ref:{pattern:String.raw`^(\$map/|\$reduce/|\$args/|event#/|#/|parent#/|window#/|document#/)`,type:"string"}},required:["$ref"],type:"object"},Y0={anyOf:[{not:{pattern:String.raw`\$\{`},type:"string"},{type:"number"},{type:"boolean"},{type:"null"},{items:{$ref:"#/$defs/ExpressionOperand"},type:"array"},{description:"Plain-object literal (e.g. an Intl options bag). Objects carrying $ref or operator keys are pointers/nodes, never literals.",not:{anyOf:[{required:["$ref"]},{required:["operator"]}]},type:"object"}],description:"A non-reactive operand: scalar, plain-object literal, or array of operands."},Z0={anyOf:[{$ref:"#/$defs/ExpressionPointer"},{$ref:"#/$defs/ExpressionNode"},{$ref:"#/$defs/ExpressionLiteral"}],description:"Anything that may appear in target or value: a pointer, a literal, or a nested expression node."},Q0={enum:["!","-"]},eE={enum:["+","-","*","/","%","===","!==","<","<=",">",">=","&&","||","??"]},tE={const:"?:"},nE={const:"switch"},rE={const:"call"},sE={description:"A genuine pure String.prototype / Array.prototype / Number.prototype method (spec §19.4d). The ES2023 change-by-copy family (toSorted, toReversed, toSpliced, with) stands in where mutation would otherwise occur. Receiver in target; value carries the argument (bare scalar) or argument list (array).",enum:["includes","indexOf","lastIndexOf","join","slice","concat","at","flat","toSorted","toReversed","toSpliced","with","toUpperCase","toLowerCase","trim","trimStart","trimEnd","split","startsWith","endsWith","padStart","padEnd","replaceAll","repeat","charAt","normalize","toLocaleUpperCase","toLocaleLowerCase","toFixed","toPrecision","toLocaleString"]},oE={enum:["=","+=","-=","*=","/="]},iE={enum:["pop","shift"]},aE={enum:["push","unshift"]},cE={const:"splice"},lE={const:"reduce"},uE={enum:["map","filter"]},fE={additionalProperties:!1,description:"The core expression node. operator + target, with value gated by arity.",oneOf:[{not:{anyOf:[{required:["value"]},{required:["initial"]}]},properties:{operator:{$ref:"#/$defs/UnaryOperator"}},required:["operator"],title:"Unary — target only, no value"},{not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/BinaryOperator"}},required:["operator","value"],title:"Binary — left in target, right in value"},{not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/AssignmentOperator"},target:{$ref:"#/$defs/ExpressionPointer"}},required:["operator","value"],title:"Assignment — writable target, value required"},{not:{anyOf:[{required:["value"]},{required:["initial"]}]},properties:{operator:{$ref:"#/$defs/NoArgMethod"},target:{$ref:"#/$defs/ExpressionPointer"}},required:["operator"],title:"pop / shift — array receiver, no value"},{not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/OneArgMethod"},target:{$ref:"#/$defs/ExpressionPointer"}},required:["operator","value"],title:"push / unshift — array receiver, single value argument"},{not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/SpliceMethod"},target:{$ref:"#/$defs/ExpressionPointer"},value:{items:{$ref:"#/$defs/ExpressionOperand"},minItems:1,type:"array"}},required:["operator","value"],title:"splice — array receiver, [start, deleteCount, ...items]"},{properties:{operator:{$ref:"#/$defs/ReduceMethod"},target:{anyOf:[{$ref:"#/$defs/ExpressionPointer"},{$ref:"#/$defs/ExpressionNode"}]},value:{$ref:"#/$defs/ExpressionNode"}},required:["operator","value","initial"],title:"reduce — pure fold over a pointer or derived array; seed in initial"},{not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/MapFilterMethod"},target:{anyOf:[{$ref:"#/$defs/ExpressionPointer"},{$ref:"#/$defs/ExpressionNode"}]},value:{$ref:"#/$defs/ExpressionNode"}},required:["operator","value"],title:"map / filter — pure over a pointer or derived array; per-item expression in value"},{description:"The ECMAScript conditional (ternary) operator, pure: target is the test, value the consequent, initial the alternate (the reduce precedent for repurposing initial). Chain else-if by nesting another ?: node in initial.",properties:{operator:{$ref:"#/$defs/ConditionalOperator"}},required:["operator","value","initial"],title:"?: — pure conditional; test in target, consequent in value, alternate in initial"},{description:"Value-keyed multiway selection, pure: target is the discriminant (matched against case keys by its string form, like element-level $switch), cases maps matched values to result operands, default is the operand when no case matches (result is undefined without it). Condition-chain branching composes from nested ?: nodes instead.",not:{anyOf:[{required:["value"]},{required:["initial"]}]},properties:{cases:{additionalProperties:{$ref:"#/$defs/ExpressionOperand"},type:"object"},default:{$ref:"#/$defs/ExpressionOperand"},operator:{$ref:"#/$defs/SwitchOperator"}},required:["operator","cases"],title:"switch — pure value-keyed selection; discriminant in target, results in cases/default"},{description:"A pure standard-library method call: target is the receiver (any operand — never mutated; change-by-copy names replace the mutating originals), value the optional argument (bare scalar) or argument list (array). A missing receiver or method yields undefined, matching null-safe path reads.",not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/PureMethod"}},required:["operator"],title:"Pure method — genuine prototype methods; receiver in target, args in value"},{description:"Invoke a callable, pure in formula position: target is the callee pointer — a named formula entry (#/state/…) or a blessed pure global via window#/ (Math.*, JSON.*, Object.keys/values/entries, and "+`${Hb()}) — and value is the positional argument list (the splice args-in-value precedent). Argument order follows the callee's declared parameters.`,not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/CallOperator"},target:{$ref:"#/$defs/ExpressionPointer"},value:{items:{$ref:"#/$defs/ExpressionOperand"},type:"array"}},required:["operator"],title:"call — invoke a named formula or blessed global; callee in target, args in value"}],properties:{cases:{additionalProperties:{$ref:"#/$defs/ExpressionOperand"},description:"switch only: matched discriminant value (string form) → result operand.",type:"object"},default:{$ref:"#/$defs/ExpressionOperand",description:"switch only: result operand when no case key matches."},initial:{$ref:"#/$defs/ExpressionOperand"},operator:{type:"string"},target:{$ref:"#/$defs/ExpressionOperand"},value:{$ref:"#/$defs/ExpressionOperand"}},required:["operator","target"],type:"object"},dE={additionalProperties:!1,description:"A declarative expression entry (Shape 5). Used as a state entry or inline event handler. With parameters it is a named formula: a pure, reusable computation invoked via the call operator, its parameters resolved through $args/<name> refs in the body.",properties:{$description:{type:"string"},$expression:{$ref:"#/$defs/ExpressionNode"},$title:{type:"string"},parameters:{description:"Named-formula parameters (CEM convention, as on Function entries): bare names or CEM parameter objects. Present ⇒ the entry is callable, not a computed value.",items:{anyOf:[{type:"string"},{$ref:"#/$defs/CemParameter"}]},type:"array"}},required:["$expression"],type:"object"}});var mE,hE,gE,yE;var xE=T(()=>{mE={description:"A single state entry. Shape is determined by value type: "+"scalar/array → naked reactive property, string with ${} → computed, "+'object with $prototype: "Function" → function, '+"object with $prototype: <other> → data source, "+"object with type and default → typed reactive property, "+"plain object → naked object reactive property.",oneOf:[{type:"number"},{type:"boolean"},{type:"null"},{type:"string"},{type:"array"},{$ref:"#/$defs/TypedStateDef"},{$ref:"#/$defs/FunctionDef"},{$ref:"#/$defs/ExternalClassDef"},{$ref:"#/$defs/ExpressionEntry"},{not:{anyOf:[{required:["$prototype"]},{required:["default"]},{required:["type"]},{required:["$expression"]}]},type:"object"}]},hE={additionalProperties:{$ref:"#/$defs/StateEntry"},description:"Map of runtime variables. Keys are camelCase (public) or #-prefixed (private). All entries are reactive by default.",type:"object"},gE={additionalProperties:{$ref:"#/$defs/TypeDefEntry"},description:"Map of reusable JSON Schema type definitions. Keys are PascalCase type names. No runtime artifacts are produced.",type:"object"},yE={description:"A $defs type definition entry. Must be a pure JSON Schema type definition or a class definition (.class.json format).",oneOf:[{$ref:"#/$defs/PureTypeDef"},{$ref:"#/$defs/ClassDef"}]}});var gF,oh,ih,ah,ch,lh,uh,fh,dh,ph,bE;var $E=T(()=>{gF=["method","accessor","parse","serialize","rewrite","discover","load","projectData","resolvePaths","lower","emit","head","assets","mount","dialect","deploySchema","bindings","testConnection"],oh={description:"A typed parameter definition for a class.",properties:{default:{},description:{type:"string"},examples:{type:"array"},format:{description:`When "json-schema", this parameter's value is itself a JSON Schema.`,type:"string"},identifier:{type:"string"},type:{}},required:["identifier"],type:"object"},ih={description:"A class field definition with access control and scope.",properties:{$prototype:{description:'Data source prototype for this field (e.g., "Request").',type:"string"},access:{enum:["public","private","protected"],type:"string"},default:{},description:{type:"string"},examples:{type:"array"},identifier:{type:"string"},initializer:{},role:{const:"field",type:"string"},scope:{enum:["instance","static"],type:"string"},type:{}},type:"object"},ah={description:"Class constructor definition.",properties:{$prototype:{const:"Function",type:"string"},body:{description:"The member's body in erasable TypeScript, which plain JavaScript already is (spec §23.1), as one string or as an array of lines.",oneOf:[{type:"string"},{items:{type:"string"},type:"array"}]},description:{type:"string"},parameters:{items:{oneOf:[{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"},{$ref:"#/$defs/ClassParameterDef"}]},type:"array"},role:{const:"constructor",type:"string"},superCall:{properties:{arguments:{items:{type:"string"},type:"array"}},type:"object"}},type:"object"},ch={description:"A class method or accessor definition. Capability roles (parse, serialize, rewrite, discover, load) mark static methods that hosts (compiler, server, studio) invoke for format dispatch.",properties:{$prototype:{const:"Function",type:"string"},access:{enum:["public","private","protected"],type:"string"},body:{description:"The member's body in erasable TypeScript, which plain JavaScript already is (spec §23.1), as one string or as an array of lines.",oneOf:[{type:"string"},{items:{type:"string"},type:"array"}]},description:{type:"string"},getter:{properties:{body:{type:"string"}},type:"object"},identifier:{type:"string"},parameters:{items:{oneOf:[{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"},{$ref:"#/$defs/ClassParameterDef"}]},type:"array"},returnType:{},role:{enum:gF,type:"string"},scope:{enum:["instance","static"],type:"string"},setter:{properties:{body:{type:"string"},parameters:{type:"array"}},type:"object"},timing:{description:"Execution environments allowed to call this capability directly. Hosts outside the list round-trip through the dev server.",items:{enum:["compiler","server","client"],type:"string"},type:"array"}},type:"object"},lh={description:"Format participation marker. A class carrying this block is auto-discovered from the project imports map and used for file-extension dispatch by the compiler, server, and studio.",properties:{documentKinds:{description:'"page"/"component" allow the extension in pages/components discovery; "content" allows it as a content-type source.',items:{enum:["page","component","content"],type:"string"},type:"array"},exportTarget:{description:"When true, site builds emit a serialized sidecar per page in this format.",type:"boolean"},extensions:{description:'File extensions this format claims, with leading dot (e.g. [".md"]).',items:{pattern:String.raw`^\.`,type:"string"},minItems:1,type:"array"},mediaType:{description:"MIME type for the format (icons, labels, HTTP).",type:"string"},remote:{description:"When true, the load capability accepts http(s) URLs as sources.",type:"boolean"}},required:["extensions"],type:"object"},uh={additionalProperties:!1,description:"Project-section admission block (specs/extensions.md §9). A class carrying this block owns "+"the project.json section named by `key`; hosts dispatch that section's data through the class's projectData/resolvePaths capabilities.",properties:{description:{type:"string"},key:{description:"The project.json top-level section this class owns (exclusive per project).",type:"string"},referenceable:{description:"Whether section entries can be referenced from documents (e.g. content types).",type:"boolean"},title:{type:"string"}},required:["key"],type:"object"},fh={additionalProperties:!1,description:"Server-mount admission block (specs/extensions.md §11). A class carrying this block mounts "+"routes under its /_jx/ basePath in the site worker and dev server.",properties:{basePath:{description:"Route subtree this class mounts — must be under /_jx/ (exclusive per project).",examples:["/_jx/data","/_jx/auth"],type:"string"},module:{description:"Module specifier exporting the mount handler.",type:"string"},order:{description:"Mount order (ascending; default 100).",type:"number"}},required:["basePath"],type:"object"},dh={description:"Connection-provider admission block (specs/extensions.md §12). A class carrying this block "+"provides database connections of the given provider/kind.",properties:{kind:{description:"SQL dialect family the provider speaks.",enum:["sqlite","postgres"],type:"string"},local:{description:"Local-development substitute provider (e.g. sqlite for D1).",type:"string"},module:{description:"Module specifier exporting the provider implementation.",type:"string"},provider:{description:"Provider identifier (e.g. d1, supabase, sqlite).",type:"string"},serve:{description:"Module specifier exporting the serve-time worker binding.",type:"string"}},required:["provider","kind"],type:"object"},ph={description:"Studio control-surface hints for a format class: editor modes, document-mode rules, templates, and the element/nesting constraints that gate structural editing.",properties:{documentMode:{properties:{componentWhen:{description:"Treat the document as a component when this top-level/frontmatter key matches the regex.",properties:{frontmatterKey:{type:"string"},matches:{type:"string"}},type:"object"},default:{enum:["content","component"],type:"string"}},type:"object"},elements:{description:"Element allowlist and nesting constraints for structural editing.",properties:{block:{items:{type:"string"},type:"array"},inline:{items:{type:"string"},type:"array"},nesting:{additionalProperties:{properties:{block:{type:"boolean"},directive:{type:"boolean"},inline:{type:"boolean"},only:{items:{type:"string"},type:"array"}},type:"object"},description:'Per-parent child rules keyed by tag (or "_root"): { block, inline, directive } booleans or { only: [tags] }.',type:"object"},textOnly:{items:{type:"string"},type:"array"},void:{items:{type:"string"},type:"array"}},type:"object"},icon:{type:"string"},modes:{description:"Editor modes the studio offers for documents of this format.",items:{type:"string"},type:"array"},newFileTemplate:{description:"Initial source text for newly created files of this format.",type:"string"}},type:"object"},bE={additionalProperties:!1,description:'A .class.json schema-defined class. $prototype must be "Class". Defines fields, constructor, methods, and type parameters via $defs. Optionally points to a JS module via $implementation for hybrid execution.',properties:{$defs:{description:"Class members: parameters, returnTypes, fields, constructor, methods.",properties:{constructor:{$ref:"#/$defs/ClassConstructorDef"},fields:{additionalProperties:{$ref:"#/$defs/ClassFieldDef"},description:"Class fields with role, access, scope, and type information.",type:"object"},methods:{additionalProperties:{$ref:"#/$defs/ClassMethodDef"},description:"Class methods and accessors.",type:"object"},parameters:{additionalProperties:{$ref:"#/$defs/ClassParameterDef"},description:"Reusable typed parameter schemas, keyed by name.",type:"object"},returnTypes:{additionalProperties:{type:"object"},description:"Output type schemas, keyed by name.",type:"object"}},type:"object"},$id:{type:"string"},$implementation:{description:"Relative path to a JS module containing the actual class implementation.",type:"string"},$prototype:{const:"Class",type:"string"},$schema:{type:"string"},$studio:{$ref:"#/$defs/StudioHints"},connector:{$ref:"#/$defs/ConnectorBlockDef"},description:{type:"string"},extends:{description:"Base class — string name or $ref to another .class.json.",oneOf:[{type:"string"},{properties:{$ref:{type:"string"}},required:["$ref"],type:"object"}]},format:{$ref:"#/$defs/FormatDef"},project:{$ref:"#/$defs/ProjectBlockDef"},server:{$ref:"#/$defs/ServerBlockDef"},title:{description:"PascalCase class name, used as the export name.",type:"string"}},required:["$prototype","title"],type:"object"}});var wE;var SE=T(()=>{wE={additionalProperties:!1,description:"Schema for jx-extension.json manifests. Located at the extension package root and exported so hosts can resolve <package>/jx-extension.json through the exports map.",properties:{$schema:{type:"string"},classes:{additionalProperties:{type:"string"},description:"$prototype-visible class name → class descriptor path, relative to the manifest.",type:"object"},description:{description:"One-line description.",type:"string"},name:{description:"Package name; must match package.json.",type:"string"},schemas:{additionalProperties:!1,description:"Schema fragments this package contributes, relative to the manifest.",properties:{document:{description:"Document-schema fragment (positions like $paths values).",type:"string"},fields:{description:"Field-union fragment: its $defs members are unioned into the per-project "+"field-schema resource as extension field extras (specs/extensions.md §5.3).",type:"string"},project:{description:"Project-schema fragment (top-level project.json sections).",type:"string"}},type:"object"},title:{description:"Human-readable name for studio surfaces.",type:"string"}},required:["name"],type:"object"}});var Uu;var vE=T(()=>{Uu={description:"Image optimization configuration for the project.",properties:{formats:{description:'Output formats, each one of "avif", "jpeg", "png" or "webp" (default ["avif", "jpeg"]). AVIF and JPEG are lossy; PNG and WebP are written losslessly, so listing WebP produces larger files than either. A source with transparency is written as PNG wherever JPEG is listed.',items:{type:"string"},type:"array"},lazyLoad:{type:"boolean"},optimize:{type:"boolean"},picture:{description:"Wrap a multi-format image in a <picture> with one <source> per format (default true). With it off the <img> carries a srcset in the preferred format alone, which browsers that cannot decode that format will still select from.",type:"boolean"},quality:{description:"Lossy quality per format, 1 to 100 (defaults: avif 65, jpeg 80). The build writes png and webp losslessly, so png is never read and webp is read only by the cloudflare service, as the quality of its transform URLs (default 80).",properties:{avif:{type:"number"},jpeg:{type:"number"},png:{type:"number"},webp:{type:"number"}},type:"object"},remoteDomains:{description:'Hostnames whose remote (https) images are optimized through /cdn-cgi/image transform URLs (cloudflare service only), e.g. ["drive.usercontent.google.com"]. Remote sources from other hosts are left untouched.',items:{type:"string"},type:"array"},service:{description:'How images are optimized: "build" encodes variants at build time; "cloudflare" emits /cdn-cgi/image transform URLs served by Cloudflare Image Transformations (requires the feature to be enabled on the serving zone).',enum:["build","cloudflare"],type:"string"},sizes:{type:"string"},widths:{items:{type:"number"},type:"array"}},type:"object"}});var yF,mh;var EE=T(()=>{Eo();yF=[301,302,303,307,308],mh={description:"Schema for Jx project.json files. A project.json file is the root anchor file for a Jx project, declaring site metadata, default settings, global styles, extensions, and build configuration. Open by design: extension-contributed sections (e.g. `content`) are opaque top-level keys; the generated per-project entry document (project.schema.json) closes the composition.",properties:{$defs:{description:"Global type definitions available to all pages.",type:"object"},$elements:{description:"Global custom element dependencies available to all pages. Items are $ref objects or npm package specifier strings.",items:{oneOf:[{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"},{type:"string"}]},type:"array"},$head:{description:"Global <head> entries applied to all pages. Array of element definitions for meta tags, link tags, script tags, etc.",examples:[[{attributes:{href:"/favicon.svg",rel:"icon"},tagName:"link"},{attributes:{content:"Jx",name:"generator"},tagName:"meta"}]],items:{properties:{attributes:{additionalProperties:{type:"string"},type:"object"},tagName:{type:"string"}},type:"object"},type:"array"},$media:{additionalProperties:{type:"string"},description:'Named media breakpoints following CSS @custom-media convention. Available in all component style objects. Declaring a pure color-scheme query (e.g. "--dark": "(prefers-color-scheme: dark)") additionally opts the site into the forced-scheme contract: @--dark style blocks are dual-emitted so a data-color-scheme attribute on <html> overrides the OS preference, color-scheme is declared on :root, and a pre-paint script restores the '+"visitor's persisted choice (spec §9.5).",examples:[{"--dark":"(prefers-color-scheme: dark)","--lg":"(min-width: 1024px)","--md":"(min-width: 768px)","--sm":"(min-width: 640px)"}],type:"object"},$schema:{description:"Relative path to the generated per-project schema (conventionally ./project.schema.json, written by `jx schema`).",type:"string"},build:{description:"Build configuration.",properties:{adapter:{description:"Platform adapter for deployment-specific output.",enum:["static","cloudflare-pages","cloudflare-workers","node","bun"],type:"string"},deploy:{additionalProperties:!1,description:"Deployment tracking: the hosting project this repo publishes to. Identifiers "+"only (no secrets) — safe to commit; Studio uses it to tell whether the publish "+"workflow already exists. `adapter` says how the build is packaged; `deploy` says where it ships.",properties:{accountId:{description:"Hosting account id (e.g. the Cloudflare account id).",type:"string"},productionUrl:{description:"Production URL of the connected hosting project.",type:"string"},projectName:{description:"Hosting project name (e.g. the Cloudflare Pages project).",pattern:"^[a-z0-9][a-z0-9-]*$",type:"string"},provider:{description:"Hosting provider the project is connected to.",enum:["cloudflare-pages"],type:"string"}},required:["provider","accountId","projectName"],type:"object"},format:{default:"directory",description:"Reserved; currently unused. Accepted for forward compatibility with single-file output (desktop single-file mode) — the build emits per-route directories regardless.",enum:["directory","single"],type:"string"},outDir:{default:"./dist",description:"Output directory for compiled site.",type:"string"},headers:{additionalProperties:!1,description:"Emit dist/_headers — the response headers only the build can know. Honored by "+"Cloudflare Pages/Workers assets and Netlify; on the node/bun adapters the file documents what a reverse proxy in front of them must send.",properties:{cache:{default:"auto",description:'"auto" marks the content-addressed image variants immutable (RFC 8246) and revalidates everything else (RFC 9111). "off" emits no Cache-Control at all.',enum:["auto","off"],type:"string"},enabled:{default:!0,type:"boolean"},rules:{additionalProperties:{additionalProperties:{type:"string"},type:"object"},description:"Verbatim rules, merged after the generated block.",propertyNames:{pattern:"^/"},type:"object"},security:{additionalProperties:!1,properties:{contentTypeOptions:{default:!0,type:"boolean"},csp:{default:!1,description:"CSP Level 3. Off by default: unlike the other security headers this one "+"governs code the build cannot see — a third-party script that loads a "+"second script, a widget that opens a frame — so turning it on is a change "+"to verify in the browser console, not a safe default. `script-src` is derived from the inline scripts and external origins the build emitted; `style-src` keeps 'unsafe-inline', because per-page <style> blocks and per-element style attributes have no site-wide hash.",oneOf:[{type:"boolean"},{const:"report-only"},{additionalProperties:!1,properties:{directives:{additionalProperties:{oneOf:[{type:"string"},{const:!1}]},description:"Replace (string) or remove (false) a computed directive. A replacement is wholesale, so an addition restates the defaults.",type:"object"},mode:{default:"enforce",enum:["enforce","report-only"]},reportUri:{format:"uri-reference",type:"string"}},type:"object"}]},frameOptions:{default:"SAMEORIGIN",oneOf:[{enum:["DENY","SAMEORIGIN"],type:"string"},{const:!1}]},hsts:{default:!1,description:"RFC 6797. Off by default: a wrong max-age locks the apex domain to HTTPS for that long, and the mistake is invisible until a certificate lapses. `preload` requires `includeSubDomains` and is a build error without it.",oneOf:[{type:"boolean"},{additionalProperties:!1,properties:{includeSubDomains:{default:!0,type:"boolean"},maxAge:{default:31536000,minimum:0,type:"integer"},preload:{default:!1,type:"boolean"}},type:"object"}]},permissionsPolicy:{default:"camera=(), microphone=(), geolocation=()",oneOf:[{type:"string"},{const:!1}]},referrerPolicy:{default:"strict-origin-when-cross-origin",oneOf:[{enum:["no-referrer","no-referrer-when-downgrade","origin","origin-when-cross-origin","same-origin","strict-origin","strict-origin-when-cross-origin","unsafe-url"],type:"string"},{const:!1}]}},type:"object"}},type:"object"},sitemap:{default:!0,description:"Generate sitemap.xml from the route table (requires `url`). Set false to disable.",type:"boolean"},trailingSlash:{default:"always",description:"Trailing slash behavior for generated URLs.",enum:["always","never","ignore"],type:"string"}},type:"object"},copy:{additionalProperties:{type:"string"},description:"Declarative file copy map. Keys are source paths (relative to project root), values are destination paths (relative to outDir).",type:"object"},defaults:{description:"Default settings applied to all pages unless overridden.",properties:{charset:{default:"utf8",description:"Default charset for the page.",type:"string"},dir:{description:"Base direction for the <html> element. Omitted when unset — a page's `$dir` "+"overrides it. Right-to-left content renders left-to-right without this.",enum:["ltr","rtl","auto"],type:"string"},lang:{default:"en",description:"Default lang attribute for the <html> element. A page's `$lang` overrides it.",type:"string"},layout:{default:null,description:"Default layout file path applied to all pages. Set to null to render pages without a layout.",examples:["./layouts/base.json"],oneOf:[{type:"string"},{type:"null"}]},shadow:{default:!1,description:"Default shadow-DOM mode for every component (spec.md §16.6). Off unless set: a "+"shadow root isolates component styles from the page and replaces the <slot> emulation with real slot distribution. A component's own `$shadow` overrides this in both directions.",oneOf:[{enum:["open","closed"],type:"string"},{const:!1,type:"boolean"}]}},type:"object"},extensions:{description:"Extension packages: bare package names (resolved project-first through the package exports map) or relative paths. Each must export jx-extension.json.",examples:[["@jxsuite/parser"]],items:{type:"string"},type:"array"},manifest:{additionalProperties:!1,description:'W3C Web App Manifest, emitted as manifest.webmanifest with a <link rel="manifest"> on every page. Absent means no manifest: it is a claim that a site is meant to be installed, and most are not.',properties:{backgroundColor:{type:"string"},categories:{items:{type:"string"},type:"array"},description:{type:"string"},dir:{enum:["ltr","rtl","auto"],type:"string"},display:{default:"standalone",enum:["fullscreen","standalone","minimal-ui","browser"],type:"string"},enabled:{default:!0,type:"boolean"},icons:{description:"Icons at 192px and 512px are what browsers require before offering to install the site; the build warns when either is missing.",items:{additionalProperties:!1,properties:{purpose:{type:"string"},sizes:{examples:["192x192"],type:"string"},src:{type:"string"},type:{type:"string"}},required:["src"],type:"object"},type:"array"},lang:{type:"string"},name:{description:"Defaults to the project name.",type:"string"},orientation:{type:"string"},scope:{type:"string"},shortName:{type:"string"},startUrl:{default:"/",type:"string"},themeColor:{type:"string"}},type:"object"},serviceWorker:{default:!1,description:"W3C Service Worker, emitted as sw.js. Off unless declared — a worker is sticky, so it "+"is the one output that can keep breaking visitors after a deploy tries to fix them. **Turning it off means `false`, not deleting the key**: `false` emits a tombstone at the same URL that unregisters the old worker and clears its caches, and a 404 there is not an instruction to stop. HTML is always network-first; only the content-addressed /images/_optimized/* is served cache-first.",oneOf:[{type:"boolean"},{additionalProperties:!1,properties:{enabled:{default:!0,type:"boolean"},offlineFallback:{description:"Page served for a failed navigation. Added to `precache` if not already there.",type:"string"},precache:{description:"Site-absolute URLs fetched at install time. Each must be a file this build produces; one that is not fails the build, because a single unreachable entry stops the worker installing at all.",items:{pattern:"^/",type:"string"},type:"array"},scope:{default:"/",type:"string"}},type:"object"}]},securityTxt:{additionalProperties:!1,description:"RFC 9116 security.txt, emitted at .well-known/security.txt. `expires` is required by "+"§2.5.5 and an absent or past value is a build error — an expired file advertises a "+"reporting channel while telling the reporter not to trust it. A hand-placed public/.well-known/security.txt shadows this, which is how a clearsigned file ships.",properties:{acknowledgments:{items:{type:"string"},type:"array"},canonical:{type:"string"},contact:{description:"At least one mailto:, https: or tel: URI (§2.5.3).",items:{type:"string"},type:"array"},enabled:{default:!0,type:"boolean"},encryption:{items:{type:"string"},type:"array"},expires:{format:"date-time",type:"string"},hiring:{items:{type:"string"},type:"array"},policy:{items:{type:"string"},type:"array"},preferredLanguages:{description:"BCP 47 tags, validated and canonicalized like i18n.locales.",items:{pattern:Wl,type:"string"},type:"array"}},type:"object"},i18n:{description:"Internationalization configuration.",properties:{defaultLocale:{description:"Default locale, as a BCP 47 language tag. The pattern catches shape errors (`en_US`, `en--US`); the build is the authority on well-formedness.",examples:["en"],pattern:Wl,type:"string"},locales:{description:"Available locales, as BCP 47 language tags.",examples:[["en","fr","de"]],items:{pattern:Wl,type:"string"},type:"array"},routing:{description:"Locale routing strategy.",enum:["prefix-except-default","prefix-always"],type:"string"}},type:"object"},images:{$ref:"#/$defs/ImageConfig"},imports:{additionalProperties:{type:"string"},description:"Global import map: $prototype names to .class.json file paths. Makes external classes available by name in all pages.",examples:[{Markdown:"@jxsuite/parser/Markdown.class.json",MarkdownCollection:"@jxsuite/parser/MarkdownCollection.class.json"}],type:"object"},name:{default:"Jx Site",description:"Human-readable project name.",examples:["My Portfolio","Jx Example Site"],type:"string"},redirects:{additionalProperties:{oneOf:[{description:"Destination path or URL; implies a 301.",type:"string"},{additionalProperties:!1,description:"A redirect with an explicit RFC 9110 §15.4 status.",properties:{destination:{type:"string"},status:{default:301,description:"RFC 9110 §15.4 redirection status. 307 and 308 preserve the request method; "+"301 and 302 historically do not.",enum:[...yF],type:"integer"}},required:["destination"],type:"object"},{additionalProperties:!1,description:"A rewrite (proxy): the destination's content is served AT the source URL, with no "+"redirect. Emitted as status 200 in `_redirects`, which is the host convention — "+"not an HTTP redirection status.",properties:{destination:{type:"string"},rewrite:{const:!0,type:"boolean"}},required:["destination","rewrite"],type:"object"}]},description:"Static redirect and rewrite rules. Keys are source paths in URLPattern pathname syntax.",examples:[{"/api/*":{destination:"https://api.example.com/*",rewrite:!0},"/legacy/*":{destination:"/archive/*",status:308},"/old-about":"/about"}],propertyNames:{pattern:"^/"},type:"object"},state:{description:"Site-wide reactive state available to all pages.",type:"object"},style:{additionalProperties:{oneOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/StyleObject"}]},description:"Global CSS styles applied to the <body> element. Uses the same camelCase CSSOM convention and recursive selector/at-rule nesting as component styles.",type:"object"},url:{description:"Production URL of the deployed site.",examples:["https://example.com","https://jxsuite.com"],type:"string"}},type:"object"}});function xF(){return jE??=bF(),jE}async function bF(){let[e,t,n]=await Promise.all([_E.listAll(),kE.default.listAll(),OE.default.parseAll()]),r=new Set;for(let{elements:l}of Object.values(e))for(let u of l)if(!u.obsolete)r.add(u.name);let s=[...r].toSorted(),o=new Set;for(let l of t.properties)for(let u of l.styleDeclaration??[])o.add(u);let i=[...o].toSorted(),a=new Set;for(let l of Object.values(n))for(let u of l){if(u.type!=="interface"&&u.type!=="interface mixin")continue;if(!u.members)continue;for(let d of u.members)if(d.type==="attribute"&&d.name?.startsWith("on")&&d.idlType?.idlType==="EventHandler")a.add(d.name)}let c=[...a].toSorted();return{cssProps:i,eventHandlers:c,tagExamples:s}}function $F(e){let t={};for(let n of e)t[n]={description:`Event handler for the "${n.slice(2)}" event.`,oneOf:[{$ref:"#/$defs/RefObject"},{$ref:"#/$defs/ExpressionEntry"},{$ref:"#/$defs/FunctionDef"}]};return t}function wF(e){let t={...Hu.properties};for(let n of e)t[n]={oneOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/RefObject"}]};return t}async function SF(){let{tagExamples:e,cssProps:t,eventHandlers:n}=await xF();return{$defs:{DefsMap:gE,TypeDefEntry:yE,StateMap:hE,StateEntry:mE,TypedStateDef:F0,PureTypeDef:K0,FunctionDef:V0,ClassDef:bE,ClassParameterDef:oh,ClassFieldDef:ih,ClassConstructorDef:ah,ClassMethodDef:ch,FormatDef:lh,ProjectBlockDef:uh,ServerBlockDef:fh,ConnectorBlockDef:dh,StudioHints:ph,ExternalClassDef:B0,ExpressionPointer:X0,ExpressionLiteral:Y0,ExpressionOperand:Z0,UnaryOperator:Q0,BinaryOperator:eE,ConditionalOperator:tE,SwitchOperator:nE,CallOperator:rE,PureMethod:sE,AssignmentOperator:oE,NoArgMethod:iE,OneArgMethod:aE,SpliceMethod:cE,ReduceMethod:lE,MapFilterMethod:uE,ExpressionNode:fE,ExpressionEntry:dE,Statement:W0,StatementList:H0,ElementDef:{...sh,properties:{...sh.properties,...$F(n)}},ChildrenValue:R0,ArrayNamespace:A0,SwitchDef:I0,SwitchNode:M0,StyleObject:{...Hu,properties:wF(t)},AttributesObject:N0,PropsObject:T0,RefObject:P0,AnyRef:j0,InternalRef:b0,StateRef:$0,ExternalRef:w0,ExternalComponentRef:_0,GlobalRef:S0,ParentRef:v0,MapRef:E0,ElementPropertyValue:J0,StringOrRef:c0,BoolOrRef:l0,NumberOrRef:u0,CemParameter:m0,CemEvent:h0,TagName:{...i0,examples:[...e,"my-counter","todo-app","user-card"]},TagExpression:r0,ElementTagName:s0,JsonSchemaType:y0,HeadEntry:d0,ImageConfig:Uu,PathsValue:{$id:Co,anyOf:[...gc,Xm],description:"Default $paths source union: the core shapes, plus a catch-all for source shapes contributed by extensions this schema cannot see. The project's generated document.schema.json replaces this with the exact set its extensions provide."}},$id:"https://jxsuite.com/schema/v1",$schema:"https://json-schema.org/draft/2020-12/schema",additionalProperties:{$ref:"#/$defs/ElementPropertyValue"},description:"Schema for Jx component files. A Jx document is a JSON object that declaratively describes a reactive web component: its structure (DOM tree), styling, type definitions ($defs), runtime state, and inline or external functions. Reactivity is powered by @vue/reactivity.",properties:{$defs:{$ref:"#/$defs/DefsMap",description:"Pure JSON Schema type definitions for this component. "+"All entries are reusable type schemas — no runtime artifacts are produced. "+"Referenced from state entries via $ref. Naming convention: PascalCase."},$elements:{description:"Custom element dependencies. Items are either $ref objects pointing to JX element definitions, or bare npm package name strings for web component libraries.",items:{oneOf:[{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"},{description:"npm package specifier (must declare customElements in package.json)",type:"string"}]},type:"array"},$head:{description:"Page-level <head> entries. Array of head entries for meta tags, link tags, script tags, etc. Merged with layout and site-level $head entries.",items:{$ref:"#/$defs/HeadEntry"},type:"array"},$id:{description:"Component identifier string. Used by tooling and the builder.",examples:["Counter","TodoApp","UserCard"],type:"string"},$dir:{description:"Base direction for this page's <html> element, overriding `defaults.dir`. Right-to-left content renders left-to-right without it.",enum:["ltr","rtl","auto"],type:"string"},$lang:{description:"Language tag for this page's <html> element, overriding `defaults.lang` "+"(site-architecture.md §8.4).",examples:["en","fr","ar-EG"],type:"string"},$translationKey:{description:"This page's identity across languages, overriding the one its path implies "+"(site-architecture.md §13.5). Two routes are translations when their keys match; "+"the default key is the path with the locale prefix removed, which is right whenever "+"the paths are parallel and wrong for a localized slug — /fr-ca/a-propos/ shares "+"nothing with /about/ until one of them says so.",examples:["about","blog/hello-world"],type:"string"},$layout:{description:"Layout reference for pages. String path to a layout JSON file, or false to opt out of the default layout.",examples:["./layouts/base.json"],oneOf:[{type:"string"},{const:!1,type:"boolean"}]},$script:{additionalProperties:!1,description:"This document's own modules, as TypeScript module text (spec.md §23.2). "+'A state entry names an export of one with `$src: "#client"` or `$src: "#server"`. `client` runs in the browser; `server` runs only on the server and is never sent to one.',properties:{client:{description:'The module the browser runs. A Function entry with `$src: "#client"` is one of its exports.',type:"string"},server:{description:'The module the server runs. A `timing: "server"` entry with `$src: "#server"` is one of its exports, called with `(args, env)`.',type:"string"}},type:"object"},$shadow:{description:"Render this component into a shadow root instead of the light DOM (spec.md §16.6). "+"Off unless set: a shadow root isolates the component's styles from the page and replaces the <slot> emulation with real slot distribution, so it changes how the "+"component composes. Overrides `defaults.shadow` in both directions — `false` opts "+"one component out of a project that opted in.",oneOf:[{enum:["open","closed"],type:"string"},{const:!1,type:"boolean"}]},$sitemap:{description:"Set false to exclude this page from sitemap.xml (site-architecture.md §8.4.1). "+"Every other page with a URL is included.",type:"boolean"},$media:{additionalProperties:{type:"string"},description:'Named media breakpoints following CSS @custom-media convention. Keys use the CSS custom property -- prefix. Pure color-scheme queries (e.g. "--dark": "(prefers-color-scheme: dark)") are dual-emitted so a data-color-scheme attribute on the root element forces the scheme '+"regardless of the OS preference (spec §9.5).",examples:[{"--dark":"(prefers-color-scheme: dark)","--md":"(min-width: 768px)","--sm":"(min-width: 640px)"}],type:"object"},$paths:{$ref:Co,description:"Dynamic route source for a page: expands one page per entry at build time. One of the core shapes (explicit `values`, a `$ref` data file, or a bare array of parameter objects) or a source shape contributed by an enabled extension, such as the parser's `contentType`."},$schema:{description:"URI identifying the Jx dialect version. Enables schema-aware IDE tooling.",examples:["https://jxsuite.com/schema/v1"],type:"string"},attributes:{$ref:"#/$defs/AttributesObject"},cases:{additionalProperties:{oneOf:[{$ref:"#/$defs/ElementDef"},{$ref:"#/$defs/ExternalComponentRef"}]},description:"Switch cases object. Maps case values to element definitions or external component refs. Used alongside $switch for dynamic component rendering.",type:"object"},children:{$ref:"#/$defs/ChildrenValue"},imports:{additionalProperties:{type:"string"},description:"Import map: $prototype names to .class.json file paths. Allows state entries to reference external classes by name without $src.",type:"object"},observedAttributes:{description:"HTML attributes the custom element watches for changes. Follows the Web Components observedAttributes convention.",items:{type:"string"},type:"array"},state:{$ref:"#/$defs/StateMap",description:"Runtime variables for this component. All entries are reactive by default. Entry shape is determined by value type: "+"scalar/array → reactive property, string with ${} → computed, "+"object with $prototype → function or data source, "+"object with type and default → typed reactive property."},style:{$ref:"#/$defs/StyleObject"},tagName:{$ref:"#/$defs/TagName"},title:{$ref:"#/$defs/StringOrRef",description:"Page title. Can be a static string or a template string with ${} expressions."}},title:"Jx Document",type:"object"}}function vF(){return{$defs:{ImageConfig:Uu,StyleObject:AE},$id:"https://jxsuite.com/schema/project/v1",$schema:"https://json-schema.org/draft/2020-12/schema",description:"Schema for Jx project.json files. A project.json file is the root anchor file for a Jx project, declaring site metadata, default settings, global styles, extensions, and build configuration. Open by design: extension-contributed sections are opaque top-level keys; the generated per-project entry document (project.schema.json) closes the composition.",properties:mh.properties,title:"Jx Project",type:"object"}}function EF(){return{$defs:{ImageConfig:Uu,JxFieldSchema:_v,RelationshipRef:kv,StyleObject:AE},$id:"https://jxsuite.com/schema/project/core/v2",$schema:"https://json-schema.org/draft/2020-12/schema",description:"Core fragment of the Jx project.json schema. Open by design: extension fragments contribute their own top-level sections and the generated per-project entry document "+"(project.schema.json) closes the composition. See specs/extensions.md §5.",properties:mh.properties,title:"Jx Project Core",type:"object"}}function jF(){return{$id:hc,$schema:"https://json-schema.org/draft/2020-12/schema",anyOf:[{$ref:"https://jxsuite.com/schema/project/core/v2#/$defs/JxFieldSchema"},{$ref:"https://jxsuite.com/schema/project/core/v2#/$defs/RelationshipRef"}],description:"Default field-schema union for section entry schemas: the core field shape plus relationship references. Per-project entry documents override this resource with the "+"effective union. See specs/extensions.md §5.3.",title:"Jx Project Field Union"}}function PF(){return{$id:Co,$schema:"https://json-schema.org/draft/2020-12/schema",anyOf:[...gc,Xm],description:"Default $paths-value union for documents: the core source shapes. Per-project entry documents override this resource with those members PLUS every extension-contributed paths shape.",title:"Jx Document Paths Union"}}function _F(){return{$id:"https://jxsuite.com/schema/extension-manifest/v1",$schema:"https://json-schema.org/draft/2020-12/schema",title:"Jx Extension Manifest",...wE}}function hh(){return{$defs:{ClassConstructorDef:ah,ClassFieldDef:ih,ClassMethodDef:ch,ClassParameterDef:oh,ConnectorBlockDef:dh,FormatDef:lh,ProjectBlockDef:uh,ServerBlockDef:fh,StudioHints:ph},$id:"https://jxsuite.com/schema/class/v1",$schema:"https://json-schema.org/draft/2020-12/schema",additionalProperties:!1,description:"Schema for Jx .class.json files. A class definition describes a schema-defined class with fields, constructor, methods, and type parameters. Optionally points to a JS module via $implementation for hybrid execution.",properties:{$defs:{description:"Class members: parameters, returnTypes, fields, constructor, methods.",properties:{constructor:{$ref:"#/$defs/ClassConstructorDef"},fields:{additionalProperties:{$ref:"#/$defs/ClassFieldDef"},description:"Class fields with role, access, scope, and type information.",type:"object"},methods:{additionalProperties:{$ref:"#/$defs/ClassMethodDef"},description:"Class methods and accessors.",type:"object"},parameters:{additionalProperties:{$ref:"#/$defs/ClassParameterDef"},description:"Reusable typed parameter schemas, keyed by name.",type:"object"},returnTypes:{additionalProperties:{type:"object"},description:"Output type schemas, keyed by name.",type:"object"}},type:"object"},$id:{type:"string"},$implementation:{description:"Relative path to a JS module containing the actual class implementation.",examples:["./md.js","./lib/calculator.js"],type:"string"},$prototype:{const:"Class",description:'Must be "Class" for class definition files.',type:"string"},$schema:{type:"string"},$studio:{$ref:"#/$defs/StudioHints"},connector:{$ref:"#/$defs/ConnectorBlockDef"},description:{type:"string"},extends:{description:"Base class — string name or $ref to another .class.json.",oneOf:[{type:"string"},{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"}]},format:{$ref:"#/$defs/FormatDef"},project:{$ref:"#/$defs/ProjectBlockDef"},server:{$ref:"#/$defs/ServerBlockDef"},title:{description:"PascalCase class name, used as the export name.",examples:["MarkdownFile","DataSource","Calculator"],type:"string"}},required:["$prototype","title"],title:"Jx Class Definition",type:"object"}}async function kF(e){let{mkdirSync:t,writeFileSync:n}=await import("node:fs"),{resolve:r,dirname:s}=await import("node:path"),o=s(r(e,"..")),i=await SF(),a=vF(),c=hh(),l=EF(),u=_F(),d=jF(),p=PF(),m=JSON.stringify(i,null,2),x=JSON.stringify(a,null,2),h=JSON.stringify(c,null,2),g=JSON.stringify(l,null,2),b=JSON.stringify(u,null,2),j=JSON.stringify(d,null,2),v=JSON.stringify(p,null,2),[P]=process.argv.slice(2);if(P)n(P,m,"utf8"),console.error(`Jx component schema written to ${P}`);else{n(r(o,"schema.json"),m,"utf8"),n(r(o,"project-schema.json"),x,"utf8"),n(r(o,"class-schema.json"),h,"utf8"),t(r(o,"schemas"),{recursive:!0}),n(r(o,"schemas","project.core.schema.json"),g,"utf8"),n(r(o,"schemas","project.fields.schema.json"),j,"utf8"),n(r(o,"schemas","document.paths.schema.json"),v,"utf8"),n(r(o,"extension-manifest.schema.json"),b,"utf8");let S=Bun.spawnSync(["bunx","oxfmt",r(o,"schemas","project.core.schema.json"),r(o,"schemas","project.fields.schema.json"),r(o,"schemas","document.paths.schema.json")],{cwd:o});if(S.exitCode!==0){let _=S.stderr.toString()||S.stdout.toString()||`exit ${S.exitCode}${S.signalCode?`, signal ${S.signalCode}`:""}`;console.error(`Warning: skipped oxfmt reformat of generated schemas (${_})`)}console.error("Generated:"),console.error(" schema.json (component)"),console.error(" project-schema.json"),console.error(" class-schema.json"),console.error(" schemas/project.core.schema.json"),console.error(" schemas/project.fields.schema.json"),console.error(" schemas/document.paths.schema.json"),console.error(" extension-manifest.schema.json")}}var _E,kE,OE,jE=null,AE,PE,jZ;var RE=T(()=>{o0();a0();f0();p0();g0();x0();k0();O0();C0();D0();L0();q0();U0();z0();G0();pE();xE();$E();SE();Fu();vE();EE();_E=Jr(Uv(),1),kE=Jr(Gv(),1),OE=Jr(n0(),1);AE={...Hu,additionalProperties:{anyOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/StyleObject"}]}};[,PE]=process.argv,jZ=PE?.endsWith("schema.ts")?kF(PE):void 0});var Sc=W(function(TE){Object.defineProperty(TE,"__esModule",{value:!0});TE.regexpCode=TE.getEsmExportName=TE.getProperty=TE.safeStringify=TE.stringify=TE.strConcat=TE.addCodeArg=TE.str=TE._=TE.nil=TE._Code=TE.Name=TE.IDENTIFIER=TE._CodeOrName=void 0;class Bu{}TE._CodeOrName=Bu;TE.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class qi extends Bu{constructor(e){super();if(!TE.IDENTIFIER.test(e))throw Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}TE.Name=qi;class tr extends Bu{constructor(e){super();this._items=typeof e==="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((t,n)=>`${t}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((t,n)=>{if(n instanceof qi)t[n.str]=(t[n.str]||0)+1;return t},{})}}TE._Code=tr;TE.nil=new tr("");function CE(e,...t){let n=[e[0]],r=0;while(r<t.length)yh(n,t[r]),n.push(e[++r]);return new tr(n)}TE._=CE;var gh=new tr("+");function NE(e,...t){let n=[wc(e[0])],r=0;while(r<t.length)n.push(gh),yh(n,t[r]),n.push(gh,wc(e[++r]));return OF(n),new tr(n)}TE.str=NE;function yh(e,t){if(t instanceof tr)e.push(...t._items);else if(t instanceof qi)e.push(t);else e.push(CF(t))}TE.addCodeArg=yh;function OF(e){let t=1;while(t<e.length-1){if(e[t]===gh){let n=AF(e[t-1],e[t+1]);if(n!==void 0){e.splice(t-1,3,n);continue}e[t++]="+"}t++}}function AF(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string"){if(t instanceof qi||e[e.length-1]!=='"')return;if(typeof t!="string")return`${e.slice(0,-1)}${t}"`;if(t[0]==='"')return e.slice(0,-1)+t.slice(1);return}if(typeof t=="string"&&t[0]==='"'&&!(e instanceof qi))return`"${e}${t.slice(1)}`;return}function RF(e,t){return t.emptyStr()?e:e.emptyStr()?t:NE`${e}${t}`}TE.strConcat=RF;function CF(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:wc(Array.isArray(e)?e.join(","):e)}function NF(e){return new tr(wc(e))}TE.stringify=NF;function wc(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}TE.safeStringify=wc;function TF(e){return typeof e=="string"&&TE.IDENTIFIER.test(e)?new tr(`.${e}`):CE`[${e}]`}TE.getProperty=TF;function JF(e){if(typeof e=="string"&&TE.IDENTIFIER.test(e))return new tr(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}TE.getEsmExportName=JF;function IF(e){return new tr(e.toString())}TE.regexpCode=IF});var wh=W(function(DE){Object.defineProperty(DE,"__esModule",{value:!0});DE.ValueScope=DE.ValueScopeName=DE.Scope=DE.varKinds=DE.UsedValueState=void 0;var He=Sc();class IE extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var Ku;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(Ku||(DE.UsedValueState=Ku={}));DE.varKinds={const:new He.Name("const"),let:new He.Name("let"),var:new He.Name("var")};class bh{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof He.Name?e:this.name(e)}name(e){return new He.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,n;if(((n=(t=this._parent)===null||t===void 0?void 0:t._prefixes)===null||n===void 0?void 0:n.has(e))||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}DE.Scope=bh;class $h extends He.Name{constructor(e,t){super(t);this.prefix=e}setValue(e,{property:t,itemIndex:n}){this.value=e,this.scopePath=He._`.${new He.Name(t)}[${n}]`}}DE.ValueScopeName=$h;var GF=He._`\n`;class ME extends bh{constructor(e){super(e);this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?GF:He.nil}}get(){return this._scope}name(e){return new $h(e,this._newName(e))}value(e,t){var n;if(t.ref===void 0)throw Error("CodeGen: ref must be passed in value");let r=this.toName(e),{prefix:s}=r,o=(n=t.key)!==null&&n!==void 0?n:t.ref,i=this._values[s];if(i){let l=i.get(o);if(l)return l}else i=this._values[s]=new Map;i.set(o,r);let a=this._scope[s]||(this._scope[s]=[]),c=a.length;return a[c]=t.ref,r.setValue(t,{property:s,itemIndex:c}),r}getValue(e,t){let n=this._values[e];if(!n)return;return n.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,(n)=>{if(n.scopePath===void 0)throw Error(`CodeGen: name "${n}" has no value`);return He._`${e}${n.scopePath}`})}scopeCode(e=this._values,t,n){return this._reduceValues(e,(r)=>{if(r.value===void 0)throw Error(`CodeGen: name "${r}" has no value`);return r.value.code},t,n)}_reduceValues(e,t,n={},r){let s=He.nil;for(let o in e){let i=e[o];if(!i)continue;let a=n[o]=n[o]||new Map;i.forEach((c)=>{if(a.has(c))return;a.set(c,Ku.Started);let l=t(c);if(l){let u=this.opts.es5?DE.varKinds.var:DE.varKinds.const;s=He._`${s}${u} ${c} = ${l};${this.opts._n}`}else if(l=r===null||r===void 0?void 0:r(c))s=He._`${s}${l}${this.opts._n}`;else throw new IE(c);a.set(c,Ku.Completed)})}return s}}DE.ValueScope=ME});var ge=W(function(ln){Object.defineProperty(ln,"__esModule",{value:!0});ln.or=ln.and=ln.not=ln.CodeGen=ln.operators=ln.varKinds=ln.ValueScopeName=ln.ValueScope=ln.Scope=ln.Name=ln.regexpCode=ln.stringify=ln.getProperty=ln.nil=ln.strConcat=ln.str=ln._=void 0;var Y=Sc(),ct=wh(),Os=Sc();Object.defineProperty(ln,"_",{enumerable:!0,get:function(){return Os._}});Object.defineProperty(ln,"str",{enumerable:!0,get:function(){return Os.str}});Object.defineProperty(ln,"strConcat",{enumerable:!0,get:function(){return Os.strConcat}});Object.defineProperty(ln,"nil",{enumerable:!0,get:function(){return Os.nil}});Object.defineProperty(ln,"getProperty",{enumerable:!0,get:function(){return Os.getProperty}});Object.defineProperty(ln,"stringify",{enumerable:!0,get:function(){return Os.stringify}});Object.defineProperty(ln,"regexpCode",{enumerable:!0,get:function(){return Os.regexpCode}});Object.defineProperty(ln,"Name",{enumerable:!0,get:function(){return Os.Name}});var ef=wh();Object.defineProperty(ln,"Scope",{enumerable:!0,get:function(){return ef.Scope}});Object.defineProperty(ln,"ValueScope",{enumerable:!0,get:function(){return ef.ValueScope}});Object.defineProperty(ln,"ValueScopeName",{enumerable:!0,get:function(){return ef.ValueScopeName}});Object.defineProperty(ln,"varKinds",{enumerable:!0,get:function(){return ef.varKinds}});ln.operators={GT:new Y._Code(">"),GTE:new Y._Code(">="),LT:new Y._Code("<"),LTE:new Y._Code("<="),EQ:new Y._Code("==="),NEQ:new Y._Code("!=="),NOT:new Y._Code("!"),OR:new Y._Code("||"),AND:new Y._Code("&&"),ADD:new Y._Code("+")};class As{optimizeNodes(){return this}optimizeNames(e,t){return this}}class LE extends As{constructor(e,t,n){super();this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){let n=e?ct.varKinds.var:this.varKind,r=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${r};`+t}optimizeNames(e,t){if(!e[this.name.str])return;if(this.rhs)this.rhs=Hi(this.rhs,e,t);return this}get names(){return this.rhs instanceof Y._CodeOrName?this.rhs.names:{}}}class Eh extends As{constructor(e,t,n){super();this.lhs=e,this.rhs=t,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(this.lhs instanceof Y.Name&&!e[this.lhs.str]&&!this.sideEffects)return;return this.rhs=Hi(this.rhs,e,t),this}get names(){let e=this.lhs instanceof Y.Name?{}:{...this.lhs.names};return Qu(e,this.rhs)}}class VE extends Eh{constructor(e,t,n,r){super(e,n,r);this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class qE extends As{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class WE extends As{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class HE extends As{constructor(e){super();this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class UE extends As{constructor(e){super();this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=Hi(this.code,e,t),this}get names(){return this.code instanceof Y._CodeOrName?this.code.names:{}}}class tf extends As{constructor(e=[]){super();this.nodes=e}render(e){return this.nodes.reduce((t,n)=>t+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,t=e.length;while(t--){let n=e[t].optimizeNodes();if(Array.isArray(n))e.splice(t,1,...n);else if(n)e[t]=n;else e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:n}=this,r=n.length;while(r--){let s=n[r];if(s.optimizeNames(e,t))continue;QF(e,s.names),n.splice(r,1)}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>No(e,t.names),{})}}class Rs extends tf{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class BE extends tf{}class vc extends Rs{}vc.kind="else";class es extends Rs{constructor(e,t){super(t);this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);if(this.else)t+="else "+this.else.render(e);return t}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let t=this.else;if(t){let n=t.optimizeNodes();t=this.else=Array.isArray(n)?new vc(n):n}if(t){if(e===!1)return t instanceof es?t:t.nodes;if(this.nodes.length)return this;return new es(YE(e),t instanceof es?[t]:t.nodes)}if(e===!1||!this.nodes.length)return;return this}optimizeNames(e,t){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,t),!(super.optimizeNames(e,t)||this.else))return;return this.condition=Hi(this.condition,e,t),this}get names(){let e=super.names;if(Qu(e,this.condition),this.else)No(e,this.else.names);return e}}es.kind="if";class Wi extends Rs{}Wi.kind="for";class zE extends Wi{constructor(e){super();this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;return this.iteration=Hi(this.iteration,e,t),this}get names(){return No(super.names,this.iteration.names)}}class KE extends Wi{constructor(e,t,n,r){super();this.varKind=e,this.name=t,this.from=n,this.to=r}render(e){let t=e.es5?ct.varKinds.var:this.varKind,{name:n,from:r,to:s}=this;return`for(${t} ${n}=${r}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){let e=Qu(super.names,this.from);return Qu(e,this.to)}}class Sh extends Wi{constructor(e,t,n,r){super();this.loop=e,this.varKind=t,this.name=n,this.iterable=r}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;return this.iterable=Hi(this.iterable,e,t),this}get names(){return No(super.names,this.iterable.names)}}class Gu extends Rs{constructor(e,t,n){super();this.name=e,this.args=t,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}Gu.kind="func";class Xu extends tf{render(e){return"return "+super.render(e)}}Xu.kind="return";class GE extends Rs{render(e){let t="try"+super.render(e);if(this.catch)t+=this.catch.render(e);if(this.finally)t+=this.finally.render(e);return t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(t=this.finally)===null||t===void 0||t.optimizeNodes(),this}optimizeNames(e,t){var n,r;return super.optimizeNames(e,t),(n=this.catch)===null||n===void 0||n.optimizeNames(e,t),(r=this.finally)===null||r===void 0||r.optimizeNames(e,t),this}get names(){let e=super.names;if(this.catch)No(e,this.catch.names);if(this.finally)No(e,this.finally.names);return e}}class Yu extends Rs{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}Yu.kind="catch";class Zu extends Rs{render(e){return"finally"+super.render(e)}}Zu.kind="finally";class XE{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
617
- `:""},this._extScope=e,this._scope=new ct.Scope({parent:e}),this._nodes=[new BE]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let n=this._extScope.value(e,t);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,n,r){let s=this._scope.toName(t);if(n!==void 0&&r)this._constants[s.str]=n;return this._leafNode(new LE(e,s,n)),s}const(e,t,n){return this._def(ct.varKinds.const,e,t,n)}let(e,t,n){return this._def(ct.varKinds.let,e,t,n)}var(e,t,n){return this._def(ct.varKinds.var,e,t,n)}assign(e,t,n){return this._leafNode(new Eh(e,t,n))}add(e,t){return this._leafNode(new VE(e,ln.operators.ADD,t))}code(e){if(typeof e=="function")e();else if(e!==Y.nil)this._leafNode(new UE(e));return this}object(...e){let t=["{"];for(let[n,r]of e){if(t.length>1)t.push(",");if(t.push(n),n!==r||this.opts.es5)t.push(":"),Y.addCodeArg(t,r)}return t.push("}"),new Y._Code(t)}if(e,t,n){if(this._blockNode(new es(e)),t&&n)this.code(t).else().code(n).endIf();else if(t)this.code(t).endIf();else if(n)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new es(e))}else(){return this._elseNode(new vc)}endIf(){return this._endBlockNode(es,vc)}_for(e,t){if(this._blockNode(e),t)this.code(t).endFor();return this}for(e,t){return this._for(new zE(e),t)}forRange(e,t,n,r,s=this.opts.es5?ct.varKinds.var:ct.varKinds.let){let o=this._scope.toName(e);return this._for(new KE(s,o,t,n),()=>r(o))}forOf(e,t,n,r=ct.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let o=t instanceof Y.Name?t:this.var("_arr",t);return this.forRange("_i",0,Y._`${o}.length`,(i)=>{this.var(s,Y._`${o}[${i}]`),n(s)})}return this._for(new Sh("of",r,s,t),()=>n(s))}forIn(e,t,n,r=this.opts.es5?ct.varKinds.var:ct.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,Y._`Object.keys(${t})`,n);let s=this._scope.toName(e);return this._for(new Sh("in",r,s,t),()=>n(s))}endFor(){return this._endBlockNode(Wi)}label(e){return this._leafNode(new qE(e))}break(e){return this._leafNode(new WE(e))}return(e){let t=new Xu;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(Xu)}try(e,t,n){if(!t&&!n)throw Error('CodeGen: "try" without "catch" and "finally"');let r=new GE;if(this._blockNode(r),this.code(e),t){let s=this.name("e");this._currNode=r.catch=new Yu(s),t(s)}if(n)this._currNode=r.finally=new Zu,this.code(n);return this._endBlockNode(Yu,Zu)}throw(e){return this._leafNode(new HE(e))}block(e,t){if(this._blockStarts.push(this._nodes.length),e)this.code(e).endBlock(t);return this}endBlock(e){let t=this._blockStarts.pop();if(t===void 0)throw Error("CodeGen: not in self-balancing block");let n=this._nodes.length-t;if(n<0||e!==void 0&&n!==e)throw Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=Y.nil,n,r){if(this._blockNode(new Gu(e,t,n)),r)this.code(r).endFunc();return this}endFunc(){return this._endBlockNode(Gu)}optimize(e=1){while(e-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let n=this._currNode;if(n instanceof e||t&&n instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof es))throw Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}}ln.CodeGen=XE;function No(e,t){for(let n in t)e[n]=(e[n]||0)+(t[n]||0);return e}function Qu(e,t){return t instanceof Y._CodeOrName?No(e,t.names):e}function Hi(e,t,n){if(e instanceof Y.Name)return r(e);if(!s(e))return e;return new Y._Code(e._items.reduce((o,i)=>{if(i instanceof Y.Name)i=r(i);if(i instanceof Y._Code)o.push(...i._items);else o.push(i);return o},[]));function r(o){let i=n[o.str];if(i===void 0||t[o.str]!==1)return o;return delete t[o.str],i}function s(o){return o instanceof Y._Code&&o._items.some((i)=>i instanceof Y.Name&&t[i.str]===1&&n[i.str]!==void 0)}}function QF(e,t){for(let n in t)e[n]=(e[n]||0)-(t[n]||0)}function YE(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:Y._`!${vh(e)}`}ln.not=YE;var eL=ZE(ln.operators.AND);function tL(...e){return e.reduce(eL)}ln.and=tL;var nL=ZE(ln.operators.OR);function rL(...e){return e.reduce(nL)}ln.or=rL;function ZE(e){return(t,n)=>t===Y.nil?n:n===Y.nil?t:Y._`${vh(t)} ${e} ${vh(n)}`}function vh(e){return e instanceof Y.Name?e:Y._`(${e})`}});var ke=W(function(cj){Object.defineProperty(cj,"__esModule",{value:!0});cj.checkStrictMode=cj.getErrorPath=cj.Type=cj.useFunc=cj.setEvaluated=cj.evaluatedPropsToName=cj.mergeEvaluated=cj.eachItem=cj.unescapeJsonPointer=cj.escapeJsonPointer=cj.escapeFragment=cj.unescapeFragment=cj.schemaRefOrVal=cj.schemaHasRulesButRef=cj.schemaHasRules=cj.checkUnknownRules=cj.alwaysValidSchema=cj.toHash=void 0;var ie=ge(),nj=Sc();function aL(e){let t={};for(let n of e)t[n]=!0;return t}cj.toHash=aL;function cL(e,t){if(typeof t=="boolean")return t;if(Object.keys(t).length===0)return!0;return rj(e,t),!sj(t,e.self.RULES.all)}cj.alwaysValidSchema=cL;function rj(e,t=e.schema){let{opts:n,self:r}=e;if(!n.strictSchema)return;if(typeof t==="boolean")return;let s=r.RULES.keywords;for(let o in t)if(!s[o])aj(e,`unknown keyword: "${o}"`)}cj.checkUnknownRules=rj;function sj(e,t){if(typeof e=="boolean")return!e;for(let n in e)if(t[n])return!0;return!1}cj.schemaHasRules=sj;function lL(e,t){if(typeof e=="boolean")return!e;for(let n in e)if(n!=="$ref"&&t.all[n])return!0;return!1}cj.schemaHasRulesButRef=lL;function uL({topSchemaRef:e,schemaPath:t},n,r,s){if(!s){if(typeof n=="number"||typeof n=="boolean")return n;if(typeof n=="string")return ie._`${n}`}return ie._`${e}${t}${ie.getProperty(r)}`}cj.schemaRefOrVal=uL;function fL(e){return oj(decodeURIComponent(e))}cj.unescapeFragment=fL;function dL(e){return encodeURIComponent(Ph(e))}cj.escapeFragment=dL;function Ph(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}cj.escapeJsonPointer=Ph;function oj(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}cj.unescapeJsonPointer=oj;function pL(e,t){if(Array.isArray(e))for(let n of e)t(n);else t(e)}cj.eachItem=pL;function ej({mergeNames:e,mergeToName:t,mergeValues:n,resultToName:r}){return(s,o,i,a)=>{let c=i===void 0?o:i instanceof ie.Name?(o instanceof ie.Name?e(s,o,i):t(s,o,i),i):o instanceof ie.Name?(t(s,i,o),o):n(o,i);return a===ie.Name&&!(c instanceof ie.Name)?r(s,c):c}}cj.mergeEvaluated={props:ej({mergeNames:(e,t,n)=>e.if(ie._`${n} !== true && ${t} !== undefined`,()=>{e.if(ie._`${t} === true`,()=>e.assign(n,!0),()=>e.assign(n,ie._`${n} || {}`).code(ie._`Object.assign(${n}, ${t})`))}),mergeToName:(e,t,n)=>e.if(ie._`${n} !== true`,()=>{if(t===!0)e.assign(n,!0);else e.assign(n,ie._`${n} || {}`),_h(e,n,t)}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:ij}),items:ej({mergeNames:(e,t,n)=>e.if(ie._`${n} !== true && ${t} !== undefined`,()=>e.assign(n,ie._`${t} === true ? true : ${n} > ${t} ? ${n} : ${t}`)),mergeToName:(e,t,n)=>e.if(ie._`${n} !== true`,()=>e.assign(n,t===!0?!0:ie._`${n} > ${t} ? ${n} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function ij(e,t){if(t===!0)return e.var("props",!0);let n=e.var("props",ie._`{}`);if(t!==void 0)_h(e,n,t);return n}cj.evaluatedPropsToName=ij;function _h(e,t,n){Object.keys(n).forEach((r)=>e.assign(ie._`${t}${ie.getProperty(r)}`,!0))}cj.setEvaluated=_h;var tj={};function mL(e,t){return e.scopeValue("func",{ref:t,code:tj[t.code]||(tj[t.code]=new nj._Code(t.code))})}cj.useFunc=mL;var jh;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(jh||(cj.Type=jh={}));function hL(e,t,n){if(e instanceof ie.Name){let r=t===jh.Num;return n?r?ie._`"[" + ${e} + "]"`:ie._`"['" + ${e} + "']"`:r?ie._`"/" + ${e}`:ie._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return n?ie.getProperty(e).toString():"/"+Ph(e)}cj.getErrorPath=hL;function aj(e,t,n=e.opts.strictSchema){if(!n)return;if(t=`strict mode: ${t}`,n===!0)throw Error(t);e.self.logger.warn(t)}cj.checkStrictMode=aj});var Mn=W(function(uj){Object.defineProperty(uj,"__esModule",{value:!0});var Ie=ge(),NL={data:new Ie.Name("data"),valCxt:new Ie.Name("valCxt"),instancePath:new Ie.Name("instancePath"),parentData:new Ie.Name("parentData"),parentDataProperty:new Ie.Name("parentDataProperty"),rootData:new Ie.Name("rootData"),dynamicAnchors:new Ie.Name("dynamicAnchors"),vErrors:new Ie.Name("vErrors"),errors:new Ie.Name("errors"),this:new Ie.Name("this"),self:new Ie.Name("self"),scope:new Ie.Name("scope"),json:new Ie.Name("json"),jsonPos:new Ie.Name("jsonPos"),jsonLen:new Ie.Name("jsonLen"),jsonPart:new Ie.Name("jsonPart")};uj.default=NL});var Ec=W(function(mj){Object.defineProperty(mj,"__esModule",{value:!0});mj.extendErrors=mj.resetErrorsCount=mj.reportExtraError=mj.reportError=mj.keyword$DataError=mj.keywordError=void 0;var Q=ge(),Cs=ke(),Zt=Mn();mj.keywordError={message:({keyword:e})=>Q.str`must pass "${e}" keyword validation`};mj.keyword$DataError={message:({keyword:e,schemaType:t})=>t?Q.str`"${e}" keyword must be ${t} ($data)`:Q.str`"${e}" keyword is invalid ($data)`};function JL(e,t=mj.keywordError,n,r){let{it:s}=e,{gen:o,compositeRule:i,allErrors:a}=s,c=pj(e,t,n);if(r!==null&&r!==void 0?r:i||a)fj(o,c);else dj(s,Q._`[${c}]`)}mj.reportError=JL;function IL(e,t=mj.keywordError,n){let{it:r}=e,{gen:s,compositeRule:o,allErrors:i}=r,a=pj(e,t,n);if(fj(s,a),!(o||i))dj(r,Zt.default.vErrors)}mj.reportExtraError=IL;function ML(e,t){e.assign(Zt.default.errors,t),e.if(Q._`${Zt.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(Q._`${Zt.default.vErrors}.length`,t),()=>e.assign(Zt.default.vErrors,null)))}mj.resetErrorsCount=ML;function DL({gen:e,keyword:t,schemaValue:n,data:r,errsCount:s,it:o}){if(s===void 0)throw Error("ajv implementation error");let i=e.name("err");e.forRange("i",s,Zt.default.errors,(a)=>{if(e.const(i,Q._`${Zt.default.vErrors}[${a}]`),e.if(Q._`${i}.instancePath === undefined`,()=>e.assign(Q._`${i}.instancePath`,Q.strConcat(Zt.default.instancePath,o.errorPath))),e.assign(Q._`${i}.schemaPath`,Q.str`${o.errSchemaPath}/${t}`),o.opts.verbose)e.assign(Q._`${i}.schema`,n),e.assign(Q._`${i}.data`,r)})}mj.extendErrors=DL;function fj(e,t){let n=e.const("err",t);e.if(Q._`${Zt.default.vErrors} === null`,()=>e.assign(Zt.default.vErrors,Q._`[${n}]`),Q._`${Zt.default.vErrors}.push(${n})`),e.code(Q._`${Zt.default.errors}++`)}function dj(e,t){let{gen:n,validateName:r,schemaEnv:s}=e;if(s.$async)n.throw(Q._`new ${e.ValidationError}(${t})`);else n.assign(Q._`${r}.errors`,t),n.return(!1)}var To={keyword:new Q.Name("keyword"),schemaPath:new Q.Name("schemaPath"),params:new Q.Name("params"),propertyName:new Q.Name("propertyName"),message:new Q.Name("message"),schema:new Q.Name("schema"),parentSchema:new Q.Name("parentSchema")};function pj(e,t,n){let{createErrors:r}=e.it;if(r===!1)return Q._`{}`;return FL(e,t,n)}function FL(e,t,n={}){let{gen:r,it:s}=e,o=[LL(s,n),VL(e,n)];return qL(e,t,o),r.object(...o)}function LL({errorPath:e},{instancePath:t}){let n=t?Q.str`${e}${Cs.getErrorPath(t,Cs.Type.Str)}`:e;return[Zt.default.instancePath,Q.strConcat(Zt.default.instancePath,n)]}function VL({keyword:e,it:{errSchemaPath:t}},{schemaPath:n,parentSchema:r}){let s=r?t:Q.str`${t}/${e}`;if(n)s=Q.str`${s}${Cs.getErrorPath(n,Cs.Type.Str)}`;return[To.schemaPath,s]}function qL(e,{params:t,message:n},r){let{keyword:s,data:o,schemaValue:i,it:a}=e,{opts:c,propertyName:l,topSchemaRef:u,schemaPath:d}=a;if(r.push([To.keyword,s],[To.params,typeof t=="function"?t(e):t||Q._`{}`]),c.messages)r.push([To.message,typeof n=="function"?n(e):n]);if(c.verbose)r.push([To.schema,i],[To.parentSchema,Q._`${u}${d}`],[Zt.default.data,o]);if(l)r.push([To.propertyName,l])}});var wj=W(function(bj){Object.defineProperty(bj,"__esModule",{value:!0});bj.boolOrEmptySchema=bj.topBoolOrEmptySchema=void 0;var gj=Ec(),yj=ge(),zL=Mn(),KL={message:"boolean schema is false"};function GL(e){let{gen:t,schema:n,validateName:r}=e;if(n===!1)xj(e,!1);else if(typeof n=="object"&&n.$async===!0)t.return(zL.default.data);else t.assign(yj._`${r}.errors`,null),t.return(!0)}bj.topBoolOrEmptySchema=GL;function XL(e,t){let{gen:n,schema:r}=e;if(r===!1)n.var(t,!1),xj(e);else n.var(t,!0)}bj.boolOrEmptySchema=XL;function xj(e,t){let{gen:n,data:r}=e;gj.reportError({gen:n,keyword:"false schema",data:r,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},KL,void 0,t)}});var Oh=W(function(Sj){Object.defineProperty(Sj,"__esModule",{value:!0});Sj.getRules=Sj.isJSONType=void 0;var ZL=["string","number","integer","boolean","null","object","array"],QL=new Set(ZL);function e2(e){return typeof e=="string"&&QL.has(e)}Sj.isJSONType=e2;function t2(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}Sj.getRules=t2});var Ah=W(function(Pj){Object.defineProperty(Pj,"__esModule",{value:!0});Pj.shouldUseRule=Pj.shouldUseGroup=Pj.schemaHasRulesForType=void 0;function r2({schema:e,self:t},n){let r=t.RULES.types[n];return r&&r!==!0&&Ej(e,r)}Pj.schemaHasRulesForType=r2;function Ej(e,t){return t.rules.some((n)=>jj(e,n))}Pj.shouldUseGroup=Ej;function jj(e,t){var n;return e[t.keyword]!==void 0||((n=t.definition.implements)===null||n===void 0?void 0:n.some((r)=>e[r]!==void 0))}Pj.shouldUseRule=jj});var jc=W(function(Nj){Object.defineProperty(Nj,"__esModule",{value:!0});Nj.reportTypeError=Nj.checkDataTypes=Nj.checkDataType=Nj.coerceAndCheckDataType=Nj.getJSONTypes=Nj.getSchemaTypes=Nj.DataType=void 0;var kj=Oh(),Oj=Ah(),Aj=Ec(),B=ge(),rf=ke(),Ui;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(Ui||(Nj.DataType=Ui={}));function i2(e){let t=Rj(e.type);if(t.includes("null")){if(e.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(e.nullable===!0)t.push("null")}return t}Nj.getSchemaTypes=i2;function Rj(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(kj.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}Nj.getJSONTypes=Rj;function a2(e,t){let{gen:n,data:r,opts:s}=e,o=c2(t,s.coerceTypes),i=t.length>0&&!(o.length===0&&t.length===1&&Oj.schemaHasRulesForType(e,t[0]));if(i){let a=Ch(t,r,s.strictNumbers,Ui.Wrong);n.if(a,()=>{if(o.length)l2(e,t,o);else Nh(e)})}return i}Nj.coerceAndCheckDataType=a2;var Cj=new Set(["string","number","integer","boolean","null"]);function c2(e,t){return t?e.filter((n)=>Cj.has(n)||t==="array"&&n==="array"):[]}function l2(e,t,n){let{gen:r,data:s,opts:o}=e,i=r.let("dataType",B._`typeof ${s}`),a=r.let("coerced",B._`undefined`);if(o.coerceTypes==="array")r.if(B._`${i} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,()=>r.assign(s,B._`${s}[0]`).assign(i,B._`typeof ${s}`).if(Ch(t,s,o.strictNumbers),()=>r.assign(a,s)));r.if(B._`${a} !== undefined`);for(let l of n)if(Cj.has(l)||l==="array"&&o.coerceTypes==="array")c(l);r.else(),Nh(e),r.endIf(),r.if(B._`${a} !== undefined`,()=>{r.assign(s,a),u2(e,a)});function c(l){switch(l){case"string":r.elseIf(B._`${i} == "number" || ${i} == "boolean"`).assign(a,B._`"" + ${s}`).elseIf(B._`${s} === null`).assign(a,B._`""`);return;case"number":r.elseIf(B._`${i} == "boolean" || ${s} === null
618
- || (${i} == "string" && ${s} && ${s} == +${s})`).assign(a,B._`+${s}`);return;case"integer":r.elseIf(B._`${i} === "boolean" || ${s} === null
619
- || (${i} === "string" && ${s} && ${s} == +${s} && !(${s} % 1))`).assign(a,B._`+${s}`);return;case"boolean":r.elseIf(B._`${s} === "false" || ${s} === 0 || ${s} === null`).assign(a,!1).elseIf(B._`${s} === "true" || ${s} === 1`).assign(a,!0);return;case"null":r.elseIf(B._`${s} === "" || ${s} === 0 || ${s} === false`),r.assign(a,null);return;case"array":r.elseIf(B._`${i} === "string" || ${i} === "number"
620
- || ${i} === "boolean" || ${s} === null`).assign(a,B._`[${s}]`)}}}function u2({gen:e,parentData:t,parentDataProperty:n},r){e.if(B._`${t} !== undefined`,()=>e.assign(B._`${t}[${n}]`,r))}function Rh(e,t,n,r=Ui.Correct){let s=r===Ui.Correct?B.operators.EQ:B.operators.NEQ,o;switch(e){case"null":return B._`${t} ${s} null`;case"array":o=B._`Array.isArray(${t})`;break;case"object":o=B._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":o=i(B._`!(${t} % 1) && !isNaN(${t})`);break;case"number":o=i();break;default:return B._`typeof ${t} ${s} ${e}`}return r===Ui.Correct?o:B.not(o);function i(a=B.nil){return B.and(B._`typeof ${t} == "number"`,a,n?B._`isFinite(${t})`:B.nil)}}Nj.checkDataType=Rh;function Ch(e,t,n,r){if(e.length===1)return Rh(e[0],t,n,r);let s,o=rf.toHash(e);if(o.array&&o.object){let i=B._`typeof ${t} != "object"`;s=o.null?i:B._`!${t} || ${i}`,delete o.null,delete o.array,delete o.object}else s=B.nil;if(o.number)delete o.integer;for(let i in o)s=B.and(s,Rh(i,t,n,r));return s}Nj.checkDataTypes=Ch;var f2={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?B._`{type: ${e}}`:B._`{type: ${t}}`};function Nh(e){let t=d2(e);Aj.reportError(t,f2)}Nj.reportTypeError=Nh;function d2(e){let{gen:t,data:n,schema:r}=e,s=rf.schemaRefOrVal(e,r,"type");return{gen:t,keyword:"type",data:n,schema:r.type,schemaCode:s,schemaValue:s,parentSchema:r,params:{},it:e}}});var Fj=W(function(Mj){Object.defineProperty(Mj,"__esModule",{value:!0});Mj.assignDefaults=void 0;var Dn=ge(),Ij=ke();function b2(e,t){let{properties:n,items:r}=e.schema;if(t==="object"&&n)for(let s in n)Jj(e,s,n[s].default);else if(t==="array"&&Array.isArray(r))r.forEach((s,o)=>Jj(e,o,s.default))}Mj.assignDefaults=b2;function Jj(e,t,n){let{gen:r,compositeRule:s,data:o,opts:i}=e;if(n===void 0)return;let a=Dn._`${o}${Dn.getProperty(t)}`;if(s){Ij.checkStrictMode(e,`default is ignored for: ${a}`);return}let c=Dn._`${a} === undefined`;if(i.useDefaults==="empty")c=Dn._`${c} || ${a} === null || ${a} === ""`;r.if(c,Dn._`${a} = ${Dn.stringify(n)}`)}});var Fn=W(function(Wj){Object.defineProperty(Wj,"__esModule",{value:!0});Wj.validateUnion=Wj.validateArray=Wj.usePattern=Wj.callValidateCode=Wj.schemaProperties=Wj.allSchemaProperties=Wj.noPropertyInData=Wj.propertyInData=Wj.isOwnProperty=Wj.hasPropFunc=Wj.reportMissingProp=Wj.checkMissingProp=Wj.checkReportMissingProp=void 0;var ue=ge(),Bi=ke(),Ns=Mn(),Lj=ke();function $2(e,t){let{gen:n,data:r,it:s}=e;n.if(Jh(n,r,t,s.opts.ownProperties),()=>{e.setParams({missingProperty:ue._`${t}`},!0),e.error()})}Wj.checkReportMissingProp=$2;function w2({gen:e,data:t,it:{opts:n}},r,s){return ue.or(...r.map((o)=>ue.and(Jh(e,t,o,n.ownProperties),ue._`${s} = ${o}`)))}Wj.checkMissingProp=w2;function S2(e,t){e.setParams({missingProperty:t},!0),e.error()}Wj.reportMissingProp=S2;function Vj(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:ue._`Object.prototype.hasOwnProperty`})}Wj.hasPropFunc=Vj;function Th(e,t,n){return ue._`${Vj(e)}.call(${t}, ${n})`}Wj.isOwnProperty=Th;function v2(e,t,n,r){let s=ue._`${t}${ue.getProperty(n)} !== undefined`;return r?ue._`${s} && ${Th(e,t,n)}`:s}Wj.propertyInData=v2;function Jh(e,t,n,r){let s=ue._`${t}${ue.getProperty(n)} === undefined`;return r?ue.or(s,ue.not(Th(e,t,n))):s}Wj.noPropertyInData=Jh;function qj(e){return e?Object.keys(e).filter((t)=>t!=="__proto__"):[]}Wj.allSchemaProperties=qj;function E2(e,t){return qj(t).filter((n)=>!Bi.alwaysValidSchema(e,t[n]))}Wj.schemaProperties=E2;function j2({schemaCode:e,data:t,it:{gen:n,topSchemaRef:r,schemaPath:s,errorPath:o},it:i},a,c,l){let u=l?ue._`${e}, ${t}, ${r}${s}`:t,d=[[Ns.default.instancePath,ue.strConcat(Ns.default.instancePath,o)],[Ns.default.parentData,i.parentData],[Ns.default.parentDataProperty,i.parentDataProperty],[Ns.default.rootData,Ns.default.rootData]];if(i.opts.dynamicRef)d.push([Ns.default.dynamicAnchors,Ns.default.dynamicAnchors]);let p=ue._`${u}, ${n.object(...d)}`;return c!==ue.nil?ue._`${a}.call(${c}, ${p})`:ue._`${a}(${p})`}Wj.callValidateCode=j2;var P2=ue._`new RegExp`;function _2({gen:e,it:{opts:t}},n){let r=t.unicodeRegExp?"u":"",{regExp:s}=t.code,o=s(n,r);return e.scopeValue("pattern",{key:o.toString(),ref:o,code:ue._`${s.code==="new RegExp"?P2:Lj.useFunc(e,s)}(${n}, ${r})`})}Wj.usePattern=_2;function k2(e){let{gen:t,data:n,keyword:r,it:s}=e,o=t.name("valid");if(s.allErrors){let a=t.let("valid",!0);return i(()=>t.assign(a,!1)),a}return t.var(o,!0),i(()=>t.break()),o;function i(a){let c=t.const("len",ue._`${n}.length`);t.forRange("i",0,c,(l)=>{e.subschema({keyword:r,dataProp:l,dataPropType:Bi.Type.Num},o),t.if(ue.not(o),a)})}}Wj.validateArray=k2;function O2(e){let{gen:t,schema:n,keyword:r,it:s}=e;if(!Array.isArray(n))throw Error("ajv implementation error");if(n.some((c)=>Bi.alwaysValidSchema(s,c))&&!s.opts.unevaluated)return;let i=t.let("valid",!1),a=t.name("_valid");t.block(()=>n.forEach((c,l)=>{let u=e.subschema({keyword:r,schemaProp:l,compositeRule:!0},a);if(t.assign(i,ue._`${i} || ${a}`),!e.mergeValidEvaluated(u,a))t.if(ue.not(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}Wj.validateUnion=O2});var Yj=W(function(Gj){Object.defineProperty(Gj,"__esModule",{value:!0});Gj.validateKeywordUsage=Gj.validSchemaType=Gj.funcKeywordCode=Gj.macroKeywordCode=void 0;var De=ge(),Jo=Mn(),Bj=Fn(),zj=Ec();function q2(e,t){let{gen:n,keyword:r,schema:s,parentSchema:o,it:i}=e,a=t.macro.call(i.self,s,o,i),c=Kj(n,r,a);if(i.opts.validateSchema!==!1)i.self.validateSchema(a,!0);let l=n.name("valid");e.subschema({schema:a,schemaPath:De.nil,errSchemaPath:`${i.errSchemaPath}/${r}`,topSchemaRef:c,compositeRule:!0},l),e.pass(l,()=>e.error(!0))}Gj.macroKeywordCode=q2;function W2(e,t){var n;let{gen:r,keyword:s,schema:o,parentSchema:i,$data:a,it:c}=e;U2(c,t);let l=!a&&t.compile?t.compile.call(c.self,o,i,c):t.validate,u=Kj(r,s,l),d=r.let("valid");e.block$data(d,p),e.ok((n=t.valid)!==null&&n!==void 0?n:d);function p(){if(t.errors===!1){if(h(),t.modifying)Uj(e);g(()=>e.error())}else{let b=t.async?m():x();if(t.modifying)Uj(e);g(()=>H2(e,b))}}function m(){let b=r.let("ruleErrs",null);return r.try(()=>h(De._`await `),(j)=>r.assign(d,!1).if(De._`${j} instanceof ${c.ValidationError}`,()=>r.assign(b,De._`${j}.errors`),()=>r.throw(j))),b}function x(){let b=De._`${u}.errors`;return r.assign(b,null),h(De.nil),b}function h(b=t.async?De._`await `:De.nil){let j=c.opts.passContext?Jo.default.this:Jo.default.self,v=!(("compile"in t)&&!a||t.schema===!1);r.assign(d,De._`${b}${Bj.callValidateCode(e,u,j,v)}`,t.modifying)}function g(b){var j;r.if(De.not((j=t.valid)!==null&&j!==void 0?j:d),b)}}Gj.funcKeywordCode=W2;function Uj(e){let{gen:t,data:n,it:r}=e;t.if(r.parentData,()=>t.assign(n,De._`${r.parentData}[${r.parentDataProperty}]`))}function H2(e,t){let{gen:n}=e;n.if(De._`Array.isArray(${t})`,()=>{n.assign(Jo.default.vErrors,De._`${Jo.default.vErrors} === null ? ${t} : ${Jo.default.vErrors}.concat(${t})`).assign(Jo.default.errors,De._`${Jo.default.vErrors}.length`),zj.extendErrors(e)},()=>e.error())}function U2({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}function Kj(e,t,n){if(n===void 0)throw Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof n=="function"?{ref:n}:{ref:n,code:De.stringify(n)})}function B2(e,t,n=!1){return!t.length||t.some((r)=>r==="array"?Array.isArray(e):r==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==r||n&&typeof e>"u")}Gj.validSchemaType=B2;function z2({schema:e,opts:t,self:n,errSchemaPath:r},s,o){if(Array.isArray(s.keyword)?!s.keyword.includes(o):s.keyword!==o)throw Error("ajv implementation error");let i=s.dependencies;if(i===null||i===void 0?void 0:i.some((a)=>!Object.prototype.hasOwnProperty.call(e,a)))throw Error(`parent schema must have dependencies of ${o}: ${i.join(",")}`);if(s.validateSchema){if(!s.validateSchema(e[o])){let c=`keyword "${o}" value is invalid at path "${r}": `+n.errorsText(s.validateSchema.errors);if(t.validateSchema==="log")n.logger.error(c);else throw Error(c)}}}Gj.validateKeywordUsage=z2});var eP=W(function(Zj){Object.defineProperty(Zj,"__esModule",{value:!0});Zj.extendSubschemaMode=Zj.extendSubschemaData=Zj.getSubschema=void 0;var wt=ge(),sf=ke();function Y2(e,{keyword:t,schemaProp:n,schema:r,schemaPath:s,errSchemaPath:o,topSchemaRef:i}){if(t!==void 0&&r!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let a=e.schema[t];return n===void 0?{schema:a,schemaPath:wt._`${e.schemaPath}${wt.getProperty(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[n],schemaPath:wt._`${e.schemaPath}${wt.getProperty(t)}${wt.getProperty(n)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${sf.escapeFragment(n)}`}}if(r!==void 0){if(s===void 0||o===void 0||i===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:r,schemaPath:s,topSchemaRef:i,errSchemaPath:o}}throw Error('either "keyword" or "schema" must be passed')}Zj.getSubschema=Y2;function Z2(e,t,{dataProp:n,dataPropType:r,data:s,dataTypes:o,propertyName:i}){if(s!==void 0&&n!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(n!==void 0){let{errorPath:l,dataPathArr:u,opts:d}=t,p=a.let("data",wt._`${t.data}${wt.getProperty(n)}`,!0);c(p),e.errorPath=wt.str`${l}${sf.getErrorPath(n,r,d.jsPropertySyntax)}`,e.parentDataProperty=wt._`${n}`,e.dataPathArr=[...u,e.parentDataProperty]}if(s!==void 0){let l=s instanceof wt.Name?s:a.let("data",s,!0);if(c(l),i!==void 0)e.propertyName=i}if(o)e.dataTypes=o;function c(l){e.data=l,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,l]}}Zj.extendSubschemaData=Z2;function Q2(e,{jtdDiscriminator:t,jtdMetadata:n,compositeRule:r,createErrors:s,allErrors:o}){if(r!==void 0)e.compositeRule=r;if(s!==void 0)e.createErrors=s;if(o!==void 0)e.allErrors=o;e.jtdDiscriminator=t,e.jtdMetadata=n}Zj.extendSubschemaMode=Q2});var Ih=W(function(QZ,tP){tP.exports=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var r,s,o;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(s=r;s--!==0;)if(!e(t[s],n[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(o=Object.keys(t),r=o.length,r!==Object.keys(n).length)return!1;for(s=r;s--!==0;)if(!Object.prototype.hasOwnProperty.call(n,o[s]))return!1;for(s=r;s--!==0;){var i=o[s];if(!e(t[i],n[i]))return!1}return!0}return t!==t&&n!==n}});var rP=W(function(eQ,nP){var Ts=nP.exports=function(e,t,n){if(typeof t=="function")n=t,t={};n=t.cb||n;var r=typeof n=="function"?n:n.pre||function(){},s=n.post||function(){};of(t,r,s,e,"",e)};Ts.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Ts.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Ts.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Ts.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function of(e,t,n,r,s,o,i,a,c,l){if(r&&typeof r=="object"&&!Array.isArray(r)){t(r,s,o,i,a,c,l);for(var u in r){var d=r[u];if(Array.isArray(d)){if(u in Ts.arrayKeywords)for(var p=0;p<d.length;p++)of(e,t,n,d[p],s+"/"+u+"/"+p,o,s,u,r,p)}else if(u in Ts.propsKeywords){if(d&&typeof d=="object")for(var m in d)of(e,t,n,d[m],s+"/"+u+"/"+nV(m),o,s,u,r,m)}else if(u in Ts.keywords||e.allKeys&&!(u in Ts.skipKeywords))of(e,t,n,d,s+"/"+u,o,s,u,r)}n(r,s,o,i,a,c,l)}}function nV(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Pc=W(function(cP){Object.defineProperty(cP,"__esModule",{value:!0});cP.getSchemaRefs=cP.resolveUrl=cP.normalizeId=cP._getFullPath=cP.getFullPath=cP.inlineRef=void 0;var sP=ke(),rV=Ih(),sV=rP(),oV=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function iV(e,t=!0){if(typeof e=="boolean")return!0;if(t===!0)return!Mh(e);if(!t)return!1;return oP(e)<=t}cP.inlineRef=iV;var aV=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Mh(e){for(let t in e){if(aV.has(t))return!0;let n=e[t];if(Array.isArray(n)&&n.some(Mh))return!0;if(typeof n=="object"&&Mh(n))return!0}return!1}function oP(e){let t=0;for(let n in e){if(n==="$ref")return 1/0;if(t++,oV.has(n))continue;if(typeof e[n]=="object")sP.eachItem(e[n],(r)=>t+=oP(r));if(t===1/0)return 1/0}return t}function iP(e,t="",n){if(n!==!1)t=zi(t);let r=e.parse(t);return aP(e,r)}cP.getFullPath=iP;function aP(e,t){return e.serialize(t).split("#")[0]+"#"}cP._getFullPath=aP;var cV=/#\/?$/;function zi(e){return e?e.replace(cV,""):""}cP.normalizeId=zi;function lV(e,t,n){return n=zi(n),e.resolve(t,n)}cP.resolveUrl=lV;var uV=/^[a-z_][-a-z0-9._]*$/i;function fV(e,t){if(typeof e=="boolean")return{};let{schemaId:n,uriResolver:r}=this.opts,s=zi(e[n]||t),o={"":s},i=iP(r,s,!1),a={},c=new Set;return sV(e,{allKeys:!0},(d,p,m,x)=>{if(x===void 0)return;let h=i+p,g=o[x];if(typeof d[n]=="string")g=b.call(this,d[n]);j.call(this,d.$anchor),j.call(this,d.$dynamicAnchor),o[p]=g;function b(v){let P=this.opts.uriResolver.resolve;if(v=zi(g?P(g,v):v),c.has(v))throw u(v);c.add(v);let S=this.refs[v];if(typeof S=="string")S=this.refs[S];if(typeof S=="object")l(d,S.schema,v);else if(v!==zi(h))if(v[0]==="#")l(d,a[v],v),a[v]=d;else this.refs[v]=h;return v}function j(v){if(typeof v=="string"){if(!uV.test(v))throw Error(`invalid anchor "${v}"`);b.call(this,`#${v}`)}}}),a;function l(d,p,m){if(p!==void 0&&!rV(d,p))throw u(m)}function u(d){return Error(`reference "${d}" resolves to more than one schema`)}}cP.getSchemaRefs=fV});var Xi=W(function(EP){Object.defineProperty(EP,"__esModule",{value:!0});EP.getData=EP.KeywordCxt=EP.validateFunctionCode=void 0;var cf=wj(),af=jc(),Gi=Ah(),Js=jc(),pP=Fj(),br=Yj(),Ki=eP(),M=ge(),he=Mn(),mP=Pc(),kt=ke(),xr=Ec();function yV(e){if(yP(e)){if(xP(e),gP(e)){$V(e);return}}hP(e,()=>cf.topBoolOrEmptySchema(e))}EP.validateFunctionCode=yV;function hP({gen:e,validateName:t,schema:n,schemaEnv:r,opts:s},o){if(s.code.es5)e.func(t,M._`${he.default.data}, ${he.default.valCxt}`,r.$async,()=>{e.code(M._`"use strict"; ${uP(n,s)}`),bV(e,s),e.code(o)});else e.func(t,M._`${he.default.data}, ${xV(s)}`,r.$async,()=>e.code(uP(n,s)).code(o))}function xV(e){return M._`{${he.default.instancePath}="", ${he.default.parentData}, ${he.default.parentDataProperty}, ${he.default.rootData}=${he.default.data}${e.dynamicRef?M._`, ${he.default.dynamicAnchors}={}`:M.nil}}={}`}function bV(e,t){e.if(he.default.valCxt,()=>{if(e.var(he.default.instancePath,M._`${he.default.valCxt}.${he.default.instancePath}`),e.var(he.default.parentData,M._`${he.default.valCxt}.${he.default.parentData}`),e.var(he.default.parentDataProperty,M._`${he.default.valCxt}.${he.default.parentDataProperty}`),e.var(he.default.rootData,M._`${he.default.valCxt}.${he.default.rootData}`),t.dynamicRef)e.var(he.default.dynamicAnchors,M._`${he.default.valCxt}.${he.default.dynamicAnchors}`)},()=>{if(e.var(he.default.instancePath,M._`""`),e.var(he.default.parentData,M._`undefined`),e.var(he.default.parentDataProperty,M._`undefined`),e.var(he.default.rootData,he.default.data),t.dynamicRef)e.var(he.default.dynamicAnchors,M._`{}`)})}function $V(e){let{schema:t,opts:n,gen:r}=e;hP(e,()=>{if(n.$comment&&t.$comment)$P(e);if(jV(e),r.let(he.default.vErrors,null),r.let(he.default.errors,0),n.unevaluated)wV(e);bP(e),kV(e)});return}function wV(e){let{gen:t,validateName:n}=e;e.evaluated=t.const("evaluated",M._`${n}.evaluated`),t.if(M._`${e.evaluated}.dynamicProps`,()=>t.assign(M._`${e.evaluated}.props`,M._`undefined`)),t.if(M._`${e.evaluated}.dynamicItems`,()=>t.assign(M._`${e.evaluated}.items`,M._`undefined`))}function uP(e,t){let n=typeof e=="object"&&e[t.schemaId];return n&&(t.code.source||t.code.process)?M._`/*# sourceURL=${n} */`:M.nil}function SV(e,t){if(yP(e)){if(xP(e),gP(e)){vV(e,t);return}}cf.boolOrEmptySchema(e,t)}function gP({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let n in e)if(t.RULES.all[n])return!0;return!1}function yP(e){return typeof e.schema!="boolean"}function vV(e,t){let{schema:n,gen:r,opts:s}=e;if(s.$comment&&n.$comment)$P(e);PV(e),_V(e);let o=r.const("_errs",he.default.errors);bP(e,o),r.var(t,M._`${o} === ${he.default.errors}`)}function xP(e){kt.checkUnknownRules(e),EV(e)}function bP(e,t){if(e.opts.jtd)return fP(e,[],!1,t);let n=af.getSchemaTypes(e.schema),r=af.coerceAndCheckDataType(e,n);fP(e,n,!r,t)}function EV(e){let{schema:t,errSchemaPath:n,opts:r,self:s}=e;if(t.$ref&&r.ignoreKeywordsWithRef&&kt.schemaHasRulesButRef(t,s.RULES))s.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}function jV(e){let{schema:t,opts:n}=e;if(t.default!==void 0&&n.useDefaults&&n.strictSchema)kt.checkStrictMode(e,"default is ignored in the schema root")}function PV(e){let t=e.schema[e.opts.schemaId];if(t)e.baseId=mP.resolveUrl(e.opts.uriResolver,e.baseId,t)}function _V(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function $P({gen:e,schemaEnv:t,schema:n,errSchemaPath:r,opts:s}){let o=n.$comment;if(s.$comment===!0)e.code(M._`${he.default.self}.logger.log(${o})`);else if(typeof s.$comment=="function"){let i=M.str`${r}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code(M._`${he.default.self}.opts.$comment(${o}, ${i}, ${a}.schema)`)}}function kV(e){let{gen:t,schemaEnv:n,validateName:r,ValidationError:s,opts:o}=e;if(n.$async)t.if(M._`${he.default.errors} === 0`,()=>t.return(he.default.data),()=>t.throw(M._`new ${s}(${he.default.vErrors})`));else{if(t.assign(M._`${r}.errors`,he.default.vErrors),o.unevaluated)OV(e);t.return(M._`${he.default.errors} === 0`)}}function OV({gen:e,evaluated:t,props:n,items:r}){if(n instanceof M.Name)e.assign(M._`${t}.props`,n);if(r instanceof M.Name)e.assign(M._`${t}.items`,r)}function fP(e,t,n,r){let{gen:s,schema:o,data:i,allErrors:a,opts:c,self:l}=e,{RULES:u}=l;if(o.$ref&&(c.ignoreKeywordsWithRef||!kt.schemaHasRulesButRef(o,u))){s.block(()=>SP(e,"$ref",u.all.$ref.definition));return}if(!c.jtd)AV(e,t);s.block(()=>{for(let p of u.rules)d(p);d(u.post)});function d(p){if(!Gi.shouldUseGroup(o,p))return;if(p.type){if(s.if(Js.checkDataType(p.type,i,c.strictNumbers)),dP(e,p),t.length===1&&t[0]===p.type&&n)s.else(),Js.reportTypeError(e);s.endIf()}else dP(e,p);if(!a)s.if(M._`${he.default.errors} === ${r||0}`)}}function dP(e,t){let{gen:n,schema:r,opts:{useDefaults:s}}=e;if(s)pP.assignDefaults(e,t.type);n.block(()=>{for(let o of t.rules)if(Gi.shouldUseRule(r,o))SP(e,o.keyword,o.definition,t.type)})}function AV(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;if(RV(e,t),!e.opts.allowUnionTypes)CV(e,t);NV(e,e.dataTypes)}function RV(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((n)=>{if(!wP(e.dataTypes,n))Dh(e,`type "${n}" not allowed by context "${e.dataTypes.join(",")}"`)}),JV(e,t)}function CV(e,t){if(t.length>1&&!(t.length===2&&t.includes("null")))Dh(e,"use allowUnionTypes to allow union type keyword")}function NV(e,t){let n=e.self.RULES.all;for(let r in n){let s=n[r];if(typeof s=="object"&&Gi.shouldUseRule(e.schema,s)){let{type:o}=s.definition;if(o.length&&!o.some((i)=>TV(t,i)))Dh(e,`missing type "${o.join(",")}" for keyword "${r}"`)}}}function TV(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function wP(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function JV(e,t){let n=[];for(let r of e.dataTypes)if(wP(t,r))n.push(r);else if(t.includes("integer")&&r==="number")n.push("integer");e.dataTypes=n}function Dh(e,t){let n=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${n}" (strictTypes)`,kt.checkStrictMode(e,t,e.opts.strictTypes)}class Fh{constructor(e,t,n){if(br.validateKeywordUsage(e,t,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=kt.schemaRefOrVal(e,this.schema,n,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",vP(this.$data,e));else if(this.schemaCode=this.schemaValue,!br.validSchemaType(this.schema,t.schemaType,t.allowUndefined))throw Error(`${n} value must be ${JSON.stringify(t.schemaType)}`);if("code"in t?t.trackErrors:t.errors!==!1)this.errsCount=e.gen.const("_errs",he.default.errors)}result(e,t,n){this.failResult(M.not(e),t,n)}failResult(e,t,n){if(this.gen.if(e),n)n();else this.error();if(t){if(this.gen.else(),t(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(e,t){this.failResult(M.not(e),void 0,t)}fail(e){if(e===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(e),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail(M._`${t} !== undefined && (${M.or(this.invalid$data(),e)})`)}error(e,t,n){if(t){this.setParams(t),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,t){(e?xr.reportExtraError:xr.reportError)(this,this.def.error,t)}$dataError(){xr.reportError(this,this.def.$dataError||xr.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');xr.resetErrorsCount(this.gen,this.errsCount)}ok(e){if(!this.allErrors)this.gen.if(e)}setParams(e,t){if(t)Object.assign(this.params,e);else this.params=e}block$data(e,t,n=M.nil){this.gen.block(()=>{this.check$data(e,n),t()})}check$data(e=M.nil,t=M.nil){if(!this.$data)return;let{gen:n,schemaCode:r,schemaType:s,def:o}=this;if(n.if(M.or(M._`${r} === undefined`,t)),e!==M.nil)n.assign(e,!0);if(s.length||o.validateSchema){if(n.elseIf(this.invalid$data()),this.$dataError(),e!==M.nil)n.assign(e,!1)}n.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:n,def:r,it:s}=this;return M.or(o(),i());function o(){if(n.length){if(!(t instanceof M.Name))throw Error("ajv implementation error");let a=Array.isArray(n)?n:[n];return M._`${Js.checkDataTypes(a,t,s.opts.strictNumbers,Js.DataType.Wrong)}`}return M.nil}function i(){if(r.validateSchema){let a=e.scopeValue("validate$data",{ref:r.validateSchema});return M._`!${a}(${t})`}return M.nil}}subschema(e,t){let n=Ki.getSubschema(this.it,e);Ki.extendSubschemaData(n,this.it,e),Ki.extendSubschemaMode(n,e);let r={...this.it,...n,items:void 0,props:void 0};return SV(r,t),r}mergeEvaluated(e,t){let{it:n,gen:r}=this;if(!n.opts.unevaluated)return;if(n.props!==!0&&e.props!==void 0)n.props=kt.mergeEvaluated.props(r,e.props,n.props,t);if(n.items!==!0&&e.items!==void 0)n.items=kt.mergeEvaluated.items(r,e.items,n.items,t)}mergeValidEvaluated(e,t){let{it:n,gen:r}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return r.if(t,()=>this.mergeEvaluated(e,M.Name)),!0}}EP.KeywordCxt=Fh;function SP(e,t,n,r){let s=new Fh(e,n,t);if("code"in n)n.code(s,r);else if(s.$data&&n.validate)br.funcKeywordCode(s,n);else if("macro"in n)br.macroKeywordCode(s,n);else if(n.compile||n.validate)br.funcKeywordCode(s,n)}var IV=/^\/(?:[^~]|~0|~1)*$/,MV=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function vP(e,{dataLevel:t,dataNames:n,dataPathArr:r}){let s,o;if(e==="")return he.default.rootData;if(e[0]==="/"){if(!IV.test(e))throw Error(`Invalid JSON-pointer: ${e}`);s=e,o=he.default.rootData}else{let l=MV.exec(e);if(!l)throw Error(`Invalid JSON-pointer: ${e}`);let u=+l[1];if(s=l[2],s==="#"){if(u>=t)throw Error(c("property/index",u));return r[t-u]}if(u>t)throw Error(c("data",u));if(o=n[t-u],!s)return o}let i=o,a=s.split("/");for(let l of a)if(l)o=M._`${o}${M.getProperty(kt.unescapeJsonPointer(l))}`,i=M._`${i} && ${o}`;return i;function c(l,u){return`Cannot access ${l} ${u} levels up, current level is ${t}`}}EP.getData=vP});var _c=W(function(_P){Object.defineProperty(_P,"__esModule",{value:!0});class PP extends Error{constructor(e){super("validation failed");this.errors=e,this.ajv=this.validation=!0}}_P.default=PP});var Zi=W(function(OP){Object.defineProperty(OP,"__esModule",{value:!0});var Yi=Pc();class kP extends Error{constructor(e,t,n,r){super(r||`can't resolve reference ${n} from id ${t}`);this.missingRef=Yi.resolveUrl(e,t,n),this.missingSchema=Yi.normalizeId(Yi.getFullPath(e,this.missingRef))}}OP.default=kP});var Oc=W(function(CP){Object.defineProperty(CP,"__esModule",{value:!0});CP.resolveSchema=CP.getCompilingSchema=CP.resolveRef=CP.compileSchema=CP.SchemaEnv=void 0;var lt=ge(),qV=_c(),Io=Mn(),ut=Pc(),lf=ke(),AP=Xi();class kc{constructor(e){var t;this.refs={},this.dynamicAnchors={};let n;if(typeof e.schema=="object")n=e.schema;this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(t=e.baseId)!==null&&t!==void 0?t:ut.normalizeId(n===null||n===void 0?void 0:n[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n===null||n===void 0?void 0:n.$async,this.refs={}}}CP.SchemaEnv=kc;function Vh(e){let t=RP.call(this,e);if(t)return t;let n=ut.getFullPath(this.opts.uriResolver,e.root.baseId),{es5:r,lines:s}=this.opts.code,{ownProperties:o}=this.opts,i=new lt.CodeGen(this.scope,{es5:r,lines:s,ownProperties:o}),a;if(e.$async)a=i.scopeValue("Error",{ref:qV.default,code:lt._`require("ajv/dist/runtime/validation_error").default`});let c=i.scopeName("validate");e.validateName=c;let l={gen:i,allErrors:this.opts.allErrors,data:Io.default.data,parentData:Io.default.parentData,parentDataProperty:Io.default.parentDataProperty,dataNames:[Io.default.data],dataPathArr:[lt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:lt.stringify(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:n,baseId:e.baseId||n,schemaPath:lt.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:lt._`""`,opts:this.opts,self:this},u;try{this._compilations.add(e),AP.validateFunctionCode(l),i.optimize(this.opts.code.optimize);let d=i.toString();if(u=`${i.scopeRefs(Io.default.scope)}return ${d}`,this.opts.code.process)u=this.opts.code.process(u,e);let m=Function(`${Io.default.self}`,`${Io.default.scope}`,u)(this,this.scope.get());if(this.scope.value(c,{ref:m}),m.errors=null,m.schema=e.schema,m.schemaEnv=e,e.$async)m.$async=!0;if(this.opts.code.source===!0)m.source={validateName:c,validateCode:d,scopeValues:i._values};if(this.opts.unevaluated){let{props:x,items:h}=l;if(m.evaluated={props:x instanceof lt.Name?void 0:x,items:h instanceof lt.Name?void 0:h,dynamicProps:x instanceof lt.Name,dynamicItems:h instanceof lt.Name},m.source)m.source.evaluated=lt.stringify(m.evaluated)}return e.validate=m,e}catch(d){if(delete e.validate,delete e.validateName,u)this.logger.error("Error compiling schema, function code:",u);throw d}finally{this._compilations.delete(e)}}CP.compileSchema=Vh;function WV(e,t,n){var r;n=ut.resolveUrl(this.opts.uriResolver,t,n);let s=e.refs[n];if(s)return s;let o=BV.call(this,e,n);if(o===void 0){let i=(r=e.localRefs)===null||r===void 0?void 0:r[n],{schemaId:a}=this.opts;if(i)o=new kc({schema:i,schemaId:a,root:e,baseId:t})}if(o===void 0)return;return e.refs[n]=HV.call(this,o)}CP.resolveRef=WV;function HV(e){if(ut.inlineRef(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:Vh.call(this,e)}function RP(e){for(let t of this._compilations)if(UV(t,e))return t}CP.getCompilingSchema=RP;function UV(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function BV(e,t){let n;while(typeof(n=this.refs[t])=="string")t=n;return n||this.schemas[t]||uf.call(this,e,t)}function uf(e,t){let n=this.opts.uriResolver.parse(t),r=ut._getFullPath(this.opts.uriResolver,n),s=ut.getFullPath(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&r===s)return Lh.call(this,n,e);let o=ut.normalizeId(r),i=this.refs[o]||this.schemas[o];if(typeof i=="string"){let a=uf.call(this,e,i);if(typeof(a===null||a===void 0?void 0:a.schema)!=="object")return;return Lh.call(this,n,a)}if(typeof(i===null||i===void 0?void 0:i.schema)!=="object")return;if(!i.validate)Vh.call(this,i);if(o===ut.normalizeId(t)){let{schema:a}=i,{schemaId:c}=this.opts,l=a[c];if(l)s=ut.resolveUrl(this.opts.uriResolver,s,l);return new kc({schema:a,schemaId:c,root:e,baseId:s})}return Lh.call(this,n,i)}CP.resolveSchema=uf;var zV=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Lh(e,{baseId:t,schema:n,root:r}){var s;if(((s=e.fragment)===null||s===void 0?void 0:s[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof n==="boolean")return;let c=n[lf.unescapeFragment(a)];if(c===void 0)return;n=c;let l=typeof n==="object"&&n[this.opts.schemaId];if(!zV.has(a)&&l)t=ut.resolveUrl(this.opts.uriResolver,t,l)}let o;if(typeof n!="boolean"&&n.$ref&&!lf.schemaHasRulesButRef(n,this.RULES)){let a=ut.resolveUrl(this.opts.uriResolver,t,n.$ref);o=uf.call(this,r,a)}let{schemaId:i}=this.opts;if(o=o||new kc({schema:n,schemaId:i,root:r,baseId:t}),o.schema!==o.root.schema)return o;return}});var TP=W(function(iQ,ZV){ZV.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var zh=W(function(aQ,qP){var QV=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Wh=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),eq=RegExp.prototype.test.bind(/^\d*$/u),Mo=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),Hh=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),IP=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),Uh=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),tq=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),un=Array(256);for(let t=0;t<256;t++)un[t]="%"+"0123456789ABCDEF"[t>>4]+"0123456789ABCDEF"[t&15];function qt(e){if(e<2048)return un[192|e>>6]+un[128|e&63];if(e<65536)return un[224|e>>12]+un[128|e>>6&63]+un[128|e&63];return un[240|e>>18]+un[128|e>>12&63]+un[128|e>>6&63]+un[128|e&63]}function nq(e){let t="",n=0,r=0;for(r=0;r<e.length;r++){if(n=e[r].charCodeAt(0),n===48)continue;if(!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return"";t+=e[r];break}for(r+=1;r<e.length;r++){if(n=e[r].charCodeAt(0),!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return"";t+=e[r]}return t}var rq=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),sq=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),oq=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),iq=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function aq(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++){if(oq(e[t]))continue;if(e[t]==="%"&&t+2<e.length&&Mo(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function JP(e){let t=-1,n=0,r=-1,s=0;for(let a=0;a<e.length;a++)if(e[a]==="0"){if(r===-1)r=a;if(s++,s>n)n=s,t=r}else r=-1,s=0;if(n<2)return e.join(":");let o=e.slice(0,t).join(":"),i=e.slice(t+n).join(":");return o+"::"+i}function cq(e){let t=e.indexOf("::");if(t!==-1&&e.indexOf("::",t+1)!==-1)return;let n=t===-1?e.split(":"):e.slice(0,t).split(":"),r=t===-1?[]:e.slice(t+2).split(":");if(t!==-1){if(n.length===1&&n[0]==="")n.length=0;if(r.length===1&&r[0]==="")r.length=0}let s=n.concat(r),o=0;for(let a=0;a<s.length;a++){let c=s[a];if(c==="")return;if(c.indexOf(".")!==-1){if(a!==s.length-1||t!==-1&&r.length===0||!Wh(c))return;o+=2;continue}if(!rq(c))return;s[a]=parseInt(c,16).toString(16),o++}if(t===-1){if(o!==8)return;return JP(s)}if(o>=8)return;let i=s.slice(0,n.length);for(let a=o;a<8;a++)i.push("0");for(let a=n.length;a<s.length;a++)i.push(s[a]);return JP(i)}function qh(e){let t=e[0]==="["&&e[e.length-1]==="]";if((e[0]==="["||e[e.length-1]==="]")&&!t)return{host:e,isIPV6:!1,error:!0};let r=t?e.slice(1,-1):e;if(t&&sq(r))return r=r.toLowerCase(),{host:`[${r}]`,escapedHost:r,isIPV6:!1,isIPVFuture:!0};if(lq(r,":")<2)return{host:e,isIPV6:!1,error:t};let s="",o=r.indexOf("%");if(o!==-1){let a=r.slice(o,o+3).toLowerCase()==="%25"?3:1;if(s=r.slice(o+a),!aq(s))return{host:e,isIPV6:!1,error:!0};r=r.slice(0,o)}let i=cq(r);if(i===void 0)return{host:e,isIPV6:!1,error:!0};return{host:i+(s?"%"+s:""),escapedHost:i+(s?"%25"+s:""),isIPV6:!0}}function lq(e,t){let n=0;for(let r=0;r<e.length;r++)if(e[r]===t)n++;return n}function MP(e){let t=e,n=[],r=-1,s=0;while(s=t.length){if(s===1)if(t===".")break;else if(t==="/"){n.push("/");break}else{n.push(t);break}else if(s===2){if(t[0]==="."){if(t[1]===".")break;else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."||t[1]==="/"){n.push("/");break}}}else if(s===3){if(t==="/.."){if(n.length!==0)n.pop();n.push("/");break}}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."){if(t[3]==="/"){if(t=t.slice(3),n.length!==0)n.pop();continue}}}}if((r=t.indexOf("/",1))===-1){n.push(t);break}else n.push(t.slice(0,r)),t=t.slice(r)}return n.join("")}function uq(e){if(e===""||e[0]==="/")return MP(e);let t=e.split("/"),n=t.length-1,r=[],s=!1;for(let o=0;o<=n;o++){let i=t[o];if(i==="."||i===".."){if(i==="..")if(r.length!==0&&r[r.length-1]!=="..")r.pop();else r.push("..");s=o===n}else r.push(i)}if(s&&r[r.length-1]!=="..")r.push("");if(r.length===0||r[0]===""||r[0].includes(":"))r.unshift(".");return r.join("/")}var fq={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},dq=/[@/?#:]/g,pq=/[@/?#]/g;function DP(e,t){let n=t?pq:dq;return n.lastIndex=0,e.replace(n,(r)=>fq[r])}function FP(e,t=!1){if(e.indexOf("%")===-1)return e;let n="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let s=e.slice(r+1,r+3);if(Mo(s)){let o=s.toUpperCase(),i=String.fromCharCode(parseInt(o,16));if(t&&Hh(i))n+=i;else n+="%"+o;r+=2;continue}}n+=e[r]}return n}function mq(e){let t="";for(let n=0;n<e.length;n++){let r=e[n];if(r==="%"&&n+2<e.length){let s=e.slice(n+1,n+3);if(Mo(s)){let o=s.toUpperCase(),i=String.fromCharCode(parseInt(o,16));if(i!=="."&&Hh(i))t+=i;else t+="%"+o;n+=2;continue}}if(IP(r))t+=r;else{let s=e.charCodeAt(n);if(s<128)t+=VP(s)?r:un[s];else if(s<55296||s>57343)t+=qt(s);else if(s<=56319&&n+1<e.length){let o=e.charCodeAt(n+1);if(o>=56320&&o<=57343)t+=qt(65536+(s-55296<<10)+(o-56320)),n++;else t+=qt(65533)}else t+=qt(65533)}}return t}function hq(e,t=!1){let n="",r=t&&e[0]!=="/";for(let s=0;s<e.length;s++){let o=e[s];if(o==="%"&&s+2<e.length){let i=e.slice(s+1,s+3);if(Mo(i)){n+="%"+i.toUpperCase(),s+=2;continue}}if(o==="/")r=!1;if(IP(o)&&(o!==":"||!r))n+=o;else{let i=e.charCodeAt(s);if(i<128)n+=un[i];else if(i<55296||i>57343)n+=qt(i);else if(i<=56319&&s+1<e.length){let a=e.charCodeAt(s+1);if(a>=56320&&a<=57343)n+=qt(65536+(i-55296<<10)+(a-56320)),s++;else n+=qt(65533)}else n+=qt(65533)}}return n}function Bh(e,t){let n="";for(let r=0;r<e.length;r++){let s=e[r];if(s==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(Mo(o)){n+="%"+o.toUpperCase(),r+=2;continue}}if(t(s))n+=s;else{let o=e.charCodeAt(r);if(o<128)n+=un[o];else if(o<55296||o>57343)n+=qt(o);else if(o<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);if(i>=56320&&i<=57343)n+=qt(65536+(o-55296<<10)+(i-56320)),r++;else n+=qt(65533)}else n+=qt(65533)}}return n}function LP(e){return Bh(e,tq)}function gq(e){return Bh(e,Uh)}function yq(e){return Bh(e,Uh)}function VP(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===42||e===43||e===45||e===46||e===47||e===64||e===95}function xq(e){let t="";for(let n=0;n<e.length;n++){let r=e[n];if(r==="%"&&n+2<e.length){let s=e.slice(n+1,n+3);if(Mo(s)){let o=s.toUpperCase(),i=String.fromCharCode(parseInt(o,16));if(Hh(i))t+=i;else t+="%"+o;n+=2;continue}}if(Uh(r))t+=r;else{let s=e.charCodeAt(n);if(s<128)t+=VP(s)?r:un[s];else if(s<55296||s>57343)t+=qt(s);else if(s<=56319&&n+1<e.length){let o=e.charCodeAt(n+1);if(o>=56320&&o<=57343)t+=qt(65536+(s-55296<<10)+(o-56320)),n++;else t+=qt(65533)}else t+=qt(65533)}}return t}function bq(e){let t="";for(let n=0;n<e.length;n++){if(e[n]==="%"&&n+2<e.length){let r=e.slice(n+1,n+3);if(Mo(r)){t+="%"+r.toUpperCase(),n+=2;continue}}t+=escape(e[n])}return t}function $q(e){let t=[];if(e.userinfo!==void 0)t.push(LP(e.userinfo)),t.push("@");if(e.host!==void 0){let n=e.host;if(!Wh(n)){let r=qh(n);if(r.isIPV6!==!0&&r.isIPVFuture!==!0)n=FP(n,!0),r=qh(n);if(r.isIPV6===!0||r.isIPVFuture===!0)n=`[${r.escapedHost}]`;else n=DP(n,!1)}t.push(n)}if(typeof e.port==="number"||typeof e.port==="string"){let n=String(e.port);if(!eq(n))throw TypeError("URI port is malformed.");t.push(":"),t.push(n)}return t.length?t.join(""):void 0}qP.exports={nonSimpleDomain:iq,recomposeAuthority:$q,reescapeHostDelimiters:DP,normalizePercentEncoding:FP,normalizePathEncoding:mq,serializePathEncoding:hq,normalizeQueryFragmentEncoding:xq,encodeUserinfo:LP,encodeQuery:gq,encodeFragment:yq,escapePreservingEscapes:bq,removeDotSegments:MP,removeDotSegmentsRelative:uq,isIPv4:Wh,isUUID:QV,normalizeIPv6:qh,stringArrayToHexStripped:nq}});var zP=W(function(cQ,BP){var{isUUID:wq}=zh(),Sq=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,vq=["http","https","ws","wss","urn","urn:uuid"];function Eq(e){return vq.indexOf(e)!==-1}function Kh(e){if(e.secure===!0)return!0;else if(e.secure===!1)return!1;else if(e.scheme)return e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S");else return!1}function WP(e){if(!e.host)e.error=e.error||"HTTP URIs must have a host.";return e}function HP(e){let t=String(e.scheme).toLowerCase()==="https";if(e.port===(t?443:80)||e.port==="")e.port=void 0;if(!e.path)e.path="/";return e}function jq(e){return e.secure=Kh(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function Pq(e){if(e.port===(Kh(e)?443:80)||e.port==="")e.port=void 0;if(typeof e.secure==="boolean")e.scheme=e.secure?"wss":"ws",e.secure=void 0;if(e.resourceName){let t=e.resourceName.indexOf("?"),n=t===-1?e.resourceName:e.resourceName.slice(0,t);e.path=n&&n!=="/"?n:void 0,e.query=t===-1?void 0:e.resourceName.slice(t+1),e.resourceName=void 0}return e.fragment=void 0,e}function _q(e,t){if(!e.path)return e.error="URN can not be parsed",e;let n=e.path.match(Sq);if(n&&n[0]===e.path){let r=t.scheme||e.scheme||"urn";e.nid=n[1].toLowerCase(),e.nss=n[2];let s=`${r}:${t.nid||e.nid}`,o=Gh(s);if(e.path=void 0,o)e=o.parse(e,t)}else e.error=e.error||"URN can not be parsed.";return e}function kq(e,t){if(e.nid===void 0)throw Error("URN without nid cannot be serialized");let n=t.scheme||e.scheme||"urn",r=e.nid.toLowerCase(),s=`${n}:${t.nid||r}`,o=Gh(s);if(o)e=o.serialize(e,t);let i=e,a=e.nss;return i.path=`${r||t.nid}:${a}`,t.skipEscape=!0,i}function Oq(e,t){let n=e;if(n.uuid=n.nss,n.nss=void 0,!t.tolerant&&(!n.uuid||!wq(n.uuid)))n.error=n.error||"UUID is not valid.";return n}function Aq(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var UP={scheme:"http",domainHost:!0,parse:WP,serialize:HP},Rq={scheme:"https",domainHost:UP.domainHost,parse:WP,serialize:HP},ff={scheme:"ws",domainHost:!0,parse:jq,serialize:Pq},Cq={scheme:"wss",domainHost:ff.domainHost,parse:ff.parse,serialize:ff.serialize},Nq={scheme:"urn",parse:_q,serialize:kq,skipNormalize:!0},Tq={scheme:"urn:uuid",parse:Oq,serialize:Aq,skipNormalize:!0},df={http:UP,https:Rq,ws:ff,wss:Cq,urn:Nq,"urn:uuid":Tq};Object.setPrototypeOf(df,null);function Gh(e){return e&&(df[e]||df[e.toLowerCase()])||void 0}BP.exports={wsIsSecure:Kh,SCHEMES:df,isValidSchemeName:Eq,getSchemeHandler:Gh}});var a_=W(function(lQ,gf){var{normalizeIPv6:ZP,removeDotSegments:Rc,removeDotSegmentsRelative:QP,recomposeAuthority:Jq,normalizePercentEncoding:Xh,normalizePathEncoding:Iq,serializePathEncoding:KP,normalizeQueryFragmentEncoding:GP,encodeQuery:Mq,encodeFragment:Dq,reescapeHostDelimiters:Fq,isIPv4:e_,nonSimpleDomain:Lq}=zh(),{SCHEMES:t_,getSchemeHandler:Yh}=zP(),n_=/^[A-Za-z][A-Za-z0-9+.-]*$/u,Vq=/[\0-\x20"#/:<>?@[\\\]^`{|}\x7F]/u;function XP(e){let t=String(e);if(!n_.test(t))throw TypeError("URI scheme is malformed.");return t}function qq(e,t){if(typeof e==="string")e=Yq(e,t);else if(typeof e==="object")e=mf(Do(e,t),t);return e}function Wq(e,t,n){let r=n?Object.assign({scheme:"null"},n):{scheme:"null"},{parsed:s,malformedAuthorityOrPort:o,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:c,malformedScheme:l}=pf(e,r),{parsed:u,malformedAuthorityOrPort:d,malformedPercentEncoding:p,malformedSchemeSpecific:m,malformedHost:x,malformedScheme:h}=pf(t,r);if(o||d||i||p||a||m||c||x||l||h)throw Error(s.error||u.error||"URI is malformed.");let g=r_(s,u,r,!0),b=Yh(n&&n.scheme||g.scheme),j=g.host,v=j!==void 0&&j!==""&&(e_(j)||ZP(j).isIPV6);if(o_(g,n||{},b,v))throw Error("URI host is malformed.");s_(g,n||{},b,v);let P=j&&j.indexOf("%")!==-1&&!/\P{ASCII}/u.test(j);if(g.error&&!P)throw Error(g.error);return r.skipEscape=!0,Do(g,r)}function r_(e,t,n,r){let s={};if(!r)e=mf(Do(e,n),n),t=mf(Do(t,n),n);if(n=n||{},!n.tolerant&&t.scheme)s.scheme=t.scheme,s.userinfo=t.userinfo,s.host=t.host,s.port=t.port,s.path=Rc(t.path||""),s.query=t.query;else{if(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)s.userinfo=t.userinfo,s.host=t.host,s.port=t.port,s.path=Rc(t.path||""),s.query=t.query;else{if(!t.path)if(s.path=e.path,t.query!==void 0)s.query=t.query;else s.query=e.query;else{if(t.path[0]==="/")s.path=Rc(t.path);else{let o=e.userinfo!==void 0||e.host!==void 0||e.port!==void 0;if(o&&!e.path)s.path="/"+t.path;else if(!e.path)s.path=t.path;else s.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path;s.path=e.scheme===void 0&&!o&&s.path[0]!=="/"?QP(s.path):Rc(s.path)}s.query=t.query}s.userinfo=e.userinfo,s.host=e.host,s.port=e.port}s.scheme=e.scheme}return s.fragment=t.fragment,s}function Hq(e,t,n){let r=YP(e,n),s=YP(t,n);return r!==void 0&&s!==void 0&&r===s}function Do(e,t){let n={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},r=Object.assign({},t),s=[];if(n.scheme)n.scheme=XP(n.scheme);let o=Yh(r.scheme||n.scheme);if(o&&o.serialize)o.serialize(n,r);let i=n.userinfo!==void 0||n.host!==void 0||n.port!==void 0,a=(n.scheme===void 0||r.reference==="suffix")&&!i,c=!r.skipEscape&&a;if(n.path!==void 0)if(!r.skipEscape)n.path=KP(n.path,c);else n.path=Xh(n.path);if(r.reference!=="suffix"&&n.scheme)n.scheme=XP(n.scheme),s.push(n.scheme,":");let l=Jq(n);if(l!==void 0){if(r.reference!=="suffix")s.push("//");if(s.push(l),n.path&&n.path[0]!=="/")s.push("/")}if(n.path!==void 0){let u=n.path;if(!r.absolutePath&&(!o||!o.absolutePath))u=a&&u[0]!=="/"?QP(u):Rc(u);if(a)u=KP(u,!0);if(l===void 0&&u[0]==="/"&&u[1]==="/")u="/%2F"+u.slice(2);s.push(u)}if(n.query!==void 0)s.push("?",Mq(n.query));if(n.fragment!==void 0)s.push("#",Dq(n.fragment));return s.join("")}var Uq=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,Bq=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,zq=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function Kq(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof e.port==="number"&&(e.port<0||e.port>65535))return"URI port is malformed.";return}function Ac(e){if(e===void 0)return!1;let t=e.indexOf("%");while(t!==-1){if(t+2>=e.length||!/^[\da-f]{2}$/iu.test(e.slice(t+1,t+3)))return!0;t=e.indexOf("%",t+3)}return!1}function hf(e){return e[0]==="["&&e[e.length-1]==="]"}function Gq(e){let t=e[4];return Ac(e[3])||t!==void 0&&!hf(t)&&Ac(t)||Ac(e[6])||Ac(e[7])||Ac(e[8])}function s_(e,t,n,r){if(o_(e,t,n,r))return e.error=e.error||"URI host is malformed.",!0;if(!t.unicodeSupport&&(!n||!n.unicodeSupport)&&e.host&&!hf(e.host)&&(t.domainHost||n&&n.domainHost)&&r===!1&&Lq(e.host)){let s;try{s=new URL("http://"+e.host)}catch(o){return e.error=e.error||"Host's domain name can not be converted to ASCII: "+o,!0}if(!Xq(s))return e.error=e.error||"URI host is malformed.",!0;e.host=s.hostname}return!1}function o_(e,t,n,r){return Boolean(e.host&&r===!1&&!hf(e.host)&&(t.domainHost||n&&n.domainHost)&&Vq.test(e.host))}function Xq(e){return e.username===""&&e.password===""&&e.port===""&&e.pathname==="/"&&e.search===""&&e.hash===""&&e.hostname!==""}function pf(e,t){let n=Object.assign({},t),r={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},s=!1,o=!1,i=!1,a=!1,c=!1,l=!1,u=!1;if(n.reference==="suffix")if(n.scheme)e=n.scheme+":"+e;else e="//"+e;let d=e.match(Bq);if(d!==null&&d[1].indexOf("\\")!==-1)r.error="URI authority must not contain a literal backslash.",s=!0;let p=e.match(zq);if(p!==null){let x=p[1],h=x.replace(/[\t\n\r]/g,"");if(h.length>=2){if(h.slice(0,2)!=="//")r.error=r.error||"URI authority must not contain a literal backslash.",s=!0;else if(x.length!==h.length)r.error=r.error||"URI authority introducer must not contain whitespace.",s=!0}}let m=e.match(Uq);if(m){if(r.scheme=m[1],r.userinfo=m[3],r.host=m[4],r.port=parseInt(m[5],10),r.path=m[6]||"",r.query=m[7],r.fragment=m[8],r.scheme!==void 0)if(n_.test(r.scheme))r.scheme=r.scheme.toLowerCase();else r.error=r.error||"URI scheme is malformed.",l=!0;if(o=Gq(m),o)r.error=r.error||"URI contains malformed percent-encoding.";if(isNaN(r.port))r.port=m[5];let x=Kq(r,m);if(x!==void 0)r.error=r.error||x,s=!0;if(r.host)if(e_(r.host)===!1){let b=hf(r.host),j=r.host.indexOf("[")!==-1||r.host.indexOf("]")!==-1,v=ZP(r.host);if(u=v.isIPV6||v.isIPVFuture===!0,c=j&&(!b||v.error===!0),r.host=u?v.host:v.host.toLowerCase(),c)r.error=r.error||"URI host is malformed.",s=!0}else u=!0;if(r.scheme===void 0&&r.userinfo===void 0&&r.host===void 0&&r.port===void 0&&r.query===void 0&&!r.path)r.reference="same-document";else if(r.scheme===void 0)r.reference="relative";else if(r.fragment===void 0)r.reference="absolute";else r.reference="uri";if(n.reference&&n.reference!=="suffix"&&n.reference!==r.reference)r.error=r.error||"URI is not a "+n.reference+" reference.";let h=Yh(n.scheme||r.scheme);if(!c)a=s_(r,n,h,u);if(e.indexOf("%")!==-1&&r.host!==void 0&&!c){let g=u?r.host:Xh(r.host,!0);if(!u)g=Xh(g.toLowerCase());r.host=u||n.scheme!=="null"?Fq(g,u):g}if(!h||h&&!h.skipNormalize){if(r.path)r.path=Iq(r.path);if(r.query)r.query=GP(r.query);if(r.fragment)r.fragment=GP(r.fragment)}if(h&&h.parse){if(h.parse(r,n),h===t_.urn&&r.nid===void 0)i=!0}}else r.error=r.error||"URI can not be parsed.";return{parsed:r,malformedAuthorityOrPort:s,malformedPercentEncoding:o,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:l}}function mf(e,t){return pf(e,t).parsed}function Yq(e,t){return i_(e,t).normalized}function i_(e,t){let{parsed:n,malformedAuthorityOrPort:r,malformedPercentEncoding:s,malformedSchemeSpecific:o,malformedHost:i,malformedScheme:a}=pf(e,t);return{normalized:r||s||o||i||a?e:Do(n,t),malformedAuthorityOrPort:r,malformedPercentEncoding:s,malformedSchemeSpecific:o,malformedHost:i,malformedScheme:a}}function YP(e,t){if(typeof e!=="string"&&typeof e!=="object")return;let n;try{n=typeof e==="string"?e:Do(e,t)}catch{return}let{normalized:r,malformedAuthorityOrPort:s,malformedPercentEncoding:o,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:c}=i_(n,t);return s||o||i||a||c?void 0:r}var Zh={SCHEMES:t_,normalize:qq,resolve:Wq,resolveComponent:r_,equal:Hq,serialize:Do,parse:mf};gf.exports=Zh;gf.exports.default=Zh;gf.exports.fastUri=Zh});var u_=W(function(l_){Object.defineProperty(l_,"__esModule",{value:!0});var c_=a_();c_.code='require("ajv/dist/runtime/uri").default';l_.default=c_});var eg=W(function(ts){Object.defineProperty(ts,"__esModule",{value:!0});ts.CodeGen=ts.Name=ts.nil=ts.stringify=ts.str=ts._=ts.KeywordCxt=void 0;var Qq=Xi();Object.defineProperty(ts,"KeywordCxt",{enumerable:!0,get:function(){return Qq.KeywordCxt}});var ea=ge();Object.defineProperty(ts,"_",{enumerable:!0,get:function(){return ea._}});Object.defineProperty(ts,"str",{enumerable:!0,get:function(){return ea.str}});Object.defineProperty(ts,"stringify",{enumerable:!0,get:function(){return ea.stringify}});Object.defineProperty(ts,"nil",{enumerable:!0,get:function(){return ea.nil}});Object.defineProperty(ts,"Name",{enumerable:!0,get:function(){return ea.Name}});Object.defineProperty(ts,"CodeGen",{enumerable:!0,get:function(){return ea.CodeGen}});var eW=_c(),h_=Zi(),g_=Oh(),$r=Oc(),y_=ge(),wr=Pc(),Is=jc(),Qi=ke(),f_=TP(),tW=u_(),x_=(e,t)=>new RegExp(e,t);x_.code="new RegExp";var nW=["removeAdditional","useDefaults","coerceTypes"],rW=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),sW={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},oW={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},d_=200;function iW(e){var t,n,r,s,o,i,a,c,l,u,d,p,m,x,h,g,b,j,v,P,S,_,N,F,K;let J=e.strict,C=(t=e.code)===null||t===void 0?void 0:t.optimize,L=C===!0||C===void 0?1:C||0,G=(r=(n=e.code)===null||n===void 0?void 0:n.regExp)!==null&&r!==void 0?r:x_,te=(s=e.uriResolver)!==null&&s!==void 0?s:tW.default;return{strictSchema:(i=(o=e.strictSchema)!==null&&o!==void 0?o:J)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=e.strictNumbers)!==null&&a!==void 0?a:J)!==null&&c!==void 0?c:!0,strictTypes:(u=(l=e.strictTypes)!==null&&l!==void 0?l:J)!==null&&u!==void 0?u:"log",strictTuples:(p=(d=e.strictTuples)!==null&&d!==void 0?d:J)!==null&&p!==void 0?p:"log",strictRequired:(x=(m=e.strictRequired)!==null&&m!==void 0?m:J)!==null&&x!==void 0?x:!1,code:e.code?{...e.code,optimize:L,regExp:G}:{optimize:L,regExp:G},loopRequired:(h=e.loopRequired)!==null&&h!==void 0?h:d_,loopEnum:(g=e.loopEnum)!==null&&g!==void 0?g:d_,meta:(b=e.meta)!==null&&b!==void 0?b:!0,messages:(j=e.messages)!==null&&j!==void 0?j:!0,inlineRefs:(v=e.inlineRefs)!==null&&v!==void 0?v:!0,schemaId:(P=e.schemaId)!==null&&P!==void 0?P:"$id",addUsedSchema:(S=e.addUsedSchema)!==null&&S!==void 0?S:!0,validateSchema:(_=e.validateSchema)!==null&&_!==void 0?_:!0,validateFormats:(N=e.validateFormats)!==null&&N!==void 0?N:!0,unicodeRegExp:(F=e.unicodeRegExp)!==null&&F!==void 0?F:!0,int32range:(K=e.int32range)!==null&&K!==void 0?K:!0,uriResolver:te}}class yf{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...iW(e)};let{es5:t,lines:n}=this.opts.code;this.scope=new y_.ValueScope({scope:{},prefixes:rW,es5:t,lines:n}),this.logger=dW(e.logger);let r=e.validateFormats;if(e.validateFormats=!1,this.RULES=g_.getRules(),p_.call(this,sW,e,"NOT SUPPORTED"),p_.call(this,oW,e,"DEPRECATED","warn"),this._metaOpts=uW.call(this),e.formats)cW.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords)lW.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);aW.call(this),e.validateFormats=r}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:n}=this.opts,r=f_;if(n==="id")r={...f_},r.id=r.$id,delete r.$id;if(t&&e)this.addMetaSchema(r,r[n],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[t]||e:void 0}validate(e,t){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let r=n(t);if(!("$async"in n))this.errors=n.errors;return r}compile(e,t){let n=this._addSchema(e,t);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,t){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return r.call(this,e,t);async function r(l,u){await s.call(this,l.$schema);let d=this._addSchema(l,u);return d.validate||o.call(this,d)}async function s(l){if(l&&!this.getSchema(l))await r.call(this,{$ref:l},!0)}async function o(l){try{return this._compileSchemaEnv(l)}catch(u){if(!(u instanceof h_.default))throw u;return i.call(this,u),await a.call(this,u.missingSchema),o.call(this,l)}}function i({missingSchema:l,missingRef:u}){if(this.refs[l])throw Error(`AnySchema ${l} is loaded but ${u} cannot be resolved`)}async function a(l){let u=await c.call(this,l);if(!this.refs[l])await s.call(this,u.$schema);if(!this.refs[l])this.addSchema(u,l,t)}async function c(l){let u=this._loading[l];if(u)return u;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l]}}}addSchema(e,t,n,r=this.opts.validateSchema){if(Array.isArray(e)){for(let o of e)this.addSchema(o,void 0,n,r);return this}let s;if(typeof e==="object"){let{schemaId:o}=this.opts;if(s=e[o],s!==void 0&&typeof s!="string")throw Error(`schema ${o} must be string`)}return t=wr.normalizeId(t||s),this._checkUnique(t),this.schemas[t]=this._addSchema(e,n,t,r,!0),this}addMetaSchema(e,t,n=this.opts.validateSchema){return this.addSchema(e,t,!0,n),this}validateSchema(e,t){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let r=this.validate(n,e);if(!r&&t){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw Error(s)}return r}getSchema(e){let t;while(typeof(t=m_.call(this,e))=="string")e=t;if(t===void 0){let{schemaId:n}=this.opts,r=new $r.SchemaEnv({schema:{},schemaId:n});if(t=$r.resolveSchema.call(this,r,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let t=m_.call(this,e);if(typeof t=="object")this._cache.delete(t.schema);return delete this.schemas[e],delete this.refs[e],this}case"object":{let t=e;this._cache.delete(t);let n=e[this.opts.schemaId];if(n)n=wr.normalizeId(n),delete this.schemas[n],delete this.refs[n];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let n;if(typeof e=="string"){if(n=e,typeof t=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=n}else if(typeof e=="object"&&t===void 0){if(t=e,n=t.keyword,Array.isArray(n)&&!n.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(mW.call(this,n,t),!t)return Qi.eachItem(n,(s)=>Qh.call(this,s)),this;gW.call(this,t);let r={...t,type:Is.getJSONTypes(t.type),schemaType:Is.getJSONTypes(t.schemaType)};return Qi.eachItem(n,r.type.length===0?(s)=>Qh.call(this,s,r):(s)=>r.type.forEach((o)=>Qh.call(this,s,r,o))),this}getKeyword(e){let t=this.RULES.all[e];return typeof t=="object"?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(let n of t.rules){let r=n.rules.findIndex((s)=>s.keyword===e);if(r>=0)n.rules.splice(r,1)}return this}addFormat(e,t){if(typeof t=="string")t=new RegExp(t);return this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:n="data"}={}){if(!e||e.length===0)return"No errors";return e.map((r)=>`${n}${r.instancePath} ${r.message}`).reduce((r,s)=>r+t+s)}$dataMetaSchema(e,t){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let r of t){let s=r.split("/").slice(1),o=e;for(let i of s)o=o[i];for(let i in n){let a=n[i];if(typeof a!="object")continue;let{$data:c}=a.definition,l=o[i];if(c&&l)o[i]=b_(l)}}return e}_removeAllSchemas(e,t){for(let n in e){let r=e[n];if(!t||t.test(n)){if(typeof r=="string")delete e[n];else if(r&&!r.meta)this._cache.delete(r.schema),delete e[n]}}}_addSchema(e,t,n,r=this.opts.validateSchema,s=this.opts.addUsedSchema){let o,{schemaId:i}=this.opts;if(typeof e=="object")o=e[i];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof e!="boolean")throw Error("schema must be object or boolean");let a=this._cache.get(e);if(a!==void 0)return a;n=wr.normalizeId(o||n);let c=wr.getSchemaRefs.call(this,e,n);if(a=new $r.SchemaEnv({schema:e,schemaId:i,meta:t,baseId:n,localRefs:c}),this._cache.set(a.schema,a),s&&!n.startsWith("#")){if(n)this._checkUnique(n);this.refs[n]=a}if(r)this.validateSchema(e,!0);return a}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta)this._compileMetaSchema(e);else $r.compileSchema.call(this,e);if(!e.validate)throw Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{$r.compileSchema.call(this,e)}finally{this.opts=t}}}yf.ValidationError=eW.default;yf.MissingRefError=h_.default;ts.default=yf;function p_(e,t,n,r="error"){for(let s in e){let o=s;if(o in t)this.logger[r](`${n}: option ${s}. ${e[o]}`)}}function m_(e){return e=wr.normalizeId(e),this.schemas[e]||this.refs[e]}function aW(){let e=this.opts.schemas;if(!e)return;if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function cW(){for(let e in this.opts.formats){let t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function lW(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let n=e[t];if(!n.keyword)n.keyword=t;this.addKeyword(n)}}function uW(){let e={...this.opts};for(let t of nW)delete e[t];return e}var fW={log(){},warn(){},error(){}};function dW(e){if(e===!1)return fW;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw Error("logger must implement log, warn and error methods")}var pW=/^[a-z_$][a-z0-9_$:-]*$/i;function mW(e,t){let{RULES:n}=this;if(Qi.eachItem(e,(r)=>{if(n.keywords[r])throw Error(`Keyword ${r} is already defined`);if(!pW.test(r))throw Error(`Keyword ${r} has invalid name`)}),!t)return;if(t.$data&&!(("code"in t)||("validate"in t)))throw Error('$data keyword must have "code" or "validate" function')}function Qh(e,t,n){var r;let s=t===null||t===void 0?void 0:t.post;if(n&&s)throw Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,i=s?o.post:o.rules.find(({type:c})=>c===n);if(!i)i={type:n,rules:[]},o.rules.push(i);if(o.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:Is.getJSONTypes(t.type),schemaType:Is.getJSONTypes(t.schemaType)}};if(t.before)hW.call(this,i,a,t.before);else i.rules.push(a);o.all[e]=a,(r=t.implements)===null||r===void 0||r.forEach((c)=>this.addKeyword(c))}function hW(e,t,n){let r=e.rules.findIndex((s)=>s.keyword===n);if(r>=0)e.rules.splice(r,0,t);else e.rules.push(t),this.logger.warn(`rule ${n} is not defined`)}function gW(e){let{metaSchema:t}=e;if(t===void 0)return;if(e.$data&&this.opts.$data)t=b_(t);e.validateSchema=this.compile(t,!0)}var yW={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function b_(e){return{anyOf:[e,yW]}}});var w_=W(function($_){Object.defineProperty($_,"__esModule",{value:!0});var $W={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};$_.default=$W});var wf=W(function(v_){Object.defineProperty(v_,"__esModule",{value:!0});v_.callRef=v_.getValidate=void 0;var SW=Zi(),bf=Fn(),Ue=ge(),ta=Mn(),$f=Oc(),Ms=ke(),vW={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:n,it:r}=e,{baseId:s,schemaEnv:o,validateName:i,opts:a,self:c}=r,{root:l}=o;if((n==="#"||n==="#/")&&s===l.baseId)return d();let u=$f.resolveRef.call(c,l,s,n);if(u===void 0)throw new SW.default(r.opts.uriResolver,s,n);if(u instanceof $f.SchemaEnv)return p(u);return m(u);function d(){if(o===l)return xf(e,i,o,o.$async);let x=t.scopeValue("root",{ref:l});return xf(e,Ue._`${x}.validate`,l,l.$async)}function p(x){let h=S_(e,x);xf(e,h,x,x.$async)}function m(x){let h=t.scopeValue("schema",a.code.source===!0?{ref:x,code:Ue.stringify(x)}:{ref:x}),g=t.name("valid"),b=e.subschema({schema:x,dataTypes:[],schemaPath:Ue.nil,topSchemaRef:h,errSchemaPath:n},g);e.mergeEvaluated(b),e.ok(g)}}};function S_(e,t){let{gen:n}=e;return t.validate?n.scopeValue("validate",{ref:t.validate}):Ue._`${n.scopeValue("wrapper",{ref:t})}.validate`}v_.getValidate=S_;function xf(e,t,n,r){let{gen:s,it:o}=e,{allErrors:i,schemaEnv:a,opts:c}=o,l=c.passContext?ta.default.this:Ue.nil;if(r)u();else d();function u(){if(!a.$async)throw Error("async schema referenced by sync schema");let x=s.let("valid");s.try(()=>{if(s.code(Ue._`await ${bf.callValidateCode(e,t,l)}`),m(t),!i)s.assign(x,!0)},(h)=>{if(s.if(Ue._`!(${h} instanceof ${o.ValidationError})`,()=>s.throw(h)),p(h),!i)s.assign(x,!1)}),e.ok(x)}function d(){e.result(bf.callValidateCode(e,t,l),()=>m(t),()=>p(t))}function p(x){let h=Ue._`${x}.errors`;s.assign(ta.default.vErrors,Ue._`${ta.default.vErrors} === null ? ${h} : ${ta.default.vErrors}.concat(${h})`),s.assign(ta.default.errors,Ue._`${ta.default.vErrors}.length`)}function m(x){var h;if(!o.opts.unevaluated)return;let g=(h=n===null||n===void 0?void 0:n.validate)===null||h===void 0?void 0:h.evaluated;if(o.props!==!0)if(g&&!g.dynamicProps){if(g.props!==void 0)o.props=Ms.mergeEvaluated.props(s,g.props,o.props)}else{let b=s.var("props",Ue._`${x}.evaluated.props`);o.props=Ms.mergeEvaluated.props(s,b,o.props,Ue.Name)}if(o.items!==!0)if(g&&!g.dynamicItems){if(g.items!==void 0)o.items=Ms.mergeEvaluated.items(s,g.items,o.items)}else{let b=s.var("items",Ue._`${x}.evaluated.items`);o.items=Ms.mergeEvaluated.items(s,b,o.items,Ue.Name)}}}v_.callRef=xf;v_.default=vW});var tg=W(function(j_){Object.defineProperty(j_,"__esModule",{value:!0});var PW=w_(),_W=wf(),kW=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",PW.default,_W.default];j_.default=kW});var __=W(function(P_){Object.defineProperty(P_,"__esModule",{value:!0});var Fs=ge(),Ds=Fs.operators,Sf={maximum:{okStr:"<=",ok:Ds.LTE,fail:Ds.GT},minimum:{okStr:">=",ok:Ds.GTE,fail:Ds.LT},exclusiveMaximum:{okStr:"<",ok:Ds.LT,fail:Ds.GTE},exclusiveMinimum:{okStr:">",ok:Ds.GT,fail:Ds.LTE}},AW={message:({keyword:e,schemaCode:t})=>Fs.str`must be ${Sf[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>Fs._`{comparison: ${Sf[e].okStr}, limit: ${t}}`},RW={keyword:Object.keys(Sf),type:"number",schemaType:"number",$data:!0,error:AW,code(e){let{keyword:t,data:n,schemaCode:r}=e;e.fail$data(Fs._`${n} ${Sf[t].fail} ${r} || isNaN(${n})`)}};P_.default=RW});var O_=W(function(k_){Object.defineProperty(k_,"__esModule",{value:!0});var Sr=ge(),NW={message:({schemaCode:e})=>Sr.str`must be multiple of ${e}`,params:({schemaCode:e})=>Sr._`{multipleOf: ${e}}`},TW={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:NW,code(e){let{gen:t,data:n,schemaCode:r,it:s}=e,o=s.opts.multipleOfPrecision,i=t.let("res"),a=o?Sr._`Math.abs(Math.round(${i}) - ${i}) > 1e-${o}`:Sr._`${i} !== parseInt(${i})`;e.fail$data(Sr._`(${r} === 0 || (${i} = ${n}/${r}, ${a}))`)}};k_.default=TW});var C_=W(function(R_){Object.defineProperty(R_,"__esModule",{value:!0});function A_(e){let t=e.length,n=0,r=0,s;while(r<t)if(n++,s=e.charCodeAt(r++),s>=55296&&s<=56319&&r<t){if(s=e.charCodeAt(r),(s&64512)===56320)r++}return n}R_.default=A_;A_.code='require("ajv/dist/runtime/ucs2length").default'});var J_=W(function(T_){Object.defineProperty(T_,"__esModule",{value:!0});var fn=ge(),N_=ke(),MW=C_(),DW={message({keyword:e,schemaCode:t}){return fn.str`must NOT have ${e==="maxLength"?"more":"fewer"} than ${t} characters`},params:({schemaCode:e})=>fn._`{limit: ${e}}`},FW={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:DW,code(e){let{keyword:t,data:n,schemaCode:r,it:s}=e,o=t==="maxLength"?fn.operators.GT:fn.operators.LT,i=s.opts.unicode===!1?fn._`${n}.length`:fn._`${N_.useFunc(e.gen,MW.default)}(${n})`;e.fail$data(fn._`${i} ${o} ${r}`)}};T_.default=FW});var F_=W(function(D_){Object.defineProperty(D_,"__esModule",{value:!0});var I_=Fn(),M_=ke(),Ln=ge(),VW={message:({schemaCode:e})=>Ln.str`must match pattern "${e}"`,params:({schemaCode:e})=>Ln._`{pattern: ${e}}`},qW={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:VW,code(e){let{gen:t,data:n,$data:r,schema:s,schemaCode:o,it:i}=e,a=i.opts.unicodeRegExp?"u":"";if(r){let{regExp:c}=i.opts.code,l=c.code==="new RegExp"?Ln._`new RegExp`:M_.useFunc(t,c),u=t.let("valid");t.try(()=>t.assign(u,Ln._`${l}(${o}, ${a}).test(${n})`),()=>t.assign(u,!1)),e.fail$data(Ln._`!${u}`)}else{let c=I_.usePattern(e,s);e.fail$data(Ln._`!${c}.test(${n})`)}}};D_.default=qW});var V_=W(function(L_){Object.defineProperty(L_,"__esModule",{value:!0});var vr=ge(),HW={message({keyword:e,schemaCode:t}){return vr.str`must NOT have ${e==="maxProperties"?"more":"fewer"} than ${t} properties`},params:({schemaCode:e})=>vr._`{limit: ${e}}`},UW={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:HW,code(e){let{keyword:t,data:n,schemaCode:r}=e,s=t==="maxProperties"?vr.operators.GT:vr.operators.LT;e.fail$data(vr._`Object.keys(${n}).length ${s} ${r}`)}};L_.default=UW});var H_=W(function(W_){Object.defineProperty(W_,"__esModule",{value:!0});var Er=Fn(),jr=ge(),q_=ke(),zW={message:({params:{missingProperty:e}})=>jr.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>jr._`{missingProperty: ${e}}`},KW={keyword:"required",type:"object",schemaType:"array",$data:!0,error:zW,code(e){let{gen:t,schema:n,schemaCode:r,data:s,$data:o,it:i}=e,{opts:a}=i;if(!o&&n.length===0)return;let c=n.length>=a.loopRequired;if(i.allErrors)l();else u();if(a.strictRequired){let m=e.parentSchema.properties,{definedProperties:x}=e.it;for(let h of n)if((m===null||m===void 0?void 0:m[h])===void 0&&!x.has(h)){let g=i.schemaEnv.baseId+i.errSchemaPath,b=`required property "${h}" is not defined at "${g}" (strictRequired)`;q_.checkStrictMode(i,b,i.opts.strictRequired)}}function l(){if(c||o)e.block$data(jr.nil,d);else for(let m of n)Er.checkReportMissingProp(e,m)}function u(){let m=t.let("missing");if(c||o){let x=t.let("valid",!0);e.block$data(x,()=>p(m,x)),e.ok(x)}else t.if(Er.checkMissingProp(e,n,m)),Er.reportMissingProp(e,m),t.else()}function d(){t.forOf("prop",r,(m)=>{e.setParams({missingProperty:m}),t.if(Er.noPropertyInData(t,s,m,a.ownProperties),()=>e.error())})}function p(m,x){e.setParams({missingProperty:m}),t.forOf(m,r,()=>{t.assign(x,Er.propertyInData(t,s,m,a.ownProperties)),t.if(jr.not(x),()=>{e.error(),t.break()})},jr.nil)}}};W_.default=KW});var B_=W(function(U_){Object.defineProperty(U_,"__esModule",{value:!0});var Pr=ge(),XW={message({keyword:e,schemaCode:t}){return Pr.str`must NOT have ${e==="maxItems"?"more":"fewer"} than ${t} items`},params:({schemaCode:e})=>Pr._`{limit: ${e}}`},YW={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:XW,code(e){let{keyword:t,data:n,schemaCode:r}=e,s=t==="maxItems"?Pr.operators.GT:Pr.operators.LT;e.fail$data(Pr._`${n}.length ${s} ${r}`)}};U_.default=YW});var vf=W(function(K_){Object.defineProperty(K_,"__esModule",{value:!0});var z_=Ih();z_.code='require("ajv/dist/runtime/equal").default';K_.default=z_});var Y_=W(function(X_){Object.defineProperty(X_,"__esModule",{value:!0});var na=jc(),Ce=ge(),G_=ke(),eH=vf(),tH={message:({params:{i:e,j:t}})=>Ce.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>Ce._`{i: ${e}, j: ${t}}`},nH={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:tH,code(e){let{gen:t,data:n,$data:r,schema:s,parentSchema:o,schemaCode:i,it:a}=e;if(!r&&!s)return;let c=t.let("valid"),l=o.items?na.getSchemaTypes(o.items):[];e.block$data(c,u,Ce._`${i} === false`),e.ok(c);function u(){let x=t.let("i",Ce._`${n}.length`),h=t.let("j");e.setParams({i:x,j:h}),t.assign(c,!0),t.if(Ce._`${x} > 1`,()=>(d()?p:m)(x,h))}function d(){return l.length>0&&!l.some((x)=>x==="object"||x==="array")}function p(x,h){let g=t.name("item"),b=na.checkDataTypes(l,g,a.opts.strictNumbers,na.DataType.Wrong),j=t.const("indices",Ce._`{}`);t.for(Ce._`;${x}--;`,()=>{if(t.let(g,Ce._`${n}[${x}]`),t.if(b,Ce._`continue`),l.length>1)t.if(Ce._`typeof ${g} == "string"`,Ce._`${g} += "_"`);t.if(Ce._`typeof ${j}[${g}] == "number"`,()=>{t.assign(h,Ce._`${j}[${g}]`),e.error(),t.assign(c,!1).break()}).code(Ce._`${j}[${g}] = ${x}`)})}function m(x,h){let g=G_.useFunc(t,eH.default),b=t.name("outer");t.label(b).for(Ce._`;${x}--;`,()=>t.for(Ce._`${h} = ${x}; ${h}--;`,()=>t.if(Ce._`${g}(${n}[${x}], ${n}[${h}])`,()=>{e.error(),t.assign(c,!1).break(b)})))}}};X_.default=nH});var ek=W(function(Q_){Object.defineProperty(Q_,"__esModule",{value:!0});var ra=ge(),Z_=ke(),sH=vf(),oH={message:"must be equal to constant",params:({schemaCode:e})=>ra._`{allowedValue: ${e}}`},iH={keyword:"const",$data:!0,error:oH,code(e){let{gen:t,data:n,$data:r,schemaCode:s,schema:o}=e;if(r||o&&typeof o=="object")e.fail$data(ra._`!${Z_.useFunc(t,sH.default)}(${n}, ${s})`);else e.fail(ra._`${o} !== ${n}`)}};Q_.default=iH});var rk=W(function(nk){Object.defineProperty(nk,"__esModule",{value:!0});var _r=ge(),tk=ke(),cH=vf(),lH={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>_r._`{allowedValues: ${e}}`},uH={keyword:"enum",schemaType:"array",$data:!0,error:lH,code(e){let{gen:t,data:n,$data:r,schema:s,schemaCode:o,it:i}=e;if(!r&&s.length===0)throw Error("enum must have non-empty array");let a=s.length>=i.opts.loopEnum,c,l=()=>c!==null&&c!==void 0?c:c=tk.useFunc(t,cH.default),u;if(a||r)u=t.let("valid"),e.block$data(u,d);else{if(!Array.isArray(s))throw Error("ajv implementation error");let m=t.const("vSchema",o);u=_r.or(...s.map((x,h)=>p(m,h)))}e.pass(u);function d(){t.assign(u,!1),t.forOf("v",o,(m)=>t.if(_r._`${l()}(${n}, ${m})`,()=>t.assign(u,!0).break()))}function p(m,x){let h=s[x];return typeof h==="object"&&h!==null?_r._`${l()}(${n}, ${m}[${x}])`:_r._`${n} === ${h}`}}};nk.default=uH});var ng=W(function(sk){Object.defineProperty(sk,"__esModule",{value:!0});var dH=__(),pH=O_(),mH=J_(),hH=F_(),gH=V_(),yH=H_(),xH=B_(),bH=Y_(),$H=ek(),wH=rk(),SH=[dH.default,pH.default,mH.default,hH.default,gH.default,yH.default,xH.default,bH.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},$H.default,wH.default];sk.default=SH});var rg=W(function(ik){Object.defineProperty(ik,"__esModule",{value:!0});ik.validateAdditionalItems=void 0;var dn=ge(),sa=ke(),EH={message:({params:{len:e}})=>dn.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>dn._`{limit: ${e}}`},jH={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:EH,code(e){let{parentSchema:t,it:n}=e,{items:r}=t;if(!Array.isArray(r)){sa.checkStrictMode(n,'"additionalItems" is ignored when "items" is not an array of schemas');return}ok(e,r)}};function ok(e,t){let{gen:n,schema:r,data:s,keyword:o,it:i}=e;i.items=!0;let a=n.const("len",dn._`${s}.length`);if(r===!1)e.setParams({len:t.length}),e.pass(dn._`${a} <= ${t.length}`);else if(typeof r=="object"&&!sa.alwaysValidSchema(i,r)){let l=n.var("valid",dn._`${a} <= ${t.length}`);n.if(dn.not(l),()=>c(l)),e.ok(l)}function c(l){n.forRange("i",t.length,a,(u)=>{if(e.subschema({keyword:o,dataProp:u,dataPropType:sa.Type.Num},l),!i.allErrors)n.if(dn.not(l),()=>n.break())})}}ik.validateAdditionalItems=ok;ik.default=jH});var sg=W(function(uk){Object.defineProperty(uk,"__esModule",{value:!0});uk.validateTuple=void 0;var Ef=ge(),Ls=ke(),ck=Fn(),_H={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:n}=e;if(Array.isArray(t))return lk(e,"additionalItems",t);if(n.items=!0,Ls.alwaysValidSchema(n,t))return;e.ok(ck.validateArray(e))}};function lk(e,t,n=e.schema){let{gen:r,parentSchema:s,data:o,keyword:i,it:a}=e;if(u(s),a.opts.unevaluated&&n.length&&a.items!==!0)a.items=Ls.mergeEvaluated.items(r,n.length,a.items);let c=r.name("valid"),l=r.const("len",Ef._`${o}.length`);n.forEach((d,p)=>{if(Ls.alwaysValidSchema(a,d))return;r.if(Ef._`${l} > ${p}`,()=>e.subschema({keyword:i,schemaProp:p,dataProp:p},c)),e.ok(c)});function u(d){let{opts:p,errSchemaPath:m}=a,x=n.length,h=x===d.minItems&&(x===d.maxItems||d[t]===!1);if(p.strictTuples&&!h){let g=`"${i}" is ${x}-tuple, but minItems or maxItems/${t} are not specified or different at path "${m}"`;Ls.checkStrictMode(a,g,p.strictTuples)}}}uk.validateTuple=lk;uk.default=_H});var mk=W(function(pk){Object.defineProperty(pk,"__esModule",{value:!0});var dk=sg(),OH={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(e)=>dk.validateTuple(e,"items")};pk.default=OH});var bk=W(function(xk){Object.defineProperty(xk,"__esModule",{value:!0});var jf=ge(),hk=ke(),gk=Fn(),yk=rg(),RH={message:({params:{len:e}})=>jf.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>jf._`{limit: ${e}}`},CH={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:RH,code(e){let{schema:t,parentSchema:n,it:r}=e,{prefixItems:s}=n;if(r.items=!0,hk.alwaysValidSchema(r,t))return;if(s)yk.validateAdditionalItems(e,s);else e.ok(gk.validateArray(e))}};xk.default=CH});var wk=W(function($k){Object.defineProperty($k,"__esModule",{value:!0});var nt=ge(),Vs=ke(),TH={message:({params:{min:e,max:t}})=>t===void 0?nt.str`must contain at least ${e} valid item(s)`:nt.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?nt._`{minContains: ${e}}`:nt._`{minContains: ${e}, maxContains: ${t}}`},JH={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:TH,code(e){let{gen:t,schema:n,parentSchema:r,data:s,it:o}=e,i,a,{minContains:c,maxContains:l}=r;if(o.opts.next)i=c===void 0?1:c,a=l;else i=1;let u=t.const("len",nt._`${s}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){Vs.checkStrictMode(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){Vs.checkStrictMode(o,'"minContains" > "maxContains" is always invalid'),e.fail();return}if(Vs.alwaysValidSchema(o,n)){let h=nt._`${u} >= ${i}`;if(a!==void 0)h=nt._`${h} && ${u} <= ${a}`;e.pass(h);return}o.items=!0;let d=t.name("valid");if(a===void 0&&i===1)m(d,()=>t.if(d,()=>t.break()));else if(i===0){if(t.let(d,!0),a!==void 0)t.if(nt._`${s}.length > 0`,p)}else t.let(d,!1),p();e.result(d,()=>e.reset());function p(){let h=t.name("_valid"),g=t.let("count",0);m(h,()=>t.if(h,()=>x(g)))}function m(h,g){t.forRange("i",0,u,(b)=>{e.subschema({keyword:"contains",dataProp:b,dataPropType:Vs.Type.Num,compositeRule:!0},h),g()})}function x(h){if(t.code(nt._`${h}++`),a===void 0)t.if(nt._`${h} >= ${i}`,()=>t.assign(d,!0).break());else if(t.if(nt._`${h} > ${a}`,()=>t.assign(d,!1).break()),i===1)t.assign(d,!0);else t.if(nt._`${h} >= ${i}`,()=>t.assign(d,!0))}}};$k.default=JH});var Pf=W(function(jk){Object.defineProperty(jk,"__esModule",{value:!0});jk.validateSchemaDeps=jk.validatePropertyDeps=jk.error=void 0;var oa=ge(),Sk=ke(),kr=Fn();jk.error={message:({params:{property:e,depsCount:t,deps:n}})=>oa.str`must have ${t===1?"property":"properties"} ${n} when property ${e} is present`,params:({params:{property:e,depsCount:t,deps:n,missingProperty:r}})=>oa._`{property: ${e},
607
+ `+(" ".repeat(oe.length)+"^"),Pd=_==="Syntax"?"since":"inside",Ox=`${_} error at line ${fe}${f.name?` in ${f.name}`:""}${b&&b.name?`, ${Pd} \`${b.partial?"partial ":""}${function(hn){let no=[hn];for(;hn&&hn.parent;){let{parent:Ir}=hn;no.unshift(Ir),hn=Ir}return no.map((Ir)=>function(ga,ya){let Ax=ga;return ya&&(Ax+=` ${ya}`),Ax}(Ir.type,Ir.name)).join(" -> ")}(b)}\``:""}:
608
+ ${ss}`;return{message:`${Ox} ${w}`,bareMessage:w,context:Ox,line:fe,sourceName:f.name,level:W,ruleName:Y,autofix:K,input:Pt,tokens:Je}}function r(f,h,b,w){return n(f,h,b,w,"Syntax")}function s(f,h,b,w,_={}){return _.ruleName=b,n(h.source,f.index,h,w,"Validation",_)}e.r(t),e.d(t,{WebIDLParseError:()=>dt,parse:()=>Uc,validate:()=>to,write:()=>eo});class o{constructor({source:f,tokens:h}){Object.defineProperties(this,{source:{value:f},tokens:{value:h,writable:!0},parent:{value:null,writable:!0},this:{value:this}})}toJSON(){let f={type:void 0,name:void 0,inheritance:void 0},h=this;for(;h!==Object.prototype;){let b=Object.getOwnPropertyDescriptors(h);for(let[w,_]of Object.entries(b))(_.enumerable||_.get)&&(f[w]=this[w]);h=Object.getPrototypeOf(h)}return f}}function i(f,h,{useNullableInner:b}={}){if(!f.union){let w=h.unique.get(f.idlType);if(!w)return;if(w.type==="typedef"){let{typedefIncludesDictionary:_}=h.cache;if(_.has(w))return _.get(w);h.cache.typedefIncludesDictionary.set(w,void 0);let W=i(w.idlType,h);if(h.cache.typedefIncludesDictionary.set(w,W),W)return{reference:f,dictionary:W.dictionary}}if(w.type==="dictionary"&&(b||!f.nullable))return{reference:f,dictionary:w}}for(let w of f.subtype){let _=i(w,h);if(_)return w.union?_:{reference:w,dictionary:_.dictionary}}}function a(f,h){if(h.cache.dictionaryIncludesRequiredField.has(f))return h.cache.dictionaryIncludesRequiredField.get(f);h.cache.dictionaryIncludesRequiredField.set(f,void 0);let b=f.members.some((w)=>w.required);if(!b&&f.inheritance){let w=h.unique.get(f.inheritance);w?a(w,h)&&(b=!0):b=!0}return h.cache.dictionaryIncludesRequiredField.set(f,b),b}class c extends Array{constructor({source:f,tokens:h}){super(),Object.defineProperties(this,{source:{value:f},tokens:{value:h},parent:{value:null,writable:!0}})}}class l extends o{static parser(f,h){return()=>{let b=f.consumeKind(h);if(b)return new l({source:f.source,tokens:{value:b}})}}get value(){return A(this.tokens.value.value)}write(f){return f.ts.wrap([f.token(this.tokens.value),f.token(this.tokens.separator)])}}class u extends l{static parse(f){let h=f.consumeKind("eof");if(h)return new u({source:f.source,tokens:{value:h}})}get type(){return"eof"}}function d(f,h){return N(f,{parser:l.parser(f,h),listName:h+" list"})}let p=["identifier","decimal","integer","string"],m=new Map([...["NoInterfaceObject","LenientSetter","LenientThis","TreatNonObjectAsNull","Unforgeable"].map((f)=>[f,`Legacy${f}`]),["NamedConstructor","LegacyFactoryFunction"],["OverrideBuiltins","LegacyOverrideBuiltIns"],["TreatNullAs","LegacyNullToEmptyString"]]);function x(f){for(let h of p){let b=d(f,h);if(b.length)return b}f.error("Expected identifiers, strings, decimals, or integers but none found")}class g extends o{static parse(f){let h={assign:f.consume("=")},b=ee(new g({source:f.source,tokens:h}));if(b.list=[],h.assign){if(h.asterisk=f.consume("*"),h.asterisk)return b.this;h.secondaryName=f.consumeKind(...p)}return h.open=f.consume("("),h.open?(b.list=b.rhsIsList?x(f):X(f),h.close=f.consume(")")||f.error("Unexpected token in extended attribute argument list")):h.assign&&!h.secondaryName&&f.error("No right hand side to extended attribute assignment"),b.this}get rhsIsList(){return this.tokens.assign&&!this.tokens.asterisk&&!this.tokens.secondaryName}get rhsType(){return this.rhsIsList?this.list[0].tokens.value.type+"-list":this.tokens.asterisk?"*":this.tokens.secondaryName?this.tokens.secondaryName.type:null}write(f){let{rhsType:h}=this;return f.ts.wrap([f.token(this.tokens.assign),f.token(this.tokens.asterisk),f.reference_token(this.tokens.secondaryName,this.parent),f.token(this.tokens.open),...this.list.map((b)=>h==="identifier-list"?f.identifier(b,this.parent):b.write(f)),f.token(this.tokens.close)])}}class y extends o{static parse(f){let h=f.consumeKind("identifier");if(h)return new y({source:f.source,tokens:{name:h},params:g.parse(f)})}constructor({source:f,tokens:h,params:b}){super({source:f,tokens:h}),b.parent=this,Object.defineProperty(this,"params",{value:b})}get type(){return"extended-attribute"}get name(){return this.tokens.name.value}get rhs(){let{rhsType:f,tokens:h,list:b}=this.params;if(!f)return null;return{type:f,value:this.params.rhsIsList?b:this.params.tokens.secondaryName?A(h.secondaryName.value):null}}get arguments(){let{rhsIsList:f,list:h}=this.params;return!h||f?[]:h}*validate(f){let{name:h}=this;if(h==="LegacyNoInterfaceObject")yield s(this.tokens.name,this,"no-nointerfaceobject","`[LegacyNoInterfaceObject]` extended attribute is an undesirable feature that may be removed from Web IDL in the future. Refer to the [relevant upstream PR](https://github.com/whatwg/webidl/pull/609) for more information.",{level:"warning"});else if(m.has(h)){let w=`\`[${h}]\` extended attribute is a legacy feature that is now renamed to \`[${m.get(h)}]\`. Refer to the [relevant upstream PR](https://github.com/whatwg/webidl/pull/870) for more information.`;yield s(this.tokens.name,this,"renamed-legacy",w,{level:"warning",autofix:(b=this,()=>{let{name:_}=b;b.tokens.name.value=m.get(_),_==="TreatNullAs"&&(b.params.tokens={})})})}var b;for(let w of this.arguments)yield*w.validate(f)}write(f){return f.ts.wrap([f.ts.trivia(this.tokens.name.trivia),f.ts.extendedAttribute(f.ts.wrap([f.ts.extendedAttributeReference(this.name),this.params.write(f)])),f.token(this.tokens.separator)])}}class S extends c{static parse(f){let h={};h.open=f.consume("[");let b=new S({source:f.source,tokens:h});return h.open?(b.push(...N(f,{parser:y.parse,listName:"extended attribute"})),h.close=f.consume("]")||f.error("Expected a closing token for the extended attribute list"),b.length||(f.unconsume(h.close.index),f.error("An extended attribute list must not be empty")),f.probe("[")&&f.error("Illegal double extended attribute lists, consider merging them"),b):b}*validate(f){for(let h of this)yield*h.validate(f)}write(f){return this.length?f.ts.wrap([f.token(this.tokens.open),...this.map((h)=>h.write(f)),f.token(this.tokens.close)]):""}}function E(f,h){let b=f.consume("?");b&&(h.tokens.nullable=b),f.probe("?")&&f.error("Can't nullable more than once")}function v(f,h){let b=function(w,_){let W=w.consume("FrozenArray","ObservableArray","Promise","async_sequence","sequence","record");if(!W)return;let K=ee(new j({source:w.source,tokens:{base:W}}));switch(K.tokens.open=w.consume("<")||w.error(`No opening bracket after ${W.value}`),W.value){case"Promise":{w.probe("[")&&w.error("Promise type cannot have extended attribute");let Y=ue(w,_)||w.error("Missing Promise subtype");K.subtype.push(Y);break}case"async_sequence":case"sequence":case"FrozenArray":case"ObservableArray":{let Y=re(w,_)||w.error(`Missing ${W.value} subtype`);K.subtype.push(Y);break}case"record":{w.probe("[")&&w.error("Record key cannot have extended attribute");let Y=w.consume(...et)||w.error(`Record key must be one of: ${et.join(", ")}`),V=new j({source:w.source,tokens:{base:Y}});V.tokens.separator=w.consume(",")||w.error("Missing comma after record key type"),V.type=_;let ne=re(w,_)||w.error("Error parsing generic type record");K.subtype.push(V,ne);break}}return K.idlType||w.error(`Error parsing generic type ${W.value}`),K.tokens.close=w.consume(">")||w.error(`Missing closing bracket after ${W.value}`),K.this}(f,h)||D(f);if(!b){let w=f.consumeKind("identifier")||f.consume(...et,...Te);if(!w)return;b=new j({source:f.source,tokens:{base:w}}),f.probe("<")&&f.error(`Unsupported generic type ${w.value}`)}return b.generic==="Promise"&&f.probe("?")&&f.error("Promise type cannot be nullable"),b.type=h||null,E(f,b),b.nullable&&b.idlType==="any"&&f.error("Type `any` cannot be made nullable"),b}class j extends o{static parse(f,h){return v(f,h)||function(b,w){let _={};if(_.open=b.consume("("),!_.open)return;let W=ee(new j({source:b.source,tokens:_}));for(W.type=w||null;;){let K=re(b,w)||b.error("No type after open parenthesis or 'or' in union type");K.idlType==="any"&&b.error("Type `any` cannot be included in a union type"),K.generic==="Promise"&&b.error("Type `Promise` cannot be included in a union type"),W.subtype.push(K);let Y=b.consume("or");if(!Y)break;K.tokens.separator=Y}return W.idlType.length<2&&b.error("At least two types are expected in a union type but found less"),_.close=b.consume(")")||b.error("Unterminated union type"),E(b,W),W.this}(f,h)}constructor({source:f,tokens:h}){super({source:f,tokens:h}),Object.defineProperty(this,"subtype",{value:[],writable:!0}),this.extAttrs=new S({source:f,tokens:{}})}get generic(){return this.subtype.length&&this.tokens.base?this.tokens.base.value:""}get nullable(){return Boolean(this.tokens.nullable)}get union(){return Boolean(this.subtype.length)&&!this.tokens.base}get idlType(){if(this.subtype.length)return this.subtype;return A([this.tokens.prefix,this.tokens.base,this.tokens.postfix].filter((f)=>f).map((f)=>f.value).join(" "))}*validate(f){if(yield*this.extAttrs.validate(f),this.idlType==="BufferSource")for(let _ of[this.extAttrs,this.parent?.extAttrs])for(let W of _){if(W.name!=="AllowShared")continue;let K="`[AllowShared] BufferSource` is now replaced with AllowSharedBufferSource.";yield s(this.tokens.base,this,"migrate-allowshared",K,{autofix:P(this,W,_)})}if(this.idlType==="void")yield s(this.tokens.base,this,"replace-void","`void` is now replaced by `undefined`. Refer to the [relevant GitHub issue](https://github.com/whatwg/webidl/issues/60) for more information.",{autofix:(h=this,()=>{h.tokens.base.value="undefined"})});var h;let b=!this.union&&f.unique.get(this.idlType),w=this.union?this:b&&b.type==="typedef"?b.idlType:void 0;if(w&&this.nullable){let{reference:_}=i(w,f)||{};if(_){let W=(this.union?_:this).tokens.base;yield s(W,this,"no-nullable-union-dict","Nullable union cannot include a dictionary type.")}}else for(let _ of this.subtype)yield*_.validate(f)}write(f){return f.ts.wrap([this.extAttrs.write(f),(()=>{if(this.union||this.generic)return f.ts.wrap([f.token(this.tokens.base,f.ts.generic),f.token(this.tokens.open),...this.subtype.map((_)=>_.write(f)),f.token(this.tokens.close)]);let h=this.tokens.prefix||this.tokens.base,b=this.tokens.prefix?[this.tokens.prefix.value,f.ts.trivia(this.tokens.base.trivia)]:[],w=f.reference(f.ts.wrap([...b,this.tokens.base.value,f.token(this.tokens.postfix)]),{unescaped:this.idlType,context:this});return f.ts.wrap([f.ts.trivia(h.trivia),w])})(),f.token(this.tokens.nullable),f.token(this.tokens.separator)])}}function P(f,h,b){return()=>{let w=b.indexOf(h);b.splice(w,1),!b.length&&f.tokens.base.trivia.match(/^\s$/)&&(f.tokens.base.trivia=""),f.tokens.base.value="AllowSharedBufferSource"}}class O extends o{static parse(f){let h=f.consume("=");if(!h)return null;let b=B(f)||f.consumeKind("string")||f.consume("null","[","{")||f.error("No value for default"),w=[b];if(b.value==="["){let _=f.consume("]")||f.error("Default sequence value must be empty");w.push(_)}else if(b.value==="{"){let _=f.consume("}")||f.error("Default dictionary value must be empty");w.push(_)}return new O({source:f.source,tokens:{assign:h},expression:w})}constructor({source:f,tokens:h,expression:b}){super({source:f,tokens:h}),b.parent=this,Object.defineProperty(this,"expression",{value:b})}get type(){return M(this.expression[0]).type}get value(){return M(this.expression[0]).value}get negative(){return M(this.expression[0]).negative}write(f){return f.ts.wrap([f.token(this.tokens.assign),...this.expression.map((h)=>f.token(h))])}}class T extends o{static parse(f){let h=f.position,b={},w=ee(new T({source:f.source,tokens:b}));return w.extAttrs=S.parse(f),b.optional=f.consume("optional"),w.idlType=re(f,"argument-type"),w.idlType?(b.optional||(b.variadic=f.consume("...")),b.name=f.consumeKind("identifier")||f.consume(...te),b.name?(w.default=b.optional?O.parse(f):null,w.this):f.unconsume(h)):f.unconsume(h)}get type(){return"argument"}get optional(){return!!this.tokens.optional}get variadic(){return!!this.tokens.variadic}get name(){return A(this.tokens.name.value)}*validate(f){yield*this.extAttrs.validate(f),yield*this.idlType.validate(f);let h=i(this.idlType,f,{useNullableInner:!0});if(h){if(this.idlType.nullable)yield s(this.tokens.name,this,"no-nullable-dict-arg","Dictionary arguments cannot be nullable.");else if(this.optional){if(!this.default)yield s(this.tokens.name,this,"dict-arg-default","Optional dictionary arguments must have a default value of `{}`.",{autofix:U(this)})}else if(this.parent&&!a(h.dictionary,f)&&function(w){let _=w.parent.arguments||w.parent.list,W=_.indexOf(w);return!_.slice(W+1).some((Y)=>!Y.optional)}(this))yield s(this.tokens.name,this,"dict-arg-optional","Dictionary argument must be optional if it has no required fields",{autofix:(b=this,()=>{let _=ae(b.idlType);b.tokens.optional={..._,type:"optional",value:"optional"},_.trivia=" ",U(b)()})})}var b}write(f){return f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.optional),f.ts.type(this.idlType.write(f)),f.token(this.tokens.variadic),f.name_token(this.tokens.name,{data:this}),this.default?this.default.write(f):"",f.token(this.tokens.separator)])}}function U(f){return()=>{f.default=O.parse(new de(" = {}"))}}class F extends o{static parse(f,{special:h,regular:b}={}){let w={special:h},_=ee(new F({source:f.source,tokens:w}));return h&&h.value==="stringifier"&&(w.termination=f.consume(";"),w.termination)?(_.arguments=[],_):(h||b||(w.special=f.consume("getter","setter","deleter")),_.idlType=ue(f)||f.error("Missing return type"),w.name=f.consumeKind("identifier")||f.consume("includes"),w.open=f.consume("(")||f.error("Invalid operation"),_.arguments=X(f),w.close=f.consume(")")||f.error("Unterminated operation"),w.termination=f.consume(";")||f.error("Unterminated operation, expected `;`"),_.this)}get type(){return"operation"}get name(){let{name:f}=this.tokens;return f?A(f.value):""}get special(){return this.tokens.special?this.tokens.special.value:""}*validate(f){if(yield*this.extAttrs.validate(f),!this.name&&["","static"].includes(this.special))yield s(this.tokens.open,this,"incomplete-op","Regular or static operations must have both a return type and an identifier.");if(this.idlType){if(this.idlType.generic==="async_sequence")yield s(this.idlType.tokens.base,this,"async-sequence-idl-to-js","async_sequence types cannot be returned by an operation.");yield*this.idlType.validate(f)}for(let h of this.arguments)yield*h.validate(f)}write(f){let{parent:h}=this,b=this.idlType?[f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this,parent:h}),f.token(this.tokens.open),f.ts.wrap(this.arguments.map((w)=>w.write(f))),f.token(this.tokens.close)]:[];return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),this.tokens.name?f.token(this.tokens.special):f.token(this.tokens.special,f.ts.nameless,{data:this,parent:h}),...b,f.token(this.tokens.termination)]),{data:this,parent:h})}}class H extends o{static parse(f,{special:h,noInherit:b=!1,readonly:w=!1}={}){let _=f.position,W={special:h},K=ee(new H({source:f.source,tokens:W}));if(h||b||(W.special=f.consume("inherit")),K.special==="inherit"&&f.probe("readonly")&&f.error("Inherited attributes cannot be read-only"),W.readonly=f.consume("readonly"),w&&!W.readonly&&f.probe("attribute")&&f.error("Attributes must be readonly in this context"),W.base=f.consume("attribute"),W.base)return K.idlType=re(f,"attribute-type")||f.error("Attribute lacks a type"),W.name=f.consumeKind("identifier")||f.consume("async","required")||f.error("Attribute lacks a name"),W.termination=f.consume(";")||f.error("Unterminated attribute, expected `;`"),K.this;f.unconsume(_)}get type(){return"attribute"}get special(){return this.tokens.special?this.tokens.special.value:""}get readonly(){return!!this.tokens.readonly}get name(){return A(this.tokens.name.value)}*validate(f){if(yield*this.extAttrs.validate(f),yield*this.idlType.validate(f),["async_sequence","sequence","record"].includes(this.idlType.generic)){let h=`Attributes cannot accept ${this.idlType.generic} types.`;yield s(this.tokens.name,this,"attr-invalid-type",h)}{let{reference:h}=i(this.idlType,f)||{};if(h){let b=(this.idlType.union?h:this.idlType).tokens.base;yield s(b,this,"attr-invalid-type","Attributes cannot accept dictionary types.")}}if(this.readonly&&function(h,b){if(h.union)return!1;if(h.extAttrs.some((_)=>_.name==="EnforceRange"))return!0;let w=b.unique.get(h.idlType);return w?.type==="typedef"&&w.idlType.extAttrs.some((_)=>_.name==="EnforceRange")}(this.idlType,f)){let h=this.idlType.tokens.base;yield s(h,this,"attr-invalid-type","Readonly attributes cannot accept [EnforceRange] extended attribute.")}}write(f){let{parent:h}=this;return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.special),f.token(this.tokens.readonly),f.token(this.tokens.base),f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this,parent:h}),f.token(this.tokens.termination)]),{data:this,parent:h})}}function A(f){return f.startsWith("_")?f.slice(1):f}function N(f,{parser:h,allowDangler:b,listName:w="list"}){let _=h(f);if(!_)return[];_.tokens.separator=f.consume(",");let W=[_];for(;_.tokens.separator;){let K=h(f);if(!K){b||f.error(`Trailing comma in ${w}`);break}if(K.tokens.separator=f.consume(","),W.push(K),!K.tokens.separator)break}return W}function B(f){return f.consumeKind("decimal","integer")||f.consume("true","false","Infinity","-Infinity","NaN")}function M({type:f,value:h}){switch(f){case"decimal":case"integer":return{type:"number",value:h};case"string":return{type:"string",value:h.slice(1,-1)}}switch(h){case"true":case"false":return{type:"boolean",value:h==="true"};case"Infinity":case"-Infinity":return{type:"Infinity",negative:h.startsWith("-")};case"[":return{type:"sequence",value:[]};case"{":return{type:"dictionary"};default:return{type:h}}}function D(f){let{source:h}=f,b=function(){let _=f.consume("unsigned"),W=f.consume("short","long");if(W){let K=f.consume("long");return new j({source:h,tokens:{prefix:_,base:W,postfix:K}})}_&&f.error("Failed to parse integer type")}()||function(){let _=f.consume("unrestricted"),W=f.consume("float","double");if(W)return new j({source:h,tokens:{prefix:_,base:W}});_&&f.error("Failed to parse float type")}();if(b)return b;let w=f.consume("bigint","boolean","byte","octet","undefined");return w?new j({source:h,tokens:{base:w}}):void 0}function X(f){return N(f,{parser:T.parse,listName:"arguments list"})}function re(f,h){let b=S.parse(f),w=j.parse(f,h);return w&&(ee(w).extAttrs=b),w}function ue(f,h){let b=j.parse(f,h||"return-type");if(b)return b;let w=f.consume("void");if(w){let _=new j({source:f.source,tokens:{base:w}});return _.type="return-type",_}}function xe(f){let h=f.consume("stringifier");if(!h)return;return H.parse(f,{special:h})||F.parse(f,{special:h})||f.error("Unterminated stringifier")}function z(f){let h=f.split(`
609
+ `);if(h.length){let b=h[h.length-1].match(/^\s+/);if(b)return b[0]}return""}function be(f){return()=>{if(f.extAttrs.length){let h=new de("Exposed=Window,"),b=y.parse(h);b.tokens.separator=h.consume(",");let w=f.extAttrs[0];/^\s/.test(w.tokens.name.trivia)||(w.tokens.name.trivia=` ${w.tokens.name.trivia}`),f.extAttrs.unshift(b)}else{ee(f).extAttrs=S.parse(new de("[Exposed=Window]"));let h=f.tokens.base.trivia;f.extAttrs.tokens.open.trivia=h,f.tokens.base.trivia=`
610
+ ${z(h)}`}}}function ae(f){if(f.extAttrs.length)return f.extAttrs.tokens.open;if(f.type==="operation"&&!f.special)return ae(f.idlType);return Object.values(f.tokens).sort((h,b)=>h.index-b.index)[0]}function ee(f,h){if(h||(h=f),!f)return f;return new Proxy(f,{get(b,w){let _=b[w];return Array.isArray(_)&&w!=="source"?ee(_,b):_},set(b,w,_){if(b[w]=_,!_)return!0;if(Array.isArray(_))for(let W of _)W.parent!==void 0&&(W.parent=h);else _.parent!==void 0&&(_.parent=h);return!0}})}let ot={decimal:/-?(?=[0-9]*\.|[0-9]+[eE])(([0-9]+\.[0-9]*|[0-9]*\.[0-9]+)([Ee][-+]?[0-9]+)?|[0-9]+[Ee][-+]?[0-9]+)/y,integer:/-?(0([Xx][0-9A-Fa-f]+|[0-7]*)|[1-9][0-9]*)/y,identifier:/[_-]?[A-Za-z][0-9A-Z_a-z-]*/y,string:/"[^"]*"/y,whitespace:/[\t\n\r ]+/y,comment:/\/\/.*|\/\*[\s\S]*?\*\//y,other:/[^\t\n\r 0-9A-Za-z]/y},Te=["ArrayBuffer","SharedArrayBuffer","DataView","Int8Array","Int16Array","Int32Array","Uint8Array","Uint16Array","Uint32Array","Uint8ClampedArray","BigInt64Array","BigUint64Array","Float16Array","Float32Array","Float64Array","any","object","symbol"],et=["ByteString","DOMString","USVString"],te=["async","attribute","callback","const","constructor","deleter","dictionary","enum","getter","includes","inherit","interface","iterable","maplike","namespace","partial","required","setlike","setter","static","stringifier","typedef","unrestricted"],tt=["-Infinity","FrozenArray","Infinity","NaN","ObservableArray","Promise","async_iterable","async_sequence","bigint","boolean","byte","double","false","float","long","mixin","null","octet","optional","or","readonly","record","sequence","short","true","undefined","unsigned","void"].concat(te,et,Te),Xe=["(",")",",","...",":",";","<","=",">","?","*","[","]","{","}"],xt=["_constructor","toString","_toString"];class de{constructor(f){this.source=function(h){let b=[],w=0,_="",W=1,K=0;for(;w<h.length;){let V=h.charAt(w),ne=-1;if(/[\t\n\r ]/.test(V)?ne=Y("whitespace",{noFlushTrivia:!0}):V==="/"&&(ne=Y("comment",{noFlushTrivia:!0})),ne!==-1){let fe=b.pop().value;W+=(fe.match(/\n/g)||[]).length,_+=fe,K-=1}else if(/[-0-9.A-Z_a-z]/.test(V)){if(ne=Y("decimal"),ne===-1&&(ne=Y("integer")),ne===-1){ne=Y("identifier");let fe=b.length-1,oe=b[fe];if(ne!==-1){if(xt.includes(oe.value)){let Je=`${A(oe.value)} is a reserved identifier and must not be used.`;throw new dt(r(b,fe,null,Je))}tt.includes(oe.value)&&(oe.type="inline")}}}else V==='"'&&(ne=Y("string"));for(let fe of Xe)if(h.startsWith(fe,w)){b.push({type:"inline",value:fe,trivia:_,line:W,index:K}),_="",w+=fe.length,ne=w;break}if(ne===-1&&(ne=Y("other")),ne===-1)throw Error("Token stream not progressing");w=ne,K+=1}return b.push({type:"eof",value:"",trivia:_,line:W,index:K}),b;function Y(V,{noFlushTrivia:ne}={}){let fe=ot[V];fe.lastIndex=w;let oe=fe.exec(h);return oe?(b.push({type:V,value:oe[0],trivia:_,line:W,index:K}),ne||(_=""),fe.lastIndex):-1}}(f),this.position=0}error(f){throw new dt(r(this.source,this.position,this.current,f))}probeKind(f){return this.source.length>this.position&&this.source[this.position].type===f}probe(f){return this.probeKind("inline")&&this.source[this.position].value===f}consumeKind(...f){for(let h of f){if(!this.probeKind(h))continue;let b=this.source[this.position];return this.position++,b}}consume(...f){if(!this.probeKind("inline"))return;let h=this.source[this.position];for(let b of f)if(h.value===b)return this.position++,h}consumeIdentifier(f){if(this.probeKind("identifier")&&this.source[this.position].value===f)return this.consumeKind("identifier")}unconsume(f){this.position=f}}class dt extends Error{constructor({message:f,bareMessage:h,context:b,line:w,sourceName:_,input:W,tokens:K}){super(f),this.name="WebIDLParseError",this.bareMessage=h,this.context=b,this.line=w,this.sourceName=_,this.input=W,this.tokens=K}}class Be extends l{static parse(f){let h=f.consumeKind("string");if(h)return new Be({source:f.source,tokens:{value:h}})}get type(){return"enum-value"}get value(){return super.value.slice(1,-1)}write(f){let{parent:h}=this;return f.ts.wrap([f.ts.trivia(this.tokens.value.trivia),f.ts.definition(f.ts.wrap(['"',f.ts.name(this.value,{data:this,parent:h}),'"']),{data:this,parent:h}),f.token(this.tokens.separator)])}}class ce extends o{static parse(f){let h={};if(h.base=f.consume("enum"),!h.base)return;h.name=f.consumeKind("identifier")||f.error("No name for enum");let b=ee(new ce({source:f.source,tokens:h}));return f.current=b.this,h.open=f.consume("{")||f.error("Bodyless enum"),b.values=N(f,{parser:Be.parse,allowDangler:!0,listName:"enumeration"}),f.probeKind("string")&&f.error("No comma between enum values"),h.close=f.consume("}")||f.error("Unexpected value in enum"),b.values.length||f.error("No value in enum"),h.termination=f.consume(";")||f.error("No semicolon after enum"),b.this}get type(){return"enum"}get name(){return A(this.tokens.name.value)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base),f.name_token(this.tokens.name,{data:this}),f.token(this.tokens.open),f.ts.wrap(this.values.map((h)=>h.write(f))),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this})}}class Et extends o{static parse(f){let h=f.consumeKind("identifier");if(!h)return;let b={target:h};if(b.includes=f.consume("includes"),b.includes)return b.mixin=f.consumeKind("identifier")||f.error("Incomplete includes statement"),b.termination=f.consume(";")||f.error("No terminating ; for includes statement"),new Et({source:f.source,tokens:b});f.unconsume(h.index)}get type(){return"includes"}get target(){return A(this.tokens.target.value)}get includes(){return A(this.tokens.mixin.value)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.reference_token(this.tokens.target,this),f.token(this.tokens.includes),f.reference_token(this.tokens.mixin,this),f.token(this.tokens.termination)]),{data:this})}}class Jr extends o{static parse(f){let h={},b=ee(new Jr({source:f.source,tokens:h}));if(h.base=f.consume("typedef"),h.base)return b.idlType=re(f,"typedef-type")||f.error("Typedef lacks a type"),h.name=f.consumeKind("identifier")||f.error("Typedef lacks a name"),f.current=b.this,h.termination=f.consume(";")||f.error("Unterminated typedef, expected `;`"),b.this}get type(){return"typedef"}get name(){return A(this.tokens.name.value)}*validate(f){yield*this.idlType.validate(f)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base),f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this}),f.token(this.tokens.termination)]),{data:this})}}class rr extends o{static parse(f,h){let b={base:h},w=ee(new rr({source:f.source,tokens:b}));return b.name=f.consumeKind("identifier")||f.error("Callback lacks a name"),f.current=w.this,b.assign=f.consume("=")||f.error("Callback lacks an assignment"),w.idlType=ue(f)||f.error("Callback lacks a return type"),b.open=f.consume("(")||f.error("Callback lacks parentheses for arguments"),w.arguments=X(f),b.close=f.consume(")")||f.error("Unterminated callback"),b.termination=f.consume(";")||f.error("Unterminated callback, expected `;`"),w.this}get type(){return"callback"}get name(){return A(this.tokens.name.value)}*validate(f){yield*this.extAttrs.validate(f);for(let h of this.arguments)if(yield*h.validate(f),h.idlType.generic==="async_sequence")yield s(h.tokens.name,h,"async-sequence-idl-to-js","async_sequence types cannot be returned as a callback argument.");yield*this.idlType.validate(f)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base),f.name_token(this.tokens.name,{data:this}),f.token(this.tokens.assign),f.ts.type(this.idlType.write(f)),f.token(this.tokens.open),...this.arguments.map((h)=>h.write(f)),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this})}}class Ft extends o{static parse(f,h,{inheritable:b,allowedMembers:w}){let{tokens:_,type:W}=h;for(_.name=f.consumeKind("identifier")||f.error(`Missing name in ${W}`),f.current=h,h=ee(h),b&&Object.assign(_,function(K){let Y=K.consume(":");return Y?{colon:Y,inheritance:K.consumeKind("identifier")||K.error("Inheritance lacks a type")}:{}}(f)),_.open=f.consume("{")||f.error(`Bodyless ${W}`),h.members=[];;){if(_.close=f.consume("}"),_.close)return _.termination=f.consume(";")||f.error(`Missing semicolon after ${W}`),h.this;let K=S.parse(f),Y;for(let[V,...ne]of w)if(Y=ee(V(f,...ne)),Y)break;Y||f.error("Unknown member"),Y.extAttrs=K,h.members.push(Y.this)}}get partial(){return!!this.tokens.partial}get name(){return A(this.tokens.name.value)}get inheritance(){return this.tokens.inheritance?A(this.tokens.inheritance.value):null}*validate(f){for(let h of this.members)h.validate&&(yield*h.validate(f))}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.callback),f.token(this.tokens.partial),f.token(this.tokens.base),f.token(this.tokens.mixin),f.name_token(this.tokens.name,{data:this}),(()=>this.tokens.inheritance?f.ts.wrap([f.token(this.tokens.colon),f.ts.trivia(this.tokens.inheritance.trivia),f.ts.inheritance(f.reference(this.tokens.inheritance.value,{context:this}))]):"")(),f.token(this.tokens.open),f.ts.wrap(this.members.map((h)=>h.write(f))),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this})}}class mn extends o{static parse(f){let h={};if(h.base=f.consume("const"),!h.base)return;let b=D(f);if(!b){let _=f.consumeKind("identifier")||f.error("Const lacks a type");b=new j({source:f.source,tokens:{base:_}})}f.probe("?")&&f.error("Unexpected nullable constant type"),b.type="const-type",h.name=f.consumeKind("identifier")||f.error("Const lacks a name"),h.assign=f.consume("=")||f.error("Const lacks value assignment"),h.value=B(f)||f.error("Const lacks a value"),h.termination=f.consume(";")||f.error("Unterminated const, expected `;`");let w=new mn({source:f.source,tokens:h});return ee(w).idlType=b,w}get type(){return"const"}get name(){return A(this.tokens.name.value)}get value(){return M(this.tokens.value)}write(f){let{parent:h}=this;return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base),f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this,parent:h}),f.token(this.tokens.assign),f.token(this.tokens.value),f.token(this.tokens.termination)]),{data:this,parent:h})}}class Qs extends o{static parse(f){let h=f.position,b=ee(new Qs({source:f.source,tokens:{}})),{tokens:w}=b;if(w.readonly=f.consume("readonly"),w.readonly||(w.async=f.consume("async")),w.base=w.readonly?f.consume("maplike","setlike"):w.async?f.consume("iterable"):f.consume("iterable","async_iterable","maplike","setlike"),!w.base)return void f.unconsume(h);let{type:_}=b,W=_==="maplike",K=W||_==="iterable"||_==="async_iterable",Y=_==="async_iterable"||b.async&&_==="iterable";w.open=f.consume("<")||f.error(`Missing less-than sign \`<\` in ${_} declaration`);let V=re(f)||f.error(`Missing a type argument in ${_} declaration`);return b.idlType=[V],b.arguments=[],K&&(V.tokens.separator=f.consume(","),V.tokens.separator?b.idlType.push(re(f)):W&&f.error(`Missing second type argument in ${_} declaration`)),w.close=f.consume(">")||f.error(`Missing greater-than sign \`>\` in ${_} declaration`),f.probe("(")&&(Y?(w.argsOpen=f.consume("("),b.arguments.push(...X(f)),w.argsClose=f.consume(")")||f.error("Unterminated async iterable argument list")):f.error("Arguments are only allowed for `async iterable`")),w.termination=f.consume(";")||f.error(`Missing semicolon after ${_} declaration`),b.this}get type(){return this.tokens.base.value}get readonly(){return!!this.tokens.readonly}get async(){return!!this.tokens.async}*validate(f){if(this.async&&this.type==="iterable")yield s(this.tokens.async,this,"obsolete-async-iterable-syntax","`async iterable` is now changed to `async_iterable`.",{autofix:(h=this,()=>{let w=h.tokens.async;h.tokens.base={...w,type:"async_iterable",value:"async_iterable"},delete h.tokens.async})});var h;for(let b of this.idlType)yield*b.validate(f);for(let b of this.arguments)yield*b.validate(f)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.readonly),f.token(this.tokens.async),f.token(this.tokens.base,f.ts.generic),f.token(this.tokens.open),f.ts.wrap(this.idlType.map((h)=>h.write(f))),f.token(this.tokens.close),f.token(this.tokens.argsOpen),f.ts.wrap(this.arguments.map((h)=>h.write(f))),f.token(this.tokens.argsClose),f.token(this.tokens.termination)]),{data:this,parent:this.parent})}}class jt extends o{static parse(f){let h=f.consume("constructor");if(!h)return;let b={base:h};b.open=f.consume("(")||f.error("No argument list in constructor");let w=X(f);b.close=f.consume(")")||f.error("Unterminated constructor"),b.termination=f.consume(";")||f.error("No semicolon after constructor");let _=new jt({source:f.source,tokens:b});return ee(_).arguments=w,_}get type(){return"constructor"}*validate(f){for(let h of this.arguments)yield*h.validate(f)}write(f){let{parent:h}=this;return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base,f.ts.nameless,{data:this,parent:h}),f.token(this.tokens.open),f.ts.wrap(this.arguments.map((b)=>b.write(f))),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this,parent:h})}}function ma(f){let h=f.consume("static");if(!h)return;return H.parse(f,{special:h})||F.parse(f,{special:h})||f.error("No body in static member")}class sr extends Ft{static parse(f,h,{extMembers:b=[],partial:w=null}={}){let _={partial:w,base:h};return Ft.parse(f,new sr({source:f.source,tokens:_}),{inheritable:!w,allowedMembers:[...b,[mn.parse],[jt.parse],[ma],[xe],[Qs.parse],[H.parse],[F.parse]]})}get type(){return"interface"}*validate(f){if(yield*this.extAttrs.validate(f),!this.partial&&this.extAttrs.every((b)=>b.name!=="Exposed"))yield s(this.tokens.name,this,"require-exposed","Interfaces must have `[Exposed]` extended attribute. To fix, add, for example, `[Exposed=Window]`. Please also consider carefully if your interface should also be exposed in a Worker scope. Refer to the [WebIDL spec section on Exposed](https://heycam.github.io/webidl/#Exposed) for more information.",{autofix:be(this)});let h=this.extAttrs.filter((b)=>b.name==="Constructor");for(let b of h)yield s(b.tokens.name,this,"constructor-member","Constructors should now be represented as a `constructor()` operation on the interface instead of `[Constructor]` extended attribute. Refer to the [WebIDL spec section on constructor operations](https://heycam.github.io/webidl/#idl-constructors) for more information.",{autofix:Ed(this,b)});if(this.extAttrs.some((b)=>b.name==="Global")){let b=this.extAttrs.filter((_)=>_.name==="LegacyFactoryFunction");for(let _ of b)yield s(_.tokens.name,this,"no-constructible-global","Interfaces marked as `[Global]` cannot have factory functions.");let w=this.members.filter((_)=>_.type==="constructor");for(let _ of w)yield s(_.tokens.base,this,"no-constructible-global","Interfaces marked as `[Global]` cannot have constructors.")}yield*super.validate(f),this.partial||(yield*function*(b,w){let _=function(ne){let fe=V(ne);return{statics:new Set(fe.filter((oe)=>oe.special==="static").map((oe)=>oe.name)),nonstatics:new Set(fe.filter((oe)=>oe.special!=="static").map((oe)=>oe.name))}}(w),W=b.partials.get(w.name)||[],K=b.mixinMap.get(w.name)||[];for(let ne of[...W,...K]){let fe=V(ne),oe=fe.filter((Pt)=>Pt.special==="static"),Je=fe.filter((Pt)=>Pt.special!=="static");yield*Y(oe,_.statics,ne,w),yield*Y(Je,_.nonstatics,ne,w),oe.forEach((Pt)=>_.statics.add(Pt.name)),Je.forEach((Pt)=>_.nonstatics.add(Pt.name))}function*Y(ne,fe,oe,Je){for(let Pt of ne){let{name:ss}=Pt;if(ss&&fe.has(ss)){let Pd=`The ${Pt.special==="static"?"static ":""}operation "${ss}" has already been defined for the base interface "${Je.name}" either in itself or in a mixin`;yield s(Pt.tokens.name,oe,"no-cross-overload",Pd)}}}function V(ne){return ne.members.filter(({type:fe})=>fe==="operation")}}(f,this))}}function Ed(f,h){return f=ee(f),()=>{let b=z(f.extAttrs.tokens.open.trivia),w=f.members.length?z(ae(f.members[0]).trivia):function(fe){let oe=z(fe),Je=oe.includes("\t")?"\t":" ";return oe+Je}(b),_=jt.parse(new de(`
611
+ ${w}constructor();`));_.extAttrs=new S({source:f.source,tokens:{}}),ee(_).arguments=h.arguments;let W=function(fe,oe){let Je=fe.slice().reverse().findIndex(oe);return Je===-1?Je:fe.length-Je-1}(f.members,(fe)=>fe.type==="constructor");f.members.splice(W+1,0,_);let{close:K}=f.tokens;K.trivia.includes(`
612
+ `)||(K.trivia+=`
613
+ ${b}`);let{extAttrs:Y}=f,V=Y.indexOf(h),ne=Y.splice(V,1);Y.length?Y.length===V?Y[V-1].tokens.separator=void 0:Y[V].tokens.name.trivia.trim()||(Y[V].tokens.name.trivia=ne[0].tokens.name.trivia):Y.tokens.open=Y.tokens.close=void 0}}class or extends Ft{static parse(f,h,{extMembers:b=[],partial:w}={}){let _={partial:w,base:h};if(_.mixin=f.consume("mixin"),_.mixin)return Ft.parse(f,new or({source:f.source,tokens:_}),{allowedMembers:[...b,[mn.parse],[xe],[H.parse,{noInherit:!0}],[F.parse,{regular:!0}]]})}get type(){return"interface mixin"}}class ir extends o{static parse(f){let h={},b=ee(new ir({source:f.source,tokens:h}));return b.extAttrs=S.parse(f),h.required=f.consume("required"),b.idlType=re(f,"dictionary-type")||f.error("Dictionary member lacks a type"),h.name=f.consumeKind("identifier")||f.error("Dictionary member lacks a name"),b.default=O.parse(f),h.required&&b.default&&f.error("Required member must not have a default"),h.termination=f.consume(";")||f.error("Unterminated dictionary member, expected `;`"),b.this}get type(){return"field"}get name(){return A(this.tokens.name.value)}get required(){return!!this.tokens.required}*validate(f){yield*this.idlType.validate(f)}write(f){let{parent:h}=this;return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.required),f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this,parent:h}),this.default?this.default.write(f):"",f.token(this.tokens.termination)]),{data:this,parent:h})}}class ns extends Ft{static parse(f,{extMembers:h=[],partial:b}={}){let w={partial:b};if(w.base=f.consume("dictionary"),w.base)return Ft.parse(f,new ns({source:f.source,tokens:w}),{inheritable:!b,allowedMembers:[...h,[ir.parse]]})}get type(){return"dictionary"}}class rs extends Ft{static parse(f,{extMembers:h=[],partial:b}={}){let w={partial:b};if(w.base=f.consume("namespace"),w.base)return Ft.parse(f,new rs({source:f.source,tokens:w}),{allowedMembers:[...h,[H.parse,{noInherit:!0,readonly:!0}],[mn.parse],[F.parse,{regular:!0}]]})}get type(){return"namespace"}*validate(f){if(!this.partial&&this.extAttrs.every((h)=>h.name!=="Exposed"))yield s(this.tokens.name,this,"require-exposed","Namespaces must have [Exposed] extended attribute. To fix, add, for example, [Exposed=Window]. Please also consider carefully if your namespace should also be exposed in a Worker scope. Refer to the [WebIDL spec section on Exposed](https://heycam.github.io/webidl/#Exposed) for more information.",{autofix:be(this)});yield*super.validate(f)}}class Lo extends Ft{static parse(f,h,{extMembers:b=[]}={}){let w={callback:h};if(w.base=f.consume("interface"),w.base)return Ft.parse(f,new Lo({source:f.source,tokens:w}),{allowedMembers:[...b,[mn.parse],[F.parse,{regular:!0}]]})}get type(){return"callback interface"}}function jd(f,h){let b=f.source;function w(V){f.error(V)}function _(...V){return f.consume(...V)}function W(V){let ne=_("interface");if(ne)return or.parse(f,ne,{...V,...h?.extensions?.mixin})||sr.parse(f,ne,{...V,...h?.extensions?.interface})||w("Interface has no proper body")}function K(){if(h.productions)for(let V of h.productions){let ne=V(f);if(ne)return ne}return function(){let V=_("callback");if(V)return f.probe("interface")?Lo.parse(f,V,{...h?.extensions?.callbackInterface}):rr.parse(f,V)}()||W()||function(){let V=_("partial");if(V)return ns.parse(f,{partial:V,...h?.extensions?.dictionary})||W({partial:V})||rs.parse(f,{partial:V,...h?.extensions?.namespace})||w("Partial doesn't apply to anything")}()||ns.parse(f,h?.extensions?.dictionary)||ce.parse(f)||Jr.parse(f)||Et.parse(f)||rs.parse(f,h?.extensions?.namespace)}let Y=function(){if(!b.length)return[];let V=[];for(;;){let fe=S.parse(f),oe=K();if(!oe){fe.length&&w("Stray extended attributes");break}ee(oe).extAttrs=fe,V.push(oe)}let ne=u.parse(f);return h.concrete&&V.push(ne),V}();return f.position<b.length&&w("Unrecognised tokens"),Y}function Uc(f,h={}){let b=new de(f);return h.sourceName!==void 0&&(b.source.name=h.sourceName),jd(b,h)}function en(f){return f}let ha={wrap:(f)=>f.join(""),trivia:en,name:en,reference:en,type:en,generic:en,nameless:en,inheritance:en,definition:en,extendedAttribute:en,extendedAttributeReference:en};class Bc{constructor(f){this.ts=Object.assign({},ha,f)}reference(f,{unescaped:h,context:b}){return h||(h=f.startsWith("_")?f.slice(1):f),this.ts.reference(f,h,b)}token(f,h=en,...b){if(!f)return"";let w=h(f.value,...b);return this.ts.wrap([this.ts.trivia(f.trivia),w])}reference_token(f,h){return this.token(f,this.reference.bind(this),{context:h})}name_token(f,h){return this.token(f,this.ts.name,h)}identifier(f,h){return this.ts.wrap([this.reference_token(f.tokens.value,h),this.token(f.tokens.separator)])}}function eo(f,{templates:h=ha}={}){h=Object.assign({},ha,h);let b=new Bc(h);return h.wrap(f.map((w)=>w.write(b)))}function zc(f,h){let b=new Map,w=f.filter((_)=>_.type==="includes");for(let _ of w){let W=h.get(_.includes);if(!W)continue;let K=b.get(_.target);K?K.push(W):b.set(_.target,[W])}return b}function*Kc(f){let h=function(b){let w=new Map,_=new Set,W=new Map;for(let K of b)if(K.partial){let Y=W.get(K.name);Y?Y.push(K):W.set(K.name,[K])}else K.name&&(w.has(K.name)?_.add(K):w.set(K.name,K));return{all:b,unique:w,partials:W,duplicates:_,mixinMap:zc(b,w),cache:{typedefIncludesDictionary:new WeakMap,dictionaryIncludesRequiredField:new WeakMap}}}(f);for(let b of h.all)b.validate&&(yield*b.validate(h));yield*function*({unique:b,duplicates:w}){for(let _ of w){let{name:W}=_,K=`The name "${W}" of type "${b.get(W).type}" was already seen`;yield s(_.tokens.name,_,"no-duplicate",K)}}(h)}function to(f){return[...Kc((h=f,h.flat?h.flat():[].concat(...h)))];var h}return t})())});var kj=q(function(uee,_j){var __dirname="/home/runner/work/jx/jx/node_modules/@webref/idl",vj=it("fs").promises,bf=it("path"),Ej=wj();class jj{constructor(e,t){this.filename=t,this.shortname=bf.basename(t,".idl"),this.path=bf.join(e,t)}async text(){return await vj.readFile(this.path,"utf8")}async parse(){let e=await this.text();return Ej.parse(e)}}async function Pj({folder:e=__dirname}={}){let t={},n=await vj.readdir(e);for(let r of n)if(r.endsWith(".idl")){let s=new jj(e,r);t[s.shortname]=s}return t}async function qL(e){let t=await Pj(e);for(let[n,r]of Object.entries(t))t[n]=await r.parse();return t}_j.exports={listAll:Pj,parseAll:qL}});function WL(){return Oj??=HL(),Oj}async function HL(){let[e,t,n]=await Promise.all([Cj.listAll(),Rj.default.listAll(),Nj.default.parseAll()]),r=new Set;for(let{elements:l}of Object.values(e))for(let u of l)if(!u.obsolete)r.add(u.name);let s=[...r].toSorted(),o=new Set;for(let l of t.properties)for(let u of l.styleDeclaration??[])o.add(u);let i=[...o].toSorted(),a=new Set;for(let l of Object.values(n))for(let u of l){if(u.type!=="interface"&&u.type!=="interface mixin")continue;if(!u.members)continue;for(let d of u.members)if(d.type==="attribute"&&d.name?.startsWith("on")&&d.idlType?.idlType==="EventHandler")a.add(d.name)}let c=[...a].toSorted();return{cssProps:i,eventHandlers:c,tagExamples:s}}function UL(e){let t={};for(let n of e)t[n]={description:`Event handler for the "${n.slice(2)}" event.`,oneOf:[{$ref:"#/$defs/RefObject"},{$ref:"#/$defs/ExpressionEntry"},{$ref:"#/$defs/FunctionDef"}]};return t}function BL(e){let t={...Qa.properties};for(let n of e)t[n]={oneOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/RefObject"}]};return t}async function zL(){let{tagExamples:e,cssProps:t,eventHandlers:n}=await WL();return{$defs:{DefsMap:Oh,TypeDefEntry:Ah,StateMap:kh,StateEntry:_h,TypedStateDef:Ym,PureTypeDef:ah,FunctionDef:Qm,ClassDef:Rh,ClassParameterDef:mu,ClassFieldDef:hu,ClassConstructorDef:gu,ClassMethodDef:yu,FormatDef:xu,ProjectBlockDef:bu,ServerBlockDef:$u,ConnectorBlockDef:Su,StudioHints:wu,ExternalClassDef:oh,ExpressionPointer:lh,ExpressionLiteral:uh,ExpressionOperand:fh,UnaryOperator:dh,BinaryOperator:ph,ConditionalOperator:mh,SwitchOperator:hh,CallOperator:gh,PureMethod:yh,AssignmentOperator:xh,NoArgMethod:bh,OneArgMethod:$h,SpliceMethod:Sh,ReduceMethod:wh,MapFilterMethod:vh,ExpressionNode:Eh,ExpressionEntry:jh,Statement:th,StatementList:nh,ElementDef:{...pu,properties:{...pu.properties,...UL(n)}},ChildrenValue:Wm,ArrayNamespace:qm,SwitchDef:Km,SwitchNode:Gm,StyleObject:{...Qa,properties:BL(t)},AttributesObject:Um,PropsObject:Bm,RefObject:Mm,AnyRef:Dm,InternalRef:Cm,StateRef:Rm,ExternalRef:Nm,ExternalComponentRef:Fm,GlobalRef:Tm,ParentRef:Jm,MapRef:Im,ElementPropertyValue:zm,StringOrRef:bm,BoolOrRef:$m,NumberOrRef:Sm,CemParameter:jm,CemEvent:Pm,TagName:{...ym,examples:[...e,"my-counter","todo-app","user-card"]},TagExpression:mm,ElementTagName:hm,JsonSchemaType:Om,HeadEntry:vm,ImageConfig:Za,PathsValue:{$id:Oo,anyOf:[...tc,Fh],description:"Default $paths source union: the core shapes, plus a catch-all for source shapes contributed by extensions this schema cannot see. The project's generated document.schema.json replaces this with the exact set its extensions provide."}},$id:"https://jxsuite.com/schema/v1",$schema:"https://json-schema.org/draft/2020-12/schema",additionalProperties:{$ref:"#/$defs/ElementPropertyValue"},description:"Schema for Jx component files. A Jx document is a JSON object that declaratively describes a reactive web component: its structure (DOM tree), styling, type definitions ($defs), runtime state, and inline or external functions. Reactivity is powered by @vue/reactivity.",properties:{$defs:{$ref:"#/$defs/DefsMap",description:"Pure JSON Schema type definitions for this component. "+"All entries are reusable type schemas — no runtime artifacts are produced. "+"Referenced from state entries via $ref. Naming convention: PascalCase."},$elements:{description:"Custom element dependencies. Items are either $ref objects pointing to JX element definitions, or bare npm package name strings for web component libraries.",items:{oneOf:[{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"},{description:"npm package specifier (must declare customElements in package.json)",type:"string"}]},type:"array"},$head:{description:"Page-level <head> entries. Array of head entries for meta tags, link tags, script tags, etc. Merged with layout and site-level $head entries.",items:{$ref:"#/$defs/HeadEntry"},type:"array"},$id:{description:"Component identifier string. Used by tooling and the builder.",examples:["Counter","TodoApp","UserCard"],type:"string"},$dir:{description:"Base direction for this page's <html> element, overriding `defaults.dir`. Right-to-left content renders left-to-right without it.",enum:["ltr","rtl","auto"],type:"string"},$lang:{description:"Language tag for this page's <html> element, overriding `defaults.lang` "+"(site-architecture.md §8.4).",examples:["en","fr","ar-EG"],type:"string"},$translationKey:{description:"This page's identity across languages, overriding the one its path implies "+"(site-architecture.md §13.5). Two routes are translations when their keys match; "+"the default key is the path with the locale prefix removed, which is right whenever "+"the paths are parallel and wrong for a localized slug — /fr-ca/a-propos/ shares "+"nothing with /about/ until one of them says so.",examples:["about","blog/hello-world"],type:"string"},$layout:{description:"Layout reference for pages. String path to a layout JSON file, or false to opt out of the default layout.",examples:["./layouts/base.json"],oneOf:[{type:"string"},{const:!1,type:"boolean"}]},$script:{additionalProperties:!1,description:"This document's own modules, as TypeScript module text (spec.md §23.2). "+'A state entry names an export of one with `$src: "#client"` or `$src: "#server"`. `client` runs in the browser; `server` runs only on the server and is never sent to one.',properties:{client:{description:'The module the browser runs. A Function entry with `$src: "#client"` is one of its exports.',type:"string"},server:{description:'The module the server runs. A `timing: "server"` entry with `$src: "#server"` is one of its exports, called with `(args, env)`.',type:"string"}},type:"object"},$shadow:{description:"Render this component into a shadow root instead of the light DOM (spec.md §16.6). "+"Off unless set: a shadow root isolates the component's styles from the page and replaces the <slot> emulation with real slot distribution, so it changes how the "+"component composes. Overrides `defaults.shadow` in both directions — `false` opts "+"one component out of a project that opted in.",oneOf:[{enum:["open","closed"],type:"string"},{const:!1,type:"boolean"}]},$sitemap:{description:"Set false to exclude this page from sitemap.xml (site-architecture.md §8.4.1). "+"Every other page with a URL is included.",type:"boolean"},$media:{additionalProperties:{type:"string"},description:'Named media breakpoints following CSS @custom-media convention. Keys use the CSS custom property -- prefix. Pure color-scheme queries (e.g. "--dark": "(prefers-color-scheme: dark)") are dual-emitted so a data-color-scheme attribute on the root element forces the scheme '+"regardless of the OS preference (spec §9.5).",examples:[{"--dark":"(prefers-color-scheme: dark)","--md":"(min-width: 768px)","--sm":"(min-width: 640px)"}],type:"object"},$paths:{$ref:Oo,description:"Dynamic route source for a page: expands one page per entry at build time. One of the core shapes (explicit `values`, a `$ref` data file, or a bare array of parameter objects) or a source shape contributed by an enabled extension, such as the parser's `contentType`."},$schema:{description:"URI identifying the Jx dialect version. Enables schema-aware IDE tooling.",examples:["https://jxsuite.com/schema/v1"],type:"string"},attributes:{$ref:"#/$defs/AttributesObject"},cases:{additionalProperties:{oneOf:[{$ref:"#/$defs/ElementDef"},{$ref:"#/$defs/ExternalComponentRef"}]},description:"Switch cases object. Maps case values to element definitions or external component refs. Used alongside $switch for dynamic component rendering.",type:"object"},children:{$ref:"#/$defs/ChildrenValue"},imports:{additionalProperties:{type:"string"},description:"Import map: $prototype names to .class.json file paths. Allows state entries to reference external classes by name without $src.",type:"object"},observedAttributes:{description:"HTML attributes the custom element watches for changes. Follows the Web Components observedAttributes convention.",items:{type:"string"},type:"array"},state:{$ref:"#/$defs/StateMap",description:"Runtime variables for this component. All entries are reactive by default. Entry shape is determined by value type: "+"scalar/array → reactive property, string with ${} → computed, "+"object with $prototype → function or data source, "+"object with type and default → typed reactive property."},style:{$ref:"#/$defs/StyleObject"},tagName:{$ref:"#/$defs/TagName"},title:{$ref:"#/$defs/StringOrRef",description:"Page title. Can be a static string or a template string with ${} expressions."}},title:"Jx Document",type:"object"}}function KL(){return{$defs:{ImageConfig:Za,StyleObject:Tj},$id:"https://jxsuite.com/schema/project/v1",$schema:"https://json-schema.org/draft/2020-12/schema",description:"Schema for Jx project.json files. A project.json file is the root anchor file for a Jx project, declaring site metadata, default settings, global styles, extensions, and build configuration. Open by design: extension-contributed sections are opaque top-level keys; the generated per-project entry document (project.schema.json) closes the composition.",properties:vu.properties,title:"Jx Project",type:"object"}}function GL(){return{$defs:{ImageConfig:Za,JxFieldSchema:Dh,RelationshipRef:Mh,StyleObject:Tj},$id:"https://jxsuite.com/schema/project/core/v2",$schema:"https://json-schema.org/draft/2020-12/schema",description:"Core fragment of the Jx project.json schema. Open by design: extension fragments contribute their own top-level sections and the generated per-project entry document "+"(project.schema.json) closes the composition. See specs/extensions.md §5.",properties:vu.properties,title:"Jx Project Core",type:"object"}}function XL(){return{$id:ec,$schema:"https://json-schema.org/draft/2020-12/schema",anyOf:[{$ref:"https://jxsuite.com/schema/project/core/v2#/$defs/JxFieldSchema"},{$ref:"https://jxsuite.com/schema/project/core/v2#/$defs/RelationshipRef"}],description:"Default field-schema union for section entry schemas: the core field shape plus relationship references. Per-project entry documents override this resource with the "+"effective union. See specs/extensions.md §5.3.",title:"Jx Project Field Union"}}function YL(){return{$id:Oo,$schema:"https://json-schema.org/draft/2020-12/schema",anyOf:[...tc,Fh],description:"Default $paths-value union for documents: the core source shapes. Per-project entry documents override this resource with those members PLUS every extension-contributed paths shape.",title:"Jx Document Paths Union"}}function ZL(){return{$id:"https://jxsuite.com/schema/extension-manifest/v1",$schema:"https://json-schema.org/draft/2020-12/schema",title:"Jx Extension Manifest",...Jh}}function py(){return{$defs:{ClassConstructorDef:gu,ClassFieldDef:hu,ClassMethodDef:yu,ClassParameterDef:mu,ConnectorBlockDef:Su,FormatDef:xu,ProjectBlockDef:bu,ServerBlockDef:$u,StudioHints:wu},$id:"https://jxsuite.com/schema/class/v1",$schema:"https://json-schema.org/draft/2020-12/schema",additionalProperties:!1,description:"Schema for Jx .class.json files. A class definition describes a schema-defined class with fields, constructor, methods, and type parameters. Optionally points to a JS module via $implementation for hybrid execution.",properties:{$defs:{description:"Class members: parameters, returnTypes, fields, constructor, methods.",properties:{constructor:{$ref:"#/$defs/ClassConstructorDef"},fields:{additionalProperties:{$ref:"#/$defs/ClassFieldDef"},description:"Class fields with role, access, scope, and type information.",type:"object"},methods:{additionalProperties:{$ref:"#/$defs/ClassMethodDef"},description:"Class methods and accessors.",type:"object"},parameters:{additionalProperties:{$ref:"#/$defs/ClassParameterDef"},description:"Reusable typed parameter schemas, keyed by name.",type:"object"},returnTypes:{additionalProperties:{type:"object"},description:"Output type schemas, keyed by name.",type:"object"}},type:"object"},$id:{type:"string"},$implementation:{description:"Relative path to a JS module containing the actual class implementation.",examples:["./md.js","./lib/calculator.js"],type:"string"},$prototype:{const:"Class",description:'Must be "Class" for class definition files.',type:"string"},$schema:{type:"string"},$studio:{$ref:"#/$defs/StudioHints"},connector:{$ref:"#/$defs/ConnectorBlockDef"},description:{type:"string"},extends:{description:"Base class — string name or $ref to another .class.json.",oneOf:[{type:"string"},{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"}]},format:{$ref:"#/$defs/FormatDef"},project:{$ref:"#/$defs/ProjectBlockDef"},server:{$ref:"#/$defs/ServerBlockDef"},title:{description:"PascalCase class name, used as the export name.",examples:["MarkdownFile","DataSource","Calculator"],type:"string"}},required:["$prototype","title"],title:"Jx Class Definition",type:"object"}}async function QL(e){let{mkdirSync:t,writeFileSync:n}=await import("node:fs"),{resolve:r,dirname:s}=await import("node:path"),o=s(r(e,"..")),i=await zL(),a=KL(),c=py(),l=GL(),u=ZL(),d=XL(),p=YL(),m=JSON.stringify(i,null,2),x=JSON.stringify(a,null,2),g=JSON.stringify(c,null,2),y=JSON.stringify(l,null,2),S=JSON.stringify(u,null,2),E=JSON.stringify(d,null,2),v=JSON.stringify(p,null,2),[j]=process.argv.slice(2);if(j)n(j,m,"utf8"),console.error(`Jx component schema written to ${j}`);else{n(r(o,"schema.json"),m,"utf8"),n(r(o,"project-schema.json"),x,"utf8"),n(r(o,"class-schema.json"),g,"utf8"),t(r(o,"schemas"),{recursive:!0}),n(r(o,"schemas","project.core.schema.json"),y,"utf8"),n(r(o,"schemas","project.fields.schema.json"),E,"utf8"),n(r(o,"schemas","document.paths.schema.json"),v,"utf8"),n(r(o,"extension-manifest.schema.json"),S,"utf8");let P=Bun.spawnSync(["bunx","oxfmt",r(o,"schemas","project.core.schema.json"),r(o,"schemas","project.fields.schema.json"),r(o,"schemas","document.paths.schema.json")],{cwd:o});if(P.exitCode!==0){let O=P.stderr.toString()||P.stdout.toString()||`exit ${P.exitCode}${P.signalCode?`, signal ${P.signalCode}`:""}`;console.error(`Warning: skipped oxfmt reformat of generated schemas (${O})`)}console.error("Generated:"),console.error(" schema.json (component)"),console.error(" project-schema.json"),console.error(" class-schema.json"),console.error(" schemas/project.core.schema.json"),console.error(" schemas/project.fields.schema.json"),console.error(" schemas/document.paths.schema.json"),console.error(" extension-manifest.schema.json")}}var Cj,Rj,Nj,Oj=null,Tj,Aj,Nee;var Jj=R(()=>{gm();xm();wm();Em();_m();Am();Lm();Vm();Hm();Xm();Zm();eh();rh();ih();ch();Ph();Ch();Nh();Ih();nc();km();Th();Cj=ar(yj(),1),Rj=ar(Sj(),1),Nj=ar(kj(),1);Tj={...Qa,additionalProperties:{anyOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/StyleObject"}]}};[,Aj]=process.argv,Nee=Aj?.endsWith("schema.ts")?QL(Aj):void 0});var Ac=q(function(Mj){Object.defineProperty(Mj,"__esModule",{value:!0});Mj.regexpCode=Mj.getEsmExportName=Mj.getProperty=Mj.safeStringify=Mj.stringify=Mj.strConcat=Mj.addCodeArg=Mj.str=Mj._=Mj.nil=Mj._Code=Mj.Name=Mj.IDENTIFIER=Mj._CodeOrName=void 0;class $f{}Mj._CodeOrName=$f;Mj.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class Fi extends $f{constructor(e){super();if(!Mj.IDENTIFIER.test(e))throw Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}Mj.Name=Fi;class nr extends $f{constructor(e){super();this._items=typeof e==="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((t,n)=>`${t}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((t,n)=>{if(n instanceof Fi)t[n.str]=(t[n.str]||0)+1;return t},{})}}Mj._Code=nr;Mj.nil=new nr("");function Ij(e,...t){let n=[e[0]],r=0;while(r<t.length)hy(n,t[r]),n.push(e[++r]);return new nr(n)}Mj._=Ij;var my=new nr("+");function Dj(e,...t){let n=[Oc(e[0])],r=0;while(r<t.length)n.push(my),hy(n,t[r]),n.push(my,Oc(e[++r]));return e2(n),new nr(n)}Mj.str=Dj;function hy(e,t){if(t instanceof nr)e.push(...t._items);else if(t instanceof Fi)e.push(t);else e.push(r2(t))}Mj.addCodeArg=hy;function e2(e){let t=1;while(t<e.length-1){if(e[t]===my){let n=t2(e[t-1],e[t+1]);if(n!==void 0){e.splice(t-1,3,n);continue}e[t++]="+"}t++}}function t2(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string"){if(t instanceof Fi||e[e.length-1]!=='"')return;if(typeof t!="string")return`${e.slice(0,-1)}${t}"`;if(t[0]==='"')return e.slice(0,-1)+t.slice(1);return}if(typeof t=="string"&&t[0]==='"'&&!(e instanceof Fi))return`"${e}${t.slice(1)}`;return}function n2(e,t){return t.emptyStr()?e:e.emptyStr()?t:Dj`${e}${t}`}Mj.strConcat=n2;function r2(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:Oc(Array.isArray(e)?e.join(","):e)}function s2(e){return new nr(Oc(e))}Mj.stringify=s2;function Oc(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Mj.safeStringify=Oc;function o2(e){return typeof e=="string"&&Mj.IDENTIFIER.test(e)?new nr(`.${e}`):Ij`[${e}]`}Mj.getProperty=o2;function i2(e){if(typeof e=="string"&&Mj.IDENTIFIER.test(e))return new nr(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}Mj.getEsmExportName=i2;function a2(e){return new nr(e.toString())}Mj.regexpCode=a2});var by=q(function(qj){Object.defineProperty(qj,"__esModule",{value:!0});qj.ValueScope=qj.ValueScopeName=qj.Scope=qj.varKinds=qj.UsedValueState=void 0;var Ve=Ac();class Lj extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var wf;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(wf||(qj.UsedValueState=wf={}));qj.varKinds={const:new Ve.Name("const"),let:new Ve.Name("let"),var:new Ve.Name("var")};class yy{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof Ve.Name?e:this.name(e)}name(e){return new Ve.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,n;if(((n=(t=this._parent)===null||t===void 0?void 0:t._prefixes)===null||n===void 0?void 0:n.has(e))||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}qj.Scope=yy;class xy extends Ve.Name{constructor(e,t){super(t);this.prefix=e}setValue(e,{property:t,itemIndex:n}){this.value=e,this.scopePath=Ve._`.${new Ve.Name(t)}[${n}]`}}qj.ValueScopeName=xy;var $2=Ve._`\n`;class Vj extends yy{constructor(e){super(e);this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?$2:Ve.nil}}get(){return this._scope}name(e){return new xy(e,this._newName(e))}value(e,t){var n;if(t.ref===void 0)throw Error("CodeGen: ref must be passed in value");let r=this.toName(e),{prefix:s}=r,o=(n=t.key)!==null&&n!==void 0?n:t.ref,i=this._values[s];if(i){let l=i.get(o);if(l)return l}else i=this._values[s]=new Map;i.set(o,r);let a=this._scope[s]||(this._scope[s]=[]),c=a.length;return a[c]=t.ref,r.setValue(t,{property:s,itemIndex:c}),r}getValue(e,t){let n=this._values[e];if(!n)return;return n.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,(n)=>{if(n.scopePath===void 0)throw Error(`CodeGen: name "${n}" has no value`);return Ve._`${e}${n.scopePath}`})}scopeCode(e=this._values,t,n){return this._reduceValues(e,(r)=>{if(r.value===void 0)throw Error(`CodeGen: name "${r}" has no value`);return r.value.code},t,n)}_reduceValues(e,t,n={},r){let s=Ve.nil;for(let o in e){let i=e[o];if(!i)continue;let a=n[o]=n[o]||new Map;i.forEach((c)=>{if(a.has(c))return;a.set(c,wf.Started);let l=t(c);if(l){let u=this.opts.es5?qj.varKinds.var:qj.varKinds.const;s=Ve._`${s}${u} ${c} = ${l};${this.opts._n}`}else if(l=r===null||r===void 0?void 0:r(c))s=Ve._`${s}${l}${this.opts._n}`;else throw new Lj(c);a.set(c,wf.Completed)})}return s}}qj.ValueScope=Vj});var ye=q(function(an){Object.defineProperty(an,"__esModule",{value:!0});an.or=an.and=an.not=an.CodeGen=an.operators=an.varKinds=an.ValueScopeName=an.ValueScope=an.Scope=an.Name=an.regexpCode=an.stringify=an.getProperty=an.nil=an.strConcat=an.str=an._=void 0;var Z=Ac(),at=by(),Rs=Ac();Object.defineProperty(an,"_",{enumerable:!0,get:function(){return Rs._}});Object.defineProperty(an,"str",{enumerable:!0,get:function(){return Rs.str}});Object.defineProperty(an,"strConcat",{enumerable:!0,get:function(){return Rs.strConcat}});Object.defineProperty(an,"nil",{enumerable:!0,get:function(){return Rs.nil}});Object.defineProperty(an,"getProperty",{enumerable:!0,get:function(){return Rs.getProperty}});Object.defineProperty(an,"stringify",{enumerable:!0,get:function(){return Rs.stringify}});Object.defineProperty(an,"regexpCode",{enumerable:!0,get:function(){return Rs.regexpCode}});Object.defineProperty(an,"Name",{enumerable:!0,get:function(){return Rs.Name}});var kf=by();Object.defineProperty(an,"Scope",{enumerable:!0,get:function(){return kf.Scope}});Object.defineProperty(an,"ValueScope",{enumerable:!0,get:function(){return kf.ValueScope}});Object.defineProperty(an,"ValueScopeName",{enumerable:!0,get:function(){return kf.ValueScopeName}});Object.defineProperty(an,"varKinds",{enumerable:!0,get:function(){return kf.varKinds}});an.operators={GT:new Z._Code(">"),GTE:new Z._Code(">="),LT:new Z._Code("<"),LTE:new Z._Code("<="),EQ:new Z._Code("==="),NEQ:new Z._Code("!=="),NOT:new Z._Code("!"),OR:new Z._Code("||"),AND:new Z._Code("&&"),ADD:new Z._Code("+")};class Ns{optimizeNodes(){return this}optimizeNames(e,t){return this}}class Hj extends Ns{constructor(e,t,n){super();this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){let n=e?at.varKinds.var:this.varKind,r=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${r};`+t}optimizeNames(e,t){if(!e[this.name.str])return;if(this.rhs)this.rhs=Vi(this.rhs,e,t);return this}get names(){return this.rhs instanceof Z._CodeOrName?this.rhs.names:{}}}class wy extends Ns{constructor(e,t,n){super();this.lhs=e,this.rhs=t,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(this.lhs instanceof Z.Name&&!e[this.lhs.str]&&!this.sideEffects)return;return this.rhs=Vi(this.rhs,e,t),this}get names(){let e=this.lhs instanceof Z.Name?{}:{...this.lhs.names};return _f(e,this.rhs)}}class Uj extends wy{constructor(e,t,n,r){super(e,n,r);this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class Bj extends Ns{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class zj extends Ns{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class Kj extends Ns{constructor(e){super();this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class Gj extends Ns{constructor(e){super();this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=Vi(this.code,e,t),this}get names(){return this.code instanceof Z._CodeOrName?this.code.names:{}}}class Of extends Ns{constructor(e=[]){super();this.nodes=e}render(e){return this.nodes.reduce((t,n)=>t+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,t=e.length;while(t--){let n=e[t].optimizeNodes();if(Array.isArray(n))e.splice(t,1,...n);else if(n)e[t]=n;else e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:n}=this,r=n.length;while(r--){let s=n[r];if(s.optimizeNames(e,t))continue;E2(e,s.names),n.splice(r,1)}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>To(e,t.names),{})}}class Ts extends Of{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class Xj extends Of{}class Cc extends Ts{}Cc.kind="else";class es extends Ts{constructor(e,t){super(t);this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);if(this.else)t+="else "+this.else.render(e);return t}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let t=this.else;if(t){let n=t.optimizeNodes();t=this.else=Array.isArray(n)?new Cc(n):n}if(t){if(e===!1)return t instanceof es?t:t.nodes;if(this.nodes.length)return this;return new es(tP(e),t instanceof es?[t]:t.nodes)}if(e===!1||!this.nodes.length)return;return this}optimizeNames(e,t){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,t),!(super.optimizeNames(e,t)||this.else))return;return this.condition=Vi(this.condition,e,t),this}get names(){let e=super.names;if(_f(e,this.condition),this.else)To(e,this.else.names);return e}}es.kind="if";class Li extends Ts{}Li.kind="for";class Yj extends Li{constructor(e){super();this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;return this.iteration=Vi(this.iteration,e,t),this}get names(){return To(super.names,this.iteration.names)}}class Zj extends Li{constructor(e,t,n,r){super();this.varKind=e,this.name=t,this.from=n,this.to=r}render(e){let t=e.es5?at.varKinds.var:this.varKind,{name:n,from:r,to:s}=this;return`for(${t} ${n}=${r}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){let e=_f(super.names,this.from);return _f(e,this.to)}}class $y extends Li{constructor(e,t,n,r){super();this.loop=e,this.varKind=t,this.name=n,this.iterable=r}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;return this.iterable=Vi(this.iterable,e,t),this}get names(){return To(super.names,this.iterable.names)}}class vf extends Ts{constructor(e,t,n){super();this.name=e,this.args=t,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}vf.kind="func";class Ef extends Of{render(e){return"return "+super.render(e)}}Ef.kind="return";class Qj extends Ts{render(e){let t="try"+super.render(e);if(this.catch)t+=this.catch.render(e);if(this.finally)t+=this.finally.render(e);return t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(t=this.finally)===null||t===void 0||t.optimizeNodes(),this}optimizeNames(e,t){var n,r;return super.optimizeNames(e,t),(n=this.catch)===null||n===void 0||n.optimizeNames(e,t),(r=this.finally)===null||r===void 0||r.optimizeNames(e,t),this}get names(){let e=super.names;if(this.catch)To(e,this.catch.names);if(this.finally)To(e,this.finally.names);return e}}class jf extends Ts{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}jf.kind="catch";class Pf extends Ts{render(e){return"finally"+super.render(e)}}Pf.kind="finally";class eP{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
614
+ `:""},this._extScope=e,this._scope=new at.Scope({parent:e}),this._nodes=[new Xj]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let n=this._extScope.value(e,t);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,n,r){let s=this._scope.toName(t);if(n!==void 0&&r)this._constants[s.str]=n;return this._leafNode(new Hj(e,s,n)),s}const(e,t,n){return this._def(at.varKinds.const,e,t,n)}let(e,t,n){return this._def(at.varKinds.let,e,t,n)}var(e,t,n){return this._def(at.varKinds.var,e,t,n)}assign(e,t,n){return this._leafNode(new wy(e,t,n))}add(e,t){return this._leafNode(new Uj(e,an.operators.ADD,t))}code(e){if(typeof e=="function")e();else if(e!==Z.nil)this._leafNode(new Gj(e));return this}object(...e){let t=["{"];for(let[n,r]of e){if(t.length>1)t.push(",");if(t.push(n),n!==r||this.opts.es5)t.push(":"),Z.addCodeArg(t,r)}return t.push("}"),new Z._Code(t)}if(e,t,n){if(this._blockNode(new es(e)),t&&n)this.code(t).else().code(n).endIf();else if(t)this.code(t).endIf();else if(n)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new es(e))}else(){return this._elseNode(new Cc)}endIf(){return this._endBlockNode(es,Cc)}_for(e,t){if(this._blockNode(e),t)this.code(t).endFor();return this}for(e,t){return this._for(new Yj(e),t)}forRange(e,t,n,r,s=this.opts.es5?at.varKinds.var:at.varKinds.let){let o=this._scope.toName(e);return this._for(new Zj(s,o,t,n),()=>r(o))}forOf(e,t,n,r=at.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let o=t instanceof Z.Name?t:this.var("_arr",t);return this.forRange("_i",0,Z._`${o}.length`,(i)=>{this.var(s,Z._`${o}[${i}]`),n(s)})}return this._for(new $y("of",r,s,t),()=>n(s))}forIn(e,t,n,r=this.opts.es5?at.varKinds.var:at.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,Z._`Object.keys(${t})`,n);let s=this._scope.toName(e);return this._for(new $y("in",r,s,t),()=>n(s))}endFor(){return this._endBlockNode(Li)}label(e){return this._leafNode(new Bj(e))}break(e){return this._leafNode(new zj(e))}return(e){let t=new Ef;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(Ef)}try(e,t,n){if(!t&&!n)throw Error('CodeGen: "try" without "catch" and "finally"');let r=new Qj;if(this._blockNode(r),this.code(e),t){let s=this.name("e");this._currNode=r.catch=new jf(s),t(s)}if(n)this._currNode=r.finally=new Pf,this.code(n);return this._endBlockNode(jf,Pf)}throw(e){return this._leafNode(new Kj(e))}block(e,t){if(this._blockStarts.push(this._nodes.length),e)this.code(e).endBlock(t);return this}endBlock(e){let t=this._blockStarts.pop();if(t===void 0)throw Error("CodeGen: not in self-balancing block");let n=this._nodes.length-t;if(n<0||e!==void 0&&n!==e)throw Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=Z.nil,n,r){if(this._blockNode(new vf(e,t,n)),r)this.code(r).endFunc();return this}endFunc(){return this._endBlockNode(vf)}optimize(e=1){while(e-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let n=this._currNode;if(n instanceof e||t&&n instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof es))throw Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}}an.CodeGen=eP;function To(e,t){for(let n in t)e[n]=(e[n]||0)+(t[n]||0);return e}function _f(e,t){return t instanceof Z._CodeOrName?To(e,t.names):e}function Vi(e,t,n){if(e instanceof Z.Name)return r(e);if(!s(e))return e;return new Z._Code(e._items.reduce((o,i)=>{if(i instanceof Z.Name)i=r(i);if(i instanceof Z._Code)o.push(...i._items);else o.push(i);return o},[]));function r(o){let i=n[o.str];if(i===void 0||t[o.str]!==1)return o;return delete t[o.str],i}function s(o){return o instanceof Z._Code&&o._items.some((i)=>i instanceof Z.Name&&t[i.str]===1&&n[i.str]!==void 0)}}function E2(e,t){for(let n in t)e[n]=(e[n]||0)-(t[n]||0)}function tP(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:Z._`!${Sy(e)}`}an.not=tP;var j2=nP(an.operators.AND);function P2(...e){return e.reduce(j2)}an.and=P2;var _2=nP(an.operators.OR);function k2(...e){return e.reduce(_2)}an.or=k2;function nP(e){return(t,n)=>t===Z.nil?n:n===Z.nil?t:Z._`${Sy(t)} ${e} ${Sy(n)}`}function Sy(e){return e instanceof Z.Name?e:Z._`(${e})`}});var _e=q(function(dP){Object.defineProperty(dP,"__esModule",{value:!0});dP.checkStrictMode=dP.getErrorPath=dP.Type=dP.useFunc=dP.setEvaluated=dP.evaluatedPropsToName=dP.mergeEvaluated=dP.eachItem=dP.unescapeJsonPointer=dP.escapeJsonPointer=dP.escapeFragment=dP.unescapeFragment=dP.schemaRefOrVal=dP.schemaHasRulesButRef=dP.schemaHasRules=dP.checkUnknownRules=dP.alwaysValidSchema=dP.toHash=void 0;var ie=ye(),iP=Ac();function R2(e){let t={};for(let n of e)t[n]=!0;return t}dP.toHash=R2;function N2(e,t){if(typeof t=="boolean")return t;if(Object.keys(t).length===0)return!0;return aP(e,t),!cP(t,e.self.RULES.all)}dP.alwaysValidSchema=N2;function aP(e,t=e.schema){let{opts:n,self:r}=e;if(!n.strictSchema)return;if(typeof t==="boolean")return;let s=r.RULES.keywords;for(let o in t)if(!s[o])fP(e,`unknown keyword: "${o}"`)}dP.checkUnknownRules=aP;function cP(e,t){if(typeof e=="boolean")return!e;for(let n in e)if(t[n])return!0;return!1}dP.schemaHasRules=cP;function T2(e,t){if(typeof e=="boolean")return!e;for(let n in e)if(n!=="$ref"&&t.all[n])return!0;return!1}dP.schemaHasRulesButRef=T2;function J2({topSchemaRef:e,schemaPath:t},n,r,s){if(!s){if(typeof n=="number"||typeof n=="boolean")return n;if(typeof n=="string")return ie._`${n}`}return ie._`${e}${t}${ie.getProperty(r)}`}dP.schemaRefOrVal=J2;function I2(e){return lP(decodeURIComponent(e))}dP.unescapeFragment=I2;function D2(e){return encodeURIComponent(Ey(e))}dP.escapeFragment=D2;function Ey(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}dP.escapeJsonPointer=Ey;function lP(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}dP.unescapeJsonPointer=lP;function M2(e,t){if(Array.isArray(e))for(let n of e)t(n);else t(e)}dP.eachItem=M2;function sP({mergeNames:e,mergeToName:t,mergeValues:n,resultToName:r}){return(s,o,i,a)=>{let c=i===void 0?o:i instanceof ie.Name?(o instanceof ie.Name?e(s,o,i):t(s,o,i),i):o instanceof ie.Name?(t(s,i,o),o):n(o,i);return a===ie.Name&&!(c instanceof ie.Name)?r(s,c):c}}dP.mergeEvaluated={props:sP({mergeNames:(e,t,n)=>e.if(ie._`${n} !== true && ${t} !== undefined`,()=>{e.if(ie._`${t} === true`,()=>e.assign(n,!0),()=>e.assign(n,ie._`${n} || {}`).code(ie._`Object.assign(${n}, ${t})`))}),mergeToName:(e,t,n)=>e.if(ie._`${n} !== true`,()=>{if(t===!0)e.assign(n,!0);else e.assign(n,ie._`${n} || {}`),jy(e,n,t)}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:uP}),items:sP({mergeNames:(e,t,n)=>e.if(ie._`${n} !== true && ${t} !== undefined`,()=>e.assign(n,ie._`${t} === true ? true : ${n} > ${t} ? ${n} : ${t}`)),mergeToName:(e,t,n)=>e.if(ie._`${n} !== true`,()=>e.assign(n,t===!0?!0:ie._`${n} > ${t} ? ${n} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function uP(e,t){if(t===!0)return e.var("props",!0);let n=e.var("props",ie._`{}`);if(t!==void 0)jy(e,n,t);return n}dP.evaluatedPropsToName=uP;function jy(e,t,n){Object.keys(n).forEach((r)=>e.assign(ie._`${t}${ie.getProperty(r)}`,!0))}dP.setEvaluated=jy;var oP={};function F2(e,t){return e.scopeValue("func",{ref:t,code:oP[t.code]||(oP[t.code]=new iP._Code(t.code))})}dP.useFunc=F2;var vy;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(vy||(dP.Type=vy={}));function L2(e,t,n){if(e instanceof ie.Name){let r=t===vy.Num;return n?r?ie._`"[" + ${e} + "]"`:ie._`"['" + ${e} + "']"`:r?ie._`"/" + ${e}`:ie._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return n?ie.getProperty(e).toString():"/"+Ey(e)}dP.getErrorPath=L2;function fP(e,t,n=e.opts.strictSchema){if(!n)return;if(t=`strict mode: ${t}`,n===!0)throw Error(t);e.self.logger.warn(t)}dP.checkStrictMode=fP});var Jn=q(function(mP){Object.defineProperty(mP,"__esModule",{value:!0});var Ne=ye(),sV={data:new Ne.Name("data"),valCxt:new Ne.Name("valCxt"),instancePath:new Ne.Name("instancePath"),parentData:new Ne.Name("parentData"),parentDataProperty:new Ne.Name("parentDataProperty"),rootData:new Ne.Name("rootData"),dynamicAnchors:new Ne.Name("dynamicAnchors"),vErrors:new Ne.Name("vErrors"),errors:new Ne.Name("errors"),this:new Ne.Name("this"),self:new Ne.Name("self"),scope:new Ne.Name("scope"),json:new Ne.Name("json"),jsonPos:new Ne.Name("jsonPos"),jsonLen:new Ne.Name("jsonLen"),jsonPart:new Ne.Name("jsonPart")};mP.default=sV});var Rc=q(function(xP){Object.defineProperty(xP,"__esModule",{value:!0});xP.extendErrors=xP.resetErrorsCount=xP.reportExtraError=xP.reportError=xP.keyword$DataError=xP.keywordError=void 0;var Q=ye(),Js=_e(),Yt=Jn();xP.keywordError={message:({keyword:e})=>Q.str`must pass "${e}" keyword validation`};xP.keyword$DataError={message:({keyword:e,schemaType:t})=>t?Q.str`"${e}" keyword must be ${t} ($data)`:Q.str`"${e}" keyword is invalid ($data)`};function iV(e,t=xP.keywordError,n,r){let{it:s}=e,{gen:o,compositeRule:i,allErrors:a}=s,c=yP(e,t,n);if(r!==null&&r!==void 0?r:i||a)hP(o,c);else gP(s,Q._`[${c}]`)}xP.reportError=iV;function aV(e,t=xP.keywordError,n){let{it:r}=e,{gen:s,compositeRule:o,allErrors:i}=r,a=yP(e,t,n);if(hP(s,a),!(o||i))gP(r,Yt.default.vErrors)}xP.reportExtraError=aV;function cV(e,t){e.assign(Yt.default.errors,t),e.if(Q._`${Yt.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(Q._`${Yt.default.vErrors}.length`,t),()=>e.assign(Yt.default.vErrors,null)))}xP.resetErrorsCount=cV;function lV({gen:e,keyword:t,schemaValue:n,data:r,errsCount:s,it:o}){if(s===void 0)throw Error("ajv implementation error");let i=e.name("err");e.forRange("i",s,Yt.default.errors,(a)=>{if(e.const(i,Q._`${Yt.default.vErrors}[${a}]`),e.if(Q._`${i}.instancePath === undefined`,()=>e.assign(Q._`${i}.instancePath`,Q.strConcat(Yt.default.instancePath,o.errorPath))),e.assign(Q._`${i}.schemaPath`,Q.str`${o.errSchemaPath}/${t}`),o.opts.verbose)e.assign(Q._`${i}.schema`,n),e.assign(Q._`${i}.data`,r)})}xP.extendErrors=lV;function hP(e,t){let n=e.const("err",t);e.if(Q._`${Yt.default.vErrors} === null`,()=>e.assign(Yt.default.vErrors,Q._`[${n}]`),Q._`${Yt.default.vErrors}.push(${n})`),e.code(Q._`${Yt.default.errors}++`)}function gP(e,t){let{gen:n,validateName:r,schemaEnv:s}=e;if(s.$async)n.throw(Q._`new ${e.ValidationError}(${t})`);else n.assign(Q._`${r}.errors`,t),n.return(!1)}var Jo={keyword:new Q.Name("keyword"),schemaPath:new Q.Name("schemaPath"),params:new Q.Name("params"),propertyName:new Q.Name("propertyName"),message:new Q.Name("message"),schema:new Q.Name("schema"),parentSchema:new Q.Name("parentSchema")};function yP(e,t,n){let{createErrors:r}=e.it;if(r===!1)return Q._`{}`;return uV(e,t,n)}function uV(e,t,n={}){let{gen:r,it:s}=e,o=[fV(s,n),dV(e,n)];return pV(e,t,o),r.object(...o)}function fV({errorPath:e},{instancePath:t}){let n=t?Q.str`${e}${Js.getErrorPath(t,Js.Type.Str)}`:e;return[Yt.default.instancePath,Q.strConcat(Yt.default.instancePath,n)]}function dV({keyword:e,it:{errSchemaPath:t}},{schemaPath:n,parentSchema:r}){let s=r?t:Q.str`${t}/${e}`;if(n)s=Q.str`${s}${Js.getErrorPath(n,Js.Type.Str)}`;return[Jo.schemaPath,s]}function pV(e,{params:t,message:n},r){let{keyword:s,data:o,schemaValue:i,it:a}=e,{opts:c,propertyName:l,topSchemaRef:u,schemaPath:d}=a;if(r.push([Jo.keyword,s],[Jo.params,typeof t=="function"?t(e):t||Q._`{}`]),c.messages)r.push([Jo.message,typeof n=="function"?n(e):n]);if(c.verbose)r.push([Jo.schema,i],[Jo.parentSchema,Q._`${u}${d}`],[Yt.default.data,o]);if(l)r.push([Jo.propertyName,l])}});var jP=q(function(vP){Object.defineProperty(vP,"__esModule",{value:!0});vP.boolOrEmptySchema=vP.topBoolOrEmptySchema=void 0;var $P=Rc(),SP=ye(),xV=Jn(),bV={message:"boolean schema is false"};function $V(e){let{gen:t,schema:n,validateName:r}=e;if(n===!1)wP(e,!1);else if(typeof n=="object"&&n.$async===!0)t.return(xV.default.data);else t.assign(SP._`${r}.errors`,null),t.return(!0)}vP.topBoolOrEmptySchema=$V;function SV(e,t){let{gen:n,schema:r}=e;if(r===!1)n.var(t,!1),wP(e);else n.var(t,!0)}vP.boolOrEmptySchema=SV;function wP(e,t){let{gen:n,data:r}=e;$P.reportError({gen:n,keyword:"false schema",data:r,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},bV,void 0,t)}});var _y=q(function(PP){Object.defineProperty(PP,"__esModule",{value:!0});PP.getRules=PP.isJSONType=void 0;var vV=["string","number","integer","boolean","null","object","array"],EV=new Set(vV);function jV(e){return typeof e=="string"&&EV.has(e)}PP.isJSONType=jV;function PV(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}PP.getRules=PV});var ky=q(function(AP){Object.defineProperty(AP,"__esModule",{value:!0});AP.shouldUseRule=AP.shouldUseGroup=AP.schemaHasRulesForType=void 0;function kV({schema:e,self:t},n){let r=t.RULES.types[n];return r&&r!==!0&&kP(e,r)}AP.schemaHasRulesForType=kV;function kP(e,t){return t.rules.some((n)=>OP(e,n))}AP.shouldUseGroup=kP;function OP(e,t){var n;return e[t.keyword]!==void 0||((n=t.definition.implements)===null||n===void 0?void 0:n.some((r)=>e[r]!==void 0))}AP.shouldUseRule=OP});var Nc=q(function(DP){Object.defineProperty(DP,"__esModule",{value:!0});DP.reportTypeError=DP.checkDataTypes=DP.checkDataType=DP.coerceAndCheckDataType=DP.getJSONTypes=DP.getSchemaTypes=DP.DataType=void 0;var RP=_y(),NP=ky(),TP=Rc(),G=ye(),Cf=_e(),qi;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(qi||(DP.DataType=qi={}));function CV(e){let t=JP(e.type);if(t.includes("null")){if(e.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(e.nullable===!0)t.push("null")}return t}DP.getSchemaTypes=CV;function JP(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(RP.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}DP.getJSONTypes=JP;function RV(e,t){let{gen:n,data:r,opts:s}=e,o=NV(t,s.coerceTypes),i=t.length>0&&!(o.length===0&&t.length===1&&NP.schemaHasRulesForType(e,t[0]));if(i){let a=Ay(t,r,s.strictNumbers,qi.Wrong);n.if(a,()=>{if(o.length)TV(e,t,o);else Cy(e)})}return i}DP.coerceAndCheckDataType=RV;var IP=new Set(["string","number","integer","boolean","null"]);function NV(e,t){return t?e.filter((n)=>IP.has(n)||t==="array"&&n==="array"):[]}function TV(e,t,n){let{gen:r,data:s,opts:o}=e,i=r.let("dataType",G._`typeof ${s}`),a=r.let("coerced",G._`undefined`);if(o.coerceTypes==="array")r.if(G._`${i} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,()=>r.assign(s,G._`${s}[0]`).assign(i,G._`typeof ${s}`).if(Ay(t,s,o.strictNumbers),()=>r.assign(a,s)));r.if(G._`${a} !== undefined`);for(let l of n)if(IP.has(l)||l==="array"&&o.coerceTypes==="array")c(l);r.else(),Cy(e),r.endIf(),r.if(G._`${a} !== undefined`,()=>{r.assign(s,a),JV(e,a)});function c(l){switch(l){case"string":r.elseIf(G._`${i} == "number" || ${i} == "boolean"`).assign(a,G._`"" + ${s}`).elseIf(G._`${s} === null`).assign(a,G._`""`);return;case"number":r.elseIf(G._`${i} == "boolean" || ${s} === null
615
+ || (${i} == "string" && ${s} && ${s} == +${s})`).assign(a,G._`+${s}`);return;case"integer":r.elseIf(G._`${i} === "boolean" || ${s} === null
616
+ || (${i} === "string" && ${s} && ${s} == +${s} && !(${s} % 1))`).assign(a,G._`+${s}`);return;case"boolean":r.elseIf(G._`${s} === "false" || ${s} === 0 || ${s} === null`).assign(a,!1).elseIf(G._`${s} === "true" || ${s} === 1`).assign(a,!0);return;case"null":r.elseIf(G._`${s} === "" || ${s} === 0 || ${s} === false`),r.assign(a,null);return;case"array":r.elseIf(G._`${i} === "string" || ${i} === "number"
617
+ || ${i} === "boolean" || ${s} === null`).assign(a,G._`[${s}]`)}}}function JV({gen:e,parentData:t,parentDataProperty:n},r){e.if(G._`${t} !== undefined`,()=>e.assign(G._`${t}[${n}]`,r))}function Oy(e,t,n,r=qi.Correct){let s=r===qi.Correct?G.operators.EQ:G.operators.NEQ,o;switch(e){case"null":return G._`${t} ${s} null`;case"array":o=G._`Array.isArray(${t})`;break;case"object":o=G._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":o=i(G._`!(${t} % 1) && !isNaN(${t})`);break;case"number":o=i();break;default:return G._`typeof ${t} ${s} ${e}`}return r===qi.Correct?o:G.not(o);function i(a=G.nil){return G.and(G._`typeof ${t} == "number"`,a,n?G._`isFinite(${t})`:G.nil)}}DP.checkDataType=Oy;function Ay(e,t,n,r){if(e.length===1)return Oy(e[0],t,n,r);let s,o=Cf.toHash(e);if(o.array&&o.object){let i=G._`typeof ${t} != "object"`;s=o.null?i:G._`!${t} || ${i}`,delete o.null,delete o.array,delete o.object}else s=G.nil;if(o.number)delete o.integer;for(let i in o)s=G.and(s,Oy(i,t,n,r));return s}DP.checkDataTypes=Ay;var IV={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?G._`{type: ${e}}`:G._`{type: ${t}}`};function Cy(e){let t=DV(e);TP.reportError(t,IV)}DP.reportTypeError=Cy;function DV(e){let{gen:t,data:n,schema:r}=e,s=Cf.schemaRefOrVal(e,r,"type");return{gen:t,keyword:"type",data:n,schema:r.type,schemaCode:s,schemaValue:s,parentSchema:r,params:{},it:e}}});var WP=q(function(VP){Object.defineProperty(VP,"__esModule",{value:!0});VP.assignDefaults=void 0;var In=ye(),LP=_e();function HV(e,t){let{properties:n,items:r}=e.schema;if(t==="object"&&n)for(let s in n)FP(e,s,n[s].default);else if(t==="array"&&Array.isArray(r))r.forEach((s,o)=>FP(e,o,s.default))}VP.assignDefaults=HV;function FP(e,t,n){let{gen:r,compositeRule:s,data:o,opts:i}=e;if(n===void 0)return;let a=In._`${o}${In.getProperty(t)}`;if(s){LP.checkStrictMode(e,`default is ignored for: ${a}`);return}let c=In._`${a} === undefined`;if(i.useDefaults==="empty")c=In._`${c} || ${a} === null || ${a} === ""`;r.if(c,In._`${a} = ${In.stringify(n)}`)}});var Dn=q(function(zP){Object.defineProperty(zP,"__esModule",{value:!0});zP.validateUnion=zP.validateArray=zP.usePattern=zP.callValidateCode=zP.schemaProperties=zP.allSchemaProperties=zP.noPropertyInData=zP.propertyInData=zP.isOwnProperty=zP.hasPropFunc=zP.reportMissingProp=zP.checkMissingProp=zP.checkReportMissingProp=void 0;var pe=ye(),Wi=_e(),Is=Jn(),HP=_e();function UV(e,t){let{gen:n,data:r,it:s}=e;n.if(Ny(n,r,t,s.opts.ownProperties),()=>{e.setParams({missingProperty:pe._`${t}`},!0),e.error()})}zP.checkReportMissingProp=UV;function BV({gen:e,data:t,it:{opts:n}},r,s){return pe.or(...r.map((o)=>pe.and(Ny(e,t,o,n.ownProperties),pe._`${s} = ${o}`)))}zP.checkMissingProp=BV;function zV(e,t){e.setParams({missingProperty:t},!0),e.error()}zP.reportMissingProp=zV;function UP(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:pe._`Object.prototype.hasOwnProperty`})}zP.hasPropFunc=UP;function Ry(e,t,n){return pe._`${UP(e)}.call(${t}, ${n})`}zP.isOwnProperty=Ry;function KV(e,t,n,r){let s=pe._`${t}${pe.getProperty(n)} !== undefined`;return r?pe._`${s} && ${Ry(e,t,n)}`:s}zP.propertyInData=KV;function Ny(e,t,n,r){let s=pe._`${t}${pe.getProperty(n)} === undefined`;return r?pe.or(s,pe.not(Ry(e,t,n))):s}zP.noPropertyInData=Ny;function BP(e){return e?Object.keys(e).filter((t)=>t!=="__proto__"):[]}zP.allSchemaProperties=BP;function GV(e,t){return BP(t).filter((n)=>!Wi.alwaysValidSchema(e,t[n]))}zP.schemaProperties=GV;function XV({schemaCode:e,data:t,it:{gen:n,topSchemaRef:r,schemaPath:s,errorPath:o},it:i},a,c,l){let u=l?pe._`${e}, ${t}, ${r}${s}`:t,d=[[Is.default.instancePath,pe.strConcat(Is.default.instancePath,o)],[Is.default.parentData,i.parentData],[Is.default.parentDataProperty,i.parentDataProperty],[Is.default.rootData,Is.default.rootData]];if(i.opts.dynamicRef)d.push([Is.default.dynamicAnchors,Is.default.dynamicAnchors]);let p=pe._`${u}, ${n.object(...d)}`;return c!==pe.nil?pe._`${a}.call(${c}, ${p})`:pe._`${a}(${p})`}zP.callValidateCode=XV;var YV=pe._`new RegExp`;function ZV({gen:e,it:{opts:t}},n){let r=t.unicodeRegExp?"u":"",{regExp:s}=t.code,o=s(n,r);return e.scopeValue("pattern",{key:o.toString(),ref:o,code:pe._`${s.code==="new RegExp"?YV:HP.useFunc(e,s)}(${n}, ${r})`})}zP.usePattern=ZV;function QV(e){let{gen:t,data:n,keyword:r,it:s}=e,o=t.name("valid");if(s.allErrors){let a=t.let("valid",!0);return i(()=>t.assign(a,!1)),a}return t.var(o,!0),i(()=>t.break()),o;function i(a){let c=t.const("len",pe._`${n}.length`);t.forRange("i",0,c,(l)=>{e.subschema({keyword:r,dataProp:l,dataPropType:Wi.Type.Num},o),t.if(pe.not(o),a)})}}zP.validateArray=QV;function eq(e){let{gen:t,schema:n,keyword:r,it:s}=e;if(!Array.isArray(n))throw Error("ajv implementation error");if(n.some((c)=>Wi.alwaysValidSchema(s,c))&&!s.opts.unevaluated)return;let i=t.let("valid",!1),a=t.name("_valid");t.block(()=>n.forEach((c,l)=>{let u=e.subschema({keyword:r,schemaProp:l,compositeRule:!0},a);if(t.assign(i,pe._`${i} || ${a}`),!e.mergeValidEvaluated(u,a))t.if(pe.not(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}zP.validateUnion=eq});var t_=q(function(QP){Object.defineProperty(QP,"__esModule",{value:!0});QP.validateKeywordUsage=QP.validSchemaType=QP.funcKeywordCode=QP.macroKeywordCode=void 0;var De=ye(),Io=Jn(),XP=Dn(),YP=Rc();function pq(e,t){let{gen:n,keyword:r,schema:s,parentSchema:o,it:i}=e,a=t.macro.call(i.self,s,o,i),c=ZP(n,r,a);if(i.opts.validateSchema!==!1)i.self.validateSchema(a,!0);let l=n.name("valid");e.subschema({schema:a,schemaPath:De.nil,errSchemaPath:`${i.errSchemaPath}/${r}`,topSchemaRef:c,compositeRule:!0},l),e.pass(l,()=>e.error(!0))}QP.macroKeywordCode=pq;function mq(e,t){var n;let{gen:r,keyword:s,schema:o,parentSchema:i,$data:a,it:c}=e;gq(c,t);let l=!a&&t.compile?t.compile.call(c.self,o,i,c):t.validate,u=ZP(r,s,l),d=r.let("valid");e.block$data(d,p),e.ok((n=t.valid)!==null&&n!==void 0?n:d);function p(){if(t.errors===!1){if(g(),t.modifying)GP(e);y(()=>e.error())}else{let S=t.async?m():x();if(t.modifying)GP(e);y(()=>hq(e,S))}}function m(){let S=r.let("ruleErrs",null);return r.try(()=>g(De._`await `),(E)=>r.assign(d,!1).if(De._`${E} instanceof ${c.ValidationError}`,()=>r.assign(S,De._`${E}.errors`),()=>r.throw(E))),S}function x(){let S=De._`${u}.errors`;return r.assign(S,null),g(De.nil),S}function g(S=t.async?De._`await `:De.nil){let E=c.opts.passContext?Io.default.this:Io.default.self,v=!(("compile"in t)&&!a||t.schema===!1);r.assign(d,De._`${S}${XP.callValidateCode(e,u,E,v)}`,t.modifying)}function y(S){var E;r.if(De.not((E=t.valid)!==null&&E!==void 0?E:d),S)}}QP.funcKeywordCode=mq;function GP(e){let{gen:t,data:n,it:r}=e;t.if(r.parentData,()=>t.assign(n,De._`${r.parentData}[${r.parentDataProperty}]`))}function hq(e,t){let{gen:n}=e;n.if(De._`Array.isArray(${t})`,()=>{n.assign(Io.default.vErrors,De._`${Io.default.vErrors} === null ? ${t} : ${Io.default.vErrors}.concat(${t})`).assign(Io.default.errors,De._`${Io.default.vErrors}.length`),YP.extendErrors(e)},()=>e.error())}function gq({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}function ZP(e,t,n){if(n===void 0)throw Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof n=="function"?{ref:n}:{ref:n,code:De.stringify(n)})}function yq(e,t,n=!1){return!t.length||t.some((r)=>r==="array"?Array.isArray(e):r==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==r||n&&typeof e>"u")}QP.validSchemaType=yq;function xq({schema:e,opts:t,self:n,errSchemaPath:r},s,o){if(Array.isArray(s.keyword)?!s.keyword.includes(o):s.keyword!==o)throw Error("ajv implementation error");let i=s.dependencies;if(i===null||i===void 0?void 0:i.some((a)=>!Object.prototype.hasOwnProperty.call(e,a)))throw Error(`parent schema must have dependencies of ${o}: ${i.join(",")}`);if(s.validateSchema){if(!s.validateSchema(e[o])){let c=`keyword "${o}" value is invalid at path "${r}": `+n.errorsText(s.validateSchema.errors);if(t.validateSchema==="log")n.logger.error(c);else throw Error(c)}}}QP.validateKeywordUsage=xq});var s_=q(function(n_){Object.defineProperty(n_,"__esModule",{value:!0});n_.extendSubschemaMode=n_.extendSubschemaData=n_.getSubschema=void 0;var wt=ye(),Rf=_e();function wq(e,{keyword:t,schemaProp:n,schema:r,schemaPath:s,errSchemaPath:o,topSchemaRef:i}){if(t!==void 0&&r!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let a=e.schema[t];return n===void 0?{schema:a,schemaPath:wt._`${e.schemaPath}${wt.getProperty(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[n],schemaPath:wt._`${e.schemaPath}${wt.getProperty(t)}${wt.getProperty(n)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${Rf.escapeFragment(n)}`}}if(r!==void 0){if(s===void 0||o===void 0||i===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:r,schemaPath:s,topSchemaRef:i,errSchemaPath:o}}throw Error('either "keyword" or "schema" must be passed')}n_.getSubschema=wq;function vq(e,t,{dataProp:n,dataPropType:r,data:s,dataTypes:o,propertyName:i}){if(s!==void 0&&n!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(n!==void 0){let{errorPath:l,dataPathArr:u,opts:d}=t,p=a.let("data",wt._`${t.data}${wt.getProperty(n)}`,!0);c(p),e.errorPath=wt.str`${l}${Rf.getErrorPath(n,r,d.jsPropertySyntax)}`,e.parentDataProperty=wt._`${n}`,e.dataPathArr=[...u,e.parentDataProperty]}if(s!==void 0){let l=s instanceof wt.Name?s:a.let("data",s,!0);if(c(l),i!==void 0)e.propertyName=i}if(o)e.dataTypes=o;function c(l){e.data=l,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,l]}}n_.extendSubschemaData=vq;function Eq(e,{jtdDiscriminator:t,jtdMetadata:n,compositeRule:r,createErrors:s,allErrors:o}){if(r!==void 0)e.compositeRule=r;if(s!==void 0)e.createErrors=s;if(o!==void 0)e.allErrors=o;e.jtdDiscriminator=t,e.jtdMetadata=n}n_.extendSubschemaMode=Eq});var Ty=q(function(ate,o_){o_.exports=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var r,s,o;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(s=r;s--!==0;)if(!e(t[s],n[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(o=Object.keys(t),r=o.length,r!==Object.keys(n).length)return!1;for(s=r;s--!==0;)if(!Object.prototype.hasOwnProperty.call(n,o[s]))return!1;for(s=r;s--!==0;){var i=o[s];if(!e(t[i],n[i]))return!1}return!0}return t!==t&&n!==n}});var a_=q(function(cte,i_){var Ds=i_.exports=function(e,t,n){if(typeof t=="function")n=t,t={};n=t.cb||n;var r=typeof n=="function"?n:n.pre||function(){},s=n.post||function(){};Nf(t,r,s,e,"",e)};Ds.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Ds.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Ds.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Ds.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function Nf(e,t,n,r,s,o,i,a,c,l){if(r&&typeof r=="object"&&!Array.isArray(r)){t(r,s,o,i,a,c,l);for(var u in r){var d=r[u];if(Array.isArray(d)){if(u in Ds.arrayKeywords)for(var p=0;p<d.length;p++)Nf(e,t,n,d[p],s+"/"+u+"/"+p,o,s,u,r,p)}else if(u in Ds.propsKeywords){if(d&&typeof d=="object")for(var m in d)Nf(e,t,n,d[m],s+"/"+u+"/"+_q(m),o,s,u,r,m)}else if(u in Ds.keywords||e.allKeys&&!(u in Ds.skipKeywords))Nf(e,t,n,d,s+"/"+u,o,s,u,r)}n(r,s,o,i,a,c,l)}}function _q(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Tc=q(function(d_){Object.defineProperty(d_,"__esModule",{value:!0});d_.getSchemaRefs=d_.resolveUrl=d_.normalizeId=d_._getFullPath=d_.getFullPath=d_.inlineRef=void 0;var c_=_e(),kq=Ty(),Oq=a_(),Aq=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function Cq(e,t=!0){if(typeof e=="boolean")return!0;if(t===!0)return!Jy(e);if(!t)return!1;return l_(e)<=t}d_.inlineRef=Cq;var Rq=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Jy(e){for(let t in e){if(Rq.has(t))return!0;let n=e[t];if(Array.isArray(n)&&n.some(Jy))return!0;if(typeof n=="object"&&Jy(n))return!0}return!1}function l_(e){let t=0;for(let n in e){if(n==="$ref")return 1/0;if(t++,Aq.has(n))continue;if(typeof e[n]=="object")c_.eachItem(e[n],(r)=>t+=l_(r));if(t===1/0)return 1/0}return t}function u_(e,t="",n){if(n!==!1)t=Hi(t);let r=e.parse(t);return f_(e,r)}d_.getFullPath=u_;function f_(e,t){return e.serialize(t).split("#")[0]+"#"}d_._getFullPath=f_;var Nq=/#\/?$/;function Hi(e){return e?e.replace(Nq,""):""}d_.normalizeId=Hi;function Tq(e,t,n){return n=Hi(n),e.resolve(t,n)}d_.resolveUrl=Tq;var Jq=/^[a-z_][-a-z0-9._]*$/i;function Iq(e,t){if(typeof e=="boolean")return{};let{schemaId:n,uriResolver:r}=this.opts,s=Hi(e[n]||t),o={"":s},i=u_(r,s,!1),a={},c=new Set;return Oq(e,{allKeys:!0},(d,p,m,x)=>{if(x===void 0)return;let g=i+p,y=o[x];if(typeof d[n]=="string")y=S.call(this,d[n]);E.call(this,d.$anchor),E.call(this,d.$dynamicAnchor),o[p]=y;function S(v){let j=this.opts.uriResolver.resolve;if(v=Hi(y?j(y,v):v),c.has(v))throw u(v);c.add(v);let P=this.refs[v];if(typeof P=="string")P=this.refs[P];if(typeof P=="object")l(d,P.schema,v);else if(v!==Hi(g))if(v[0]==="#")l(d,a[v],v),a[v]=d;else this.refs[v]=g;return v}function E(v){if(typeof v=="string"){if(!Jq.test(v))throw Error(`invalid anchor "${v}"`);S.call(this,`#${v}`)}}}),a;function l(d,p,m){if(p!==void 0&&!kq(d,p))throw u(m)}function u(d){return Error(`reference "${d}" resolves to more than one schema`)}}d_.getSchemaRefs=Iq});var zi=q(function(k_){Object.defineProperty(k_,"__esModule",{value:!0});k_.getData=k_.KeywordCxt=k_.validateFunctionCode=void 0;var Jf=jP(),Tf=Nc(),Bi=ky(),Ms=Nc(),y_=WP(),Sr=t_(),Ui=s_(),J=ye(),he=Jn(),x_=Tc(),Ct=_e(),$r=Rc();function qq(e){if(S_(e)){if(w_(e),$_(e)){Uq(e);return}}b_(e,()=>Jf.topBoolOrEmptySchema(e))}k_.validateFunctionCode=qq;function b_({gen:e,validateName:t,schema:n,schemaEnv:r,opts:s},o){if(s.code.es5)e.func(t,J._`${he.default.data}, ${he.default.valCxt}`,r.$async,()=>{e.code(J._`"use strict"; ${m_(n,s)}`),Hq(e,s),e.code(o)});else e.func(t,J._`${he.default.data}, ${Wq(s)}`,r.$async,()=>e.code(m_(n,s)).code(o))}function Wq(e){return J._`{${he.default.instancePath}="", ${he.default.parentData}, ${he.default.parentDataProperty}, ${he.default.rootData}=${he.default.data}${e.dynamicRef?J._`, ${he.default.dynamicAnchors}={}`:J.nil}}={}`}function Hq(e,t){e.if(he.default.valCxt,()=>{if(e.var(he.default.instancePath,J._`${he.default.valCxt}.${he.default.instancePath}`),e.var(he.default.parentData,J._`${he.default.valCxt}.${he.default.parentData}`),e.var(he.default.parentDataProperty,J._`${he.default.valCxt}.${he.default.parentDataProperty}`),e.var(he.default.rootData,J._`${he.default.valCxt}.${he.default.rootData}`),t.dynamicRef)e.var(he.default.dynamicAnchors,J._`${he.default.valCxt}.${he.default.dynamicAnchors}`)},()=>{if(e.var(he.default.instancePath,J._`""`),e.var(he.default.parentData,J._`undefined`),e.var(he.default.parentDataProperty,J._`undefined`),e.var(he.default.rootData,he.default.data),t.dynamicRef)e.var(he.default.dynamicAnchors,J._`{}`)})}function Uq(e){let{schema:t,opts:n,gen:r}=e;b_(e,()=>{if(n.$comment&&t.$comment)E_(e);if(Xq(e),r.let(he.default.vErrors,null),r.let(he.default.errors,0),n.unevaluated)Bq(e);v_(e),Qq(e)});return}function Bq(e){let{gen:t,validateName:n}=e;e.evaluated=t.const("evaluated",J._`${n}.evaluated`),t.if(J._`${e.evaluated}.dynamicProps`,()=>t.assign(J._`${e.evaluated}.props`,J._`undefined`)),t.if(J._`${e.evaluated}.dynamicItems`,()=>t.assign(J._`${e.evaluated}.items`,J._`undefined`))}function m_(e,t){let n=typeof e=="object"&&e[t.schemaId];return n&&(t.code.source||t.code.process)?J._`/*# sourceURL=${n} */`:J.nil}function zq(e,t){if(S_(e)){if(w_(e),$_(e)){Kq(e,t);return}}Jf.boolOrEmptySchema(e,t)}function $_({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let n in e)if(t.RULES.all[n])return!0;return!1}function S_(e){return typeof e.schema!="boolean"}function Kq(e,t){let{schema:n,gen:r,opts:s}=e;if(s.$comment&&n.$comment)E_(e);Yq(e),Zq(e);let o=r.const("_errs",he.default.errors);v_(e,o),r.var(t,J._`${o} === ${he.default.errors}`)}function w_(e){Ct.checkUnknownRules(e),Gq(e)}function v_(e,t){if(e.opts.jtd)return h_(e,[],!1,t);let n=Tf.getSchemaTypes(e.schema),r=Tf.coerceAndCheckDataType(e,n);h_(e,n,!r,t)}function Gq(e){let{schema:t,errSchemaPath:n,opts:r,self:s}=e;if(t.$ref&&r.ignoreKeywordsWithRef&&Ct.schemaHasRulesButRef(t,s.RULES))s.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}function Xq(e){let{schema:t,opts:n}=e;if(t.default!==void 0&&n.useDefaults&&n.strictSchema)Ct.checkStrictMode(e,"default is ignored in the schema root")}function Yq(e){let t=e.schema[e.opts.schemaId];if(t)e.baseId=x_.resolveUrl(e.opts.uriResolver,e.baseId,t)}function Zq(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function E_({gen:e,schemaEnv:t,schema:n,errSchemaPath:r,opts:s}){let o=n.$comment;if(s.$comment===!0)e.code(J._`${he.default.self}.logger.log(${o})`);else if(typeof s.$comment=="function"){let i=J.str`${r}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code(J._`${he.default.self}.opts.$comment(${o}, ${i}, ${a}.schema)`)}}function Qq(e){let{gen:t,schemaEnv:n,validateName:r,ValidationError:s,opts:o}=e;if(n.$async)t.if(J._`${he.default.errors} === 0`,()=>t.return(he.default.data),()=>t.throw(J._`new ${s}(${he.default.vErrors})`));else{if(t.assign(J._`${r}.errors`,he.default.vErrors),o.unevaluated)eW(e);t.return(J._`${he.default.errors} === 0`)}}function eW({gen:e,evaluated:t,props:n,items:r}){if(n instanceof J.Name)e.assign(J._`${t}.props`,n);if(r instanceof J.Name)e.assign(J._`${t}.items`,r)}function h_(e,t,n,r){let{gen:s,schema:o,data:i,allErrors:a,opts:c,self:l}=e,{RULES:u}=l;if(o.$ref&&(c.ignoreKeywordsWithRef||!Ct.schemaHasRulesButRef(o,u))){s.block(()=>P_(e,"$ref",u.all.$ref.definition));return}if(!c.jtd)tW(e,t);s.block(()=>{for(let p of u.rules)d(p);d(u.post)});function d(p){if(!Bi.shouldUseGroup(o,p))return;if(p.type){if(s.if(Ms.checkDataType(p.type,i,c.strictNumbers)),g_(e,p),t.length===1&&t[0]===p.type&&n)s.else(),Ms.reportTypeError(e);s.endIf()}else g_(e,p);if(!a)s.if(J._`${he.default.errors} === ${r||0}`)}}function g_(e,t){let{gen:n,schema:r,opts:{useDefaults:s}}=e;if(s)y_.assignDefaults(e,t.type);n.block(()=>{for(let o of t.rules)if(Bi.shouldUseRule(r,o))P_(e,o.keyword,o.definition,t.type)})}function tW(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;if(nW(e,t),!e.opts.allowUnionTypes)rW(e,t);sW(e,e.dataTypes)}function nW(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((n)=>{if(!j_(e.dataTypes,n))Iy(e,`type "${n}" not allowed by context "${e.dataTypes.join(",")}"`)}),iW(e,t)}function rW(e,t){if(t.length>1&&!(t.length===2&&t.includes("null")))Iy(e,"use allowUnionTypes to allow union type keyword")}function sW(e,t){let n=e.self.RULES.all;for(let r in n){let s=n[r];if(typeof s=="object"&&Bi.shouldUseRule(e.schema,s)){let{type:o}=s.definition;if(o.length&&!o.some((i)=>oW(t,i)))Iy(e,`missing type "${o.join(",")}" for keyword "${r}"`)}}}function oW(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function j_(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function iW(e,t){let n=[];for(let r of e.dataTypes)if(j_(t,r))n.push(r);else if(t.includes("integer")&&r==="number")n.push("integer");e.dataTypes=n}function Iy(e,t){let n=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${n}" (strictTypes)`,Ct.checkStrictMode(e,t,e.opts.strictTypes)}class Dy{constructor(e,t,n){if(Sr.validateKeywordUsage(e,t,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=Ct.schemaRefOrVal(e,this.schema,n,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",__(this.$data,e));else if(this.schemaCode=this.schemaValue,!Sr.validSchemaType(this.schema,t.schemaType,t.allowUndefined))throw Error(`${n} value must be ${JSON.stringify(t.schemaType)}`);if("code"in t?t.trackErrors:t.errors!==!1)this.errsCount=e.gen.const("_errs",he.default.errors)}result(e,t,n){this.failResult(J.not(e),t,n)}failResult(e,t,n){if(this.gen.if(e),n)n();else this.error();if(t){if(this.gen.else(),t(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(e,t){this.failResult(J.not(e),void 0,t)}fail(e){if(e===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(e),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail(J._`${t} !== undefined && (${J.or(this.invalid$data(),e)})`)}error(e,t,n){if(t){this.setParams(t),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,t){(e?$r.reportExtraError:$r.reportError)(this,this.def.error,t)}$dataError(){$r.reportError(this,this.def.$dataError||$r.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');$r.resetErrorsCount(this.gen,this.errsCount)}ok(e){if(!this.allErrors)this.gen.if(e)}setParams(e,t){if(t)Object.assign(this.params,e);else this.params=e}block$data(e,t,n=J.nil){this.gen.block(()=>{this.check$data(e,n),t()})}check$data(e=J.nil,t=J.nil){if(!this.$data)return;let{gen:n,schemaCode:r,schemaType:s,def:o}=this;if(n.if(J.or(J._`${r} === undefined`,t)),e!==J.nil)n.assign(e,!0);if(s.length||o.validateSchema){if(n.elseIf(this.invalid$data()),this.$dataError(),e!==J.nil)n.assign(e,!1)}n.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:n,def:r,it:s}=this;return J.or(o(),i());function o(){if(n.length){if(!(t instanceof J.Name))throw Error("ajv implementation error");let a=Array.isArray(n)?n:[n];return J._`${Ms.checkDataTypes(a,t,s.opts.strictNumbers,Ms.DataType.Wrong)}`}return J.nil}function i(){if(r.validateSchema){let a=e.scopeValue("validate$data",{ref:r.validateSchema});return J._`!${a}(${t})`}return J.nil}}subschema(e,t){let n=Ui.getSubschema(this.it,e);Ui.extendSubschemaData(n,this.it,e),Ui.extendSubschemaMode(n,e);let r={...this.it,...n,items:void 0,props:void 0};return zq(r,t),r}mergeEvaluated(e,t){let{it:n,gen:r}=this;if(!n.opts.unevaluated)return;if(n.props!==!0&&e.props!==void 0)n.props=Ct.mergeEvaluated.props(r,e.props,n.props,t);if(n.items!==!0&&e.items!==void 0)n.items=Ct.mergeEvaluated.items(r,e.items,n.items,t)}mergeValidEvaluated(e,t){let{it:n,gen:r}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return r.if(t,()=>this.mergeEvaluated(e,J.Name)),!0}}k_.KeywordCxt=Dy;function P_(e,t,n,r){let s=new Dy(e,n,t);if("code"in n)n.code(s,r);else if(s.$data&&n.validate)Sr.funcKeywordCode(s,n);else if("macro"in n)Sr.macroKeywordCode(s,n);else if(n.compile||n.validate)Sr.funcKeywordCode(s,n)}var aW=/^\/(?:[^~]|~0|~1)*$/,cW=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function __(e,{dataLevel:t,dataNames:n,dataPathArr:r}){let s,o;if(e==="")return he.default.rootData;if(e[0]==="/"){if(!aW.test(e))throw Error(`Invalid JSON-pointer: ${e}`);s=e,o=he.default.rootData}else{let l=cW.exec(e);if(!l)throw Error(`Invalid JSON-pointer: ${e}`);let u=+l[1];if(s=l[2],s==="#"){if(u>=t)throw Error(c("property/index",u));return r[t-u]}if(u>t)throw Error(c("data",u));if(o=n[t-u],!s)return o}let i=o,a=s.split("/");for(let l of a)if(l)o=J._`${o}${J.getProperty(Ct.unescapeJsonPointer(l))}`,i=J._`${i} && ${o}`;return i;function c(l,u){return`Cannot access ${l} ${u} levels up, current level is ${t}`}}k_.getData=__});var Jc=q(function(C_){Object.defineProperty(C_,"__esModule",{value:!0});class A_ extends Error{constructor(e){super("validation failed");this.errors=e,this.ajv=this.validation=!0}}C_.default=A_});var Gi=q(function(N_){Object.defineProperty(N_,"__esModule",{value:!0});var Ki=Tc();class R_ extends Error{constructor(e,t,n,r){super(r||`can't resolve reference ${n} from id ${t}`);this.missingRef=Ki.resolveUrl(e,t,n),this.missingSchema=Ki.normalizeId(Ki.getFullPath(e,this.missingRef))}}N_.default=R_});var Dc=q(function(I_){Object.defineProperty(I_,"__esModule",{value:!0});I_.resolveSchema=I_.getCompilingSchema=I_.resolveRef=I_.compileSchema=I_.SchemaEnv=void 0;var ct=ye(),pW=Jc(),Do=Jn(),lt=Tc(),If=_e(),T_=zi();class Ic{constructor(e){var t;this.refs={},this.dynamicAnchors={};let n;if(typeof e.schema=="object")n=e.schema;this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(t=e.baseId)!==null&&t!==void 0?t:lt.normalizeId(n===null||n===void 0?void 0:n[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n===null||n===void 0?void 0:n.$async,this.refs={}}}I_.SchemaEnv=Ic;function Fy(e){let t=J_.call(this,e);if(t)return t;let n=lt.getFullPath(this.opts.uriResolver,e.root.baseId),{es5:r,lines:s}=this.opts.code,{ownProperties:o}=this.opts,i=new ct.CodeGen(this.scope,{es5:r,lines:s,ownProperties:o}),a;if(e.$async)a=i.scopeValue("Error",{ref:pW.default,code:ct._`require("ajv/dist/runtime/validation_error").default`});let c=i.scopeName("validate");e.validateName=c;let l={gen:i,allErrors:this.opts.allErrors,data:Do.default.data,parentData:Do.default.parentData,parentDataProperty:Do.default.parentDataProperty,dataNames:[Do.default.data],dataPathArr:[ct.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:ct.stringify(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:n,baseId:e.baseId||n,schemaPath:ct.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:ct._`""`,opts:this.opts,self:this},u;try{this._compilations.add(e),T_.validateFunctionCode(l),i.optimize(this.opts.code.optimize);let d=i.toString();if(u=`${i.scopeRefs(Do.default.scope)}return ${d}`,this.opts.code.process)u=this.opts.code.process(u,e);let m=Function(`${Do.default.self}`,`${Do.default.scope}`,u)(this,this.scope.get());if(this.scope.value(c,{ref:m}),m.errors=null,m.schema=e.schema,m.schemaEnv=e,e.$async)m.$async=!0;if(this.opts.code.source===!0)m.source={validateName:c,validateCode:d,scopeValues:i._values};if(this.opts.unevaluated){let{props:x,items:g}=l;if(m.evaluated={props:x instanceof ct.Name?void 0:x,items:g instanceof ct.Name?void 0:g,dynamicProps:x instanceof ct.Name,dynamicItems:g instanceof ct.Name},m.source)m.source.evaluated=ct.stringify(m.evaluated)}return e.validate=m,e}catch(d){if(delete e.validate,delete e.validateName,u)this.logger.error("Error compiling schema, function code:",u);throw d}finally{this._compilations.delete(e)}}I_.compileSchema=Fy;function mW(e,t,n){var r;n=lt.resolveUrl(this.opts.uriResolver,t,n);let s=e.refs[n];if(s)return s;let o=yW.call(this,e,n);if(o===void 0){let i=(r=e.localRefs)===null||r===void 0?void 0:r[n],{schemaId:a}=this.opts;if(i)o=new Ic({schema:i,schemaId:a,root:e,baseId:t})}if(o===void 0)return;return e.refs[n]=hW.call(this,o)}I_.resolveRef=mW;function hW(e){if(lt.inlineRef(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:Fy.call(this,e)}function J_(e){for(let t of this._compilations)if(gW(t,e))return t}I_.getCompilingSchema=J_;function gW(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function yW(e,t){let n;while(typeof(n=this.refs[t])=="string")t=n;return n||this.schemas[t]||Df.call(this,e,t)}function Df(e,t){let n=this.opts.uriResolver.parse(t),r=lt._getFullPath(this.opts.uriResolver,n),s=lt.getFullPath(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&r===s)return My.call(this,n,e);let o=lt.normalizeId(r),i=this.refs[o]||this.schemas[o];if(typeof i=="string"){let a=Df.call(this,e,i);if(typeof(a===null||a===void 0?void 0:a.schema)!=="object")return;return My.call(this,n,a)}if(typeof(i===null||i===void 0?void 0:i.schema)!=="object")return;if(!i.validate)Fy.call(this,i);if(o===lt.normalizeId(t)){let{schema:a}=i,{schemaId:c}=this.opts,l=a[c];if(l)s=lt.resolveUrl(this.opts.uriResolver,s,l);return new Ic({schema:a,schemaId:c,root:e,baseId:s})}return My.call(this,n,i)}I_.resolveSchema=Df;var xW=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function My(e,{baseId:t,schema:n,root:r}){var s;if(((s=e.fragment)===null||s===void 0?void 0:s[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof n==="boolean")return;let c=n[If.unescapeFragment(a)];if(c===void 0)return;n=c;let l=typeof n==="object"&&n[this.opts.schemaId];if(!xW.has(a)&&l)t=lt.resolveUrl(this.opts.uriResolver,t,l)}let o;if(typeof n!="boolean"&&n.$ref&&!If.schemaHasRulesButRef(n,this.RULES)){let a=lt.resolveUrl(this.opts.uriResolver,t,n.$ref);o=Df.call(this,r,a)}let{schemaId:i}=this.opts;if(o=o||new Ic({schema:n,schemaId:i,root:r,baseId:t}),o.schema!==o.root.schema)return o;return}});var M_=q(function(mte,vW){vW.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var Uy=q(function(hte,B_){var EW=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Vy=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),jW=RegExp.prototype.test.bind(/^\d*$/u),Mo=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),qy=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),L_=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),Wy=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),PW=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),cn=Array(256);for(let t=0;t<256;t++)cn[t]="%"+"0123456789ABCDEF"[t>>4]+"0123456789ABCDEF"[t&15];function Ht(e){if(e<2048)return cn[192|e>>6]+cn[128|e&63];if(e<65536)return cn[224|e>>12]+cn[128|e>>6&63]+cn[128|e&63];return cn[240|e>>18]+cn[128|e>>12&63]+cn[128|e>>6&63]+cn[128|e&63]}function _W(e){let t="",n=0,r=0;for(r=0;r<e.length;r++){if(n=e[r].charCodeAt(0),n===48)continue;if(!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return"";t+=e[r];break}for(r+=1;r<e.length;r++){if(n=e[r].charCodeAt(0),!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return"";t+=e[r]}return t}var kW=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),OW=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),AW=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),CW=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function RW(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++){if(AW(e[t]))continue;if(e[t]==="%"&&t+2<e.length&&Mo(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function F_(e){let t=-1,n=0,r=-1,s=0;for(let a=0;a<e.length;a++)if(e[a]==="0"){if(r===-1)r=a;if(s++,s>n)n=s,t=r}else r=-1,s=0;if(n<2)return e.join(":");let o=e.slice(0,t).join(":"),i=e.slice(t+n).join(":");return o+"::"+i}function NW(e){let t=e.indexOf("::");if(t!==-1&&e.indexOf("::",t+1)!==-1)return;let n=t===-1?e.split(":"):e.slice(0,t).split(":"),r=t===-1?[]:e.slice(t+2).split(":");if(t!==-1){if(n.length===1&&n[0]==="")n.length=0;if(r.length===1&&r[0]==="")r.length=0}let s=n.concat(r),o=0;for(let a=0;a<s.length;a++){let c=s[a];if(c==="")return;if(c.indexOf(".")!==-1){if(a!==s.length-1||t!==-1&&r.length===0||!Vy(c))return;o+=2;continue}if(!kW(c))return;s[a]=parseInt(c,16).toString(16),o++}if(t===-1){if(o!==8)return;return F_(s)}if(o>=8)return;let i=s.slice(0,n.length);for(let a=o;a<8;a++)i.push("0");for(let a=n.length;a<s.length;a++)i.push(s[a]);return F_(i)}function Ly(e){let t=e[0]==="["&&e[e.length-1]==="]";if((e[0]==="["||e[e.length-1]==="]")&&!t)return{host:e,isIPV6:!1,error:!0};let r=t?e.slice(1,-1):e;if(t&&OW(r))return r=r.toLowerCase(),{host:`[${r}]`,escapedHost:r,isIPV6:!1,isIPVFuture:!0};if(TW(r,":")<2)return{host:e,isIPV6:!1,error:t};let s="",o=r.indexOf("%");if(o!==-1){let a=r.slice(o,o+3).toLowerCase()==="%25"?3:1;if(s=r.slice(o+a),!RW(s))return{host:e,isIPV6:!1,error:!0};r=r.slice(0,o)}let i=NW(r);if(i===void 0)return{host:e,isIPV6:!1,error:!0};return{host:i+(s?"%"+s:""),escapedHost:i+(s?"%25"+s:""),isIPV6:!0}}function TW(e,t){let n=0;for(let r=0;r<e.length;r++)if(e[r]===t)n++;return n}function V_(e){let t=e,n=[],r=-1,s=0;while(s=t.length){if(s===1)if(t===".")break;else if(t==="/"){n.push("/");break}else{n.push(t);break}else if(s===2){if(t[0]==="."){if(t[1]===".")break;else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."||t[1]==="/"){n.push("/");break}}}else if(s===3){if(t==="/.."){if(n.length!==0)n.pop();n.push("/");break}}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."){if(t[3]==="/"){if(t=t.slice(3),n.length!==0)n.pop();continue}}}}if((r=t.indexOf("/",1))===-1){n.push(t);break}else n.push(t.slice(0,r)),t=t.slice(r)}return n.join("")}function JW(e){if(e===""||e[0]==="/")return V_(e);let t=e.split("/"),n=t.length-1,r=[],s=!1;for(let o=0;o<=n;o++){let i=t[o];if(i==="."||i===".."){if(i==="..")if(r.length!==0&&r[r.length-1]!=="..")r.pop();else r.push("..");s=o===n}else r.push(i)}if(s&&r[r.length-1]!=="..")r.push("");if(r.length===0||r[0]===""||r[0].includes(":"))r.unshift(".");return r.join("/")}var IW={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},DW=/[@/?#:]/g,MW=/[@/?#]/g;function q_(e,t){let n=t?MW:DW;return n.lastIndex=0,e.replace(n,(r)=>IW[r])}function W_(e,t=!1){if(e.indexOf("%")===-1)return e;let n="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let s=e.slice(r+1,r+3);if(Mo(s)){let o=s.toUpperCase(),i=String.fromCharCode(parseInt(o,16));if(t&&qy(i))n+=i;else n+="%"+o;r+=2;continue}}n+=e[r]}return n}function FW(e){let t="";for(let n=0;n<e.length;n++){let r=e[n];if(r==="%"&&n+2<e.length){let s=e.slice(n+1,n+3);if(Mo(s)){let o=s.toUpperCase(),i=String.fromCharCode(parseInt(o,16));if(i!=="."&&qy(i))t+=i;else t+="%"+o;n+=2;continue}}if(L_(r))t+=r;else{let s=e.charCodeAt(n);if(s<128)t+=U_(s)?r:cn[s];else if(s<55296||s>57343)t+=Ht(s);else if(s<=56319&&n+1<e.length){let o=e.charCodeAt(n+1);if(o>=56320&&o<=57343)t+=Ht(65536+(s-55296<<10)+(o-56320)),n++;else t+=Ht(65533)}else t+=Ht(65533)}}return t}function LW(e,t=!1){let n="",r=t&&e[0]!=="/";for(let s=0;s<e.length;s++){let o=e[s];if(o==="%"&&s+2<e.length){let i=e.slice(s+1,s+3);if(Mo(i)){n+="%"+i.toUpperCase(),s+=2;continue}}if(o==="/")r=!1;if(L_(o)&&(o!==":"||!r))n+=o;else{let i=e.charCodeAt(s);if(i<128)n+=cn[i];else if(i<55296||i>57343)n+=Ht(i);else if(i<=56319&&s+1<e.length){let a=e.charCodeAt(s+1);if(a>=56320&&a<=57343)n+=Ht(65536+(i-55296<<10)+(a-56320)),s++;else n+=Ht(65533)}else n+=Ht(65533)}}return n}function Hy(e,t){let n="";for(let r=0;r<e.length;r++){let s=e[r];if(s==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(Mo(o)){n+="%"+o.toUpperCase(),r+=2;continue}}if(t(s))n+=s;else{let o=e.charCodeAt(r);if(o<128)n+=cn[o];else if(o<55296||o>57343)n+=Ht(o);else if(o<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);if(i>=56320&&i<=57343)n+=Ht(65536+(o-55296<<10)+(i-56320)),r++;else n+=Ht(65533)}else n+=Ht(65533)}}return n}function H_(e){return Hy(e,PW)}function VW(e){return Hy(e,Wy)}function qW(e){return Hy(e,Wy)}function U_(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===42||e===43||e===45||e===46||e===47||e===64||e===95}function WW(e){let t="";for(let n=0;n<e.length;n++){let r=e[n];if(r==="%"&&n+2<e.length){let s=e.slice(n+1,n+3);if(Mo(s)){let o=s.toUpperCase(),i=String.fromCharCode(parseInt(o,16));if(qy(i))t+=i;else t+="%"+o;n+=2;continue}}if(Wy(r))t+=r;else{let s=e.charCodeAt(n);if(s<128)t+=U_(s)?r:cn[s];else if(s<55296||s>57343)t+=Ht(s);else if(s<=56319&&n+1<e.length){let o=e.charCodeAt(n+1);if(o>=56320&&o<=57343)t+=Ht(65536+(s-55296<<10)+(o-56320)),n++;else t+=Ht(65533)}else t+=Ht(65533)}}return t}function HW(e){let t="";for(let n=0;n<e.length;n++){if(e[n]==="%"&&n+2<e.length){let r=e.slice(n+1,n+3);if(Mo(r)){t+="%"+r.toUpperCase(),n+=2;continue}}t+=escape(e[n])}return t}function UW(e){let t=[];if(e.userinfo!==void 0)t.push(H_(e.userinfo)),t.push("@");if(e.host!==void 0){let n=e.host;if(!Vy(n)){let r=Ly(n);if(r.isIPV6!==!0&&r.isIPVFuture!==!0)n=W_(n,!0),r=Ly(n);if(r.isIPV6===!0||r.isIPVFuture===!0)n=`[${r.escapedHost}]`;else n=q_(n,!1)}t.push(n)}if(typeof e.port==="number"||typeof e.port==="string"){let n=String(e.port);if(!jW(n))throw TypeError("URI port is malformed.");t.push(":"),t.push(n)}return t.length?t.join(""):void 0}B_.exports={nonSimpleDomain:CW,recomposeAuthority:UW,reescapeHostDelimiters:q_,normalizePercentEncoding:W_,normalizePathEncoding:FW,serializePathEncoding:LW,normalizeQueryFragmentEncoding:WW,encodeUserinfo:H_,encodeQuery:VW,encodeFragment:qW,escapePreservingEscapes:HW,removeDotSegments:V_,removeDotSegmentsRelative:JW,isIPv4:Vy,isUUID:EW,normalizeIPv6:Ly,stringArrayToHexStripped:_W}});var Y_=q(function(gte,X_){var{isUUID:BW}=Uy(),zW=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,KW=["http","https","ws","wss","urn","urn:uuid"];function GW(e){return KW.indexOf(e)!==-1}function By(e){if(e.secure===!0)return!0;else if(e.secure===!1)return!1;else if(e.scheme)return e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S");else return!1}function z_(e){if(!e.host)e.error=e.error||"HTTP URIs must have a host.";return e}function K_(e){let t=String(e.scheme).toLowerCase()==="https";if(e.port===(t?443:80)||e.port==="")e.port=void 0;if(!e.path)e.path="/";return e}function XW(e){return e.secure=By(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function YW(e){if(e.port===(By(e)?443:80)||e.port==="")e.port=void 0;if(typeof e.secure==="boolean")e.scheme=e.secure?"wss":"ws",e.secure=void 0;if(e.resourceName){let t=e.resourceName.indexOf("?"),n=t===-1?e.resourceName:e.resourceName.slice(0,t);e.path=n&&n!=="/"?n:void 0,e.query=t===-1?void 0:e.resourceName.slice(t+1),e.resourceName=void 0}return e.fragment=void 0,e}function ZW(e,t){if(!e.path)return e.error="URN can not be parsed",e;let n=e.path.match(zW);if(n&&n[0]===e.path){let r=t.scheme||e.scheme||"urn";e.nid=n[1].toLowerCase(),e.nss=n[2];let s=`${r}:${t.nid||e.nid}`,o=zy(s);if(e.path=void 0,o)e=o.parse(e,t)}else e.error=e.error||"URN can not be parsed.";return e}function QW(e,t){if(e.nid===void 0)throw Error("URN without nid cannot be serialized");let n=t.scheme||e.scheme||"urn",r=e.nid.toLowerCase(),s=`${n}:${t.nid||r}`,o=zy(s);if(o)e=o.serialize(e,t);let i=e,a=e.nss;return i.path=`${r||t.nid}:${a}`,t.skipEscape=!0,i}function eH(e,t){let n=e;if(n.uuid=n.nss,n.nss=void 0,!t.tolerant&&(!n.uuid||!BW(n.uuid)))n.error=n.error||"UUID is not valid.";return n}function tH(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var G_={scheme:"http",domainHost:!0,parse:z_,serialize:K_},nH={scheme:"https",domainHost:G_.domainHost,parse:z_,serialize:K_},Mf={scheme:"ws",domainHost:!0,parse:XW,serialize:YW},rH={scheme:"wss",domainHost:Mf.domainHost,parse:Mf.parse,serialize:Mf.serialize},sH={scheme:"urn",parse:ZW,serialize:QW,skipNormalize:!0},oH={scheme:"urn:uuid",parse:eH,serialize:tH,skipNormalize:!0},Ff={http:G_,https:nH,ws:Mf,wss:rH,urn:sH,"urn:uuid":oH};Object.setPrototypeOf(Ff,null);function zy(e){return e&&(Ff[e]||Ff[e.toLowerCase()])||void 0}X_.exports={wsIsSecure:By,SCHEMES:Ff,isValidSchemeName:GW,getSchemeHandler:zy}});var fk=q(function(yte,Wf){var{normalizeIPv6:nk,removeDotSegments:Fc,removeDotSegmentsRelative:rk,recomposeAuthority:iH,normalizePercentEncoding:Ky,normalizePathEncoding:aH,serializePathEncoding:Z_,normalizeQueryFragmentEncoding:Q_,encodeQuery:cH,encodeFragment:lH,reescapeHostDelimiters:uH,isIPv4:sk,nonSimpleDomain:fH}=Uy(),{SCHEMES:ok,getSchemeHandler:Gy}=Y_(),ik=/^[A-Za-z][A-Za-z0-9+.-]*$/u,dH=/[\0-\x20"#/:<>?@[\\\]^`{|}\x7F]/u;function ek(e){let t=String(e);if(!ik.test(t))throw TypeError("URI scheme is malformed.");return t}function pH(e,t){if(typeof e==="string")e=wH(e,t);else if(typeof e==="object")e=Vf(Fo(e,t),t);return e}function mH(e,t,n){let r=n?Object.assign({scheme:"null"},n):{scheme:"null"},{parsed:s,malformedAuthorityOrPort:o,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:c,malformedScheme:l}=Lf(e,r),{parsed:u,malformedAuthorityOrPort:d,malformedPercentEncoding:p,malformedSchemeSpecific:m,malformedHost:x,malformedScheme:g}=Lf(t,r);if(o||d||i||p||a||m||c||x||l||g)throw Error(s.error||u.error||"URI is malformed.");let y=ak(s,u,r,!0),S=Gy(n&&n.scheme||y.scheme),E=y.host,v=E!==void 0&&E!==""&&(sk(E)||nk(E).isIPV6);if(lk(y,n||{},S,v))throw Error("URI host is malformed.");ck(y,n||{},S,v);let j=E&&E.indexOf("%")!==-1&&!/\P{ASCII}/u.test(E);if(y.error&&!j)throw Error(y.error);return r.skipEscape=!0,Fo(y,r)}function ak(e,t,n,r){let s={};if(!r)e=Vf(Fo(e,n),n),t=Vf(Fo(t,n),n);if(n=n||{},!n.tolerant&&t.scheme)s.scheme=t.scheme,s.userinfo=t.userinfo,s.host=t.host,s.port=t.port,s.path=Fc(t.path||""),s.query=t.query;else{if(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)s.userinfo=t.userinfo,s.host=t.host,s.port=t.port,s.path=Fc(t.path||""),s.query=t.query;else{if(!t.path)if(s.path=e.path,t.query!==void 0)s.query=t.query;else s.query=e.query;else{if(t.path[0]==="/")s.path=Fc(t.path);else{let o=e.userinfo!==void 0||e.host!==void 0||e.port!==void 0;if(o&&!e.path)s.path="/"+t.path;else if(!e.path)s.path=t.path;else s.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path;s.path=e.scheme===void 0&&!o&&s.path[0]!=="/"?rk(s.path):Fc(s.path)}s.query=t.query}s.userinfo=e.userinfo,s.host=e.host,s.port=e.port}s.scheme=e.scheme}return s.fragment=t.fragment,s}function hH(e,t,n){let r=tk(e,n),s=tk(t,n);return r!==void 0&&s!==void 0&&r===s}function Fo(e,t){let n={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},r=Object.assign({},t),s=[];if(n.scheme)n.scheme=ek(n.scheme);let o=Gy(r.scheme||n.scheme);if(o&&o.serialize)o.serialize(n,r);let i=n.userinfo!==void 0||n.host!==void 0||n.port!==void 0,a=(n.scheme===void 0||r.reference==="suffix")&&!i,c=!r.skipEscape&&a;if(n.path!==void 0)if(!r.skipEscape)n.path=Z_(n.path,c);else n.path=Ky(n.path);if(r.reference!=="suffix"&&n.scheme)n.scheme=ek(n.scheme),s.push(n.scheme,":");let l=iH(n);if(l!==void 0){if(r.reference!=="suffix")s.push("//");if(s.push(l),n.path&&n.path[0]!=="/")s.push("/")}if(n.path!==void 0){let u=n.path;if(!r.absolutePath&&(!o||!o.absolutePath))u=a&&u[0]!=="/"?rk(u):Fc(u);if(a)u=Z_(u,!0);if(l===void 0&&u[0]==="/"&&u[1]==="/")u="/%2F"+u.slice(2);s.push(u)}if(n.query!==void 0)s.push("?",cH(n.query));if(n.fragment!==void 0)s.push("#",lH(n.fragment));return s.join("")}var gH=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,yH=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,xH=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function bH(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof e.port==="number"&&(e.port<0||e.port>65535))return"URI port is malformed.";return}function Mc(e){if(e===void 0)return!1;let t=e.indexOf("%");while(t!==-1){if(t+2>=e.length||!/^[\da-f]{2}$/iu.test(e.slice(t+1,t+3)))return!0;t=e.indexOf("%",t+3)}return!1}function qf(e){return e[0]==="["&&e[e.length-1]==="]"}function $H(e){let t=e[4];return Mc(e[3])||t!==void 0&&!qf(t)&&Mc(t)||Mc(e[6])||Mc(e[7])||Mc(e[8])}function ck(e,t,n,r){if(lk(e,t,n,r))return e.error=e.error||"URI host is malformed.",!0;if(!t.unicodeSupport&&(!n||!n.unicodeSupport)&&e.host&&!qf(e.host)&&(t.domainHost||n&&n.domainHost)&&r===!1&&fH(e.host)){let s;try{s=new URL("http://"+e.host)}catch(o){return e.error=e.error||"Host's domain name can not be converted to ASCII: "+o,!0}if(!SH(s))return e.error=e.error||"URI host is malformed.",!0;e.host=s.hostname}return!1}function lk(e,t,n,r){return Boolean(e.host&&r===!1&&!qf(e.host)&&(t.domainHost||n&&n.domainHost)&&dH.test(e.host))}function SH(e){return e.username===""&&e.password===""&&e.port===""&&e.pathname==="/"&&e.search===""&&e.hash===""&&e.hostname!==""}function Lf(e,t){let n=Object.assign({},t),r={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},s=!1,o=!1,i=!1,a=!1,c=!1,l=!1,u=!1;if(n.reference==="suffix")if(n.scheme)e=n.scheme+":"+e;else e="//"+e;let d=e.match(yH);if(d!==null&&d[1].indexOf("\\")!==-1)r.error="URI authority must not contain a literal backslash.",s=!0;let p=e.match(xH);if(p!==null){let x=p[1],g=x.replace(/[\t\n\r]/g,"");if(g.length>=2){if(g.slice(0,2)!=="//")r.error=r.error||"URI authority must not contain a literal backslash.",s=!0;else if(x.length!==g.length)r.error=r.error||"URI authority introducer must not contain whitespace.",s=!0}}let m=e.match(gH);if(m){if(r.scheme=m[1],r.userinfo=m[3],r.host=m[4],r.port=parseInt(m[5],10),r.path=m[6]||"",r.query=m[7],r.fragment=m[8],r.scheme!==void 0)if(ik.test(r.scheme))r.scheme=r.scheme.toLowerCase();else r.error=r.error||"URI scheme is malformed.",l=!0;if(o=$H(m),o)r.error=r.error||"URI contains malformed percent-encoding.";if(isNaN(r.port))r.port=m[5];let x=bH(r,m);if(x!==void 0)r.error=r.error||x,s=!0;if(r.host)if(sk(r.host)===!1){let S=qf(r.host),E=r.host.indexOf("[")!==-1||r.host.indexOf("]")!==-1,v=nk(r.host);if(u=v.isIPV6||v.isIPVFuture===!0,c=E&&(!S||v.error===!0),r.host=u?v.host:v.host.toLowerCase(),c)r.error=r.error||"URI host is malformed.",s=!0}else u=!0;if(r.scheme===void 0&&r.userinfo===void 0&&r.host===void 0&&r.port===void 0&&r.query===void 0&&!r.path)r.reference="same-document";else if(r.scheme===void 0)r.reference="relative";else if(r.fragment===void 0)r.reference="absolute";else r.reference="uri";if(n.reference&&n.reference!=="suffix"&&n.reference!==r.reference)r.error=r.error||"URI is not a "+n.reference+" reference.";let g=Gy(n.scheme||r.scheme);if(!c)a=ck(r,n,g,u);if(e.indexOf("%")!==-1&&r.host!==void 0&&!c){let y=u?r.host:Ky(r.host,!0);if(!u)y=Ky(y.toLowerCase());r.host=u||n.scheme!=="null"?uH(y,u):y}if(!g||g&&!g.skipNormalize){if(r.path)r.path=aH(r.path);if(r.query)r.query=Q_(r.query);if(r.fragment)r.fragment=Q_(r.fragment)}if(g&&g.parse){if(g.parse(r,n),g===ok.urn&&r.nid===void 0)i=!0}}else r.error=r.error||"URI can not be parsed.";return{parsed:r,malformedAuthorityOrPort:s,malformedPercentEncoding:o,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:l}}function Vf(e,t){return Lf(e,t).parsed}function wH(e,t){return uk(e,t).normalized}function uk(e,t){let{parsed:n,malformedAuthorityOrPort:r,malformedPercentEncoding:s,malformedSchemeSpecific:o,malformedHost:i,malformedScheme:a}=Lf(e,t);return{normalized:r||s||o||i||a?e:Fo(n,t),malformedAuthorityOrPort:r,malformedPercentEncoding:s,malformedSchemeSpecific:o,malformedHost:i,malformedScheme:a}}function tk(e,t){if(typeof e!=="string"&&typeof e!=="object")return;let n;try{n=typeof e==="string"?e:Fo(e,t)}catch{return}let{normalized:r,malformedAuthorityOrPort:s,malformedPercentEncoding:o,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:c}=uk(n,t);return s||o||i||a||c?void 0:r}var Xy={SCHEMES:ok,normalize:pH,resolve:mH,resolveComponent:ak,equal:hH,serialize:Fo,parse:Vf};Wf.exports=Xy;Wf.exports.default=Xy;Wf.exports.fastUri=Xy});var mk=q(function(pk){Object.defineProperty(pk,"__esModule",{value:!0});var dk=fk();dk.code='require("ajv/dist/runtime/uri").default';pk.default=dk});var Zy=q(function(ts){Object.defineProperty(ts,"__esModule",{value:!0});ts.CodeGen=ts.Name=ts.nil=ts.stringify=ts.str=ts._=ts.KeywordCxt=void 0;var EH=zi();Object.defineProperty(ts,"KeywordCxt",{enumerable:!0,get:function(){return EH.KeywordCxt}});var Yi=ye();Object.defineProperty(ts,"_",{enumerable:!0,get:function(){return Yi._}});Object.defineProperty(ts,"str",{enumerable:!0,get:function(){return Yi.str}});Object.defineProperty(ts,"stringify",{enumerable:!0,get:function(){return Yi.stringify}});Object.defineProperty(ts,"nil",{enumerable:!0,get:function(){return Yi.nil}});Object.defineProperty(ts,"Name",{enumerable:!0,get:function(){return Yi.Name}});Object.defineProperty(ts,"CodeGen",{enumerable:!0,get:function(){return Yi.CodeGen}});var jH=Jc(),bk=Gi(),$k=_y(),wr=Dc(),Sk=ye(),vr=Tc(),Fs=Nc(),Xi=_e(),hk=M_(),PH=mk(),wk=(e,t)=>new RegExp(e,t);wk.code="new RegExp";var _H=["removeAdditional","useDefaults","coerceTypes"],kH=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),OH={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},AH={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},gk=200;function CH(e){var t,n,r,s,o,i,a,c,l,u,d,p,m,x,g,y,S,E,v,j,P,O,T,U,F;let H=e.strict,A=(t=e.code)===null||t===void 0?void 0:t.optimize,N=A===!0||A===void 0?1:A||0,B=(r=(n=e.code)===null||n===void 0?void 0:n.regExp)!==null&&r!==void 0?r:wk,M=(s=e.uriResolver)!==null&&s!==void 0?s:PH.default;return{strictSchema:(i=(o=e.strictSchema)!==null&&o!==void 0?o:H)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=e.strictNumbers)!==null&&a!==void 0?a:H)!==null&&c!==void 0?c:!0,strictTypes:(u=(l=e.strictTypes)!==null&&l!==void 0?l:H)!==null&&u!==void 0?u:"log",strictTuples:(p=(d=e.strictTuples)!==null&&d!==void 0?d:H)!==null&&p!==void 0?p:"log",strictRequired:(x=(m=e.strictRequired)!==null&&m!==void 0?m:H)!==null&&x!==void 0?x:!1,code:e.code?{...e.code,optimize:N,regExp:B}:{optimize:N,regExp:B},loopRequired:(g=e.loopRequired)!==null&&g!==void 0?g:gk,loopEnum:(y=e.loopEnum)!==null&&y!==void 0?y:gk,meta:(S=e.meta)!==null&&S!==void 0?S:!0,messages:(E=e.messages)!==null&&E!==void 0?E:!0,inlineRefs:(v=e.inlineRefs)!==null&&v!==void 0?v:!0,schemaId:(j=e.schemaId)!==null&&j!==void 0?j:"$id",addUsedSchema:(P=e.addUsedSchema)!==null&&P!==void 0?P:!0,validateSchema:(O=e.validateSchema)!==null&&O!==void 0?O:!0,validateFormats:(T=e.validateFormats)!==null&&T!==void 0?T:!0,unicodeRegExp:(U=e.unicodeRegExp)!==null&&U!==void 0?U:!0,int32range:(F=e.int32range)!==null&&F!==void 0?F:!0,uriResolver:M}}class Hf{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...CH(e)};let{es5:t,lines:n}=this.opts.code;this.scope=new Sk.ValueScope({scope:{},prefixes:kH,es5:t,lines:n}),this.logger=DH(e.logger);let r=e.validateFormats;if(e.validateFormats=!1,this.RULES=$k.getRules(),yk.call(this,OH,e,"NOT SUPPORTED"),yk.call(this,AH,e,"DEPRECATED","warn"),this._metaOpts=JH.call(this),e.formats)NH.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords)TH.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);RH.call(this),e.validateFormats=r}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:n}=this.opts,r=hk;if(n==="id")r={...hk},r.id=r.$id,delete r.$id;if(t&&e)this.addMetaSchema(r,r[n],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[t]||e:void 0}validate(e,t){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let r=n(t);if(!("$async"in n))this.errors=n.errors;return r}compile(e,t){let n=this._addSchema(e,t);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,t){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return r.call(this,e,t);async function r(l,u){await s.call(this,l.$schema);let d=this._addSchema(l,u);return d.validate||o.call(this,d)}async function s(l){if(l&&!this.getSchema(l))await r.call(this,{$ref:l},!0)}async function o(l){try{return this._compileSchemaEnv(l)}catch(u){if(!(u instanceof bk.default))throw u;return i.call(this,u),await a.call(this,u.missingSchema),o.call(this,l)}}function i({missingSchema:l,missingRef:u}){if(this.refs[l])throw Error(`AnySchema ${l} is loaded but ${u} cannot be resolved`)}async function a(l){let u=await c.call(this,l);if(!this.refs[l])await s.call(this,u.$schema);if(!this.refs[l])this.addSchema(u,l,t)}async function c(l){let u=this._loading[l];if(u)return u;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l]}}}addSchema(e,t,n,r=this.opts.validateSchema){if(Array.isArray(e)){for(let o of e)this.addSchema(o,void 0,n,r);return this}let s;if(typeof e==="object"){let{schemaId:o}=this.opts;if(s=e[o],s!==void 0&&typeof s!="string")throw Error(`schema ${o} must be string`)}return t=vr.normalizeId(t||s),this._checkUnique(t),this.schemas[t]=this._addSchema(e,n,t,r,!0),this}addMetaSchema(e,t,n=this.opts.validateSchema){return this.addSchema(e,t,!0,n),this}validateSchema(e,t){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let r=this.validate(n,e);if(!r&&t){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw Error(s)}return r}getSchema(e){let t;while(typeof(t=xk.call(this,e))=="string")e=t;if(t===void 0){let{schemaId:n}=this.opts,r=new wr.SchemaEnv({schema:{},schemaId:n});if(t=wr.resolveSchema.call(this,r,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let t=xk.call(this,e);if(typeof t=="object")this._cache.delete(t.schema);return delete this.schemas[e],delete this.refs[e],this}case"object":{let t=e;this._cache.delete(t);let n=e[this.opts.schemaId];if(n)n=vr.normalizeId(n),delete this.schemas[n],delete this.refs[n];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let n;if(typeof e=="string"){if(n=e,typeof t=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=n}else if(typeof e=="object"&&t===void 0){if(t=e,n=t.keyword,Array.isArray(n)&&!n.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(FH.call(this,n,t),!t)return Xi.eachItem(n,(s)=>Yy.call(this,s)),this;VH.call(this,t);let r={...t,type:Fs.getJSONTypes(t.type),schemaType:Fs.getJSONTypes(t.schemaType)};return Xi.eachItem(n,r.type.length===0?(s)=>Yy.call(this,s,r):(s)=>r.type.forEach((o)=>Yy.call(this,s,r,o))),this}getKeyword(e){let t=this.RULES.all[e];return typeof t=="object"?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(let n of t.rules){let r=n.rules.findIndex((s)=>s.keyword===e);if(r>=0)n.rules.splice(r,1)}return this}addFormat(e,t){if(typeof t=="string")t=new RegExp(t);return this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:n="data"}={}){if(!e||e.length===0)return"No errors";return e.map((r)=>`${n}${r.instancePath} ${r.message}`).reduce((r,s)=>r+t+s)}$dataMetaSchema(e,t){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let r of t){let s=r.split("/").slice(1),o=e;for(let i of s)o=o[i];for(let i in n){let a=n[i];if(typeof a!="object")continue;let{$data:c}=a.definition,l=o[i];if(c&&l)o[i]=vk(l)}}return e}_removeAllSchemas(e,t){for(let n in e){let r=e[n];if(!t||t.test(n)){if(typeof r=="string")delete e[n];else if(r&&!r.meta)this._cache.delete(r.schema),delete e[n]}}}_addSchema(e,t,n,r=this.opts.validateSchema,s=this.opts.addUsedSchema){let o,{schemaId:i}=this.opts;if(typeof e=="object")o=e[i];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof e!="boolean")throw Error("schema must be object or boolean");let a=this._cache.get(e);if(a!==void 0)return a;n=vr.normalizeId(o||n);let c=vr.getSchemaRefs.call(this,e,n);if(a=new wr.SchemaEnv({schema:e,schemaId:i,meta:t,baseId:n,localRefs:c}),this._cache.set(a.schema,a),s&&!n.startsWith("#")){if(n)this._checkUnique(n);this.refs[n]=a}if(r)this.validateSchema(e,!0);return a}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta)this._compileMetaSchema(e);else wr.compileSchema.call(this,e);if(!e.validate)throw Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{wr.compileSchema.call(this,e)}finally{this.opts=t}}}Hf.ValidationError=jH.default;Hf.MissingRefError=bk.default;ts.default=Hf;function yk(e,t,n,r="error"){for(let s in e){let o=s;if(o in t)this.logger[r](`${n}: option ${s}. ${e[o]}`)}}function xk(e){return e=vr.normalizeId(e),this.schemas[e]||this.refs[e]}function RH(){let e=this.opts.schemas;if(!e)return;if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function NH(){for(let e in this.opts.formats){let t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function TH(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let n=e[t];if(!n.keyword)n.keyword=t;this.addKeyword(n)}}function JH(){let e={...this.opts};for(let t of _H)delete e[t];return e}var IH={log(){},warn(){},error(){}};function DH(e){if(e===!1)return IH;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw Error("logger must implement log, warn and error methods")}var MH=/^[a-z_$][a-z0-9_$:-]*$/i;function FH(e,t){let{RULES:n}=this;if(Xi.eachItem(e,(r)=>{if(n.keywords[r])throw Error(`Keyword ${r} is already defined`);if(!MH.test(r))throw Error(`Keyword ${r} has invalid name`)}),!t)return;if(t.$data&&!(("code"in t)||("validate"in t)))throw Error('$data keyword must have "code" or "validate" function')}function Yy(e,t,n){var r;let s=t===null||t===void 0?void 0:t.post;if(n&&s)throw Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,i=s?o.post:o.rules.find(({type:c})=>c===n);if(!i)i={type:n,rules:[]},o.rules.push(i);if(o.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:Fs.getJSONTypes(t.type),schemaType:Fs.getJSONTypes(t.schemaType)}};if(t.before)LH.call(this,i,a,t.before);else i.rules.push(a);o.all[e]=a,(r=t.implements)===null||r===void 0||r.forEach((c)=>this.addKeyword(c))}function LH(e,t,n){let r=e.rules.findIndex((s)=>s.keyword===n);if(r>=0)e.rules.splice(r,0,t);else e.rules.push(t),this.logger.warn(`rule ${n} is not defined`)}function VH(e){let{metaSchema:t}=e;if(t===void 0)return;if(e.$data&&this.opts.$data)t=vk(t);e.validateSchema=this.compile(t,!0)}var qH={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function vk(e){return{anyOf:[e,qH]}}});var jk=q(function(Ek){Object.defineProperty(Ek,"__esModule",{value:!0});var UH={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Ek.default=UH});var Kf=q(function(_k){Object.defineProperty(_k,"__esModule",{value:!0});_k.callRef=_k.getValidate=void 0;var zH=Gi(),Bf=Dn(),qe=ye(),Zi=Jn(),zf=Dc(),Ls=_e(),KH={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:n,it:r}=e,{baseId:s,schemaEnv:o,validateName:i,opts:a,self:c}=r,{root:l}=o;if((n==="#"||n==="#/")&&s===l.baseId)return d();let u=zf.resolveRef.call(c,l,s,n);if(u===void 0)throw new zH.default(r.opts.uriResolver,s,n);if(u instanceof zf.SchemaEnv)return p(u);return m(u);function d(){if(o===l)return Uf(e,i,o,o.$async);let x=t.scopeValue("root",{ref:l});return Uf(e,qe._`${x}.validate`,l,l.$async)}function p(x){let g=Pk(e,x);Uf(e,g,x,x.$async)}function m(x){let g=t.scopeValue("schema",a.code.source===!0?{ref:x,code:qe.stringify(x)}:{ref:x}),y=t.name("valid"),S=e.subschema({schema:x,dataTypes:[],schemaPath:qe.nil,topSchemaRef:g,errSchemaPath:n},y);e.mergeEvaluated(S),e.ok(y)}}};function Pk(e,t){let{gen:n}=e;return t.validate?n.scopeValue("validate",{ref:t.validate}):qe._`${n.scopeValue("wrapper",{ref:t})}.validate`}_k.getValidate=Pk;function Uf(e,t,n,r){let{gen:s,it:o}=e,{allErrors:i,schemaEnv:a,opts:c}=o,l=c.passContext?Zi.default.this:qe.nil;if(r)u();else d();function u(){if(!a.$async)throw Error("async schema referenced by sync schema");let x=s.let("valid");s.try(()=>{if(s.code(qe._`await ${Bf.callValidateCode(e,t,l)}`),m(t),!i)s.assign(x,!0)},(g)=>{if(s.if(qe._`!(${g} instanceof ${o.ValidationError})`,()=>s.throw(g)),p(g),!i)s.assign(x,!1)}),e.ok(x)}function d(){e.result(Bf.callValidateCode(e,t,l),()=>m(t),()=>p(t))}function p(x){let g=qe._`${x}.errors`;s.assign(Zi.default.vErrors,qe._`${Zi.default.vErrors} === null ? ${g} : ${Zi.default.vErrors}.concat(${g})`),s.assign(Zi.default.errors,qe._`${Zi.default.vErrors}.length`)}function m(x){var g;if(!o.opts.unevaluated)return;let y=(g=n===null||n===void 0?void 0:n.validate)===null||g===void 0?void 0:g.evaluated;if(o.props!==!0)if(y&&!y.dynamicProps){if(y.props!==void 0)o.props=Ls.mergeEvaluated.props(s,y.props,o.props)}else{let S=s.var("props",qe._`${x}.evaluated.props`);o.props=Ls.mergeEvaluated.props(s,S,o.props,qe.Name)}if(o.items!==!0)if(y&&!y.dynamicItems){if(y.items!==void 0)o.items=Ls.mergeEvaluated.items(s,y.items,o.items)}else{let S=s.var("items",qe._`${x}.evaluated.items`);o.items=Ls.mergeEvaluated.items(s,S,o.items,qe.Name)}}}_k.callRef=Uf;_k.default=KH});var Qy=q(function(Ok){Object.defineProperty(Ok,"__esModule",{value:!0});var YH=jk(),ZH=Kf(),QH=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",YH.default,ZH.default];Ok.default=QH});var Ck=q(function(Ak){Object.defineProperty(Ak,"__esModule",{value:!0});var qs=ye(),Vs=qs.operators,Gf={maximum:{okStr:"<=",ok:Vs.LTE,fail:Vs.GT},minimum:{okStr:">=",ok:Vs.GTE,fail:Vs.LT},exclusiveMaximum:{okStr:"<",ok:Vs.LT,fail:Vs.GTE},exclusiveMinimum:{okStr:">",ok:Vs.GT,fail:Vs.LTE}},tU={message:({keyword:e,schemaCode:t})=>qs.str`must be ${Gf[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>qs._`{comparison: ${Gf[e].okStr}, limit: ${t}}`},nU={keyword:Object.keys(Gf),type:"number",schemaType:"number",$data:!0,error:tU,code(e){let{keyword:t,data:n,schemaCode:r}=e;e.fail$data(qs._`${n} ${Gf[t].fail} ${r} || isNaN(${n})`)}};Ak.default=nU});var Nk=q(function(Rk){Object.defineProperty(Rk,"__esModule",{value:!0});var Er=ye(),sU={message:({schemaCode:e})=>Er.str`must be multiple of ${e}`,params:({schemaCode:e})=>Er._`{multipleOf: ${e}}`},oU={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:sU,code(e){let{gen:t,data:n,schemaCode:r,it:s}=e,o=s.opts.multipleOfPrecision,i=t.let("res"),a=o?Er._`Math.abs(Math.round(${i}) - ${i}) > 1e-${o}`:Er._`${i} !== parseInt(${i})`;e.fail$data(Er._`(${r} === 0 || (${i} = ${n}/${r}, ${a}))`)}};Rk.default=oU});var Ik=q(function(Jk){Object.defineProperty(Jk,"__esModule",{value:!0});function Tk(e){let t=e.length,n=0,r=0,s;while(r<t)if(n++,s=e.charCodeAt(r++),s>=55296&&s<=56319&&r<t){if(s=e.charCodeAt(r),(s&64512)===56320)r++}return n}Jk.default=Tk;Tk.code='require("ajv/dist/runtime/ucs2length").default'});var Fk=q(function(Mk){Object.defineProperty(Mk,"__esModule",{value:!0});var ln=ye(),Dk=_e(),cU=Ik(),lU={message({keyword:e,schemaCode:t}){return ln.str`must NOT have ${e==="maxLength"?"more":"fewer"} than ${t} characters`},params:({schemaCode:e})=>ln._`{limit: ${e}}`},uU={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:lU,code(e){let{keyword:t,data:n,schemaCode:r,it:s}=e,o=t==="maxLength"?ln.operators.GT:ln.operators.LT,i=s.opts.unicode===!1?ln._`${n}.length`:ln._`${Dk.useFunc(e.gen,cU.default)}(${n})`;e.fail$data(ln._`${i} ${o} ${r}`)}};Mk.default=uU});var Wk=q(function(qk){Object.defineProperty(qk,"__esModule",{value:!0});var Lk=Dn(),Vk=_e(),Mn=ye(),dU={message:({schemaCode:e})=>Mn.str`must match pattern "${e}"`,params:({schemaCode:e})=>Mn._`{pattern: ${e}}`},pU={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:dU,code(e){let{gen:t,data:n,$data:r,schema:s,schemaCode:o,it:i}=e,a=i.opts.unicodeRegExp?"u":"";if(r){let{regExp:c}=i.opts.code,l=c.code==="new RegExp"?Mn._`new RegExp`:Vk.useFunc(t,c),u=t.let("valid");t.try(()=>t.assign(u,Mn._`${l}(${o}, ${a}).test(${n})`),()=>t.assign(u,!1)),e.fail$data(Mn._`!${u}`)}else{let c=Lk.usePattern(e,s);e.fail$data(Mn._`!${c}.test(${n})`)}}};qk.default=pU});var Uk=q(function(Hk){Object.defineProperty(Hk,"__esModule",{value:!0});var jr=ye(),hU={message({keyword:e,schemaCode:t}){return jr.str`must NOT have ${e==="maxProperties"?"more":"fewer"} than ${t} properties`},params:({schemaCode:e})=>jr._`{limit: ${e}}`},gU={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:hU,code(e){let{keyword:t,data:n,schemaCode:r}=e,s=t==="maxProperties"?jr.operators.GT:jr.operators.LT;e.fail$data(jr._`Object.keys(${n}).length ${s} ${r}`)}};Hk.default=gU});var Kk=q(function(zk){Object.defineProperty(zk,"__esModule",{value:!0});var Pr=Dn(),_r=ye(),Bk=_e(),xU={message:({params:{missingProperty:e}})=>_r.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>_r._`{missingProperty: ${e}}`},bU={keyword:"required",type:"object",schemaType:"array",$data:!0,error:xU,code(e){let{gen:t,schema:n,schemaCode:r,data:s,$data:o,it:i}=e,{opts:a}=i;if(!o&&n.length===0)return;let c=n.length>=a.loopRequired;if(i.allErrors)l();else u();if(a.strictRequired){let m=e.parentSchema.properties,{definedProperties:x}=e.it;for(let g of n)if((m===null||m===void 0?void 0:m[g])===void 0&&!x.has(g)){let y=i.schemaEnv.baseId+i.errSchemaPath,S=`required property "${g}" is not defined at "${y}" (strictRequired)`;Bk.checkStrictMode(i,S,i.opts.strictRequired)}}function l(){if(c||o)e.block$data(_r.nil,d);else for(let m of n)Pr.checkReportMissingProp(e,m)}function u(){let m=t.let("missing");if(c||o){let x=t.let("valid",!0);e.block$data(x,()=>p(m,x)),e.ok(x)}else t.if(Pr.checkMissingProp(e,n,m)),Pr.reportMissingProp(e,m),t.else()}function d(){t.forOf("prop",r,(m)=>{e.setParams({missingProperty:m}),t.if(Pr.noPropertyInData(t,s,m,a.ownProperties),()=>e.error())})}function p(m,x){e.setParams({missingProperty:m}),t.forOf(m,r,()=>{t.assign(x,Pr.propertyInData(t,s,m,a.ownProperties)),t.if(_r.not(x),()=>{e.error(),t.break()})},_r.nil)}}};zk.default=bU});var Xk=q(function(Gk){Object.defineProperty(Gk,"__esModule",{value:!0});var kr=ye(),SU={message({keyword:e,schemaCode:t}){return kr.str`must NOT have ${e==="maxItems"?"more":"fewer"} than ${t} items`},params:({schemaCode:e})=>kr._`{limit: ${e}}`},wU={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:SU,code(e){let{keyword:t,data:n,schemaCode:r}=e,s=t==="maxItems"?kr.operators.GT:kr.operators.LT;e.fail$data(kr._`${n}.length ${s} ${r}`)}};Gk.default=wU});var Xf=q(function(Zk){Object.defineProperty(Zk,"__esModule",{value:!0});var Yk=Ty();Yk.code='require("ajv/dist/runtime/equal").default';Zk.default=Yk});var tO=q(function(eO){Object.defineProperty(eO,"__esModule",{value:!0});var Qi=Nc(),Ae=ye(),Qk=_e(),jU=Xf(),PU={message:({params:{i:e,j:t}})=>Ae.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>Ae._`{i: ${e}, j: ${t}}`},_U={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:PU,code(e){let{gen:t,data:n,$data:r,schema:s,parentSchema:o,schemaCode:i,it:a}=e;if(!r&&!s)return;let c=t.let("valid"),l=o.items?Qi.getSchemaTypes(o.items):[];e.block$data(c,u,Ae._`${i} === false`),e.ok(c);function u(){let x=t.let("i",Ae._`${n}.length`),g=t.let("j");e.setParams({i:x,j:g}),t.assign(c,!0),t.if(Ae._`${x} > 1`,()=>(d()?p:m)(x,g))}function d(){return l.length>0&&!l.some((x)=>x==="object"||x==="array")}function p(x,g){let y=t.name("item"),S=Qi.checkDataTypes(l,y,a.opts.strictNumbers,Qi.DataType.Wrong),E=t.const("indices",Ae._`{}`);t.for(Ae._`;${x}--;`,()=>{if(t.let(y,Ae._`${n}[${x}]`),t.if(S,Ae._`continue`),l.length>1)t.if(Ae._`typeof ${y} == "string"`,Ae._`${y} += "_"`);t.if(Ae._`typeof ${E}[${y}] == "number"`,()=>{t.assign(g,Ae._`${E}[${y}]`),e.error(),t.assign(c,!1).break()}).code(Ae._`${E}[${y}] = ${x}`)})}function m(x,g){let y=Qk.useFunc(t,jU.default),S=t.name("outer");t.label(S).for(Ae._`;${x}--;`,()=>t.for(Ae._`${g} = ${x}; ${g}--;`,()=>t.if(Ae._`${y}(${n}[${x}], ${n}[${g}])`,()=>{e.error(),t.assign(c,!1).break(S)})))}}};eO.default=_U});var sO=q(function(rO){Object.defineProperty(rO,"__esModule",{value:!0});var ea=ye(),nO=_e(),OU=Xf(),AU={message:"must be equal to constant",params:({schemaCode:e})=>ea._`{allowedValue: ${e}}`},CU={keyword:"const",$data:!0,error:AU,code(e){let{gen:t,data:n,$data:r,schemaCode:s,schema:o}=e;if(r||o&&typeof o=="object")e.fail$data(ea._`!${nO.useFunc(t,OU.default)}(${n}, ${s})`);else e.fail(ea._`${o} !== ${n}`)}};rO.default=CU});var aO=q(function(iO){Object.defineProperty(iO,"__esModule",{value:!0});var Or=ye(),oO=_e(),NU=Xf(),TU={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>Or._`{allowedValues: ${e}}`},JU={keyword:"enum",schemaType:"array",$data:!0,error:TU,code(e){let{gen:t,data:n,$data:r,schema:s,schemaCode:o,it:i}=e;if(!r&&s.length===0)throw Error("enum must have non-empty array");let a=s.length>=i.opts.loopEnum,c,l=()=>c!==null&&c!==void 0?c:c=oO.useFunc(t,NU.default),u;if(a||r)u=t.let("valid"),e.block$data(u,d);else{if(!Array.isArray(s))throw Error("ajv implementation error");let m=t.const("vSchema",o);u=Or.or(...s.map((x,g)=>p(m,g)))}e.pass(u);function d(){t.assign(u,!1),t.forOf("v",o,(m)=>t.if(Or._`${l()}(${n}, ${m})`,()=>t.assign(u,!0).break()))}function p(m,x){let g=s[x];return typeof g==="object"&&g!==null?Or._`${l()}(${n}, ${m}[${x}])`:Or._`${n} === ${g}`}}};iO.default=JU});var ex=q(function(cO){Object.defineProperty(cO,"__esModule",{value:!0});var DU=Ck(),MU=Nk(),FU=Fk(),LU=Wk(),VU=Uk(),qU=Kk(),WU=Xk(),HU=tO(),UU=sO(),BU=aO(),zU=[DU.default,MU.default,FU.default,LU.default,VU.default,qU.default,WU.default,HU.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},UU.default,BU.default];cO.default=zU});var tx=q(function(uO){Object.defineProperty(uO,"__esModule",{value:!0});uO.validateAdditionalItems=void 0;var un=ye(),ta=_e(),GU={message:({params:{len:e}})=>un.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>un._`{limit: ${e}}`},XU={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:GU,code(e){let{parentSchema:t,it:n}=e,{items:r}=t;if(!Array.isArray(r)){ta.checkStrictMode(n,'"additionalItems" is ignored when "items" is not an array of schemas');return}lO(e,r)}};function lO(e,t){let{gen:n,schema:r,data:s,keyword:o,it:i}=e;i.items=!0;let a=n.const("len",un._`${s}.length`);if(r===!1)e.setParams({len:t.length}),e.pass(un._`${a} <= ${t.length}`);else if(typeof r=="object"&&!ta.alwaysValidSchema(i,r)){let l=n.var("valid",un._`${a} <= ${t.length}`);n.if(un.not(l),()=>c(l)),e.ok(l)}function c(l){n.forRange("i",t.length,a,(u)=>{if(e.subschema({keyword:o,dataProp:u,dataPropType:ta.Type.Num},l),!i.allErrors)n.if(un.not(l),()=>n.break())})}}uO.validateAdditionalItems=lO;uO.default=XU});var nx=q(function(mO){Object.defineProperty(mO,"__esModule",{value:!0});mO.validateTuple=void 0;var Yf=ye(),Ws=_e(),dO=Dn(),ZU={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:n}=e;if(Array.isArray(t))return pO(e,"additionalItems",t);if(n.items=!0,Ws.alwaysValidSchema(n,t))return;e.ok(dO.validateArray(e))}};function pO(e,t,n=e.schema){let{gen:r,parentSchema:s,data:o,keyword:i,it:a}=e;if(u(s),a.opts.unevaluated&&n.length&&a.items!==!0)a.items=Ws.mergeEvaluated.items(r,n.length,a.items);let c=r.name("valid"),l=r.const("len",Yf._`${o}.length`);n.forEach((d,p)=>{if(Ws.alwaysValidSchema(a,d))return;r.if(Yf._`${l} > ${p}`,()=>e.subschema({keyword:i,schemaProp:p,dataProp:p},c)),e.ok(c)});function u(d){let{opts:p,errSchemaPath:m}=a,x=n.length,g=x===d.minItems&&(x===d.maxItems||d[t]===!1);if(p.strictTuples&&!g){let y=`"${i}" is ${x}-tuple, but minItems or maxItems/${t} are not specified or different at path "${m}"`;Ws.checkStrictMode(a,y,p.strictTuples)}}}mO.validateTuple=pO;mO.default=ZU});var xO=q(function(yO){Object.defineProperty(yO,"__esModule",{value:!0});var gO=nx(),eB={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(e)=>gO.validateTuple(e,"items")};yO.default=eB});var vO=q(function(wO){Object.defineProperty(wO,"__esModule",{value:!0});var Zf=ye(),bO=_e(),$O=Dn(),SO=tx(),nB={message:({params:{len:e}})=>Zf.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Zf._`{limit: ${e}}`},rB={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:nB,code(e){let{schema:t,parentSchema:n,it:r}=e,{prefixItems:s}=n;if(r.items=!0,bO.alwaysValidSchema(r,t))return;if(s)SO.validateAdditionalItems(e,s);else e.ok($O.validateArray(e))}};wO.default=rB});var jO=q(function(EO){Object.defineProperty(EO,"__esModule",{value:!0});var Qe=ye(),Hs=_e(),oB={message:({params:{min:e,max:t}})=>t===void 0?Qe.str`must contain at least ${e} valid item(s)`:Qe.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?Qe._`{minContains: ${e}}`:Qe._`{minContains: ${e}, maxContains: ${t}}`},iB={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:oB,code(e){let{gen:t,schema:n,parentSchema:r,data:s,it:o}=e,i,a,{minContains:c,maxContains:l}=r;if(o.opts.next)i=c===void 0?1:c,a=l;else i=1;let u=t.const("len",Qe._`${s}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){Hs.checkStrictMode(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){Hs.checkStrictMode(o,'"minContains" > "maxContains" is always invalid'),e.fail();return}if(Hs.alwaysValidSchema(o,n)){let g=Qe._`${u} >= ${i}`;if(a!==void 0)g=Qe._`${g} && ${u} <= ${a}`;e.pass(g);return}o.items=!0;let d=t.name("valid");if(a===void 0&&i===1)m(d,()=>t.if(d,()=>t.break()));else if(i===0){if(t.let(d,!0),a!==void 0)t.if(Qe._`${s}.length > 0`,p)}else t.let(d,!1),p();e.result(d,()=>e.reset());function p(){let g=t.name("_valid"),y=t.let("count",0);m(g,()=>t.if(g,()=>x(y)))}function m(g,y){t.forRange("i",0,u,(S)=>{e.subschema({keyword:"contains",dataProp:S,dataPropType:Hs.Type.Num,compositeRule:!0},g),y()})}function x(g){if(t.code(Qe._`${g}++`),a===void 0)t.if(Qe._`${g} >= ${i}`,()=>t.assign(d,!0).break());else if(t.if(Qe._`${g} > ${a}`,()=>t.assign(d,!1).break()),i===1)t.assign(d,!0);else t.if(Qe._`${g} >= ${i}`,()=>t.assign(d,!0))}}};EO.default=iB});var Qf=q(function(OO){Object.defineProperty(OO,"__esModule",{value:!0});OO.validateSchemaDeps=OO.validatePropertyDeps=OO.error=void 0;var na=ye(),PO=_e(),Ar=Dn();OO.error={message:({params:{property:e,depsCount:t,deps:n}})=>na.str`must have ${t===1?"property":"properties"} ${n} when property ${e} is present`,params:({params:{property:e,depsCount:t,deps:n,missingProperty:r}})=>na._`{property: ${e},
621
618
  missingProperty: ${r},
622
619
  depsCount: ${t},
623
- deps: ${n}}`};var MH={keyword:"dependencies",type:"object",schemaType:"object",error:jk.error,code(e){let[t,n]=DH(e);vk(e,t),Ek(e,n)}};function DH({schema:e}){let t={},n={};for(let r in e){if(r==="__proto__")continue;let s=Array.isArray(e[r])?t:n;s[r]=e[r]}return[t,n]}function vk(e,t=e.schema){let{gen:n,data:r,it:s}=e;if(Object.keys(t).length===0)return;let o=n.let("missing");for(let i in t){let a=t[i];if(a.length===0)continue;let c=kr.propertyInData(n,r,i,s.opts.ownProperties);if(e.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),s.allErrors)n.if(c,()=>{for(let l of a)kr.checkReportMissingProp(e,l)});else n.if(oa._`${c} && (${kr.checkMissingProp(e,a,o)})`),kr.reportMissingProp(e,o),n.else()}}jk.validatePropertyDeps=vk;function Ek(e,t=e.schema){let{gen:n,data:r,keyword:s,it:o}=e,i=n.name("valid");for(let a in t){if(Sk.alwaysValidSchema(o,t[a]))continue;n.if(kr.propertyInData(n,r,a,o.opts.ownProperties),()=>{let c=e.subschema({keyword:s,schemaProp:a},i);e.mergeValidEvaluated(c,i)},()=>n.var(i,!0)),e.ok(i)}}jk.validateSchemaDeps=Ek;jk.default=MH});var Ak=W(function(Ok){Object.defineProperty(Ok,"__esModule",{value:!0});var _f=ge(),kk=ke(),VH={message:"property name must be valid",params:({params:e})=>_f._`{propertyName: ${e.propertyName}}`},qH={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:VH,code(e){let{gen:t,schema:n,data:r,it:s}=e;if(kk.alwaysValidSchema(s,n))return;let o=t.name("valid");t.forIn("key",r,(i)=>{e.setParams({propertyName:i}),e.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},o),t.if(_f.not(o),()=>{if(e.error(!0),!s.allErrors)t.break()})}),e.ok(o)}};Ok.default=qH});var og=W(function(Rk){Object.defineProperty(Rk,"__esModule",{value:!0});var qs=Fn(),ft=ge(),HH=Mn(),Ws=ke(),UH={message:"must NOT have additional properties",params:({params:e})=>ft._`{additionalProperty: ${e.additionalProperty}}`},BH={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:UH,code(e){let{gen:t,schema:n,parentSchema:r,data:s,errsCount:o,it:i}=e;if(!o)throw Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&Ws.alwaysValidSchema(i,n))return;let l=qs.allSchemaProperties(r.properties),u=qs.allSchemaProperties(r.patternProperties);d(),e.ok(ft._`${o} === ${HH.default.errors}`);function d(){t.forIn("key",s,(g)=>{if(!l.length&&!u.length)x(g);else t.if(p(g),()=>x(g))})}function p(g){let b;if(l.length>8){let j=Ws.schemaRefOrVal(i,r.properties,"properties");b=qs.isOwnProperty(t,j,g)}else if(l.length)b=ft.or(...l.map((j)=>ft._`${g} === ${j}`));else b=ft.nil;if(u.length)b=ft.or(b,...u.map((j)=>ft._`${qs.usePattern(e,j)}.test(${g})`));return ft.not(b)}function m(g){t.code(ft._`delete ${s}[${g}]`)}function x(g){if(c.removeAdditional==="all"||c.removeAdditional&&n===!1){m(g);return}if(n===!1){if(e.setParams({additionalProperty:g}),e.error(),!a)t.break();return}if(typeof n=="object"&&!Ws.alwaysValidSchema(i,n)){let b=t.name("valid");if(c.removeAdditional==="failing")h(g,b,!1),t.if(ft.not(b),()=>{e.reset(),m(g)});else if(h(g,b),!a)t.if(ft.not(b),()=>t.break())}}function h(g,b,j){let v={keyword:"additionalProperties",dataProp:g,dataPropType:Ws.Type.Str};if(j===!1)Object.assign(v,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(v,b)}}};Rk.default=BH});var Jk=W(function(Tk){Object.defineProperty(Tk,"__esModule",{value:!0});var Nk=Xi(),kf=Fn(),ia=ke(),Ck=og(),KH={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:n,parentSchema:r,data:s,it:o}=e;if(o.opts.removeAdditional==="all"&&r.additionalProperties===void 0)Ck.default.code(new Nk.KeywordCxt(o,Ck.default,"additionalProperties"));let i=kf.allSchemaProperties(n);for(let d of i)o.definedProperties.add(d);if(o.opts.unevaluated&&i.length&&o.props!==!0)o.props=ia.mergeEvaluated.props(t,ia.toHash(i),o.props);let a=i.filter((d)=>!ia.alwaysValidSchema(o,n[d]));if(a.length===0)return;let c=t.name("valid");for(let d of a){if(l(d))u(d);else{if(t.if(kf.propertyInData(t,s,d,o.opts.ownProperties)),u(d),!o.allErrors)t.else().var(c,!0);t.endIf()}e.it.definedProperties.add(d),e.ok(c)}function l(d){return o.opts.useDefaults&&!o.compositeRule&&n[d].default!==void 0}function u(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};Tk.default=KH});var Mk=W(function(Ik){Object.defineProperty(Ik,"__esModule",{value:!0});var Of=Fn(),Hs=ge(),Af=ke(),Rf=ke(),XH={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:n,data:r,parentSchema:s,it:o}=e,{opts:i}=o,a=Of.allSchemaProperties(n),c=a.filter((h)=>Af.alwaysValidSchema(o,n[h]));if(a.length===0||c.length===a.length&&(!o.opts.unevaluated||o.props===!0))return;let l=i.strictSchema&&!i.allowMatchingProperties&&s.properties,u=t.name("valid");if(o.props!==!0&&!(o.props instanceof Hs.Name))o.props=Rf.evaluatedPropsToName(t,o.props);let{props:d}=o;p();function p(){for(let h of a){if(l)m(h);if(o.allErrors)x(h);else t.var(u,!0),x(h),t.if(u)}}function m(h){for(let g in l)if(new RegExp(h).test(g))Af.checkStrictMode(o,`property ${g} matches pattern ${h} (use allowMatchingProperties)`)}function x(h){t.forIn("key",r,(g)=>{t.if(Hs._`${Of.usePattern(e,h)}.test(${g})`,()=>{let b=c.includes(h);if(!b)e.subschema({keyword:"patternProperties",schemaProp:h,dataProp:g,dataPropType:Rf.Type.Str},u);if(o.opts.unevaluated&&d!==!0)t.assign(Hs._`${d}[${g}]`,!0);else if(!b&&!o.allErrors)t.if(Hs.not(u),()=>t.break())})})}}};Ik.default=XH});var Lk=W(function(Fk){Object.defineProperty(Fk,"__esModule",{value:!0});var Dk=ke(),ZH={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:n,it:r}=e;if(Dk.alwaysValidSchema(r,n)){e.fail();return}let s=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},s),e.failResult(s,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};Fk.default=ZH});var Wk=W(function(qk){Object.defineProperty(qk,"__esModule",{value:!0});var Vk=Fn(),eU={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Vk.validateUnion,error:{message:"must match a schema in anyOf"}};qk.default=eU});var Bk=W(function(Uk){Object.defineProperty(Uk,"__esModule",{value:!0});var Us=ge(),Hk=ke(),nU={message:"must match exactly one schema in oneOf",params:({params:e})=>Us._`{passingSchemas: ${e.passing}}`},rU={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:nU,code(e){let{gen:t,schema:n,parentSchema:r,it:s}=e;if(!Array.isArray(n))throw Error("ajv implementation error");if(s.opts.discriminator&&r.discriminator)return;let o=n,i=t.let("valid",!1),a=t.let("passing",null),c=t.name("_valid");e.setParams({passing:a}),t.block(l),e.result(i,()=>e.reset(),()=>e.error(!0));function l(){o.forEach((u,d)=>{let p;if(Hk.alwaysValidSchema(s,u))t.var(c,!0);else p=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c);if(d>0)t.if(Us._`${c} && ${i}`).assign(i,!1).assign(a,Us._`[${a}, ${d}]`).else();t.if(c,()=>{if(t.assign(i,!0),t.assign(a,d),p)e.mergeEvaluated(p,Us.Name)})})}}};Uk.default=rU});var Gk=W(function(Kk){Object.defineProperty(Kk,"__esModule",{value:!0});var zk=ke(),oU={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:n,it:r}=e;if(!Array.isArray(n))throw Error("ajv implementation error");let s=t.name("valid");n.forEach((o,i)=>{if(zk.alwaysValidSchema(r,o))return;let a=e.subschema({keyword:"allOf",schemaProp:i},s);e.ok(s),e.mergeEvaluated(a)})}};Kk.default=oU});var Zk=W(function(Yk){Object.defineProperty(Yk,"__esModule",{value:!0});var Bs=ge(),Cf=ke(),aU={message:({params:e})=>Bs.str`must match "${e.ifClause}" schema`,params:({params:e})=>Bs._`{failingKeyword: ${e.ifClause}}`},cU={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:aU,code(e){let{gen:t,parentSchema:n,it:r}=e;if(n.then===void 0&&n.else===void 0)Cf.checkStrictMode(r,'"if" without "then" and "else" is ignored');let s=Xk(r,"then"),o=Xk(r,"else");if(!s&&!o)return;let i=t.let("valid",!0),a=t.name("_valid");if(c(),e.reset(),s&&o){let u=t.let("ifClause");e.setParams({ifClause:u}),t.if(a,l("then",u),l("else",u))}else if(s)t.if(a,l("then"));else t.if(Bs.not(a),l("else"));e.pass(i,()=>e.error(!0));function c(){let u=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(u)}function l(u,d){return()=>{let p=e.subschema({keyword:u},a);if(t.assign(i,a),e.mergeValidEvaluated(p,i),d)t.assign(d,Bs._`${u}`);else e.setParams({ifClause:u})}}}};function Xk(e,t){let n=e.schema[t];return n!==void 0&&!Cf.alwaysValidSchema(e,n)}Yk.default=cU});var tO=W(function(eO){Object.defineProperty(eO,"__esModule",{value:!0});var Qk=ke(),uU={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:n}){if(t.if===void 0)Qk.checkStrictMode(n,`"${e}" without "if" is ignored`)}};eO.default=uU});var ig=W(function(nO){Object.defineProperty(nO,"__esModule",{value:!0});var dU=rg(),pU=mk(),mU=sg(),hU=bk(),gU=wk(),yU=Pf(),xU=Ak(),bU=og(),$U=Jk(),wU=Mk(),SU=Lk(),vU=Wk(),EU=Bk(),jU=Gk(),PU=Zk(),_U=tO();function kU(e=!1){let t=[SU.default,vU.default,EU.default,jU.default,PU.default,_U.default,xU.default,bU.default,yU.default,$U.default,wU.default];if(e)t.push(pU.default,hU.default);else t.push(dU.default,mU.default);return t.push(gU.default),t}nO.default=kU});var ag=W(function(oO){Object.defineProperty(oO,"__esModule",{value:!0});oO.dynamicAnchor=void 0;var aa=ge(),AU=Mn(),Nf=Oc(),rO=wf(),RU={keyword:"$dynamicAnchor",schemaType:"string",code:(e)=>sO(e,e.schema)};function sO(e,t){let{gen:n,it:r}=e;r.schemaEnv.root.dynamicAnchors[t]=!0;let s=aa._`${AU.default.dynamicAnchors}${aa.getProperty(t)}`,o=r.errSchemaPath==="#"?r.validateName:CU(e);n.if(aa._`!${s}`,()=>n.assign(s,o))}oO.dynamicAnchor=sO;function CU(e){let{schemaEnv:t,schema:n,self:r}=e.it,{root:s,baseId:o,localRefs:i,meta:a}=t.root,{schemaId:c}=r.opts,l=new Nf.SchemaEnv({schema:n,schemaId:c,root:s,baseId:o,localRefs:i,meta:a});return Nf.compileSchema.call(r,l),rO.getValidate(e,l)}oO.default=RU});var cg=W(function(cO){Object.defineProperty(cO,"__esModule",{value:!0});cO.dynamicRef=void 0;var Tf=ge(),TU=Mn(),Jf=wf(),JU={keyword:"$dynamicRef",schemaType:"string",code:(e)=>aO(e,e.schema)};function aO(e,t){let{gen:n,keyword:r,it:s}=e;if(t[0]!=="#")throw Error(`"${r}" only supports hash fragment reference`);let o=t.slice(1);if(s.allErrors)i();else{let c=n.let("valid",!1);i(c),e.ok(c)}function i(c){if(s.schemaEnv.root.dynamicAnchors[o]){let l=n.let("_v",Tf._`${TU.default.dynamicAnchors}${Tf.getProperty(o)}`);n.if(l,a(l,c),a(s.validateName,c))}else a(s.validateName,c)()}function a(c,l){return l?()=>n.block(()=>{Jf.callRef(e,c),n.let(l,!0)}):()=>Jf.callRef(e,c)}}cO.dynamicRef=aO;cO.default=JU});var pO=W(function(dO){Object.defineProperty(dO,"__esModule",{value:!0});var uO=ag(),fO=ke(),MU={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){if(e.schema)uO.dynamicAnchor(e,"");else fO.checkStrictMode(e.it,"$recursiveAnchor: false is ignored")}};dO.default=MU});var gO=W(function(hO){Object.defineProperty(hO,"__esModule",{value:!0});var mO=cg(),FU={keyword:"$recursiveRef",schemaType:"string",code:(e)=>mO.dynamicRef(e,e.schema)};hO.default=FU});var xO=W(function(yO){Object.defineProperty(yO,"__esModule",{value:!0});var VU=ag(),qU=cg(),WU=pO(),HU=gO(),UU=[VU.default,qU.default,WU.default,HU.default];yO.default=UU});var $O=W(function(bO){Object.defineProperty(bO,"__esModule",{value:!0});var If=Pf(),zU={keyword:"dependentRequired",type:"object",schemaType:"object",error:If.error,code:(e)=>If.validatePropertyDeps(e)};bO.default=zU});var vO=W(function(SO){Object.defineProperty(SO,"__esModule",{value:!0});var wO=Pf(),GU={keyword:"dependentSchemas",type:"object",schemaType:"object",code:(e)=>wO.validateSchemaDeps(e)};SO.default=GU});var PO=W(function(jO){Object.defineProperty(jO,"__esModule",{value:!0});var EO=ke(),YU={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:e,parentSchema:t,it:n}){if(t.contains===void 0)EO.checkStrictMode(n,`"${e}" without "contains" is ignored`)}};jO.default=YU});var kO=W(function(_O){Object.defineProperty(_O,"__esModule",{value:!0});var QU=$O(),eB=vO(),tB=PO(),nB=[QU.default,eB.default,tB.default];_O.default=nB});var AO=W(function(OO){Object.defineProperty(OO,"__esModule",{value:!0});var Wt=ge(),Mf=ke(),sB=Mn(),oB={message:"must NOT have unevaluated properties",params:({params:e})=>Wt._`{unevaluatedProperty: ${e.unevaluatedProperty}}`},iB={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:oB,code(e){let{gen:t,schema:n,data:r,errsCount:s,it:o}=e;if(!s)throw Error("ajv implementation error");let{allErrors:i,props:a}=o;if(a instanceof Wt.Name)t.if(Wt._`${a} !== true`,()=>t.forIn("key",r,(d)=>t.if(l(a,d),()=>c(d))));else if(a!==!0)t.forIn("key",r,(d)=>a===void 0?c(d):t.if(u(a,d),()=>c(d)));o.props=!0,e.ok(Wt._`${s} === ${sB.default.errors}`);function c(d){if(n===!1){if(e.setParams({unevaluatedProperty:d}),e.error(),!i)t.break();return}if(!Mf.alwaysValidSchema(o,n)){let p=t.name("valid");if(e.subschema({keyword:"unevaluatedProperties",dataProp:d,dataPropType:Mf.Type.Str},p),!i)t.if(Wt.not(p),()=>t.break())}}function l(d,p){return Wt._`!${d} || !${d}[${p}]`}function u(d,p){let m=[];for(let x in d)if(d[x]===!0)m.push(Wt._`${p} !== ${x}`);return Wt.and(...m)}}};OO.default=iB});var CO=W(function(RO){Object.defineProperty(RO,"__esModule",{value:!0});var pn=ge(),Df=ke(),cB={message:({params:{len:e}})=>pn.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>pn._`{limit: ${e}}`},lB={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:cB,code(e){let{gen:t,schema:n,data:r,it:s}=e,o=s.items||0;if(o===!0)return;let i=t.const("len",pn._`${r}.length`);if(n===!1)e.setParams({len:o}),e.fail(pn._`${i} > ${o}`);else if(typeof n=="object"&&!Df.alwaysValidSchema(s,n)){let c=t.var("valid",pn._`${i} <= ${o}`);t.if(pn.not(c),()=>a(c,o)),e.ok(c)}s.items=!0;function a(c,l){t.forRange("i",l,i,(u)=>{if(e.subschema({keyword:"unevaluatedItems",dataProp:u,dataPropType:Df.Type.Num},c),!s.allErrors)t.if(pn.not(c),()=>t.break())})}}};RO.default=lB});var TO=W(function(NO){Object.defineProperty(NO,"__esModule",{value:!0});var fB=AO(),dB=CO(),pB=[fB.default,dB.default];NO.default=pB});var IO=W(function(JO){Object.defineProperty(JO,"__esModule",{value:!0});var we=ge(),hB={message:({schemaCode:e})=>we.str`must match format "${e}"`,params:({schemaCode:e})=>we._`{format: ${e}}`},gB={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:hB,code(e,t){let{gen:n,data:r,$data:s,schema:o,schemaCode:i,it:a}=e,{opts:c,errSchemaPath:l,schemaEnv:u,self:d}=a;if(!c.validateFormats)return;if(s)p();else m();function p(){let x=n.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=n.const("fDef",we._`${x}[${i}]`),g=n.let("fType"),b=n.let("format");n.if(we._`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>n.assign(g,we._`${h}.type || "string"`).assign(b,we._`${h}.validate`),()=>n.assign(g,we._`"string"`).assign(b,h)),e.fail$data(we.or(j(),v()));function j(){if(c.strictSchema===!1)return we.nil;return we._`${i} && !${b}`}function v(){let P=u.$async?we._`(${h}.async ? await ${b}(${r}) : ${b}(${r}))`:we._`${b}(${r})`,S=we._`(typeof ${b} == "function" ? ${P} : ${b}.test(${r}))`;return we._`${b} && ${b} !== true && ${g} === ${t} && !${S}`}}function m(){let x=d.formats[o];if(!x){j();return}if(x===!0)return;let[h,g,b]=v(x);if(h===t)e.pass(P());function j(){if(c.strictSchema===!1){d.logger.warn(S());return}throw Error(S());function S(){return`unknown format "${o}" ignored in schema at path "${l}"`}}function v(S){let _=S instanceof RegExp?we.regexpCode(S):c.code.formats?we._`${c.code.formats}${we.getProperty(o)}`:void 0,N=n.scopeValue("formats",{key:o,ref:S,code:_});if(typeof S=="object"&&!(S instanceof RegExp))return[S.type||"string",S.validate,we._`${N}.validate`];return["string",S,N]}function P(){if(typeof x=="object"&&!(x instanceof RegExp)&&x.async){if(!u.$async)throw Error("async format in sync schema");return we._`await ${b}(${r})`}return typeof g=="function"?we._`${b}(${r})`:we._`${b}.test(${r})`}}}};JO.default=gB});var lg=W(function(MO){Object.defineProperty(MO,"__esModule",{value:!0});var xB=IO(),bB=[xB.default];MO.default=bB});var ug=W(function(DO){Object.defineProperty(DO,"__esModule",{value:!0});DO.contentVocabulary=DO.metadataVocabulary=void 0;DO.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];DO.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var VO=W(function(LO){Object.defineProperty(LO,"__esModule",{value:!0});var SB=tg(),vB=ng(),EB=ig(),jB=xO(),PB=kO(),_B=TO(),kB=lg(),Ff=ug(),OB=[jB.default,SB.default,vB.default,(0,EB.default)(!0),kB.default,Ff.metadataVocabulary,Ff.contentVocabulary,PB.default,_B.default];LO.default=OB});var UO=W(function(WO){Object.defineProperty(WO,"__esModule",{value:!0});WO.DiscrError=void 0;var qO;(function(e){e.Tag="tag",e.Mapping="mapping"})(qO||(WO.DiscrError=qO={}))});var fg=W(function(zO){Object.defineProperty(zO,"__esModule",{value:!0});var Vn=ge(),ca=UO(),Lf=Oc(),RB=Zi(),BO=ke(),CB={message:({params:{discrError:e,tagName:t}})=>e===ca.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:n}})=>Vn._`{error: ${e}, tag: ${n}, tagValue: ${t}}`},NB={keyword:"discriminator",type:"object",schemaType:"object",error:CB,code(e){let{gen:t,data:n,schema:r,parentSchema:s,it:o}=e,{oneOf:i}=s;if(!o.opts.discriminator)throw Error("discriminator: requires discriminator option");let a=r.propertyName;if(typeof a!="string")throw Error("discriminator: requires propertyName");if(r.mapping)throw Error("discriminator: mapping is not supported");if(!i)throw Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),l=t.const("tag",Vn._`${n}${Vn.getProperty(a)}`);t.if(Vn._`typeof ${l} == "string"`,()=>u(),()=>e.error(!1,{discrError:ca.DiscrError.Tag,tag:l,tagName:a})),e.ok(c);function u(){let m=p();t.if(!1);for(let x in m)t.elseIf(Vn._`${l} === ${x}`),t.assign(c,d(m[x]));t.else(),e.error(!1,{discrError:ca.DiscrError.Mapping,tag:l,tagName:a}),t.endIf()}function d(m){let x=t.name("valid"),h=e.subschema({keyword:"oneOf",schemaProp:m},x);return e.mergeEvaluated(h,Vn.Name),x}function p(){var m;let x={},h=b(s),g=!0;for(let P=0;P<i.length;P++){let S=i[P];if((S===null||S===void 0?void 0:S.$ref)&&!BO.schemaHasRulesButRef(S,o.self.RULES)){let N=S.$ref;if(S=Lf.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,N),S instanceof Lf.SchemaEnv)S=S.schema;if(S===void 0)throw new RB.default(o.opts.uriResolver,o.baseId,N)}let _=(m=S===null||S===void 0?void 0:S.properties)===null||m===void 0?void 0:m[a];if(typeof _!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);g=g&&(h||b(S)),j(_,P)}if(!g)throw Error(`discriminator: "${a}" must be required`);return x;function b({required:P}){return Array.isArray(P)&&P.includes(a)}function j(P,S){if(P.const)v(P.const,S);else if(P.enum)for(let _ of P.enum)v(_,S);else throw Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function v(P,S){if(typeof P!="string"||P in x)throw Error(`discriminator: "${a}" values must be unique strings`);x[P]=S}}}};zO.default=NB});var KO=W(function(hee,JB){JB.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/schema",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],type:["object","boolean"],$comment:"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",properties:{definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}}}});var GO=W(function(gee,IB){IB.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$dynamicAnchor:"meta",title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}}}});var XO=W(function(yee,MB){MB.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/unevaluated",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$dynamicAnchor:"meta",title:"Unevaluated applicator vocabulary meta-schema",type:["object","boolean"],properties:{unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}}}});var YO=W(function(xee,DB){DB.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/content",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}}}});var ZO=W(function(bee,FB){FB.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/core",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0},$dynamicAnchor:"meta",title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},$defs:{anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}}}});var QO=W(function($ee,LB){LB.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/format-annotation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},$dynamicAnchor:"meta",title:"Format vocabulary meta-schema for annotation results",type:["object","boolean"],properties:{format:{type:"string"}}}});var eA=W(function(wee,VB){VB.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$dynamicAnchor:"meta",title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}});var tA=W(function(See,qB){qB.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/validation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/validation":!0},$dynamicAnchor:"meta",title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}});var rA=W(function(nA){Object.defineProperty(nA,"__esModule",{value:!0});var WB=KO(),HB=GO(),UB=XO(),BB=YO(),zB=ZO(),KB=QO(),GB=eA(),XB=tA(),YB=["/properties"];function ZB(e){return[WB,HB,UB,BB,zB,t(this,KB),GB,t(this,XB)].forEach((n)=>this.addMetaSchema(n,void 0,!1)),this;function t(n,r){return e?n.$dataMetaSchema(r,YB):r}}nA.default=ZB});var mg=W(function(mn,pg){Object.defineProperty(mn,"__esModule",{value:!0});mn.MissingRefError=mn.ValidationError=mn.CodeGen=mn.Name=mn.nil=mn.stringify=mn.str=mn._=mn.KeywordCxt=mn.Ajv2020=void 0;var ez=eg(),tz=VO(),nz=fg(),rz=rA(),dg="https://json-schema.org/draft/2020-12/schema";class Cc extends ez.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){if(super._addVocabularies(),tz.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(nz.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:t}=this.opts;if(!t)return;rz.default.call(this,e),this.refs["http://json-schema.org/schema"]=dg}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(dg)?dg:void 0)}}mn.Ajv2020=Cc;pg.exports=mn=Cc;pg.exports.Ajv2020=Cc;Object.defineProperty(mn,"__esModule",{value:!0});mn.default=Cc;var sz=Xi();Object.defineProperty(mn,"KeywordCxt",{enumerable:!0,get:function(){return sz.KeywordCxt}});var la=ge();Object.defineProperty(mn,"_",{enumerable:!0,get:function(){return la._}});Object.defineProperty(mn,"str",{enumerable:!0,get:function(){return la.str}});Object.defineProperty(mn,"stringify",{enumerable:!0,get:function(){return la.stringify}});Object.defineProperty(mn,"nil",{enumerable:!0,get:function(){return la.nil}});Object.defineProperty(mn,"Name",{enumerable:!0,get:function(){return la.Name}});Object.defineProperty(mn,"CodeGen",{enumerable:!0,get:function(){return la.CodeGen}});var oz=_c();Object.defineProperty(mn,"ValidationError",{enumerable:!0,get:function(){return oz.default}});var iz=Zi();Object.defineProperty(mn,"MissingRefError",{enumerable:!0,get:function(){return iz.default}})});import{existsSync as qf,readFileSync as iA}from"node:fs";import{createRequire as sA}from"node:module";import{basename as lz,isAbsolute as uz,relative as fz,resolve as hg}from"node:path";import{fileURLToPath as oA,pathToFileURL as dz}from"node:url";function Vf(e){return JSON.parse(iA(e,"utf8"))}async function aA(e){let t=hg(e),n=Rn(t),r=hg(t,"project.schema.json");if(!qf(n))throw Error(`No project.jxn or project.json in ${t}`);if(!qf(r))throw Error(`project.schema.json not found in ${t} — run \`jx schema\` to generate it from `+"the project file's extensions");let s=wl(iA(n,"utf8"),n),o=Vf(r);o.$id=dz(r).href;let i;try{({default:i}=await Promise.resolve().then(() => Jr(mg(),1)))}catch(d){throw Error("Project validation requires ajv: bun add ajv",{cause:d})}let c=await new i({allErrors:!0,loadSchema:(d)=>hz(d,t),strict:!1}).compileAsync(o),l=c(s),u=c.errors??null;return{errors:u&&qr(n)?mz(u,s):u,file:lz(n),valid:l}}function pz(e,t){let n=e;for(let r of t.split("/").slice(1)){let s=r.replaceAll("~1","/").replaceAll("~0","~");n=Array.isArray(n)?n[Number(s)]:V(n)?n[s]:void 0}return n}function mz(e,t){return e.map((n)=>{if(!D(n)||!("keyword"in n)||n.keyword!=="type"||!("params"in n)||!D(n.params)||!("type"in n.params)||n.params.type!=="array"||!("instancePath"in n)||!k(n.instancePath))return n;let r=pz(t,n.instancePath),s=rt(r,"",n.instancePath),o=n.instancePath.split("/").at(-1)??"";if(s===null||s.includes(`
624
- `)||o==="")return n;return{...n,message:`must be a list, written as ${o} { - ${s} }`}})}async function hz(e,t){if(!e.startsWith("file:"))throw Error(`Cannot resolve schema ref "${e}": only project-relative file refs are loadable (canonical URIs must resolve from already-loaded fragments)`);let n=oA(e),r=fz(t,n);if(r.startsWith("..")||uz(r))throw Error(`Schema ref "${e}" escapes the project root ${t}`);if(qf(n))return Vf(n);let s=r.split("\\").join("/"),o="node_modules/",i=s.lastIndexOf(o);if(i===-1)throw Error(`Schema ref "${e}" does not exist`);let a=s.slice(i+o.length),c="@jxsuite/schema/",l;try{l=sA(hg(t,"package.json")).resolve(a)}catch(u){if(!a.startsWith(c))throw Error(`Schema ref "${e}" does not exist and "${a}" is not resolvable from the `+"project — is the package installed?",{cause:u});try{l=sA(import.meta.url).resolve(a)}catch(d){let p=oA(new URL(`../${a.slice(c.length)}`,import.meta.url));if(qf(p))return Vf(p);throw Error(`Schema ref "${e}" does not exist and "${a}" is not resolvable from the project or this host's core`,{cause:d})}}return Vf(l)}var cA=T(()=>{le();dl();bl();Sl();po()});function Ar(e){return V(e.attributes)?e.attributes:{}}function Ht(e,t){let n=Ar(e)[t];return k(n)?n:null}function yt(e){return k(e.tagName)?e.tagName.toLowerCase():""}function en(e,t="the popover"){let n=k(e.id)?e.id:Ht(e,"id");if(n)return`#${n}`;let r=yt(e);return r===""?t:`the <${r}>`}function xz(e){let t=Ar(e).popover;return k(t)?t:null}function uA(e){let t=new Set,n=new Set;for(let r of e){let s=r!==null&&k(r.tagName)?r.tagName:"";if(r===null||!s.includes("-"))continue;if(gg(r))t.add(s);let o=r.observedAttributes;if(Array.isArray(o)&&bz.every((i)=>o.includes(i)))n.add(s)}return{invokerTags:n,popoverTags:t}}function gg(e){return"popover"in Ar(e)||"popover"in e}function Nc(e,t){return gg(e)||(t?.popoverTags?.has(yt(e))??!1)}function zs(e){if(k(e.id)&&e.id!=="")return e.id;let t=Ht(e,"id");return t===""?null:t}function*Or(e,t=[],n=null,r){yield{enclosing:n,node:e,path:t};let s=Nc(e,r)?e:n,{children:o}=e;if(Array.isArray(o)){for(let[c,l]of o.entries())if(D(l))yield*Or(l,[...t,"children",c],s,r)}else if(V(o)&&nn(o.map))yield*Or(o.map,[...t,"children","map"],s,r);let i=nn(e.map)?e.map:null;if(i)yield*Or(i,[...t,"map"],s,r);let a=V(e.cases)?e.cases:{};for(let[c,l]of Object.entries(a))if(D(l))yield*Or(l,[...t,"cases",c],s,r)}function yg(e,t){let n=[];for(let{node:r}of Or(e,[],null,t)){if(!Nc(r,t))continue;let s=zs(r);if(s!==null&&!n.includes(s))n.push(s)}return n}function Wf(e){return e.startsWith("@")}function fA(e){return e.startsWith(":")||e.startsWith("&")||e.startsWith(".")||e.startsWith("[")}function Qt(e,t){let n=e?.[t];if(n===void 0||no(n)||Array.isArray(n))return null;return String(n)}function dA(e){for(let[t,n]of Object.entries(e??{})){if(!no(n))continue;if(fA(t)&&t.includes(":popover-open")&&Qt(n,"display")!==null)return!0;if(Wf(t)&&dA(n))return!0}return!1}function pA(e){for(let[t,n]of Object.entries(e??{})){if(!no(n))continue;if(fA(t)&&t.includes(":popover-open"))return!0;if(Wf(t)&&pA(n))return!0}return!1}function wz(e){return $z.some((t)=>Qt(e,t)!==null)}function Sz(e){if(!e)return[];let t=[];for(let[n,r]of Object.entries(e))if(Wf(n)&&no(r)&&Qt(r,"display")!==null)t.push(n);return t}function mA(e){if(!e)return[];let t=[],n=Qt(e,"transition");if(n!==null)t.push(n);for(let[r,s]of Object.entries(e))if(Wf(r)&&no(s))t.push(...mA(s));return t}function vz(e){if(!e)return!1;if(Qt(e,"positionAnchor")!==null||Qt(e,"position-anchor")!==null)return!0;return["top","left","right","bottom","inset","insetBlockStart","insetInlineStart"].some((t)=>(Qt(e,t)??"").includes("anchor("))}function Ez(e){if(!e)return!1;if(Qt(e,"positionArea")!==null||Qt(e,"position-area")!==null||Qt(e,"positionTryFallbacks")!==null||Qt(e,"position-try-fallbacks")!==null)return!0;return Object.keys(e).some((t)=>t.startsWith("@supports"))}function hA(e,t){let n=[...Or(e,[],null,t)],r=yg(e,t),s=n.some(({node:a})=>Nc(a,t)),o=new Set;for(let{node:a}of n)if(lA.has(yt(a))){let c=Ht(a,"popovertarget");if(c!==null)o.add(c)}let i=[];for(let{enclosing:a,node:c,path:l}of n)if(i.push(...jz(c,l,a,r,s,t)),gg(c))i.push(...Pz(c,l,o));return i}function jz(e,t,n,r,s,o){let i=[],a=yt(e),c=Ht(e,"popovertarget"),l=lA.has(a)||(o?.invokerTags?.has(a)??!1);if(c!==null&&!l)return i.push({detail:"`popovertarget` and `popovertargetaction` come from the `PopoverTargetAttributes` IDL mixin, which HTML includes into `HTMLButtonElement` and `HTMLInputElement` and into nothing else. Elsewhere they parse and do nothing. A link inside an open popover "+"dismisses it by navigating away, which is why this looks like it works — but it does "+`not for a new tab or a same-page fragment. Remove both attributes. ${Ze}`,fix:"invoker",message:`<${a||"element"}> carries popovertarget, which only <button> and <input> support.`,path:t,rule:"invoker-not-button",severity:"error"}),i;if(c!==null){if(s&&!r.includes(c)){let u=r.length>0?`The popovers here are: ${r.map((d)=>`"${d}"`).join(", ")}. `:"";i.push({detail:`No element in this document declares \`popover\` with the id "${c}". ${u}A target that names nothing does nothing, silently. ${Ze}`,message:`popovertarget="${c}" names no popover in this document.`,path:t,rule:"target-missing",severity:"error"})}else if(n!==null&&zs(n)!==null&&zs(n)!==c)i.push({detail:`This control is inside ${en(n)} but targets "${c}". Dismissing a different popover leaves the one the reader is looking at open. This is usually a copy-paste between two panels in the same file. ${Ze}`,message:`A control inside ${en(n)} targets "${c}" instead.`,path:t,rule:"target-mismatch",severity:"warn"})}if(a==="a"&&n!==null&&c===null){let u=Ht(e,"href")??(k(e.href)?e.href:null),d=Ht(e,"target")==="_blank",p=u!==null&&u.includes("#");if(d||p){let m=d?"it opens a new tab, so the panel stays open on the page behind it. ":"it is a same-document fragment, so the page scrolls behind the open panel. ";i.push({detail:`A link inside a panel normally dismisses it by navigating away. This one does not: ${m}`+"There is no declarative fix — a link cannot carry `popovertarget`. Move it out of the "+`panel, make it a <button>, or accept it deliberately. ${Ze}`,message:`A link inside ${en(n)} does not dismiss it.`,path:t,rule:"link-does-not-dismiss",severity:"warn"})}}return i}function Pz(e,t,n){let r=[],{style:s}=e,o=en(e),i=xz(e);if(i!==null&&i!==""&&!yz.some((l)=>l===i))r.push({detail:"`popover` is an enumerated attribute taking `auto`, `manual` or `hint`. Anything else falls back to the invalid-value default `manual`, which gives up light dismiss and gives "+`up Escape — so the panel opens and there is no way to close it. Write "auto". ${Ze}`,fix:"mode",message:`${o} declares popover="${i}", which is not one of auto, manual or hint.`,path:t,rule:"invalid-mode",severity:"error"});else if(Mt(Ar(e).popover))r.push({detail:`\`popover\` carries its value in its text, so a boolean is not the right shape. Written as \`true\` it reaches two of the compiler's emitters as \`popover="true"\`, which is not one of the three keywords, so HTML falls back to \`manual\`: no light dismiss, no Escape, and the trigger stops toggling. Write "auto". ${Ze}`,fix:"mode",message:`${o} writes popover as a boolean.`,path:t,rule:"invalid-mode",severity:"error"});let a=Qt(s,"display");if(a!==null&&a!=="revert"&&a!=="revert-layer")r.push({detail:"A closed popover is hidden by the browser's own `[popover]:not(:popover-open) { display: none }`. That rule is UA-origin, so any author `display` beats it at any specificity, and "+"the panel is laid out on every page whether it is open or not — usually parked off the "+`side of the viewport by the transform meant to animate it, so nothing looks wrong until you scroll sideways. \`display\` belongs in \`:popover-open\` and nowhere else. ${Ze}`,fix:"display",message:`${o} sets display in its base rule.`,path:t,rule:"base-display",severity:"error"});for(let l of Sz(s))r.push({detail:`The same defect as a base \`display\`, arriving through \`${l}\` and therefore only at `+"one width — which is what makes it hard to see. Gate the TRIGGER on a breakpoint, never "+`the panel: the popover mechanism is what hides the panel. ${Ze}`,fix:"display",message:`${o} sets display inside ${l}.`,path:t,rule:"breakpoint-display",severity:"error"});if(Qt(s,"visibility")!==null)r.push({detail:`A second hiding mechanism the browser already provides. Once \`display\` leaves the base rule this one only adds a frame of flicker on open, and it hides the element from assistive technology in a way \`display: none\` already did. ${Ze}`,fix:"display",message:`${o} also hides itself with visibility.`,path:t,rule:"base-visibility",severity:"warn"});if(!pA(s))r.push({detail:"Nothing changes when it opens, so no transition on it can run and — if `display` is not "+"in the base rule — the panel has no `display` at all while open. This is usually a panel "+`that was styled before it was made a popover. ${Ze}`,message:`${o} has no :popover-open rule.`,path:t,rule:"no-open-rule",severity:"warn"});else if(!dA(s)&&a===null&&wz(s))r.push({detail:`${o} declares flex or grid properties, but neither its base rule nor its `+"`:popover-open` rule sets a `display` for them to apply to — and the base rule must not "+`(that is what keeps the closed panel hidden). So it opens with the UA's \`display: block\` and the layout silently does nothing. Put \`display: flex\` in \`:popover-open\`. ${Ze}`,fix:"open-display",message:`${o} is laid out with flex or grid but never sets display.`,path:t,rule:"no-open-display",severity:"error"});for(let l of mA(s))if(l.includes("display")&&!l.includes("overlay")){r.push({detail:"`display …allow-discrete` keeps the box alive while it animates out; `overlay "+"…allow-discrete` is what keeps it in the TOP LAYER for those same milliseconds. "+`Without it the panel drops behind the page content and the backdrop disappears a frame early, so the exit reads as a flicker rather than an animation. ${Ze}`,message:`${o} transitions display but not overlay.`,path:t,rule:"cut-exit",severity:"warn"});break}if(vz(s)&&!Ez(s))r.push({detail:"When `anchor()` does not resolve, every inset it feeds computes to `auto` — and a "+`\`position: fixed\` box with four \`auto\` insets falls back to its STATIC position, which for a panel declared inside a header is in the middle of the header. Use \`position-area\` with \`position-try-fallbacks\`, or add a \`@supports\` block that positions it without anchors. ${Ze}`,message:`${o} is anchor-positioned with no fallback.`,path:t,rule:"unsafe-anchor",severity:"warn"});let c=zs(e);if(c!==null&&!n.has(c))r.push({detail:`No \`<button>\` or \`<input>\` in this document names it with \`popovertarget\`. If it is opened from another file or from a function that calls \`showPopover()\`, this is fine; otherwise there is no way for a reader to open it. ${Ze}`,message:`${o} has no invoker in this document.`,path:t,rule:"no-invoker",severity:"warn"});return r}var yz,lA,bz,$z,Ze="See docs/framework/concepts/overlays.";var Hf=T(()=>{le();yz=["auto","manual","hint"],lA=new Set(["button","input"]);bz=["popovertarget","popovertargetaction","command","commandfor"];$z=["flexDirection","flex-direction","alignItems","align-items","justifyContent","justify-content","flexWrap","flex-wrap","gridTemplateColumns","grid-template-columns","gridTemplateRows","grid-template-rows","gap"]});function pa(e,t){let n=Ar(e),r=t in n?n[t]:e[t];if(r===void 0||r===null)return{kind:"absent"};if(Ne(r)||V(r))return{kind:"bound"};if(k(r))return r.includes("${")?{kind:"bound"}:{kind:"text",text:r};return{isTrue:r===!0,kind:"other"}}function fa(e,t){let n=pa(e,t);return n.kind==="text"&&n.text.trim()!==""?n.text:null}function Ut(e,t){return pa(e,t).kind!=="absent"}function Ks(e){let t=pa(e,"role");if(t.kind==="bound")return da;return t.kind==="text"?t.text.trim().toLowerCase().split(/\s+/)[0]:null}function Uf(e){let t=pa(e,"id");if(t.kind==="bound")return da;return t.kind==="text"&&t.text!==""?t.text:null}function qn(e,t){let n=pa(e,t);return n.kind==="bound"||n.kind==="text"&&n.text.trim()!==""}function Bf(e){let t=e.textContent;if(k(t)){if(t.trim()!=="")return!0}else if(t!==void 0&&t!==null)return!0;if(qn(e,"aria-label")||Ut(e,"aria-labelledby"))return!0;if(yt(e)==="img"&&(qn(e,"alt")||qn(e,"title")))return!0;if(yt(e)==="slot")return!0;let{children:n}=e;if(Array.isArray(n)){for(let s of n)if(k(s)){if(s.trim()!=="")return!0}else if(D(s)&&Bf(s))return!0}else if(n!=null)return!0;if(V(e.map))return!0;return(V(e.cases)?Object.values(e.cases):[]).some((s)=>nn(s)&&Bf(s))}function*ua(e,t=[],n=[],r=[]){yield{node:e,path:t,roles:n,tags:r};let s=[...n,Ks(e)],o=[...r,yt(e)],{children:i}=e;if(Array.isArray(i)){for(let[a,c]of i.entries())if(D(c))yield*ua(c,[...t,"children",a],s,o)}else if(V(i)&&nn(i.map))yield*ua(i.map,[...t,"children","map"],s,o);if(nn(e.map))yield*ua(e.map,[...t,"map"],s,o);if(V(e.cases)){for(let[a,c]of Object.entries(e.cases))if(D(c))yield*ua(c,[...t,"cases",a],s,o)}}function Cz(e){return e.some((t)=>t.includes("-"))}function Rr(e,t,n,r,s,o="error"){return{criterion:s,detail:`${r} ${_z}`,message:n,path:t,rule:e,severity:o}}function gA(e,t,n){if(n.includes("label"))return!0;if(e===da||t.bound)return!0;return e!==null&&t.ids.has(e)}function Nz(e,t){let{node:n,path:r,tags:s}=e,o=yt(n),i=Ks(n);if(i==="bound")return null;if(qn(n,"aria-label")||Ut(n,"aria-labelledby")||qn(n,"title"))return null;let c=en(n,"the control"),l=(d)=>Rr("interactive-unnamed",r,`${c} has no accessible name.`,`A control with no name is announced as its role alone, so a reader hears "button" and nothing else. ${d}`,"4.1.2"),u=Tz(n,o,t,s);if(u==="named"||u==="exempt")return null;if(i!==null&&kz.has(i))return Bf(n)?null:l("Give it text content, or an aria-label.");if(i!==null&&Oz.has(i))return l("Give it an aria-label, or aria-labelledby naming its visible label.");if(i!==null)return null;if(o==="button"||o==="summary"||o==="a"&&Ut(n,"href"))return Bf(n)?null:l("Give it text content, or an aria-label.");if(u==="unnamed")return l("Give it a <label for> naming its id, or an aria-label.");if(u==="unnamed-value")return l("Give it a value, or an aria-label.");if(u==="unnamed-alt")return l("Give it an alt, or an aria-label.");return null}function Tz(e,t,n,r){if(t==="area"){if(!Ut(e,"href"))return"none";return qn(e,"alt")?"named":"unnamed-alt"}if(t==="select"||t==="textarea")return gA(Uf(e),n,r)||qn(e,"placeholder")?"named":"unnamed";if(t!=="input")return"none";let s=(fa(e,"type")??"text").toLowerCase();if(s==="hidden"||Ut(e,"type")&&fa(e,"type")===null)return"exempt";if(Az.has(s))return qn(e,"value")?"named":"unnamed-value";if(s==="image")return qn(e,"alt")?"named":"unnamed-alt";return gA(Uf(e),n,r)||qn(e,"placeholder")?"named":"unnamed"}function Iz(e){let{node:t,path:n,tags:r}=e,s=yt(t);if(!s.includes("-")||!r.some((o)=>Jz.has(o)))return null;return Rr("custom-element-in-select",n,`<${s}> is a custom element inside a <select>.`,'A <select> builds its own rows: an element it does not know is not in select.options, so it cannot be picked, cannot be reached with the arrow keys, and fires no change event — while role="option" on it still makes the accessibility tree read as though it could. Every row of a <select> is a native <option>; a listbox whose rows are jx-option elements is a jx-listbox.',"4.1.2")}function Mz(e){let{node:t,path:n}=e;if(yt(t)!=="img")return null;let r=Ks(t);if(r==="bound"||r==="presentation"||r==="none")return null;if(Ut(t,"alt")||qn(t,"aria-label")||Ut(t,"aria-labelledby"))return null;return Rr("img-alt-missing",n,`${en(t,"the image")} has no alt text.`,'An image with no alt is announced by its file name. Describe it in alt, or write alt="" for a decorative one.',"1.1.1")}function Fz(e,t){let{node:n,path:r}=e,s=[];for(let o of Dz){let i=fa(n,o);if(i===null)continue;for(let a of i.split(/\s+/))if(a!==""&&!t.has(a))s.push(Rr("aria-target-missing",r,`${en(n,"the element")} points ${o} at #${a}, which nothing in this document has as its id.`,"A reference to an id that is not in the document is silently dropped, so the relationship it declares does not exist. Name an element that is here, or give that element the id.","1.3.1"))}return s}function Lz(e,t,n){for(let r of yA.get(t)??[]){let s=n.get(r);if(s===void 0)continue;if(s.bound)return!0;if(e===da&&s.ids.size>0)return!0;if(e!==null&&e!==da&&s.ids.has(e))return!0}return!1}function Vz(e,t){let{node:n,path:r,roles:s,tags:o}=e,i=Ks(n);if(i===null||i==="bound"||r.length===0||Cz(o))return null;if(s.includes("bound")||Lz(Uf(n),i,t))return null;let a=en(n,"the element");if(i==="tab"&&!s.includes("tablist"))return Rr("tab-outside-tablist",r,`${a} is a tab outside any tablist.`,'A tab is announced with its position in a tablist, so one with no tablist ancestor has no place to be counted in. Put the tabs in a container with role="tablist".',"1.3.1");if((i==="menuitem"||i==="menuitemcheckbox"||i==="menuitemradio")&&!s.includes("menu")&&!s.includes("menubar"))return Rr("menuitem-outside-menu",r,`${a} is a ${i} outside any menu.`,'A menu item is owned by a menu, and is announced as one of its items. Put it in a container with role="menu" or role="menubar".',"1.3.1");if(i==="option"&&!s.includes("listbox")&&!o.includes("select")&&!o.includes("datalist"))return Rr("option-outside-listbox",r,`${a} is an option outside any listbox.`,'An option is owned by a listbox, and is announced as one of its choices. Put it in a container with role="listbox", or in a <select>.',"1.3.1");return null}function qz(e){let t=[];for(let{node:n}of ua(e)){if(Ks(n)!=="tab")continue;let r=pa(n,"aria-selected");if(r.kind==="bound")return null;t.push(r.kind==="other"&&r.isTrue||r.kind==="text"&&r.text==="true")}return t}function Wz(e){let{node:t,path:n}=e;if(Ks(t)!=="tablist")return null;let r=qz(t);if(r===null||r.length===0||r.includes(!0))return null;return Rr("tablist-none-selected",n,`${en(t,"the tablist")} has ${r.length} tab(s) and none is selected.`,'A tablist always has a current tab, and aria-selected="true" is how it is announced. Mark the tab whose panel is showing.',"4.1.2","warn")}function Hz(e){let{node:t,path:n}=e,r=Ks(t);if(!(yt(t)==="dialog"||r==="dialog"||r==="alertdialog")||r==="bound")return null;if(qn(t,"aria-label")||Ut(t,"aria-labelledby"))return null;return Rr("dialog-unnamed",n,`${en(t,"the dialog")} has no accessible name.`,"A dialog is announced by its name when it opens, and its content does not name it. Give it aria-labelledby naming its heading, or an aria-label.","4.1.2")}function Bz(e){let{node:t,path:n}=e;if(!Ut(t,"aria-activedescendant"))return null;let r=yt(t);if(Uz.has(r)||r==="a"&&Ut(t,"href")||Ut(t,"tabIndex")||Ut(t,"tabindex")||Ut(t,"contenteditable"))return null;return Rr("activedescendant-not-focusable",n,`${en(t,"the element")} manages focus with aria-activedescendant but cannot itself take focus.`,"aria-activedescendant names the active child of a FOCUSED container; on one that cannot be focused, the keyboard never reaches it. Give the container a tabindex.","2.1.1")}function xA(e){let t=[...ua(e)],n=new Set,r={bound:!1,ids:new Set},s=new Map,o=!1;for(let{node:a}of t){let c=Ks(a);if(c!==null&&Rz.has(c)){let u=s.get(c)??{bound:!1,ids:new Set},d=fa(a,"aria-owns");if(d===null)u.bound||=Ut(a,"aria-owns");else for(let p of d.split(/\s+/))if(p!=="")u.ids.add(p);s.set(c,u)}let l=Uf(a);if(l===da)o=!0;else if(l!==null)n.add(l);if(yt(a)==="label"){let u=fa(a,"for")??fa(a,"htmlFor");if(u===null)r.bound||=Ut(a,"for")||Ut(a,"htmlFor");else r.ids.add(u)}}let i=[];for(let a of t){let c=[Nz(a,r),Mz(a),Vz(a,s),Iz(a),Wz(a),Hz(a),Bz(a)];for(let l of c)if(l)i.push(l);if(!o)i.push(...Fz(a,n))}return i}var _z="See docs/framework/concepts/accessibility.",da="bound",kz,Oz,Az,yA,Rz,Jz,Dz,Uz;var bA=T(()=>{le();Hf();kz=new Set(["button","checkbox","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","switch","tab","treeitem"]),Oz=new Set(["combobox","listbox","searchbox","slider","spinbutton","textbox"]),Az=new Set(["button","reset","submit"]),yA=new Map([["menuitem",["menu","menubar"]],["menuitemcheckbox",["menu","menubar"]],["menuitemradio",["menu","menubar"]],["option",["listbox"]],["tab",["tablist"]]]),Rz=new Set([...yA.values()].flat());Jz=new Set(["select","jx-select"]);Dz=["aria-activedescendant","aria-controls","aria-describedby","aria-details","aria-errormessage","aria-flowto","aria-labelledby","aria-owns"];Uz=new Set(["button","input","select","textarea"])});function xg(e){return yt(e)==="dialog"}function $A(e){return e.startsWith("--")}function Qz(e){let t=[];for(let{node:n}of Or(e)){let r=zs(n);if(xg(n)&&r!==null&&!t.includes(r))t.push(r)}return t}function e8(e){let t=e.oncommand;return t!==void 0&&t!==null}function t8(e,t){for(let{node:n}of Or(e)){if(n===e)continue;let r=yt(n);if(r==="button"){let s=Ht(n,"command"),o=Ht(n,"commandfor");if(s!==null&&(s==="close"||s==="request-close")&&(o===null||o===t))return!0}if(r==="form"&&Ht(n,"method")?.toLowerCase()==="dialog")return!0}return!1}function SA(e,t){let n=[...Or(e,[],null,t)],r=Qz(e),s=yg(e,t),o=r.length>0||s.length>0,i=new Map,a=new Map;for(let{node:l}of n){let u=zs(l);if(u!==null&&!i.has(u))i.set(u,l);if(yt(l)==="button"){let d=Ht(l,"commandfor"),p=Ht(l,"command");if(d!==null){let m=a.get(d)??new Set;m.add(p??""),a.set(d,m)}}}let c=[];for(let{node:l,path:u}of n)if(c.push(...n8(l,u,i,r,s,o,t)),xg(l))c.push(...r8(l,u,a));return c}function n8(e,t,n,r,s,o,i){let a=[],c=yt(e),l=i?.invokerTags?.has(c)??!1,u=Ht(e,"command"),d=Ht(e,"commandfor");if(!(u!==null||d!==null||("command"in Ar(e))||("commandfor"in Ar(e))))return a;let m=en(e,"the element");if(!Zz.has(c)&&!l)return a.push({detail:"`command` and `commandfor` are attributes of `HTMLButtonElement` and of no other "+"interface — not even `<input>`, which `popovertarget` does allow. Elsewhere they parse "+`and do nothing. Make it a <button>, or remove both attributes. ${Ze}`,fix:"invoker",message:`<${c||"element"}> carries command/commandfor, which only <button> supports.`,path:t,rule:"invoker-not-button",severity:"error"}),a;if(u!==null&&!Xz.has(u)&&!$A(u))return a.push({detail:`\`command\` is an enumerated attribute taking ${wA.map((x)=>`\`${x}\``).join(", ")}, or a custom command starting with \`--\`. Anything else is the invalid-value state, and a button in that state does nothing when clicked. ${Ze}`,message:`${m} declares command="${u}", which is not a built-in or --custom command.`,path:t,rule:"command-invalid",severity:"error"}),a;if(d!==null){let x=n.get(d),h=r.includes(d),g=s.includes(d);if(!x&&o){let b=[...r,...s].map((j)=>`"${j}"`).join(", ");return a.push({detail:`No element in this document has the id "${d}". The dialogs and popovers here are: ${b}. A commandfor that names nothing does nothing, silently. ${Ze}`,message:`commandfor="${d}" names nothing in this document.`,path:t,rule:"command-target-missing",severity:"error"}),a}if(u!==null&&x){if(zz.has(u)&&!xg(x))a.push({detail:`\`${u}\` acts on a <dialog>, and "${d}" is ${g?"a popover":`a <${yt(x)||"element"}>`}. The click is ignored. ${g?"Use `toggle-popover`, `show-popover` or `hide-popover` for a popover.":"Point it at a dialog, or make the target one."} ${Ze}`,message:`${m} sends ${u} to "${d}", which is not a dialog.`,path:t,rule:"command-target-mismatch",severity:"error"});else if(Kz.has(u)&&!Nc(x,i))a.push({detail:`\`${u}\` acts on a popover, and "${d}" is ${h?"a dialog":`a <${yt(x)||"element"}>`} that declares no \`popover\`. The click is ignored. ${h?"Use `show-modal`, `close` or `request-close` for a dialog.":"Give the target a `popover` attribute, or point the button elsewhere."} ${Ze}`,message:`${m} sends ${u} to "${d}", which is not a popover.`,path:t,rule:"command-target-mismatch",severity:"error"});else if($A(u)&&!e8(x))a.push({detail:`A custom command is a \`CommandEvent\` dispatched at its target, and "${d}" has no `+"`oncommand` handler to answer it — so the click does nothing. Add one that switches on "+`\`event#/command\`, or use a built-in command. ${Ze}`,message:`${m} sends ${u} to "${d}", which handles no command.`,path:t,rule:"custom-command-unhandled",severity:"warn"})}}return a}function r8(e,t,n){let r=[],s=en(e,"the dialog"),o=zs(e),{style:i}=e,a=Ht(e,"closedby");if(a!==null&&!Yz.has(a))r.push({detail:`\`closedby\` is an enumerated attribute taking \`any\` (light dismiss and Escape), \`closerequest\` (Escape only, the default for a modal) or \`none\`. Anything else is the invalid-value default, \`auto\`, which is the same as leaving it out. ${Ze}`,message:`${s} declares closedby="${a}", which is not any, closerequest or none.`,path:t,rule:"dialog-closedby-invalid",severity:"error"});if(Qt(i,"display")!==null)r.push({detail:`A closed dialog is hidden by the browser's own \`dialog:not([open]) { display: none }\`. That rule is UA-origin, so any author \`display\` beats it, and the dialog is laid out on every page whether or not anyone opened it. \`display\` belongs in the \`&[open]\` rule and nowhere else. ${Ze}`,fix:"display",message:`${s} sets display in its base rule.`,path:t,rule:"dialog-display",severity:"error"});let c=o===null?void 0:n.get(o),l=Ht(e,"open")!==null||Ar(e).open===!0||e.open===!0;if(o!==null&&!c?.has("show-modal")&&!l)r.push({detail:`No <button> in this document opens it with \`command="show-modal"\`. If it is opened from another file or from a function that calls \`showModal()\`, this is fine; otherwise there is no way for a reader to open it. ${Ze}`,message:`${s} has no invoker in this document.`,path:t,rule:"dialog-no-invoker",severity:"warn"});if(c?.has("show-modal")&&a==="none"&&!t8(e,o))r.push({detail:`A modal dialog makes everything outside it inert, so the only ways out are the ones it offers: \`closedby="none"\` turns off Escape and light dismiss, and nothing inside it closes it. A reader who opens it cannot leave. Add a <button command="close"> inside, or drop \`closedby="none"\`. ${Ze}`,message:`${s} opens modally, closes on nothing, and has no close button.`,path:t,rule:"modal-without-close",severity:"error"});return r}var wA,zz,Kz,Gz,Xz,Yz,Zz;var vA=T(()=>{le();Hf();wA=["toggle-popover","show-popover","hide-popover","show-modal","close","request-close"],zz=new Set(["show-modal","close","request-close"]),Kz=new Set(["toggle-popover","show-popover","hide-popover"]),Gz=["any","closerequest","none"],Xz=new Set(wA),Yz=new Set(Gz),Zz=new Set(["button"])});var NA=W(function(RA){Object.defineProperty(RA,"__esModule",{value:!0});RA.formatNames=RA.fastFormats=RA.fullFormats=void 0;function Cr(e,t){return{validate:e,compare:t}}RA.fullFormats={date:Cr(_A,Sg),time:Cr($g(!0),vg),"date-time":Cr(EA(!0),OA),"iso-time":Cr($g(),kA),"iso-date-time":Cr(EA(),AA),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:l8,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:g8,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:u8,int32:{type:"number",validate:p8},int64:{type:"number",validate:m8},float:{type:"number",validate:PA},double:{type:"number",validate:PA},password:!0,binary:!0};RA.fastFormats={...RA.fullFormats,date:Cr(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Sg),time:Cr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,vg),"date-time":Cr(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,OA),"iso-time":Cr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,kA),"iso-date-time":Cr(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,AA),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};RA.formatNames=Object.keys(RA.fullFormats);function s8(e){return e%4===0&&(e%100!==0||e%400===0)}var o8=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i8=[0,31,28,31,30,31,30,31,31,30,31,30,31];function _A(e){let t=o8.exec(e);if(!t)return!1;let n=+t[1],r=+t[2],s=+t[3];return r>=1&&r<=12&&s>=1&&s<=(r===2&&s8(n)?29:i8[r])}function Sg(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var bg=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function $g(e){return function(n){let r=bg.exec(n);if(!r)return!1;let s=+r[1],o=+r[2],i=+r[3],a=r[4],c=r[5]==="-"?-1:1,l=+(r[6]||0),u=+(r[7]||0);if(l>23||u>59||e&&!a)return!1;if(s<=23&&o<=59&&i<60)return!0;let d=o-u*c,p=s-l*c-(d<0?1:0);return(p===23||p===-1)&&(d===59||d===-1)&&i<61}}function vg(e,t){if(!(e&&t))return;let n=new Date("2020-01-01T"+e).valueOf(),r=new Date("2020-01-01T"+t).valueOf();if(!(n&&r))return;return n-r}function kA(e,t){if(!(e&&t))return;let n=bg.exec(e),r=bg.exec(t);if(!(n&&r))return;if(e=n[1]+n[2]+n[3],t=r[1]+r[2]+r[3],e>t)return 1;if(e<t)return-1;return 0}var wg=/t|\s/i;function EA(e){let t=$g(e);return function(r){let s=r.split(wg);return s.length===2&&_A(s[0])&&t(s[1])}}function OA(e,t){if(!(e&&t))return;let n=new Date(e).valueOf(),r=new Date(t).valueOf();if(!(n&&r))return;return n-r}function AA(e,t){if(!(e&&t))return;let[n,r]=e.split(wg),[s,o]=t.split(wg),i=Sg(n,s);if(i===void 0)return;return i||vg(r,o)}var a8=/\/|:/,c8=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function l8(e){return a8.test(e)&&c8.test(e)}var jA=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function u8(e){return jA.lastIndex=0,jA.test(e)}var f8=-2147483648,d8=2147483647;function p8(e){return Number.isInteger(e)&&e<=d8&&e>=f8}function m8(e){return Number.isInteger(e)}function PA(){return!0}var h8=/[^\\]\\Z/;function g8(e){if(h8.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var JA=W(function(TA){Object.defineProperty(TA,"__esModule",{value:!0});var x8=tg(),b8=ng(),$8=ig(),w8=lg(),zf=ug(),S8=[x8.default,b8.default,(0,$8.default)(),w8.default,zf.metadataVocabulary,zf.contentVocabulary];TA.default=S8});var IA=W(function(Zee,E8){E8.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var DA=W(function(hn,jg){Object.defineProperty(hn,"__esModule",{value:!0});hn.MissingRefError=hn.ValidationError=hn.CodeGen=hn.Name=hn.nil=hn.stringify=hn.str=hn._=hn.KeywordCxt=hn.Ajv=void 0;var j8=eg(),P8=JA(),_8=fg(),MA=IA(),k8=["/properties"],Kf="http://json-schema.org/draft-07/schema";class Tc extends j8.default{_addVocabularies(){if(super._addVocabularies(),P8.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(_8.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(MA,k8):MA;this.addMetaSchema(e,Kf,!1),this.refs["http://json-schema.org/schema"]=Kf}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Kf)?Kf:void 0)}}hn.Ajv=Tc;jg.exports=hn=Tc;jg.exports.Ajv=Tc;Object.defineProperty(hn,"__esModule",{value:!0});hn.default=Tc;var O8=Xi();Object.defineProperty(hn,"KeywordCxt",{enumerable:!0,get:function(){return O8.KeywordCxt}});var ma=ge();Object.defineProperty(hn,"_",{enumerable:!0,get:function(){return ma._}});Object.defineProperty(hn,"str",{enumerable:!0,get:function(){return ma.str}});Object.defineProperty(hn,"stringify",{enumerable:!0,get:function(){return ma.stringify}});Object.defineProperty(hn,"nil",{enumerable:!0,get:function(){return ma.nil}});Object.defineProperty(hn,"Name",{enumerable:!0,get:function(){return ma.Name}});Object.defineProperty(hn,"CodeGen",{enumerable:!0,get:function(){return ma.CodeGen}});var A8=_c();Object.defineProperty(hn,"ValidationError",{enumerable:!0,get:function(){return A8.default}});var R8=Zi();Object.defineProperty(hn,"MissingRefError",{enumerable:!0,get:function(){return R8.default}})});var VA=W(function(LA){Object.defineProperty(LA,"__esModule",{value:!0});LA.formatLimitDefinition=void 0;var FA=DA(),dt=ge(),Gs=dt.operators,Gf={formatMaximum:{okStr:"<=",ok:Gs.LTE,fail:Gs.GT},formatMinimum:{okStr:">=",ok:Gs.GTE,fail:Gs.LT},formatExclusiveMaximum:{okStr:"<",ok:Gs.LT,fail:Gs.GTE},formatExclusiveMinimum:{okStr:">",ok:Gs.GT,fail:Gs.LTE}},T8={message:({keyword:e,schemaCode:t})=>dt.str`should be ${Gf[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>dt._`{comparison: ${Gf[e].okStr}, limit: ${t}}`};LA.formatLimitDefinition={keyword:Object.keys(Gf),type:"string",schemaType:"string",$data:!0,error:T8,code(e){let{gen:t,data:n,schemaCode:r,keyword:s,it:o}=e,{opts:i,self:a}=o;if(!i.validateFormats)return;let c=new FA.KeywordCxt(o,a.RULES.all.format.definition,"format");if(c.$data)l();else u();function l(){let p=t.scopeValue("formats",{ref:a.formats,code:i.code.formats}),m=t.const("fmt",dt._`${p}[${c.schemaCode}]`);e.fail$data(dt.or(dt._`typeof ${m} != "object"`,dt._`${m} instanceof RegExp`,dt._`typeof ${m}.compare != "function"`,d(m)))}function u(){let p=c.schema,m=a.formats[p];if(!m||m===!0)return;if(typeof m!="object"||m instanceof RegExp||typeof m.compare!="function")throw Error(`"${s}": format "${p}" does not define "compare" function`);let x=t.scopeValue("formats",{key:p,ref:m,code:i.code.formats?dt._`${i.code.formats}${dt.getProperty(p)}`:void 0});e.fail$data(d(x))}function d(p){return dt._`${p}.compare(${n}, ${r}) ${Gf[s].fail} 0`}},dependencies:["format"]};var J8=(e)=>(e.addKeyword(LA.formatLimitDefinition),e);LA.default=J8});var UA=W(function(Jc,HA){Object.defineProperty(Jc,"__esModule",{value:!0});var Wn=NA(),M8=VA(),ha=ge(),qA=new ha.Name("fullFormats"),D8=new ha.Name("fastFormats"),_g=(e,t={keywords:!0})=>{if(Array.isArray(t))return WA(e,t,Wn.fullFormats,qA),e;let[n,r]=t.mode==="fast"?[Wn.fastFormats,D8]:[Wn.fullFormats,qA],s=t.formats||Wn.formatNames;if(WA(e,s,n,r),t.keywords)(0,M8.default)(e);return e};_g.get=(e,t="full")=>{let r=(t==="fast"?Wn.fastFormats:Wn.fullFormats)[e];if(!r)throw Error(`Unknown format "${e}"`);return r};function WA(e,t,n,r){var s,o;(s=(o=e.opts.code).formats)!==null&&s!==void 0||(o.formats=ha._`require("ajv-formats/dist/formats").${r}`);for(let i of t)e.addFormat(i,n[i])}HA.exports=Jc=_g;Object.defineProperty(Jc,"__esModule",{value:!0});Jc.default=_g});import{existsSync as KA,readFileSync as Og,readdirSync as GA,statSync as XA}from"node:fs";import{createRequire as F8}from"node:module";import{join as YA,relative as ga,resolve as kg}from"node:path";async function W8(){try{let{default:e}=await Promise.resolve().then(() => Jr(mg(),1)),{default:t}=await Promise.resolve().then(() => Jr(UA(),1));return{addFormats:t,Ajv:e}}catch(e){throw Error("Project validation requires ajv and ajv-formats: bun add ajv ajv-formats",{cause:e})}}async function ZA(e,t={}){let n=kg(e),r=[],s=[],o=0;for(let v of["project.schema.json","document.schema.json"]){let P=kg(n,v);if(!KA(P))continue;o+=1;let S=Ic(P),_=z8(S);if(_.length>0)r.push({errors:_.map(({reason:N,ref:F})=>({message:`$ref "${F}" ${N} — committed entry documents must be self-contained `+"single-resource schemas; regenerate with `jx schema`"})),file:v})}if(r.length>0)return{checked:o,issues:r,lint:s,valid:!1};let i=await aA(n);if(o+=1,!i.valid)r.push({errors:i.errors??[],file:i.file});let{addFormats:a,Ajv:c}=await W8(),{document:l}=await Lv(n,{write:!1}),u=new c({allErrors:!0,ownProperties:!0,strict:!1});a(u);let d=u.compile(l),p=uA(zA(n).flatMap((v)=>{try{return[JSON.parse(Og(v,"utf8"))]}catch{return[]}}));for(let v of L8)for(let P of tR(kg(n,v))){if(P.endsWith(".class.json"))continue;o+=1;let S=H8(P,ga(n,P));if(s.push(...S.warnings),S.failure!==null){r.push(S.failure);continue}let _=S.document,N=BA(_,ga(n,P));if(s.push(...N.warnings),N.failure!==null){r.push(N.failure);continue}if(d(_))s.push(...B8(_,ga(n,P),p));else r.push({errors:d.errors??[],file:ga(n,P)})}let m=new c({allErrors:!0,ownProperties:!0,strict:!1});a(m);let x=m.compile(hh());for(let v of zA(n)){o+=1;let P=Ic(v),S=BA(P,ga(n,v));if(s.push(...S.warnings),S.failure!==null)r.push(S.failure);else if(!x(P))r.push({errors:x.errors??[],file:ga(n,v)})}let{config:h}=ms(n),g=await ps(n,h),b=F8(import.meta.url);for(let v of g.extensions)for(let P of["project","document","fields"]){let S=v.schemas[P];if(!S)continue;o+=1;let _=new c({allErrors:!0,ownProperties:!0,strict:!1});a(_);for(let N of q8){let F=b.resolve(N);_.addSchema(Ic(F))}try{_.compile(Ic(S))}catch(N){r.push({errors:[{message:N instanceof Error?N.message:String(N)}],file:`${v.specifier} (${P} fragment)`})}}let j=t.strict===!0&&s.some((v)=>v.severity==="error");return{checked:o,issues:r,lint:s,valid:r.length===0&&!j}}function H8(e,t){if(!qr(e))return{document:Ic(e),failure:null,warnings:[]};let n=Og(e,"utf8"),r=Ad(n).map((s)=>({detail:s.message,file:t,message:`line ${s.line}, column ${s.column}: ${s.message}`,path:[],rule:"escape",severity:"warn",source:"notation"}));try{return{document:U8(n),failure:null,warnings:r}}catch(s){return{document:null,failure:{errors:[{message:$e(s)}],file:t},warnings:r}}}function BA(e,t){let n=[];try{Ha(e,t,n)}catch(s){return{failure:{errors:[{message:$e(s)}],file:t},warnings:[]}}return{failure:null,warnings:n.map(({pointer:s,problem:o})=>({detail:o.message,file:t,message:`${s} (line ${o.line}, column ${o.column}): ${o.message}`,path:s.split("/").slice(1),rule:"typescript-reading",severity:"warn",source:"function-body"}))}}function U8(e){let t=fo(e);return V(t)?t:null}function Ic(e){return JSON.parse(Og(e,"utf8"))}function B8(e,t,n){let r=[];for(let s of hA(e,n))r.push({...Xf(s),file:t,source:"popover"});for(let s of SA(e,n))r.push({...Xf(s),file:t,source:"dialog"});for(let s of xA(e))r.push({...Xf(s),criterion:s.criterion,file:t,source:"accessibility"});for(let s of o$(e))r.push({...Xf({...s,severity:"info"}),file:t,source:"module"});return r}function Xf(e){return{detail:e.detail,message:e.message,path:e.path,rule:e.rule,severity:e.severity}}function QA(e){return e.lint.map((t)=>{let n=t.criterion===void 0?`${t.source}/${t.rule}`:`${t.source}/${t.rule}, WCAG ${t.criterion}`;return`${t.file}: ${t.severity}: ${t.message} [${n}]`})}function z8(e){let t=[],n=new Set,r=(o)=>{let i=e;for(let a of o.slice(1).split("/")){if(a==="")continue;let c=a.replaceAll("~1","/").replaceAll("~0","~");if(!D(i))return!1;if(i=i[c],i===void 0)return!1}return!0},s=(o)=>{if(!V(o)||n.has(o))return;n.add(o);let i=o.$ref;if(k(i)){if(/^[a-zA-Z][a-zA-Z\d+.-]*:/.test(i))t.push({reason:"is an absolute URI editors resolve over the network",ref:i});else if(!i.startsWith("#"))t.push({reason:"is a relative path only Node module resolution can follow",ref:i});else if(i.length>1&&!i.startsWith("#/"))t.push({reason:"is an $anchor reference, which has no root-pointer form",ref:i});else if(i.length>1&&!r(i.slice(1)))t.push({reason:"points at no node in this document",ref:i})}for(let[a,c]of Object.entries(o)){if(!K8.has(a))continue;if(Array.isArray(c))for(let l of c)s(l);else if(V(c)){if(s(c),eR.has(a))for(let l of Object.values(c))s(l)}}};return s(e),t}function tR(e){if(!KA(e))return[];let t=[];for(let n of GA(e)){let r=YA(e,n);if(XA(r).isDirectory())t.push(...tR(r));else if(Wr(n))t.push(r)}return t.toSorted()}function zA(e){let t=[],n=(r)=>{for(let s of GA(r)){if(V8.has(s))continue;let o=YA(r,s);if(XA(o).isDirectory())n(o);else if(s.endsWith(".class.json"))t.push(o)}};return n(e),t.toSorted()}function nR(e){let t=[];for(let n of e.issues){t.push(`${n.file}:`);for(let r of n.errors){let s=V(r)?r:{},{instancePath:o,message:i}=s;t.push(` - ${o||"/"}: ${i??JSON.stringify(r)}`)}}return t}var L8,V8,q8,eR,K8;var rR=T(()=>{ds();Dt();ql();RE();cA();bA();vA();Si();Hf();le();Ur();Da();nh();L8=["components","pages","layouts"],V8=new Set(["node_modules","dist",".git"]),q8=["@jxsuite/schema/schemas/project.core.schema.json","@jxsuite/schema/schemas/project.fields.schema.json","@jxsuite/schema/schemas/document.paths.schema.json"];eR=new Set(["$defs","definitions","dependencies","dependentSchemas","patternProperties","properties"]),K8=new Set([...eR,"additionalItems","additionalProperties","allOf","anyOf","contains","contentSchema","else","if","items","not","oneOf","prefixItems","propertyNames","then","unevaluatedItems","unevaluatedProperties"])});Dt();import{relative as Ag,resolve as sR}from"node:path";async function G8(){let e=process.argv.slice(2),[t]=e;if(!t||t==="--help"||t==="-h")console.log(`Usage: jx <command> [options]
620
+ deps: ${n}}`};var cB={keyword:"dependencies",type:"object",schemaType:"object",error:OO.error,code(e){let[t,n]=lB(e);_O(e,t),kO(e,n)}};function lB({schema:e}){let t={},n={};for(let r in e){if(r==="__proto__")continue;let s=Array.isArray(e[r])?t:n;s[r]=e[r]}return[t,n]}function _O(e,t=e.schema){let{gen:n,data:r,it:s}=e;if(Object.keys(t).length===0)return;let o=n.let("missing");for(let i in t){let a=t[i];if(a.length===0)continue;let c=Ar.propertyInData(n,r,i,s.opts.ownProperties);if(e.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),s.allErrors)n.if(c,()=>{for(let l of a)Ar.checkReportMissingProp(e,l)});else n.if(na._`${c} && (${Ar.checkMissingProp(e,a,o)})`),Ar.reportMissingProp(e,o),n.else()}}OO.validatePropertyDeps=_O;function kO(e,t=e.schema){let{gen:n,data:r,keyword:s,it:o}=e,i=n.name("valid");for(let a in t){if(PO.alwaysValidSchema(o,t[a]))continue;n.if(Ar.propertyInData(n,r,a,o.opts.ownProperties),()=>{let c=e.subschema({keyword:s,schemaProp:a},i);e.mergeValidEvaluated(c,i)},()=>n.var(i,!0)),e.ok(i)}}OO.validateSchemaDeps=kO;OO.default=cB});var TO=q(function(NO){Object.defineProperty(NO,"__esModule",{value:!0});var ed=ye(),RO=_e(),dB={message:"property name must be valid",params:({params:e})=>ed._`{propertyName: ${e.propertyName}}`},pB={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:dB,code(e){let{gen:t,schema:n,data:r,it:s}=e;if(RO.alwaysValidSchema(s,n))return;let o=t.name("valid");t.forIn("key",r,(i)=>{e.setParams({propertyName:i}),e.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},o),t.if(ed.not(o),()=>{if(e.error(!0),!s.allErrors)t.break()})}),e.ok(o)}};NO.default=pB});var rx=q(function(JO){Object.defineProperty(JO,"__esModule",{value:!0});var Us=Dn(),ut=ye(),hB=Jn(),Bs=_e(),gB={message:"must NOT have additional properties",params:({params:e})=>ut._`{additionalProperty: ${e.additionalProperty}}`},yB={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:gB,code(e){let{gen:t,schema:n,parentSchema:r,data:s,errsCount:o,it:i}=e;if(!o)throw Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&Bs.alwaysValidSchema(i,n))return;let l=Us.allSchemaProperties(r.properties),u=Us.allSchemaProperties(r.patternProperties);d(),e.ok(ut._`${o} === ${hB.default.errors}`);function d(){t.forIn("key",s,(y)=>{if(!l.length&&!u.length)x(y);else t.if(p(y),()=>x(y))})}function p(y){let S;if(l.length>8){let E=Bs.schemaRefOrVal(i,r.properties,"properties");S=Us.isOwnProperty(t,E,y)}else if(l.length)S=ut.or(...l.map((E)=>ut._`${y} === ${E}`));else S=ut.nil;if(u.length)S=ut.or(S,...u.map((E)=>ut._`${Us.usePattern(e,E)}.test(${y})`));return ut.not(S)}function m(y){t.code(ut._`delete ${s}[${y}]`)}function x(y){if(c.removeAdditional==="all"||c.removeAdditional&&n===!1){m(y);return}if(n===!1){if(e.setParams({additionalProperty:y}),e.error(),!a)t.break();return}if(typeof n=="object"&&!Bs.alwaysValidSchema(i,n)){let S=t.name("valid");if(c.removeAdditional==="failing")g(y,S,!1),t.if(ut.not(S),()=>{e.reset(),m(y)});else if(g(y,S),!a)t.if(ut.not(S),()=>t.break())}}function g(y,S,E){let v={keyword:"additionalProperties",dataProp:y,dataPropType:Bs.Type.Str};if(E===!1)Object.assign(v,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(v,S)}}};JO.default=yB});var FO=q(function(MO){Object.defineProperty(MO,"__esModule",{value:!0});var DO=zi(),td=Dn(),ra=_e(),IO=rx(),bB={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:n,parentSchema:r,data:s,it:o}=e;if(o.opts.removeAdditional==="all"&&r.additionalProperties===void 0)IO.default.code(new DO.KeywordCxt(o,IO.default,"additionalProperties"));let i=td.allSchemaProperties(n);for(let d of i)o.definedProperties.add(d);if(o.opts.unevaluated&&i.length&&o.props!==!0)o.props=ra.mergeEvaluated.props(t,ra.toHash(i),o.props);let a=i.filter((d)=>!ra.alwaysValidSchema(o,n[d]));if(a.length===0)return;let c=t.name("valid");for(let d of a){if(l(d))u(d);else{if(t.if(td.propertyInData(t,s,d,o.opts.ownProperties)),u(d),!o.allErrors)t.else().var(c,!0);t.endIf()}e.it.definedProperties.add(d),e.ok(c)}function l(d){return o.opts.useDefaults&&!o.compositeRule&&n[d].default!==void 0}function u(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};MO.default=bB});var VO=q(function(LO){Object.defineProperty(LO,"__esModule",{value:!0});var nd=Dn(),zs=ye(),rd=_e(),sd=_e(),SB={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:n,data:r,parentSchema:s,it:o}=e,{opts:i}=o,a=nd.allSchemaProperties(n),c=a.filter((g)=>rd.alwaysValidSchema(o,n[g]));if(a.length===0||c.length===a.length&&(!o.opts.unevaluated||o.props===!0))return;let l=i.strictSchema&&!i.allowMatchingProperties&&s.properties,u=t.name("valid");if(o.props!==!0&&!(o.props instanceof zs.Name))o.props=sd.evaluatedPropsToName(t,o.props);let{props:d}=o;p();function p(){for(let g of a){if(l)m(g);if(o.allErrors)x(g);else t.var(u,!0),x(g),t.if(u)}}function m(g){for(let y in l)if(new RegExp(g).test(y))rd.checkStrictMode(o,`property ${y} matches pattern ${g} (use allowMatchingProperties)`)}function x(g){t.forIn("key",r,(y)=>{t.if(zs._`${nd.usePattern(e,g)}.test(${y})`,()=>{let S=c.includes(g);if(!S)e.subschema({keyword:"patternProperties",schemaProp:g,dataProp:y,dataPropType:sd.Type.Str},u);if(o.opts.unevaluated&&d!==!0)t.assign(zs._`${d}[${y}]`,!0);else if(!S&&!o.allErrors)t.if(zs.not(u),()=>t.break())})})}}};LO.default=SB});var HO=q(function(WO){Object.defineProperty(WO,"__esModule",{value:!0});var qO=_e(),vB={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:n,it:r}=e;if(qO.alwaysValidSchema(r,n)){e.fail();return}let s=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},s),e.failResult(s,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};WO.default=vB});var zO=q(function(BO){Object.defineProperty(BO,"__esModule",{value:!0});var UO=Dn(),jB={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:UO.validateUnion,error:{message:"must match a schema in anyOf"}};BO.default=jB});var XO=q(function(GO){Object.defineProperty(GO,"__esModule",{value:!0});var Ks=ye(),KO=_e(),_B={message:"must match exactly one schema in oneOf",params:({params:e})=>Ks._`{passingSchemas: ${e.passing}}`},kB={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:_B,code(e){let{gen:t,schema:n,parentSchema:r,it:s}=e;if(!Array.isArray(n))throw Error("ajv implementation error");if(s.opts.discriminator&&r.discriminator)return;let o=n,i=t.let("valid",!1),a=t.let("passing",null),c=t.name("_valid");e.setParams({passing:a}),t.block(l),e.result(i,()=>e.reset(),()=>e.error(!0));function l(){o.forEach((u,d)=>{let p;if(KO.alwaysValidSchema(s,u))t.var(c,!0);else p=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c);if(d>0)t.if(Ks._`${c} && ${i}`).assign(i,!1).assign(a,Ks._`[${a}, ${d}]`).else();t.if(c,()=>{if(t.assign(i,!0),t.assign(a,d),p)e.mergeEvaluated(p,Ks.Name)})})}}};GO.default=kB});var QO=q(function(ZO){Object.defineProperty(ZO,"__esModule",{value:!0});var YO=_e(),AB={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:n,it:r}=e;if(!Array.isArray(n))throw Error("ajv implementation error");let s=t.name("valid");n.forEach((o,i)=>{if(YO.alwaysValidSchema(r,o))return;let a=e.subschema({keyword:"allOf",schemaProp:i},s);e.ok(s),e.mergeEvaluated(a)})}};ZO.default=AB});var nA=q(function(tA){Object.defineProperty(tA,"__esModule",{value:!0});var Gs=ye(),od=_e(),RB={message:({params:e})=>Gs.str`must match "${e.ifClause}" schema`,params:({params:e})=>Gs._`{failingKeyword: ${e.ifClause}}`},NB={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:RB,code(e){let{gen:t,parentSchema:n,it:r}=e;if(n.then===void 0&&n.else===void 0)od.checkStrictMode(r,'"if" without "then" and "else" is ignored');let s=eA(r,"then"),o=eA(r,"else");if(!s&&!o)return;let i=t.let("valid",!0),a=t.name("_valid");if(c(),e.reset(),s&&o){let u=t.let("ifClause");e.setParams({ifClause:u}),t.if(a,l("then",u),l("else",u))}else if(s)t.if(a,l("then"));else t.if(Gs.not(a),l("else"));e.pass(i,()=>e.error(!0));function c(){let u=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(u)}function l(u,d){return()=>{let p=e.subschema({keyword:u},a);if(t.assign(i,a),e.mergeValidEvaluated(p,i),d)t.assign(d,Gs._`${u}`);else e.setParams({ifClause:u})}}}};function eA(e,t){let n=e.schema[t];return n!==void 0&&!od.alwaysValidSchema(e,n)}tA.default=NB});var oA=q(function(sA){Object.defineProperty(sA,"__esModule",{value:!0});var rA=_e(),JB={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:n}){if(t.if===void 0)rA.checkStrictMode(n,`"${e}" without "if" is ignored`)}};sA.default=JB});var sx=q(function(iA){Object.defineProperty(iA,"__esModule",{value:!0});var DB=tx(),MB=xO(),FB=nx(),LB=vO(),VB=jO(),qB=Qf(),WB=TO(),HB=rx(),UB=FO(),BB=VO(),zB=HO(),KB=zO(),GB=XO(),XB=QO(),YB=nA(),ZB=oA();function QB(e=!1){let t=[zB.default,KB.default,GB.default,XB.default,YB.default,ZB.default,WB.default,HB.default,qB.default,UB.default,BB.default];if(e)t.push(MB.default,LB.default);else t.push(DB.default,FB.default);return t.push(VB.default),t}iA.default=QB});var ox=q(function(lA){Object.defineProperty(lA,"__esModule",{value:!0});lA.dynamicAnchor=void 0;var sa=ye(),tz=Jn(),id=Dc(),aA=Kf(),nz={keyword:"$dynamicAnchor",schemaType:"string",code:(e)=>cA(e,e.schema)};function cA(e,t){let{gen:n,it:r}=e;r.schemaEnv.root.dynamicAnchors[t]=!0;let s=sa._`${tz.default.dynamicAnchors}${sa.getProperty(t)}`,o=r.errSchemaPath==="#"?r.validateName:rz(e);n.if(sa._`!${s}`,()=>n.assign(s,o))}lA.dynamicAnchor=cA;function rz(e){let{schemaEnv:t,schema:n,self:r}=e.it,{root:s,baseId:o,localRefs:i,meta:a}=t.root,{schemaId:c}=r.opts,l=new id.SchemaEnv({schema:n,schemaId:c,root:s,baseId:o,localRefs:i,meta:a});return id.compileSchema.call(r,l),aA.getValidate(e,l)}lA.default=nz});var ix=q(function(dA){Object.defineProperty(dA,"__esModule",{value:!0});dA.dynamicRef=void 0;var ad=ye(),oz=Jn(),cd=Kf(),iz={keyword:"$dynamicRef",schemaType:"string",code:(e)=>fA(e,e.schema)};function fA(e,t){let{gen:n,keyword:r,it:s}=e;if(t[0]!=="#")throw Error(`"${r}" only supports hash fragment reference`);let o=t.slice(1);if(s.allErrors)i();else{let c=n.let("valid",!1);i(c),e.ok(c)}function i(c){if(s.schemaEnv.root.dynamicAnchors[o]){let l=n.let("_v",ad._`${oz.default.dynamicAnchors}${ad.getProperty(o)}`);n.if(l,a(l,c),a(s.validateName,c))}else a(s.validateName,c)()}function a(c,l){return l?()=>n.block(()=>{cd.callRef(e,c),n.let(l,!0)}):()=>cd.callRef(e,c)}}dA.dynamicRef=fA;dA.default=iz});var yA=q(function(gA){Object.defineProperty(gA,"__esModule",{value:!0});var mA=ox(),hA=_e(),cz={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){if(e.schema)mA.dynamicAnchor(e,"");else hA.checkStrictMode(e.it,"$recursiveAnchor: false is ignored")}};gA.default=cz});var $A=q(function(bA){Object.defineProperty(bA,"__esModule",{value:!0});var xA=ix(),uz={keyword:"$recursiveRef",schemaType:"string",code:(e)=>xA.dynamicRef(e,e.schema)};bA.default=uz});var wA=q(function(SA){Object.defineProperty(SA,"__esModule",{value:!0});var dz=ox(),pz=ix(),mz=yA(),hz=$A(),gz=[dz.default,pz.default,mz.default,hz.default];SA.default=gz});var EA=q(function(vA){Object.defineProperty(vA,"__esModule",{value:!0});var ld=Qf(),xz={keyword:"dependentRequired",type:"object",schemaType:"object",error:ld.error,code:(e)=>ld.validatePropertyDeps(e)};vA.default=xz});var _A=q(function(PA){Object.defineProperty(PA,"__esModule",{value:!0});var jA=Qf(),$z={keyword:"dependentSchemas",type:"object",schemaType:"object",code:(e)=>jA.validateSchemaDeps(e)};PA.default=$z});var AA=q(function(OA){Object.defineProperty(OA,"__esModule",{value:!0});var kA=_e(),wz={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:e,parentSchema:t,it:n}){if(t.contains===void 0)kA.checkStrictMode(n,`"${e}" without "contains" is ignored`)}};OA.default=wz});var RA=q(function(CA){Object.defineProperty(CA,"__esModule",{value:!0});var Ez=EA(),jz=_A(),Pz=AA(),_z=[Ez.default,jz.default,Pz.default];CA.default=_z});var TA=q(function(NA){Object.defineProperty(NA,"__esModule",{value:!0});var Ut=ye(),ud=_e(),Oz=Jn(),Az={message:"must NOT have unevaluated properties",params:({params:e})=>Ut._`{unevaluatedProperty: ${e.unevaluatedProperty}}`},Cz={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:Az,code(e){let{gen:t,schema:n,data:r,errsCount:s,it:o}=e;if(!s)throw Error("ajv implementation error");let{allErrors:i,props:a}=o;if(a instanceof Ut.Name)t.if(Ut._`${a} !== true`,()=>t.forIn("key",r,(d)=>t.if(l(a,d),()=>c(d))));else if(a!==!0)t.forIn("key",r,(d)=>a===void 0?c(d):t.if(u(a,d),()=>c(d)));o.props=!0,e.ok(Ut._`${s} === ${Oz.default.errors}`);function c(d){if(n===!1){if(e.setParams({unevaluatedProperty:d}),e.error(),!i)t.break();return}if(!ud.alwaysValidSchema(o,n)){let p=t.name("valid");if(e.subschema({keyword:"unevaluatedProperties",dataProp:d,dataPropType:ud.Type.Str},p),!i)t.if(Ut.not(p),()=>t.break())}}function l(d,p){return Ut._`!${d} || !${d}[${p}]`}function u(d,p){let m=[];for(let x in d)if(d[x]===!0)m.push(Ut._`${p} !== ${x}`);return Ut.and(...m)}}};NA.default=Cz});var IA=q(function(JA){Object.defineProperty(JA,"__esModule",{value:!0});var fn=ye(),fd=_e(),Nz={message:({params:{len:e}})=>fn.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>fn._`{limit: ${e}}`},Tz={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:Nz,code(e){let{gen:t,schema:n,data:r,it:s}=e,o=s.items||0;if(o===!0)return;let i=t.const("len",fn._`${r}.length`);if(n===!1)e.setParams({len:o}),e.fail(fn._`${i} > ${o}`);else if(typeof n=="object"&&!fd.alwaysValidSchema(s,n)){let c=t.var("valid",fn._`${i} <= ${o}`);t.if(fn.not(c),()=>a(c,o)),e.ok(c)}s.items=!0;function a(c,l){t.forRange("i",l,i,(u)=>{if(e.subschema({keyword:"unevaluatedItems",dataProp:u,dataPropType:fd.Type.Num},c),!s.allErrors)t.if(fn.not(c),()=>t.break())})}}};JA.default=Tz});var MA=q(function(DA){Object.defineProperty(DA,"__esModule",{value:!0});var Iz=TA(),Dz=IA(),Mz=[Iz.default,Dz.default];DA.default=Mz});var LA=q(function(FA){Object.defineProperty(FA,"__esModule",{value:!0});var $e=ye(),Lz={message:({schemaCode:e})=>$e.str`must match format "${e}"`,params:({schemaCode:e})=>$e._`{format: ${e}}`},Vz={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:Lz,code(e,t){let{gen:n,data:r,$data:s,schema:o,schemaCode:i,it:a}=e,{opts:c,errSchemaPath:l,schemaEnv:u,self:d}=a;if(!c.validateFormats)return;if(s)p();else m();function p(){let x=n.scopeValue("formats",{ref:d.formats,code:c.code.formats}),g=n.const("fDef",$e._`${x}[${i}]`),y=n.let("fType"),S=n.let("format");n.if($e._`typeof ${g} == "object" && !(${g} instanceof RegExp)`,()=>n.assign(y,$e._`${g}.type || "string"`).assign(S,$e._`${g}.validate`),()=>n.assign(y,$e._`"string"`).assign(S,g)),e.fail$data($e.or(E(),v()));function E(){if(c.strictSchema===!1)return $e.nil;return $e._`${i} && !${S}`}function v(){let j=u.$async?$e._`(${g}.async ? await ${S}(${r}) : ${S}(${r}))`:$e._`${S}(${r})`,P=$e._`(typeof ${S} == "function" ? ${j} : ${S}.test(${r}))`;return $e._`${S} && ${S} !== true && ${y} === ${t} && !${P}`}}function m(){let x=d.formats[o];if(!x){E();return}if(x===!0)return;let[g,y,S]=v(x);if(g===t)e.pass(j());function E(){if(c.strictSchema===!1){d.logger.warn(P());return}throw Error(P());function P(){return`unknown format "${o}" ignored in schema at path "${l}"`}}function v(P){let O=P instanceof RegExp?$e.regexpCode(P):c.code.formats?$e._`${c.code.formats}${$e.getProperty(o)}`:void 0,T=n.scopeValue("formats",{key:o,ref:P,code:O});if(typeof P=="object"&&!(P instanceof RegExp))return[P.type||"string",P.validate,$e._`${T}.validate`];return["string",P,T]}function j(){if(typeof x=="object"&&!(x instanceof RegExp)&&x.async){if(!u.$async)throw Error("async format in sync schema");return $e._`await ${S}(${r})`}return typeof y=="function"?$e._`${S}(${r})`:$e._`${S}.test(${r})`}}}};FA.default=Vz});var ax=q(function(VA){Object.defineProperty(VA,"__esModule",{value:!0});var Wz=LA(),Hz=[Wz.default];VA.default=Hz});var cx=q(function(qA){Object.defineProperty(qA,"__esModule",{value:!0});qA.contentVocabulary=qA.metadataVocabulary=void 0;qA.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];qA.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var UA=q(function(HA){Object.defineProperty(HA,"__esModule",{value:!0});var zz=Qy(),Kz=ex(),Gz=sx(),Xz=wA(),Yz=RA(),Zz=MA(),Qz=ax(),dd=cx(),e8=[Xz.default,zz.default,Kz.default,(0,Gz.default)(!0),Qz.default,dd.metadataVocabulary,dd.contentVocabulary,Yz.default,Zz.default];HA.default=e8});var GA=q(function(zA){Object.defineProperty(zA,"__esModule",{value:!0});zA.DiscrError=void 0;var BA;(function(e){e.Tag="tag",e.Mapping="mapping"})(BA||(zA.DiscrError=BA={}))});var lx=q(function(YA){Object.defineProperty(YA,"__esModule",{value:!0});var Fn=ye(),oa=GA(),pd=Dc(),n8=Gi(),XA=_e(),r8={message:({params:{discrError:e,tagName:t}})=>e===oa.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:n}})=>Fn._`{error: ${e}, tag: ${n}, tagValue: ${t}}`},s8={keyword:"discriminator",type:"object",schemaType:"object",error:r8,code(e){let{gen:t,data:n,schema:r,parentSchema:s,it:o}=e,{oneOf:i}=s;if(!o.opts.discriminator)throw Error("discriminator: requires discriminator option");let a=r.propertyName;if(typeof a!="string")throw Error("discriminator: requires propertyName");if(r.mapping)throw Error("discriminator: mapping is not supported");if(!i)throw Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),l=t.const("tag",Fn._`${n}${Fn.getProperty(a)}`);t.if(Fn._`typeof ${l} == "string"`,()=>u(),()=>e.error(!1,{discrError:oa.DiscrError.Tag,tag:l,tagName:a})),e.ok(c);function u(){let m=p();t.if(!1);for(let x in m)t.elseIf(Fn._`${l} === ${x}`),t.assign(c,d(m[x]));t.else(),e.error(!1,{discrError:oa.DiscrError.Mapping,tag:l,tagName:a}),t.endIf()}function d(m){let x=t.name("valid"),g=e.subschema({keyword:"oneOf",schemaProp:m},x);return e.mergeEvaluated(g,Fn.Name),x}function p(){var m;let x={},g=S(s),y=!0;for(let j=0;j<i.length;j++){let P=i[j];if((P===null||P===void 0?void 0:P.$ref)&&!XA.schemaHasRulesButRef(P,o.self.RULES)){let T=P.$ref;if(P=pd.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,T),P instanceof pd.SchemaEnv)P=P.schema;if(P===void 0)throw new n8.default(o.opts.uriResolver,o.baseId,T)}let O=(m=P===null||P===void 0?void 0:P.properties)===null||m===void 0?void 0:m[a];if(typeof O!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);y=y&&(g||S(P)),E(O,j)}if(!y)throw Error(`discriminator: "${a}" must be required`);return x;function S({required:j}){return Array.isArray(j)&&j.includes(a)}function E(j,P){if(j.const)v(j.const,P);else if(j.enum)for(let O of j.enum)v(O,P);else throw Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function v(j,P){if(typeof j!="string"||j in x)throw Error(`discriminator: "${a}" values must be unique strings`);x[j]=P}}}};YA.default=s8});var ZA=q(function(vne,i8){i8.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/schema",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],type:["object","boolean"],$comment:"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",properties:{definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}}}});var QA=q(function(Ene,a8){a8.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$dynamicAnchor:"meta",title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}}}});var eC=q(function(jne,c8){c8.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/unevaluated",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$dynamicAnchor:"meta",title:"Unevaluated applicator vocabulary meta-schema",type:["object","boolean"],properties:{unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}}}});var tC=q(function(Pne,l8){l8.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/content",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}}}});var nC=q(function(_ne,u8){u8.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/core",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0},$dynamicAnchor:"meta",title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},$defs:{anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}}}});var rC=q(function(kne,f8){f8.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/format-annotation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},$dynamicAnchor:"meta",title:"Format vocabulary meta-schema for annotation results",type:["object","boolean"],properties:{format:{type:"string"}}}});var sC=q(function(One,d8){d8.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$dynamicAnchor:"meta",title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}});var oC=q(function(Ane,p8){p8.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/validation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/validation":!0},$dynamicAnchor:"meta",title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}});var aC=q(function(iC){Object.defineProperty(iC,"__esModule",{value:!0});var m8=ZA(),h8=QA(),g8=eC(),y8=tC(),x8=nC(),b8=rC(),$8=sC(),S8=oC(),w8=["/properties"];function v8(e){return[m8,h8,g8,y8,x8,t(this,b8),$8,t(this,S8)].forEach((n)=>this.addMetaSchema(n,void 0,!1)),this;function t(n,r){return e?n.$dataMetaSchema(r,w8):r}}iC.default=v8});var dx=q(function(dn,fx){Object.defineProperty(dn,"__esModule",{value:!0});dn.MissingRefError=dn.ValidationError=dn.CodeGen=dn.Name=dn.nil=dn.stringify=dn.str=dn._=dn.KeywordCxt=dn.Ajv2020=void 0;var j8=Zy(),P8=UA(),_8=lx(),k8=aC(),ux="https://json-schema.org/draft/2020-12/schema";class Lc extends j8.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){if(super._addVocabularies(),P8.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(_8.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:t}=this.opts;if(!t)return;k8.default.call(this,e),this.refs["http://json-schema.org/schema"]=ux}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(ux)?ux:void 0)}}dn.Ajv2020=Lc;fx.exports=dn=Lc;fx.exports.Ajv2020=Lc;Object.defineProperty(dn,"__esModule",{value:!0});dn.default=Lc;var O8=zi();Object.defineProperty(dn,"KeywordCxt",{enumerable:!0,get:function(){return O8.KeywordCxt}});var ia=ye();Object.defineProperty(dn,"_",{enumerable:!0,get:function(){return ia._}});Object.defineProperty(dn,"str",{enumerable:!0,get:function(){return ia.str}});Object.defineProperty(dn,"stringify",{enumerable:!0,get:function(){return ia.stringify}});Object.defineProperty(dn,"nil",{enumerable:!0,get:function(){return ia.nil}});Object.defineProperty(dn,"Name",{enumerable:!0,get:function(){return ia.Name}});Object.defineProperty(dn,"CodeGen",{enumerable:!0,get:function(){return ia.CodeGen}});var A8=Jc();Object.defineProperty(dn,"ValidationError",{enumerable:!0,get:function(){return A8.default}});var C8=Gi();Object.defineProperty(dn,"MissingRefError",{enumerable:!0,get:function(){return C8.default}})});import{existsSync as hd,readFileSync as uC}from"node:fs";import{createRequire as cC}from"node:module";import{basename as T8,isAbsolute as J8,relative as I8,resolve as px}from"node:path";import{fileURLToPath as lC,pathToFileURL as D8}from"node:url";function md(e){return JSON.parse(uC(e,"utf8"))}async function fC(e){let t=px(e),n=An(t),r=px(t,"project.schema.json");if(!hd(n))throw Error(`No project.jxn or project.json in ${t}`);if(!hd(r))throw Error(`project.schema.json not found in ${t} — run \`jx schema\` to generate it from `+"the project file's extensions");let s=Nl(uC(n,"utf8"),n),o=md(r);o.$id=D8(r).href;let i;try{({default:i}=await Promise.resolve().then(() => ar(dx(),1)))}catch(d){throw Error("Project validation requires ajv: bun add ajv",{cause:d})}let c=await new i({allErrors:!0,loadSchema:(d)=>L8(d,t),strict:!1}).compileAsync(o),l=c(s),u=c.errors??null;return{errors:u&&Wr(n)?F8(u,s):u,file:T8(n),valid:l}}function M8(e,t){let n=e;for(let r of t.split("/").slice(1)){let s=r.replaceAll("~1","/").replaceAll("~0","~");n=Array.isArray(n)?n[Number(s)]:L(n)?n[s]:void 0}return n}function F8(e,t){return e.map((n)=>{if(!I(n)||!("keyword"in n)||n.keyword!=="type"||!("params"in n)||!I(n.params)||!("type"in n.params)||n.params.type!=="array"||!("instancePath"in n)||!k(n.instancePath))return n;let r=M8(t,n.instancePath),s=rt(r,"",n.instancePath),o=n.instancePath.split("/").at(-1)??"";if(s===null||s.includes(`
621
+ `)||o==="")return n;return{...n,message:`must be a list, written as ${o} { - ${s} }`}})}async function L8(e,t){if(!e.startsWith("file:"))throw Error(`Cannot resolve schema ref "${e}": only project-relative file refs are loadable (canonical URIs must resolve from already-loaded fragments)`);let n=lC(e),r=I8(t,n);if(r.startsWith("..")||J8(r))throw Error(`Schema ref "${e}" escapes the project root ${t}`);if(hd(n))return md(n);let s=r.split("\\").join("/"),o="node_modules/",i=s.lastIndexOf(o);if(i===-1)throw Error(`Schema ref "${e}" does not exist`);let a=s.slice(i+o.length),c="@jxsuite/schema/",l;try{l=cC(px(t,"package.json")).resolve(a)}catch(u){if(!a.startsWith(c))throw Error(`Schema ref "${e}" does not exist and "${a}" is not resolvable from the `+"project — is the package installed?",{cause:u});try{l=cC(import.meta.url).resolve(a)}catch(d){let p=lC(new URL(`../${a.slice(c.length)}`,import.meta.url));if(hd(p))return md(p);throw Error(`Schema ref "${e}" does not exist and "${a}" is not resolvable from the project or this host's core`,{cause:d})}}return md(l)}var dC=R(()=>{le();El();Cl();Tl();ho()});function Rr(e){return L(e.attributes)?e.attributes:{}}function Bt(e,t){let n=Rr(e)[t];return k(n)?n:null}function yt(e){return k(e.tagName)?e.tagName.toLowerCase():""}function Qt(e,t="the popover"){let n=k(e.id)?e.id:Bt(e,"id");if(n)return`#${n}`;let r=yt(e);return r===""?t:`the <${r}>`}function W8(e){let t=Rr(e).popover;return k(t)?t:null}function mC(e){let t=new Set,n=new Set;for(let r of e){let s=r!==null&&k(r.tagName)?r.tagName:"";if(r===null||!s.includes("-"))continue;if(mx(r))t.add(s);let o=r.observedAttributes;if(Array.isArray(o)&&H8.every((i)=>o.includes(i)))n.add(s)}return{invokerTags:n,popoverTags:t}}function mx(e){return"popover"in Rr(e)||"popover"in e}function Vc(e,t){return mx(e)||(t?.popoverTags?.has(yt(e))??!1)}function Xs(e){if(k(e.id)&&e.id!=="")return e.id;let t=Bt(e,"id");return t===""?null:t}function*Cr(e,t=[],n=null,r){yield{enclosing:n,node:e,path:t};let s=Vc(e,r)?e:n,{children:o}=e;if(Array.isArray(o)){for(let[c,l]of o.entries())if(I(l))yield*Cr(l,[...t,"children",c],s,r)}else if(L(o)&&tn(o.map))yield*Cr(o.map,[...t,"children","map"],s,r);let i=tn(e.map)?e.map:null;if(i)yield*Cr(i,[...t,"map"],s,r);let a=L(e.cases)?e.cases:{};for(let[c,l]of Object.entries(a))if(I(l))yield*Cr(l,[...t,"cases",c],s,r)}function hx(e,t){let n=[];for(let{node:r}of Cr(e,[],null,t)){if(!Vc(r,t))continue;let s=Xs(r);if(s!==null&&!n.includes(s))n.push(s)}return n}function gd(e){return e.startsWith("@")}function hC(e){return e.startsWith(":")||e.startsWith("&")||e.startsWith(".")||e.startsWith("[")}function Zt(e,t){let n=e?.[t];if(n===void 0||so(n)||Array.isArray(n))return null;return String(n)}function gC(e){for(let[t,n]of Object.entries(e??{})){if(!so(n))continue;if(hC(t)&&t.includes(":popover-open")&&Zt(n,"display")!==null)return!0;if(gd(t)&&gC(n))return!0}return!1}function yC(e){for(let[t,n]of Object.entries(e??{})){if(!so(n))continue;if(hC(t)&&t.includes(":popover-open"))return!0;if(gd(t)&&yC(n))return!0}return!1}function B8(e){return U8.some((t)=>Zt(e,t)!==null)}function z8(e){if(!e)return[];let t=[];for(let[n,r]of Object.entries(e))if(gd(n)&&so(r)&&Zt(r,"display")!==null)t.push(n);return t}function xC(e){if(!e)return[];let t=[],n=Zt(e,"transition");if(n!==null)t.push(n);for(let[r,s]of Object.entries(e))if(gd(r)&&so(s))t.push(...xC(s));return t}function K8(e){if(!e)return!1;if(Zt(e,"positionAnchor")!==null||Zt(e,"position-anchor")!==null)return!0;return["top","left","right","bottom","inset","insetBlockStart","insetInlineStart"].some((t)=>(Zt(e,t)??"").includes("anchor("))}function G8(e){if(!e)return!1;if(Zt(e,"positionArea")!==null||Zt(e,"position-area")!==null||Zt(e,"positionTryFallbacks")!==null||Zt(e,"position-try-fallbacks")!==null)return!0;return Object.keys(e).some((t)=>t.startsWith("@supports"))}function bC(e,t){let n=[...Cr(e,[],null,t)],r=hx(e,t),s=n.some(({node:a})=>Vc(a,t)),o=new Set;for(let{node:a}of n)if(pC.has(yt(a))){let c=Bt(a,"popovertarget");if(c!==null)o.add(c)}let i=[];for(let{enclosing:a,node:c,path:l}of n)if(i.push(...X8(c,l,a,r,s,t)),mx(c))i.push(...Y8(c,l,o));return i}function X8(e,t,n,r,s,o){let i=[],a=yt(e),c=Bt(e,"popovertarget"),l=pC.has(a)||(o?.invokerTags?.has(a)??!1);if(c!==null&&!l)return i.push({detail:"`popovertarget` and `popovertargetaction` come from the `PopoverTargetAttributes` IDL mixin, which HTML includes into `HTMLButtonElement` and `HTMLInputElement` and into nothing else. Elsewhere they parse and do nothing. A link inside an open popover "+"dismisses it by navigating away, which is why this looks like it works — but it does "+`not for a new tab or a same-page fragment. Remove both attributes. ${Ge}`,fix:"invoker",message:`<${a||"element"}> carries popovertarget, which only <button> and <input> support.`,path:t,rule:"invoker-not-button",severity:"error"}),i;if(c!==null){if(s&&!r.includes(c)){let u=r.length>0?`The popovers here are: ${r.map((d)=>`"${d}"`).join(", ")}. `:"";i.push({detail:`No element in this document declares \`popover\` with the id "${c}". ${u}A target that names nothing does nothing, silently. ${Ge}`,message:`popovertarget="${c}" names no popover in this document.`,path:t,rule:"target-missing",severity:"error"})}else if(n!==null&&Xs(n)!==null&&Xs(n)!==c)i.push({detail:`This control is inside ${Qt(n)} but targets "${c}". Dismissing a different popover leaves the one the reader is looking at open. This is usually a copy-paste between two panels in the same file. ${Ge}`,message:`A control inside ${Qt(n)} targets "${c}" instead.`,path:t,rule:"target-mismatch",severity:"warn"})}if(a==="a"&&n!==null&&c===null){let u=Bt(e,"href")??(k(e.href)?e.href:null),d=Bt(e,"target")==="_blank",p=u!==null&&u.includes("#");if(d||p){let m=d?"it opens a new tab, so the panel stays open on the page behind it. ":"it is a same-document fragment, so the page scrolls behind the open panel. ";i.push({detail:`A link inside a panel normally dismisses it by navigating away. This one does not: ${m}`+"There is no declarative fix — a link cannot carry `popovertarget`. Move it out of the "+`panel, make it a <button>, or accept it deliberately. ${Ge}`,message:`A link inside ${Qt(n)} does not dismiss it.`,path:t,rule:"link-does-not-dismiss",severity:"warn"})}}return i}function Y8(e,t,n){let r=[],{style:s}=e,o=Qt(e),i=W8(e);if(i!==null&&i!==""&&!q8.some((l)=>l===i))r.push({detail:"`popover` is an enumerated attribute taking `auto`, `manual` or `hint`. Anything else falls back to the invalid-value default `manual`, which gives up light dismiss and gives "+`up Escape — so the panel opens and there is no way to close it. Write "auto". ${Ge}`,fix:"mode",message:`${o} declares popover="${i}", which is not one of auto, manual or hint.`,path:t,rule:"invalid-mode",severity:"error"});else if(bt(Rr(e).popover))r.push({detail:`\`popover\` carries its value in its text, so a boolean is not the right shape. Written as \`true\` it reaches two of the compiler's emitters as \`popover="true"\`, which is not one of the three keywords, so HTML falls back to \`manual\`: no light dismiss, no Escape, and the trigger stops toggling. Write "auto". ${Ge}`,fix:"mode",message:`${o} writes popover as a boolean.`,path:t,rule:"invalid-mode",severity:"error"});let a=Zt(s,"display");if(a!==null&&a!=="revert"&&a!=="revert-layer")r.push({detail:"A closed popover is hidden by the browser's own `[popover]:not(:popover-open) { display: none }`. That rule is UA-origin, so any author `display` beats it at any specificity, and "+"the panel is laid out on every page whether it is open or not — usually parked off the "+`side of the viewport by the transform meant to animate it, so nothing looks wrong until you scroll sideways. \`display\` belongs in \`:popover-open\` and nowhere else. ${Ge}`,fix:"display",message:`${o} sets display in its base rule.`,path:t,rule:"base-display",severity:"error"});for(let l of z8(s))r.push({detail:`The same defect as a base \`display\`, arriving through \`${l}\` and therefore only at `+"one width — which is what makes it hard to see. Gate the TRIGGER on a breakpoint, never "+`the panel: the popover mechanism is what hides the panel. ${Ge}`,fix:"display",message:`${o} sets display inside ${l}.`,path:t,rule:"breakpoint-display",severity:"error"});if(Zt(s,"visibility")!==null)r.push({detail:`A second hiding mechanism the browser already provides. Once \`display\` leaves the base rule this one only adds a frame of flicker on open, and it hides the element from assistive technology in a way \`display: none\` already did. ${Ge}`,fix:"display",message:`${o} also hides itself with visibility.`,path:t,rule:"base-visibility",severity:"warn"});if(!yC(s))r.push({detail:"Nothing changes when it opens, so no transition on it can run and — if `display` is not "+"in the base rule — the panel has no `display` at all while open. This is usually a panel "+`that was styled before it was made a popover. ${Ge}`,message:`${o} has no :popover-open rule.`,path:t,rule:"no-open-rule",severity:"warn"});else if(!gC(s)&&a===null&&B8(s))r.push({detail:`${o} declares flex or grid properties, but neither its base rule nor its `+"`:popover-open` rule sets a `display` for them to apply to — and the base rule must not "+`(that is what keeps the closed panel hidden). So it opens with the UA's \`display: block\` and the layout silently does nothing. Put \`display: flex\` in \`:popover-open\`. ${Ge}`,fix:"open-display",message:`${o} is laid out with flex or grid but never sets display.`,path:t,rule:"no-open-display",severity:"error"});for(let l of xC(s))if(l.includes("display")&&!l.includes("overlay")){r.push({detail:"`display …allow-discrete` keeps the box alive while it animates out; `overlay "+"…allow-discrete` is what keeps it in the TOP LAYER for those same milliseconds. "+`Without it the panel drops behind the page content and the backdrop disappears a frame early, so the exit reads as a flicker rather than an animation. ${Ge}`,message:`${o} transitions display but not overlay.`,path:t,rule:"cut-exit",severity:"warn"});break}if(K8(s)&&!G8(s))r.push({detail:"When `anchor()` does not resolve, every inset it feeds computes to `auto` — and a "+`\`position: fixed\` box with four \`auto\` insets falls back to its STATIC position, which for a panel declared inside a header is in the middle of the header. Use \`position-area\` with \`position-try-fallbacks\`, or add a \`@supports\` block that positions it without anchors. ${Ge}`,message:`${o} is anchor-positioned with no fallback.`,path:t,rule:"unsafe-anchor",severity:"warn"});let c=Xs(e);if(c!==null&&!n.has(c))r.push({detail:`No \`<button>\` or \`<input>\` in this document names it with \`popovertarget\`. If it is opened from another file or from a function that calls \`showPopover()\`, this is fine; otherwise there is no way for a reader to open it. ${Ge}`,message:`${o} has no invoker in this document.`,path:t,rule:"no-invoker",severity:"warn"});return r}var q8,pC,H8,U8,Ge="See docs/framework/concepts/overlays.";var yd=R(()=>{le();q8=["auto","manual","hint"],pC=new Set(["button","input"]);H8=["popovertarget","popovertargetaction","command","commandfor"];U8=["flexDirection","flex-direction","alignItems","align-items","justifyContent","justify-content","flexWrap","flex-wrap","gridTemplateColumns","grid-template-columns","gridTemplateRows","grid-template-rows","gap"]});function ua(e,t){let n=Rr(e),r=t in n?n[t]:e[t];if(r===void 0||r===null)return{kind:"absent"};if(Ce(r)||L(r))return{kind:"bound"};if(k(r))return r.includes("${")?{kind:"bound"}:{kind:"text",text:r};return{isTrue:r===!0,kind:"other"}}function ca(e,t){let n=ua(e,t);return n.kind==="text"&&n.text.trim()!==""?n.text:null}function zt(e,t){return ua(e,t).kind!=="absent"}function Ys(e){let t=ua(e,"role");if(t.kind==="bound")return la;return t.kind==="text"?t.text.trim().toLowerCase().split(/\s+/)[0]:null}function xd(e){let t=ua(e,"id");if(t.kind==="bound")return la;return t.kind==="text"&&t.text!==""?t.text:null}function Ln(e,t){let n=ua(e,t);return n.kind==="bound"||n.kind==="text"&&n.text.trim()!==""}function bd(e){let t=e.textContent;if(k(t)){if(t.trim()!=="")return!0}else if(t!==void 0&&t!==null)return!0;if(Ln(e,"aria-label")||zt(e,"aria-labelledby"))return!0;if(yt(e)==="img"&&(Ln(e,"alt")||Ln(e,"title")))return!0;if(yt(e)==="slot")return!0;let{children:n}=e;if(Array.isArray(n)){for(let s of n)if(k(s)){if(s.trim()!=="")return!0}else if(I(s)&&bd(s))return!0}else if(n!=null)return!0;if(L(e.map))return!0;return(L(e.cases)?Object.values(e.cases):[]).some((s)=>tn(s)&&bd(s))}function*aa(e,t=[],n=[],r=[]){yield{node:e,path:t,roles:n,tags:r};let s=[...n,Ys(e)],o=[...r,yt(e)],{children:i}=e;if(Array.isArray(i)){for(let[a,c]of i.entries())if(I(c))yield*aa(c,[...t,"children",a],s,o)}else if(L(i)&&tn(i.map))yield*aa(i.map,[...t,"children","map"],s,o);if(tn(e.map))yield*aa(e.map,[...t,"map"],s,o);if(L(e.cases)){for(let[a,c]of Object.entries(e.cases))if(I(c))yield*aa(c,[...t,"cases",a],s,o)}}function r9(e){return e.some((t)=>t.includes("-"))}function Nr(e,t,n,r,s,o="error"){return{criterion:s,detail:`${r} ${Z8}`,message:n,path:t,rule:e,severity:o}}function $C(e,t,n){if(n.includes("label"))return!0;if(e===la||t.bound)return!0;return e!==null&&t.ids.has(e)}function s9(e,t){let{node:n,path:r,tags:s}=e,o=yt(n),i=Ys(n);if(i==="bound")return null;if(Ln(n,"aria-label")||zt(n,"aria-labelledby")||Ln(n,"title"))return null;let c=Qt(n,"the control"),l=(d)=>Nr("interactive-unnamed",r,`${c} has no accessible name.`,`A control with no name is announced as its role alone, so a reader hears "button" and nothing else. ${d}`,"4.1.2"),u=o9(n,o,t,s);if(u==="named"||u==="exempt")return null;if(i!==null&&Q8.has(i))return bd(n)?null:l("Give it text content, or an aria-label.");if(i!==null&&e9.has(i))return l("Give it an aria-label, or aria-labelledby naming its visible label.");if(i!==null)return null;if(o==="button"||o==="summary"||o==="a"&&zt(n,"href"))return bd(n)?null:l("Give it text content, or an aria-label.");if(u==="unnamed")return l("Give it a <label for> naming its id, or an aria-label.");if(u==="unnamed-value")return l("Give it a value, or an aria-label.");if(u==="unnamed-alt")return l("Give it an alt, or an aria-label.");return null}function o9(e,t,n,r){if(t==="area"){if(!zt(e,"href"))return"none";return Ln(e,"alt")?"named":"unnamed-alt"}if(t==="select"||t==="textarea")return $C(xd(e),n,r)||Ln(e,"placeholder")?"named":"unnamed";if(t!=="input")return"none";let s=(ca(e,"type")??"text").toLowerCase();if(s==="hidden"||zt(e,"type")&&ca(e,"type")===null)return"exempt";if(t9.has(s))return Ln(e,"value")?"named":"unnamed-value";if(s==="image")return Ln(e,"alt")?"named":"unnamed-alt";return $C(xd(e),n,r)||Ln(e,"placeholder")?"named":"unnamed"}function a9(e){let{node:t,path:n,tags:r}=e,s=yt(t);if(!s.includes("-")||!r.some((o)=>i9.has(o)))return null;return Nr("custom-element-in-select",n,`<${s}> is a custom element inside a <select>.`,'A <select> builds its own rows: an element it does not know is not in select.options, so it cannot be picked, cannot be reached with the arrow keys, and fires no change event — while role="option" on it still makes the accessibility tree read as though it could. Every row of a <select> is a native <option>; a listbox whose rows are jx-option elements is a jx-listbox.',"4.1.2")}function c9(e){let{node:t,path:n}=e;if(yt(t)!=="img")return null;let r=Ys(t);if(r==="bound"||r==="presentation"||r==="none")return null;if(zt(t,"alt")||Ln(t,"aria-label")||zt(t,"aria-labelledby"))return null;return Nr("img-alt-missing",n,`${Qt(t,"the image")} has no alt text.`,'An image with no alt is announced by its file name. Describe it in alt, or write alt="" for a decorative one.',"1.1.1")}function u9(e,t){let{node:n,path:r}=e,s=[];for(let o of l9){let i=ca(n,o);if(i===null)continue;for(let a of i.split(/\s+/))if(a!==""&&!t.has(a))s.push(Nr("aria-target-missing",r,`${Qt(n,"the element")} points ${o} at #${a}, which nothing in this document has as its id.`,"A reference to an id that is not in the document is silently dropped, so the relationship it declares does not exist. Name an element that is here, or give that element the id.","1.3.1"))}return s}function f9(e,t,n){for(let r of SC.get(t)??[]){let s=n.get(r);if(s===void 0)continue;if(s.bound)return!0;if(e===la&&s.ids.size>0)return!0;if(e!==null&&e!==la&&s.ids.has(e))return!0}return!1}function d9(e,t){let{node:n,path:r,roles:s,tags:o}=e,i=Ys(n);if(i===null||i==="bound"||r.length===0||r9(o))return null;if(s.includes("bound")||f9(xd(n),i,t))return null;let a=Qt(n,"the element");if(i==="tab"&&!s.includes("tablist"))return Nr("tab-outside-tablist",r,`${a} is a tab outside any tablist.`,'A tab is announced with its position in a tablist, so one with no tablist ancestor has no place to be counted in. Put the tabs in a container with role="tablist".',"1.3.1");if((i==="menuitem"||i==="menuitemcheckbox"||i==="menuitemradio")&&!s.includes("menu")&&!s.includes("menubar"))return Nr("menuitem-outside-menu",r,`${a} is a ${i} outside any menu.`,'A menu item is owned by a menu, and is announced as one of its items. Put it in a container with role="menu" or role="menubar".',"1.3.1");if(i==="option"&&!s.includes("listbox")&&!o.includes("select")&&!o.includes("datalist"))return Nr("option-outside-listbox",r,`${a} is an option outside any listbox.`,'An option is owned by a listbox, and is announced as one of its choices. Put it in a container with role="listbox", or in a <select>.',"1.3.1");return null}function p9(e){let t=[];for(let{node:n}of aa(e)){if(Ys(n)!=="tab")continue;let r=ua(n,"aria-selected");if(r.kind==="bound")return null;t.push(r.kind==="other"&&r.isTrue||r.kind==="text"&&r.text==="true")}return t}function m9(e){let{node:t,path:n}=e;if(Ys(t)!=="tablist")return null;let r=p9(t);if(r===null||r.length===0||r.includes(!0))return null;return Nr("tablist-none-selected",n,`${Qt(t,"the tablist")} has ${r.length} tab(s) and none is selected.`,'A tablist always has a current tab, and aria-selected="true" is how it is announced. Mark the tab whose panel is showing.',"4.1.2","warn")}function h9(e){let{node:t,path:n}=e,r=Ys(t);if(!(yt(t)==="dialog"||r==="dialog"||r==="alertdialog")||r==="bound")return null;if(Ln(t,"aria-label")||zt(t,"aria-labelledby"))return null;return Nr("dialog-unnamed",n,`${Qt(t,"the dialog")} has no accessible name.`,"A dialog is announced by its name when it opens, and its content does not name it. Give it aria-labelledby naming its heading, or an aria-label.","4.1.2")}function y9(e){let{node:t,path:n}=e;if(!zt(t,"aria-activedescendant"))return null;let r=yt(t);if(g9.has(r)||r==="a"&&zt(t,"href")||zt(t,"tabIndex")||zt(t,"tabindex")||zt(t,"contenteditable"))return null;return Nr("activedescendant-not-focusable",n,`${Qt(t,"the element")} manages focus with aria-activedescendant but cannot itself take focus.`,"aria-activedescendant names the active child of a FOCUSED container; on one that cannot be focused, the keyboard never reaches it. Give the container a tabindex.","2.1.1")}function wC(e){let t=[...aa(e)],n=new Set,r={bound:!1,ids:new Set},s=new Map,o=!1;for(let{node:a}of t){let c=Ys(a);if(c!==null&&n9.has(c)){let u=s.get(c)??{bound:!1,ids:new Set},d=ca(a,"aria-owns");if(d===null)u.bound||=zt(a,"aria-owns");else for(let p of d.split(/\s+/))if(p!=="")u.ids.add(p);s.set(c,u)}let l=xd(a);if(l===la)o=!0;else if(l!==null)n.add(l);if(yt(a)==="label"){let u=ca(a,"for")??ca(a,"htmlFor");if(u===null)r.bound||=zt(a,"for")||zt(a,"htmlFor");else r.ids.add(u)}}let i=[];for(let a of t){let c=[s9(a,r),c9(a),d9(a,s),a9(a),m9(a),h9(a),y9(a)];for(let l of c)if(l)i.push(l);if(!o)i.push(...u9(a,n))}return i}var Z8="See docs/framework/concepts/accessibility.",la="bound",Q8,e9,t9,SC,n9,i9,l9,g9;var vC=R(()=>{le();yd();Q8=new Set(["button","checkbox","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","switch","tab","treeitem"]),e9=new Set(["combobox","listbox","searchbox","slider","spinbutton","textbox"]),t9=new Set(["button","reset","submit"]),SC=new Map([["menuitem",["menu","menubar"]],["menuitemcheckbox",["menu","menubar"]],["menuitemradio",["menu","menubar"]],["option",["listbox"]],["tab",["tablist"]]]),n9=new Set([...SC.values()].flat());i9=new Set(["select","jx-select"]);l9=["aria-activedescendant","aria-controls","aria-describedby","aria-details","aria-errormessage","aria-flowto","aria-labelledby","aria-owns"];g9=new Set(["button","input","select","textarea"])});function gx(e){return yt(e)==="dialog"}function EC(e){return e.startsWith("--")}function E9(e){let t=[];for(let{node:n}of Cr(e)){let r=Xs(n);if(gx(n)&&r!==null&&!t.includes(r))t.push(r)}return t}function j9(e){let t=e.oncommand;return t!==void 0&&t!==null}function P9(e,t){for(let{node:n}of Cr(e)){if(n===e)continue;let r=yt(n);if(r==="button"){let s=Bt(n,"command"),o=Bt(n,"commandfor");if(s!==null&&(s==="close"||s==="request-close")&&(o===null||o===t))return!0}if(r==="form"&&Bt(n,"method")?.toLowerCase()==="dialog")return!0}return!1}function PC(e,t){let n=[...Cr(e,[],null,t)],r=E9(e),s=hx(e,t),o=r.length>0||s.length>0,i=new Map,a=new Map;for(let{node:l}of n){let u=Xs(l);if(u!==null&&!i.has(u))i.set(u,l);if(yt(l)==="button"){let d=Bt(l,"commandfor"),p=Bt(l,"command");if(d!==null){let m=a.get(d)??new Set;m.add(p??""),a.set(d,m)}}}let c=[];for(let{node:l,path:u}of n)if(c.push(..._9(l,u,i,r,s,o,t)),gx(l))c.push(...k9(l,u,a));return c}function _9(e,t,n,r,s,o,i){let a=[],c=yt(e),l=i?.invokerTags?.has(c)??!1,u=Bt(e,"command"),d=Bt(e,"commandfor");if(!(u!==null||d!==null||("command"in Rr(e))||("commandfor"in Rr(e))))return a;let m=Qt(e,"the element");if(!v9.has(c)&&!l)return a.push({detail:"`command` and `commandfor` are attributes of `HTMLButtonElement` and of no other "+"interface — not even `<input>`, which `popovertarget` does allow. Elsewhere they parse "+`and do nothing. Make it a <button>, or remove both attributes. ${Ge}`,fix:"invoker",message:`<${c||"element"}> carries command/commandfor, which only <button> supports.`,path:t,rule:"invoker-not-button",severity:"error"}),a;if(u!==null&&!S9.has(u)&&!EC(u))return a.push({detail:`\`command\` is an enumerated attribute taking ${jC.map((x)=>`\`${x}\``).join(", ")}, or a custom command starting with \`--\`. Anything else is the invalid-value state, and a button in that state does nothing when clicked. ${Ge}`,message:`${m} declares command="${u}", which is not a built-in or --custom command.`,path:t,rule:"command-invalid",severity:"error"}),a;if(d!==null){let x=n.get(d),g=r.includes(d),y=s.includes(d);if(!x&&o){let S=[...r,...s].map((E)=>`"${E}"`).join(", ");return a.push({detail:`No element in this document has the id "${d}". The dialogs and popovers here are: ${S}. A commandfor that names nothing does nothing, silently. ${Ge}`,message:`commandfor="${d}" names nothing in this document.`,path:t,rule:"command-target-missing",severity:"error"}),a}if(u!==null&&x){if(x9.has(u)&&!gx(x))a.push({detail:`\`${u}\` acts on a <dialog>, and "${d}" is ${y?"a popover":`a <${yt(x)||"element"}>`}. The click is ignored. ${y?"Use `toggle-popover`, `show-popover` or `hide-popover` for a popover.":"Point it at a dialog, or make the target one."} ${Ge}`,message:`${m} sends ${u} to "${d}", which is not a dialog.`,path:t,rule:"command-target-mismatch",severity:"error"});else if(b9.has(u)&&!Vc(x,i))a.push({detail:`\`${u}\` acts on a popover, and "${d}" is ${g?"a dialog":`a <${yt(x)||"element"}>`} that declares no \`popover\`. The click is ignored. ${g?"Use `show-modal`, `close` or `request-close` for a dialog.":"Give the target a `popover` attribute, or point the button elsewhere."} ${Ge}`,message:`${m} sends ${u} to "${d}", which is not a popover.`,path:t,rule:"command-target-mismatch",severity:"error"});else if(EC(u)&&!j9(x))a.push({detail:`A custom command is a \`CommandEvent\` dispatched at its target, and "${d}" has no `+"`oncommand` handler to answer it — so the click does nothing. Add one that switches on "+`\`event#/command\`, or use a built-in command. ${Ge}`,message:`${m} sends ${u} to "${d}", which handles no command.`,path:t,rule:"custom-command-unhandled",severity:"warn"})}}return a}function k9(e,t,n){let r=[],s=Qt(e,"the dialog"),o=Xs(e),{style:i}=e,a=Bt(e,"closedby");if(a!==null&&!w9.has(a))r.push({detail:`\`closedby\` is an enumerated attribute taking \`any\` (light dismiss and Escape), \`closerequest\` (Escape only, the default for a modal) or \`none\`. Anything else is the invalid-value default, \`auto\`, which is the same as leaving it out. ${Ge}`,message:`${s} declares closedby="${a}", which is not any, closerequest or none.`,path:t,rule:"dialog-closedby-invalid",severity:"error"});if(Zt(i,"display")!==null)r.push({detail:`A closed dialog is hidden by the browser's own \`dialog:not([open]) { display: none }\`. That rule is UA-origin, so any author \`display\` beats it, and the dialog is laid out on every page whether or not anyone opened it. \`display\` belongs in the \`&[open]\` rule and nowhere else. ${Ge}`,fix:"display",message:`${s} sets display in its base rule.`,path:t,rule:"dialog-display",severity:"error"});let c=o===null?void 0:n.get(o),l=Bt(e,"open")!==null||Rr(e).open===!0||e.open===!0;if(o!==null&&!c?.has("show-modal")&&!l)r.push({detail:`No <button> in this document opens it with \`command="show-modal"\`. If it is opened from another file or from a function that calls \`showModal()\`, this is fine; otherwise there is no way for a reader to open it. ${Ge}`,message:`${s} has no invoker in this document.`,path:t,rule:"dialog-no-invoker",severity:"warn"});if(c?.has("show-modal")&&a==="none"&&!P9(e,o))r.push({detail:`A modal dialog makes everything outside it inert, so the only ways out are the ones it offers: \`closedby="none"\` turns off Escape and light dismiss, and nothing inside it closes it. A reader who opens it cannot leave. Add a <button command="close"> inside, or drop \`closedby="none"\`. ${Ge}`,message:`${s} opens modally, closes on nothing, and has no close button.`,path:t,rule:"modal-without-close",severity:"error"});return r}var jC,x9,b9,$9,S9,w9,v9;var _C=R(()=>{le();yd();jC=["toggle-popover","show-popover","hide-popover","show-modal","close","request-close"],x9=new Set(["show-modal","close","request-close"]),b9=new Set(["toggle-popover","show-popover","hide-popover"]),$9=["any","closerequest","none"],S9=new Set(jC),w9=new Set($9),v9=new Set(["button"])});var DC=q(function(JC){Object.defineProperty(JC,"__esModule",{value:!0});JC.formatNames=JC.fastFormats=JC.fullFormats=void 0;function Tr(e,t){return{validate:e,compare:t}}JC.fullFormats={date:Tr(CC,$x),time:Tr(xx(!0),Sx),"date-time":Tr(kC(!0),NC),"iso-time":Tr(xx(),RC),"iso-date-time":Tr(kC(),TC),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:T9,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:V9,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:J9,int32:{type:"number",validate:M9},int64:{type:"number",validate:F9},float:{type:"number",validate:AC},double:{type:"number",validate:AC},password:!0,binary:!0};JC.fastFormats={...JC.fullFormats,date:Tr(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,$x),time:Tr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Sx),"date-time":Tr(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,NC),"iso-time":Tr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,RC),"iso-date-time":Tr(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,TC),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};JC.formatNames=Object.keys(JC.fullFormats);function O9(e){return e%4===0&&(e%100!==0||e%400===0)}var A9=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,C9=[0,31,28,31,30,31,30,31,31,30,31,30,31];function CC(e){let t=A9.exec(e);if(!t)return!1;let n=+t[1],r=+t[2],s=+t[3];return r>=1&&r<=12&&s>=1&&s<=(r===2&&O9(n)?29:C9[r])}function $x(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var yx=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function xx(e){return function(n){let r=yx.exec(n);if(!r)return!1;let s=+r[1],o=+r[2],i=+r[3],a=r[4],c=r[5]==="-"?-1:1,l=+(r[6]||0),u=+(r[7]||0);if(l>23||u>59||e&&!a)return!1;if(s<=23&&o<=59&&i<60)return!0;let d=o-u*c,p=s-l*c-(d<0?1:0);return(p===23||p===-1)&&(d===59||d===-1)&&i<61}}function Sx(e,t){if(!(e&&t))return;let n=new Date("2020-01-01T"+e).valueOf(),r=new Date("2020-01-01T"+t).valueOf();if(!(n&&r))return;return n-r}function RC(e,t){if(!(e&&t))return;let n=yx.exec(e),r=yx.exec(t);if(!(n&&r))return;if(e=n[1]+n[2]+n[3],t=r[1]+r[2]+r[3],e>t)return 1;if(e<t)return-1;return 0}var bx=/t|\s/i;function kC(e){let t=xx(e);return function(r){let s=r.split(bx);return s.length===2&&CC(s[0])&&t(s[1])}}function NC(e,t){if(!(e&&t))return;let n=new Date(e).valueOf(),r=new Date(t).valueOf();if(!(n&&r))return;return n-r}function TC(e,t){if(!(e&&t))return;let[n,r]=e.split(bx),[s,o]=t.split(bx),i=$x(n,s);if(i===void 0)return;return i||Sx(r,o)}var R9=/\/|:/,N9=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function T9(e){return R9.test(e)&&N9.test(e)}var OC=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function J9(e){return OC.lastIndex=0,OC.test(e)}var I9=-2147483648,D9=2147483647;function M9(e){return Number.isInteger(e)&&e<=D9&&e>=I9}function F9(e){return Number.isInteger(e)}function AC(){return!0}var L9=/[^\\]\\Z/;function V9(e){if(L9.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var FC=q(function(MC){Object.defineProperty(MC,"__esModule",{value:!0});var W9=Qy(),H9=ex(),U9=sx(),B9=ax(),$d=cx(),z9=[W9.default,H9.default,(0,U9.default)(),B9.default,$d.metadataVocabulary,$d.contentVocabulary];MC.default=z9});var LC=q(function(ire,G9){G9.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var qC=q(function(pn,vx){Object.defineProperty(pn,"__esModule",{value:!0});pn.MissingRefError=pn.ValidationError=pn.CodeGen=pn.Name=pn.nil=pn.stringify=pn.str=pn._=pn.KeywordCxt=pn.Ajv=void 0;var X9=Zy(),Y9=FC(),Z9=lx(),VC=LC(),Q9=["/properties"],Sd="http://json-schema.org/draft-07/schema";class qc extends X9.default{_addVocabularies(){if(super._addVocabularies(),Y9.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(Z9.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(VC,Q9):VC;this.addMetaSchema(e,Sd,!1),this.refs["http://json-schema.org/schema"]=Sd}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Sd)?Sd:void 0)}}pn.Ajv=qc;vx.exports=pn=qc;vx.exports.Ajv=qc;Object.defineProperty(pn,"__esModule",{value:!0});pn.default=qc;var e4=zi();Object.defineProperty(pn,"KeywordCxt",{enumerable:!0,get:function(){return e4.KeywordCxt}});var fa=ye();Object.defineProperty(pn,"_",{enumerable:!0,get:function(){return fa._}});Object.defineProperty(pn,"str",{enumerable:!0,get:function(){return fa.str}});Object.defineProperty(pn,"stringify",{enumerable:!0,get:function(){return fa.stringify}});Object.defineProperty(pn,"nil",{enumerable:!0,get:function(){return fa.nil}});Object.defineProperty(pn,"Name",{enumerable:!0,get:function(){return fa.Name}});Object.defineProperty(pn,"CodeGen",{enumerable:!0,get:function(){return fa.CodeGen}});var t4=Jc();Object.defineProperty(pn,"ValidationError",{enumerable:!0,get:function(){return t4.default}});var n4=Gi();Object.defineProperty(pn,"MissingRefError",{enumerable:!0,get:function(){return n4.default}})});var UC=q(function(HC){Object.defineProperty(HC,"__esModule",{value:!0});HC.formatLimitDefinition=void 0;var WC=qC(),ft=ye(),Zs=ft.operators,wd={formatMaximum:{okStr:"<=",ok:Zs.LTE,fail:Zs.GT},formatMinimum:{okStr:">=",ok:Zs.GTE,fail:Zs.LT},formatExclusiveMaximum:{okStr:"<",ok:Zs.LT,fail:Zs.GTE},formatExclusiveMinimum:{okStr:">",ok:Zs.GT,fail:Zs.LTE}},o4={message:({keyword:e,schemaCode:t})=>ft.str`should be ${wd[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>ft._`{comparison: ${wd[e].okStr}, limit: ${t}}`};HC.formatLimitDefinition={keyword:Object.keys(wd),type:"string",schemaType:"string",$data:!0,error:o4,code(e){let{gen:t,data:n,schemaCode:r,keyword:s,it:o}=e,{opts:i,self:a}=o;if(!i.validateFormats)return;let c=new WC.KeywordCxt(o,a.RULES.all.format.definition,"format");if(c.$data)l();else u();function l(){let p=t.scopeValue("formats",{ref:a.formats,code:i.code.formats}),m=t.const("fmt",ft._`${p}[${c.schemaCode}]`);e.fail$data(ft.or(ft._`typeof ${m} != "object"`,ft._`${m} instanceof RegExp`,ft._`typeof ${m}.compare != "function"`,d(m)))}function u(){let p=c.schema,m=a.formats[p];if(!m||m===!0)return;if(typeof m!="object"||m instanceof RegExp||typeof m.compare!="function")throw Error(`"${s}": format "${p}" does not define "compare" function`);let x=t.scopeValue("formats",{key:p,ref:m,code:i.code.formats?ft._`${i.code.formats}${ft.getProperty(p)}`:void 0});e.fail$data(d(x))}function d(p){return ft._`${p}.compare(${n}, ${r}) ${wd[s].fail} 0`}},dependencies:["format"]};var i4=(e)=>(e.addKeyword(HC.formatLimitDefinition),e);HC.default=i4});var GC=q(function(Wc,KC){Object.defineProperty(Wc,"__esModule",{value:!0});var Vn=DC(),c4=UC(),da=ye(),BC=new da.Name("fullFormats"),l4=new da.Name("fastFormats"),jx=(e,t={keywords:!0})=>{if(Array.isArray(t))return zC(e,t,Vn.fullFormats,BC),e;let[n,r]=t.mode==="fast"?[Vn.fastFormats,l4]:[Vn.fullFormats,BC],s=t.formats||Vn.formatNames;if(zC(e,s,n,r),t.keywords)(0,c4.default)(e);return e};jx.get=(e,t="full")=>{let r=(t==="fast"?Vn.fastFormats:Vn.fullFormats)[e];if(!r)throw Error(`Unknown format "${e}"`);return r};function zC(e,t,n,r){var s,o;(s=(o=e.opts.code).formats)!==null&&s!==void 0||(o.formats=da._`require("ajv-formats/dist/formats").${r}`);for(let i of t)e.addFormat(i,n[i])}KC.exports=Wc=jx;Object.defineProperty(Wc,"__esModule",{value:!0});Wc.default=jx});import{existsSync as ZC,readFileSync as _x,readdirSync as QC,statSync as eR}from"node:fs";import{createRequire as u4}from"node:module";import{join as tR,relative as pa,resolve as Px}from"node:path";async function m4(){try{let{default:e}=await Promise.resolve().then(() => ar(dx(),1)),{default:t}=await Promise.resolve().then(() => ar(GC(),1));return{addFormats:t,Ajv:e}}catch(e){throw Error("Project validation requires ajv and ajv-formats: bun add ajv ajv-formats",{cause:e})}}async function nR(e,t={}){let n=Px(e),r=[],s=[],o=0;for(let v of["project.schema.json","document.schema.json"]){let j=Px(n,v);if(!ZC(j))continue;o+=1;let P=Hc(j),O=x4(P);if(O.length>0)r.push({errors:O.map(({reason:T,ref:U})=>({message:`$ref "${U}" ${T} — committed entry documents must be self-contained `+"single-resource schemas; regenerate with `jx schema`"})),file:v})}if(r.length>0)return{checked:o,issues:r,lint:s,valid:!1};let i=await fC(n);if(o+=1,!i.valid)r.push({errors:i.errors??[],file:i.file});let{addFormats:a,Ajv:c}=await m4(),{document:l}=await dj(n,{write:!1}),u=new c({allErrors:!0,ownProperties:!0,strict:!1});a(u);let d=u.compile(l),p=mC(YC(n).flatMap((v)=>{try{return[JSON.parse(_x(v,"utf8"))]}catch{return[]}}));for(let v of f4)for(let j of oR(Px(n,v))){if(j.endsWith(".class.json"))continue;o+=1;let P=h4(j,pa(n,j));if(s.push(...P.warnings),P.failure!==null){r.push(P.failure);continue}let O=P.document,T=XC(O,pa(n,j));if(s.push(...T.warnings),T.failure!==null){r.push(T.failure);continue}if(d(O))s.push(...y4(O,pa(n,j),p));else r.push({errors:d.errors??[],file:pa(n,j)})}let m=new c({allErrors:!0,ownProperties:!0,strict:!1});a(m);let x=m.compile(py());for(let v of YC(n)){o+=1;let j=Hc(v),P=XC(j,pa(n,v));if(s.push(...P.warnings),P.failure!==null)r.push(P.failure);else if(!x(j))r.push({errors:x.errors??[],file:pa(n,v)})}let{config:g}=gs(n),y=await hs(n,g),S=u4(import.meta.url);for(let v of y.extensions)for(let j of["project","document","fields"]){let P=v.schemas[j];if(!P)continue;o+=1;let O=new c({allErrors:!0,ownProperties:!0,strict:!1});a(O);for(let T of p4){let U=S.resolve(T);O.addSchema(Hc(U))}try{O.compile(Hc(P))}catch(T){r.push({errors:[{message:T instanceof Error?T.message:String(T)}],file:`${v.specifier} (${j} fragment)`})}}let E=t.strict===!0&&s.some((v)=>v.severity==="error");return{checked:o,issues:r,lint:s,valid:r.length===0&&!E}}function h4(e,t){if(!Wr(e))return{document:Hc(e),failure:null,warnings:[]};let n=_x(e,"utf8"),r=rp(n).map((s)=>({detail:s.message,file:t,message:`line ${s.line}, column ${s.column}: ${s.message}`,path:[],rule:"escape",severity:"warn",source:"notation"}));try{return{document:g4(n),failure:null,warnings:r}}catch(s){return{document:null,failure:{errors:[{message:ge(s)}],file:t},warnings:r}}}function XC(e,t){let n=[];try{Va(e,t,n)}catch(s){return{failure:{errors:[{message:ge(s)}],file:t},warnings:[]}}return{failure:null,warnings:n.map(({pointer:s,problem:o})=>({detail:o.message,file:t,message:`${s} (line ${o.line}, column ${o.column}): ${o.message}`,path:s.split("/").slice(1),rule:"typescript-reading",severity:"warn",source:"function-body"}))}}function g4(e){let t=mo(e);return L(t)?t:null}function Hc(e){return JSON.parse(_x(e,"utf8"))}function y4(e,t,n){let r=[];for(let s of bC(e,n))r.push({...vd(s),file:t,source:"popover"});for(let s of PC(e,n))r.push({...vd(s),file:t,source:"dialog"});for(let s of wC(e))r.push({...vd(s),criterion:s.criterion,file:t,source:"accessibility"});for(let s of cw(e))r.push({...vd({...s,severity:"info"}),file:t,source:"module"});return r}function vd(e){return{detail:e.detail,message:e.message,path:e.path,rule:e.rule,severity:e.severity}}function rR(e){return e.lint.map((t)=>{let n=t.criterion===void 0?`${t.source}/${t.rule}`:`${t.source}/${t.rule}, WCAG ${t.criterion}`;return`${t.file}: ${t.severity}: ${t.message} [${n}]`})}function x4(e){let t=[],n=new Set,r=(o)=>{let i=e;for(let a of o.slice(1).split("/")){if(a==="")continue;let c=a.replaceAll("~1","/").replaceAll("~0","~");if(!I(i))return!1;if(i=i[c],i===void 0)return!1}return!0},s=(o)=>{if(!L(o)||n.has(o))return;n.add(o);let i=o.$ref;if(k(i)){if(/^[a-zA-Z][a-zA-Z\d+.-]*:/.test(i))t.push({reason:"is an absolute URI editors resolve over the network",ref:i});else if(!i.startsWith("#"))t.push({reason:"is a relative path only Node module resolution can follow",ref:i});else if(i.length>1&&!i.startsWith("#/"))t.push({reason:"is an $anchor reference, which has no root-pointer form",ref:i});else if(i.length>1&&!r(i.slice(1)))t.push({reason:"points at no node in this document",ref:i})}for(let[a,c]of Object.entries(o)){if(!b4.has(a))continue;if(Array.isArray(c))for(let l of c)s(l);else if(L(c)){if(s(c),sR.has(a))for(let l of Object.values(c))s(l)}}};return s(e),t}function oR(e){if(!ZC(e))return[];let t=[];for(let n of QC(e)){let r=tR(e,n);if(eR(r).isDirectory())t.push(...oR(r));else if(Hr(n))t.push(r)}return t.toSorted()}function YC(e){let t=[],n=(r)=>{for(let s of QC(r)){if(d4.has(s))continue;let o=tR(r,s);if(eR(o).isDirectory())n(o);else if(s.endsWith(".class.json"))t.push(o)}};return n(e),t.toSorted()}function iR(e){let t=[];for(let n of e.issues){t.push(`${n.file}:`);for(let r of n.errors){let s=L(r)?r:{},{instancePath:o,message:i}=s;t.push(` - ${o||"/"}: ${i??JSON.stringify(r)}`)}}return t}var f4,d4,p4,sR,b4;var aR=R(()=>{ms();Rt();tu();Jj();dC();vC();_C();bi();yd();le();Br();ii();fy();f4=["components","pages","layouts"],d4=new Set(["node_modules","dist",".git"]),p4=["@jxsuite/schema/schemas/project.core.schema.json","@jxsuite/schema/schemas/project.fields.schema.json","@jxsuite/schema/schemas/document.paths.schema.json"];sR=new Set(["$defs","definitions","dependencies","dependentSchemas","patternProperties","properties"]),b4=new Set([...sR,"additionalItems","additionalProperties","allOf","anyOf","contains","contentSchema","else","if","items","not","oneOf","prefixItems","propertyNames","then","unevaluatedItems","unevaluatedProperties"])});Rt();import{relative as kx,resolve as cR}from"node:path";async function $4(){let e=process.argv.slice(2),[t]=e;if(!t||t==="--help"||t==="-h")console.log(`Usage: jx <command> [options]
625
622
 
626
623
  Commands:
627
624
  build [root] Build a Jx site to dist/
@@ -637,14 +634,16 @@ Options:
637
634
  --verbose Print detailed build progress
638
635
  --no-clean Don't clean outDir before building
639
636
  --include-held Keep entries a content type's hold rules match, for a preview
637
+ --no-optimize-images Publish images as they are, whatever images.optimize says (also
638
+ JX_IMAGES_OPTIMIZE=false in the environment)
640
639
  --port <n> dev/preview: port to listen on (default 3000 / 4173)
641
640
  --dry-run db push: print the statements without executing them
642
641
  --connection db push: restrict to one connection name
643
642
  --strict validate: fail on an overlay or accessibility lint error, not only a schema error
644
643
  --to <format> convert: jxn or json
645
644
  --drop-comments convert: convert a .jxn file to .json even though it has comments
646
- --check format: write nothing, and fail when a file would change`),process.exit(0);if(t==="convert"||t==="format"){try{if(t==="convert"){await Promise.resolve().then(() => ty());ey(process.cwd(),e.slice(1))}else{await Promise.resolve().then(() => ry());ny(process.cwd(),e.slice(1))}}catch(d){console.error($e(d)),process.exit(1)}return}let n=t==="db",r=n?e[1]:null,s=e.slice(n?2:1),o=new Set,i=[],a,c;for(let d=0;d<s.length;d+=1){let p=s[d];if(p==="--connection")d+=1,a=s[d];else if(p==="--port"){d+=1;let m=Math.trunc(Number(s[d]??""));if(Number.isFinite(m)&&m>=0)c=m}else if(p.startsWith("--"))o.add(p);else i.push(p)}let[l]=i,u=sR(l??".");if(n){if(r!=="push")console.error(`Unknown db subcommand: ${r??"(none)"}
647
- Usage: jx db push [root] [--dry-run] [--connection <name>]`),process.exit(1);let d=o.has("--dry-run");try{await Promise.resolve().then(() => Cx());let m={dryRun:d};if(a!==void 0)m.connection=a;let{results:x,bindingsPatched:h,wranglerPath:g}=await Rx(u,m);for(let b of x){let j=b.applied?"applied":"dry-run";console.log(`${b.connection} (${b.provider}) — ${b.tables.length} table(s), ${b.statements.length} statement(s) [${j}]`);for(let v of b.statements)console.log(` ${v}`);for(let v of b.warnings)console.warn(` warning: ${v}`)}if(h&&g)console.log(`Updated bindings in ${Ag(u,g)}`)}catch(p){console.error(`db push failed: ${$e(p)}`),process.exit(1)}return}if(t==="build"){let d=o.has("--verbose"),p=!o.has("--no-clean"),m=o.has("--include-held");console.log(`Building site from ${u}...`);try{await Promise.resolve().then(() => $v());let h=await mv(u,{clean:p,includeHeld:m,verbose:d});if(h.errors.length>0){console.error(`
648
- Build completed with ${h.errors.length} error(s):`);for(let g of h.errors)console.error(` - ${g}`);process.exit(1)}console.log(`
649
- Done: ${h.routes} routes → ${h.files} files`)}catch(x){console.error(`Build failed: ${$e(x)}`),process.exit(1)}}else if(t==="dev")try{await Promise.resolve().then(() => Sv());wv(u,c)}catch(d){console.error($e(d)),process.exit(1)}else if(t==="preview"){let{existsSync:d}=await import("node:fs"),p=sR(u,"dist");if(!d(p))console.error(`No build output at ${p} — run \`jx build\` first.`),process.exit(1);await Promise.resolve().then(() => Pv());let x=c??4173;jv(p,x),console.log(`Previewing ${p} at http://localhost:${x}`)}else if(t==="schema")try{await Promise.resolve().then(() => nh());let{projectSchemaPath:p,documentSchemaPath:m}=await Fv(u);console.log(`Wrote ${Ag(u,p)}`),console.log(`Wrote ${Ag(u,m)}`)}catch(d){console.error(`Schema generation failed: ${$e(d)}`),process.exit(1)}else if(t==="validate")try{await Promise.resolve().then(() => rR());let x=await ZA(u,{strict:o.has("--strict")}),h=QA(x);if(x.valid){console.log(`Project is valid (${x.checked} files checked in ${u})`);for(let g of h)console.log(g)}else{console.error(`Project is INVALID (${u}):`);for(let g of[...nR(x),...h])console.error(g);process.exit(1)}}catch(d){console.error(`Validation failed: ${$e(d)}`),process.exit(1)}else console.error(`Unknown command: ${t}
650
- Run "jx --help" for usage.`),process.exit(1)}var _te=G8();export{_te as ready};
645
+ --check format: write nothing, and fail when a file would change`),process.exit(0);if(t==="convert"||t==="format"){try{if(t==="convert"){await Promise.resolve().then(() => eb());Qx(process.cwd(),e.slice(1))}else{await Promise.resolve().then(() => nb());tb(process.cwd(),e.slice(1))}}catch(d){console.error(ge(d)),process.exit(1)}return}let n=t==="db",r=n?e[1]:null,s=e.slice(n?2:1),o=new Set,i=[],a,c;for(let d=0;d<s.length;d+=1){let p=s[d];if(p==="--connection")d+=1,a=s[d];else if(p==="--port"){d+=1;let m=Math.trunc(Number(s[d]??""));if(Number.isFinite(m)&&m>=0)c=m}else if(p.startsWith("--"))o.add(p);else i.push(p)}let[l]=i,u=cR(l??".");if(n){if(r!=="push")console.error(`Unknown db subcommand: ${r??"(none)"}
646
+ Usage: jx db push [root] [--dry-run] [--connection <name>]`),process.exit(1);let d=o.has("--dry-run");try{await Promise.resolve().then(() => T$());let m={dryRun:d};if(a!==void 0)m.connection=a;let{results:x,bindingsPatched:g,wranglerPath:y}=await N$(u,m);for(let S of x){let E=S.applied?"applied":"dry-run";console.log(`${S.connection} (${S.provider}) — ${S.tables.length} table(s), ${S.statements.length} statement(s) [${E}]`);for(let v of S.statements)console.log(` ${v}`);for(let v of S.warnings)console.warn(` warning: ${v}`)}if(g&&y)console.log(`Updated bindings in ${kx(u,y)}`)}catch(p){console.error(`db push failed: ${ge(p)}`),process.exit(1)}return}if(t==="build"){let d=o.has("--verbose"),p=!o.has("--no-clean"),m=o.has("--include-held");console.log(`Building site from ${u}...`);try{await Promise.resolve().then(() => KE());await Promise.resolve().then(() => ii());let y=!o.has("--no-optimize-images")&&!A$(process.env.JX_IMAGES_OPTIMIZE),S=await VE(u,{clean:p,includeHeld:m,optimizeImages:y,verbose:d});if(S.errors.length>0){console.error(`
647
+ Build completed with ${S.errors.length} error(s):`);for(let E of S.errors)console.error(` - ${E}`);process.exit(1)}console.log(`
648
+ Done: ${S.routes} routes → ${S.files} files`)}catch(x){console.error(`Build failed: ${ge(x)}`),process.exit(1)}}else if(t==="dev")try{await Promise.resolve().then(() => XE());GE(u,c)}catch(d){console.error(ge(d)),process.exit(1)}else if(t==="preview"){let{existsSync:d}=await import("node:fs"),p=cR(u,"dist");if(!d(p))console.error(`No build output at ${p} — run \`jx build\` first.`),process.exit(1);await Promise.resolve().then(() => ej());let x=c??4173;QE(p,x),console.log(`Previewing ${p} at http://localhost:${x}`)}else if(t==="schema")try{await Promise.resolve().then(() => fy());let{projectSchemaPath:p,documentSchemaPath:m}=await fj(u);console.log(`Wrote ${kx(u,p)}`),console.log(`Wrote ${kx(u,m)}`)}catch(d){console.error(`Schema generation failed: ${ge(d)}`),process.exit(1)}else if(t==="validate")try{await Promise.resolve().then(() => aR());let x=await nR(u,{strict:o.has("--strict")}),g=rR(x);if(x.valid){console.log(`Project is valid (${x.checked} files checked in ${u})`);for(let y of g)console.log(y)}else{console.error(`Project is INVALID (${u}):`);for(let y of[...iR(x),...g])console.error(y);process.exit(1)}}catch(d){console.error(`Validation failed: ${ge(d)}`),process.exit(1)}else console.error(`Unknown command: ${t}
649
+ Run "jx --help" for usage.`),process.exit(1)}var Jre=$4();export{Jre as ready};