@jxsuite/compiler 11.0.0 → 11.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -1,71 +1,71 @@
1
1
  #!/usr/bin/env node
2
- import{createRequire as LN}from"node:module";var NN=Object.create;var{getPrototypeOf:TN,defineProperty:Tb,getOwnPropertyNames:JN}=Object;var Jb=Object.prototype.hasOwnProperty;function MN(e){return this[e]}var IN,DN,Sr=(e,t,n)=>{var r=e!=null&&typeof e==="object";if(r){var s=t?IN??=new WeakMap:DN??=new WeakMap,o=s.get(e);if(o)return o}n=e!=null?NN(TN(e)):{};let i=t||!e||!e.__esModule||!Jb.call(e,"default")?Tb(n,"default",{value:e,enumerable:!0}):n;if(e&&typeof e==="object"||typeof e==="function"){for(let a of JN(e))if(!Jb.call(i,a))Tb(i,a,{get:MN.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 J=(e,t,n)=>()=>{if(e)try{t=e(e=0)}catch(r){n=[r]}if(n)throw n[0];return t};var pt=LN(import.meta.url);function k(e){return typeof e==="string"}function Ie(e){return typeof e==="number"}function Ge(e){return typeof e==="boolean"}function _t(e){return typeof e==="function"}function D(e){return typeof e==="object"&&e!==null}function L(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function me(e){return L(e)&&typeof e.$ref==="string"}function kt(e){return L(e)&&e.$prototype==="Function"}function fn(e){return L(e)&&L(e.$expression)}function wr(e){return fn(e)&&Array.isArray(e.parameters)&&e.parameters.length>0}function vr(e){return kt(e)&&Array.isArray(e.body)}function Pn(e){return L(e)&&typeof e.$prototype==="string"&&e.$prototype!=="Function"}function Zr(e){return L(e)&&e.timing==="server"&&typeof e.$src==="string"&&typeof e.$export==="string"&&!e.$prototype}function jc(e){return L(e)&&!e.$prototype&&!e.$expression&&"default"in e}function $s(e){if(!L(e))return!1;for(let t of Object.keys(e))if(!hp.has(t))return!1;return!0}function Db(e){if(!L(e))return!1;for(let t of Object.keys(e))if(hp.has(t))return!0;return!1}function Le(e){return L(e)&&e.$prototype==="Array"}function Lb(e){return(Array.isArray(e)?e:[e]).some((n)=>Le(n))}function Fb(e){return L(e)&&e.$prototype==="Class"}function Ot(e){return L(e)}function le(e){return typeof e==="string"&&e.includes("${")}function Vb(e){return/\breturn\b[^\S\n]*(?![;}\s]|$)/.test(po(e))}function gp(e){return e.$prototype==="Function"||k(e.role)&&e.role!=="field"}function po(e){if(!/[/'"`]/u.test(e))return e;let t=vc.get(e);if(t!==void 0)return t;let n=Wb(e);if(vc.size>=qb)vc.clear();return vc.set(e,n),n}function Hb(e){if(!e.includes("${"))return FN;let t=Ec.get(e);if(t!==void 0)return t;let n=[],r=0;while(r<e.length){let s=[];Wb(e.slice(r),s);let o=-1;for(let a=0;a<s.length;a+=2){let l=r+(s[a]??0),c=s[a+1]??-1;if(c===-1){o=l;break}n.push(Mb(e,l,r+c))}if(o===-1)break;let i=VN(e,o);if(i===-1)r=o+2;else n.push(Mb(e,o,i)),r=i}if(Ec.size>=qb)Ec.clear();return Ec.set(e,n),n}function Mb(e,t,n){return{end:n,expr:e.slice(t+2,n-1),start:t}}function VN(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 HN(e,t,n){return(t==="+"||t==="-")&&e.charAt(n-1)===t}function Ib(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 Wb(e,t){let n=e.split(""),r=(c)=>{if(n[c]!==void 0&&n[c]!==`
2
+ import{createRequire as xN}from"node:module";var dN=Object.create;var{getPrototypeOf:pN,defineProperty:n$,getOwnPropertyNames:mN}=Object;var r$=Object.prototype.hasOwnProperty;function hN(e){return this[e]}var gN,yN,Sr=(e,t,n)=>{var r=e!=null&&typeof e==="object";if(r){var s=t?gN??=new WeakMap:yN??=new WeakMap,o=s.get(e);if(o)return o}n=e!=null?dN(pN(e)):{};let i=t||!e||!e.__esModule||!r$.call(e,"default")?n$(n,"default",{value:e,enumerable:!0}):n;if(e&&typeof e==="object"||typeof e==="function"){for(let a of mN(e))if(!r$.call(i,a))n$(i,a,{get:hN.bind(e,a),enumerable:!0})}if(r)s.set(e,i);return i};var B=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var M=(e,t,n)=>()=>{if(e)try{t=e(e=0)}catch(r){n=[r]}if(n)throw n[0];return t};var yt=xN(import.meta.url);function _(e){return typeof e==="string"}function De(e){return typeof e==="number"}function Xe(e){return typeof e==="boolean"}function Ot(e){return typeof e==="function"}function F(e){return typeof e==="object"&&e!==null}function L(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function pe(e){return L(e)&&typeof e.$ref==="string"}function At(e){return L(e)&&e.$prototype==="Function"}function pn(e){return L(e)&&L(e.$expression)}function wr(e){return pn(e)&&Array.isArray(e.parameters)&&e.parameters.length>0}function vr(e){return At(e)&&Array.isArray(e.body)}function An(e){return L(e)&&typeof e.$prototype==="string"&&e.$prototype!=="Function"}function Zr(e){return L(e)&&e.timing==="server"&&typeof e.$src==="string"&&typeof e.$export==="string"&&!e.$prototype}function Oc(e){return L(e)&&!e.$prototype&&!e.$expression&&"default"in e}function vs(e){if(!L(e))return!1;for(let t of Object.keys(e))if(!kp.has(t))return!1;return!0}function i$(e){if(!L(e))return!1;for(let t of Object.keys(e))if(kp.has(t))return!0;return!1}function Le(e){return L(e)&&e.$prototype==="Array"}function a$(e){return(Array.isArray(e)?e:[e]).some((n)=>Le(n))}function l$(e){return L(e)&&e.$prototype==="Class"}function Ct(e){return L(e)}function ce(e){return typeof e==="string"&&e.includes("${")}function c$(e){return/\breturn\b[^\S\n]*(?![;}\s]|$)/.test(go(e))}function _p(e){return e.$prototype==="Function"||_(e.role)&&e.role!=="field"}function go(e){if(!/[/'"`]/u.test(e))return e;let t=kc.get(e);if(t!==void 0)return t;let n=d$(e);if(kc.size>=u$)kc.clear();return kc.set(e,n),n}function f$(e){if(!e.includes("${"))return bN;let t=_c.get(e);if(t!==void 0)return t;let n=[],r=0;while(r<e.length){let s=[];d$(e.slice(r),s);let o=-1;for(let a=0;a<s.length;a+=2){let l=r+(s[a]??0),c=s[a+1]??-1;if(c===-1){o=l;break}n.push(s$(e,l,r+c))}if(o===-1)break;let i=$N(e,o);if(i===-1)r=o+2;else n.push(s$(e,o,i)),r=i}if(_c.size>=u$)_c.clear();return _c.set(e,n),n}function s$(e,t,n){return{end:n,expr:e.slice(t+2,n-1),start:t}}function $N(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 wN(e,t,n){return(t==="+"||t==="-")&&e.charAt(n-1)===t}function o$(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 d$(e,t){let n=e.split(""),r=(c)=>{if(n[c]!==void 0&&n[c]!==`
4
4
  `)n[c]=" "},s=[],o=t!==void 0,i="",a=-1,l=0;while(l<e.length){let c=e.charAt(l);if(o)if(c==="\\")r(l),r(l+1),l+=2;else if(c==="`"&&!(t&&s.length===0))o=!1,i=c,l+=1;else if(c==="$"&&e.charAt(l+1)==="{"){if(s.length===0)t?.push(l,-1);s.push(0),o=!1,i="{",l+=2}else r(l),l+=1;else if(c==="/"&&e.charAt(l+1)==="/")while(l<e.length&&e.charAt(l)!==`
5
5
  `)r(l),l+=1;else if(c==="/"&&e.charAt(l+1)==="*"){let u=e.indexOf("*/",l+2),d=u===-1?e.length:u+2;for(;l<d;l+=1)r(l)}else if(c==="'"||c==='"'){l+=1;while(l<e.length&&e.charAt(l)!==c&&e.charAt(l)!==`
6
- `){if(e.charAt(l)==="\\")r(l),l+=1;r(l),l+=1}i=c,l+=1}else if(c==="`")o=!0,l+=1;else if(t&&c==="/"&&qN.has(i)&&!HN(e,i,a)&&Ib(e,l)>0){let u=Ib(e,l);for(l+=1;l<u-1;l+=1)r(l);i="/",l=u}else{let u=s.length-1;if(u>=0&&c==="{")s[u]=(s[u]??0)+1;else if(u>=0&&c==="}")if(s[u]===0){if(s.pop(),o=!0,t&&s.length===0)t[t.length-1]=l+1}else s[u]=(s[u]??1)-1;if(c.trim()!=="")i=c,a=l;l+=1}}return n.join("")}function mo(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Pc(e){if(!e)return[];return e.map((t)=>k(t)?t:t.name)}function WN(e){return typeof e==="string"}function rr(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 Yo(e){if(WN(e))return[e];if(!rr(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 Zo(e){return e.startsWith("#")}function Qo(e){return e.replaceAll(/-([a-z])/g,(t,n)=>n.toUpperCase())}var hp,vc,qb=2048,FN,Ec,qN;var ce=J(()=>{hp=new Set(["type","enum","minimum","maximum","minLength","maxLength","pattern","format","items","properties","required","description","title","$comment"]);vc=new Map;FN=[],Ec=new Map;qN=new Set("(,=:[!&|?{;+-*%<>~^")});function Ub(e){let t=[],n=[],r=null,s=0,o=()=>n.at(-1)?.path??"",i=()=>r===null?o():zN(o(),r),a=()=>{s+=1;let l="";while(s<e.length){let c=e[s];if(c==="\\"){let u=e[s+1]??"";if(u==="u")l+=String.fromCodePoint(Number.parseInt(e.slice(s+2,s+6),16)),s+=6;else l+=BN.get(u)??u,s+=2;continue}if(c==='"')return s+=1,l;l+=c,s+=1}return l};while(s<e.length){let l=e[s];if(Bb.has(l)||l===","||l===":"){s+=1;continue}if(l==="{"||l==="["){n.push(l==="{"?{keys:new Set,kind:"object",path:i()}:{kind:"array",path:i()}),r=null,s+=1;continue}if(l==="}"||l==="]"){n.pop(),r=null,s+=1;continue}if(l==='"'){let u=a(),d=n.at(-1);if(d?.kind==="object"&&UN(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(l==="-"||l>="0"&&l<="9"){let u=s;while(s<e.length&&/[\d+.eE-]/.test(e[s]))s+=1;let d=e.slice(u,s);if(!KN(d))t.push({detail:d,kind:"unsafe-number",path:i()});r=null;continue}let c=s;while(s<e.length&&/[A-Za-z]/.test(e[s]))s+=1;if(s===c)s+=1;r=null}return t}function UN(e,t){let n=t;while(n<e.length&&Bb.has(e[n]))n+=1;return e[n]??""}function zN(e,t){return e===""?t:`${e}.${t}`}function KN(e){if(/[.eE]/.test(e))return!0;let t=Number(e);if(!Number.isFinite(t))return!1;return String(t)===e.replace(/^\+/,"")}function zb(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 Bb,BN;var Kb=J(()=>{Bb=new Set([" ","\t",`
7
- `,"\r"]);BN=new Map([["b","\b"],["f","\f"],["n",`
8
- `],["r","\r"],["t","\t"]])});function be(e){return e instanceof Error?e.message:String(e)}function Xb(e){if(k(e))return Gb.test(e)?e.normalize("NFC"):e;if(Array.isArray(e))return e.map((t)=>Xb(t));if(L(e))return ei(e);return e}function ei(e){let t={};for(let[n,r]of Object.entries(e))t[Gb.test(n)?n.normalize("NFC"):n]=Xb(r);return t}function yp(e,t,n){let r;try{r=JSON.parse(e)}catch(o){throw Error(`Failed to parse ${n} at ${t}: ${be(o)}`,{cause:o})}if(!L(r))throw Error(`Invalid ${n} at ${t}: expected a JSON object`);let s=Ub(e);if(s.length>0){let o=s.map((i)=>zb(i)).join("; ");throw Error(`Invalid ${n} at ${t}: ${o}`)}return ei(r)}function Yb(e,t){return yp(e,t,"Jx document")}function Zb(e,t){return yp(e,t,"project config")}function Qb(e,t){return yp(e,t,"class definition")}var Gb;var Lt=J(()=>{ce();Kb();Gb=/[^\p{ASCII}]/u});import{spawn as GN}from"node:child_process";import{createRequire as XN}from"node:module";import{join as YN}from"node:path";function e$(e,t){try{return XN(YN(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 _c(e,t,n,r=GN,s=process){let o=e$(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 xp=()=>{};import{spawn as ZN}from"node:child_process";function t$(e,t,n=ZN,r=process){return _c("convert",e,t,n,r)}var n$=J(()=>{xp()});import{spawn as QN}from"node:child_process";function r$(e,t,n=QN,r=process){return _c("format",e,t,n,r)}var s$=J(()=>{xp()});function eT(e){return JSON.parse(e)}function ti(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function tT(e){return ti(e)&&typeof e.binding==="string"}function nT(e){try{let t=eT(e);return ti(t)?t:void 0}catch{return}}function o$(e,t){if(t.length===0)return{content:e??"",patched:!1};let n={};if(e){let r=nT(e);if(r===void 0)return{content:e,patched:!1};n=r}for(let r of t)i$(n,r);return{content:`${JSON.stringify(n,null,"\t")}
9
- `,patched:!0}}function i$(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]=rT(Array.isArray(s)?s:[],r);continue}if(ti(r)){if(ti(s))i$(s,r);else if(s===void 0)e[n]=structuredClone(r);continue}if(s===void 0)e[n]=r}}function rT(e,t){let n=[...e];for(let r of t){if(!tT(r)){if(!n.some((a)=>JSON.stringify(a)===JSON.stringify(r)))n.push(structuredClone(r));continue}let s=n.findIndex((i)=>ti(i)&&i.binding===r.binding),o=n[s];if(ti(o))n[s]={...o,...r};else n.push(structuredClone(r))}return n}var a$=()=>{};function f$(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(!l$.test(s)||!l$.test(o))return null;let i=o.lastIndexOf("+"),a=i===-1?null:o.slice(i+1),l=i===-1?o:o.slice(0,i);if(a==="")return null;let c=l.indexOf("."),u=c===-1?null:l.slice(0,c),d=u!==null&&sT.has(u)?u:null,p=d===null?l:l.slice(d.length+1);if(p==="")return null;let m={};for(let y of n){let S=y.indexOf("=");if(S===-1)return null;let g=y.slice(0,S).trim().toLowerCase(),x=y.slice(S+1).trim();if(g==="")return null;if(x.startsWith('"')&&x.endsWith('"')&&x.length>=2)x=x.slice(1,-1);m[g]=x}return{parameters:m,subtype:p,suffix:a,tree:d,type:s}}function d$(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(f$(e)===null)return`"${e}" is not a well-formed media type (RFC 6838 §4.2)`;return null}function p$(e){let t=f$(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 l$,sT,c$="text/markdown; variant=GFM",u$="application/yaml",m$;var bp=J(()=>{ce();l$=/^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}$/,sT=new Set(["vnd","prs","x"]);m$={".jxn":"text/plain; charset=utf-8",".markdown":`${c$}; charset=utf-8`,".md":`${c$}; charset=utf-8`,".yaml":`${u$}; charset=utf-8`,".yml":`${u$}; charset=utf-8`}});class h${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(l)==="\\")r(l),l+=1;r(l),l+=1}i=c,l+=1}else if(c==="`")o=!0,l+=1;else if(t&&c==="/"&&SN.has(i)&&!wN(e,i,a)&&o$(e,l)>0){let u=o$(e,l);for(l+=1;l<u-1;l+=1)r(l);i="/",l=u}else{let u=s.length-1;if(u>=0&&c==="{")s[u]=(s[u]??0)+1;else if(u>=0&&c==="}")if(s[u]===0){if(s.pop(),o=!0,t&&s.length===0)t[t.length-1]=l+1}else s[u]=(s[u]??1)-1;if(c.trim()!=="")i=c,a=l;l+=1}}return n.join("")}function yo(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Ac(e){if(!e)return[];return e.map((t)=>_(t)?t:t.name)}function vN(e){return typeof e==="string"}function ir(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)=>_(n))&&typeof t.default==="string";return!1}function ri(e){if(vN(e))return[e];if(!ir(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 si(e){return e.startsWith("#")}function oi(e){return e.replaceAll(/-([a-z])/g,(t,n)=>n.toUpperCase())}var kp,kc,u$=2048,bN,_c,SN;var ae=M(()=>{kp=new Set(["type","enum","minimum","maximum","minLength","maxLength","pattern","format","items","properties","required","description","title","$comment"]);kc=new Map;bN=[],_c=new Map;SN=new Set("(,=:[!&|?{;+-*%<>~^")});function m$(e){let t=[],n=[],r=null,s=0,o=()=>n.at(-1)?.path??"",i=()=>r===null?o():PN(o(),r),a=()=>{s+=1;let l="";while(s<e.length){let c=e[s];if(c==="\\"){let u=e[s+1]??"";if(u==="u")l+=String.fromCodePoint(Number.parseInt(e.slice(s+2,s+6),16)),s+=6;else l+=EN.get(u)??u,s+=2;continue}if(c==='"')return s+=1,l;l+=c,s+=1}return l};while(s<e.length){let l=e[s];if(p$.has(l)||l===","||l===":"){s+=1;continue}if(l==="{"||l==="["){n.push(l==="{"?{keys:new Set,kind:"object",path:i()}:{kind:"array",path:i()}),r=null,s+=1;continue}if(l==="}"||l==="]"){n.pop(),r=null,s+=1;continue}if(l==='"'){let u=a(),d=n.at(-1);if(d?.kind==="object"&&jN(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(l==="-"||l>="0"&&l<="9"){let u=s;while(s<e.length&&/[\d+.eE-]/.test(e[s]))s+=1;let d=e.slice(u,s);if(!kN(d))t.push({detail:d,kind:"unsafe-number",path:i()});r=null;continue}let c=s;while(s<e.length&&/[A-Za-z]/.test(e[s]))s+=1;if(s===c)s+=1;r=null}return t}function jN(e,t){let n=t;while(n<e.length&&p$.has(e[n]))n+=1;return e[n]??""}function PN(e,t){return e===""?t:`${e}.${t}`}function kN(e){if(/[.eE]/.test(e))return!0;let t=Number(e);if(!Number.isFinite(t))return!1;return String(t)===e.replace(/^\+/,"")}function h$(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 p$,EN;var g$=M(()=>{p$=new Set([" ","\t",`
7
+ `,"\r"]);EN=new Map([["b","\b"],["f","\f"],["n",`
8
+ `],["r","\r"],["t","\t"]])});function ye(e){return e instanceof Error?e.message:String(e)}function x$(e){if(_(e))return y$.test(e)?e.normalize("NFC"):e;if(Array.isArray(e))return e.map((t)=>x$(t));if(L(e))return ii(e);return e}function ii(e){let t={};for(let[n,r]of Object.entries(e))t[y$.test(n)?n.normalize("NFC"):n]=x$(r);return t}function Op(e,t,n){let r;try{r=JSON.parse(e)}catch(o){throw Error(`Failed to parse ${n} at ${t}: ${ye(o)}`,{cause:o})}if(!L(r))throw Error(`Invalid ${n} at ${t}: expected a JSON object`);let s=m$(e);if(s.length>0){let o=s.map((i)=>h$(i)).join("; ");throw Error(`Invalid ${n} at ${t}: ${o}`)}return ii(r)}function b$(e,t){return Op(e,t,"Jx document")}function $$(e,t){return Op(e,t,"project config")}function S$(e,t){return Op(e,t,"class definition")}var y$;var Ft=M(()=>{ae();g$();y$=/[^\p{ASCII}]/u});import{spawn as _N}from"node:child_process";import{createRequire as ON}from"node:module";import{join as AN}from"node:path";function w$(e,t){try{return ON(AN(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 Cc(e,t,n,r=_N,s=process){let o=w$(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 Ap=()=>{};import{spawn as CN}from"node:child_process";function v$(e,t,n=CN,r=process){return Cc("convert",e,t,n,r)}var E$=M(()=>{Ap()});import{spawn as RN}from"node:child_process";function j$(e,t,n=RN,r=process){return Cc("format",e,t,n,r)}var P$=M(()=>{Ap()});function TN(e){return JSON.parse(e)}function ai(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function NN(e){return ai(e)&&typeof e.binding==="string"}function JN(e){try{let t=TN(e);return ai(t)?t:void 0}catch{return}}function k$(e,t){if(t.length===0)return{content:e??"",patched:!1};let n={};if(e){let r=JN(e);if(r===void 0)return{content:e,patched:!1};n=r}for(let r of t)_$(n,r);return{content:`${JSON.stringify(n,null,"\t")}
9
+ `,patched:!0}}function _$(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]=MN(Array.isArray(s)?s:[],r);continue}if(ai(r)){if(ai(s))_$(s,r);else if(s===void 0)e[n]=structuredClone(r);continue}if(s===void 0)e[n]=r}}function MN(e,t){let n=[...e];for(let r of t){if(!NN(r)){if(!n.some((a)=>JSON.stringify(a)===JSON.stringify(r)))n.push(structuredClone(r));continue}let s=n.findIndex((i)=>ai(i)&&i.binding===r.binding),o=n[s];if(ai(o))n[s]={...o,...r};else n.push(structuredClone(r))}return n}var O$=()=>{};function T$(e){if(!_(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(!A$.test(s)||!A$.test(o))return null;let i=o.lastIndexOf("+"),a=i===-1?null:o.slice(i+1),l=i===-1?o:o.slice(0,i);if(a==="")return null;let c=l.indexOf("."),u=c===-1?null:l.slice(0,c),d=u!==null&&IN.has(u)?u:null,p=d===null?l:l.slice(d.length+1);if(p==="")return null;let m={};for(let g of n){let b=g.indexOf("=");if(b===-1)return null;let h=g.slice(0,b).trim().toLowerCase(),x=g.slice(b+1).trim();if(h==="")return null;if(x.startsWith('"')&&x.endsWith('"')&&x.length>=2)x=x.slice(1,-1);m[h]=x}return{parameters:m,subtype:p,suffix:a,tree:d,type:s}}function N$(e){if(!_(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(T$(e)===null)return`"${e}" is not a well-formed media type (RFC 6838 §4.2)`;return null}function J$(e){let t=T$(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 A$,IN,C$="text/markdown; variant=GFM",R$="application/yaml",M$;var Cp=M(()=>{ae();A$=/^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}$/,IN=new Set(["vnd","prs","x"]);M$={".jxn":"text/plain; charset=utf-8",".markdown":`${C$}; charset=utf-8`,".md":`${C$}; charset=utf-8`,".yaml":`${R$}; charset=utf-8`,".yml":`${R$}; charset=utf-8`}});class I${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 ni(e){if(oT.test(e))return"unreadable";let t=new h$(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]=iT.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 oT,iT;var Ta=J(()=>{oT=/\0/u,iT=/^[^\s\\/(){};[\]"#=]+/u});function Ia(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 Es(e){return e===13||e===10||e===133||e===11||e===12||e===8232||e===8233||!1}function Dc(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 Qe(e){return!isNaN(e)&&!Ia(e)&&!Es(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 g$(e){return e>=65&&e<91||e>=97&&e<123||!1}function $p(e){return e>=48&&e<58||e>=65&&e<71||e>=97&&e<103||!1}function Sp(e){return $p(e)||e===95}function es(e){return e>=48&&e<58}function xo(e){return es(e)||e===95}function wp(e){return e>=48&&e<56}function y$(e){return wp(e)||e===95}function vp(e){return e===48||e===49}function x$(e){return vp(e)||e===95}function b$(e){return e===45||e===43}var Ss=1,ri=2,ho=3,kc=4,Oc=5,Ja=6,Ac=7,Cc=8,Ma=9,ws=10,zt=11,si=12,oi=13,Rc=14,Qr=15,Nc=16,Tc=17,go=18,vs=19,Jc=20,Mc=21,Ic=22,ii=23,yo=24,Er=28;function*lT(e){for(let t of(aT??=new Intl.Segmenter("en")).segment(e))yield t.segment}function cT(e){return e[Symbol.iterator]()}function $$(e,{flags:t,graphemeLocations:n=!1}){let r=n?lT(e):cT(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*S$(e){if(Ae(e,65279))e.column=1,yield Ee(e,ri);if(Dc(e.current))throw jr(e,`Invalid character \\u${e.current.toString(16)}`)}function St(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(Dc(n))if(n>=55296&&n<=57343||n>1114111)Da(e,`Invalid character \\u${n.toString(16)}`);else Da(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 sr(e,t){if(t(e.current)){let n=e.current;return St(e),n}}function Ae(e,t){if(e.current===t)return St(e),t}function ai(e){if(!Es(e.current))return!1;if(!e.graphemeLocations&&e.current===13&&e.text.codePointAt(e.offset+1)===10)e.iterator.next(),e.offset++;return St(e),e.column=1,e.line++,!0}function Ep(e,t){while(e.current===t)St(e)}function Be(e,t){while(t(e.current))St(e)}function Ee(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 l=e.errorsInToken;e.errorsInToken=null;let c={type:t,text:e.text.slice(a.offset,i.offset),start:a,end:i,errors:l};if(n){if(!c.errors)c.errors=[];c.errors.push(new Ce(n,{token:c}))}return c}function jr(e,t){if(t instanceof Ce)return t;let{line:n,column:r,offset:s}=e,o={line:n,column:r,offset:s},i;if(s<e.length)if(Es(e.current))i={line:n+1,column:1,offset:s+1};else i={line:n,column:r+1,offset:s+1};return new Ce(`${t}`,{start:o,end:i})}function Da(e,t){(e.errorsInToken??=[]).push(jr(e,t))}var aT;var w$=J(()=>{bo()});function $o(e){return(t)=>(St(t),Ee(t,e))}function La(e){return Be(e,Ia),Ee(e,go)}function So(e){return ai(e),Ee(e,vs)}function uT(e){St(e);let t=!1,n=!1;if(Ae(e,34)){if(!Ae(e,34))return Ee(e,Ma);if(n=!0,e.current===34)throw jr(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),ai(e)||St(e)}else while(!t&&e.offset<e.length)if(Ae(e,34))t=!0;else Ae(e,92),ai(e)||St(e);if(!t)throw jr(e,"Unexpected EOF inside string");return Ee(e,n?ii:Ma)}function v$(e){if(St(e),e.current===35||e.current===34){let t=1;while(Ae(e,35))t++;if(!Ae(e,34))throw jr(e,`Expected a quote after ${"#".repeat(t)}`);let n=!1;if(Ae(e,34))if(Ae(e,34)){if(e.current===34)throw jr(e,"Multiline strings must start with exactly three quotes");n=!0}else{let r=0;while(Ae(e,35))r++;if(r===t)return Ee(e,ws)}while(!0){if(e.offset>=e.length)throw jr(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 Ee(e,n?yo:ws)}else ai(e)||St(e)}}else{let t;if(e.current<255){let n=Pe[e.current];t=n(e)}else if(Ia(e.current))t=La(e);else if(Es(e.current))t=So(e);else t=Pp(e);if(t.type!==zt)(t.errors??=[]).push(new Ce("Expected a valid identifier",{token:t}));return t.type=oi,t}}function fT(e){if(St(e),sr(e,es))return Be(e,Qe),Ee(e,zt,"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 Be(e,Qe),Ee(e,zt)}function dT(e){if(St(e),Ae(e,45))return Ee(e,ho);else if(Ae(e,47)){while(e.offset<e.length&&!Es(e.current))St(e);return Ee(e,Mc)}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 Ee(e,Ic)}}else if(Ae(e,47)){if(Ae(e,42))t++}else ai(e)||St(e);throw jr(e,"Unexpected EOF in multiline comment")}else Fc(e)}function E$(e){return St(e),pT(e)}function pT(e){if(es(e.current))return or(e);else if(Ae(e,46)){if(sr(e,es))return Be(e,Qe),Ee(e,zt,"Invalid identifier or number, surround with quotes to make it an identifier or add a zero between the sign and the decimal point");return Be(e,Qe),Ee(e,zt)}else return Be(e,Qe),Ee(e,zt)}function jp(e,t,n,r){return(s)=>{let o=St(s);if(sr(s,n))return Be(s,r),Ee(s,t);else if(!s.flags.experimentalSuffixedNumbers){if(Ae(s,95)){if(Be(s,r),!Qe(s.current))return Ee(s,t,`Invalid ${e} number, the first character after 0${String.fromCodePoint(o)} cannot be an underscore`)}return Be(s,Qe),Ee(s,zt,`Invalid ${e} number`)}else if(Ae(s,95)){if(Ep(s,95),n(s.current)){if(Be(s,r),!Qe(s.current))return Ee(s,t,`Invalid ${e} number, the first character after 0${String.fromCodePoint(o)} cannot be an underscore`)}return Be(s,Qe),Ee(s,zt,"Invalid number with suffix, a suffix cannot start with a letter followed by an underscore")}else if(es(s.current))return Ee(s,zt,"Invalid number with suffix, a suffix cannot start with a letter followed by a number");else return Be(s,Qe),Ee(s,Er)}}function or(e){if(Ae(e,48)){let t=Lc[e.current];if(t)return t(e)}if(Be(e,xo),Ae(e,46)){if(!sr(e,es))if(e.current===95)Da(e,"Invalid decimal number, the part after the decimal point mustn't start on an underscore");else Da(e,"Invalid decimal number, a decimal point must be followed by a digit");Be(e,xo)}if(Ae(e,101)||Ae(e,69))if(sr(e,b$),sr(e,es)){if(Be(e,xo),Qe(e.current))return Be(e,Qe),Ee(e,zt,"Invalid number with suffix, a number with an exponent cannot have a suffix");return Ee(e,Qr)}else if(!e.flags.experimentalSuffixedNumbers)if(e.current===95)return Be(e,xo),Ee(e,Qr,"Invalid decimal number, the number after the exponent mustn't start on an underscore");else return Be(e,Qe),Ee(e,Qr,"Invalid decimal number, missing a number after the exponent");else if(Ae(e,95)){if(Ep(e,95),es(e.current)){if(Be(e,xo),!Qe(e.current))return Ee(e,Qr,"Invalid decimal number, the number after the exponent mustn't start on an underscore")}return Be(e,Qe),Ee(e,zt,"Invalid number with suffix, a suffix cannot start with a letter followed by an underscore")}else return Be(e,Qe),Ee(e,Er);else if(e.flags.experimentalSuffixedNumbers)if(e.current===88||e.current===120){St(e);let t=null;if(sr(e,Sp))t="Invalid number with suffix, a suffix cannot start with an x followed by a hexidecimal number";return Be(e,Qe),Ee(e,Er,t)}else if(sr(e,g$)){let t=null;if(sr(e,xo))t="Invalid number with suffix, a suffix cannot start with a letter followed by a digit";return Be(e,Qe),Ee(e,Er,t)}else if(Ae(e,44))return Be(e,Qe),Ee(e,Er,"Invalid number with suffix, a suffix cannot start with a comma");else if(Ae(e,46))return Be(e,Qe),Ee(e,Er,"Invalid number with suffix, a suffix cannot start with a dot");else if(sr(e,Qe))return Be(e,Qe),Ee(e,Er);else return Ee(e,Qr);else return Ee(e,Qr)}function mT(e){if(St(e),e.current!=35)return Be(e,Qe),Ee(e,zt);let t=v$(e);t.start.offset--,t.start.column--;let n;switch(t.type){case ws:case yo: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 Ce(n,{token:t})),t}function Pp(e){return St(e),Be(e,Qe),Ee(e,zt)}function Fc(e){throw jr(e,`Unexpected character ${JSON.stringify(String.fromCodePoint(e.current))}, did you forget to quote an identifier?`)}function*Fa(e,t){let n=$$(e,t);yield*S$(n);while(!n.currentIter.done){if(n.current<255){let r=Pe[n.current];yield r(n);continue}if(Ia(n.current)){yield La(n);continue}if(Es(n.current)){yield So(n);continue}yield Pp(n)}yield Ee(n,Ss)}var Lc,Pe;var j$=J(()=>{bo();w$();Lc=Array(256).fill(null);Lc[98]=jp("binary",Tc,vp,x$);Lc[111]=jp("octal",Nc,wp,y$);Lc[120]=jp("hexadecimal",Rc,$p,Sp);Pe=Array(255);Pe.fill(Pp);for(let e=0;e<32;e++)Pe[e]=Fc;Pe[9]=La;Pe[10]=So;Pe[11]=So;Pe[12]=So;Pe[13]=So;Pe[32]=La;Pe[34]=uT;Pe[35]=v$;Pe[40]=$o(kc);Pe[41]=$o(Ja);Pe[43]=E$;Pe[45]=E$;Pe[46]=fT;Pe[47]=dT;Pe[48]=or;Pe[49]=or;Pe[50]=or;Pe[51]=or;Pe[52]=or;Pe[53]=or;Pe[54]=or;Pe[55]=or;Pe[56]=or;Pe[57]=or;Pe[59]=$o(Cc);Pe[61]=$o(si);Pe[91]=Fc;Pe[92]=$o(Jc);Pe[93]=Fc;Pe[114]=mT;Pe[123]=$o(Oc);Pe[125]=$o(Ac);Pe[133]=So;Pe[160]=La});var li=J(()=>{j$()});var Ce;var bo=J(()=>{li();Ce=class Ce 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 ci(e){return P$.get(e)}function _$(e,{start:t},{end:n}){P$.set(e,{start:t,end:n})}var P$;var _p=J(()=>{P$=new WeakMap});function k$({experimentalSuffixedNumbers:e=!1}={}){return{experimentalSuffixedNumbers:e}}class ir{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 ir(this.name);return e.representation=this.representation,e}}class Pr{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 Pr(this.name);return e.representation=this.representation,e.leading=this.leading,e.trailing=this.trailing,e.suffix=this.suffix,e}}class ar{type="value";static type="value";representation;tag=null;betweenTagAndValue;constructor(e){this.value=e}clone(){let e=new ar(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 Pr(e)}}var kp=()=>{};class _n{static createArgument(e){return new _n(new ar(e),null)}static createProperty(e,t){return new _n(new ar(t),new ir(e))}type="entry";static type="entry";name;value;leading;trailing;equals;constructor(e,t){this.value=e,this.name=t}clone(){let e=new _n(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 ir(e):null}getValue(){return this.value.value}setValue(e){this.value=new ar(e)}isArgument(){return this.name==null}isProperty(){return this.name!=null}}var Op=J(()=>{kp()});function*ui(e){for(let t=e.length-1;t>=0;t--)yield e[t]}function Ap(e){return e.children??(e.children=new js)}class fi{static create(e){return new fi(new ir(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 fi(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 Pr(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=_n.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 ui(this.entries))if(t.getName()===e)return t;return}setProperty(e,t,n){for(let s of ui(this.entries))if(s.getName()===e){s.setValue(t),s.value.setTag(n);return}let r=_n.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){Ap(this).appendNode(e)}insertNodeBefore(e,t){Ap(this).insertNodeBefore(e,t)}insertNodeAfter(e,t){Ap(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 O$=J(()=>{Cp();Op()});function*di(e){if(e instanceof js)yield*e.nodes;else yield e}class js{type="document";static type="document";nodes;trailing;constructor(e=[]){this.nodes=e}clone({shallow:e}={}){let t=new js(e?[]:this.nodes.map((n)=>n.clone()));return t.trailing=this.trailing,t}appendNode(e){this.nodes.push(...di(e))}insertNodeBefore(e,t){if(t==null){this.nodes.push(...di(e));return}let n=this.nodes.indexOf(t);if(n===-1)throw Error("Reference node is not in document");this.nodes.splice(n,0,...di(e))}insertNodeAfter(e,t){if(t==null){this.nodes.unshift(...di(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,...di(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,...di(t))}findNodesByName(e){return this.nodes.filter((t)=>t.name.name===e)}findNodeByName(e){for(let t of ui(this.nodes))if(t.name.name===e)return t;return}findParameterizedNode(e,t){for(let n of ui(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 Cp=()=>{};var A$=J(()=>{Cp();Op();O$();kp()});function C$(e,t,n){let r;while(r=gT.exec(t)){let s=Va(n,t,r.index);e.push(new Ce("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 R$(e,t,n){if(!pi.test(t))return e.push(new Ce("Raw strings with three quotes must be multiline strings",{token:n})),t;if(!pi.test(t[0]))return e.push(new Ce("Multi-line strings must start with a newline",{token:n})),t;let r=bT.exec(t)?.[1];if(r==null)return e.push(new Ce("The final line in a multiline string may only contain whitespace",{token:n})),t;return t.replace(ST,(s,o,i,a,l)=>{if(!a)return`
13
- `;if(!i.startsWith(r)){let c=Va(n,t,l+o.length);return e.push(new Ce("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:c,end:{offset:c.offset+r.length,line:c.line,column:c.column+r.length}})),`
12
+ `||t===";")&&e===0)return this.index+=1,!0;else this.index+=1}return e===0}}function li(e){if(DN.test(e))return"unreadable";let t=new I$(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]=LN.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 DN,LN;var Da=M(()=>{DN=/\0/u,LN=/^[^\s\\/(){};[\]"#=]+/u});function Va(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 ks(e){return e===13||e===10||e===133||e===11||e===12||e===8232||e===8233||!1}function qc(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 tt(e){return!isNaN(e)&&!Va(e)&&!ks(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 D$(e){return e>=65&&e<91||e>=97&&e<123||!1}function Rp(e){return e>=48&&e<58||e>=65&&e<71||e>=97&&e<103||!1}function Tp(e){return Rp(e)||e===95}function es(e){return e>=48&&e<58}function So(e){return es(e)||e===95}function Np(e){return e>=48&&e<56}function L$(e){return Np(e)||e===95}function Jp(e){return e===48||e===49}function F$(e){return Jp(e)||e===95}function V$(e){return e===45||e===43}var Es=1,ci=2,xo=3,Rc=4,Tc=5,La=6,Nc=7,Jc=8,Fa=9,js=10,Xt=11,ui=12,fi=13,Mc=14,Qr=15,Ic=16,Dc=17,bo=18,Ps=19,Lc=20,Fc=21,Vc=22,di=23,$o=24,Er=28;function*VN(e){for(let t of(FN??=new Intl.Segmenter("en")).segment(e))yield t.segment}function qN(e){return e[Symbol.iterator]()}function q$(e,{flags:t,graphemeLocations:n=!1}){let r=n?VN(e):qN(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*H$(e){if(Re(e,65279))e.column=1,yield Ee(e,ci);if(qc(e.current))throw jr(e,`Invalid character \\u${e.current.toString(16)}`)}function vt(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(qc(n))if(n>=55296&&n<=57343||n>1114111)qa(e,`Invalid character \\u${n.toString(16)}`);else qa(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 ar(e,t){if(t(e.current)){let n=e.current;return vt(e),n}}function Re(e,t){if(e.current===t)return vt(e),t}function pi(e){if(!ks(e.current))return!1;if(!e.graphemeLocations&&e.current===13&&e.text.codePointAt(e.offset+1)===10)e.iterator.next(),e.offset++;return vt(e),e.column=1,e.line++,!0}function Mp(e,t){while(e.current===t)vt(e)}function Be(e,t){while(t(e.current))vt(e)}function Ee(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 l=e.errorsInToken;e.errorsInToken=null;let c={type:t,text:e.text.slice(a.offset,i.offset),start:a,end:i,errors:l};if(n){if(!c.errors)c.errors=[];c.errors.push(new Ne(n,{token:c}))}return c}function jr(e,t){if(t instanceof Ne)return t;let{line:n,column:r,offset:s}=e,o={line:n,column:r,offset:s},i;if(s<e.length)if(ks(e.current))i={line:n+1,column:1,offset:s+1};else i={line:n,column:r+1,offset:s+1};return new Ne(`${t}`,{start:o,end:i})}function qa(e,t){(e.errorsInToken??=[]).push(jr(e,t))}var FN;var W$=M(()=>{wo()});function vo(e){return(t)=>(vt(t),Ee(t,e))}function Ha(e){return Be(e,Va),Ee(e,bo)}function Eo(e){return pi(e),Ee(e,Ps)}function HN(e){vt(e);let t=!1,n=!1;if(Re(e,34)){if(!Re(e,34))return Ee(e,Fa);if(n=!0,e.current===34)throw jr(e,"Multiline strings must start with exactly three quotes");while(!t&&e.offset<e.length)if(Re(e,34)){if(Re(e,34)&&Re(e,34))t=!0}else Re(e,92),pi(e)||vt(e)}else while(!t&&e.offset<e.length)if(Re(e,34))t=!0;else Re(e,92),pi(e)||vt(e);if(!t)throw jr(e,"Unexpected EOF inside string");return Ee(e,n?di:Fa)}function B$(e){if(vt(e),e.current===35||e.current===34){let t=1;while(Re(e,35))t++;if(!Re(e,34))throw jr(e,`Expected a quote after ${"#".repeat(t)}`);let n=!1;if(Re(e,34))if(Re(e,34)){if(e.current===34)throw jr(e,"Multiline strings must start with exactly three quotes");n=!0}else{let r=0;while(Re(e,35))r++;if(r===t)return Ee(e,js)}while(!0){if(e.offset>=e.length)throw jr(e,"Unexpected EOF while parsing raw string");if(Re(e,34)){if(n){if(!Re(e,34)||!Re(e,34))continue}let r=0;while(r<t&&Re(e,35))r++;if(r===t)return Ee(e,n?$o:js)}else pi(e)||vt(e)}}else{let t;if(e.current<255){let n=_e[e.current];t=n(e)}else if(Va(e.current))t=Ha(e);else if(ks(e.current))t=Eo(e);else t=Dp(e);if(t.type!==Xt)(t.errors??=[]).push(new Ne("Expected a valid identifier",{token:t}));return t.type=fi,t}}function WN(e){if(vt(e),ar(e,es))return Be(e,tt),Ee(e,Xt,"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 Be(e,tt),Ee(e,Xt)}function BN(e){if(vt(e),Re(e,45))return Ee(e,xo);else if(Re(e,47)){while(e.offset<e.length&&!ks(e.current))vt(e);return Ee(e,Fc)}else if(Re(e,42)){let t=1;while(e.offset<e.length)if(Re(e,42)){if(Re(e,47)){if(t--,t===0)return Ee(e,Vc)}}else if(Re(e,47)){if(Re(e,42))t++}else pi(e)||vt(e);throw jr(e,"Unexpected EOF in multiline comment")}else Wc(e)}function U$(e){return vt(e),UN(e)}function UN(e){if(es(e.current))return lr(e);else if(Re(e,46)){if(ar(e,es))return Be(e,tt),Ee(e,Xt,"Invalid identifier or number, surround with quotes to make it an identifier or add a zero between the sign and the decimal point");return Be(e,tt),Ee(e,Xt)}else return Be(e,tt),Ee(e,Xt)}function Ip(e,t,n,r){return(s)=>{let o=vt(s);if(ar(s,n))return Be(s,r),Ee(s,t);else if(!s.flags.experimentalSuffixedNumbers){if(Re(s,95)){if(Be(s,r),!tt(s.current))return Ee(s,t,`Invalid ${e} number, the first character after 0${String.fromCodePoint(o)} cannot be an underscore`)}return Be(s,tt),Ee(s,Xt,`Invalid ${e} number`)}else if(Re(s,95)){if(Mp(s,95),n(s.current)){if(Be(s,r),!tt(s.current))return Ee(s,t,`Invalid ${e} number, the first character after 0${String.fromCodePoint(o)} cannot be an underscore`)}return Be(s,tt),Ee(s,Xt,"Invalid number with suffix, a suffix cannot start with a letter followed by an underscore")}else if(es(s.current))return Ee(s,Xt,"Invalid number with suffix, a suffix cannot start with a letter followed by a number");else return Be(s,tt),Ee(s,Er)}}function lr(e){if(Re(e,48)){let t=Hc[e.current];if(t)return t(e)}if(Be(e,So),Re(e,46)){if(!ar(e,es))if(e.current===95)qa(e,"Invalid decimal number, the part after the decimal point mustn't start on an underscore");else qa(e,"Invalid decimal number, a decimal point must be followed by a digit");Be(e,So)}if(Re(e,101)||Re(e,69))if(ar(e,V$),ar(e,es)){if(Be(e,So),tt(e.current))return Be(e,tt),Ee(e,Xt,"Invalid number with suffix, a number with an exponent cannot have a suffix");return Ee(e,Qr)}else if(!e.flags.experimentalSuffixedNumbers)if(e.current===95)return Be(e,So),Ee(e,Qr,"Invalid decimal number, the number after the exponent mustn't start on an underscore");else return Be(e,tt),Ee(e,Qr,"Invalid decimal number, missing a number after the exponent");else if(Re(e,95)){if(Mp(e,95),es(e.current)){if(Be(e,So),!tt(e.current))return Ee(e,Qr,"Invalid decimal number, the number after the exponent mustn't start on an underscore")}return Be(e,tt),Ee(e,Xt,"Invalid number with suffix, a suffix cannot start with a letter followed by an underscore")}else return Be(e,tt),Ee(e,Er);else if(e.flags.experimentalSuffixedNumbers)if(e.current===88||e.current===120){vt(e);let t=null;if(ar(e,Tp))t="Invalid number with suffix, a suffix cannot start with an x followed by a hexidecimal number";return Be(e,tt),Ee(e,Er,t)}else if(ar(e,D$)){let t=null;if(ar(e,So))t="Invalid number with suffix, a suffix cannot start with a letter followed by a digit";return Be(e,tt),Ee(e,Er,t)}else if(Re(e,44))return Be(e,tt),Ee(e,Er,"Invalid number with suffix, a suffix cannot start with a comma");else if(Re(e,46))return Be(e,tt),Ee(e,Er,"Invalid number with suffix, a suffix cannot start with a dot");else if(ar(e,tt))return Be(e,tt),Ee(e,Er);else return Ee(e,Qr);else return Ee(e,Qr)}function zN(e){if(vt(e),e.current!=35)return Be(e,tt),Ee(e,Xt);let t=B$(e);t.start.offset--,t.start.column--;let n;switch(t.type){case js:case $o: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 Ne(n,{token:t})),t}function Dp(e){return vt(e),Be(e,tt),Ee(e,Xt)}function Wc(e){throw jr(e,`Unexpected character ${JSON.stringify(String.fromCodePoint(e.current))}, did you forget to quote an identifier?`)}function*Wa(e,t){let n=q$(e,t);yield*H$(n);while(!n.currentIter.done){if(n.current<255){let r=_e[n.current];yield r(n);continue}if(Va(n.current)){yield Ha(n);continue}if(ks(n.current)){yield Eo(n);continue}yield Dp(n)}yield Ee(n,Es)}var Hc,_e;var z$=M(()=>{wo();W$();Hc=Array(256).fill(null);Hc[98]=Ip("binary",Dc,Jp,F$);Hc[111]=Ip("octal",Ic,Np,L$);Hc[120]=Ip("hexadecimal",Mc,Rp,Tp);_e=Array(255);_e.fill(Dp);for(let e=0;e<32;e++)_e[e]=Wc;_e[9]=Ha;_e[10]=Eo;_e[11]=Eo;_e[12]=Eo;_e[13]=Eo;_e[32]=Ha;_e[34]=HN;_e[35]=B$;_e[40]=vo(Rc);_e[41]=vo(La);_e[43]=U$;_e[45]=U$;_e[46]=WN;_e[47]=BN;_e[48]=lr;_e[49]=lr;_e[50]=lr;_e[51]=lr;_e[52]=lr;_e[53]=lr;_e[54]=lr;_e[55]=lr;_e[56]=lr;_e[57]=lr;_e[59]=vo(Jc);_e[61]=vo(ui);_e[91]=Wc;_e[92]=vo(Lc);_e[93]=Wc;_e[114]=zN;_e[123]=vo(Tc);_e[125]=vo(Nc);_e[133]=Eo;_e[160]=Ha});var mi=M(()=>{z$()});var Ne;var wo=M(()=>{mi();Ne=class Ne 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===Es)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 hi(e){return K$.get(e)}function G$(e,{start:t},{end:n}){K$.set(e,{start:t,end:n})}var K$;var Lp=M(()=>{K$=new WeakMap});function X$({experimentalSuffixedNumbers:e=!1}={}){return{experimentalSuffixedNumbers:e}}class cr{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 cr(this.name);return e.representation=this.representation,e}}class Pr{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 Pr(this.name);return e.representation=this.representation,e.leading=this.leading,e.trailing=this.trailing,e.suffix=this.suffix,e}}class ur{type="value";static type="value";representation;tag=null;betweenTagAndValue;constructor(e){this.value=e}clone(){let e=new ur(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 Pr(e)}}var Fp=()=>{};class Cn{static createArgument(e){return new Cn(new ur(e),null)}static createProperty(e,t){return new Cn(new ur(t),new cr(e))}type="entry";static type="entry";name;value;leading;trailing;equals;constructor(e,t){this.value=e,this.name=t}clone(){let e=new Cn(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 cr(e):null}getValue(){return this.value.value}setValue(e){this.value=new ur(e)}isArgument(){return this.name==null}isProperty(){return this.name!=null}}var Vp=M(()=>{Fp()});function*gi(e){for(let t=e.length-1;t>=0;t--)yield e[t]}function qp(e){return e.children??(e.children=new _s)}class yi{static create(e){return new yi(new cr(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 yi(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 Pr(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=Cn.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 gi(this.entries))if(t.getName()===e)return t;return}setProperty(e,t,n){for(let s of gi(this.entries))if(s.getName()===e){s.setValue(t),s.value.setTag(n);return}let r=Cn.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){qp(this).appendNode(e)}insertNodeBefore(e,t){qp(this).insertNodeBefore(e,t)}insertNodeAfter(e,t){qp(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 Y$=M(()=>{Hp();Vp()});function*xi(e){if(e instanceof _s)yield*e.nodes;else yield e}class _s{type="document";static type="document";nodes;trailing;constructor(e=[]){this.nodes=e}clone({shallow:e}={}){let t=new _s(e?[]:this.nodes.map((n)=>n.clone()));return t.trailing=this.trailing,t}appendNode(e){this.nodes.push(...xi(e))}insertNodeBefore(e,t){if(t==null){this.nodes.push(...xi(e));return}let n=this.nodes.indexOf(t);if(n===-1)throw Error("Reference node is not in document");this.nodes.splice(n,0,...xi(e))}insertNodeAfter(e,t){if(t==null){this.nodes.unshift(...xi(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,...xi(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,...xi(t))}findNodesByName(e){return this.nodes.filter((t)=>t.name.name===e)}findNodeByName(e){for(let t of gi(this.nodes))if(t.name.name===e)return t;return}findParameterizedNode(e,t){for(let n of gi(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 Hp=()=>{};var Z$=M(()=>{Hp();Vp();Y$();Fp()});function Q$(e,t,n){let r;while(r=GN.exec(t)){let s=Ba(n,t,r.index);e.push(new Ne("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 eS(e,t,n){if(!bi.test(t))return e.push(new Ne("Raw strings with three quotes must be multiline strings",{token:n})),t;if(!bi.test(t[0]))return e.push(new Ne("Multi-line strings must start with a newline",{token:n})),t;let r=ZN.exec(t)?.[1];if(r==null)return e.push(new Ne("The final line in a multiline string may only contain whitespace",{token:n})),t;return t.replace(eJ,(s,o,i,a,l)=>{if(!a)return`
13
+ `;if(!i.startsWith(r)){let c=Ba(n,t,l+o.length);return e.push(new Ne("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:c,end:{offset:c.offset+r.length,line:c.line,column:c.column+r.length}})),`
14
14
  `}return`
15
- `+i.slice(r.length)+a}).slice(1,-1)}function N$(e,t,n){let r;while(r=xT.exec(t)){let s=Va(n,t,r.indices[1][0]);e.push(new Ce("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(vT,(s,o,i,a,l)=>J$(e,t,n,s,o,i,a,l))}function T$(e,t,n){if(!yT.test(t))return e.push(new Ce("Strings with three quotes must be multiline strings",{token:n})),t;if(!pi.test(t[0]))return e.push(new Ce("Multi-line strings must start with a newline",{token:n})),t;let r=$T.exec(t)?.[1];if(r==null){let s=wT.exec(t),o=s?Va(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 Ce(i,{token:n,start:o,end:o&&{offset:o.offset,line:o.line,column:o.column+1}})),t}return t.replace(ET,(s,o,i,a,l,c,u)=>{if(!o)return J$(e,t,n,s,a,l,c,u);let d=t[u+o.length+(i?i.length:0)];if(pi.test(d))return`
16
- `;if(!i.startsWith(r)){let p=Va(n,t,u+o.length);return e.push(new Ce("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 tS(e,t,n){let r;while(r=YN.exec(t)){let s=Ba(n,t,r.indices[1][0]);e.push(new Ne("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(nJ,(s,o,i,a,l)=>rS(e,t,n,s,o,i,a,l))}function nS(e,t,n){if(!XN.test(t))return e.push(new Ne("Strings with three quotes must be multiline strings",{token:n})),t;if(!bi.test(t[0]))return e.push(new Ne("Multi-line strings must start with a newline",{token:n})),t;let r=QN.exec(t)?.[1];if(r==null){let s=tJ.exec(t),o=s?Ba(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 Ne(i,{token:n,start:o,end:o&&{offset:o.offset,line:o.line,column:o.column+1}})),t}return t.replace(rJ,(s,o,i,a,l,c,u)=>{if(!o)return rS(e,t,n,s,a,l,c,u);let d=t[u+o.length+(i?i.length:0)];if(bi.test(d))return`
16
+ `;if(!i.startsWith(r)){let p=Ba(n,t,u+o.length);return e.push(new Ne("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 J$(e,t,n,r,s,o,i,a){if(i)return"";if(o){let l=n.text.startsWith('"""'),c=t.slice(0,a).split(pi),u={offset:n.start.offset+(l?3:1)+a,line:n.start.line+(c.length-1),column:c.length===1?n.start.column+(l?3:1)+a:c.at(-1).length},d={offset:u.offset+r.length,line:u.line,column:u.column+r.length};if(!o.startsWith("{"))e.push(new Ce(String.raw`Invalid unicode escape "\u${o}", did you forget to use {}? "\u{${o}}"`,{token:n,start:u,end:d}));else e.push(new Ce(String.raw`Invalid unicode escape "\u${o.endsWith("}")?o:`${o}...`}"`,{token:n,start:u,end:d}));return""}else if(s){let l=parseInt(s,16);if(l>=55296&&l<=57343)e.push(new Ce(String.raw`Invalid unicode escape "\u{${s}}, only scalar values can be added using an escape`,{token:n}));return String.fromCodePoint(l)}else{let l=hT.get(r);if(l==null)return e.push(new Ce(r.length<2?"Invalid whitespace escape at the end of a string":`Invalid escape "${r}"`,{token:n})),"";return l}}function Va(e,t,n){let r=1;switch(e.type){case ii:r=3;break;case ws:r=e.text.indexOf('"')+1;break;case yo:r=e.text.indexOf('"')+3;break}let s=t.slice(0,n).split(pi);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 w6,hT,pi,gT,yT,xT,bT,$T,ST,wT,vT,ET;var M$=J(()=>{bo();li();w6=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"]]),hT=new Map([["\\n",`
19
- `],["\\r","\r"],["\\t","\t"],["\\\\","\\"],["\\\"",'"'],["\\b","\b"],["\\f","\f"],["\\s"," "]]),pi=/\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029]/,gT=/\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029]/g,yT=/(?:^|[^\\\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,xT=/(?:^|[^\\\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;bT=/[\x0A\x0B\x0C\x0D\x85\u2028\u2029]([\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)$/,$T=/(?:^|[^\\\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]*)*$/,ST=/(\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,wT=/([^\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]*$/;vT=/\\(?:$|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;ET=/(\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 ts(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 Ue(e,t){if(!e.current.done&&e.current.value.type===t){let n=e.current.value;return ts(e),n}}function _e(e,t){let n="current"in e?e.current.value??e.lastToken:e;return new Ce(t,{token:n})}function dn(e,t,n,r=n){if(e.storeLocations)_$(t,n,r)}function Kt(e="",t="",n=""){return e+t+n||void 0}function Hc(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 ts(o),o}function Np(e,t){if(!t&&!e.current.done&&e.current.value.type!==Ss)t=_e(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 Ce)if(t.errors)n.push(...t.errors);else n.push(t);else n.push(new Ce(`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 Ce("Encountered multiple errors",{errors:n})}function Vc(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 I$(e){return e==="inf"||e==="-inf"||e==="nan"||e==="true"||e==="false"||e==="null"||!1}function Tp(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 Er:{if(!e.flags.experimentalSuffixedNumbers)throw new Ce("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),I$(s))e.errors.push(_e(e,`Invalid suffix ${s}, values that look like keywords cannot be used as suffix`))}break;case Tc:a=!0,n=(i==="-"?-1:1)*Number.parseInt(t.text.slice(i?3:2).replaceAll("_",""),2);break;case Nc:a=!0,n=(i==="-"?-1:1)*Number.parseInt(t.text.slice(i?3:2).replaceAll("_",""),8);break;case Qr:a=!0,n=Number.parseFloat(t.text.replaceAll("_",""));break;case Rc:a=!0,n=(i==="-"?-1:1)*Number.parseInt(t.text.slice(i?3:2).replaceAll("_",""),16);break;case oi:if(n=Vc(t.text),n===void 0)if(n=null,Vc(t.text.toLowerCase())!==void 0)e.errors.push(_e(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(_e(e,`Invalid keyword ${t.text}, did you mean #null?`));break;case"#fals":case"#fasle":e.errors.push(_e(e,`Invalid keyword ${t.text}, did you mean #false?`));break;case"#ture":case"#treu":e.errors.push(_e(e,`Invalid keyword ${t.text}, did you mean #true?`));break;case"#ifn":e.errors.push(_e(e,`Invalid keyword ${t.text}, did you mean #inf?`));break;case"#-ifn":e.errors.push(_e(e,`Invalid keyword ${t.text}, did you mean #-inf?`));break;default:e.errors.push(_e(e,`Invalid keyword ${t.text}, surround it with quotes to use a string`))}break;default:return}ts(e);let l=e.flags.experimentalSuffixedNumbers&&Ue(e,oi);if(l)if(a){if(o=l.text,Vc(o)!==void 0)e.errors.push(_e(l,`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(_e(l,"Unexpected hashed suffix, a number can only have one suffix"));else if(typeof n==="number")e.errors.push(_e(l,"Unexpected hashed suffix, you cannot place suffixes on number keywords"));else e.errors.push(_e(l,"Unexpected hashed suffix, you can only place suffixes on numbers"));let c=new ar(n);if(c.representation=r??t.text,dn(e,c,t),s){let u=new Pr(s);u.representation=o,u.suffix=!0,dn(e,u,e.lastToken),c.tag=u}return c}function qa(e){if(e.current.done)return;let{value:t}=e.current,n;switch(t.type){case zt:if(ts(e),I$(t.text))e.errors.push(_e(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 Ma:ts(e),n=[N$(e.errors,t.text.slice(1,-1),t),t.text,t];break;case ii:ts(e),n=[T$(e.errors,t.text.slice(3,-3),t),t.text,t];break;case ws:{ts(e);let r=t.text,s=r.indexOf('"');n=[C$(e.errors,r.slice(s+1,-(s+1)),t),r,t];break}case yo:{ts(e);let r=t.text,s=r.indexOf('"');n=[R$(e.errors,r.slice(s+3,-(s+3)),t),r,t];break}default:return}if(Ue(e,oi))e.errors.push(_e(e.lastToken,Vc(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 Jp(e){let t=qa(e);if(!t)return;let n=new ir(t[0]);return n.representation=t[1],dn(e,n,t[2],e.lastToken),n}function qc(e){let t=Tp(e);if(t)return t;let n=qa(e);if(!n)return;let r=new ar(n[0]);return r.representation=n[1],dn(e,r,n[2],e.lastToken),r}function Ha(e){let t=Ue(e,Mc);if(!t)return;let{value:n}=e.current;return ts(e),t.text+(n?.text??"")}function Wc(e){return Ue(e,Ic)?.text}function Mp(e){return Ue(e,go)??Wc(e)}function Bc(e){let t=Ue(e,Jc);if(!t)return;while(Mp(e));if(!Ha(e)&&!Ue(e,vs)&&!Ue(e,Ss))e.errors.push(_e(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 Ps(e){let t=e.lastToken.end;while(Ue(e,vs)?.text??Ha(e)??Mp(e)??Bc(e));if(e.lastToken.end===t)return;return e.text.slice(t.offset,e.lastToken.end.offset)}function At(e){let t=e.lastToken.end;while(Mp(e)??Bc(e));if(e.lastToken.end===t)return;return e.text.slice(t.offset,e.lastToken.end.offset)}function Rp(e){let t=Ue(e,kc);if(!t)return;let n=At(e),r=qa(e);if(!r&&e.current.value){let a=e.current.value;if(Ps(e))e.errors.push(_e(a,"This type of whitespace is not allowed inside a tag"));r=qa(e)}if(!r){if(Tp(e))e.errors.push(_e(e,"Invalid tag, did you forget to quote a string?")),r=["error","error"]}if(!r)throw _e(e,"Invalid tag, did you forget to quote a string?");let s=At(e),o=Ue(e,Ja);if(!o&&e.current.value){let a=e.current.value;if(Ps(e))e.errors.push(_e(a,"This type of whitespace is not allowed inside a tag"));o=Ue(e,Ja)}if(!o)throw _e(e,"Invalid tag, did you forget to quote a string?");let i=new Pr(r[0]);return i.representation=r[1],i.leading=n,i.trailing=s,dn(e,i,t,e.lastToken),i}function Uc(e){return Ha(e)??Ue(e,vs)?.text??Ue(e,Cc)?.text??Ue(e,Ss)?.text}function Ip(e){if(!Ue(e,Oc))return;let t=V$(e);if(!Ue(e,Ac))throw _e(e,"Invalid node children");return t}function mi(e){let t=e.current.value;{let d=Rp(e);if(d){let p=At(e),m=qc(e);if(!m)throw _e(e,"Invalid argument");if(m.tag)e.errors.push(_e(e.lastToken,"A number suffix cannot be combined with a regular tag"));m.tag=d,m.betweenTagAndValue=p;let y=new _n(m,null);dn(e,m,t,e.lastToken),dn(e,y,t,e.lastToken);let S=At(e);if(Ue(e,si))e.errors.push(_e(e.lastToken,typeof m.value==="string"?"Unexpected equals sign, properties are name=(tag)value not (tag)name=value":"Unexpected equals sign")),S=Kt(S,At(e))||" ";return[y,S]}}{let d=Tp(e);if(d){let p=new _n(d,null);dn(e,p,t,e.lastToken);let m=At(e);if(Ue(e,si))e.errors.push(_e(e.lastToken,"Unexpected equals sign, did you forget to quote the property name?")),m=Kt(m,At(e))||" ";return[p,m]}}let n=qa(e);if(!n)return;let r=At(e),s=Ue(e,si);if(!s){let d=new ar(n[0]);d.representation=n[1],dn(e,d,n[2]);let p=new _n(d,null);return dn(e,p,t,e.lastToken),[p,r]}let o=new ir(n[0]);o.representation=n[1],dn(e,o,n[2]);let i=At(e),a=Rp(e),l=a&&At(e),c=qc(e);if(!c)throw _e(e,"Expected a value");if(a){if(c.tag)e.errors.push(_e(e.lastToken,"A number suffix cannot be combined with a regular tag"));c.tag=a,c.betweenTagAndValue=l}let u=new _n(c,o);return dn(e,u,t,e.lastToken),u.equals=Kt(r,s.text,i),[u,void 0]}function D$(e){let t=At(e)??"",n;while(n=wo(e)){let i=e.lastToken.end,a=mi(e);if(!a)throw _e(e,"Expected a property or argument");if(!(a[1]??At(e)))throw _e(e,"Expected space after slashdashed property or argument");t=t+n+e.text.slice(i.offset,e.lastToken.end.offset)}let r=mi(e);if(!r)return;let s=r[1]??At(e)??"";while(n=wo(e)){let i=e.lastToken.end,a=mi(e);if(!a)throw _e(e,"Expected a property or argument");if(!(a[1]??At(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 wo(e){let t=Ue(e,ho)?.text;if(!t)return;return Kt(t,Ps(e))}function zc(e){let t=e.current.value,n=Rp(e),r=n&&At(e),s=Jp(e);if(!s)if(n)throw _e(e,"Couldn't find node name");else return;let o=At(e),i=o!=null,a=wo(e),l=[];while(i||a){let p=e.lastToken.end,m=mi(e);if(!m)break;if(a)i=(m[1]||At(e))!=null,o=Kt(o,a,e.text.slice(p.offset,e.lastToken.end.offset)),a=wo(e);else{let y=m[0];y.leading=o,l.push(y),o=m[1]||At(e),i=o!=null,a=wo(e)}}let c,u;while(!0){a??=wo(e);let p=e.lastToken.end,m=Ip(e);if(!m){if(a)throw _e(e,"Unexpected slashdash");break}if(a)o=Kt(o,a,e.text.slice(p.offset,e.lastToken.end.offset)),a=void 0;else{if(c)e.errors.push(_e(e,"A node can only have one children block"));c=m,u=o??"",o=void 0}o=Kt(o,At(e))}let d=new fi(s,l,c);return d.tag=n??null,d.betweenTagAndName=r,d.beforeChildren=u,d.trailing=o??"",dn(e,d,t,e.lastToken),d}function L$(e){let t=Ps(e),n=zc(e);if(!n)return;let r=Kt(Uc(e),Ps(e));return n.leading=Kt(t,n.leading),n.trailing=Kt(n.trailing,r),n}function F$(e){let t=Ue(e,ri)?.text,n=V$(e);if(!t)return n;if(n.nodes[0])n.nodes[0].leading=Kt(t,n.nodes[0].leading);else n.trailing=Kt(t,n.trailing);return n}function V$(e){let t=e.current.value,n=[],r=!0,s=Ps(e);while(r){let i=e.lastToken.end,a=wo(e),l=zc(e);if(!l){if(a)throw _e(e,"Unexpected slashdash");break}let c=At(e),u=Uc(e);if(a)s=Kt(s,e.text.slice(i.offset,e.lastToken.end.offset),Ps(e));else l.trailing=Kt(l.trailing,c,u)??"",n.push(l),l.leading=s??"",s=Ps(e);r=u!=null}let o=new js(n);return dn(e,o,t,e.lastToken),o.trailing=s??"",o}var Dp=J(()=>{bo();_p();A$();M$();li()});function q$(e,t){let n=[],r;while(r=t(e))n.push(r);return n.length>0?n:void 0}function jT(e){{let t=Ue(e,ri);if(t)return{type:"bom",text:t.text}}{let t=Ue(e,vs);if(t)return{type:"newline",text:t.text}}{let t=Ue(e,go);if(t)return{type:"space",text:t.text}}{let t=Ha(e);if(t)return{type:"singleline",text:t}}{let t=Wc(e);if(t)return{type:"multiline",text:t}}return}function Kc(e){{let t=Bc(e);if(t)return{type:"line-escape",text:t}}{let t=Ue(e,go);if(t)return{type:"space",text:t.text}}{let t=Wc(e);if(t)return{type:"multiline",text:t}}return}function H$(e){let t=[];while(!0){{let n=jT(e);if(n){t.push(n);continue}}if(Ue(e,ho)?.text){let r,s=q$(e,Kc)??[],o=zc(e);if(!o)throw _e(e,"Invalid slashdash, expected a commented node");o.trailing=Kt(o.trailing,q$(e,Kc)?.map((i)=>i.text).join(""),Uc(e)),t.push({type:"slashdash",preface:s,value:o});continue}break}return t}function PT(e){let t=Ue(e,ho);if(t==null)return;let n,r=[];while(n=Kc(e))r.push(n);let s,o,i="";if(o=mi(e)){if(s=o[0],o[1])i=o[1]}else if(o=Ip(e))s=o;else throw _e(t,"Couldn't find argument, property, or children that were commented by slashdash");return[{type:"slashdash",preface:r,value:s},i]}function Lp(e){let t=[];while(!0){let n=Kc(e);if(!n)break;let r=!0;t.push(n);while(r){let s=PT(e);if(!s)break;if(t.push(s[0]),s[1][0])t.push(...Lp(Hc(s[1][0],Fa(s[1][0],{flags:e.flags}),{flags:e.flags})));r=!!s[1][0]}}return t}var W$=J(()=>{li();Dp()});function _s(e,{as:t="document",flags:n,...r}={}){let s=_T[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=k$(n),i=Fa(e,{...r,flags:o}),a=Hc(e,i,{...r,flags:o}),l;try{l=s(a)}catch(c){Np(a,c)}if(Np(a),!l)throw new Ce(`Expected ${/^[aeiouy]/.exec(t)?"an":"a"} ${t}`);return l}var _T;var B$=J(()=>{bo();li();Dp();W$();_T={value:qc,identifier:Jp,node:L$,entry:D$,document:F$,"whitespace in document":H$,"whitespace in node":Lp}});var Gc=J(()=>{bo();_p();B$()});function hi(e,t){let n=e.slice(0,t),r=n.split(`
18
+ `+i.slice(r.length)}).slice(1,-1)}function rS(e,t,n,r,s,o,i,a){if(i)return"";if(o){let l=n.text.startsWith('"""'),c=t.slice(0,a).split(bi),u={offset:n.start.offset+(l?3:1)+a,line:n.start.line+(c.length-1),column:c.length===1?n.start.column+(l?3:1)+a:c.at(-1).length},d={offset:u.offset+r.length,line:u.line,column:u.column+r.length};if(!o.startsWith("{"))e.push(new Ne(String.raw`Invalid unicode escape "\u${o}", did you forget to use {}? "\u{${o}}"`,{token:n,start:u,end:d}));else e.push(new Ne(String.raw`Invalid unicode escape "\u${o.endsWith("}")?o:`${o}...`}"`,{token:n,start:u,end:d}));return""}else if(s){let l=parseInt(s,16);if(l>=55296&&l<=57343)e.push(new Ne(String.raw`Invalid unicode escape "\u{${s}}, only scalar values can be added using an escape`,{token:n}));return String.fromCodePoint(l)}else{let l=KN.get(r);if(l==null)return e.push(new Ne(r.length<2?"Invalid whitespace escape at the end of a string":`Invalid escape "${r}"`,{token:n})),"";return l}}function Ba(e,t,n){let r=1;switch(e.type){case di:r=3;break;case js:r=e.text.indexOf('"')+1;break;case $o:r=e.text.indexOf('"')+3;break}let s=t.slice(0,n).split(bi);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 $G,KN,bi,GN,XN,YN,ZN,QN,eJ,tJ,nJ,rJ;var sS=M(()=>{wo();mi();$G=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"]]),KN=new Map([["\\n",`
19
+ `],["\\r","\r"],["\\t","\t"],["\\\\","\\"],["\\\"",'"'],["\\b","\b"],["\\f","\f"],["\\s"," "]]),bi=/\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029]/,GN=/\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029]/g,XN=/(?:^|[^\\\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,YN=/(?:^|[^\\\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;ZN=/[\x0A\x0B\x0C\x0D\x85\u2028\u2029]([\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)$/,QN=/(?:^|[^\\\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]*)*$/,eJ=/(\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,tJ=/([^\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]*$/;nJ=/\\(?:$|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;rJ=/(\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 ts(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 Ue(e,t){if(!e.current.done&&e.current.value.type===t){let n=e.current.value;return ts(e),n}}function Oe(e,t){let n="current"in e?e.current.value??e.lastToken:e;return new Ne(t,{token:n})}function mn(e,t,n,r=n){if(e.storeLocations)G$(t,n,r)}function Yt(e="",t="",n=""){return e+t+n||void 0}function zc(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 ts(o),o}function Bp(e,t){if(!t&&!e.current.done&&e.current.value.type!==Es)t=Oe(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 Ne)if(t.errors)n.push(...t.errors);else n.push(t);else n.push(new Ne(`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 Ne("Encountered multiple errors",{errors:n})}function Bc(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 oS(e){return e==="inf"||e==="-inf"||e==="nan"||e==="true"||e==="false"||e==="null"||!1}function Up(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 Er:{if(!e.flags.experimentalSuffixedNumbers)throw new Ne("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),oS(s))e.errors.push(Oe(e,`Invalid suffix ${s}, values that look like keywords cannot be used as suffix`))}break;case Dc:a=!0,n=(i==="-"?-1:1)*Number.parseInt(t.text.slice(i?3:2).replaceAll("_",""),2);break;case Ic:a=!0,n=(i==="-"?-1:1)*Number.parseInt(t.text.slice(i?3:2).replaceAll("_",""),8);break;case Qr:a=!0,n=Number.parseFloat(t.text.replaceAll("_",""));break;case Mc:a=!0,n=(i==="-"?-1:1)*Number.parseInt(t.text.slice(i?3:2).replaceAll("_",""),16);break;case fi:if(n=Bc(t.text),n===void 0)if(n=null,Bc(t.text.toLowerCase())!==void 0)e.errors.push(Oe(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(Oe(e,`Invalid keyword ${t.text}, did you mean #null?`));break;case"#fals":case"#fasle":e.errors.push(Oe(e,`Invalid keyword ${t.text}, did you mean #false?`));break;case"#ture":case"#treu":e.errors.push(Oe(e,`Invalid keyword ${t.text}, did you mean #true?`));break;case"#ifn":e.errors.push(Oe(e,`Invalid keyword ${t.text}, did you mean #inf?`));break;case"#-ifn":e.errors.push(Oe(e,`Invalid keyword ${t.text}, did you mean #-inf?`));break;default:e.errors.push(Oe(e,`Invalid keyword ${t.text}, surround it with quotes to use a string`))}break;default:return}ts(e);let l=e.flags.experimentalSuffixedNumbers&&Ue(e,fi);if(l)if(a){if(o=l.text,Bc(o)!==void 0)e.errors.push(Oe(l,`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(Oe(l,"Unexpected hashed suffix, a number can only have one suffix"));else if(typeof n==="number")e.errors.push(Oe(l,"Unexpected hashed suffix, you cannot place suffixes on number keywords"));else e.errors.push(Oe(l,"Unexpected hashed suffix, you can only place suffixes on numbers"));let c=new ur(n);if(c.representation=r??t.text,mn(e,c,t),s){let u=new Pr(s);u.representation=o,u.suffix=!0,mn(e,u,e.lastToken),c.tag=u}return c}function Ua(e){if(e.current.done)return;let{value:t}=e.current,n;switch(t.type){case Xt:if(ts(e),oS(t.text))e.errors.push(Oe(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 Fa:ts(e),n=[tS(e.errors,t.text.slice(1,-1),t),t.text,t];break;case di:ts(e),n=[nS(e.errors,t.text.slice(3,-3),t),t.text,t];break;case js:{ts(e);let r=t.text,s=r.indexOf('"');n=[Q$(e.errors,r.slice(s+1,-(s+1)),t),r,t];break}case $o:{ts(e);let r=t.text,s=r.indexOf('"');n=[eS(e.errors,r.slice(s+3,-(s+3)),t),r,t];break}default:return}if(Ue(e,fi))e.errors.push(Oe(e.lastToken,Bc(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 zp(e){let t=Ua(e);if(!t)return;let n=new cr(t[0]);return n.representation=t[1],mn(e,n,t[2],e.lastToken),n}function Uc(e){let t=Up(e);if(t)return t;let n=Ua(e);if(!n)return;let r=new ur(n[0]);return r.representation=n[1],mn(e,r,n[2],e.lastToken),r}function za(e){let t=Ue(e,Fc);if(!t)return;let{value:n}=e.current;return ts(e),t.text+(n?.text??"")}function Kc(e){return Ue(e,Vc)?.text}function Kp(e){return Ue(e,bo)??Kc(e)}function Gc(e){let t=Ue(e,Lc);if(!t)return;while(Kp(e));if(!za(e)&&!Ue(e,Ps)&&!Ue(e,Es))e.errors.push(Oe(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 Os(e){let t=e.lastToken.end;while(Ue(e,Ps)?.text??za(e)??Kp(e)??Gc(e));if(e.lastToken.end===t)return;return e.text.slice(t.offset,e.lastToken.end.offset)}function Rt(e){let t=e.lastToken.end;while(Kp(e)??Gc(e));if(e.lastToken.end===t)return;return e.text.slice(t.offset,e.lastToken.end.offset)}function Wp(e){let t=Ue(e,Rc);if(!t)return;let n=Rt(e),r=Ua(e);if(!r&&e.current.value){let a=e.current.value;if(Os(e))e.errors.push(Oe(a,"This type of whitespace is not allowed inside a tag"));r=Ua(e)}if(!r){if(Up(e))e.errors.push(Oe(e,"Invalid tag, did you forget to quote a string?")),r=["error","error"]}if(!r)throw Oe(e,"Invalid tag, did you forget to quote a string?");let s=Rt(e),o=Ue(e,La);if(!o&&e.current.value){let a=e.current.value;if(Os(e))e.errors.push(Oe(a,"This type of whitespace is not allowed inside a tag"));o=Ue(e,La)}if(!o)throw Oe(e,"Invalid tag, did you forget to quote a string?");let i=new Pr(r[0]);return i.representation=r[1],i.leading=n,i.trailing=s,mn(e,i,t,e.lastToken),i}function Xc(e){return za(e)??Ue(e,Ps)?.text??Ue(e,Jc)?.text??Ue(e,Es)?.text}function Gp(e){if(!Ue(e,Tc))return;let t=cS(e);if(!Ue(e,Nc))throw Oe(e,"Invalid node children");return t}function $i(e){let t=e.current.value;{let d=Wp(e);if(d){let p=Rt(e),m=Uc(e);if(!m)throw Oe(e,"Invalid argument");if(m.tag)e.errors.push(Oe(e.lastToken,"A number suffix cannot be combined with a regular tag"));m.tag=d,m.betweenTagAndValue=p;let g=new Cn(m,null);mn(e,m,t,e.lastToken),mn(e,g,t,e.lastToken);let b=Rt(e);if(Ue(e,ui))e.errors.push(Oe(e.lastToken,typeof m.value==="string"?"Unexpected equals sign, properties are name=(tag)value not (tag)name=value":"Unexpected equals sign")),b=Yt(b,Rt(e))||" ";return[g,b]}}{let d=Up(e);if(d){let p=new Cn(d,null);mn(e,p,t,e.lastToken);let m=Rt(e);if(Ue(e,ui))e.errors.push(Oe(e.lastToken,"Unexpected equals sign, did you forget to quote the property name?")),m=Yt(m,Rt(e))||" ";return[p,m]}}let n=Ua(e);if(!n)return;let r=Rt(e),s=Ue(e,ui);if(!s){let d=new ur(n[0]);d.representation=n[1],mn(e,d,n[2]);let p=new Cn(d,null);return mn(e,p,t,e.lastToken),[p,r]}let o=new cr(n[0]);o.representation=n[1],mn(e,o,n[2]);let i=Rt(e),a=Wp(e),l=a&&Rt(e),c=Uc(e);if(!c)throw Oe(e,"Expected a value");if(a){if(c.tag)e.errors.push(Oe(e.lastToken,"A number suffix cannot be combined with a regular tag"));c.tag=a,c.betweenTagAndValue=l}let u=new Cn(c,o);return mn(e,u,t,e.lastToken),u.equals=Yt(r,s.text,i),[u,void 0]}function iS(e){let t=Rt(e)??"",n;while(n=jo(e)){let i=e.lastToken.end,a=$i(e);if(!a)throw Oe(e,"Expected a property or argument");if(!(a[1]??Rt(e)))throw Oe(e,"Expected space after slashdashed property or argument");t=t+n+e.text.slice(i.offset,e.lastToken.end.offset)}let r=$i(e);if(!r)return;let s=r[1]??Rt(e)??"";while(n=jo(e)){let i=e.lastToken.end,a=$i(e);if(!a)throw Oe(e,"Expected a property or argument");if(!(a[1]??Rt(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 jo(e){let t=Ue(e,xo)?.text;if(!t)return;return Yt(t,Os(e))}function Yc(e){let t=e.current.value,n=Wp(e),r=n&&Rt(e),s=zp(e);if(!s)if(n)throw Oe(e,"Couldn't find node name");else return;let o=Rt(e),i=o!=null,a=jo(e),l=[];while(i||a){let p=e.lastToken.end,m=$i(e);if(!m)break;if(a)i=(m[1]||Rt(e))!=null,o=Yt(o,a,e.text.slice(p.offset,e.lastToken.end.offset)),a=jo(e);else{let g=m[0];g.leading=o,l.push(g),o=m[1]||Rt(e),i=o!=null,a=jo(e)}}let c,u;while(!0){a??=jo(e);let p=e.lastToken.end,m=Gp(e);if(!m){if(a)throw Oe(e,"Unexpected slashdash");break}if(a)o=Yt(o,a,e.text.slice(p.offset,e.lastToken.end.offset)),a=void 0;else{if(c)e.errors.push(Oe(e,"A node can only have one children block"));c=m,u=o??"",o=void 0}o=Yt(o,Rt(e))}let d=new yi(s,l,c);return d.tag=n??null,d.betweenTagAndName=r,d.beforeChildren=u,d.trailing=o??"",mn(e,d,t,e.lastToken),d}function aS(e){let t=Os(e),n=Yc(e);if(!n)return;let r=Yt(Xc(e),Os(e));return n.leading=Yt(t,n.leading),n.trailing=Yt(n.trailing,r),n}function lS(e){let t=Ue(e,ci)?.text,n=cS(e);if(!t)return n;if(n.nodes[0])n.nodes[0].leading=Yt(t,n.nodes[0].leading);else n.trailing=Yt(t,n.trailing);return n}function cS(e){let t=e.current.value,n=[],r=!0,s=Os(e);while(r){let i=e.lastToken.end,a=jo(e),l=Yc(e);if(!l){if(a)throw Oe(e,"Unexpected slashdash");break}let c=Rt(e),u=Xc(e);if(a)s=Yt(s,e.text.slice(i.offset,e.lastToken.end.offset),Os(e));else l.trailing=Yt(l.trailing,c,u)??"",n.push(l),l.leading=s??"",s=Os(e);r=u!=null}let o=new _s(n);return mn(e,o,t,e.lastToken),o.trailing=s??"",o}var Xp=M(()=>{wo();Lp();Z$();sS();mi()});function uS(e,t){let n=[],r;while(r=t(e))n.push(r);return n.length>0?n:void 0}function sJ(e){{let t=Ue(e,ci);if(t)return{type:"bom",text:t.text}}{let t=Ue(e,Ps);if(t)return{type:"newline",text:t.text}}{let t=Ue(e,bo);if(t)return{type:"space",text:t.text}}{let t=za(e);if(t)return{type:"singleline",text:t}}{let t=Kc(e);if(t)return{type:"multiline",text:t}}return}function Zc(e){{let t=Gc(e);if(t)return{type:"line-escape",text:t}}{let t=Ue(e,bo);if(t)return{type:"space",text:t.text}}{let t=Kc(e);if(t)return{type:"multiline",text:t}}return}function fS(e){let t=[];while(!0){{let n=sJ(e);if(n){t.push(n);continue}}if(Ue(e,xo)?.text){let r,s=uS(e,Zc)??[],o=Yc(e);if(!o)throw Oe(e,"Invalid slashdash, expected a commented node");o.trailing=Yt(o.trailing,uS(e,Zc)?.map((i)=>i.text).join(""),Xc(e)),t.push({type:"slashdash",preface:s,value:o});continue}break}return t}function oJ(e){let t=Ue(e,xo);if(t==null)return;let n,r=[];while(n=Zc(e))r.push(n);let s,o,i="";if(o=$i(e)){if(s=o[0],o[1])i=o[1]}else if(o=Gp(e))s=o;else throw Oe(t,"Couldn't find argument, property, or children that were commented by slashdash");return[{type:"slashdash",preface:r,value:s},i]}function Yp(e){let t=[];while(!0){let n=Zc(e);if(!n)break;let r=!0;t.push(n);while(r){let s=oJ(e);if(!s)break;if(t.push(s[0]),s[1][0])t.push(...Yp(zc(s[1][0],Wa(s[1][0],{flags:e.flags}),{flags:e.flags})));r=!!s[1][0]}}return t}var dS=M(()=>{mi();Xp()});function As(e,{as:t="document",flags:n,...r}={}){let s=iJ[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=X$(n),i=Wa(e,{...r,flags:o}),a=zc(e,i,{...r,flags:o}),l;try{l=s(a)}catch(c){Bp(a,c)}if(Bp(a),!l)throw new Ne(`Expected ${/^[aeiouy]/.exec(t)?"an":"a"} ${t}`);return l}var iJ;var pS=M(()=>{wo();mi();Xp();dS();iJ={value:Uc,identifier:zp,node:aS,entry:iS,document:lS,"whitespace in document":fS,"whitespace in node":Yp}});var Qc=M(()=>{wo();Lp();pS()});function Si(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 Ft;var gi=J(()=>{Ft=class Ft 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 Ft(`${e}: ${this.reason}`,t)}}});var U$;var z$=J(()=>{U$=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 je(e,t,n,r,s){let o=t.normalize("NFC");if(o==="__proto__")throw ke(r,s,'"__proto__" cannot be a key: it would not be data');if(Object.hasOwn(e,o))throw ke(r,s,`"${o}" is written twice, and one of them would be lost`);e[o]=n}function ke(e,t,n){let r=Yc(t)?.start;return new Ft(n,r===void 0?null:hi(e.text,r))}function Yc(e){let t=ci(e);return t?{end:t.end.offset,start:t.start.offset}:null}function wt(e,t,n){let r=e.spans?Yc(n):null;if(r)e.spans?.set(t,r)}function K$(e,t,n){let r=e.tokens&&n?Yc(n):null;if(r)e.tokens?.names.set(t,r)}function Jt(e,t,n){let r=e.tokens&&n?Yc(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 ks(e){return e.entries.filter((t)=>!t.name)}function nt(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function yi(e,t){let n=t.getTag();if(n!==null&&!Y$.has(n))throw ke(e,t,`(${n}) is not an annotation Jx Notation has`);if(n==="ref")throw ke(e,t,"(ref) annotates a value, and this is a name");return n}function ns(e,t){let n=t.getTag(),r=t.getValue();if(n!==null&&n!=="ref")throw ke(e,t,`(${n}) cannot annotate a value here; only (ref) can`);if(Ie(r)){if(!Number.isFinite(r))throw ke(e,t,"JSON has no way to hold #inf or #nan");if(Number.isInteger(r)&&!Number.isSafeInteger(r))throw ke(e,t,"This number is too large to survive being read as JSON")}if(n==="ref"){if(!k(r))throw ke(e,t,"(ref) needs a string");return{$ref:r}}return r}function Ln(e,t){return t.entries.filter((n)=>!n.name).map((n)=>ns(e,n))}function Fn(e){return e.entries.filter((t)=>t.name)}function Vt(e){return e.children?.nodes??[]}function _r(e){return e.getName()??""}function AT(e,t,n){let r={$prototype:"Function"},s=Ln(e,t),o=Vt(t);for(let a of Fn(t))je(r,_r(a),ns(e,a),e,a),Jt(e,`${n}/${nt(_r(a))}`,a);let i=e.tokens?ks(t):[];if(o.length>0){if(s.length>0)je(r,"parameters",s,e,t);je(r,"body",Fp(e,o,`${n}/body`),e,t)}else if(s.length>0){let a=s.at(-1)??null,l=s.slice(0,-1);if(l.length>0)je(r,"parameters",l,e,t);je(r,"body",a,e,t),Jt(e,`${n}/body`,i.pop())}for(let[a,l]of i.entries())Jt(e,`${n}/parameters/${a}`,l);return wt(e,n,t),r}function CT(e,t,n){let r={$prototype:"Function",$src:"#client"};if(Ln(e,t).length>0||Vt(t).length>0)throw ke(e,t,"(export) names a function the document's script exports, and holds no body of its own");for(let s of Fn(t))je(r,_r(s),ns(e,s),e,s),Jt(e,`${n}/${nt(_r(s))}`,s);if(!Object.hasOwn(r,"$export"))r.$export=t.getName().normalize("NFC");return wt(e,n,t),r}function RT(e,t,n){if(Ln(e,t).length>0||Vt(t).length>0)throw ke(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=Fn(t);if(s.length>0){let o={};for(let i of s){let a=_r(i);je(o,a,ns(e,i),e,i),wt(e,`${n}/arguments/${nt(a)}`,i),Jt(e,`${n}/arguments/${nt(a)}`,i)}r.arguments=o}return wt(e,n,t),r}function NT(e,t,n){let r={};for(let l of Fn(t)){let c=_r(l);if(je(r,c,ns(e,l),e,l),c!=="timing"||r[c]!=="server")throw ke(e,l,"A script takes timing=server, and nothing else")}let s=Ln(e,t),[o]=s;if(s.length!==1||!k(o)||Vt(t).length>0)throw ke(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)||!G$.has(a))a={},G$.add(a),je(n,"$script",a,e,t);je(a,i,o,e,t),wt(e,`/$script/${i}`,t),Jt(e,`/$script/${i}`,ks(t)[0])}function X$(e,t,n){for(let[r,s]of(e.tokens?ks(n):[]).entries())Jt(e,`${t}/${r}`,s)}function Fp(e,t,n,r=0){return t.map((s,o)=>{if(s.getName()!=="-")throw ke(e,s,`A list holds only "-" items, and this is "${s.getName()}"`);return Dn(e,s,`${n}/${r+o}`)})}function Dn(e,t,n){let r=yi(e,t);if(wt(e,n,t),r==="fn")return AT(e,t,n);if(r==="export")return CT(e,t,n);if(r==="server")return RT(e,t,n);let s=Ln(e,t),o=Fn(t),i=Vt(t);if(r==="array"){if(o.length>0)throw ke(e,t,"(array) holds items, and these are named");return X$(e,n,t),[...s,...Fp(e,i,n,s.length)]}if(r!=="object"){if(s.length>1){if(o.length>0||i.length>0)throw ke(e,t,"A list of values cannot also have names or a block");return X$(e,n,t),s}if(s.length===1){if(o.length>0||i.length>0)throw ke(e,t,"A value cannot also have names or a block");return Jt(e,n,ks(t)[0]),s[0]??null}if(i.length>0&&o.length===0&&i.every((l)=>l.getName()==="-"))return Fp(e,i,n)}else if(s.length>0)throw ke(e,t,"(object) holds names, and this is a value");let a={};for(let l of o){let c=_r(l);je(a,c,ns(e,l),e,l),wt(e,`${n}/${nt(c)}`,l),K$(e,`${n}/${nt(c)}`,l.name),Jt(e,`${n}/${nt(c)}`,l)}for(let l of i){let c=l.getName();je(a,c,Dn(e,l,`${n}/${nt(c)}`),e,l),K$(e,`${n}/${nt(c)}`,l.name)}return a}function Zc(e,t,n){let r={};if(wt(e,n,t),Ln(e,t).length>0)throw ke(e,t,"A style block holds declarations, and this is a value");for(let s of Fn(t)){let o=_r(s);je(r,o,ns(e,s),e,s),wt(e,`${n}/${nt(o)}`,s),Jt(e,`${n}/${nt(o)}`,s)}for(let s of Vt(t)){let o=s.getName(),i=`${n}/${nt(o)}`,a=Vt(s);if(s.getTag()==="array"||a.length>0&&a.every((c)=>c.getName()==="-")){je(r,o,Dn(e,s,i),e,s);continue}let l=Ln(e,s);if(l.length>1)throw ke(e,s,`"${o}" has more than one value. A selector with a space in it needs quotes`);if(l.length===1){if(Fn(s).length>0||Vt(s).length>0)throw ke(e,s,`"${o}" has a value and names. A selector with a space in it needs quotes`);je(r,o,l[0]??null,e,s),wt(e,i,s),Jt(e,i,ks(s)[0])}else je(r,o,Zc(e,s,i),e,s)}return r}function Xc(e,t,n){let r=Vt(t);if(r.length!==1||!r[0])throw ke(e,t,`"${t.getName()}" holds one element`);return Q$(e,r[0],n)}function Z$(e,t,n){let r={$prototype:"Array"};if(wt(e,n,t),Ln(e,t).length>0)throw ke(e,t,"$array holds names and one element, and this is a value");for(let s of Fn(t)){let o=_r(s),i=o.startsWith(".")?o.slice(1):o;je(r,i,ns(e,s),e,s),Jt(e,`${n}/${nt(i)}`,s)}if(Vt(t).length>0)je(r,"map",Xc(e,t,`${n}/map`),e,t);return r}function Q$(e,t,n){let r=t.getName();if(r==="-"){let s=Ln(e,t);if(s.length!==1||Fn(t).length>0||Vt(t).length>0)throw ke(e,t,'"-" is one piece of text or one (ref)');return wt(e,n,t),Jt(e,n,ks(t)[0]),s[0]??null}if(r==="$array")return Z$(e,t,n);return Vp(e,t,n)}function TT(e,t,n,r){let s=yi(e,n);if(t==="map")return Xc(e,n,r);if(t==="cases"){let o={};for(let i of Vt(n)){let a=i.getName();je(o,a,Xc(e,i,`${r}/${nt(a)}`),e,i)}return o}if(t==="children"&&s!=="array"&&Vt(n).length>0)return Xc(e,n,r);return Dn(e,n,r)}function Vp(e,t,n){let r={},s=t.getName(),o=yi(e,t);if(wt(e,n,t),o!==null)throw ke(e,t,`(${o}) cannot annotate an element`);let i=Ln(e,t);if(s==="$element"){let[l,c,...u]=i;if(u.length>0)throw ke(e,t,"$element takes at most a tag and a text value");if(l!==void 0)je(r,"tagName",l,e,t);if(c!==void 0)je(r,"textContent",c,e,t),Jt(e,`${n}/textContent`,ks(t)[1])}else{if(s.startsWith("$"))throw ke(e,t,`"${s}" is not a kind of element`);if(je(r,"tagName",s,e,t),i.length>1)throw ke(e,t,"An element has one text value. A list of them needs a block");if(i[0]!==void 0)je(r,"textContent",i[0],e,t),wt(e,`${n}/textContent`,t),Jt(e,`${n}/textContent`,ks(t)[0])}JT(e,t,r,n);let a=[];for(let l of Vt(t))MT(e,l,r,a,n);if(a.length>0)je(r,"children",a,e,t);return r}function eS(e){let{attributes:t}=e;if(L(t))return t;let n={};return e.attributes=n,n}function JT(e,t,n,r){for(let s of Fn(t)){let o=_r(s),i=s.getTag();if(i==="fn")throw ke(e,s,"A function has a block form: (fn)name, on a line of its own");let a=ns(e,s);if(o.startsWith(".")||o.startsWith("$")){let l=o.startsWith(".")?o.slice(1):o;je(n,l,a,e,s),wt(e,`${r}/${nt(l)}`,s),Jt(e,`${r}/${nt(l)}`,s)}else if(o.startsWith("on")&&i==="ref")je(n,o,a,e,s),wt(e,`${r}/${nt(o)}`,s),Jt(e,`${r}/${nt(o)}`,s);else if(o.startsWith("on")&&U$.has(o))throw ke(e,s,`${o} needs (ref)"pointer", or a function on a line of its own: (fn)${o} "…"`);else je(eS(n),o,a,e,s),wt(e,`${r}/attributes/${nt(o)}`,s),Jt(e,`${r}/attributes/${nt(o)}`,s)}}function MT(e,t,n,r,s){let o=t.getName(),i=yi(e,t),a=(l)=>`${s}/${nt(l)}`;if(i==="fn"||i==="on"){if(!o.startsWith("on"))throw ke(e,t,`(${i}) in an element marks a handler, and "${o}" is not one`);je(n,o,Dn(e,t,a(o)),e,t)}else if(o==="script"){if(s!=="")throw ke(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 ke(e,t,`(${i}) cannot annotate a script`);NT(e,t,n)}else if(o==="state")je(n,"state",Dn(e,t,a("state")),e,t);else if(o==="style")je(n,"style",Zc(e,t,a("style")),e,t);else if(o==="attributes"){let l=Dn(e,t,a("attributes"));if(L(l))for(let[c,u]of Object.entries(l))je(eS(n),c,u,e,t);else je(n,"attributes",l,e,t)}else if(o.startsWith(".")){let l=o.slice(1);je(n,l,TT(e,l,t,a(l)),e,t)}else if(o.startsWith("$")&&o!=="$array"&&o!=="$element")je(n,o,Dn(e,t,a(o)),e,t);else{if(OT.has(o))throw ke(e,t,`"${o}" is reserved here`);r.push(Q$(e,t,`${s}/children/${r.length}`))}}function qp(e,t){return Vt(t).map((n,r)=>{let s=`/$head/${r}`;return n.getName()==="-"?Dn(e,n,s):Vp(e,n,s)})}function Hp(e){let t=kT.exec(e);if(t)throw new Ft(`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}`,hi(e,t.index));try{return _s(e,{storeLocations:!0})}catch(n){let s=(n instanceof Ce?n.errors?.[0]??n:null)?.start,o=n instanceof Error?n.message:String(n);throw new Ft(o.split(`
22
- `)[0]??o,s?hi(e,s.offset):null)}}function tS(e){if(ni(e.text)==="project")throw new Ft('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=Hp(e.text),r={},s=null;for(let o of n.nodes){let i=o.getName();if(i==="$head"&&o.getTag()===null)je(r,i,qp(e,o),e,o);else if(i.startsWith("$")&&i!=="$array"&&i!=="$element")je(r,i,Dn(e,o,`/${nt(i)}`),e,o),wt(e,`/${nt(i)}`,o);else if(s)throw ke(e,o,"A document has one root element, and this is a second");else s=o}if(s){let o=s.getName()==="$array"?Z$(e,s,""):Vp(e,s,"");for(let[i,a]of Object.entries(o))je(r,i,a,e,s)}return ei(r)}function vo(e,t){try{return tS({spans:null,text:e})}catch(n){throw t!==void 0&&n instanceof Ft?n.inFile(t):n}}function Wp(e){let t=new Map;return{document:tS({spans:t,text:e}),spans:t}}var kT,Y$,OT,G$;var Wa=J(()=>{Gc();ce();Lt();Ta();gi();z$();kT=/(?![\t\n\v\f\r])\p{Cc}/u,Y$=new Set(["array","export","fn","object","on","ref","server"]),OT=new Set(["attributes","script","state","style"]);G$=new WeakSet});function rs(e){return e.toLowerCase().endsWith(".jxn")}function Vn(e){return e.endsWith(".json")||rs(e)}function kn(e,t){return rs(t)?vo(e,t):Yb(e,t)}var Qc=J(()=>{Lt();Wa()});function LT(e){let t={comments:0,escapes:[]},n=DT.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 Bp(e){return LT(e).escapes.flatMap((t)=>{let n=IT.get(e.charAt(t+1));return n?[{...hi(e,t),message:n}]:[]})}var IT,DT;var nS=J(()=>{gi();IT=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.`]]),DT=/^\uFEFF?\s*\/-[^\S\n]*kdl-version[^\S\n]+\d+[^\S\n]*(?:\n|$)/u});function xi(e,t=!1){if(Array.isArray(e))return`[${e.map((s)=>xi(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)}:${xi(e[s],t||s==="style")}`).join(",")}}`}function FT(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 VT({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 rS(e,t){let n=VT(e),r=new Map;for(let[s,o]of n)r.set(s,xi(FT(e.document,o)));return{meanings:r,pointers:n,text:t}}function ss(e){let t=ci(e);return{end:t?.end.offset??0,start:t?.start.offset??0}}function tu(e,t){let{end:n,start:r}=ss(e);return t.slice(r,n).trimEnd()}function eu(e,t){let{end:n,start:r}=ss(e);return`${e.leading??" "}${t.slice(r,n).trimEnd()}`}function Gp(e){return e.children?.nodes??[]}function Up(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=Gp(e).map((o)=>Up(o));return`(${e.getTag()??""})${e.getName()} ${[...n,...r].join(" ")} {${s.join(";")}}`}function zp(e,t,n){if(Up(t)===Up(n))return!0;let r=e.previous.meanings.get(ss(t).start);return r!==void 0&&r===e.next.meanings.get(ss(n).start)}function sS(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 oS(e,t,n){let r=e.length+1,s=t.length+1,o=new Int32Array(r*s);for(let c=e.length-1;c>=0;c-=1)for(let u=t.length-1;u>=0;u-=1){let d=e[c],p=t[u];o[c*s+u]=d!==void 0&&p!==void 0&&n(d,p)?(o[(c+1)*s+u+1]??0)+1:Math.max(o[(c+1)*s+u]??0,o[c*s+u+1]??0)}let i=[],a=0,l=0;while(a<e.length&&l<t.length){let c=e[a],u=t[l];if(c!==void 0&&u!==void 0&&n(c,u))i.push([a,l]),a+=1,l+=1;else if((o[(a+1)*s+l]??0)>=(o[a*s+l+1]??0))a+=1;else l+=1}return i}function qT(e,t,n){let r=new Map,s=new Set,o=(c,u)=>{let d=t[c];if(d)r.set(u,d),s.add(c)},i=oS(t,n,(c,u)=>zp(e,c,u)),a=0,l=0;for(let[c,u]of[...i,[t.length,n.length]]){let d=oS(t.slice(a,c),n.slice(l,u),(p,m)=>sS(p)===sS(m));for(let[p,m]of d)o(a+p,l+m);if(c<t.length)o(c,u);a=c+1,l=u+1}for(let[c,u]of n.entries())if(!r.has(c)){let d=t.findIndex((p,m)=>!s.has(m)&&zp(e,p,u));if(d!==-1)o(d,c)}return r}function Xp(e){let t=e.leading??"";return t.slice(t.lastIndexOf(`
24
- `)+1)}function HT(e,t,n){return e.split(`
21
+ `),line:r,offset:t}}var qt;var wi=M(()=>{qt=class qt 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 qt(`${e}: ${this.reason}`,t)}}});var mS;var hS=M(()=>{mS=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 je(e,t,n,r,s){let o=t.normalize("NFC");if(o==="__proto__")throw Ae(r,s,'"__proto__" cannot be a key: it would not be data');if(Object.hasOwn(e,o))throw Ae(r,s,`"${o}" is written twice, and one of them would be lost`);e[o]=n}function Ae(e,t,n){let r=tu(t)?.start;return new qt(n,r===void 0?null:Si(e.text,r))}function tu(e){let t=hi(e);return t?{end:t.end.offset,start:t.start.offset}:null}function Et(e,t,n){let r=e.spans?tu(n):null;if(r)e.spans?.set(t,r)}function gS(e,t,n){let r=e.tokens&&n?tu(n):null;if(r)e.tokens?.names.set(t,r)}function Mt(e,t,n){let r=e.tokens&&n?tu(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 Cs(e){return e.entries.filter((t)=>!t.name)}function it(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function vi(e,t){let n=t.getTag();if(n!==null&&!bS.has(n))throw Ae(e,t,`(${n}) is not an annotation Jx Notation has`);if(n==="ref")throw Ae(e,t,"(ref) annotates a value, and this is a name");return n}function ns(e,t){let n=t.getTag(),r=t.getValue();if(n!==null&&n!=="ref")throw Ae(e,t,`(${n}) cannot annotate a value here; only (ref) can`);if(De(r)){if(!Number.isFinite(r))throw Ae(e,t,"JSON has no way to hold #inf or #nan");if(Number.isInteger(r)&&!Number.isSafeInteger(r))throw Ae(e,t,"This number is too large to survive being read as JSON")}if(n==="ref"){if(!_(r))throw Ae(e,t,"(ref) needs a string");return{$ref:r}}return r}function Hn(e,t){return t.entries.filter((n)=>!n.name).map((n)=>ns(e,n))}function Wn(e){return e.entries.filter((t)=>t.name)}function Ht(e){return e.children?.nodes??[]}function kr(e){return e.getName()??""}function cJ(e,t,n){let r={$prototype:"Function"},s=Hn(e,t),o=Ht(t);for(let a of Wn(t))je(r,kr(a),ns(e,a),e,a),Mt(e,`${n}/${it(kr(a))}`,a);let i=e.tokens?Cs(t):[];if(o.length>0){if(s.length>0)je(r,"parameters",s,e,t);je(r,"body",Zp(e,o,`${n}/body`),e,t)}else if(s.length>0){let a=s.at(-1)??null,l=s.slice(0,-1);if(l.length>0)je(r,"parameters",l,e,t);je(r,"body",a,e,t),Mt(e,`${n}/body`,i.pop())}for(let[a,l]of i.entries())Mt(e,`${n}/parameters/${a}`,l);return Et(e,n,t),r}function uJ(e,t,n){let r={$prototype:"Function",$src:"#client"};if(Hn(e,t).length>0||Ht(t).length>0)throw Ae(e,t,"(export) names a function the document's script exports, and holds no body of its own");for(let s of Wn(t))je(r,kr(s),ns(e,s),e,s),Mt(e,`${n}/${it(kr(s))}`,s);if(!Object.hasOwn(r,"$export"))r.$export=t.getName().normalize("NFC");return Et(e,n,t),r}function fJ(e,t,n){if(Hn(e,t).length>0||Ht(t).length>0)throw Ae(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=Wn(t);if(s.length>0){let o={};for(let i of s){let a=kr(i);je(o,a,ns(e,i),e,i),Et(e,`${n}/arguments/${it(a)}`,i),Mt(e,`${n}/arguments/${it(a)}`,i)}r.arguments=o}return Et(e,n,t),r}function dJ(e,t,n){let r={};for(let l of Wn(t)){let c=kr(l);if(je(r,c,ns(e,l),e,l),c!=="timing"||r[c]!=="server")throw Ae(e,l,"A script takes timing=server, and nothing else")}let s=Hn(e,t),[o]=s;if(s.length!==1||!_(o)||Ht(t).length>0)throw Ae(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)||!yS.has(a))a={},yS.add(a),je(n,"$script",a,e,t);je(a,i,o,e,t),Et(e,`/$script/${i}`,t),Mt(e,`/$script/${i}`,Cs(t)[0])}function xS(e,t,n){for(let[r,s]of(e.tokens?Cs(n):[]).entries())Mt(e,`${t}/${r}`,s)}function Zp(e,t,n,r=0){return t.map((s,o)=>{if(s.getName()!=="-")throw Ae(e,s,`A list holds only "-" items, and this is "${s.getName()}"`);return qn(e,s,`${n}/${r+o}`)})}function qn(e,t,n){let r=vi(e,t);if(Et(e,n,t),r==="fn")return cJ(e,t,n);if(r==="export")return uJ(e,t,n);if(r==="server")return fJ(e,t,n);let s=Hn(e,t),o=Wn(t),i=Ht(t);if(r==="array"){if(o.length>0)throw Ae(e,t,"(array) holds items, and these are named");return xS(e,n,t),[...s,...Zp(e,i,n,s.length)]}if(r!=="object"){if(s.length>1){if(o.length>0||i.length>0)throw Ae(e,t,"A list of values cannot also have names or a block");return xS(e,n,t),s}if(s.length===1){if(o.length>0||i.length>0)throw Ae(e,t,"A value cannot also have names or a block");return Mt(e,n,Cs(t)[0]),s[0]??null}if(i.length>0&&o.length===0&&i.every((l)=>l.getName()==="-"))return Zp(e,i,n)}else if(s.length>0)throw Ae(e,t,"(object) holds names, and this is a value");let a={};for(let l of o){let c=kr(l);je(a,c,ns(e,l),e,l),Et(e,`${n}/${it(c)}`,l),gS(e,`${n}/${it(c)}`,l.name),Mt(e,`${n}/${it(c)}`,l)}for(let l of i){let c=l.getName();je(a,c,qn(e,l,`${n}/${it(c)}`),e,l),gS(e,`${n}/${it(c)}`,l.name)}return a}function nu(e,t,n){let r={};if(Et(e,n,t),Hn(e,t).length>0)throw Ae(e,t,"A style block holds declarations, and this is a value");for(let s of Wn(t)){let o=kr(s);je(r,o,ns(e,s),e,s),Et(e,`${n}/${it(o)}`,s),Mt(e,`${n}/${it(o)}`,s)}for(let s of Ht(t)){let o=s.getName(),i=`${n}/${it(o)}`,a=Ht(s);if(s.getTag()==="array"||a.length>0&&a.every((c)=>c.getName()==="-")){je(r,o,qn(e,s,i),e,s);continue}let l=Hn(e,s);if(l.length>1)throw Ae(e,s,`"${o}" has more than one value. A selector with a space in it needs quotes`);if(l.length===1){if(Wn(s).length>0||Ht(s).length>0)throw Ae(e,s,`"${o}" has a value and names. A selector with a space in it needs quotes`);je(r,o,l[0]??null,e,s),Et(e,i,s),Mt(e,i,Cs(s)[0])}else je(r,o,nu(e,s,i),e,s)}return r}function eu(e,t,n){let r=Ht(t);if(r.length!==1||!r[0])throw Ae(e,t,`"${t.getName()}" holds one element`);return SS(e,r[0],n)}function $S(e,t,n){let r={$prototype:"Array"};if(Et(e,n,t),Hn(e,t).length>0)throw Ae(e,t,"$array holds names and one element, and this is a value");for(let s of Wn(t)){let o=kr(s),i=o.startsWith(".")?o.slice(1):o;je(r,i,ns(e,s),e,s),Mt(e,`${n}/${it(i)}`,s)}if(Ht(t).length>0)je(r,"map",eu(e,t,`${n}/map`),e,t);return r}function SS(e,t,n){let r=t.getName();if(r==="-"){let s=Hn(e,t);if(s.length!==1||Wn(t).length>0||Ht(t).length>0)throw Ae(e,t,'"-" is one piece of text or one (ref)');return Et(e,n,t),Mt(e,n,Cs(t)[0]),s[0]??null}if(r==="$array")return $S(e,t,n);return Qp(e,t,n)}function pJ(e,t,n,r){let s=vi(e,n);if(t==="map")return eu(e,n,r);if(t==="cases"){let o={};for(let i of Ht(n)){let a=i.getName();je(o,a,eu(e,i,`${r}/${it(a)}`),e,i)}return o}if(t==="children"&&s!=="array"&&Ht(n).length>0)return eu(e,n,r);return qn(e,n,r)}function Qp(e,t,n){let r={},s=t.getName(),o=vi(e,t);if(Et(e,n,t),o!==null)throw Ae(e,t,`(${o}) cannot annotate an element`);let i=Hn(e,t);if(s==="$element"){let[l,c,...u]=i;if(u.length>0)throw Ae(e,t,"$element takes at most a tag and a text value");if(l!==void 0)je(r,"tagName",l,e,t);if(c!==void 0)je(r,"textContent",c,e,t),Mt(e,`${n}/textContent`,Cs(t)[1])}else{if(s.startsWith("$"))throw Ae(e,t,`"${s}" is not a kind of element`);if(je(r,"tagName",s,e,t),i.length>1)throw Ae(e,t,"An element has one text value. A list of them needs a block");if(i[0]!==void 0)je(r,"textContent",i[0],e,t),Et(e,`${n}/textContent`,t),Mt(e,`${n}/textContent`,Cs(t)[0])}mJ(e,t,r,n);let a=[];for(let l of Ht(t))hJ(e,l,r,a,n);if(a.length>0)je(r,"children",a,e,t);return r}function wS(e){let{attributes:t}=e;if(L(t))return t;let n={};return e.attributes=n,n}function mJ(e,t,n,r){for(let s of Wn(t)){let o=kr(s),i=s.getTag();if(i==="fn")throw Ae(e,s,"A function has a block form: (fn)name, on a line of its own");let a=ns(e,s);if(o.startsWith(".")||o.startsWith("$")){let l=o.startsWith(".")?o.slice(1):o;je(n,l,a,e,s),Et(e,`${r}/${it(l)}`,s),Mt(e,`${r}/${it(l)}`,s)}else if(o.startsWith("on")&&i==="ref")je(n,o,a,e,s),Et(e,`${r}/${it(o)}`,s),Mt(e,`${r}/${it(o)}`,s);else if(o.startsWith("on")&&mS.has(o))throw Ae(e,s,`${o} needs (ref)"pointer", or a function on a line of its own: (fn)${o} "…"`);else je(wS(n),o,a,e,s),Et(e,`${r}/attributes/${it(o)}`,s),Mt(e,`${r}/attributes/${it(o)}`,s)}}function hJ(e,t,n,r,s){let o=t.getName(),i=vi(e,t),a=(l)=>`${s}/${it(l)}`;if(i==="fn"||i==="on"){if(!o.startsWith("on"))throw Ae(e,t,`(${i}) in an element marks a handler, and "${o}" is not one`);je(n,o,qn(e,t,a(o)),e,t)}else if(o==="script"){if(s!=="")throw Ae(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 Ae(e,t,`(${i}) cannot annotate a script`);dJ(e,t,n)}else if(o==="state")je(n,"state",qn(e,t,a("state")),e,t);else if(o==="style")je(n,"style",nu(e,t,a("style")),e,t);else if(o==="attributes"){let l=qn(e,t,a("attributes"));if(L(l))for(let[c,u]of Object.entries(l))je(wS(n),c,u,e,t);else je(n,"attributes",l,e,t)}else if(o.startsWith(".")){let l=o.slice(1);je(n,l,pJ(e,l,t,a(l)),e,t)}else if(o.startsWith("$")&&o!=="$array"&&o!=="$element")je(n,o,qn(e,t,a(o)),e,t);else{if(lJ.has(o))throw Ae(e,t,`"${o}" is reserved here`);r.push(SS(e,t,`${s}/children/${r.length}`))}}function em(e,t){return Ht(t).map((n,r)=>{let s=`/$head/${r}`;return n.getName()==="-"?qn(e,n,s):Qp(e,n,s)})}function tm(e){let t=aJ.exec(e);if(t)throw new qt(`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}`,Si(e,t.index));try{return As(e,{storeLocations:!0})}catch(n){let s=(n instanceof Ne?n.errors?.[0]??n:null)?.start,o=n instanceof Error?n.message:String(n);throw new qt(o.split(`
22
+ `)[0]??o,s?Si(e,s.offset):null)}}function vS(e){if(li(e.text)==="project")throw new qt('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=tm(e.text),r={},s=null;for(let o of n.nodes){let i=o.getName();if(i==="$head"&&o.getTag()===null)je(r,i,em(e,o),e,o);else if(i.startsWith("$")&&i!=="$array"&&i!=="$element")je(r,i,qn(e,o,`/${it(i)}`),e,o),Et(e,`/${it(i)}`,o);else if(s)throw Ae(e,o,"A document has one root element, and this is a second");else s=o}if(s){let o=s.getName()==="$array"?$S(e,s,""):Qp(e,s,"");for(let[i,a]of Object.entries(o))je(r,i,a,e,s)}return ii(r)}function Po(e,t){try{return vS({spans:null,text:e})}catch(n){throw t!==void 0&&n instanceof qt?n.inFile(t):n}}function nm(e){let t=new Map;return{document:vS({spans:t,text:e}),spans:t}}var aJ,bS,lJ,yS;var Ka=M(()=>{Qc();ae();Ft();Da();wi();hS();aJ=/(?![\t\n\v\f\r])\p{Cc}/u,bS=new Set(["array","export","fn","object","on","ref","server"]),lJ=new Set(["attributes","script","state","style"]);yS=new WeakSet});function rs(e){return e.toLowerCase().endsWith(".jxn")}function Bn(e){return e.endsWith(".json")||rs(e)}function Rn(e,t){return rs(t)?Po(e,t):b$(e,t)}var ru=M(()=>{Ft();Ka()});function xJ(e){let t={comments:0,escapes:[]},n=yJ.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 rm(e){return xJ(e).escapes.flatMap((t)=>{let n=gJ.get(e.charAt(t+1));return n?[{...Si(e,t),message:n}]:[]})}var gJ,yJ;var ES=M(()=>{wi();gJ=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.`]]),yJ=/^\uFEFF?\s*\/-[^\S\n]*kdl-version[^\S\n]+\d+[^\S\n]*(?:\n|$)/u});function Ei(e,t=!1){if(Array.isArray(e))return`[${e.map((s)=>Ei(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)}:${Ei(e[s],t||s==="style")}`).join(",")}}`}function bJ(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 $J({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 jS(e,t){let n=$J(e),r=new Map;for(let[s,o]of n)r.set(s,Ei(bJ(e.document,o)));return{meanings:r,pointers:n,text:t}}function ss(e){let t=hi(e);return{end:t?.end.offset??0,start:t?.start.offset??0}}function ou(e,t){let{end:n,start:r}=ss(e);return t.slice(r,n).trimEnd()}function su(e,t){let{end:n,start:r}=ss(e);return`${e.leading??" "}${t.slice(r,n).trimEnd()}`}function am(e){return e.children?.nodes??[]}function sm(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=am(e).map((o)=>sm(o));return`(${e.getTag()??""})${e.getName()} ${[...n,...r].join(" ")} {${s.join(";")}}`}function om(e,t,n){if(sm(t)===sm(n))return!0;let r=e.previous.meanings.get(ss(t).start);return r!==void 0&&r===e.next.meanings.get(ss(n).start)}function PS(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 kS(e,t,n){let r=e.length+1,s=t.length+1,o=new Int32Array(r*s);for(let c=e.length-1;c>=0;c-=1)for(let u=t.length-1;u>=0;u-=1){let d=e[c],p=t[u];o[c*s+u]=d!==void 0&&p!==void 0&&n(d,p)?(o[(c+1)*s+u+1]??0)+1:Math.max(o[(c+1)*s+u]??0,o[c*s+u+1]??0)}let i=[],a=0,l=0;while(a<e.length&&l<t.length){let c=e[a],u=t[l];if(c!==void 0&&u!==void 0&&n(c,u))i.push([a,l]),a+=1,l+=1;else if((o[(a+1)*s+l]??0)>=(o[a*s+l+1]??0))a+=1;else l+=1}return i}function SJ(e,t,n){let r=new Map,s=new Set,o=(c,u)=>{let d=t[c];if(d)r.set(u,d),s.add(c)},i=kS(t,n,(c,u)=>om(e,c,u)),a=0,l=0;for(let[c,u]of[...i,[t.length,n.length]]){let d=kS(t.slice(a,c),n.slice(l,u),(p,m)=>PS(p)===PS(m));for(let[p,m]of d)o(a+p,l+m);if(c<t.length)o(c,u);a=c+1,l=u+1}for(let[c,u]of n.entries())if(!r.has(c)){let d=t.findIndex((p,m)=>!s.has(m)&&om(e,p,u));if(d!==-1)o(d,c)}return r}function lm(e){let t=e.leading??"";return t.slice(t.lastIndexOf(`
24
+ `)+1)}function wJ(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 WT(e,t,n){let r=[...n],s=(i)=>{let a=i.getName(),l=r.findIndex((c)=>c.getName()===a);return l===-1?void 0:r.splice(l,1)[0]},o="";for(let i of t.entries){let a=s(i);if(a){let l=a.getTag()===i.getTag()&&a.getValue()===i.getValue();o+=l?eu(i,e.previous.text):`${i.leading??" "}${eu(a,e.next.text).trimStart()}`}}for(let i of r)o+=` ${eu(i,e.next.text).trimStart()}`;return o}function BT(e,t,n){let r=new Map;for(let o of Gp(t)){let i=e.previous.pointers.get(ss(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(ss(o).start),a=i===void 0?void 0:r.get(i);if(a&&o.getName()!==null)s.set(a,o)}return s}function UT(e,t,n){let{text:r}=e.previous,s=eu(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 tu(t,r);return`${Kp(t,r)}${o.leading??" "}${s}`}return`${Kp(t,r)} ${s}`}function Kp(e,t){let{start:n}=ss(e),[r]=e.entries;if(r)return t.slice(n,ss(r).start-(r.leading??"").length);let s=e.children&&ci(e.children);if(s)return t.slice(n,s.start.offset-1).trimEnd();return tu(e,t)}function zT(e,t,n,r){let s=BT(e,t,n),o=new Set(s.values()),i=n.entries.filter((m)=>!o.has(m)),a=`${Kp(t,e.previous.text)}${WT(e,t,i)}`,l=Gp(n);if(l.length===0&&s.size===0)return a;let c=l[0]?Xp(l[0]):`${r} `,u=t.children,d=t.beforeChildren===""?" ":t.beforeChildren??" ";if(u&&u.nodes.length>0&&GT(u,e.previous.text,t)){let m=`${r}${KT(u,r)}`;return`${a}${d}{${aS(e,u,l,m,c,s)}}`}let p=l.map((m)=>iS(e,m,c,`${r} `));return`${a}${d}{
27
- ${p.join("")}${r}}`}function KT(e,t){let[n]=e.nodes,r=n?Xp(n):"";return r.startsWith(t)?r.slice(t.length):" "}function GT(e,t,n){let{end:r,start:s}=ss(n),[o]=e.nodes;return o!==void 0&&(o.leading??"").includes(`
26
+ `)}function vJ(e,t,n){let r=[...n],s=(i)=>{let a=i.getName(),l=r.findIndex((c)=>c.getName()===a);return l===-1?void 0:r.splice(l,1)[0]},o="";for(let i of t.entries){let a=s(i);if(a){let l=a.getTag()===i.getTag()&&a.getValue()===i.getValue();o+=l?su(i,e.previous.text):`${i.leading??" "}${su(a,e.next.text).trimStart()}`}}for(let i of r)o+=` ${su(i,e.next.text).trimStart()}`;return o}function EJ(e,t,n){let r=new Map;for(let o of am(t)){let i=e.previous.pointers.get(ss(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(ss(o).start),a=i===void 0?void 0:r.get(i);if(a&&o.getName()!==null)s.set(a,o)}return s}function jJ(e,t,n){let{text:r}=e.previous,s=su(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 ou(t,r);return`${im(t,r)}${o.leading??" "}${s}`}return`${im(t,r)} ${s}`}function im(e,t){let{start:n}=ss(e),[r]=e.entries;if(r)return t.slice(n,ss(r).start-(r.leading??"").length);let s=e.children&&hi(e.children);if(s)return t.slice(n,s.start.offset-1).trimEnd();return ou(e,t)}function PJ(e,t,n,r){let s=EJ(e,t,n),o=new Set(s.values()),i=n.entries.filter((m)=>!o.has(m)),a=`${im(t,e.previous.text)}${vJ(e,t,i)}`,l=am(n);if(l.length===0&&s.size===0)return a;let c=l[0]?lm(l[0]):`${r} `,u=t.children,d=t.beforeChildren===""?" ":t.beforeChildren??" ";if(u&&u.nodes.length>0&&_J(u,e.previous.text,t)){let m=`${r}${kJ(u,r)}`;return`${a}${d}{${OS(e,u,l,m,c,s)}}`}let p=l.map((m)=>_S(e,m,c,`${r} `));return`${a}${d}{
27
+ ${p.join("")}${r}}`}function kJ(e,t){let[n]=e.nodes,r=n?lm(n):"";return r.startsWith(t)?r.slice(t.length):" "}function _J(e,t,n){let{end:r,start:s}=ss(n),[o]=e.nodes;return o!==void 0&&(o.leading??"").includes(`
28
28
  `)&&t.slice(s,r).includes(`
29
- `)}function iS(e,t,n,r){return`${r}${HT(tu(t,e.next.text),n,r)}
30
- `}function aS(e,t,n,r,s,o){let i=t.nodes.filter((g)=>!o.has(g)),a=qT(e,i,n),l=t.nodes[0]?.leading??"",c=l.indexOf(`
29
+ `)}function _S(e,t,n,r){return`${r}${wJ(ou(t,e.next.text),n,r)}
30
+ `}function OS(e,t,n,r,s,o){let i=t.nodes.filter((h)=>!o.has(h)),a=SJ(e,i,n),l=t.nodes[0]?.leading??"",c=l.indexOf(`
31
31
  `),u=c===-1?"":l.slice(0,c+1),d=u,p=-1,m=()=>{if(d!==""&&!d.endsWith(`
32
32
  `)&&!d.endsWith(";"))d+=`
33
- `},y=(g,x)=>{let P=t.nodes.indexOf(g),w=P===p+1||P>p;p=Math.max(p,P);let E=g===t.nodes[0]?l.slice(u.length):g.leading??"";if(w&&(E.includes(`
34
- `)||d===u||d.endsWith(";"))){d+=`${E}${x}${g.trailing??""}`;return}if(!d.endsWith(`
33
+ `},g=(h,x)=>{let k=t.nodes.indexOf(h),w=k===p+1||k>p;p=Math.max(p,k);let v=h===t.nodes[0]?l.slice(u.length):h.leading??"";if(w&&(v.includes(`
34
+ `)||d===u||d.endsWith(";"))){d+=`${v}${x}${h.trailing??""}`;return}if(!d.endsWith(`
35
35
  `))d+=`
36
- `;let j=(g.trailing??"").replace(/^;/u,"");d+=`${E.includes(`
37
- `)?E:r}${x}${j}`},S=(g)=>{for(let[x,P]of t.nodes.entries()){let w=o.get(P);if(w&&x<g&&x>p)m(),y(P,UT(e,P,w))}};for(let[g,x]of n.entries()){let P=a.get(g);if(P){S(t.nodes.indexOf(P)),m();let w=zp(e,P,x)?tu(P,e.previous.text):zT(e,P,x,Xp(P));y(P,w)}else m(),d+=iS(e,x,s,r)}return S(t.nodes.length),`${d}${t.trailing??""}`}function nu(e,t,n){let r;try{r=n(e)}catch{return t}let s=n(t),o=xi(s.document);if(xi(r.document)===o)return e;let i={next:rS(s,t),previous:rS(r,e)},a=aS(i,_s(e,{storeLocations:!0}),_s(t,{storeLocations:!0}).nodes,"","",new Map);try{return xi(n(a).document)===o?a:t}catch{return t}}var ru=J(()=>{Gc();ce()});function fS(e){return!/\p{Cs}/u.test(e)}function dS(e,t){try{return _s(`x ${e}`).nodes[0]?.entries[0]?.getValue()===t}catch{return!1}}function ou(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(uS.test(n))t+=`\\u{${n.codePointAt(0)?.toString(16)}}`;else t+=n;return`${t}"`}function pS(e,t){let n="#";while(e.includes(t+n))n+="#";return n}function ZT(e,t){if(XT.test(e))return null;let n=pS(e,'"""'),r=`${t}${qt}`,s=e.split(`
36
+ `;let E=(h.trailing??"").replace(/^;/u,"");d+=`${v.includes(`
37
+ `)?v:r}${x}${E}`},b=(h)=>{for(let[x,k]of t.nodes.entries()){let w=o.get(k);if(w&&x<h&&x>p)m(),g(k,jJ(e,k,w))}};for(let[h,x]of n.entries()){let k=a.get(h);if(k){b(t.nodes.indexOf(k)),m();let w=om(e,k,x)?ou(k,e.previous.text):PJ(e,k,x,lm(k));g(k,w)}else m(),d+=_S(e,x,s,r)}return b(t.nodes.length),`${d}${t.trailing??""}`}function iu(e,t,n){let r;try{r=n(e)}catch{return t}let s=n(t),o=Ei(s.document);if(Ei(r.document)===o)return e;let i={next:jS(s,t),previous:jS(r,e)},a=OS(i,As(e,{storeLocations:!0}),As(t,{storeLocations:!0}).nodes,"","",new Map);try{return Ei(n(a).document)===o?a:t}catch{return t}}var au=M(()=>{Qc();ae()});function TS(e){return!/\p{Cs}/u.test(e)}function NS(e,t){try{return As(`x ${e}`).nodes[0]?.entries[0]?.getValue()===t}catch{return!1}}function cu(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(RS.test(n))t+=`\\u{${n.codePointAt(0)?.toString(16)}}`;else t+=n;return`${t}"`}function JS(e,t){let n="#";while(e.includes(t+n))n+="#";return n}function CJ(e,t){if(OJ.test(e))return null;let n=JS(e,'"""'),r=`${t}${Wt}`,s=e.split(`
39
39
  `).map((i)=>i===""?"":r+i),o=`${n}"""
40
40
  ${s.join(`
41
41
  `)}
42
- ${r}"""${n}`;return dS(o,e)?o:null}function su(e,t,n){if(!fS(e))throw new Ft(`${n} holds a lone surrogate, which Jx Notation has no way to spell`);if(cS.test(e))return e;if(e.includes(`
43
- `)){let r=ZT(e,t);if(r)return r}else if((e.includes("\\")||e.includes('"'))&&!uS.test(e)){let r=pS(e,'"'),s=`${r}"${e}"${r}`;if(dS(s,e))return s}return ou(e)}function Mt(e,t){if(!fS(e))throw new Ft(`${t} is a key with a lone surrogate, which Jx Notation cannot spell`);return cS.test(e)?e:ou(e)}function ft(e,t,n){if(e===null)return"#null";if(e===!0)return"#true";if(e===!1)return"#false";if(Ie(e))return Object.is(e,-0)?"-0":String(e);if(k(e))return su(e,t,n);return Ua(e)?`(ref)${ou(e.$ref)}`:null}function mS(e){if(!Ht(e)||e.$prototype!=="Function")return!1;let{$prototype:t,body:n,parameters:r,...s}=e,o=Object.values(s).every((c)=>ft(c,"","")!==null),i=r===void 0||Array.isArray(r)&&r.length>0&&r.every((c)=>k(c))&&n!==void 0,a=n===void 0||k(n)||Array.isArray(n),l=Array.isArray(n)&&n.length===0;return o&&i&&a&&!l}function hS(e,t,n,r){let{$prototype:s,body:o,parameters:i,...a}=t,l=[`${n}(fn)${Mt(e,r)}`];for(let[c,u]of Object.entries(a))l.push(`${Mt(c,r)}=${ft(u,n,et(r,c))}`);if(Array.isArray(i))for(let c of i)l.push(su(String(c),n,et(r,"parameters")));if(k(o))l.push(su(o,n,et(r,"body")));else if(Array.isArray(o))return[`${l.join(" ")} {`,...o.flatMap((c,u)=>On("-",c,n+qt,et(et(r,"body"),u))),`${n}}`];return[l.join(" ")]}function QT(e){if(!Ht(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)=>ft(t,"","")!==null)}function eJ(e,t,n,r){let{$export:s,$prototype:o,$src:i,...a}=t,l=[`${n}(export)${Mt(e,r)}`];if(s!==e)l.push(`$export=${ft(s,n,et(r,"$export"))}`);for(let[c,u]of Object.entries(a))l.push(`${Mt(c,r)}=${ft(u,n,et(r,c))}`);return[l.join(" ")]}function nJ(e,t){if(!Ht(t)||t.timing!=="server"||t.$src!=="#server"||t.$export!==e||!Object.keys(t).every((s)=>tJ.has(s)))return!1;let{arguments:n}=t;if(n===void 0)return!0;let r=Ht(n)?Object.values(n):[];return r.length>0&&r.every((s)=>ft(s,"","")!==null)}function rJ(e,t,n,r){let s=[`${n}(server)${Mt(e,r)}`],o=et(r,"arguments"),i=Ht(t.arguments)?t.arguments:{};for(let[a,l]of Object.entries(i))s.push(`${Mt(a,o)}=${ft(l,n,et(o,a))}`);return[s.join(" ")]}function On(e,t,n,r){let s=Mt(e,r),o=n+s,i=ft(t,n,r);if(i!==null)return[`${o} ${i}`];if(QT(t))return eJ(e,t,n,r);if(nJ(e,t))return rJ(e,t,n,r);if(mS(t))return hS(e,t,n,r);if(Array.isArray(t)){if(t.length===0)return[`${n}(array)${s}`];let u=t.map((p,m)=>ft(p,n,et(r,m)));if(t.length>1&&u.every((p)=>p!==null&&!p.includes(`
44
- `))){let p=`${o} ${u.join(" ")}`;if(p.length<=Yp)return[p]}return[`${o} {`,...t.flatMap((p,m)=>On("-",p,n+qt,et(r,m))),`${n}}`]}let a=Ht(t)?Object.entries(t):[];if(a.length===0)return[`${o} {}`];let l=a.every(([u])=>u==="-")?`${n}(object)${s}`:o,c=a.map(([u,d])=>{let p=ft(d,n,et(r,u));return p===null||p.includes(`
45
- `)?null:`${Mt(u,r)}=${p}`});if(c.every((u)=>u!==null)){let u=`${l} ${c.join(" ")}`;if(u.length<=Yp)return[u]}return[`${l} {`,...a.flatMap(([u,d])=>On(u,d,n+qt,et(r,u))),`${n}}`]}function gS(e,t,n,r){let s=Object.entries(t),o=n+Mt(e,r);if(s.length===0)return[`${o} {}`];let i=[],a=0;for(let[p,m]of s){let y=ft(m,n,et(r,p));if(y===null||y.includes(`
46
- `))break;i.push(`${Mt(p,r)}=${y}`),a+=1}let l=`${o} ${i.join(" ")}`,c=i.length>0&&l.length<=Yp,u=c?a:0,d=s.slice(u).flatMap(([p,m])=>{if(Ht(m)&&!Ua(m))return gS(p,m,n+qt,et(r,p));return On(p,m,n+qt,et(r,p))});if(c&&d.length===0)return[l];return[`${c?l:o} {`,...d,`${n}}`]}function sJ(e){if(!Ht(e)||e.$prototype!=="Array"||!Ht(e.map))return!1;let{$prototype:t,map:n,...r}=e;return Object.values(r).every((s)=>{let o=ft(s,"","");return o!==null&&!o.includes(`
47
- `)})}function oJ(e,t,n){let{$prototype:r,map:s,...o}=e,i=[`${t}$array`];for(let[a,l]of Object.entries(o))i.push(`${Mt(a,n)}=${ft(l,t,et(n,a))}`);return[`${i.join(" ")} {`,...Ba(s??null,t+qt,et(n,"map")),`${t}}`]}function Ba(e,t,n){let r=ft(e,t,n);if(r!==null)return[`${t}- ${r}`];if(sJ(e))return oJ(e,t,n);if(Ht(e))return Zp(e,t,n);throw new Ft(`${n} is a list inside a list of children, which has no spelling`)}function iJ(e,t,n){let{tagName:r}=e;if(!k(r))return`${t}$element`;if(YT.has(r)||r.startsWith("$")||r.startsWith("."))return`${t}$element ${ou(r)}`;return t+Mt(r,n)}function aJ(e,t){return t!==null&&!t.includes(`
48
- `)&&!e.startsWith("on")&&!e.startsWith("$")&&!e.startsWith(".")}function lJ(e,t){let n=Ht(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}${su(o,t,`/$script/${s}`)}`)}return r.length>0?r:null}function Zp(e,t,n,r=[]){let s=[iJ(e,t,n)],o=t+qt,i=[...r],a={},l=null;for(let[c,u]of Object.entries(e)){let d=et(n,c);if(c==="tagName"&&k(u))continue;if(c==="children")continue;if(c==="textContent"){let p=ft(u,t,d);if(p===null||!k(e.tagName))lS(s,i,c,u,o,t,d);else l=p}else if(c==="attributes"&&Ht(u))for(let[p,m]of Object.entries(u)){let y=ft(m,t,et(d,p));if(aJ(p,y))s.push(`${Mt(p,d)}=${y}`);else a[p]=m}else if(c==="state")i.push(...On("state",u,o,d));else if(c==="style"&&Ht(u))i.push(...gS("style",u,o,d));else if(c.startsWith("on")&&Ua(u))s.push(`${Mt(c,d)}=${ft(u,t,d)}`);else if(c.startsWith("on"))i.push(...mS(u)?hS(c,u,o,d):On(c,u,o,d).map((p,m)=>m===0?p.replace(o,`${o}(on)`):p));else if(c.startsWith("$")){let p=ft(u,t,d);if(p===null||p.includes(`
49
- `))i.push(...On(c,u,o,d));else s.push(`${Mt(c,d)}=${p}`)}else lS(s,i,c,u,o,t,d)}if(Object.keys(a).length>0)i.push(...On("attributes",a,o,et(n,"attributes")));if(i.push(...cJ(e.children,o,et(n,"children"))),l!==null)s.push(l);return i.length===0?[s.join(" ")]:[`${s.join(" ")} {`,...i,`${t}}`]}function cJ(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)=>Ba(s,t,et(n,o)))}let r=ft(e,t,n);if(r!==null)return[`${t}.children ${r}`];return[`${t}.children {`,...Ba(e,t+qt,n),`${t}}`]}function lS(e,t,n,r,s,o,i){let a=Mt(`.${n}`,i);if(n==="map"&&Ht(r)){t.push(`${s}${a} {`,...Ba(r,s+qt,i),`${s}}`);return}if(n==="cases"&&Ht(r)){t.push(`${s}${a} {`);for(let[c,u]of Object.entries(r))t.push(`${s}${qt}${Mt(c,i)} {`,...Ba(u,s+qt+qt,et(i,c)),`${s}${qt}}`);t.push(`${s}}`);return}let l=ft(r,o,i);if(l===null||l.includes(`
50
- `))t.push(...On(`.${n}`,r,s,i));else e.push(`${a}=${l}`)}function yS(e,t){return["$head {",...e.flatMap((n,r)=>Ht(n)&&!Ua(n)&&k(n.tagName)&&!n.$ref?Zp(n,t,`/$head/${r}`):On("-",n,t,`/$head/${r}`)),"}"]}function uJ(e){let{document:t,spans:n}=Wp(e);return{document:L(t)?t:null,spans:n}}function Qp(e,t){let n=fJ(e);return t===void 0?n:nu(t,n,uJ)}function fJ(e){if(!L(e))throw new Ft("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 l=i==="$script"&&s?lJ(a,qt):null;if(l)o=l;else if(i==="$head"&&Array.isArray(a))n.push(...yS(a,qt));else if(i==="$head")n.push(`(object)${On(i,a,"","/$head").join(`
51
- `)}`);else if(i.startsWith("$"))n.push(...On(i,a,"",et("",i)));else r[i]=a}if(Object.keys(r).length>0)n.push("",...Zp(r,"","",o));return`${n.join(`
42
+ ${r}"""${n}`;return NS(o,e)?o:null}function lu(e,t,n){if(!TS(e))throw new qt(`${n} holds a lone surrogate, which Jx Notation has no way to spell`);if(CS.test(e))return e;if(e.includes(`
43
+ `)){let r=CJ(e,t);if(r)return r}else if((e.includes("\\")||e.includes('"'))&&!RS.test(e)){let r=JS(e,'"'),s=`${r}"${e}"${r}`;if(NS(s,e))return s}return cu(e)}function It(e,t){if(!TS(e))throw new qt(`${t} is a key with a lone surrogate, which Jx Notation cannot spell`);return CS.test(e)?e:cu(e)}function pt(e,t,n){if(e===null)return"#null";if(e===!0)return"#true";if(e===!1)return"#false";if(De(e))return Object.is(e,-0)?"-0":String(e);if(_(e))return lu(e,t,n);return Xa(e)?`(ref)${cu(e.$ref)}`:null}function MS(e){if(!Bt(e)||e.$prototype!=="Function")return!1;let{$prototype:t,body:n,parameters:r,...s}=e,o=Object.values(s).every((c)=>pt(c,"","")!==null),i=r===void 0||Array.isArray(r)&&r.length>0&&r.every((c)=>_(c))&&n!==void 0,a=n===void 0||_(n)||Array.isArray(n),l=Array.isArray(n)&&n.length===0;return o&&i&&a&&!l}function IS(e,t,n,r){let{$prototype:s,body:o,parameters:i,...a}=t,l=[`${n}(fn)${It(e,r)}`];for(let[c,u]of Object.entries(a))l.push(`${It(c,r)}=${pt(u,n,nt(r,c))}`);if(Array.isArray(i))for(let c of i)l.push(lu(String(c),n,nt(r,"parameters")));if(_(o))l.push(lu(o,n,nt(r,"body")));else if(Array.isArray(o))return[`${l.join(" ")} {`,...o.flatMap((c,u)=>Tn("-",c,n+Wt,nt(nt(r,"body"),u))),`${n}}`];return[l.join(" ")]}function RJ(e){if(!Bt(e)||e.$prototype!=="Function"||e.$src!=="#client"||!_(e.$export)||Object.hasOwn(e,"body")||Object.hasOwn(e,"parameters"))return!1;return Object.values(e).every((t)=>pt(t,"","")!==null)}function TJ(e,t,n,r){let{$export:s,$prototype:o,$src:i,...a}=t,l=[`${n}(export)${It(e,r)}`];if(s!==e)l.push(`$export=${pt(s,n,nt(r,"$export"))}`);for(let[c,u]of Object.entries(a))l.push(`${It(c,r)}=${pt(u,n,nt(r,c))}`);return[l.join(" ")]}function JJ(e,t){if(!Bt(t)||t.timing!=="server"||t.$src!=="#server"||t.$export!==e||!Object.keys(t).every((s)=>NJ.has(s)))return!1;let{arguments:n}=t;if(n===void 0)return!0;let r=Bt(n)?Object.values(n):[];return r.length>0&&r.every((s)=>pt(s,"","")!==null)}function MJ(e,t,n,r){let s=[`${n}(server)${It(e,r)}`],o=nt(r,"arguments"),i=Bt(t.arguments)?t.arguments:{};for(let[a,l]of Object.entries(i))s.push(`${It(a,o)}=${pt(l,n,nt(o,a))}`);return[s.join(" ")]}function Tn(e,t,n,r){let s=It(e,r),o=n+s,i=pt(t,n,r);if(i!==null)return[`${o} ${i}`];if(RJ(t))return TJ(e,t,n,r);if(JJ(e,t))return MJ(e,t,n,r);if(MS(t))return IS(e,t,n,r);if(Array.isArray(t)){if(t.length===0)return[`${n}(array)${s}`];let u=t.map((p,m)=>pt(p,n,nt(r,m)));if(t.length>1&&u.every((p)=>p!==null&&!p.includes(`
44
+ `))){let p=`${o} ${u.join(" ")}`;if(p.length<=cm)return[p]}return[`${o} {`,...t.flatMap((p,m)=>Tn("-",p,n+Wt,nt(r,m))),`${n}}`]}let a=Bt(t)?Object.entries(t):[];if(a.length===0)return[`${o} {}`];let l=a.every(([u])=>u==="-")?`${n}(object)${s}`:o,c=a.map(([u,d])=>{let p=pt(d,n,nt(r,u));return p===null||p.includes(`
45
+ `)?null:`${It(u,r)}=${p}`});if(c.every((u)=>u!==null)){let u=`${l} ${c.join(" ")}`;if(u.length<=cm)return[u]}return[`${l} {`,...a.flatMap(([u,d])=>Tn(u,d,n+Wt,nt(r,u))),`${n}}`]}function DS(e,t,n,r){let s=Object.entries(t),o=n+It(e,r);if(s.length===0)return[`${o} {}`];let i=[],a=0;for(let[p,m]of s){let g=pt(m,n,nt(r,p));if(g===null||g.includes(`
46
+ `))break;i.push(`${It(p,r)}=${g}`),a+=1}let l=`${o} ${i.join(" ")}`,c=i.length>0&&l.length<=cm,u=c?a:0,d=s.slice(u).flatMap(([p,m])=>{if(Bt(m)&&!Xa(m))return DS(p,m,n+Wt,nt(r,p));return Tn(p,m,n+Wt,nt(r,p))});if(c&&d.length===0)return[l];return[`${c?l:o} {`,...d,`${n}}`]}function IJ(e){if(!Bt(e)||e.$prototype!=="Array"||!Bt(e.map))return!1;let{$prototype:t,map:n,...r}=e;return Object.values(r).every((s)=>{let o=pt(s,"","");return o!==null&&!o.includes(`
47
+ `)})}function DJ(e,t,n){let{$prototype:r,map:s,...o}=e,i=[`${t}$array`];for(let[a,l]of Object.entries(o))i.push(`${It(a,n)}=${pt(l,t,nt(n,a))}`);return[`${i.join(" ")} {`,...Ga(s??null,t+Wt,nt(n,"map")),`${t}}`]}function Ga(e,t,n){let r=pt(e,t,n);if(r!==null)return[`${t}- ${r}`];if(IJ(e))return DJ(e,t,n);if(Bt(e))return um(e,t,n);throw new qt(`${n} is a list inside a list of children, which has no spelling`)}function LJ(e,t,n){let{tagName:r}=e;if(!_(r))return`${t}$element`;if(AJ.has(r)||r.startsWith("$")||r.startsWith("."))return`${t}$element ${cu(r)}`;return t+It(r,n)}function FJ(e,t){return t!==null&&!t.includes(`
48
+ `)&&!e.startsWith("on")&&!e.startsWith("$")&&!e.startsWith(".")}function VJ(e,t){let n=Bt(e)?Object.entries(e):[],r=[];for(let[s,o]of n){if(s!=="client"&&s!=="server"||!_(o))return null;let i=s==="server"?"timing=server ":"";r.push(`${t}script ${i}${lu(o,t,`/$script/${s}`)}`)}return r.length>0?r:null}function um(e,t,n,r=[]){let s=[LJ(e,t,n)],o=t+Wt,i=[...r],a={},l=null;for(let[c,u]of Object.entries(e)){let d=nt(n,c);if(c==="tagName"&&_(u))continue;if(c==="children")continue;if(c==="textContent"){let p=pt(u,t,d);if(p===null||!_(e.tagName))AS(s,i,c,u,o,t,d);else l=p}else if(c==="attributes"&&Bt(u))for(let[p,m]of Object.entries(u)){let g=pt(m,t,nt(d,p));if(FJ(p,g))s.push(`${It(p,d)}=${g}`);else a[p]=m}else if(c==="state")i.push(...Tn("state",u,o,d));else if(c==="style"&&Bt(u))i.push(...DS("style",u,o,d));else if(c.startsWith("on")&&Xa(u))s.push(`${It(c,d)}=${pt(u,t,d)}`);else if(c.startsWith("on"))i.push(...MS(u)?IS(c,u,o,d):Tn(c,u,o,d).map((p,m)=>m===0?p.replace(o,`${o}(on)`):p));else if(c.startsWith("$")){let p=pt(u,t,d);if(p===null||p.includes(`
49
+ `))i.push(...Tn(c,u,o,d));else s.push(`${It(c,d)}=${p}`)}else AS(s,i,c,u,o,t,d)}if(Object.keys(a).length>0)i.push(...Tn("attributes",a,o,nt(n,"attributes")));if(i.push(...qJ(e.children,o,nt(n,"children"))),l!==null)s.push(l);return i.length===0?[s.join(" ")]:[`${s.join(" ")} {`,...i,`${t}}`]}function qJ(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)=>Ga(s,t,nt(n,o)))}let r=pt(e,t,n);if(r!==null)return[`${t}.children ${r}`];return[`${t}.children {`,...Ga(e,t+Wt,n),`${t}}`]}function AS(e,t,n,r,s,o,i){let a=It(`.${n}`,i);if(n==="map"&&Bt(r)){t.push(`${s}${a} {`,...Ga(r,s+Wt,i),`${s}}`);return}if(n==="cases"&&Bt(r)){t.push(`${s}${a} {`);for(let[c,u]of Object.entries(r))t.push(`${s}${Wt}${It(c,i)} {`,...Ga(u,s+Wt+Wt,nt(i,c)),`${s}${Wt}}`);t.push(`${s}}`);return}let l=pt(r,o,i);if(l===null||l.includes(`
50
+ `))t.push(...Tn(`.${n}`,r,s,i));else e.push(`${a}=${l}`)}function LS(e,t){return["$head {",...e.flatMap((n,r)=>Bt(n)&&!Xa(n)&&_(n.tagName)&&!n.$ref?um(n,t,`/$head/${r}`):Tn("-",n,t,`/$head/${r}`)),"}"]}function HJ(e){let{document:t,spans:n}=nm(e);return{document:L(t)?t:null,spans:n}}function fm(e,t){let n=WJ(e);return t===void 0?n:iu(t,n,HJ)}function WJ(e){if(!L(e))throw new qt("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 l=i==="$script"&&s?VJ(a,Wt):null;if(l)o=l;else if(i==="$head"&&Array.isArray(a))n.push(...LS(a,Wt));else if(i==="$head")n.push(`(object)${Tn(i,a,"","/$head").join(`
51
+ `)}`);else if(i.startsWith("$"))n.push(...Tn(i,a,"",nt("",i)));else r[i]=a}if(Object.keys(r).length>0)n.push("",...um(r,"","",o));return`${n.join(`
52
52
  `)}
53
- `}var qt=" ",Yp=100,cS,uS,XT,YT,Ht=(e)=>L(e),Ua=(e)=>Ht(e)&&k(e.$ref)&&Object.keys(e).length===1,et=(e,t)=>`${e}/${String(t).replaceAll("~","~0").replaceAll("/","~1")}`,tJ;var iu=J(()=>{Gc();ce();gi();Wa();ru();cS=/^(?![-+]?\.?\d)(?!(?:true|false|null|inf|-inf|nan)$)[^\s\\/(){};[\]"#=,\p{Cc}\p{Cf}\p{Zl}\p{Zp}]+$/u,uS=/[\p{Cc}\p{Zl}\p{Zp}‎‏‪-‮⁦-⁩]/u,XT=/(?!\n)\p{Cc}|[\p{Zl}\p{Zp}‎‏‪-‮⁦-⁩]/u,YT=new Set(["-","attributes","script","state","style"]);tJ=new Set(["$export","$src","arguments","timing"])});function mJ(e,t,n){if(yi(e,t)!==null)throw ke(e,t,`"project" names the file's kind, and takes no annotation`);let r=Ln(e,t);if(r.length>1||Fn(t).length>0||Vt(t).length>0)throw ke(e,t,`"project" holds one value, the project's name, and nothing else`);if(r[0]!==void 0)je(n,"name",r[0],e,t),wt(e,"/name",t)}function hJ(e,t,n){let r=t.getName(),s=`/${nt(r)}`,o=t.getTag()===null,i;if(r==="$head"&&o)i=qp(e,t),wt(e,s,t);else if(pJ.has(r)&&o)i=Zc(e,t,s);else i=Dn(e,t,s);je(n,r,i,e,t)}function gJ(e){if(ni(e.text)==="document")throw new Ft('A project file declares itself: its first node, after any $ metadata, is project "<name>"');let t=Hp(e.text),n={},r=!1;for(let s of t.nodes)if(s.getName()===dJ){if(r)throw ke(e,s,'"project" is written twice, and a file declares one project');mJ(e,s,n),r=!0}else hJ(e,s,n);return ei(n)}function em(e,t){try{return gJ({spans:null,text:e})}catch(n){throw t!==void 0&&n instanceof Ft?n.inFile(t):n}}var dJ="project",pJ;var tm=J(()=>{ce();Lt();Ta();gi();Wa();ru();iu();pJ=new Set(["$media","style"])});var os=J(()=>{Ta();Qc();gi();nS();Wa();ru();iu();tm()});function SS(e){if(e===null)throw TypeError("A class descriptor cannot be null");return L(e)?e:{}}class za{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=p$(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=bJ(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 au{#t;get#e(){return[...this.#t,vJ]}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=d$(t.mediaType);if(n!==null)throw Error(`Format "${t.name}" declares an invalid mediaType: ${n}`)}for(let t of bS){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=xS(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=xS(e);return this.#e.some((n)=>n.extensions.includes(t))}}function bJ(e){let t={},n=e.$defs?.methods??{};for(let[r,s]of Object.entries(n)){let{role:o}=s;if(!SJ(o))continue;let i={identifier:s.identifier??r,timing:s.timing??xJ};if(k(s.discriminator))i.discriminator=s.discriminator;t[o]=i}return t}function SJ(e){return e!==void 0&&$J.has(e)}function xS(e){let t=e.toLowerCase();return t.startsWith(".")?t:`.${t}`}var bS,$S,xJ,$J,wJ,vJ;var nm=J(()=>{ce();bp();bS=["parse","serialize","rewrite","discover","load"],$S=[...bS,"projectData","resolvePaths","lower","emit","head","assets","mount","dialect","deploySchema","bindings","testConnection"];xJ=["compiler","server"];$J=new Set($S);wJ={importModule:async()=>{await Promise.resolve().then(() => os());return{JxNotation:{parse:(n)=>vo(n),serialize:(n)=>Qp(n)}}},loadJson:()=>Promise.reject(Error("Jx Notation reads no file of its own")),resolvePath:(e,t)=>t},vJ=new za("jxn","",{$defs:{methods:{parse:{role:"parse"},serialize:{role:"serialize"}}},$implementation:"jxn",format:{documentKinds:["page","component"],extensions:[".jxn"]},title:"JxNotation"},wJ)});class wS{#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 au(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 vS(e,t,n){let r=[];for(let s of e??[])r.push(await EJ(s,t,n));return new wS(r)}async function EJ(e,t,n){let r;if(e.startsWith("./")||e.startsWith("../")){let l=t.resolvePath(n,e);r=t.resolvePath(`${l}/package.json`,`./${Ka}`)}else try{r=t.resolvePath(n,`${e}/${Ka}`)}catch(l){throw Error(`Extension "${e}" is not resolvable: it must export ${Ka} (is the package installed, and does its exports map include it?): ${rm(l)}`,{cause:l})}let s;try{s=await t.loadJson(r)}catch(l){throw Error(`Extension "${e}": cannot read manifest ${r}: ${rm(l)}`,{cause:l})}if(!L(s)||!k(s.name))throw Error(`Extension "${e}": ${Ka} 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[l,c]of Object.entries(o.classes??{})){let u=t.resolvePath(r,c),d;try{d=await t.loadJson(u)}catch(p){throw Error(`Extension "${e}": cannot read class "${l}" at ${u}: ${rm(p)}`,{cause:p})}i.push(new za(l,u,SS(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 rm(e){return e instanceof Error?e.message:String(e)}var Ka="jx-extension.json";var ES=J(()=>{nm();ce();nm()});var jS=J(()=>{ce()});function PJ(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 _S(e){let t=jJ.filter((n)=>e(n));if(t.length>1)return"conflict";return t[0]??null}function lu(e,t){return rs(t)?em(e,t):Zb(e,t)}var jJ,PS="project.jxn",sm;var cu=J(()=>{ce();jS();Ta();Qc();tm();Lt();jJ=["project.jxn","project.json"];sm=class sm extends Error{constructor(e){super(PJ(e));this.name="ProjectFileConflictError"}}});import{accessSync as dG,closeSync as pG,constants as mG,existsSync as _J,fstatSync as hG,lstatSync as gG,openSync as yG,readFileSync as xG,statSync as bG}from"node:fs";import{dirname as SG,join as kS}from"node:path";function kJ(e){return _S((t)=>_J(kS(e,t)))}function qn(e){let t=kJ(e);if(t==="conflict")throw new sm(e);return kS(e,t??PS)}var Eo=J(()=>{cu()});import{existsSync as OJ,readFileSync as AJ}from"node:fs";import{dirname as fu,isAbsolute as CJ,resolve as OS,sep as uu}from"node:path";import{pathToFileURL as RJ}from"node:url";import{createRequire as NJ}from"node:module";function AS(e){let t=[e],n=`${uu}src${uu}`,r=`${uu}dist${uu}`;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 CS(e){let t=AS(e),n=fu(e),r=[...t.filter((o)=>fu(o)===n),...t.filter((o)=>fu(o)!==n)],s=r.find((o)=>OJ(o));if(s===void 0)throw Error(`no module at ${e} (tried ${r.join(", ")})`);return s}async function om(e){let t=AS(e),n;for(let r of t)try{return await import(RJ(r).href)}catch(s){n=s}throw n instanceof Error?n:Error(String(n))}function im(e,t){return NJ(OS(e,"package.json")).resolve(t)}function am(e){return{importModule:(t)=>om(t),loadJson:async(t)=>JSON.parse(AJ(t,"utf8")),resolvePath:(t,n)=>{if(n.startsWith("./")||n.startsWith("../"))return OS(fu(t),n);if(CJ(n))return n;return im(e,n)}}}async function Os(e,t){return vS(t?.extensions,am(e),qn(e))}function du(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 is=J(()=>{ES();ce();Eo()});import{existsSync as TJ,readFileSync as JJ}from"node:fs";import{basename as MJ,resolve as IJ}from"node:path";function As(e){let t=qn(e);if(!TJ(t))throw Error(`No project.jxn or project.json in ${e}`);let n;try{n=lu(JJ(t,"utf8"),t)}catch(i){throw Error(`Invalid ${MJ(t)}: ${be(i)}`,{cause:i})}let r={...Ga,...n,build:{...Ga.build,...n.build},defaults:{...Ga.defaults,...n.defaults},images:{...Ga.images,...n.images},url:n.url??Ga.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:IJ(e)}}function RS(e){return["0","false","no","off"].includes((e??"").trim().toLowerCase())}var Ga;var bi=J(()=>{Lt();cu();Eo();Ga={$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 lm,readFileSync as NS,writeFileSync as DJ}from"node:fs";import{resolve as TS}from"node:path";async function JS(e,t={}){let{dryRun:n=!1,connection:r}=t,{config:s}=As(e),o=await Os(e,s),i=L(s.connections)?s.connections:{},a=L(s.data)?s.data:{},l=Object.keys(i).filter((y)=>!r||y===r);if(r&&l.length===0)throw Error(`Unknown connection "${r}" (no such connections entry in project.json)`);if(l.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 c={...process.env,...FJ(e),JX_PROJECT_ROOT:e},u=[],d=[];for(let y of l){let S=i[y],g=L(S)?{...S,$name:y}:{$name:y},x=String(g.provider??""),P=LJ(o.connectors(),x);if(!P)throw Error(`Connection "${y}" names provider "${x}", but no enabled extension provides it (enable the extension in project.json "extensions")`);let w={};for(let[j,A]of Object.entries(a))if(L(A)&&A.connection===y)w[j]=A;let E=await P.call("deploySchema",w,g,{dryRun:n,env:c});if(u.push({applied:E.applied??!n,connection:y,provider:x,statements:E.statements??[],tables:Object.keys(w),warnings:E.warnings??[]}),P.capabilities.bindings){let j=await P.call("bindings",g);if(L(j)&&Object.keys(j).length>0)d.push(j)}}let p=TS(e,"wrangler.jsonc"),m=!1;if(!n&&d.length>0&&lm(p)){let y=NS(p,"utf8"),{content:S,patched:g}=o$(y,d);if(g&&S!==y)DJ(p,S,"utf8"),m=!0}return{bindingsPatched:m,results:u,wranglerPath:lm(p)?p:null}}function LJ(e,t){return e.find((n)=>n.connector?.provider===t)}function FJ(e){let t=TS(e,".dev.vars");if(!lm(t))return{};let n=new Map;for(let r of NS(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 MS=J(()=>{a$();is();bi();ce()});function cm(e,t=[]){if(!L(e))return t;let{children:n}=e;if(e.tagName==="slot"){let r=e.attributes,s=L(r)?r.name:void 0,o={name:k(s)?s.trim():""};if(Array.isArray(n)&&n.length>0)o.fallback=n;t.push(o)}if(Array.isArray(n))for(let r of n)cm(r,t);return t}var IS=J(()=>{ce()});function VJ(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"&&me(o.target))r(o.target.$ref);if(o.$prototype==="Array"){for(let i of[o.filter,o.sort])if(me(i))r(i.$ref)}for(let[i,a]of Object.entries(o)){if(i==="$defs")continue;if(i.startsWith("on")&&me(a))r(a.$ref);s(a)}};s(e);for(let o of um)if(L(e.state)&&o in e.state)t.add(o);return t}function fm(e){return"body"in e&&"$src"in e}function Xa(e){return Pc(e.parameters??e.arguments).length>0}function kr(e){let t=["state"];for(let n of Pc(e.parameters??e.arguments))if(n!=="state")t.push(n);return t}function qJ(e,t,n){if(vr(t))return"callable";if(Pc(t.parameters??t.arguments).length>0)return"callable";if(k(t.body))return Vb(t.body)?"computed":"callable";if(t.$src)return n().has(e)?"callable":"computed";return"callable"}function Or(e){let t=new Map,n=null,r=()=>n??=VJ(e);for(let[s,o]of Object.entries(e.state??{}))if(kt(o))t.set(s,qJ(s,o,r));return t}var um;var $i=J(()=>{ce();um=new Set(["onMount","onUnmount","onAdopted"])});function DS(e){if(e===null||e===void 0)return"null";if(Array.isArray(e))return"array";if(k(e))return"string";if(Ie(e))return"number";return Ge(e)?"boolean":"object"}function HJ(e){if(k(e))return e;if(!L(e))return;if(k(e.text))return e.text;if(k(e.type))return e.type;if(Array.isArray(e.type))return e.type.filter((t)=>k(t)).join(" | ");return k(e.$ref)?e.$ref.slice(e.$ref.lastIndexOf("/")+1):void 0}function Ya(e){let t=HJ(e);return t===void 0||t===""?void 0:{text:t}}function FS(e){if(k(e)&&e!=="")return e;return e===!0?!0:void 0}function WJ(e,t){let n={kind:"field",name:e};if(jc(t)){let r=Ya(t.type)??Ya(k(t.$ref)?{$ref:t.$ref}:void 0);if(n.type=r??{text:DS(t.default)},n.default=JSON.stringify(t.default),k(t.description))n.description=t.description;let s=FS(t.deprecated);if(s!==void 0)n.deprecated=s;return n}if(L(t)){if(Object.keys(t).some((s)=>s.startsWith("$"))||Db(t))return null}else if(le(t))return null;return n.type={text:DS(t)},n.default=JSON.stringify(t),n}function BJ(e){if(k(e))return{name:e};if(!L(e)||!k(e.name))return null;let t={name:e.name},n=Ya(e.type);if(n)t.type=n;if(k(e.description))t.description=e.description;if(Ge(e.optional))t.optional=e.optional;if(e.default!==void 0)t.default=JSON.stringify(e.default);return t}function UJ(e,t){let n={kind:"method",name:e};if(k(t.description))n.description=t.description;let s=(t.parameters??t.arguments??[]).map((i)=>BJ(i)).filter((i)=>i!==null&&i.name!=="state");if(s.length>0)n.parameters=s;let o=Ya(t.type);if(o)n.return={type:o};return n}function LS(e,t){if(!Array.isArray(e))return;for(let n of e){if(!L(n)||!k(n.name)||t.has(n.name))continue;let r={name:n.name,type:Ya(n.type)??{text:"Event"}};if(k(n.description))r.description=n.description;let s=FS(n.deprecated);if(s!==void 0)r.deprecated=s;t.set(n.name,r)}}function zJ(e){let t=new Set,n=(s)=>{if(!L(s))return;let o=L(s.attributes)?s.attributes.part:void 0;if(k(o)){for(let i of o.split(/\s+/u))if(i!=="")t.add(i)}r(s)},r=(s)=>{if(Array.isArray(s.children))for(let o of s.children)n(o)};return r(e),[...t]}function KJ(e){let t=e.doc,n=L(t.state)?t.state:{},r=Or(e.doc),s=[],o=[],i=new Map,a=new Map;LS(t.emits,a);for(let[x,P]of Object.entries(n)){if(Zo(x))continue;if(kt(P)){if(LS(P.emits,a),!um.has(x)&&r.get(x)!=="computed")o.push(UJ(x,P));continue}let w=WJ(x,P);if(w)o.push(w),i.set(x,w)}let l=[],c=new Set,u=Array.isArray(t.observedAttributes)?t.observedAttributes:[];for(let x of new Set(u.filter((P)=>k(P)))){let P={name:x},w=Qo(x),E=i.get(w);if(E){P.fieldName=w;for(let j of["type","default","description","deprecated"])if(E[j]!==void 0)Object.assign(P,{[j]:E[j]});if(!c.has(w)){c.add(w),E.attribute=x;let j=n[w];if(L(j)&&j.reflects===!0)E.reflects=!0}}l.push(P)}for(let[x,P]of Object.entries(n)){if(Zo(x)||!L(P)||!k(P.attribute))continue;if(i.get(x)?.attribute!==P.attribute)s.push(`${e.tagName}: state entry "${x}" declares attribute "${P.attribute}", but the `+"element does not observe it into that entry (spec.md §16.5); add it to "+"observedAttributes or remove it")}let d={customElement:!0,kind:"class",members:o,name:e.className,tagName:e.tagName},p=k(t.description)?t.description:t.$description;if(k(p))d.description=p;if(l.length>0)d.attributes=l;if(a.size>0)d.events=[...a.values()];let m=cm(t).map((x)=>({name:x.name}));if(m.length>0)d.slots=m;let y=L(t.style)?t.style:{},S=Object.entries(y).filter(([x])=>x.startsWith("--")).map(([x,P])=>({default:String(P),name:x}));if(S.length>0)d.cssProperties=S;let g=e.shadow?zJ(e.doc).map((x)=>({name:x})):[];if(g.length>0)d.cssParts=g;return{module:{declarations:[d],exports:[{declaration:{name:e.className},kind:"custom-element-definition",name:e.tagName}],kind:"javascript-module",path:e.modulePath},warnings:s}}function pu(e){let n=e.toSorted((r,s)=>r.tagName<s.tagName?-1:1).map((r)=>KJ(r));return{manifest:{modules:n.map((r)=>r.module),schemaVersion:"2.1.0"},warnings:n.flatMap((r)=>r.warnings)}}function mu(e){return`${JSON.stringify(e,null,2)}
55
- `}var dm=J(()=>{IS();$i();ce()});function jo(e){return e.startsWith(hu)}function gu(e){let t=e;if(jo(t))t=t.slice(hu.length);return t=t.replace(/^\.\//,"").replace(/\.(js|ts|mjs|mts)$/,"").replaceAll("@","").replaceAll(/[/\\]+/g,"-").replaceAll(/[^\w.-]/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,""),`${pm}${t}.js`}function VS(e){let t=/\.(\w+)$/.exec(e)?.[1]??"",n=e.replace(/\.\w+$/,"").replaceAll("@","").replaceAll(/[/\\]+/g,"-").replaceAll(/[^\w.-]/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,"");return t===""?`${pm}${n}`:`${pm}${n}.${t}`}function qS(e){let t=e.replaceAll("\\","/");return t.length>1&&t.endsWith("/")?t.slice(0,-1):t}function yu(e){let t=qS(e);return t.startsWith("/")?t:`/${t}`}function GJ(e,t){return[...e].toSorted((n,r)=>r[t].length-n[t].length)}function xu(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 GJ(e,"urlPrefix")){let o=yu(s.urlPrefix);if(!r.startsWith(`${o}/`))continue;let a=r.slice(o.length+1).split("/");if(a.some((c)=>c===""||c==="."||c===".."))return null;let{filter:l}=s;if(l&&!l(a.join("/")))return null;return`${qS(s.dir)}/${a.join("/")}`}return null}function HS(e,t){let n=new Set;for(let r of t){let s=yu(r.urlPrefix),o=new RegExp(`${s.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}/[^${XJ}]+`,"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 mm(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 hm(e){return e.map(({url:t,descriptor:n})=>n?`${t} ${n}`:t).join(", ")}function Po(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 Fe(e,t){if(e===""||!t.startsWith("/")||t.startsWith("//"))return t;if(t===e||t.startsWith(`${e}/`))return t;return e+t}function Cs(e,t){let n=new URL(t);if(!n.pathname.endsWith("/"))n.pathname+="/";return new URL(e.replace(/^\/+/,""),n).href}var hu="npm:",pm="/assets/",XJ;var An=J(()=>{ce();XJ=String.raw`"'\s<>()\\`});function Qa(e,t){return e.replaceAll(QJ,(n,r,s)=>{let o=s.trim(),i=sM.exec(o),a=i?i[2]:o,l=Fe(t,a);if(l===a)return n;return`url(${r}${i?`${i[1]}${l}${i[1]}`:l}${r})`})}function gm(e,t,n,r,s){let o=n.toLowerCase();if(WS.has(o))return Fe(s,r);if(BS.has(o)){let i=mm(r);return i.length===0?r:hm(i.map((a)=>({descriptor:a.descriptor,url:Fe(s,a.url)})))}if(o==="style")return Qa(r,s);if(o==="content"&&e==="meta"&&rM.test(t))return Fe(s,r);return r}function ym(e,t){if(t==="")return e;let n=e.replaceAll(tM,(r,s,o,i)=>{let a=o.replaceAll(eM,(l,c)=>`"${Fe(t,c)}"`);return s+a+i});return n=n.replaceAll(nM,(r,s,o,i)=>s+Qa(o,t)+i),n.replaceAll(YJ,(r,s,o)=>{if(o==="")return r;let i=s.toLowerCase(),a=o.replaceAll(ZJ,(l,c,u,d,p)=>{let m=d===void 0?"'":'"',y=d??p??"",S=gm(i,o,c,y,t);return S===y?l:`${c}=${m}${S}${m}`});return a===o?r:`<${s}${a}>`})}function oM(e,t){let n=k(e.tagName)?e.tagName.toLowerCase():"",{attributes:r}=e;if(D(r)){for(let[s,o]of Object.entries(r))if(k(o))r[s]=gm(n,"",s,o,t)}for(let s of Object.keys(e)){let o=s.toLowerCase(),i=e[s];if(k(i)&&(WS.has(o)||BS.has(o)))e[s]=gm(n,"",o,i,t)}if(k(e.innerHTML))e.innerHTML=ym(e.innerHTML,t)}function Za(e,t){if(!D(e)||Array.isArray(e))return;if(Le(e)){Za(e.map,t);return}let n=e;oM(n,t);let{cases:r,children:s}=n;if(Array.isArray(s))for(let o of s)Za(o,t);else Za(s,t);if(D(r))for(let o of Object.values(r))Za(o,t)}function US(e,t){if(t!=="")Za(e,t)}var WS,BS,YJ,ZJ,QJ,eM,tM,nM,rM,sM;var zS=J(()=>{An();ce();WS=new Set(["href","src","poster","action","formaction","data"]),BS=new Set(["srcset","imagesrcset"]),YJ=/<([a-zA-Z][a-zA-Z0-9-]*)((?:"[^"]*"|'[^']*'|[^>"'])*)>/g,ZJ=/([a-zA-Z_:][\w:.-]*)\s*=\s*("([^"]*)"|'([^']*)')/g,QJ=/url\(\s*(['"]?)([^'")]+)\1\s*\)/g,eM=/"(\/[^"/][^"]*)"/g,tM=/(<script\b[^>]*\btype\s*=\s*["']importmap["'][^>]*>)([\s\S]*?)(<\/script>)/gi,nM=/(<style\b[^>]*>)([\s\S]*?)(<\/style>)/gi,rM=/\b(?:property|name)\s*=\s*["'](?:og:|twitter:)[\w:.-]*(?:image|url|video|audio|player)[\w:.-]*["']/i,sM=/^(&quot;|&#34;|&apos;|&#39;)([\s\S]*)\1$/});var ol=W(function(sX,xw){var __dirname="/home/runner/work/jx/jx/node_modules/esbuild/lib",__filename="/home/runner/work/jx/jx/node_modules/esbuild/lib/main.js",{defineProperty:wm,getOwnPropertyDescriptor:iM,getOwnPropertyNames:aM}=Object,lM=Object.prototype.hasOwnProperty,cM=(e,t)=>{for(var n in t)wm(e,n,{get:t[n],enumerable:!0})},uM=(e,t,n,r)=>{if(t&&typeof t==="object"||typeof t==="function"){for(let s of aM(t))if(!lM.call(e,s)&&s!==n)wm(e,s,{get:()=>t[s],enumerable:!(r=iM(t,s))||r.enumerable})}return e},fM=(e)=>uM(wm({},"__esModule",{value:!0}),e),rl={};cM(rl,{analyzeMetafile:()=>qM,analyzeMetafileSync:()=>UM,build:()=>DM,buildSync:()=>HM,context:()=>LM,default:()=>XM,formatMessages:()=>VM,formatMessagesSync:()=>BM,initialize:()=>KM,stop:()=>zM,transform:()=>FM,transformSync:()=>WM,version:()=>IM});xw.exports=fM(rl);function KS(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(lr(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(lr(o)),t(r[o])}},n=new sw;return n.write32(0),n.write32(e.id<<1|+!e.isRequest),t(e.value),bm(n.buf,n.len-4,0),n.buf.subarray(0,n.len)}function dM(e){let t=()=>{switch(n.read8()){case 0:return null;case 1:return!!n.read8();case 2:return n.read32();case 3:return Co(n.read());case 4:return n.read();case 5:{let i=n.read32(),a=[];for(let l=0;l<i;l++)a.push(t());return a}case 6:{let i=n.read32(),a={};for(let l=0;l<i;l++)a[Co(n.read())]=t();return a}default:throw Error("Invalid packet")}},n=new sw(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 sw=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);bm(this.buf,e,t)}write(e){let t=this._write(4+e.length);bm(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 ow(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}},lr,Co,xm;if(typeof TextEncoder<"u"&&typeof TextDecoder<"u"){let e=new TextEncoder,t=new TextDecoder;lr=(n)=>e.encode(n),Co=(n)=>t.decode(n),xm='new TextEncoder().encode("")'}else if(typeof Buffer<"u")lr=(e)=>Buffer.from(e),Co=(e)=>{let{buffer:t,byteOffset:n,byteLength:r}=e;return Buffer.from(t,n,r).toString()},xm='Buffer.from("")';else throw Error("No UTF-8 codec found");if(!(lr("")instanceof Uint8Array))throw Error(`Invariant violation: "${xm} instanceof Uint8Array" is incorrectly false
53
+ `}var Wt=" ",cm=100,CS,RS,OJ,AJ,Bt=(e)=>L(e),Xa=(e)=>Bt(e)&&_(e.$ref)&&Object.keys(e).length===1,nt=(e,t)=>`${e}/${String(t).replaceAll("~","~0").replaceAll("/","~1")}`,NJ;var uu=M(()=>{Qc();ae();wi();Ka();au();CS=/^(?![-+]?\.?\d)(?!(?:true|false|null|inf|-inf|nan)$)[^\s\\/(){};[\]"#=,\p{Cc}\p{Cf}\p{Zl}\p{Zp}]+$/u,RS=/[\p{Cc}\p{Zl}\p{Zp}‎‏‪-‮⁦-⁩]/u,OJ=/(?!\n)\p{Cc}|[\p{Zl}\p{Zp}‎‏‪-‮⁦-⁩]/u,AJ=new Set(["-","attributes","script","state","style"]);NJ=new Set(["$export","$src","arguments","timing"])});function zJ(e,t,n){if(vi(e,t)!==null)throw Ae(e,t,`"project" names the file's kind, and takes no annotation`);let r=Hn(e,t);if(r.length>1||Wn(t).length>0||Ht(t).length>0)throw Ae(e,t,`"project" holds one value, the project's name, and nothing else`);if(r[0]!==void 0)je(n,"name",r[0],e,t),Et(e,"/name",t)}function KJ(e,t,n){let r=t.getName(),s=`/${it(r)}`,o=t.getTag()===null,i;if(r==="$head"&&o)i=em(e,t),Et(e,s,t);else if(UJ.has(r)&&o)i=nu(e,t,s);else i=qn(e,t,s);je(n,r,i,e,t)}function GJ(e){if(li(e.text)==="document")throw new qt('A project file declares itself: its first node, after any $ metadata, is project "<name>"');let t=tm(e.text),n={},r=!1;for(let s of t.nodes)if(s.getName()===BJ){if(r)throw Ae(e,s,'"project" is written twice, and a file declares one project');zJ(e,s,n),r=!0}else KJ(e,s,n);return ii(n)}function dm(e,t){try{return GJ({spans:null,text:e})}catch(n){throw t!==void 0&&n instanceof qt?n.inFile(t):n}}var BJ="project",UJ;var pm=M(()=>{ae();Ft();Da();wi();Ka();au();uu();UJ=new Set(["$media","style"])});var os=M(()=>{Da();ru();wi();ES();Ka();au();uu();pm()});function HS(e){if(e===null)throw TypeError("A class descriptor cannot be null");return L(e)?e:{}}class Ya{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=J$(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=ZJ(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(!Ot(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 fu{#t;get#e(){return[...this.#t,nM]}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=N$(t.mediaType);if(n!==null)throw Error(`Format "${t.name}" declares an invalid mediaType: ${n}`)}for(let t of VS){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=FS(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=FS(e);return this.#e.some((n)=>n.extensions.includes(t))}}function ZJ(e){let t={},n=e.$defs?.methods??{};for(let[r,s]of Object.entries(n)){let{role:o}=s;if(!eM(o))continue;let i={identifier:s.identifier??r,timing:s.timing??YJ};if(_(s.discriminator))i.discriminator=s.discriminator;t[o]=i}return t}function eM(e){return e!==void 0&&QJ.has(e)}function FS(e){let t=e.toLowerCase();return t.startsWith(".")?t:`.${t}`}var VS,qS,YJ,QJ,tM,nM;var mm=M(()=>{ae();Cp();VS=["parse","serialize","rewrite","discover","load"],qS=[...VS,"projectData","resolvePaths","lower","emit","head","assets","mount","dialect","deploySchema","bindings","testConnection"];YJ=["compiler","server"];QJ=new Set(qS);tM={importModule:async()=>{await Promise.resolve().then(() => os());return{JxNotation:{parse:(n)=>Po(n),serialize:(n)=>fm(n)}}},loadJson:()=>Promise.reject(Error("Jx Notation reads no file of its own")),resolvePath:(e,t)=>t},nM=new Ya("jxn","",{$defs:{methods:{parse:{role:"parse"},serialize:{role:"serialize"}}},$implementation:"jxn",format:{documentKinds:["page","component"],extensions:[".jxn"]},title:"JxNotation"},tM)});class WS{#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 fu(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 BS(e,t,n){let r=[];for(let s of e??[])r.push(await rM(s,t,n));return new WS(r)}async function rM(e,t,n){let r;if(e.startsWith("./")||e.startsWith("../")){let l=t.resolvePath(n,e);r=t.resolvePath(`${l}/package.json`,`./${Za}`)}else try{r=t.resolvePath(n,`${e}/${Za}`)}catch(l){throw Error(`Extension "${e}" is not resolvable: it must export ${Za} (is the package installed, and does its exports map include it?): ${hm(l)}`,{cause:l})}let s;try{s=await t.loadJson(r)}catch(l){throw Error(`Extension "${e}": cannot read manifest ${r}: ${hm(l)}`,{cause:l})}if(!L(s)||!_(s.name))throw Error(`Extension "${e}": ${Za} 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[l,c]of Object.entries(o.classes??{})){let u=t.resolvePath(r,c),d;try{d=await t.loadJson(u)}catch(p){throw Error(`Extension "${e}": cannot read class "${l}" at ${u}: ${hm(p)}`,{cause:p})}i.push(new Ya(l,u,HS(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 hm(e){return e instanceof Error?e.message:String(e)}var Za="jx-extension.json";var US=M(()=>{mm();ae();mm()});var zS=M(()=>{ae()});function oM(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 GS(e){let t=sM.filter((n)=>e(n));if(t.length>1)return"conflict";return t[0]??null}function du(e,t){return rs(t)?dm(e,t):$$(e,t)}var sM,KS="project.jxn",gm;var pu=M(()=>{ae();zS();Da();ru();pm();Ft();sM=["project.jxn","project.json"];gm=class gm extends Error{constructor(e){super(oM(e));this.name="ProjectFileConflictError"}}});import{accessSync as uX,closeSync as fX,constants as dX,existsSync as iM,fstatSync as pX,lstatSync as mX,openSync as hX,readFileSync as gX,statSync as yX}from"node:fs";import{dirname as bX,join as XS}from"node:path";function aM(e){return GS((t)=>iM(XS(e,t)))}function Un(e){let t=aM(e);if(t==="conflict")throw new gm(e);return XS(e,t??KS)}var ko=M(()=>{pu()});import{existsSync as lM,readFileSync as cM}from"node:fs";import{dirname as hu,isAbsolute as uM,resolve as YS,sep as mu}from"node:path";import{pathToFileURL as fM}from"node:url";import{createRequire as dM}from"node:module";function ZS(e){let t=[e],n=`${mu}src${mu}`,r=`${mu}dist${mu}`;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 QS(e){let t=ZS(e),n=hu(e),r=[...t.filter((o)=>hu(o)===n),...t.filter((o)=>hu(o)!==n)],s=r.find((o)=>lM(o));if(s===void 0)throw Error(`no module at ${e} (tried ${r.join(", ")})`);return s}async function ym(e){let t=ZS(e),n;for(let r of t)try{return await import(fM(r).href)}catch(s){n=s}throw n instanceof Error?n:Error(String(n))}function xm(e,t){return dM(YS(e,"package.json")).resolve(t)}function bm(e){return{importModule:(t)=>ym(t),loadJson:async(t)=>JSON.parse(cM(t,"utf8")),resolvePath:(t,n)=>{if(n.startsWith("./")||n.startsWith("../"))return YS(hu(t),n);if(uM(n))return n;return xm(e,n)}}}async function Rs(e,t){return BS(t?.extensions,bm(e),Un(e))}function gu(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 is=M(()=>{US();ae();ko()});var $m,Sm;var wm=M(()=>{$m={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."},Sm={anyOf:[{$ref:"#/$defs/TagName"},{additionalProperties:!1,properties:{$expression:{$ref:"#/$defs/TagExpression"}},required:["$expression"],type:"object"}]}});var vm;var Em=M(()=>{vm={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 jm,Pm,km;var _m=M(()=>{jm={oneOf:[{type:"string"},{$ref:"#/$defs/RefObject"}]},Pm={oneOf:[{type:"boolean"},{$ref:"#/$defs/RefObject"}]},km={oneOf:[{type:"number"},{$ref:"#/$defs/RefObject"}]}});var Om;var Am=M(()=>{Om={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 Cm,Rm;var Tm=M(()=>{Cm={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"},Rm={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 Qa;var Nm=M(()=>{Qa={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 Jm;var Mm=M(()=>{Jm={enum:["string","number","integer","boolean","array","object","null"],type:"string"}});var Im,Dm,Lm,Fm,Vm,qm,Hm,Wm,Bm;var Um=M(()=>{Im={description:"Reference to a $defs type definition in the current component.",examples:["#/$defs/Count","#/$defs/TodoItem","#/$defs/Status"],pattern:String.raw`^#/\$defs/`,type:"string"},Dm={description:"Reference to a state entry (runtime variable) in the current component.",examples:["#/state/count","#/state/addTask","#/state/items"],pattern:"^#/state/",type:"string"},Lm={description:"Reference to an external Jx component file.",examples:["./card.json","https://cdn.example.com/button.json"],pattern:String.raw`^(\./|\.\./).*\.json$|^https?://`,type:"string"},Fm={description:"Reference to a window or document global.",examples:["window#/currentUser","document#/appConfig"],pattern:"^(window|document)#/",type:"string"},Vm={description:"Reference to a named state entry passed via $props from a parent component.",examples:["parent#/sharedState","parent#/theme"],pattern:"^parent#/",type:"string"},qm={description:"Reference to the current Array map iteration context.",examples:["$map/item","$map/index","$map/item/text","$map/item/done","#/$map/item/text"],pattern:String.raw`^(#/)?\$map/(item|index)(/.*)?$`,type:"string"},Hm={oneOf:[{$ref:"#/$defs/InternalRef"},{$ref:"#/$defs/StateRef"},{$ref:"#/$defs/ExternalRef"},{$ref:"#/$defs/GlobalRef"},{$ref:"#/$defs/ParentRef"},{$ref:"#/$defs/MapRef"}],type:"string"},Wm={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"},Bm={properties:{$props:{$ref:"#/$defs/PropsObject"},$ref:{$ref:"#/$defs/ExternalRef"}},required:["$ref"],type:"object"}});var el;var zm=M(()=>{el={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 Km,Gm;var Xm=M(()=>{Km={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, in either spelling ($map/item/id or #/$map/item/id). 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"},Gm={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 Ym,Zm,Qm,eh,th,yu;var nh=M(()=>{Ym={additionalProperties:{oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{$ref:"#/$defs/RefObject"}]},description:"HTML attributes and ARIA attributes set via element.setAttribute().",type:"object"},Zm={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"},Qm={oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"null"},{$ref:"#/$defs/RefObject"}]},eh={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"},th={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"},yu={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 rh;var sh=M(()=>{rh={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 oh;var ih=M(()=>{oh={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 ah,lh;var ch=M(()=>{ah={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"}]},lh={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 uh,fh;var dh=M(()=>{uh=["Function","Request","URLSearchParams","FormData","LocalStorage","SessionStorage","Cookie","IndexedDB","Array","Set","Map","Blob","ReadableStream"],fh={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 ph;var mh=M(()=>{ph={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"}});function nw(){return`the Intl helpers ${gh.join(", ")}`}var _r="en-US",hh="UTC",ew,gh,tw;var yh=M(()=>{ew=[{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."}],gh=ew.map((e)=>e.path),tw=Object.fromEntries(ew.map((e)=>[e.path,e.params.indexOf("locale")]))});var xh,bh,$h,Sh,wh,vh,Eh,jh,Ph,kh,_h,Oh,Ah,Ch,Rh,Th,Nh;var Jh=M(()=>{yh();xh={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"},bh={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."},$h={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."},Sh={enum:["!","-"]},wh={enum:["+","-","*","/","%","===","!==","<","<=",">",">=","&&","||","??"]},vh={const:"?:"},Eh={const:"switch"},jh={const:"call"},Ph={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"]},kh={enum:["=","+=","-=","*=","/="]},_h={enum:["pop","shift"]},Oh={enum:["push","unshift"]},Ah={const:"splice"},Ch={const:"reduce"},Rh={enum:["map","filter"]},Th={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 "+`${nw()}) — 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"},Nh={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 Mh,Ih,Dh,Lh;var Fh=M(()=>{Mh={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"}]},Ih={additionalProperties:{$ref:"#/$defs/StateEntry"},description:"Map of runtime variables. Keys are camelCase (public) or #-prefixed (private). All entries are reactive by default.",type:"object"},Dh={additionalProperties:{$ref:"#/$defs/TypeDefEntry"},description:"Map of reusable JSON Schema type definitions. Keys are PascalCase type names. No runtime artifacts are produced.",type:"object"},Lh={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 rw,xu,bu,$u,Su,wu,vu,Eu,ju,Pu,Vh;var qh=M(()=>{rw=["method","accessor","parse","serialize","rewrite","discover","load","projectData","resolvePaths","lower","emit","head","assets","mount","dialect","deploySchema","bindings","testConnection"],xu={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"},bu={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"},$u={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"},Su={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:rw,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"},wu={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"},vu={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"},Eu={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"},ju={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"},Pu={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"},Vh={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"}});function zn(e){if(!_(e)||e.trim()==="")return null;try{return new Intl.Locale(e.trim()).toString()}catch{return null}}function tl(e){let t=zn(e);if(t===null)return"ltr";let n=new Intl.Locale(t),r=n.script??n.maximize().script;return r!==void 0&&pM.has(r)?"rtl":"ltr"}function sw(e){let t=zn(e);if(t===null)return _(e)?e:"";return new Intl.DisplayNames([t],{type:"language"}).of(t)??t}function Hh(e){let t=e.i18n,n=[];if(!F(t))return{errors:n,i18n:null};let r=Array.isArray(t.locales)?t.locales:[],s=[];for(let l of r){let c=zn(l);if(c===null){n.push(`i18n.locales: "${String(l)}" is not a well-formed BCP 47 language tag.`);continue}if(!s.includes(c))s.push(c)}let o=zn(t.defaultLocale)??s[0]??null;if(t.defaultLocale!==void 0&&zn(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};let i=[o,...s.filter((l)=>l!==o)],a=t.routing==="prefix-always"||t.routing==="prefix-except-default"?t.routing:mM;return{errors:n,i18n:{defaultLocale:o,locales:i,routing:a}}}function fr(e,t){if(t===null)return null;let n=e.split("/").find(Boolean);if(n===void 0)return t.defaultLocale;let r=zn(n);return r!==null&&t.locales.includes(r)?r:t.defaultLocale}var pM,ku="^[A-Za-z]{2,8}(-[A-Za-z0-9]{1,8})*$",mM="prefix-except-default";var _o=M(()=>{ae();pM=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"])});var ow,Ts="utf-8",_u;var Wh=M(()=>{_o();ow=[301,302,303,307,308],_u={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:"JSON Schema type definitions, tooling only. A document's #/$defs/Name reference resolves here when the document does not define Name itself.",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"},sources:{additionalProperties:{oneOf:[{type:"string"},{items:{type:"string"},type:"array"}]},description:"Add sources to a computed directive without restating it. Each entry is appended after the derived sources (the script hashes and collected origins stay), skipped if already present. A directive the policy does not carry is created from the one a browser falls back to, `default-src` for the fetch directives. For origins that arrive only at runtime. A directive named here and in `directives` is a build error.",propertyNames:{pattern:"^[A-Za-z][A-Za-z0-9-]*$"},type:"object"}},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:Ts,description:"The <meta charset> every page declares. The HTML Standard allows only utf-8, which is the default.",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"},format:{default:"jxn",description:"The native notation Studio writes new documents in: `jxn` (Jx Notation) or `json`. Both are read everywhere; this decides only what is created.",enum:["jxn","json"],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:ku,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:ku,type:"string"},locales:{description:"Available locales, as BCP 47 language tags.",examples:[["en","fr","de"]],items:{pattern:ku,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:[...ow],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 Bh;var Uh=M(()=>{Bh={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 nl="https://jxsuite.com/schema/project/fields/v2",Oo="https://jxsuite.com/schema/document/paths/v2",zh,Kh,rl,Gh;var sl=M(()=>{zh={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"},Kh={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"},rl=[{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"}],Gh={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 ol=M(()=>{wm();Em();_m();Am();Tm();Nm();Mm();Um();zm();Xm();nh();sh();ih();ch();dh();mh();Jh();Fh();qh();Wh();Uh();sl()});import{existsSync as hM,readFileSync as gM}from"node:fs";import{basename as yM,resolve as xM}from"node:path";function as(e){let t=Un(e);if(!hM(t))throw Error(`No project.jxn or project.json in ${e}`);let n;try{n=du(gM(t,"utf8"),t)}catch(i){throw Error(`Invalid ${yM(t)}: ${ye(i)}`,{cause:i})}let r={...il,...n,build:{...il.build,...n.build},defaults:{...il.defaults,...n.defaults},images:{...il.images,...n.images},url:n.url??il.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:xM(e)}}function iw(e){return["0","false","no","off"].includes((e??"").trim().toLowerCase())}var il;var ji=M(()=>{ol();Ft();pu();ko();il={$head:[],$media:{},build:{format:"directory",outDir:"./dist",provider:null,trailingSlash:"always"},defaults:{charset:Ts,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 Xh,readFileSync as aw,writeFileSync as bM}from"node:fs";import{resolve as lw}from"node:path";async function cw(e,t={}){let{dryRun:n=!1,connection:r}=t,{config:s}=as(e),o=await Rs(e,s),i=L(s.connections)?s.connections:{},a=L(s.data)?s.data:{},l=Object.keys(i).filter((g)=>!r||g===r);if(r&&l.length===0)throw Error(`Unknown connection "${r}" (no such connections entry in project.json)`);if(l.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 c={...process.env,...SM(e),JX_PROJECT_ROOT:e},u=[],d=[];for(let g of l){let b=i[g],h=L(b)?{...b,$name:g}:{$name:g},x=String(h.provider??""),k=$M(o.connectors(),x);if(!k)throw Error(`Connection "${g}" names provider "${x}", but no enabled extension provides it (enable the extension in project.json "extensions")`);let w={};for(let[E,O]of Object.entries(a))if(L(O)&&O.connection===g)w[E]=O;let v=await k.call("deploySchema",w,h,{dryRun:n,env:c});if(u.push({applied:v.applied??!n,connection:g,provider:x,statements:v.statements??[],tables:Object.keys(w),warnings:v.warnings??[]}),k.capabilities.bindings){let E=await k.call("bindings",h);if(L(E)&&Object.keys(E).length>0)d.push(E)}}let p=lw(e,"wrangler.jsonc"),m=!1;if(!n&&d.length>0&&Xh(p)){let g=aw(p,"utf8"),{content:b,patched:h}=k$(g,d);if(h&&b!==g)bM(p,b,"utf8"),m=!0}return{bindingsPatched:m,results:u,wranglerPath:Xh(p)?p:null}}function $M(e,t){return e.find((n)=>n.connector?.provider===t)}function SM(e){let t=lw(e,".dev.vars");if(!Xh(t))return{};let n=new Map;for(let r of aw(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 uw=M(()=>{O$();is();ji();ae()});function Yh(e,t=[]){if(!L(e))return t;let{children:n}=e;if(e.tagName==="slot"){let r=e.attributes,s=L(r)?r.name:void 0,o={name:_(s)?s.trim():""};if(Array.isArray(n)&&n.length>0)o.fallback=n;t.push(o)}if(Array.isArray(n))for(let r of n)Yh(r,t);return t}var fw=M(()=>{ae()});function wM(e){let t=new Set,n=new Set,r=(o)=>{if(o.startsWith("#/state/"))t.add(o.slice(8).split("/")[0])},s=(o)=>{if(_(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"&&pe(o.target))r(o.target.$ref);if(o.$prototype==="Array"){for(let i of[o.filter,o.sort])if(pe(i))r(i.$ref)}for(let[i,a]of Object.entries(o)){if(i==="$defs")continue;if(i.startsWith("on")&&pe(a))r(a.$ref);s(a)}};s(e);for(let o of Zh)if(L(e.state)&&o in e.state)t.add(o);return t}function Qh(e){return"body"in e&&"$src"in e}function al(e){return Ac(e.parameters??e.arguments).length>0}function Or(e){let t=["state"];for(let n of Ac(e.parameters??e.arguments))if(n!=="state")t.push(n);return t}function vM(e,t,n){if(vr(t))return"callable";if(Ac(t.parameters??t.arguments).length>0)return"callable";if(_(t.body))return c$(t.body)?"computed":"callable";if(t.$src)return n().has(e)?"callable":"computed";return"callable"}function Ar(e){let t=new Map,n=null,r=()=>n??=wM(e);for(let[s,o]of Object.entries(e.state??{}))if(At(o))t.set(s,vM(s,o,r));return t}var Zh;var Pi=M(()=>{ae();Zh=new Set(["onMount","onUnmount","onAdopted"])});function dw(e){if(e===null||e===void 0)return"null";if(Array.isArray(e))return"array";if(_(e))return"string";if(De(e))return"number";return Xe(e)?"boolean":"object"}function EM(e){if(_(e))return e;if(!L(e))return;if(_(e.text))return e.text;if(_(e.type))return e.type;if(Array.isArray(e.type))return e.type.filter((t)=>_(t)).join(" | ");return _(e.$ref)?e.$ref.slice(e.$ref.lastIndexOf("/")+1):void 0}function ll(e){let t=EM(e);return t===void 0||t===""?void 0:{text:t}}function mw(e){if(_(e)&&e!=="")return e;return e===!0?!0:void 0}function jM(e,t){let n={kind:"field",name:e};if(Oc(t)){let r=ll(t.type)??ll(_(t.$ref)?{$ref:t.$ref}:void 0);if(n.type=r??{text:dw(t.default)},n.default=JSON.stringify(t.default),_(t.description))n.description=t.description;let s=mw(t.deprecated);if(s!==void 0)n.deprecated=s;return n}if(L(t)){if(Object.keys(t).some((s)=>s.startsWith("$"))||i$(t))return null}else if(ce(t))return null;return n.type={text:dw(t)},n.default=JSON.stringify(t),n}function PM(e){if(_(e))return{name:e};if(!L(e)||!_(e.name))return null;let t={name:e.name},n=ll(e.type);if(n)t.type=n;if(_(e.description))t.description=e.description;if(Xe(e.optional))t.optional=e.optional;if(e.default!==void 0)t.default=JSON.stringify(e.default);return t}function kM(e,t){let n={kind:"method",name:e};if(_(t.description))n.description=t.description;let s=(t.parameters??t.arguments??[]).map((i)=>PM(i)).filter((i)=>i!==null&&i.name!=="state");if(s.length>0)n.parameters=s;let o=ll(t.type);if(o)n.return={type:o};return n}function pw(e,t){if(!Array.isArray(e))return;for(let n of e){if(!L(n)||!_(n.name)||t.has(n.name))continue;let r={name:n.name,type:ll(n.type)??{text:"Event"}};if(_(n.description))r.description=n.description;let s=mw(n.deprecated);if(s!==void 0)r.deprecated=s;t.set(n.name,r)}}function _M(e){let t=new Set,n=(s)=>{if(!L(s))return;let o=L(s.attributes)?s.attributes.part:void 0;if(_(o)){for(let i of o.split(/\s+/u))if(i!=="")t.add(i)}r(s)},r=(s)=>{if(Array.isArray(s.children))for(let o of s.children)n(o)};return r(e),[...t]}function OM(e){let t=e.doc,n=L(t.state)?t.state:{},r=Ar(e.doc),s=[],o=[],i=new Map,a=new Map;pw(t.emits,a);for(let[x,k]of Object.entries(n)){if(si(x))continue;if(At(k)){if(pw(k.emits,a),!Zh.has(x)&&r.get(x)!=="computed")o.push(kM(x,k));continue}let w=jM(x,k);if(w)o.push(w),i.set(x,w)}let l=[],c=new Set,u=Array.isArray(t.observedAttributes)?t.observedAttributes:[];for(let x of new Set(u.filter((k)=>_(k)))){let k={name:x},w=oi(x),v=i.get(w);if(v){k.fieldName=w;for(let E of["type","default","description","deprecated"])if(v[E]!==void 0)Object.assign(k,{[E]:v[E]});if(!c.has(w)){c.add(w),v.attribute=x;let E=n[w];if(L(E)&&E.reflects===!0)v.reflects=!0}}l.push(k)}for(let[x,k]of Object.entries(n)){if(si(x)||!L(k)||!_(k.attribute))continue;if(i.get(x)?.attribute!==k.attribute)s.push(`${e.tagName}: state entry "${x}" declares attribute "${k.attribute}", but the `+"element does not observe it into that entry (spec.md §16.5); add it to "+"observedAttributes or remove it")}let d={customElement:!0,kind:"class",members:o,name:e.className,tagName:e.tagName},p=_(t.description)?t.description:t.$description;if(_(p))d.description=p;if(l.length>0)d.attributes=l;if(a.size>0)d.events=[...a.values()];let m=Yh(t).map((x)=>({name:x.name}));if(m.length>0)d.slots=m;let g=L(t.style)?t.style:{},b=Object.entries(g).filter(([x])=>x.startsWith("--")).map(([x,k])=>({default:String(k),name:x}));if(b.length>0)d.cssProperties=b;let h=e.shadow?_M(e.doc).map((x)=>({name:x})):[];if(h.length>0)d.cssParts=h;return{module:{declarations:[d],exports:[{declaration:{name:e.className},kind:"custom-element-definition",name:e.tagName}],kind:"javascript-module",path:e.modulePath},warnings:s}}function Ou(e){let n=e.toSorted((r,s)=>r.tagName<s.tagName?-1:1).map((r)=>OM(r));return{manifest:{modules:n.map((r)=>r.module),schemaVersion:"2.1.0"},warnings:n.flatMap((r)=>r.warnings)}}function Au(e){return`${JSON.stringify(e,null,2)}
55
+ `}var eg=M(()=>{fw();Pi();ae()});function Ao(e){return e.startsWith(Cu)}function Ru(e){let t=e;if(Ao(t))t=t.slice(Cu.length);return t=t.replace(/^\.\//,"").replace(/\.(js|ts|mjs|mts)$/,"").replaceAll("@","").replaceAll(/[/\\]+/g,"-").replaceAll(/[^\w.-]/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,""),`${tg}${t}.js`}function hw(e){let t=/\.(\w+)$/.exec(e)?.[1]??"",n=e.replace(/\.\w+$/,"").replaceAll("@","").replaceAll(/[/\\]+/g,"-").replaceAll(/[^\w.-]/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,"");return t===""?`${tg}${n}`:`${tg}${n}.${t}`}function gw(e){let t=e.replaceAll("\\","/");return t.length>1&&t.endsWith("/")?t.slice(0,-1):t}function Tu(e){let t=gw(e);return t.startsWith("/")?t:`/${t}`}function AM(e,t){return[...e].toSorted((n,r)=>r[t].length-n[t].length)}function Nu(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 AM(e,"urlPrefix")){let o=Tu(s.urlPrefix);if(!r.startsWith(`${o}/`))continue;let a=r.slice(o.length+1).split("/");if(a.some((c)=>c===""||c==="."||c===".."))return null;let{filter:l}=s;if(l&&!l(a.join("/")))return null;return`${gw(s.dir)}/${a.join("/")}`}return null}function yw(e,t){let n=new Set;for(let r of t){let s=Tu(r.urlPrefix),o=new RegExp(`${s.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}/[^${CM}]+`,"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 ng(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 rg(e){return e.map(({url:t,descriptor:n})=>n?`${t} ${n}`:t).join(", ")}function Co(e){if(!_(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 Te(e,t){if(e===""||!t.startsWith("/")||t.startsWith("//"))return t;if(t===e||t.startsWith(`${e}/`))return t;return e+t}function Ns(e,t){let n=new URL(t);if(!n.pathname.endsWith("/"))n.pathname+="/";return new URL(e.replace(/^\/+/,""),n).href}var Cu="npm:",tg="/assets/",CM;var hn=M(()=>{ae();CM=String.raw`"'\s<>()\\`});function xw(e){return e.toISOString().replace(/\.\d{3}Z$/,"Z")}function sg(e,t=()=>new Date){let n=e.SOURCE_DATE_EPOCH;if(n===void 0||n==="")return xw(t());let r=new Date(Number(n)*1000);if(!RM.test(n)||Number.isNaN(r.getTime()))throw RangeError(`SOURCE_DATE_EPOCH must be a non-negative integer number of seconds, got "${n}"`);return xw(r)}var RM;var bw=M(()=>{RM=/^\d+$/});function ul(e,t){return e.replaceAll(JM,(n,r,s)=>{let o=s.trim(),i=FM.exec(o),a=i?i[2]:o,l=Te(t,a);if(l===a)return n;return`url(${r}${i?`${i[1]}${l}${i[1]}`:l}${r})`})}function og(e,t,n,r,s){let o=n.toLowerCase();if($w.has(o))return Te(s,r);if(Sw.has(o)){let i=ng(r);return i.length===0?r:rg(i.map((a)=>({descriptor:a.descriptor,url:Te(s,a.url)})))}if(o==="style")return ul(r,s);if(o==="content"&&e==="meta"&&LM.test(t))return Te(s,r);return r}function ig(e,t){if(t==="")return e;let n=e.replaceAll(IM,(r,s,o,i)=>{let a=o.replaceAll(MM,(l,c)=>`"${Te(t,c)}"`);return s+a+i});return n=n.replaceAll(DM,(r,s,o,i)=>s+ul(o,t)+i),n.replaceAll(TM,(r,s,o)=>{if(o==="")return r;let i=s.toLowerCase(),a=o.replaceAll(NM,(l,c,u,d,p)=>{let m=d===void 0?"'":'"',g=d??p??"",b=og(i,o,c,g,t);return b===g?l:`${c}=${m}${b}${m}`});return a===o?r:`<${s}${a}>`})}function VM(e,t){let n=_(e.tagName)?e.tagName.toLowerCase():"",{attributes:r}=e;if(F(r)){for(let[s,o]of Object.entries(r))if(_(o))r[s]=og(n,"",s,o,t)}for(let s of Object.keys(e)){let o=s.toLowerCase(),i=e[s];if(_(i)&&($w.has(o)||Sw.has(o)))e[s]=og(n,"",o,i,t)}if(_(e.innerHTML))e.innerHTML=ig(e.innerHTML,t)}function cl(e,t){if(!F(e)||Array.isArray(e))return;if(Le(e)){cl(e.map,t);return}let n=e;VM(n,t);let{cases:r,children:s}=n;if(Array.isArray(s))for(let o of s)cl(o,t);else cl(s,t);if(F(r))for(let o of Object.values(r))cl(o,t)}function ww(e,t){if(t!=="")cl(e,t)}var $w,Sw,TM,NM,JM,MM,IM,DM,LM,FM;var vw=M(()=>{hn();ae();$w=new Set(["href","src","poster","action","formaction","data"]),Sw=new Set(["srcset","imagesrcset"]),TM=/<([a-zA-Z][a-zA-Z0-9-]*)((?:"[^"]*"|'[^']*'|[^>"'])*)>/g,NM=/([a-zA-Z_:][\w:.-]*)\s*=\s*("([^"]*)"|'([^']*)')/g,JM=/url\(\s*(['"]?)([^'")]+)\1\s*\)/g,MM=/"(\/[^"/][^"]*)"/g,IM=/(<script\b[^>]*\btype\s*=\s*["']importmap["'][^>]*>)([\s\S]*?)(<\/script>)/gi,DM=/(<style\b[^>]*>)([\s\S]*?)(<\/style>)/gi,LM=/\b(?:property|name)\s*=\s*["'](?:og:|twitter:)[\w:.-]*(?:image|url|video|audio|player)[\w:.-]*["']/i,FM=/^(&quot;|&#34;|&apos;|&#39;)([\s\S]*)\1$/});var gl=B(function(eZ,Kw){var __dirname="/home/runner/work/jx/jx/node_modules/esbuild/lib",__filename="/home/runner/work/jx/jx/node_modules/esbuild/lib/main.js",{defineProperty:fg,getOwnPropertyDescriptor:qM,getOwnPropertyNames:HM}=Object,WM=Object.prototype.hasOwnProperty,BM=(e,t)=>{for(var n in t)fg(e,n,{get:t[n],enumerable:!0})},UM=(e,t,n,r)=>{if(t&&typeof t==="object"||typeof t==="function"){for(let s of HM(t))if(!WM.call(e,s)&&s!==n)fg(e,s,{get:()=>t[s],enumerable:!(r=qM(t,s))||r.enumerable})}return e},zM=(e)=>UM(fg({},"__esModule",{value:!0}),e),ml={};BM(ml,{analyzeMetafile:()=>EI,analyzeMetafileSync:()=>_I,build:()=>$I,buildSync:()=>jI,context:()=>SI,default:()=>RI,formatMessages:()=>vI,formatMessagesSync:()=>kI,initialize:()=>AI,stop:()=>OI,transform:()=>wI,transformSync:()=>PI,version:()=>bI});Kw.exports=zM(ml);function Ew(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(dr(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(dr(o)),t(r[o])}},n=new Nw;return n.write32(0),n.write32(e.id<<1|+!e.isRequest),t(e.value),lg(n.buf,n.len-4,0),n.buf.subarray(0,n.len)}function KM(e){let t=()=>{switch(n.read8()){case 0:return null;case 1:return!!n.read8();case 2:return n.read32();case 3:return Mo(n.read());case 4:return n.read();case 5:{let i=n.read32(),a=[];for(let l=0;l<i;l++)a.push(t());return a}case 6:{let i=n.read32(),a={};for(let l=0;l<i;l++)a[Mo(n.read())]=t();return a}default:throw Error("Invalid packet")}},n=new Nw(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 Nw=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);lg(this.buf,e,t)}write(e){let t=this._write(4+e.length);lg(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 Jw(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}},dr,Mo,ag;if(typeof TextEncoder<"u"&&typeof TextDecoder<"u"){let e=new TextEncoder,t=new TextDecoder;dr=(n)=>e.encode(n),Mo=(n)=>t.decode(n),ag='new TextEncoder().encode("")'}else if(typeof Buffer<"u")dr=(e)=>Buffer.from(e),Mo=(e)=>{let{buffer:t,byteOffset:n,byteLength:r}=e;return Buffer.from(t,n,r).toString()},ag='Buffer.from("")';else throw Error("No UTF-8 codec found");if(!(dr("")instanceof Uint8Array))throw Error(`Invariant violation: "${ag} instanceof Uint8Array" is incorrectly false
56
56
 
57
57
  This indicates that your JavaScript environment is broken. You cannot use
58
58
  esbuild in this environment because esbuild relies on this invariant. This
59
59
  is not a problem with esbuild. You need to fix your environment instead.
60
- `);function ow(e,t){return(e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)>>>0}function bm(e,t,n){e[n++]=t,e[n++]=t>>8,e[n++]=t>>16,e[n++]=t>>24}var as=String.fromCharCode;function Hn(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 ${as(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 pM(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,l=0;while(l<s){let c=e[l++];if(c<=32)continue;let u;if(i===2&&o===null&&c!==34&&c!==125)Hn(e,--l);switch(c){case 116:{if(e[l++]!==114||e[l++]!==117||e[l++]!==101)Hn(e,--l);u=!0;break}case 102:{if(e[l++]!==97||e[l++]!==108||e[l++]!==115||e[l++]!==101)Hn(e,--l);u=!1;break}case 110:{if(e[l++]!==117||e[l++]!==108||e[l++]!==108)Hn(e,--l);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=l;u=as(c),c=e[l];while(!0){switch(c){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+=as(c),c=e[++l];continue}}break}if(u=+u,isNaN(u))Hn(e,--d,"Invalid number");break}case 34:{u="";while(!0){if(l>=s)Hn(e,s);if(c=e[l++],c===34)break;else if(c===92)switch(e[l++]){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+=`
61
- `;break;case 114:u+="\r";break;case 116:u+="\t";break;case 117:{let d=0;for(let p=0;p<4;p++)if(c=e[l++],d<<=4,c>=48&&c<=57)d|=c-48;else if(c>=97&&c<=102)d|=c+-87;else if(c>=65&&c<=70)d|=c+-55;else Hn(e,--l);u+=as(d);break}default:Hn(e,--l);break}else if(c<=127)u+=as(c);else if((c&224)===192)u+=as((c&31)<<6|e[l++]&63);else if((c&240)===224)u+=as((c&15)<<12|(e[l++]&63)<<6|e[l++]&63);else if((c&248)==240){let d=(c&7)<<18|(e[l++]&63)<<12|(e[l++]&63)<<6|e[l++]&63;if(d>65535)d-=65536,u+=as(d>>10&1023|55296),d=56320|d&1023;u+=as(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)Hn(e,--l);u=a,o=t.pop(),a=n.pop(),i=r.pop();break}case 125:{if(i!==2)Hn(e,--l);u=a,o=t.pop(),a=n.pop(),i=r.pop();break}default:Hn(e,--l)}c=e[l];while(c<=32)c=e[++l];switch(i){case 0:{if(l===s)return u;break}case 1:{if(a.push(u),c===44){l++;continue}if(c===93)continue;break}case 2:{if(o===null){if(o=u,c===58){l++;continue}}else{if(a[o]=u,o=null,c===44){l++;continue}if(c===125)continue}break}}break}Hn(e,l)}var Ct=JSON.stringify,GS="warning",XS="silent";function wi(e,t){let n=[];for(let r of e){if(pn(r,t),r.indexOf(",")>=0)throw Error(`Invalid ${t}: ${r}`);n.push(r)}return n.join(",")}var Su=()=>null,ot=(e)=>typeof e==="boolean"?null:"a boolean",se=(e)=>typeof e==="string"?null:"a string",wu=(e)=>e instanceof RegExp?null:"a RegExp object",ko=(e)=>typeof e==="number"&&e===(e|0)?null:"an integer",mM=(e)=>typeof e==="number"&&e===(e|0)&&e>=0&&e<=65535?null:"a valid port number",iw=(e)=>typeof e==="function"?null:"a function",ls=(e)=>Array.isArray(e)?null:"an array",mn=(e)=>Array.isArray(e)&&e.every((t)=>typeof t==="string")?null:"an array of strings",Cn=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)?null:"an object",hM=(e)=>typeof e==="object"&&e!==null?null:"an array or an object",gM=(e)=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",YS=(e)=>typeof e==="object"&&!Array.isArray(e)?null:"an object or null",aw=(e)=>typeof e==="string"||typeof e==="boolean"?null:"a string or a boolean",yM=(e)=>typeof e==="string"||typeof e==="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",lw=(e)=>typeof e==="string"||Array.isArray(e)&&e.every((t)=>typeof t==="string")?null:"a string or an array of strings",cw=(e)=>typeof e==="string"||e instanceof Uint8Array?null:"a string or a Uint8Array",xM=(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(`${Ct(n)} must be ${o}`);return s}function vt(e,t,n){for(let r in e)if(!(r in t))throw Error(`Invalid option ${n}: ${Ct(r)}`)}function bM(e){let t=Object.create(null),n=R(e,t,"wasmURL",xM),r=R(e,t,"wasmModule",gM),s=R(e,t,"worker",ot);return vt(e,t,"in initialize() call"),{wasmURL:n,wasmModule:r,worker:s}}function uw(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 ${Ct(n)} in mangle cache to map to either a string or false`)}}return t}function _u(e,t,n,r,s){let o=R(t,n,"color",ot),i=R(t,n,"logLevel",se),a=R(t,n,"logLimit",ko),l=R(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}`),l)e.push(`--log-style=${l}`)}function pn(e,t,n){if(typeof e!=="string")throw Error(`Expected value for ${t}${n!==void 0?" "+Ct(n):""} to be a string, got ${typeof e} instead`);return e}function fw(e,t,n){let r=R(t,n,"legalComments",se),s=R(t,n,"sourceRoot",se),o=R(t,n,"sourcesContent",ot),i=R(t,n,"target",lw),a=R(t,n,"format",se),l=R(t,n,"globalName",se),c=R(t,n,"mangleProps",wu),u=R(t,n,"reserveProps",wu),d=R(t,n,"mangleQuoted",ot),p=R(t,n,"minify",ot),m=R(t,n,"minifySyntax",ot),y=R(t,n,"minifyWhitespace",ot),S=R(t,n,"minifyIdentifiers",ot),g=R(t,n,"lineLimit",ko),x=R(t,n,"drop",mn),P=R(t,n,"dropLabels",mn),w=R(t,n,"charset",se),E=R(t,n,"treeShaking",ot),j=R(t,n,"ignoreAnnotations",ot),A=R(t,n,"jsx",se),T=R(t,n,"jsxFactory",se),I=R(t,n,"jsxFragment",se),V=R(t,n,"jsxImportSource",se),H=R(t,n,"jsxDev",ot),O=R(t,n,"jsxSideEffects",ot),N=R(t,n,"define",Cn),G=R(t,n,"logOverride",Cn),Q=R(t,n,"supported",Cn),re=R(t,n,"pure",mn),ue=R(t,n,"keepNames",ot),ne=R(t,n,"platform",se),fe=R(t,n,"tsconfigRaw",yM),xe=R(t,n,"absPaths",mn);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=${wi(Array.isArray(i)?i:[i],"target")}`);if(a)e.push(`--format=${a}`);if(l)e.push(`--global-name=${l}`);if(ne)e.push(`--platform=${ne}`);if(fe)e.push(`--tsconfig-raw=${typeof fe==="string"?fe:JSON.stringify(fe)}`);if(p)e.push("--minify");if(m)e.push("--minify-syntax");if(y)e.push("--minify-whitespace");if(S)e.push("--minify-identifiers");if(g)e.push(`--line-limit=${g}`);if(w)e.push(`--charset=${w}`);if(E!==void 0)e.push(`--tree-shaking=${E}`);if(j)e.push("--ignore-annotations");if(x)for(let X of x)e.push(`--drop:${pn(X,"drop")}`);if(P)e.push(`--drop-labels=${wi(P,"drop label")}`);if(xe)e.push(`--abs-paths=${wi(xe,"abs paths")}`);if(c)e.push(`--mangle-props=${vu(c)}`);if(u)e.push(`--reserve-props=${vu(u)}`);if(d!==void 0)e.push(`--mangle-quoted=${d}`);if(A)e.push(`--jsx=${A}`);if(T)e.push(`--jsx-factory=${T}`);if(I)e.push(`--jsx-fragment=${I}`);if(V)e.push(`--jsx-import-source=${V}`);if(H)e.push("--jsx-dev");if(O)e.push("--jsx-side-effects");if(N)for(let X in N){if(X.indexOf("=")>=0)throw Error(`Invalid define: ${X}`);e.push(`--define:${X}=${pn(N[X],"define",X)}`)}if(G)for(let X in G){if(X.indexOf("=")>=0)throw Error(`Invalid log override: ${X}`);e.push(`--log-override:${X}=${pn(G[X],"log override",X)}`)}if(Q)for(let X in Q){if(X.indexOf("=")>=0)throw Error(`Invalid supported: ${X}`);let B=Q[X];if(typeof B!=="boolean")throw Error(`Expected value for supported ${Ct(X)} to be a boolean, got ${typeof B} instead`);e.push(`--supported:${X}=${B}`)}if(re)for(let X of re)e.push(`--pure:${pn(X,"pure")}`);if(ue)e.push("--keep-names")}function $M(e,t,n,r,s){var o;let i=[],a=[],l=Object.create(null),c=null,u=null;_u(i,t,l,n,r),fw(i,t,l);let d=R(t,l,"sourcemap",aw),p=R(t,l,"bundle",ot),m=R(t,l,"splitting",ot),y=R(t,l,"preserveSymlinks",ot),S=R(t,l,"metafile",ot),g=R(t,l,"outfile",se),x=R(t,l,"outdir",se),P=R(t,l,"outbase",se),w=R(t,l,"tsconfig",se),E=R(t,l,"resolveExtensions",mn),j=R(t,l,"nodePaths",mn),A=R(t,l,"mainFields",mn),T=R(t,l,"conditions",mn),I=R(t,l,"external",mn),V=R(t,l,"packages",se),H=R(t,l,"alias",Cn),O=R(t,l,"loader",Cn),N=R(t,l,"outExtension",Cn),G=R(t,l,"publicPath",se),Q=R(t,l,"entryNames",se),re=R(t,l,"chunkNames",se),ue=R(t,l,"assetNames",se),ne=R(t,l,"inject",mn),fe=R(t,l,"banner",Cn),xe=R(t,l,"footer",Cn),X=R(t,l,"entryPoints",hM),B=R(t,l,"absWorkingDir",se),q=R(t,l,"stdin",Cn),z=(o=R(t,l,"write",ot))!=null?o:s,We=R(t,l,"allowOverwrite",ot),qe=R(t,l,"mangleCache",Cn);if(l.plugins=!0,vt(t,l,`in ${e}() call`),d)i.push(`--sourcemap${d===!0?"":`=${d}`}`);if(p)i.push("--bundle");if(We)i.push("--allow-overwrite");if(m)i.push("--splitting");if(y)i.push("--preserve-symlinks");if(S)i.push("--metafile");if(g)i.push(`--outfile=${g}`);if(x)i.push(`--outdir=${x}`);if(P)i.push(`--outbase=${P}`);if(w)i.push(`--tsconfig=${w}`);if(V)i.push(`--packages=${V}`);if(E)i.push(`--resolve-extensions=${wi(E,"resolve extension")}`);if(G)i.push(`--public-path=${G}`);if(Q)i.push(`--entry-names=${Q}`);if(re)i.push(`--chunk-names=${re}`);if(ue)i.push(`--asset-names=${ue}`);if(A)i.push(`--main-fields=${wi(A,"main field")}`);if(T)i.push(`--conditions=${wi(T,"condition")}`);if(I)for(let te of I)i.push(`--external:${pn(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}=${pn(H[te],"alias",te)}`)}if(fe)for(let te in fe){if(te.indexOf("=")>=0)throw Error(`Invalid banner file type: ${te}`);i.push(`--banner:${te}=${pn(fe[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}=${pn(xe[te],"footer",te)}`)}if(ne)for(let te of ne)i.push(`--inject:${pn(te,"inject")}`);if(O)for(let te in O){if(te.indexOf("=")>=0)throw Error(`Invalid loader extension: ${te}`);i.push(`--loader:${te}=${pn(O[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}=${pn(N[te],"out extension",te)}`)}if(X)if(Array.isArray(X))for(let te=0,Ut=X.length;te<Ut;te++){let Je=X[te];if(typeof Je==="object"&&Je!==null){let jt=Object.create(null),bt=R(Je,jt,"in",se),pe=R(Je,jt,"out",se);if(vt(Je,jt,"in entry point at index "+te),bt===void 0)throw Error('Missing property "in" for entry point at index '+te);if(pe===void 0)throw Error('Missing property "out" for entry point at index '+te);a.push([pe,bt])}else a.push(["",pn(Je,"entry point at index "+te)])}else for(let te in X)a.push([te,pn(X[te],"entry point",te)]);if(q){let te=Object.create(null),Ut=R(q,te,"contents",cw),Je=R(q,te,"resolveDir",se),jt=R(q,te,"sourcefile",se),bt=R(q,te,"loader",se);if(vt(q,te,'in "stdin" object'),jt)i.push(`--sourcefile=${jt}`);if(bt)i.push(`--loader=${bt}`);if(Je)u=Je;if(typeof Ut==="string")c=lr(Ut);else if(Ut instanceof Uint8Array)c=Ut}let Ye=[];if(j)for(let te of j)te+="",Ye.push(te);return{entries:a,flags:i,write:z,stdinContents:c,stdinResolveDir:u,absWorkingDir:B,nodePaths:Ye,mangleCache:uw(qe)}}function SM(e,t,n,r){let s=[],o=Object.create(null);_u(s,t,o,n,r),fw(s,t,o);let i=R(t,o,"sourcemap",aw),a=R(t,o,"sourcefile",se),l=R(t,o,"loader",se),c=R(t,o,"banner",se),u=R(t,o,"footer",se),d=R(t,o,"mangleCache",Cn);if(vt(t,o,`in ${e}() call`),i)s.push(`--sourcemap=${i===!0?"external":i}`);if(a)s.push(`--sourcefile=${a}`);if(l)s.push(`--loader=${l}`);if(c)s.push(`--banner=${c}`);if(u)s.push(`--footer=${u}`);return{flags:s,mangleCache:uw(d)}}function dw(e){let t={},n={didClose:!1,reason:""},r={},s=0,o=0,i=new Uint8Array(16384),a=0,l=(w)=>{let E=a+w.length;if(E>i.length){let A=new Uint8Array(E*2);A.set(i),i=A}i.set(w,a),a+=w.length;let j=0;while(j+4<=a){let A=ow(i,j);if(j+4+A>a)break;j+=4,y(i.subarray(j,j+A)),j+=A}if(j>0)i.copyWithin(0,j,a),a-=j},c=(w)=>{if(n.didClose=!0,w)n.reason=": "+(w.message||w);let E="The service was stopped"+n.reason;for(let j in r)r[j](E,null);r={}},u=(w,E,j)=>{if(n.didClose)return j("The service is no longer running"+n.reason,null);let A=s++;if(r[A]=(T,I)=>{try{j(T,I)}finally{if(w)w.unref()}},w)w.ref();e.writeToStdin(KS({id:A,isRequest:!0,value:E}))},d=(w,E)=>{if(n.didClose)throw Error("The service is no longer running"+n.reason);e.writeToStdin(KS({id:w,isRequest:!1,value:E}))},p=async(w,E)=>{try{if(E.command==="ping"){d(w,{});return}if(typeof E.key==="number"){let j=t[E.key];if(!j)return;let A=j[E.command];if(A){await A(w,E);return}}throw Error("Invalid command: "+E.command)}catch(j){let A=[_o(j,e,null,void 0,"")];try{d(w,{errors:A})}catch{}}},m=!0,y=(w)=>{if(m){m=!1;let j=String.fromCharCode(...w);if(j!=="0.28.2")throw Error(`Cannot start service: Host version "0.28.2" does not match binary version ${Ct(j)}`);return}let E=dM(w);if(E.isRequest)p(E.id,E.value);else{let j=r[E.id];if(delete r[E.id],E.value.error)j(E.value.error,{});else j(null,E.value)}};return{readFromStdout:l,afterClose:c,service:{buildOrContext:({callName:w,refs:E,options:j,isTTY:A,defaultWD:T,callback:I})=>{let V=0,H=o++,O={},N={ref(){if(++V===1){if(E)E.ref()}},unref(){if(--V===0){if(delete t[H],E)E.unref()}}};t[H]=O,N.ref(),wM(w,H,u,d,N,e,O,j,A,T,(G,Q)=>{try{I(G,Q)}finally{N.unref()}})},transform:({callName:w,refs:E,input:j,options:A,isTTY:T,fs:I,callback:V})=>{let H=pw(),O=(N)=>{try{if(typeof j!=="string"&&!(j instanceof Uint8Array))throw Error('The input to "transform" must be a string or a Uint8Array');let{flags:G,mangleCache:Q}=SM(w,A,T,XS),re={command:"transform",flags:G,inputFS:N!==null,input:N!==null?lr(N):typeof j==="string"?lr(j):j};if(Q)re.mangleCache=Q;u(E,re,(ue,ne)=>{if(ue)return V(Error(ue),null);let fe=vi(ne.errors,H),xe=vi(ne.warnings,H),X=1,B=()=>{if(--X===0){let q={warnings:xe,code:ne.code,map:ne.map,mangleCache:void 0,legalComments:void 0};if("legalComments"in ne)q.legalComments=ne==null?void 0:ne.legalComments;if(ne.mangleCache)q.mangleCache=ne==null?void 0:ne.mangleCache;V(null,q)}};if(fe.length>0)return V(tl("Transform failed",fe,xe),null);if(ne.codeFS)X++,I.readFile(ne.code,(q,z)=>{if(q!==null)V(q,null);else ne.code=z,B()});if(ne.mapFS)X++,I.readFile(ne.map,(q,z)=>{if(q!==null)V(q,null);else ne.map=z,B()});B()})}catch(G){let Q=[];try{_u(Q,A,{},T,XS)}catch{}let re=_o(G,e,H,void 0,"");u(E,{command:"error",flags:Q,error:re},()=>{re.detail=H.load(re.detail),V(tl("Transform failed",[re],[]),null)})}};if((typeof j==="string"||j instanceof Uint8Array)&&j.length>1048576){let N=O;O=()=>I.writeFile(j,N)}O(null)},formatMessages:({callName:w,refs:E,messages:j,options:A,callback:T})=>{if(!A)throw Error(`Missing second argument in ${w}() call`);let I={},V=R(A,I,"kind",se),H=R(A,I,"color",ot),O=R(A,I,"terminalWidth",ko),N=R(A,I,"logStyle",se);if(vt(A,I,`in ${w}() call`),V===void 0)throw Error(`Missing "kind" in ${w}() call`);if(V!=="error"&&V!=="warning")throw Error(`Expected "kind" to be "error" or "warning" in ${w}() call`);let G={command:"format-msgs",messages:cs(j,"messages",null,"",O),isWarning:V==="warning"};if(H!==void 0)G.color=H;if(O!==void 0)G.terminalWidth=O;if(N!==void 0)G.logStyle=N;u(E,G,(Q,re)=>{if(Q)return T(Error(Q),null);T(null,re.messages)})},analyzeMetafile:({callName:w,refs:E,metafile:j,options:A,callback:T})=>{if(A===void 0)A={};let I={},V=R(A,I,"color",ot),H=R(A,I,"verbose",ot);vt(A,I,`in ${w}() call`);let O={command:"analyze-metafile",metafile:j};if(V!==void 0)O.color=V;if(H!==void 0)O.verbose=H;u(E,O,(N,G)=>{if(N)return T(Error(N),null);T(null,G.result)})}}}}function wM(e,t,n,r,s,o,i,a,l,c,u){let d=pw(),p=e==="context",m=(g,x)=>{let P=[];try{_u(P,a,{},l,GS)}catch{}let w=_o(g,o,d,void 0,x);n(s,{command:"error",flags:P,error:w},()=>{w.detail=d.load(w.detail),u(tl(p?"Context failed":"Build failed",[w],[]),null)})},y;if(typeof a==="object"){let g=a.plugins;if(g!==void 0){if(!Array.isArray(g))return m(Error('"plugins" must be an array'),"");y=g}}if(y&&y.length>0){if(o.isSync)return m(Error("Cannot use plugins in synchronous API calls"),"");vM(t,n,r,s,o,i,a,y,d).then((g)=>{if(!g.ok)return m(g.error,g.pluginName);try{S(g.requestPlugins,g.runOnEndCallbacks,g.scheduleOnDisposeCallbacks)}catch(x){m(x,"")}},(g)=>m(g,""));return}try{S(null,(g,x)=>x([],[]),()=>{})}catch(g){m(g,"")}function S(g,x,P){let w=o.hasFS,{entries:E,flags:j,write:A,stdinContents:T,stdinResolveDir:I,absWorkingDir:V,nodePaths:H,mangleCache:O}=$M(e,a,l,GS,w);if(A&&!o.hasFS)throw Error('The "write" option is unavailable in this environment');let N={command:"build",key:t,entries:E,flags:j,write:A,stdinContents:T,stdinResolveDir:I,absWorkingDir:V||c,nodePaths:H,context:p};if(g)N.plugins=g;if(O)N.mangleCache=O;let G=(ue,ne)=>{let fe={errors:vi(ue.errors,d),warnings:vi(ue.warnings,d),outputFiles:void 0,metafile:void 0,mangleCache:void 0},xe=fe.errors.slice(),X=fe.warnings.slice();if(ue.outputFiles)fe.outputFiles=ue.outputFiles.map(jM);if(ue.metafile&&ue.metafile.length)fe.metafile=PM(ue.metafile);if(ue.mangleCache)fe.mangleCache=ue.mangleCache;if(ue.writeToStdout!==void 0)console.log(Co(ue.writeToStdout).replace(/\n$/,""));x(fe,(B,q)=>{if(xe.length>0||B.length>0){let z=tl("Build failed",xe.concat(B),X.concat(q));return ne(z,null,B,q)}ne(null,fe,B,q)})},Q,re;if(p)i["on-end"]=(ue,ne)=>new Promise((fe)=>{G(ne,(xe,X,B,q)=>{let z={errors:B,warnings:q};if(re)re(xe,X);Q=void 0,re=void 0,r(ue,z),fe()})});n(s,N,(ue,ne)=>{if(ue)return u(Error(ue),null);if(!p)return G(ne,(X,B)=>(P(),u(X,B)));if(ne.errors.length>0)return u(tl("Context failed",ne.errors,ne.warnings),null);let fe=!1,xe={rebuild:()=>{if(!Q)Q=new Promise((X,B)=>{let q;re=(We,qe)=>{if(!q)q=()=>We?B(We):X(qe)};let z=()=>{n(s,{command:"rebuild",key:t},(qe,Ye)=>{if(qe)B(Error(qe));else if(q)q();else z()})};z()});return Q},watch:(X={})=>new Promise((B,q)=>{if(!o.hasFS)throw Error('Cannot use the "watch" API in this environment');let z={},We=R(X,z,"delay",ko);vt(X,z,"in watch() call");let qe={command:"watch",key:t};if(We)qe.delay=We;n(s,qe,(Ye)=>{if(Ye)q(Error(Ye));else B(void 0)})}),serve:(X={})=>new Promise((B,q)=>{if(!o.hasFS)throw Error('Cannot use the "serve" API in this environment');let z={},We=R(X,z,"port",mM),qe=R(X,z,"host",se),Ye=R(X,z,"servedir",se),te=R(X,z,"keyfile",se),Ut=R(X,z,"certfile",se),Je=R(X,z,"fallback",se),jt=R(X,z,"cors",Cn),bt=R(X,z,"onRequest",iw);vt(X,z,"in serve() call");let pe={command:"serve",key:t,onRequest:!!bt};if(We!==void 0)pe.port=We;if(qe!==void 0)pe.host=qe;if(Ye!==void 0)pe.servedir=Ye;if(te!==void 0)pe.keyfile=te;if(Ut!==void 0)pe.certfile=Ut;if(Je!==void 0)pe.fallback=Je;if(jt){let ct={},Se=R(jt,ct,"origin",lw);if(vt(jt,ct,'on "cors" object'),Array.isArray(Se))pe.corsOrigin=Se;else if(Se!==void 0)pe.corsOrigin=[Se]}n(s,pe,(ct,Se)=>{if(ct)return q(Error(ct));if(bt)i["serve-request"]=(Ze,Nt)=>{bt(Nt.args),r(Ze,{})};B(Se)})}),cancel:()=>new Promise((X)=>{if(fe)return X();n(s,{command:"cancel",key:t},()=>{X()})}),dispose:()=>new Promise((X)=>{if(fe)return X();fe=!0,n(s,{command:"dispose",key:t},()=>{X(),P(),s.unref()})})};s.ref(),u(null,xe)})}}var vM=async(e,t,n,r,s,o,i,a,l)=>{let c=[],u=[],d={},p={},m=[],y=0,S=0,g=[],x=!1;a=[...a];for(let E of a){let j={};if(typeof E!=="object")throw Error(`Plugin at index ${S} must be an object`);let A=R(E,j,"name",se);if(typeof A!=="string"||A==="")throw Error(`Plugin at index ${S} is missing a name`);try{let T=R(E,j,"setup",iw);if(typeof T!=="function")throw Error("Plugin is missing a setup function");vt(E,j,`on plugin ${Ct(A)}`);let I={name:A,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};S++;let H=T({initialOptions:i,resolve:(O,N={})=>{if(!x)throw Error('Cannot call "resolve" before plugin setup has completed');if(typeof O!=="string")throw Error("The path to resolve must be a string");let G=Object.create(null),Q=R(N,G,"pluginName",se),re=R(N,G,"importer",se),ue=R(N,G,"namespace",se),ne=R(N,G,"resolveDir",se),fe=R(N,G,"kind",se),xe=R(N,G,"pluginData",Su),X=R(N,G,"with",Cn);return vt(N,G,"in resolve() call"),new Promise((B,q)=>{let z={command:"resolve",path:O,key:e,pluginName:A};if(Q!=null)z.pluginName=Q;if(re!=null)z.importer=re;if(ue!=null)z.namespace=ue;if(ne!=null)z.resolveDir=ne;if(fe!=null)z.kind=fe;else throw Error('Must specify "kind" when calling "resolve"');if(xe!=null)z.pluginData=l.store(xe);if(X!=null)z.with=EM(X,"with");t(r,z,(We,qe)=>{if(We!==null)q(Error(We));else B({errors:vi(qe.errors,l),warnings:vi(qe.warnings,l),path:qe.path,external:qe.external,sideEffects:qe.sideEffects,namespace:qe.namespace,suffix:qe.suffix,pluginData:l.load(qe.pluginData)})})})},onStart(O){let G=bu(Error('This error came from the "onStart" callback registered here:'),s,"onStart");c.push({name:A,callback:O,note:G}),I.onStart=!0},onEnd(O){let G=bu(Error('This error came from the "onEnd" callback registered here:'),s,"onEnd");u.push({name:A,callback:O,note:G}),I.onEnd=!0},onResolve(O,N){let Q=bu(Error('This error came from the "onResolve" callback registered here:'),s,"onResolve"),re={},ue=R(O,re,"filter",wu),ne=R(O,re,"namespace",se);if(vt(O,re,`in onResolve() call for plugin ${Ct(A)}`),ue==null)throw Error("onResolve() call is missing a filter");let fe=y++;d[fe]={name:A,callback:N,note:Q},I.onResolve.push({id:fe,filter:vu(ue),namespace:ne||""})},onLoad(O,N){let Q=bu(Error('This error came from the "onLoad" callback registered here:'),s,"onLoad"),re={},ue=R(O,re,"filter",wu),ne=R(O,re,"namespace",se);if(vt(O,re,`in onLoad() call for plugin ${Ct(A)}`),ue==null)throw Error("onLoad() call is missing a filter");let fe=y++;p[fe]={name:A,callback:N,note:Q},I.onLoad.push({id:fe,filter:vu(ue),namespace:ne||""})},onDispose(O){m.push(O)},esbuild:s.esbuild});if(H)await H;g.push(I)}catch(T){return{ok:!1,error:T,pluginName:A}}}o["on-start"]=async(E,j)=>{l.clear();let A={errors:[],warnings:[]};await Promise.all(c.map(async({name:T,callback:I,note:V})=>{try{let H=await I();if(H!=null){if(typeof H!=="object")throw Error(`Expected onStart() callback in plugin ${Ct(T)} to return an object`);let O={},N=R(H,O,"errors",ls),G=R(H,O,"warnings",ls);if(vt(H,O,`from onStart() callback in plugin ${Ct(T)}`),N!=null)A.errors.push(...cs(N,"errors",l,T,void 0));if(G!=null)A.warnings.push(...cs(G,"warnings",l,T,void 0))}}catch(H){A.errors.push(_o(H,s,l,V&&V(),T))}})),n(E,A)},o["on-resolve"]=async(E,j)=>{let A={},T="",I,V;for(let H of j.ids)try{({name:T,callback:I,note:V}=d[H]);let O=await I({path:j.path,importer:j.importer,namespace:j.namespace,resolveDir:j.resolveDir,kind:j.kind,pluginData:l.load(j.pluginData),with:j.with});if(O!=null){if(typeof O!=="object")throw Error(`Expected onResolve() callback in plugin ${Ct(T)} to return an object`);let N={},G=R(O,N,"pluginName",se),Q=R(O,N,"path",se),re=R(O,N,"namespace",se),ue=R(O,N,"suffix",se),ne=R(O,N,"external",ot),fe=R(O,N,"sideEffects",ot),xe=R(O,N,"pluginData",Su),X=R(O,N,"errors",ls),B=R(O,N,"warnings",ls),q=R(O,N,"watchFiles",mn),z=R(O,N,"watchDirs",mn);if(vt(O,N,`from onResolve() callback in plugin ${Ct(T)}`),A.id=H,G!=null)A.pluginName=G;if(Q!=null)A.path=Q;if(re!=null)A.namespace=re;if(ue!=null)A.suffix=ue;if(ne!=null)A.external=ne;if(fe!=null)A.sideEffects=fe;if(xe!=null)A.pluginData=l.store(xe);if(X!=null)A.errors=cs(X,"errors",l,T,void 0);if(B!=null)A.warnings=cs(B,"warnings",l,T,void 0);if(q!=null)A.watchFiles=$u(q,"watchFiles");if(z!=null)A.watchDirs=$u(z,"watchDirs");break}}catch(O){A={id:H,errors:[_o(O,s,l,V&&V(),T)]};break}n(E,A)},o["on-load"]=async(E,j)=>{let A={},T="",I,V;for(let H of j.ids)try{({name:T,callback:I,note:V}=p[H]);let O=await I({path:j.path,namespace:j.namespace,suffix:j.suffix,pluginData:l.load(j.pluginData),with:j.with});if(O!=null){if(typeof O!=="object")throw Error(`Expected onLoad() callback in plugin ${Ct(T)} to return an object`);let N={},G=R(O,N,"pluginName",se),Q=R(O,N,"contents",cw),re=R(O,N,"resolveDir",se),ue=R(O,N,"pluginData",Su),ne=R(O,N,"loader",se),fe=R(O,N,"errors",ls),xe=R(O,N,"warnings",ls),X=R(O,N,"watchFiles",mn),B=R(O,N,"watchDirs",mn);if(vt(O,N,`from onLoad() callback in plugin ${Ct(T)}`),A.id=H,G!=null)A.pluginName=G;if(Q instanceof Uint8Array)A.contents=Q;else if(Q!=null)A.contents=lr(Q);if(re!=null)A.resolveDir=re;if(ue!=null)A.pluginData=l.store(ue);if(ne!=null)A.loader=ne;if(fe!=null)A.errors=cs(fe,"errors",l,T,void 0);if(xe!=null)A.warnings=cs(xe,"warnings",l,T,void 0);if(X!=null)A.watchFiles=$u(X,"watchFiles");if(B!=null)A.watchDirs=$u(B,"watchDirs");break}}catch(O){A={id:H,errors:[_o(O,s,l,V&&V(),T)]};break}n(E,A)};let P=(E,j)=>j([],[]);if(u.length>0)P=(E,j)=>{(async()=>{let A=[],T=[];for(let{name:I,callback:V,note:H}of u){let O,N;try{let G=await V(E);if(G!=null){if(typeof G!=="object")throw Error(`Expected onEnd() callback in plugin ${Ct(I)} to return an object`);let Q={},re=R(G,Q,"errors",ls),ue=R(G,Q,"warnings",ls);if(vt(G,Q,`from onEnd() callback in plugin ${Ct(I)}`),re!=null)O=cs(re,"errors",l,I,void 0);if(ue!=null)N=cs(ue,"warnings",l,I,void 0)}}catch(G){O=[_o(G,s,l,H&&H(),I)]}if(O){A.push(...O);try{E.errors.push(...O)}catch{}}if(N){T.push(...N);try{E.warnings.push(...N)}catch{}}}j(A,T)})()};let w=()=>{for(let E of m)setTimeout(()=>E(),0)};return x=!0,{ok:!0,requestPlugins:g,runOnEndCallbacks:P,scheduleOnDisposeCallbacks:w}};function pw(){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 bu(e,t,n){let r,s=!1;return()=>{if(s)return r;s=!0;try{let o=(e.stack+"").split(`
62
- `);o.splice(1,1);let i=mw(t,o,n);if(i)return r={text:e.message,location:i},r}catch{}}}function _o(e,t,n,r,s){let o="Internal error",i=null;try{o=(e&&e.message||e)+""}catch{}try{i=mw(t,(e.stack+"").split(`
63
- `),"")}catch{}return{id:"",pluginName:s,text:o,location:i,notes:r?[r]:[],detail:n?n.store(e):-1}}function mw(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 l=a.split(/\r\n|\r|\n|\u2028|\u2029/)[+i[2]-1]||"",c=+i[3]-1,u=l.slice(c,c+n.length)===n?n.length:0;return{file:i[1],namespace:"file",line:+i[2],column:lr(l.slice(0,c)).length,length:lr(l.slice(c,c+u)).length,lineText:l+`
60
+ `);function Jw(e,t){return(e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)>>>0}function lg(e,t,n){e[n++]=t,e[n++]=t>>8,e[n++]=t>>16,e[n++]=t>>24}var ls=String.fromCharCode;function Kn(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 ${ls(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 GM(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,l=0;while(l<s){let c=e[l++];if(c<=32)continue;let u;if(i===2&&o===null&&c!==34&&c!==125)Kn(e,--l);switch(c){case 116:{if(e[l++]!==114||e[l++]!==117||e[l++]!==101)Kn(e,--l);u=!0;break}case 102:{if(e[l++]!==97||e[l++]!==108||e[l++]!==115||e[l++]!==101)Kn(e,--l);u=!1;break}case 110:{if(e[l++]!==117||e[l++]!==108||e[l++]!==108)Kn(e,--l);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=l;u=ls(c),c=e[l];while(!0){switch(c){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+=ls(c),c=e[++l];continue}}break}if(u=+u,isNaN(u))Kn(e,--d,"Invalid number");break}case 34:{u="";while(!0){if(l>=s)Kn(e,s);if(c=e[l++],c===34)break;else if(c===92)switch(e[l++]){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+=`
61
+ `;break;case 114:u+="\r";break;case 116:u+="\t";break;case 117:{let d=0;for(let p=0;p<4;p++)if(c=e[l++],d<<=4,c>=48&&c<=57)d|=c-48;else if(c>=97&&c<=102)d|=c+-87;else if(c>=65&&c<=70)d|=c+-55;else Kn(e,--l);u+=ls(d);break}default:Kn(e,--l);break}else if(c<=127)u+=ls(c);else if((c&224)===192)u+=ls((c&31)<<6|e[l++]&63);else if((c&240)===224)u+=ls((c&15)<<12|(e[l++]&63)<<6|e[l++]&63);else if((c&248)==240){let d=(c&7)<<18|(e[l++]&63)<<12|(e[l++]&63)<<6|e[l++]&63;if(d>65535)d-=65536,u+=ls(d>>10&1023|55296),d=56320|d&1023;u+=ls(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)Kn(e,--l);u=a,o=t.pop(),a=n.pop(),i=r.pop();break}case 125:{if(i!==2)Kn(e,--l);u=a,o=t.pop(),a=n.pop(),i=r.pop();break}default:Kn(e,--l)}c=e[l];while(c<=32)c=e[++l];switch(i){case 0:{if(l===s)return u;break}case 1:{if(a.push(u),c===44){l++;continue}if(c===93)continue;break}case 2:{if(o===null){if(o=u,c===58){l++;continue}}else{if(a[o]=u,o=null,c===44){l++;continue}if(c===125)continue}break}}break}Kn(e,l)}var Tt=JSON.stringify,jw="warning",Pw="silent";function _i(e,t){let n=[];for(let r of e){if(gn(r,t),r.indexOf(",")>=0)throw Error(`Invalid ${t}: ${r}`);n.push(r)}return n.join(",")}var Iu=()=>null,ct=(e)=>typeof e==="boolean"?null:"a boolean",oe=(e)=>typeof e==="string"?null:"a string",Du=(e)=>e instanceof RegExp?null:"a RegExp object",To=(e)=>typeof e==="number"&&e===(e|0)?null:"an integer",XM=(e)=>typeof e==="number"&&e===(e|0)&&e>=0&&e<=65535?null:"a valid port number",Mw=(e)=>typeof e==="function"?null:"a function",cs=(e)=>Array.isArray(e)?null:"an array",yn=(e)=>Array.isArray(e)&&e.every((t)=>typeof t==="string")?null:"an array of strings",Nn=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)?null:"an object",YM=(e)=>typeof e==="object"&&e!==null?null:"an array or an object",ZM=(e)=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",kw=(e)=>typeof e==="object"&&!Array.isArray(e)?null:"an object or null",Iw=(e)=>typeof e==="string"||typeof e==="boolean"?null:"a string or a boolean",QM=(e)=>typeof e==="string"||typeof e==="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",Dw=(e)=>typeof e==="string"||Array.isArray(e)&&e.every((t)=>typeof t==="string")?null:"a string or an array of strings",Lw=(e)=>typeof e==="string"||e instanceof Uint8Array?null:"a string or a Uint8Array",eI=(e)=>typeof e==="string"||e instanceof URL?null:"a string or a URL";function T(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(`${Tt(n)} must be ${o}`);return s}function jt(e,t,n){for(let r in e)if(!(r in t))throw Error(`Invalid option ${n}: ${Tt(r)}`)}function tI(e){let t=Object.create(null),n=T(e,t,"wasmURL",eI),r=T(e,t,"wasmModule",ZM),s=T(e,t,"worker",ct);return jt(e,t,"in initialize() call"),{wasmURL:n,wasmModule:r,worker:s}}function Fw(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 ${Tt(n)} in mangle cache to map to either a string or false`)}}return t}function Hu(e,t,n,r,s){let o=T(t,n,"color",ct),i=T(t,n,"logLevel",oe),a=T(t,n,"logLimit",To),l=T(t,n,"logStyle",oe);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}`),l)e.push(`--log-style=${l}`)}function gn(e,t,n){if(typeof e!=="string")throw Error(`Expected value for ${t}${n!==void 0?" "+Tt(n):""} to be a string, got ${typeof e} instead`);return e}function Vw(e,t,n){let r=T(t,n,"legalComments",oe),s=T(t,n,"sourceRoot",oe),o=T(t,n,"sourcesContent",ct),i=T(t,n,"target",Dw),a=T(t,n,"format",oe),l=T(t,n,"globalName",oe),c=T(t,n,"mangleProps",Du),u=T(t,n,"reserveProps",Du),d=T(t,n,"mangleQuoted",ct),p=T(t,n,"minify",ct),m=T(t,n,"minifySyntax",ct),g=T(t,n,"minifyWhitespace",ct),b=T(t,n,"minifyIdentifiers",ct),h=T(t,n,"lineLimit",To),x=T(t,n,"drop",yn),k=T(t,n,"dropLabels",yn),w=T(t,n,"charset",oe),v=T(t,n,"treeShaking",ct),E=T(t,n,"ignoreAnnotations",ct),O=T(t,n,"jsx",oe),I=T(t,n,"jsxFactory",oe),D=T(t,n,"jsxFragment",oe),V=T(t,n,"jsxImportSource",oe),W=T(t,n,"jsxDev",ct),A=T(t,n,"jsxSideEffects",ct),J=T(t,n,"define",Nn),G=T(t,n,"logOverride",Nn),se=T(t,n,"supported",Nn),ie=T(t,n,"pure",yn),le=T(t,n,"keepNames",ct),te=T(t,n,"platform",oe),de=T(t,n,"tsconfigRaw",QM),xe=T(t,n,"absPaths",yn);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=${_i(Array.isArray(i)?i:[i],"target")}`);if(a)e.push(`--format=${a}`);if(l)e.push(`--global-name=${l}`);if(te)e.push(`--platform=${te}`);if(de)e.push(`--tsconfig-raw=${typeof de==="string"?de:JSON.stringify(de)}`);if(p)e.push("--minify");if(m)e.push("--minify-syntax");if(g)e.push("--minify-whitespace");if(b)e.push("--minify-identifiers");if(h)e.push(`--line-limit=${h}`);if(w)e.push(`--charset=${w}`);if(v!==void 0)e.push(`--tree-shaking=${v}`);if(E)e.push("--ignore-annotations");if(x)for(let X of x)e.push(`--drop:${gn(X,"drop")}`);if(k)e.push(`--drop-labels=${_i(k,"drop label")}`);if(xe)e.push(`--abs-paths=${_i(xe,"abs paths")}`);if(c)e.push(`--mangle-props=${Lu(c)}`);if(u)e.push(`--reserve-props=${Lu(u)}`);if(d!==void 0)e.push(`--mangle-quoted=${d}`);if(O)e.push(`--jsx=${O}`);if(I)e.push(`--jsx-factory=${I}`);if(D)e.push(`--jsx-fragment=${D}`);if(V)e.push(`--jsx-import-source=${V}`);if(W)e.push("--jsx-dev");if(A)e.push("--jsx-side-effects");if(J)for(let X in J){if(X.indexOf("=")>=0)throw Error(`Invalid define: ${X}`);e.push(`--define:${X}=${gn(J[X],"define",X)}`)}if(G)for(let X in G){if(X.indexOf("=")>=0)throw Error(`Invalid log override: ${X}`);e.push(`--log-override:${X}=${gn(G[X],"log override",X)}`)}if(se)for(let X in se){if(X.indexOf("=")>=0)throw Error(`Invalid supported: ${X}`);let U=se[X];if(typeof U!=="boolean")throw Error(`Expected value for supported ${Tt(X)} to be a boolean, got ${typeof U} instead`);e.push(`--supported:${X}=${U}`)}if(ie)for(let X of ie)e.push(`--pure:${gn(X,"pure")}`);if(le)e.push("--keep-names")}function nI(e,t,n,r,s){var o;let i=[],a=[],l=Object.create(null),c=null,u=null;Hu(i,t,l,n,r),Vw(i,t,l);let d=T(t,l,"sourcemap",Iw),p=T(t,l,"bundle",ct),m=T(t,l,"splitting",ct),g=T(t,l,"preserveSymlinks",ct),b=T(t,l,"metafile",ct),h=T(t,l,"outfile",oe),x=T(t,l,"outdir",oe),k=T(t,l,"outbase",oe),w=T(t,l,"tsconfig",oe),v=T(t,l,"resolveExtensions",yn),E=T(t,l,"nodePaths",yn),O=T(t,l,"mainFields",yn),I=T(t,l,"conditions",yn),D=T(t,l,"external",yn),V=T(t,l,"packages",oe),W=T(t,l,"alias",Nn),A=T(t,l,"loader",Nn),J=T(t,l,"outExtension",Nn),G=T(t,l,"publicPath",oe),se=T(t,l,"entryNames",oe),ie=T(t,l,"chunkNames",oe),le=T(t,l,"assetNames",oe),te=T(t,l,"inject",yn),de=T(t,l,"banner",Nn),xe=T(t,l,"footer",Nn),X=T(t,l,"entryPoints",YM),U=T(t,l,"absWorkingDir",oe),H=T(t,l,"stdin",Nn),K=(o=T(t,l,"write",ct))!=null?o:s,He=T(t,l,"allowOverwrite",ct),Ve=T(t,l,"mangleCache",Nn);if(l.plugins=!0,jt(t,l,`in ${e}() call`),d)i.push(`--sourcemap${d===!0?"":`=${d}`}`);if(p)i.push("--bundle");if(He)i.push("--allow-overwrite");if(m)i.push("--splitting");if(g)i.push("--preserve-symlinks");if(b)i.push("--metafile");if(h)i.push(`--outfile=${h}`);if(x)i.push(`--outdir=${x}`);if(k)i.push(`--outbase=${k}`);if(w)i.push(`--tsconfig=${w}`);if(V)i.push(`--packages=${V}`);if(v)i.push(`--resolve-extensions=${_i(v,"resolve extension")}`);if(G)i.push(`--public-path=${G}`);if(se)i.push(`--entry-names=${se}`);if(ie)i.push(`--chunk-names=${ie}`);if(le)i.push(`--asset-names=${le}`);if(O)i.push(`--main-fields=${_i(O,"main field")}`);if(I)i.push(`--conditions=${_i(I,"condition")}`);if(D)for(let re of D)i.push(`--external:${gn(re,"external")}`);if(W)for(let re in W){if(re.indexOf("=")>=0)throw Error(`Invalid package name in alias: ${re}`);i.push(`--alias:${re}=${gn(W[re],"alias",re)}`)}if(de)for(let re in de){if(re.indexOf("=")>=0)throw Error(`Invalid banner file type: ${re}`);i.push(`--banner:${re}=${gn(de[re],"banner",re)}`)}if(xe)for(let re in xe){if(re.indexOf("=")>=0)throw Error(`Invalid footer file type: ${re}`);i.push(`--footer:${re}=${gn(xe[re],"footer",re)}`)}if(te)for(let re of te)i.push(`--inject:${gn(re,"inject")}`);if(A)for(let re in A){if(re.indexOf("=")>=0)throw Error(`Invalid loader extension: ${re}`);i.push(`--loader:${re}=${gn(A[re],"loader",re)}`)}if(J)for(let re in J){if(re.indexOf("=")>=0)throw Error(`Invalid out extension: ${re}`);i.push(`--out-extension:${re}=${gn(J[re],"out extension",re)}`)}if(X)if(Array.isArray(X))for(let re=0,Gt=X.length;re<Gt;re++){let Qe=X[re];if(typeof Qe==="object"&&Qe!==null){let ht=Object.create(null),kt=T(Qe,ht,"in",oe),_t=T(Qe,ht,"out",oe);if(jt(Qe,ht,"in entry point at index "+re),kt===void 0)throw Error('Missing property "in" for entry point at index '+re);if(_t===void 0)throw Error('Missing property "out" for entry point at index '+re);a.push([_t,kt])}else a.push(["",gn(Qe,"entry point at index "+re)])}else for(let re in X)a.push([re,gn(X[re],"entry point",re)]);if(H){let re=Object.create(null),Gt=T(H,re,"contents",Lw),Qe=T(H,re,"resolveDir",oe),ht=T(H,re,"sourcefile",oe),kt=T(H,re,"loader",oe);if(jt(H,re,'in "stdin" object'),ht)i.push(`--sourcefile=${ht}`);if(kt)i.push(`--loader=${kt}`);if(Qe)u=Qe;if(typeof Gt==="string")c=dr(Gt);else if(Gt instanceof Uint8Array)c=Gt}let Ze=[];if(E)for(let re of E)re+="",Ze.push(re);return{entries:a,flags:i,write:K,stdinContents:c,stdinResolveDir:u,absWorkingDir:U,nodePaths:Ze,mangleCache:Fw(Ve)}}function rI(e,t,n,r){let s=[],o=Object.create(null);Hu(s,t,o,n,r),Vw(s,t,o);let i=T(t,o,"sourcemap",Iw),a=T(t,o,"sourcefile",oe),l=T(t,o,"loader",oe),c=T(t,o,"banner",oe),u=T(t,o,"footer",oe),d=T(t,o,"mangleCache",Nn);if(jt(t,o,`in ${e}() call`),i)s.push(`--sourcemap=${i===!0?"external":i}`);if(a)s.push(`--sourcefile=${a}`);if(l)s.push(`--loader=${l}`);if(c)s.push(`--banner=${c}`);if(u)s.push(`--footer=${u}`);return{flags:s,mangleCache:Fw(d)}}function qw(e){let t={},n={didClose:!1,reason:""},r={},s=0,o=0,i=new Uint8Array(16384),a=0,l=(w)=>{let v=a+w.length;if(v>i.length){let O=new Uint8Array(v*2);O.set(i),i=O}i.set(w,a),a+=w.length;let E=0;while(E+4<=a){let O=Jw(i,E);if(E+4+O>a)break;E+=4,g(i.subarray(E,E+O)),E+=O}if(E>0)i.copyWithin(0,E,a),a-=E},c=(w)=>{if(n.didClose=!0,w)n.reason=": "+(w.message||w);let v="The service was stopped"+n.reason;for(let E in r)r[E](v,null);r={}},u=(w,v,E)=>{if(n.didClose)return E("The service is no longer running"+n.reason,null);let O=s++;if(r[O]=(I,D)=>{try{E(I,D)}finally{if(w)w.unref()}},w)w.ref();e.writeToStdin(Ew({id:O,isRequest:!0,value:v}))},d=(w,v)=>{if(n.didClose)throw Error("The service is no longer running"+n.reason);e.writeToStdin(Ew({id:w,isRequest:!1,value:v}))},p=async(w,v)=>{try{if(v.command==="ping"){d(w,{});return}if(typeof v.key==="number"){let E=t[v.key];if(!E)return;let O=E[v.command];if(O){await O(w,v);return}}throw Error("Invalid command: "+v.command)}catch(E){let O=[Ro(E,e,null,void 0,"")];try{d(w,{errors:O})}catch{}}},m=!0,g=(w)=>{if(m){m=!1;let E=String.fromCharCode(...w);if(E!=="0.28.2")throw Error(`Cannot start service: Host version "0.28.2" does not match binary version ${Tt(E)}`);return}let v=KM(w);if(v.isRequest)p(v.id,v.value);else{let E=r[v.id];if(delete r[v.id],v.value.error)E(v.value.error,{});else E(null,v.value)}};return{readFromStdout:l,afterClose:c,service:{buildOrContext:({callName:w,refs:v,options:E,isTTY:O,defaultWD:I,callback:D})=>{let V=0,W=o++,A={},J={ref(){if(++V===1){if(v)v.ref()}},unref(){if(--V===0){if(delete t[W],v)v.unref()}}};t[W]=A,J.ref(),sI(w,W,u,d,J,e,A,E,O,I,(G,se)=>{try{D(G,se)}finally{J.unref()}})},transform:({callName:w,refs:v,input:E,options:O,isTTY:I,fs:D,callback:V})=>{let W=Hw(),A=(J)=>{try{if(typeof E!=="string"&&!(E instanceof Uint8Array))throw Error('The input to "transform" must be a string or a Uint8Array');let{flags:G,mangleCache:se}=rI(w,O,I,Pw),ie={command:"transform",flags:G,inputFS:J!==null,input:J!==null?dr(J):typeof E==="string"?dr(E):E};if(se)ie.mangleCache=se;u(v,ie,(le,te)=>{if(le)return V(Error(le),null);let de=Oi(te.errors,W),xe=Oi(te.warnings,W),X=1,U=()=>{if(--X===0){let H={warnings:xe,code:te.code,map:te.map,mangleCache:void 0,legalComments:void 0};if("legalComments"in te)H.legalComments=te==null?void 0:te.legalComments;if(te.mangleCache)H.mangleCache=te==null?void 0:te.mangleCache;V(null,H)}};if(de.length>0)return V(dl("Transform failed",de,xe),null);if(te.codeFS)X++,D.readFile(te.code,(H,K)=>{if(H!==null)V(H,null);else te.code=K,U()});if(te.mapFS)X++,D.readFile(te.map,(H,K)=>{if(H!==null)V(H,null);else te.map=K,U()});U()})}catch(G){let se=[];try{Hu(se,O,{},I,Pw)}catch{}let ie=Ro(G,e,W,void 0,"");u(v,{command:"error",flags:se,error:ie},()=>{ie.detail=W.load(ie.detail),V(dl("Transform failed",[ie],[]),null)})}};if((typeof E==="string"||E instanceof Uint8Array)&&E.length>1048576){let J=A;A=()=>D.writeFile(E,J)}A(null)},formatMessages:({callName:w,refs:v,messages:E,options:O,callback:I})=>{if(!O)throw Error(`Missing second argument in ${w}() call`);let D={},V=T(O,D,"kind",oe),W=T(O,D,"color",ct),A=T(O,D,"terminalWidth",To),J=T(O,D,"logStyle",oe);if(jt(O,D,`in ${w}() call`),V===void 0)throw Error(`Missing "kind" in ${w}() call`);if(V!=="error"&&V!=="warning")throw Error(`Expected "kind" to be "error" or "warning" in ${w}() call`);let G={command:"format-msgs",messages:us(E,"messages",null,"",A),isWarning:V==="warning"};if(W!==void 0)G.color=W;if(A!==void 0)G.terminalWidth=A;if(J!==void 0)G.logStyle=J;u(v,G,(se,ie)=>{if(se)return I(Error(se),null);I(null,ie.messages)})},analyzeMetafile:({callName:w,refs:v,metafile:E,options:O,callback:I})=>{if(O===void 0)O={};let D={},V=T(O,D,"color",ct),W=T(O,D,"verbose",ct);jt(O,D,`in ${w}() call`);let A={command:"analyze-metafile",metafile:E};if(V!==void 0)A.color=V;if(W!==void 0)A.verbose=W;u(v,A,(J,G)=>{if(J)return I(Error(J),null);I(null,G.result)})}}}}function sI(e,t,n,r,s,o,i,a,l,c,u){let d=Hw(),p=e==="context",m=(h,x)=>{let k=[];try{Hu(k,a,{},l,jw)}catch{}let w=Ro(h,o,d,void 0,x);n(s,{command:"error",flags:k,error:w},()=>{w.detail=d.load(w.detail),u(dl(p?"Context failed":"Build failed",[w],[]),null)})},g;if(typeof a==="object"){let h=a.plugins;if(h!==void 0){if(!Array.isArray(h))return m(Error('"plugins" must be an array'),"");g=h}}if(g&&g.length>0){if(o.isSync)return m(Error("Cannot use plugins in synchronous API calls"),"");oI(t,n,r,s,o,i,a,g,d).then((h)=>{if(!h.ok)return m(h.error,h.pluginName);try{b(h.requestPlugins,h.runOnEndCallbacks,h.scheduleOnDisposeCallbacks)}catch(x){m(x,"")}},(h)=>m(h,""));return}try{b(null,(h,x)=>x([],[]),()=>{})}catch(h){m(h,"")}function b(h,x,k){let w=o.hasFS,{entries:v,flags:E,write:O,stdinContents:I,stdinResolveDir:D,absWorkingDir:V,nodePaths:W,mangleCache:A}=nI(e,a,l,jw,w);if(O&&!o.hasFS)throw Error('The "write" option is unavailable in this environment');let J={command:"build",key:t,entries:v,flags:E,write:O,stdinContents:I,stdinResolveDir:D,absWorkingDir:V||c,nodePaths:W,context:p};if(h)J.plugins=h;if(A)J.mangleCache=A;let G=(le,te)=>{let de={errors:Oi(le.errors,d),warnings:Oi(le.warnings,d),outputFiles:void 0,metafile:void 0,mangleCache:void 0},xe=de.errors.slice(),X=de.warnings.slice();if(le.outputFiles)de.outputFiles=le.outputFiles.map(aI);if(le.metafile&&le.metafile.length)de.metafile=lI(le.metafile);if(le.mangleCache)de.mangleCache=le.mangleCache;if(le.writeToStdout!==void 0)console.log(Mo(le.writeToStdout).replace(/\n$/,""));x(de,(U,H)=>{if(xe.length>0||U.length>0){let K=dl("Build failed",xe.concat(U),X.concat(H));return te(K,null,U,H)}te(null,de,U,H)})},se,ie;if(p)i["on-end"]=(le,te)=>new Promise((de)=>{G(te,(xe,X,U,H)=>{let K={errors:U,warnings:H};if(ie)ie(xe,X);se=void 0,ie=void 0,r(le,K),de()})});n(s,J,(le,te)=>{if(le)return u(Error(le),null);if(!p)return G(te,(X,U)=>(k(),u(X,U)));if(te.errors.length>0)return u(dl("Context failed",te.errors,te.warnings),null);let de=!1,xe={rebuild:()=>{if(!se)se=new Promise((X,U)=>{let H;ie=(He,Ve)=>{if(!H)H=()=>He?U(He):X(Ve)};let K=()=>{n(s,{command:"rebuild",key:t},(Ve,Ze)=>{if(Ve)U(Error(Ve));else if(H)H();else K()})};K()});return se},watch:(X={})=>new Promise((U,H)=>{if(!o.hasFS)throw Error('Cannot use the "watch" API in this environment');let K={},He=T(X,K,"delay",To);jt(X,K,"in watch() call");let Ve={command:"watch",key:t};if(He)Ve.delay=He;n(s,Ve,(Ze)=>{if(Ze)H(Error(Ze));else U(void 0)})}),serve:(X={})=>new Promise((U,H)=>{if(!o.hasFS)throw Error('Cannot use the "serve" API in this environment');let K={},He=T(X,K,"port",XM),Ve=T(X,K,"host",oe),Ze=T(X,K,"servedir",oe),re=T(X,K,"keyfile",oe),Gt=T(X,K,"certfile",oe),Qe=T(X,K,"fallback",oe),ht=T(X,K,"cors",Nn),kt=T(X,K,"onRequest",Mw);jt(X,K,"in serve() call");let _t={command:"serve",key:t,onRequest:!!kt};if(He!==void 0)_t.port=He;if(Ve!==void 0)_t.host=Ve;if(Ze!==void 0)_t.servedir=Ze;if(re!==void 0)_t.keyfile=re;if(Gt!==void 0)_t.certfile=Gt;if(Qe!==void 0)_t.fallback=Qe;if(ht){let We={},Pe=T(ht,We,"origin",Dw);if(jt(ht,We,'on "cors" object'),Array.isArray(Pe))_t.corsOrigin=Pe;else if(Pe!==void 0)_t.corsOrigin=[Pe]}n(s,_t,(We,Pe)=>{if(We)return H(Error(We));if(kt)i["serve-request"]=(Ln,me)=>{kt(me.args),r(Ln,{})};U(Pe)})}),cancel:()=>new Promise((X)=>{if(de)return X();n(s,{command:"cancel",key:t},()=>{X()})}),dispose:()=>new Promise((X)=>{if(de)return X();de=!0,n(s,{command:"dispose",key:t},()=>{X(),k(),s.unref()})})};s.ref(),u(null,xe)})}}var oI=async(e,t,n,r,s,o,i,a,l)=>{let c=[],u=[],d={},p={},m=[],g=0,b=0,h=[],x=!1;a=[...a];for(let v of a){let E={};if(typeof v!=="object")throw Error(`Plugin at index ${b} must be an object`);let O=T(v,E,"name",oe);if(typeof O!=="string"||O==="")throw Error(`Plugin at index ${b} is missing a name`);try{let I=T(v,E,"setup",Mw);if(typeof I!=="function")throw Error("Plugin is missing a setup function");jt(v,E,`on plugin ${Tt(O)}`);let D={name:O,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};b++;let W=I({initialOptions:i,resolve:(A,J={})=>{if(!x)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 G=Object.create(null),se=T(J,G,"pluginName",oe),ie=T(J,G,"importer",oe),le=T(J,G,"namespace",oe),te=T(J,G,"resolveDir",oe),de=T(J,G,"kind",oe),xe=T(J,G,"pluginData",Iu),X=T(J,G,"with",Nn);return jt(J,G,"in resolve() call"),new Promise((U,H)=>{let K={command:"resolve",path:A,key:e,pluginName:O};if(se!=null)K.pluginName=se;if(ie!=null)K.importer=ie;if(le!=null)K.namespace=le;if(te!=null)K.resolveDir=te;if(de!=null)K.kind=de;else throw Error('Must specify "kind" when calling "resolve"');if(xe!=null)K.pluginData=l.store(xe);if(X!=null)K.with=iI(X,"with");t(r,K,(He,Ve)=>{if(He!==null)H(Error(He));else U({errors:Oi(Ve.errors,l),warnings:Oi(Ve.warnings,l),path:Ve.path,external:Ve.external,sideEffects:Ve.sideEffects,namespace:Ve.namespace,suffix:Ve.suffix,pluginData:l.load(Ve.pluginData)})})})},onStart(A){let G=Ju(Error('This error came from the "onStart" callback registered here:'),s,"onStart");c.push({name:O,callback:A,note:G}),D.onStart=!0},onEnd(A){let G=Ju(Error('This error came from the "onEnd" callback registered here:'),s,"onEnd");u.push({name:O,callback:A,note:G}),D.onEnd=!0},onResolve(A,J){let se=Ju(Error('This error came from the "onResolve" callback registered here:'),s,"onResolve"),ie={},le=T(A,ie,"filter",Du),te=T(A,ie,"namespace",oe);if(jt(A,ie,`in onResolve() call for plugin ${Tt(O)}`),le==null)throw Error("onResolve() call is missing a filter");let de=g++;d[de]={name:O,callback:J,note:se},D.onResolve.push({id:de,filter:Lu(le),namespace:te||""})},onLoad(A,J){let se=Ju(Error('This error came from the "onLoad" callback registered here:'),s,"onLoad"),ie={},le=T(A,ie,"filter",Du),te=T(A,ie,"namespace",oe);if(jt(A,ie,`in onLoad() call for plugin ${Tt(O)}`),le==null)throw Error("onLoad() call is missing a filter");let de=g++;p[de]={name:O,callback:J,note:se},D.onLoad.push({id:de,filter:Lu(le),namespace:te||""})},onDispose(A){m.push(A)},esbuild:s.esbuild});if(W)await W;h.push(D)}catch(I){return{ok:!1,error:I,pluginName:O}}}o["on-start"]=async(v,E)=>{l.clear();let O={errors:[],warnings:[]};await Promise.all(c.map(async({name:I,callback:D,note:V})=>{try{let W=await D();if(W!=null){if(typeof W!=="object")throw Error(`Expected onStart() callback in plugin ${Tt(I)} to return an object`);let A={},J=T(W,A,"errors",cs),G=T(W,A,"warnings",cs);if(jt(W,A,`from onStart() callback in plugin ${Tt(I)}`),J!=null)O.errors.push(...us(J,"errors",l,I,void 0));if(G!=null)O.warnings.push(...us(G,"warnings",l,I,void 0))}}catch(W){O.errors.push(Ro(W,s,l,V&&V(),I))}})),n(v,O)},o["on-resolve"]=async(v,E)=>{let O={},I="",D,V;for(let W of E.ids)try{({name:I,callback:D,note:V}=d[W]);let A=await D({path:E.path,importer:E.importer,namespace:E.namespace,resolveDir:E.resolveDir,kind:E.kind,pluginData:l.load(E.pluginData),with:E.with});if(A!=null){if(typeof A!=="object")throw Error(`Expected onResolve() callback in plugin ${Tt(I)} to return an object`);let J={},G=T(A,J,"pluginName",oe),se=T(A,J,"path",oe),ie=T(A,J,"namespace",oe),le=T(A,J,"suffix",oe),te=T(A,J,"external",ct),de=T(A,J,"sideEffects",ct),xe=T(A,J,"pluginData",Iu),X=T(A,J,"errors",cs),U=T(A,J,"warnings",cs),H=T(A,J,"watchFiles",yn),K=T(A,J,"watchDirs",yn);if(jt(A,J,`from onResolve() callback in plugin ${Tt(I)}`),O.id=W,G!=null)O.pluginName=G;if(se!=null)O.path=se;if(ie!=null)O.namespace=ie;if(le!=null)O.suffix=le;if(te!=null)O.external=te;if(de!=null)O.sideEffects=de;if(xe!=null)O.pluginData=l.store(xe);if(X!=null)O.errors=us(X,"errors",l,I,void 0);if(U!=null)O.warnings=us(U,"warnings",l,I,void 0);if(H!=null)O.watchFiles=Mu(H,"watchFiles");if(K!=null)O.watchDirs=Mu(K,"watchDirs");break}}catch(A){O={id:W,errors:[Ro(A,s,l,V&&V(),I)]};break}n(v,O)},o["on-load"]=async(v,E)=>{let O={},I="",D,V;for(let W of E.ids)try{({name:I,callback:D,note:V}=p[W]);let A=await D({path:E.path,namespace:E.namespace,suffix:E.suffix,pluginData:l.load(E.pluginData),with:E.with});if(A!=null){if(typeof A!=="object")throw Error(`Expected onLoad() callback in plugin ${Tt(I)} to return an object`);let J={},G=T(A,J,"pluginName",oe),se=T(A,J,"contents",Lw),ie=T(A,J,"resolveDir",oe),le=T(A,J,"pluginData",Iu),te=T(A,J,"loader",oe),de=T(A,J,"errors",cs),xe=T(A,J,"warnings",cs),X=T(A,J,"watchFiles",yn),U=T(A,J,"watchDirs",yn);if(jt(A,J,`from onLoad() callback in plugin ${Tt(I)}`),O.id=W,G!=null)O.pluginName=G;if(se instanceof Uint8Array)O.contents=se;else if(se!=null)O.contents=dr(se);if(ie!=null)O.resolveDir=ie;if(le!=null)O.pluginData=l.store(le);if(te!=null)O.loader=te;if(de!=null)O.errors=us(de,"errors",l,I,void 0);if(xe!=null)O.warnings=us(xe,"warnings",l,I,void 0);if(X!=null)O.watchFiles=Mu(X,"watchFiles");if(U!=null)O.watchDirs=Mu(U,"watchDirs");break}}catch(A){O={id:W,errors:[Ro(A,s,l,V&&V(),I)]};break}n(v,O)};let k=(v,E)=>E([],[]);if(u.length>0)k=(v,E)=>{(async()=>{let O=[],I=[];for(let{name:D,callback:V,note:W}of u){let A,J;try{let G=await V(v);if(G!=null){if(typeof G!=="object")throw Error(`Expected onEnd() callback in plugin ${Tt(D)} to return an object`);let se={},ie=T(G,se,"errors",cs),le=T(G,se,"warnings",cs);if(jt(G,se,`from onEnd() callback in plugin ${Tt(D)}`),ie!=null)A=us(ie,"errors",l,D,void 0);if(le!=null)J=us(le,"warnings",l,D,void 0)}}catch(G){A=[Ro(G,s,l,W&&W(),D)]}if(A){O.push(...A);try{v.errors.push(...A)}catch{}}if(J){I.push(...J);try{v.warnings.push(...J)}catch{}}}E(O,I)})()};let w=()=>{for(let v of m)setTimeout(()=>v(),0)};return x=!0,{ok:!0,requestPlugins:h,runOnEndCallbacks:k,scheduleOnDisposeCallbacks:w}};function Hw(){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 Ju(e,t,n){let r,s=!1;return()=>{if(s)return r;s=!0;try{let o=(e.stack+"").split(`
62
+ `);o.splice(1,1);let i=Ww(t,o,n);if(i)return r={text:e.message,location:i},r}catch{}}}function Ro(e,t,n,r,s){let o="Internal error",i=null;try{o=(e&&e.message||e)+""}catch{}try{i=Ww(t,(e.stack+"").split(`
63
+ `),"")}catch{}return{id:"",pluginName:s,text:o,location:i,notes:r?[r]:[],detail:n?n.store(e):-1}}function Ww(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 l=a.split(/\r\n|\r|\n|\u2028|\u2029/)[+i[2]-1]||"",c=+i[3]-1,u=l.slice(c,c+n.length)===n?n.length:0;return{file:i[1],namespace:"file",line:+i[2],column:dr(l.slice(0,c)).length,length:dr(l.slice(c,c+u)).length,lineText:l+`
64
64
  `+t.slice(1).join(`
65
- `),suggestion:""}}break}}return null}function tl(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
+ `),suggestion:""}}break}}return null}function dl(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`
66
66
  ...`;if(!o.location)return`
67
67
  error: ${o.text}`;let{file:a,line:l,column:c}=o.location,u=o.pluginName?`[plugin: ${o.pluginName}] `:"";return`
68
- ${a}:${l}:${c}: 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 vi(e,t){for(let n of e)n.detail=t.load(n.detail);return e}function ZS(e,t,n){if(e==null)return null;let r={},s=R(e,r,"file",se),o=R(e,r,"namespace",se),i=R(e,r,"line",ko),a=R(e,r,"column",ko),l=R(e,r,"length",ko),c=R(e,r,"lineText",se),u=R(e,r,"suggestion",se);if(vt(e,r,t),c){let d=c.slice(0,(a&&a>0?a:0)+(l&&l>0?l:0)+(n&&n>0?n:80));if(!/[\x7F-\uFFFF]/.test(d)&&!/\n/.test(c))c=d}return{file:s||"",namespace:o||"",line:i||0,column:a||0,length:l||0,lineText:c||"",suggestion:u||""}}function cs(e,t,n,r,s){let o=[],i=0;for(let a of e){let l={},c=R(a,l,"id",se),u=R(a,l,"pluginName",se),d=R(a,l,"text",se),p=R(a,l,"location",YS),m=R(a,l,"notes",ls),y=R(a,l,"detail",Su),S=`in element ${i} of "${t}"`;vt(a,l,S);let g=[];if(m)for(let x of m){let P={},w=R(x,P,"text",se),E=R(x,P,"location",YS);vt(x,P,S),g.push({text:w||"",location:ZS(E,S,s)})}o.push({id:c||"",pluginName:u||r,text:d||"",location:ZS(p,S,s),notes:g,detail:n?n.store(y):-1}),i++}return o}function $u(e,t){let n=[];for(let r of e){if(typeof r!=="string")throw Error(`${Ct(t)} must be an array of strings`);n.push(r)}return n}function EM(e,t){let n=Object.create(null);for(let r in e){let s=e[r];if(typeof s!=="string")throw Error(`key ${Ct(r)} in object ${Ct(t)} must be a string`);n[r]=s}return n}function jM({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=Co(s);return r}}}function vu(e){let t=e.source;if(e.flags)t=`(?${e.flags})${t}`;return t}function PM(e){let t;try{t=Co(e)}catch{return pM(e)}return JSON.parse(t)}var Rs=pt("fs"),QS=pt("os"),Wn=pt("path"),Si=process.env.ESBUILD_BINARY_PATH||Si,_M=(e)=>!!e&&e!=="/usr/bin/esbuild",ew="@esbuild/darwin-arm64",tw="@esbuild/darwin-x64",Eu={"win32 arm64 LE":"@esbuild/win32-arm64","win32 ia32 LE":"@esbuild/win32-ia32","win32 x64 LE":"@esbuild/win32-x64"},ju={"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"},nw={"android arm LE":"@esbuild/android-arm","android x64 LE":"@esbuild/android-x64","openharmony arm64 LE":"@esbuild/openharmony-arm64"};function kM(){let e,t,n=!1,r=`${process.platform} ${QS.arch()} ${QS.endianness()}`;if(r in Eu)e=Eu[r],t="esbuild.exe";else if(r in ju)e=ju[r],t="bin/esbuild";else if(r in nw)e=nw[r],t="bin/esbuild",n=!0;else throw Error(`Unsupported platform: ${r}`);return{pkg:e,subpath:t,isWASM:n}}function OM(){let e=pt.resolve("esbuild"),t=Wn.dirname(Wn.dirname(Wn.dirname(e)));if(Wn.basename(t)==="node_modules"){for(let n in ju)try{let r=ju[n];if(Rs.existsSync(Wn.join(t,r)))return r}catch{}for(let n in Eu)try{let r=Eu[n];if(Rs.existsSync(Wn.join(t,r)))return r}catch{}}return null}function AM(e,t){let n=Wn.dirname(pt.resolve("esbuild"));return Wn.join(n,`downloaded-${e.replace("/","-")}-${Wn.basename(t)}`)}function CM(){if(_M(Si))if(!Rs.existsSync(Si))console.warn(`[esbuild] Ignoring bad configuration: ESBUILD_BINARY_PATH=${Si}`);else return{binPath:Si,isWASM:!1};let{pkg:e,subpath:t,isWASM:n}=kM(),r;try{r=pt.resolve(`${e}/${t}`)}catch(s){if(r=AM(e,t),!Rs.existsSync(r)){try{pt.resolve(e)}catch{let o=OM();if(o){let i=`
68
+ ${a}:${l}:${c}: 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 Oi(e,t){for(let n of e)n.detail=t.load(n.detail);return e}function _w(e,t,n){if(e==null)return null;let r={},s=T(e,r,"file",oe),o=T(e,r,"namespace",oe),i=T(e,r,"line",To),a=T(e,r,"column",To),l=T(e,r,"length",To),c=T(e,r,"lineText",oe),u=T(e,r,"suggestion",oe);if(jt(e,r,t),c){let d=c.slice(0,(a&&a>0?a:0)+(l&&l>0?l:0)+(n&&n>0?n:80));if(!/[\x7F-\uFFFF]/.test(d)&&!/\n/.test(c))c=d}return{file:s||"",namespace:o||"",line:i||0,column:a||0,length:l||0,lineText:c||"",suggestion:u||""}}function us(e,t,n,r,s){let o=[],i=0;for(let a of e){let l={},c=T(a,l,"id",oe),u=T(a,l,"pluginName",oe),d=T(a,l,"text",oe),p=T(a,l,"location",kw),m=T(a,l,"notes",cs),g=T(a,l,"detail",Iu),b=`in element ${i} of "${t}"`;jt(a,l,b);let h=[];if(m)for(let x of m){let k={},w=T(x,k,"text",oe),v=T(x,k,"location",kw);jt(x,k,b),h.push({text:w||"",location:_w(v,b,s)})}o.push({id:c||"",pluginName:u||r,text:d||"",location:_w(p,b,s),notes:h,detail:n?n.store(g):-1}),i++}return o}function Mu(e,t){let n=[];for(let r of e){if(typeof r!=="string")throw Error(`${Tt(t)} must be an array of strings`);n.push(r)}return n}function iI(e,t){let n=Object.create(null);for(let r in e){let s=e[r];if(typeof s!=="string")throw Error(`key ${Tt(r)} in object ${Tt(t)} must be a string`);n[r]=s}return n}function aI({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=Mo(s);return r}}}function Lu(e){let t=e.source;if(e.flags)t=`(?${e.flags})${t}`;return t}function lI(e){let t;try{t=Mo(e)}catch{return GM(e)}return JSON.parse(t)}var Js=yt("fs"),Ow=yt("os"),Gn=yt("path"),ki=process.env.ESBUILD_BINARY_PATH||ki,cI=(e)=>!!e&&e!=="/usr/bin/esbuild",Aw="@esbuild/darwin-arm64",Cw="@esbuild/darwin-x64",Fu={"win32 arm64 LE":"@esbuild/win32-arm64","win32 ia32 LE":"@esbuild/win32-ia32","win32 x64 LE":"@esbuild/win32-x64"},Vu={"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"},Rw={"android arm LE":"@esbuild/android-arm","android x64 LE":"@esbuild/android-x64","openharmony arm64 LE":"@esbuild/openharmony-arm64"};function uI(){let e,t,n=!1,r=`${process.platform} ${Ow.arch()} ${Ow.endianness()}`;if(r in Fu)e=Fu[r],t="esbuild.exe";else if(r in Vu)e=Vu[r],t="bin/esbuild";else if(r in Rw)e=Rw[r],t="bin/esbuild",n=!0;else throw Error(`Unsupported platform: ${r}`);return{pkg:e,subpath:t,isWASM:n}}function fI(){let e=yt.resolve("esbuild"),t=Gn.dirname(Gn.dirname(Gn.dirname(e)));if(Gn.basename(t)==="node_modules"){for(let n in Vu)try{let r=Vu[n];if(Js.existsSync(Gn.join(t,r)))return r}catch{}for(let n in Fu)try{let r=Fu[n];if(Js.existsSync(Gn.join(t,r)))return r}catch{}}return null}function dI(e,t){let n=Gn.dirname(yt.resolve("esbuild"));return Gn.join(n,`downloaded-${e.replace("/","-")}-${Gn.basename(t)}`)}function pI(){if(cI(ki))if(!Js.existsSync(ki))console.warn(`[esbuild] Ignoring bad configuration: ESBUILD_BINARY_PATH=${ki}`);else return{binPath:ki,isWASM:!1};let{pkg:e,subpath:t,isWASM:n}=uI(),r;try{r=yt.resolve(`${e}/${t}`)}catch(s){if(r=dI(e,t),!Js.existsSync(r)){try{yt.resolve(e)}catch{let o=fI();if(o){let i=`
69
69
  Specifically the "${o}" package is present but this platform
70
70
  needs the "${e}" package instead. People often get into this
71
71
  situation by installing esbuild on Windows or macOS and copying "node_modules"
@@ -82,7 +82,7 @@ If you are installing with yarn, you can try listing both this platform and the
82
82
  other platform in your ".yarnrc.yml" file using the "supportedArchitectures"
83
83
  feature: https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
84
84
  Keep in mind that this means multiple copies of esbuild will be present.
85
- `;if(e===tw&&o===ew||e===ew&&o===tw)i=`
85
+ `;if(e===Cw&&o===Aw||e===Aw&&o===Cw)i=`
86
86
  Specifically the "${o}" package is present but this platform
87
87
  needs the "${e}" package instead. People often get into this
88
88
  situation by installing esbuild with npm running inside of Rosetta 2 and then
@@ -114,43 +114,113 @@ want to do that.
114
114
  If you are installing esbuild with npm, make sure that you don't specify the
115
115
  "--no-optional" or "--omit=optional" flags. The "optionalDependencies" feature
116
116
  of "package.json" is used by esbuild to install the correct binary executable
117
- 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=Wn.join(o,"node_modules",".cache","esbuild",`pnpapi-${e.replace("/","-")}-0.28.2-${Wn.basename(t)}`);if(!Rs.existsSync(i))Rs.mkdirSync(Wn.dirname(i),{recursive:!0}),Rs.copyFileSync(r,i),Rs.chmodSync(i,493);return{binPath:i,isWASM:n}}}return{binPath:r,isWASM:n}}var hw=pt("child_process"),RM=pt("crypto"),$m=pt("path"),Oo=pt("fs"),NM=pt("os"),TM=pt("tty"),nn;if(process.env.ESBUILD_WORKER_THREADS!=="0"){try{nn=pt("worker_threads")}catch{}let[e,t]=process.versions.node.split(".");if(+e<12||+e===12&&+t<17||+e===13&&+t<13)nn=void 0}var rw,sl=((rw=nn==null?void 0:nn.workerData)==null?void 0:rw.esbuildVersion)==="0.28.2",gw=()=>{if((!Si||!1)&&($m.basename(__filename)!=="main.js"||$m.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
+ 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=Gn.join(o,"node_modules",".cache","esbuild",`pnpapi-${e.replace("/","-")}-0.28.2-${Gn.basename(t)}`);if(!Js.existsSync(i))Js.mkdirSync(Gn.dirname(i),{recursive:!0}),Js.copyFileSync(r,i),Js.chmodSync(i,493);return{binPath:i,isWASM:n}}}return{binPath:r,isWASM:n}}var Bw=yt("child_process"),mI=yt("crypto"),cg=yt("path"),No=yt("fs"),hI=yt("os"),gI=yt("tty"),sn;if(process.env.ESBUILD_WORKER_THREADS!=="0"){try{sn=yt("worker_threads")}catch{}let[e,t]=process.versions.node.split(".");if(+e<12||+e===12&&+t<17||+e===13&&+t<13)sn=void 0}var Tw,hl=((Tw=sn==null?void 0:sn.workerData)==null?void 0:Tw.esbuildVersion)==="0.28.2",Uw=()=>{if((!ki||!1)&&(cg.basename(__filename)!=="main.js"||cg.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.
118
118
 
119
- 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}=CM();if(t)return["node",[e]];else return[e,[]]}},nl=()=>TM.isatty(2),JM={readFile(e,t){try{let n=Oo.readFileSync(e,"utf8");try{Oo.unlinkSync(e)}catch{}t(null,n)}catch(n){t(n,null)}},writeFile(e,t){try{let n=yw();Oo.writeFileSync(n,e),t(n)}catch{t(null)}}},MM={readFile(e,t){try{Oo.readFile(e,"utf8",(n,r)=>{try{Oo.unlink(e,()=>t(n,r))}catch{t(n,r)}})}catch(n){t(n,null)}},writeFile(e,t){try{let n=yw();Oo.writeFile(n,e,(r)=>r!==null?t(null):t(n))}catch{t(null)}}},IM="0.28.2",DM=(e)=>Ro().build(e),LM=(e)=>Ro().context(e),FM=(e,t)=>Ro().transform(e,t),VM=(e,t)=>Ro().formatMessages(e,t),qM=(e,t)=>Ro().analyzeMetafile(e,t),HM=(e)=>{if(nn&&!sl){if(!rn)rn=Ou(nn);return rn.buildSync(e)}let t;return ku((n)=>n.buildOrContext({callName:"buildSync",refs:null,options:e,isTTY:nl(),defaultWD:Ao,callback:(r,s)=>{if(r)throw r;t=s}})),t},WM=(e,t)=>{if(nn&&!sl){if(!rn)rn=Ou(nn);return rn.transformSync(e,t)}let n;return ku((r)=>r.transform({callName:"transformSync",refs:null,input:e,options:t||{},isTTY:nl(),fs:JM,callback:(s,o)=>{if(s)throw s;n=o}})),n},BM=(e,t)=>{if(nn&&!sl){if(!rn)rn=Ou(nn);return rn.formatMessagesSync(e,t)}let n;return ku((r)=>r.formatMessages({callName:"formatMessagesSync",refs:null,messages:e,options:t,callback:(s,o)=>{if(s)throw s;n=o}})),n},UM=(e,t)=>{if(nn&&!sl){if(!rn)rn=Ou(nn);return rn.analyzeMetafileSync(e,t)}let n;return ku((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},zM=()=>{if(Pu)Pu();if(rn)rn.stop();return Promise.resolve()},Sm=!1,KM=(e)=>{if(e=bM(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(Sm)throw Error('Cannot call "initialize" more than once');return Ro(),Sm=!0,Promise.resolve()},Ao=process.cwd(),el,Pu,Ro=()=>{if(el)return el;let[e,t]=gw(),n=hw.spawn(e,t.concat("--service=0.28.2","--ping"),{windowsHide:!0,stdio:["pipe","pipe","inherit"],cwd:Ao}),{readFromStdout:r,afterClose:s,service:o}=dw({writeToStdin(u){n.stdin.write(u,(d)=>{if(d)s(d)})},readFileSync:Oo.readFileSync,isSync:!1,hasFS:!0,esbuild:rl});n.stdin.on("error",s),n.on("error",s);let{stdin:i,stdout:a}=n;a.on("data",r),a.on("end",s),Pu=()=>{i.destroy(),a.destroy(),n.kill(),Sm=!1,el=void 0,Pu=void 0};let l=0;if(n.unref(),i.unref)i.unref();if(a.unref)a.unref();let c={ref(){if(++l===1)n.ref()},unref(){if(--l===0)n.unref()}};return el={build:(u)=>new Promise((d,p)=>{o.buildOrContext({callName:"build",refs:c,options:u,isTTY:nl(),defaultWD:Ao,callback:(m,y)=>m?p(m):d(y)})}),context:(u)=>new Promise((d,p)=>o.buildOrContext({callName:"context",refs:c,options:u,isTTY:nl(),defaultWD:Ao,callback:(m,y)=>m?p(m):d(y)})),transform:(u,d)=>new Promise((p,m)=>o.transform({callName:"transform",refs:c,input:u,options:d||{},isTTY:nl(),fs:MM,callback:(y,S)=>y?m(y):p(S)})),formatMessages:(u,d)=>new Promise((p,m)=>o.formatMessages({callName:"formatMessages",refs:c,messages:u,options:d,callback:(y,S)=>y?m(y):p(S)})),analyzeMetafile:(u,d)=>new Promise((p,m)=>o.analyzeMetafile({callName:"analyzeMetafile",refs:c,metafile:typeof u==="string"?u:JSON.stringify(u),options:d,callback:(y,S)=>y?m(y):p(S)}))},el},ku=(e)=>{let[t,n]=gw(),r=new Uint8Array,{readFromStdout:s,afterClose:o,service:i}=dw({writeToStdin(l){if(r.length!==0)throw Error("Must run at most one command");r=l},isSync:!0,hasFS:!0,esbuild:rl});e(i);let a=hw.execFileSync(t,n.concat("--service=0.28.2"),{cwd:Ao,windowsHide:!0,input:r,maxBuffer:+process.env.ESBUILD_MAX_BUFFER||16777216});s(a),o(null)},yw=()=>$m.join(NM.tmpdir(),`esbuild-${RM.randomBytes(32).toString("hex")}`),rn=null,Ou=(e)=>{let{port1:t,port2:n}=new e.MessageChannel,r=new e.Worker(__filename,{workerData:{workerPort:n,defaultWD:Ao,esbuildVersion:"0.28.2"},transferList:[n],execArgv:[]}),s=0,o=(c)=>{let u=Error(`Build failed with 1 error:
120
- error: ${c}`),d=[{id:"",pluginName:"",text:c,location:null,notes:[],detail:void 0}];return u.errors=d,u.warnings=[],u},i=(c)=>{if(!c)return;let u=c.plugins;if(u&&u.length>0)throw o("Cannot use plugins in synchronous API calls")},a=(c,u)=>{for(let d in u)c[d]=u[d]},l=(c,u)=>{let d=s++,p=new SharedArrayBuffer(8),m=new Int32Array(p),y={sharedBuffer:p,id:d,command:c,args:u};r.postMessage(y);let S=Atomics.wait(m,0,0);if(S!=="ok"&&S!=="not-equal")throw Error("Internal error: Atomics.wait() failed: "+S);let{message:{id:g,resolve:x,reject:P,properties:w}}=e.receiveMessageOnPort(t);if(d!==g)throw Error(`Internal error: Expected id ${d} but got id ${g}`);if(P)throw a(P,w),P;return x};return r.unref(),{buildSync(c){return i(c),l("build",[c])},transformSync(c,u){return l("transform",[c,u])},formatMessagesSync(c,u){return l("formatMessages",[c,u])},analyzeMetafileSync(c,u){return l("analyzeMetafile",[c,u])},stop(){r.terminate(),rn=null}}},GM=()=>{let e=nn.workerData.workerPort,t=nn.parentPort,n=(r)=>{let s={};if(r&&typeof r==="object")for(let o in r)s[o]=r[o];return s};try{let r=Ro();Ao=nn.workerData.defaultWD,t.on("message",(s)=>{(async()=>{let{sharedBuffer:o,id:i,command:a,args:l}=s,c=new Int32Array(o);try{switch(a){case"build":e.postMessage({id:i,resolve:await r.build(l[0])});break;case"transform":e.postMessage({id:i,resolve:await r.transform(l[0],l[1])});break;case"formatMessages":e.postMessage({id:i,resolve:await r.formatMessages(l[0],l[1])});break;case"analyzeMetafile":e.postMessage({id:i,resolve:await r.analyzeMetafile(l[0],l[1])});break;default:throw Error(`Invalid command: ${a}`)}}catch(u){e.postMessage({id:i,reject:u,properties:n(u)})}Atomics.add(c,0,1),Atomics.notify(c,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(sl)GM();var XM=rl});import{createRequire as YM}from"node:module";import{mkdirSync as ZM,writeFileSync as QM}from"node:fs";import{dirname as eI,join as tI}from"node:path";function vm(e,t){return YM(tI(t,"package.json")).resolve(e)}function bw(e){return e==="node"||e==="bun"?"node":"browser"}function nI(e){return new RegExp(`^${e.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}$`)}function rI(e,t){let n=nI(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 Em(e){let t=await Promise.resolve().then(() => Sr(ol(),1)),{entry:n}=e,r={bundle:!0,external:e.external,format:"esm",logLevel:"silent",minify:e.minify,platform:bw(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=[rI(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 $w(e){let t=await Promise.resolve().then(() => Sr(ol(),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:bw(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)=>(ZM(eI(s.path),{recursive:!0}),QM(s.path,s.contents),s.path))}var Sw=()=>{};var ww=".jx-entry-";import{rmSync as oI,writeFileSync as vw}from"node:fs";import{builtinModules as iI}from"node:module";import{tmpdir as aI}from"node:os";import{basename as lI,join as cI,resolve as uI}from"node:path";function Ew(e){return jo(e)||e.startsWith("./")||e.startsWith("../")}function Pm(e,t,n){if(jo(e))return vm(e.slice(hu.length),n);return uI(t,e)}function jw(e,t){return vm(e,t)}function fI(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 pI(e){if(e==="cloudflare-workers"||e==="cloudflare-pages")return{conditions:["workerd","worker"],external:["cloudflare:*","node:*"],plugins:[dI],target:"workerd"};return{target:e==="bun"?"bun":"node"}}function hI(e){return e.minify??e.target==="browser"}function gI(e){let t={};if(e.conditions)t.conditions=e.conditions;if(e.target==="browser")t.define={...mI};return t}function _m(e){return{...gI(e),external:e.external??[],minify:hI(e),plugins:fI(e),target:e.target}}async function Pw(e,t){let n={path:e.entryPath};if(e.contents!==void 0)n.contents=e.contents;let r=await Em({entry:n,..._m(t)});vw(e.outfile,r,"utf8")}async function _w(e,t,n){return $w({entries:e,outdir:t,..._m(n)})}function km(e){return e==="<stdin>"||lI(e).startsWith(ww)}async function kw(e,t,n){let r=[],s=cI(aI(),`jx-resolve-${process.pid}.js`);try{await No(`export * from ${JSON.stringify(e)};
121
- `,{outfile:s,resolveDir:t},{...n,minify:!1,onFileLoaded:(o)=>r.push(o)})}catch{return}finally{oI(s,{force:!0})}return r.find((o)=>!km(o))}async function No(e,{resolveDir:t,outfile:n},r){let s=await Em({entry:{resolveDir:t,source:e},..._m(r)});vw(n,s,"utf8")}async function Ow(e,{projectRoot:t,outfile:n,adapter:r,plugins:s}){let o=pI(r);if(s!==void 0)o.plugins=[...o.plugins??[],...s];await No(e,{outfile:n,resolveDir:t},o)}var jm,dI,mI;var Om=J(()=>{An();Sw();jm=["@vue/reactivity","lit-html"];dI={name:"jx-bare-node-builtins",setup(e){let t=iI.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}`}))}};mI={"process.env.NODE_ENV":'"production"'}});function yI(e,t){let n=e.slice(0,t),r=n.split(`
119
+ 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}=pI();if(t)return["node",[e]];else return[e,[]]}},pl=()=>gI.isatty(2),yI={readFile(e,t){try{let n=No.readFileSync(e,"utf8");try{No.unlinkSync(e)}catch{}t(null,n)}catch(n){t(n,null)}},writeFile(e,t){try{let n=zw();No.writeFileSync(n,e),t(n)}catch{t(null)}}},xI={readFile(e,t){try{No.readFile(e,"utf8",(n,r)=>{try{No.unlink(e,()=>t(n,r))}catch{t(n,r)}})}catch(n){t(n,null)}},writeFile(e,t){try{let n=zw();No.writeFile(n,e,(r)=>r!==null?t(null):t(n))}catch{t(null)}}},bI="0.28.2",$I=(e)=>Io().build(e),SI=(e)=>Io().context(e),wI=(e,t)=>Io().transform(e,t),vI=(e,t)=>Io().formatMessages(e,t),EI=(e,t)=>Io().analyzeMetafile(e,t),jI=(e)=>{if(sn&&!hl){if(!on)on=Bu(sn);return on.buildSync(e)}let t;return Wu((n)=>n.buildOrContext({callName:"buildSync",refs:null,options:e,isTTY:pl(),defaultWD:Jo,callback:(r,s)=>{if(r)throw r;t=s}})),t},PI=(e,t)=>{if(sn&&!hl){if(!on)on=Bu(sn);return on.transformSync(e,t)}let n;return Wu((r)=>r.transform({callName:"transformSync",refs:null,input:e,options:t||{},isTTY:pl(),fs:yI,callback:(s,o)=>{if(s)throw s;n=o}})),n},kI=(e,t)=>{if(sn&&!hl){if(!on)on=Bu(sn);return on.formatMessagesSync(e,t)}let n;return Wu((r)=>r.formatMessages({callName:"formatMessagesSync",refs:null,messages:e,options:t,callback:(s,o)=>{if(s)throw s;n=o}})),n},_I=(e,t)=>{if(sn&&!hl){if(!on)on=Bu(sn);return on.analyzeMetafileSync(e,t)}let n;return Wu((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},OI=()=>{if(qu)qu();if(on)on.stop();return Promise.resolve()},ug=!1,AI=(e)=>{if(e=tI(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(ug)throw Error('Cannot call "initialize" more than once');return Io(),ug=!0,Promise.resolve()},Jo=process.cwd(),fl,qu,Io=()=>{if(fl)return fl;let[e,t]=Uw(),n=Bw.spawn(e,t.concat("--service=0.28.2","--ping"),{windowsHide:!0,stdio:["pipe","pipe","inherit"],cwd:Jo}),{readFromStdout:r,afterClose:s,service:o}=qw({writeToStdin(u){n.stdin.write(u,(d)=>{if(d)s(d)})},readFileSync:No.readFileSync,isSync:!1,hasFS:!0,esbuild:ml});n.stdin.on("error",s),n.on("error",s);let{stdin:i,stdout:a}=n;a.on("data",r),a.on("end",s),qu=()=>{i.destroy(),a.destroy(),n.kill(),ug=!1,fl=void 0,qu=void 0};let l=0;if(n.unref(),i.unref)i.unref();if(a.unref)a.unref();let c={ref(){if(++l===1)n.ref()},unref(){if(--l===0)n.unref()}};return fl={build:(u)=>new Promise((d,p)=>{o.buildOrContext({callName:"build",refs:c,options:u,isTTY:pl(),defaultWD:Jo,callback:(m,g)=>m?p(m):d(g)})}),context:(u)=>new Promise((d,p)=>o.buildOrContext({callName:"context",refs:c,options:u,isTTY:pl(),defaultWD:Jo,callback:(m,g)=>m?p(m):d(g)})),transform:(u,d)=>new Promise((p,m)=>o.transform({callName:"transform",refs:c,input:u,options:d||{},isTTY:pl(),fs:xI,callback:(g,b)=>g?m(g):p(b)})),formatMessages:(u,d)=>new Promise((p,m)=>o.formatMessages({callName:"formatMessages",refs:c,messages:u,options:d,callback:(g,b)=>g?m(g):p(b)})),analyzeMetafile:(u,d)=>new Promise((p,m)=>o.analyzeMetafile({callName:"analyzeMetafile",refs:c,metafile:typeof u==="string"?u:JSON.stringify(u),options:d,callback:(g,b)=>g?m(g):p(b)}))},fl},Wu=(e)=>{let[t,n]=Uw(),r=new Uint8Array,{readFromStdout:s,afterClose:o,service:i}=qw({writeToStdin(l){if(r.length!==0)throw Error("Must run at most one command");r=l},isSync:!0,hasFS:!0,esbuild:ml});e(i);let a=Bw.execFileSync(t,n.concat("--service=0.28.2"),{cwd:Jo,windowsHide:!0,input:r,maxBuffer:+process.env.ESBUILD_MAX_BUFFER||16777216});s(a),o(null)},zw=()=>cg.join(hI.tmpdir(),`esbuild-${mI.randomBytes(32).toString("hex")}`),on=null,Bu=(e)=>{let{port1:t,port2:n}=new e.MessageChannel,r=new e.Worker(__filename,{workerData:{workerPort:n,defaultWD:Jo,esbuildVersion:"0.28.2"},transferList:[n],execArgv:[]}),s=0,o=(c)=>{let u=Error(`Build failed with 1 error:
120
+ error: ${c}`),d=[{id:"",pluginName:"",text:c,location:null,notes:[],detail:void 0}];return u.errors=d,u.warnings=[],u},i=(c)=>{if(!c)return;let u=c.plugins;if(u&&u.length>0)throw o("Cannot use plugins in synchronous API calls")},a=(c,u)=>{for(let d in u)c[d]=u[d]},l=(c,u)=>{let d=s++,p=new SharedArrayBuffer(8),m=new Int32Array(p),g={sharedBuffer:p,id:d,command:c,args:u};r.postMessage(g);let b=Atomics.wait(m,0,0);if(b!=="ok"&&b!=="not-equal")throw Error("Internal error: Atomics.wait() failed: "+b);let{message:{id:h,resolve:x,reject:k,properties:w}}=e.receiveMessageOnPort(t);if(d!==h)throw Error(`Internal error: Expected id ${d} but got id ${h}`);if(k)throw a(k,w),k;return x};return r.unref(),{buildSync(c){return i(c),l("build",[c])},transformSync(c,u){return l("transform",[c,u])},formatMessagesSync(c,u){return l("formatMessages",[c,u])},analyzeMetafileSync(c,u){return l("analyzeMetafile",[c,u])},stop(){r.terminate(),on=null}}},CI=()=>{let e=sn.workerData.workerPort,t=sn.parentPort,n=(r)=>{let s={};if(r&&typeof r==="object")for(let o in r)s[o]=r[o];return s};try{let r=Io();Jo=sn.workerData.defaultWD,t.on("message",(s)=>{(async()=>{let{sharedBuffer:o,id:i,command:a,args:l}=s,c=new Int32Array(o);try{switch(a){case"build":e.postMessage({id:i,resolve:await r.build(l[0])});break;case"transform":e.postMessage({id:i,resolve:await r.transform(l[0],l[1])});break;case"formatMessages":e.postMessage({id:i,resolve:await r.formatMessages(l[0],l[1])});break;case"analyzeMetafile":e.postMessage({id:i,resolve:await r.analyzeMetafile(l[0],l[1])});break;default:throw Error(`Invalid command: ${a}`)}}catch(u){e.postMessage({id:i,reject:u,properties:n(u)})}Atomics.add(c,0,1),Atomics.notify(c,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(hl)CI();var RI=ml});import{createRequire as TI}from"node:module";import{mkdirSync as NI,writeFileSync as JI}from"node:fs";import{dirname as MI,join as II}from"node:path";function dg(e,t){return TI(II(t,"package.json")).resolve(e)}function Gw(e){return e==="node"||e==="bun"?"node":"browser"}function DI(e){return new RegExp(`^${e.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}$`)}function LI(e,t){let n=DI(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 pg(e){let t=await Promise.resolve().then(() => Sr(gl(),1)),{entry:n}=e,r={bundle:!0,external:e.external,format:"esm",logLevel:"silent",minify:e.minify,platform:Gw(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=[LI(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 Xw(e){let t=await Promise.resolve().then(() => Sr(gl(),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:Gw(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)=>(NI(MI(s.path),{recursive:!0}),JI(s.path,s.contents),s.path))}var Yw=()=>{};var Zw=".jx-entry-";import{rmSync as VI,writeFileSync as Qw}from"node:fs";import{builtinModules as qI}from"node:module";import{tmpdir as HI}from"node:os";import{basename as WI,join as BI,resolve as UI}from"node:path";function ev(e){return Ao(e)||e.startsWith("./")||e.startsWith("../")}function hg(e,t,n){if(Ao(e))return dg(e.slice(Cu.length),n);return UI(t,e)}function tv(e,t){return dg(e,t)}function zI(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 GI(e){if(e==="cloudflare-workers"||e==="cloudflare-pages")return{conditions:["workerd","worker"],external:["cloudflare:*","node:*"],plugins:[KI],target:"workerd"};return{target:e==="bun"?"bun":"node"}}function YI(e){return e.minify??e.target==="browser"}function ZI(e){let t={};if(e.conditions)t.conditions=e.conditions;if(e.target==="browser")t.define={...XI};return t}function gg(e){return{...ZI(e),external:e.external??[],minify:YI(e),plugins:zI(e),target:e.target}}async function nv(e,t){let n={path:e.entryPath};if(e.contents!==void 0)n.contents=e.contents;let r=await pg({entry:n,...gg(t)});Qw(e.outfile,r,"utf8")}async function rv(e,t,n){return Xw({entries:e,outdir:t,...gg(n)})}function yg(e){return e==="<stdin>"||WI(e).startsWith(Zw)}async function sv(e,t,n){let r=[],s=BI(HI(),`jx-resolve-${process.pid}.js`);try{await Do(`export * from ${JSON.stringify(e)};
121
+ `,{outfile:s,resolveDir:t},{...n,minify:!1,onFileLoaded:(o)=>r.push(o)})}catch{return}finally{VI(s,{force:!0})}return r.find((o)=>!yg(o))}async function Do(e,{resolveDir:t,outfile:n},r){let s=await pg({entry:{resolveDir:t,source:e},...gg(r)});Qw(n,s,"utf8")}async function ov(e,{projectRoot:t,outfile:n,adapter:r,plugins:s}){let o=GI(r);if(s!==void 0)o.plugins=[...o.plugins??[],...s];await Do(e,{outfile:n,resolveDir:t},o)}var mg,KI,XI;var xg=M(()=>{hn();Yw();mg=["@vue/reactivity","lit-html"];KI={name:"jx-bare-node-builtins",setup(e){let t=qI.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}`}))}};XI={"process.env.NODE_ENV":'"production"'}});function Uu(e){return e!==null&&(e.locales.length>1||e.routing==="prefix-always")}function QI(e,t){if(t.routing==="prefix-except-default"&&e===t.defaultLocale)return"/";return`/${e.toLowerCase()}/`}function iv(e,t=""){if(e===null||!Uu(e))return"";let n=JSON.stringify(e.locales),r=JSON.stringify(e.defaultLocale),s=JSON.stringify(Object.fromEntries(e.locales.map((i)=>[i,Te(t,QI(i,e))]))),o=JSON.stringify(Te(t,"/"));return`
122
+ // ─── Locale negotiation (RFC 4647 Lookup over Accept-Language) ───────────────
123
+ const JX_LOCALES = ${n}
124
+ const JX_DEFAULT_LOCALE = ${r}
125
+ const JX_ROOT = ${o}
126
+ const JX_LOCALE_HOMES = ${s}
127
+
128
+ function jxParseAcceptLanguage(header) {
129
+ const parsed = []
130
+ header.split(',').forEach((part, index) => {
131
+ const [rawRange, ...params] = part.split(';')
132
+ const range = (rawRange || '').trim().toLowerCase()
133
+ if (range === '') return
134
+ let quality = 1
135
+ for (const param of params) {
136
+ const [name, value] = param.split('=')
137
+ if ((name || '').trim().toLowerCase() === 'q') {
138
+ const q = Number((value || '').trim())
139
+ quality = Number.isNaN(q) ? 0 : q
140
+ }
141
+ }
142
+ if (quality <= 0) return
143
+ parsed.push({ at: index, quality, range })
144
+ })
145
+ return parsed.sort((a, b) => b.quality - a.quality || a.at - b.at).map((p) => p.range)
146
+ }
147
+
148
+ function jxLookupRange(range, available) {
149
+ let candidate = range
150
+ while (candidate !== '') {
151
+ const wanted = candidate
152
+ const match = available.find((tag) => tag.toLowerCase() === wanted)
153
+ if (match !== undefined) return match
154
+ const cut = candidate.lastIndexOf('-')
155
+ if (cut === -1) return null
156
+ candidate = candidate.slice(0, cut)
157
+ const previous = candidate.lastIndexOf('-')
158
+ if (candidate.length - previous === 2) candidate = candidate.slice(0, previous)
159
+ }
160
+ return null
161
+ }
162
+
163
+ function jxNegotiateLocale(header, available, fallback) {
164
+ if (typeof header !== 'string' || header.trim() === '') return fallback
165
+ for (const range of jxParseAcceptLanguage(header)) {
166
+ if (range === '*') continue
167
+ const match = jxLookupRange(range, available)
168
+ if (match !== null) return match
169
+ }
170
+ return fallback
171
+ }
172
+
173
+ app.use(JX_ROOT, async (c, next) => {
174
+ const locale = jxNegotiateLocale(c.req.header('accept-language'), JX_LOCALES, JX_DEFAULT_LOCALE)
175
+ const home = JX_LOCALE_HOMES[locale] || JX_ROOT
176
+ if (home !== JX_ROOT) {
177
+ // 302, never 301: the target depends on the request, so it must never be cached as permanent.
178
+ return new Response(null, {
179
+ headers: { 'Content-Language': locale, Location: home, Vary: 'Accept-Language' },
180
+ status: 302,
181
+ })
182
+ }
183
+ // The root already holds this locale (prefix-except-default). Let the chain serve it, then say the
184
+ // Response depended on the header — a cache that missed this would pin every visitor to it.
185
+ await next()
186
+ const res = new Response(c.res.body, c.res)
187
+ res.headers.set('Vary', 'Accept-Language')
188
+ res.headers.set('Content-Language', locale)
189
+ c.res = res
190
+ })
191
+ `}var bg=M(()=>{hn()});function eD(e,t){let n=e.slice(0,t),r=n.split(`
122
192
  `).length;return{column:t-n.lastIndexOf(`
123
- `),line:r}}function Cm(e,t,n,r){return{...yI(e,t),kind:n,message:r,offset:t}}function xI(e,t){let n=t;while(n<e.length&&/\s/u.test(e.charAt(n)))n+=1;return n}function Nw(e){for(let t of[e,`return async function () {
193
+ `),line:r}}function Sg(e,t,n,r){return{...eD(e,t),kind:n,message:r,offset:t}}function tD(e,t){let n=t;while(n<e.length&&/\s/u.test(e.charAt(n)))n+=1;return n}function uv(e){for(let t of[e,`return async function () {
124
194
  ${e}
125
- }`])try{return Reflect.construct(Function,[t])!==null}catch{}return!1}function Tw(e){Rm=e,Au=null}function $I(e,t){if(!Au){if(!Rm)throw Error("@jxsuite/erase was imported without an entry that loads its stripper");Au=Rm()}return Au(e,t)}function Jw(e,t,n){return $I(e,(r)=>{let s=xI(e,r.pos),[o="this"]=/^[\w$]+/u.exec(e.slice(s))??[];n.push(Cm(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 SI(e){return po(e).includes("<")||!Nw(e)}function wI(e){let t=Am.get(e);if(t)return t;if(!SI(e)){let i={code:e,problems:[]};return Am.set(e,i),i}let n=[],r=Jw(e,"A function body",n),s=po(r);for(let i of s.matchAll(bI)){let a=i.index+(i[1]?.length??0)+(i[2]?.length??0);n.push(Cm(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&&Nw(e)){let i=[...e].findIndex((a,l)=>a!==r[l]);n.push(Cm(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 Am.set(e,o),o}function Mw(e){let t=Aw.get(e);if(t)return t;let n=[],s={code:Jw(e,"A script",n),problems:n};return Aw.set(e,s),s}function vI(e){return String(e).replaceAll("~","~0").replaceAll("/","~1")}function Cw(e,t,n){if(k(e))return Rw(e,t,n);if(Array.isArray(e)&&e.length>0&&e.every((r)=>k(r)))return Rw(e.join(`
195
+ }`])try{return Reflect.construct(Function,[t])!==null}catch{}return!1}function fv(e){wg=e,zu=null}function rD(e,t){if(!zu){if(!wg)throw Error("@jxsuite/erase was imported without an entry that loads its stripper");zu=wg()}return zu(e,t)}function dv(e,t,n){return rD(e,(r)=>{let s=tD(e,r.pos),[o="this"]=/^[\w$]+/u.exec(e.slice(s))??[];n.push(Sg(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 sD(e){return go(e).includes("<")||!uv(e)}function oD(e){let t=$g.get(e);if(t)return t;if(!sD(e)){let i={code:e,problems:[]};return $g.set(e,i),i}let n=[],r=dv(e,"A function body",n),s=go(r);for(let i of s.matchAll(nD)){let a=i.index+(i[1]?.length??0)+(i[2]?.length??0);n.push(Sg(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&&uv(e)){let i=[...e].findIndex((a,l)=>a!==r[l]);n.push(Sg(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 $g.set(e,o),o}function pv(e){let t=av.get(e);if(t)return t;let n=[],s={code:dv(e,"A script",n),problems:n};return av.set(e,s),s}function iD(e){return String(e).replaceAll("~","~0").replaceAll("/","~1")}function lv(e,t,n){if(_(e))return cv(e,t,n);if(Array.isArray(e)&&e.length>0&&e.every((r)=>_(r)))return cv(e.join(`
126
196
  `),t,n).split(`
127
- `);return e}function Rw(e,t,n){let{code:r,problems:s}=wI(e),[o,...i]=s.filter((a)=>a.kind==="unsupported");if(o)throw new Cu(t,[o,...i]);for(let a of s)n.push({...t,problem:a});return r}function Nm(e,t,n){if(Array.isArray(e))return e.map((i,a)=>Nm(i,{...t,pointer:`${t.pointer}/${a}`},n));if(!L(e))return e;let r=gp(e),s=[],o={set:(i,a)=>{s.push([i,a])}};for(let[i,a]of Object.entries(e)){let l={...t,pointer:`${t.pointer}/${vI(i)}`};if(r&&i==="body")o.set(i,Cw(a,l,n));else if(r&&(i==="getter"||i==="setter")&&L(a)){let c={...a};if(a.body!==void 0)c.body=Cw(a.body,{...l,pointer:`${l.pointer}/body`},n);o.set(i,c)}else o.set(i,Nm(a,l,n))}return Object.fromEntries(s)}function il(e,t,n=[]){return Nm(e,{path:t,pointer:""},n)}function Iw(e,t,n=[]){return il(e,t,n)}var bI,Am,Au=null,Rm=null,Aw,Cu;var Tm=J(()=>{ce();bI=/(^|[\n;{}])(\s*)(import|export)(?=[\s{*"'])/gu;Am=new Map;Aw=new Map;Cu=class Cu 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 EI}from"node:module";var Ru=J(()=>{Tm();Tm();Tw(()=>EI(import.meta.url)("ts-blank-space").default)});function Lw(e){for(let{path:t,pointer:n,problem:r}of e){let s=`${t}${n} (line ${r.line}, column ${r.column}): ${r.message}`;if(!Dw.has(s))Dw.add(s),console.warn(`Warning: ${s}`)}}function Ar(e,t){let n=[],r=il(e,t,n);return Lw(n),r}function Fw(e,t){let n=[],r=Iw(e,t,n);return Lw(n),r}var Dw;var Ei=J(()=>{Ru();Dw=new Set});function PI(e){return e.split("\\").join("/").replace(/^\.\//,"").replace(/^\//,"").replace(/^pages\//,"")}function Vw(e){let t=PI(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(jI,(l,c,u)=>{if(o=!0,c)return i=!0,s.push(c),"*";return s.push(u),`:${u}`});return{isCatchAll:i,isDynamic:o,params:s,urlPattern:a}}function qw(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 jI;var Hw=J(()=>{jI=/\[\.\.\.(\w+)\]|\[(\w+)\]/g});function kI(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function Ww(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)?_I.exec(s)?.[1]:void 0;if(o===void 0)throw TypeError('$paths.paginate must be { "$ref": "#/state/<key>" }');if(!Ie(n)||!Number.isInteger(n)||n<1)throw TypeError("$paths.pageSize must be a positive integer");let i={key:kI(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 Jm(e,t){return Math.max(1,Math.ceil(e/t))}function Bw(e,t,n){let r=(t-1)*n;return e.slice(r,r+n)}function To(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 Uw(e,t,n,r){let s=Jm(r,n),o=[];for(let i=1;i<=s;i++)o.push({current:i===t,number:i,url:To(e,i)});return{first:To(e,1),itemCount:r,last:To(e,s),next:t<s?To(e,t+1):null,number:t,pageCount:s,pageSize:n,pages:o,prev:t>1?To(e,t-1):null}}var _I;var zw=J(()=>{ce();_I=/^#\/state\/([^/]+)$/});function Bn(e){if(!k(e)||e.trim()==="")return null;try{return new Intl.Locale(e.trim()).toString()}catch{return null}}function al(e){let t=Bn(e);if(t===null)return"ltr";let n=new Intl.Locale(t),r=n.script??n.maximize().script;return r!==void 0&&OI.has(r)?"rtl":"ltr"}function Kw(e){let t=Bn(e);if(t===null)return k(e)?e:"";return new Intl.DisplayNames([t],{type:"language"}).of(t)??t}function Mm(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 l=Bn(a);if(l===null){n.push(`i18n.locales: "${String(a)}" is not a well-formed BCP 47 language tag.`);continue}if(!s.includes(l))s.push(l)}let o=Bn(t.defaultLocale)??s[0]??null;if(t.defaultLocale!==void 0&&Bn(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:AI;return{errors:n,i18n:{defaultLocale:o,locales:s,routing:i}}}function cr(e,t){if(t===null)return null;let n=e.split("/").find(Boolean);if(n===void 0)return t.defaultLocale;let r=Bn(n);return r!==null&&t.locales.includes(r)?r:t.defaultLocale}var OI,Nu="^[A-Za-z]{2,8}(-[A-Za-z0-9]{1,8})*$",AI="prefix-except-default";var Jo=J(()=>{ce();OI=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 hn(e){return e.replaceAll(/[A-Z]/g,(t)=>`-${t.toLowerCase()}`)}function Xw(e,t){if(e.startsWith("@--"))return t[e.slice(1)]??e.slice(1);if(e.startsWith("@(")){let n=e.slice(2,-1).trim();return CI.has(n.toLowerCase())?n:e.slice(1)}return null}function ll(e){return e.startsWith("@position-try")||e.startsWith("@property")||e.startsWith("@font-face")||e.startsWith("@counter-style")}function cl(e){return e.startsWith("@keyframes")}function Yw(e,t){let n=[];for(let r of ji(e))for(let s of ji(t))n.push(Im(r,s));return n.join(", ")}function Im(e,t){let n=NI(e,t);if(n!==null)return n;let r=rv(t,e);if(r!==null)return r;if(t.startsWith("[")||t.startsWith(":")||t.startsWith("."))return`${e}${t}`;return`${e} ${t}`}function Zw(e,t){let n=0,r=null;for(let s=t;s<e.length;s+=1){let o=e[s];if(o==="\\")s+=1;else if(r)r=o===r?null:r;else if(o==='"'||o==="'")r=o;else if(o==="(")n+=1;else if(o===")"){if(n-=1,n===0)return s+1}}return-1}function Qw(e){if(e.endsWith(":host"))return{inner:"",prefix:e.slice(0,-5)};let t=e.lastIndexOf(":host(");if(t===-1||Zw(e,t+5)!==e.length)return null;return{inner:e.slice(t+6,-1),prefix:e.slice(0,t)}}function ev(e){if(!e.startsWith(":host"))return null;let t=e.slice(5);if(t.startsWith("(")){let n=Zw(t,0);return n===-1?null:{inner:t.slice(1,n-1),rest:t.slice(n)}}return/^[\w-]/u.test(t)?null:{inner:null,rest:t}}function tv(e){let t=0,n=null;for(let r=0;r<e.length;r+=1){let s=e[r];if(s==="\\")r+=1;else if(n)n=s===n?null:n;else if(s==='"'||s==="'")n=s;else if(s==="("||s==="[")t+=1;else if(s===")"||s==="]")t-=1;else if(t===0){if(/[\s>+~]/u.test(s)||e.startsWith("::",r))return r;if(s===":"&&RI.test(e.slice(r)))return r}}return e.length}function NI(e,t){let n=Qw(e);if(n===null||!Fm(t))return null;let r=Ju(t);if(r.length>1||r.length===1&&r[0]!==0)return null;let s=r.length===1?t.slice(1):t,o=tv(s);if(o===0)return`${e}${s}`;return`${n.prefix}:host(${n.inner}${s.slice(0,o)})${s.slice(o)}`}function JI(e,t,n){let r=ev(e);if(r===null)return n==="shadow"&&TI.test(e)?e:Im(t,e);let{inner:s,rest:o}=r;if(n==="light")return`${t}${s??""}${o}`;let a=`${Qw(t)?.prefix??""}:host${s===null?"":`(${s})`}`;if(o==="")return a;return/^[\s>+~]/u.test(o)?`${a}${o}`:Im(a,o)}function nv(e,t,n){let r=[];for(let s of ji(t))for(let o of ji(e))r.push(JI(o,s,n));return r.join(", ")}function MI(e){return ji(e).every((t)=>{let n=ev(t);if(n===null)return Fm(t);let r=tv(n.rest);return n.rest.slice(r).replace(/^::?[\w-]+(?:\([^)]*\))?/u,"")===""})}function Ju(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 rv(e,t){return Ju(e).length>0?II(e,t):null}function II(e,t){let n="",r=0;for(let s of Ju(e))n+=e.slice(r,s)+t,r=s+1;return n+e.slice(r)}function ji(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 fr(e){let t=/^\(\s*prefers-color-scheme\s*:\s*(light|dark)\s*\)$/.exec(e.trim())?.[1];return t==="light"||t==="dark"?t:null}function Dm(e,t){if(e===":root"||e==="html")return{auto:`${e}:where(:not([${ur}]))`,forced:`${e}:where([${ur}="${t}"])`};return{auto:`:where(:root:not([${ur}])) ${e}`,forced:`:where(:root[${ur}="${t}"]) ${e}`}}function ul(e){return e.startsWith(":")||e.startsWith(".")||e.startsWith("&")||e.startsWith("[")}function Lm(e){return e.startsWith("--")?e:hn(e)}function Tu(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 sv(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 fl(e){if(e.description===void 0)return e.text;return`/* ${e.description.replaceAll("*/","* /")} */
128
- ${e.text}`}function DI(e,t,n){let r=n.map(({selector:o,declarations:i})=>`${o} { ${i.map(([a,l])=>`${a}: ${l}`).join("; ")} }`).join(" "),s=`@keyframes ${t} { ${r} }`;for(let o=e.length-1;o>=0;o-=1)s=`${e[o]} { ${s} }`;return s}function LI(e){let t=Object.keys(e).filter((r)=>cl(r));if(t.length===0)return e;let n={...e};for(let r of t)delete n[r];return n}function Fm(e){let n=Ju(e).at(-1),r=n===void 0?e:e.slice(n+1);return r===""||r.startsWith(":")||r.startsWith(".")||r.startsWith("[")}function Pi(e,t={}){let{scope:n=null,mediaQueries:r={},transposeValue:s=(w)=>w,transposeSelector:o=(w)=>w,resolveValue:i,host:a,shadowTree:l=!1}=t,c=[],u=(w)=>w!==null&&typeof w==="object"&&!Array.isArray(w)&&!me(w),d=(w,E)=>{if(u(E))return[E];if(!ll(w)||!Array.isArray(E)||E.length===0)return[];return E.every((j)=>u(j))?E:[]},p=(w,E,j,A)=>{if(E===void 0||E===null)return null;if(me(E))return j?i?.(w,E,A)??null:null;if(D(E))return null;let T=String(E);if(le(T))return j?i?.(w,T,A)??null:null;return s(T)},m=(w,E,j=!0,A="self")=>{let T=[];for(let[I,V]of Object.entries(w)){if(d(I,V).length>0)continue;if(E&&(I.startsWith("@")||ul(I)))continue;if(I.startsWith("$"))continue;let H=p(I,V,j,A);if(H!==null)T.push([Lm(I),H])}return T},y=(w)=>k(w)&&w!==""?{description:w}:{},S=(w,E,j,A,T)=>{if(j.length===0)return;let I=E;if(I!==null){let O=o(I);if(O===null)return;I=O}let V=sv(w,I,j),H={text:V,conditions:[...w],selector:I,declarations:j,target:A,key:Tu(V)};c.push({...H,...y(T)})},g=(w,E,j)=>{let A=w.slice(10).trim();if(A==="")return;let T=[];for(let[V,H]of Object.entries(E)){if(!u(H))continue;let O=m(H,!0,!1,"unscoped");if(O.length>0)T.push({declarations:O,selector:V.trim()})}if(T.length===0)return;let I=DI(j,A,T);c.push({blocks:T,conditions:[...j],declarations:[],key:Tu(I),selector:null,target:"unscoped",text:I,...y(E.$description)})},x=(w,E,j,A,T,I)=>{if(w==="@--")return;if(ll(w)){S([...A,w],null,m(E,!1,!0,"unscoped"),"unscoped",E.$description);return}if(cl(w)){g(w,E,A);return}let V=Xw(w,r),H=V===null?w:`@media ${V}`,O=V===null?null:fr(V);if(O!==null&&j!==null&&!l){let{auto:N,forced:G}=Dm(j,O);P(E,N,[...A,H],T,I),P(LI(E),G,A,T,I);return}P(E,j,[...A,H],T,I)};function P(w,E,j,A,T){S(j,E,m(w,!0,!0,A),A,w.$description);for(let[I,V]of Object.entries(w))for(let H of d(I,V))if(I.startsWith("@"))x(I,H,E,j,A,T);else if(E!==null&&T&&a!==void 0)P(H,nv(I,E,a),j,MI(I)?A:"descendant",!1);else if(E!==null)P(H,Yw(E,I),j,Fm(I)?A:"descendant",!1)}return P(e,n,[],"self",!0),c}function Gw(e){return e===!1||e==="open"||e==="closed"}function Rn(e,t){let n=e?.$shadow;if(Gw(n))return n===!1?null:n;let r=t?.shadow;return Gw(r)&&r!==!1?r:null}var CI,RI,TI,ur="data-color-scheme",Mu="jx-color-scheme";var dl=J(()=>{ce();CI=new Set(["all","print","screen","speech"]);RI=/^:(?:before|after|first-line|first-letter)(?![\w-])/u;TI=/^::(?:slotted|part)\(/u});function av(){return`the Intl helpers ${qm.join(", ")}`}var Cr="en-US",Vm="UTC",ov,qm,iv;var Hm=J(()=>{ov=[{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."}],qm=ov.map((e)=>e.path),iv=Object.fromEntries(ov.map((e)=>[e.path,e.params.indexOf("locale")]))});function FI(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function Wt(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function sn(e){return e.startsWith("#/$map/")?e.slice(2):e}function Un(e){if(e==="")return[];return e.split("/").map((t)=>FI(t))}function Bt(e,t){let n=e;for(let r of Un(t))n=n?.[r];return n}function Re(e,t){let n=e;for(let r of Un(t))n+=Wm.test(r)?`.${r}`:`[${JSON.stringify(r)}]`;return n}function lv(e,t){let n=e;for(let[r,s]of Un(t).entries()){let o=r===0?"":"?.";n+=Wm.test(s)?`${r===0?".":o}${s}`:`${o}[${JSON.stringify(s)}]`}return n}function us(e){return Wm.test(e)?e:JSON.stringify(e)}function cv(e){let t=e.replaceAll(/[^A-Za-z0-9_$]/g,"_");if(t==="")return"ref";return/^\d/.test(t)?`_${t}`:t}var Wm;var _i=J(()=>{Wm=/^[A-Za-z_$][A-Za-z0-9_$]*$/});function Bm(e){let t=e.$map;return D(t)?t:void 0}function Lu(e){return D(e)&&!Array.isArray(e)&&"operator"in e}function ki(e){return D(e)&&!Array.isArray(e)&&"$ref"in e}function WI(e,t,n){let r=iv[e];if(r===void 0||r<0||t[r]!=null)return t;let s=Bt(n.$page,"locale");if(!k(s)||s==="")return t;let o=[...t];return o[r]=s,o}function gv(){return globalThis.window??globalThis}function yv(e){return e.startsWith("window#/")&&qI.has(e.slice(8))}function dr(e){return pv.has(e)}function Iu(e){if(Array.isArray(e))return e.some((t)=>Iu(t));if(e===void 0||!Lu(e))return!1;return dr(e.operator)||[e.target,e.value,e.initial,e.default].some((t)=>Iu(t))||Object.values(e.cases??{}).some((t)=>Iu(t))}function Mo(e){return wr(e)&&!Iu(e.$expression)}function Um(e,t){if(Array.isArray(e)){for(let n of e)Um(n,t);return}if(e===void 0||!D(e))return;if(ki(e)){if(!BI.test(e.$ref)){let n=e.$ref.replace(/^(?:#\/state\/|parent#\/)/,"");t.add(Un(n)[0]??"")}return}if(Lu(e)){let n=[e.target,e.value,e.initial,e.default];for(let r of[...n,...Object.values(e.cases??{})])Um(r,t)}}function Zm(e){let t=new Set;return Um(e.$expression,t),[...t]}function Qm(e){let t=new Map;for(let[r,s]of Object.entries(e??{}))if(!r.startsWith("$")&&Mo(s))t.set(r,s);let n=!1;while(!n){n=!0;for(let[r,s]of t)if(Zm(s).some((o)=>!t.has(o)))t.delete(r),n=!1}return Object.fromEntries(t)}function it(e,t){if(!e)return;let n=(e.depth??0)+1;if(n>UI)return;return{depth:n,path:[...e.path??[],...Array.isArray(t)?t:[t]],report:e.report}}function rt(e,t,n,r,s){if(e===null||e===void 0)return e;if(Lu(e))return Nn(e,t,n,r,s);if(ki(e)){let o=Du(e.$ref,t,n,r);return s?.report(s.path??[],o),o}if(Array.isArray(e))return xv(e,t,n,r,s);return s?.report(s.path??[],e),e}function xv(e,t,n,r,s){return e.map((o,i)=>rt(o,t,n,r,it(s,i)))}function zI(e,t,n,r){let s=sn(e),o=(i)=>{if(!s.slice(i.length).includes("/"))return t;return Du(s.slice(0,s.lastIndexOf("/")),t,n,r)};if(s.startsWith("#/state/"))return o("#/state/");if(s.startsWith("parent#/"))return o("parent#/");if(s.startsWith("$map/")||s.startsWith("$args/"))return s.split("/").length>2?Du(s.slice(0,s.lastIndexOf("/")),t,n,r):void 0;return}function Du(e,t,n,r){let s=sn(e);if(s==="$reduce/acc")return r?.acc;if(s.startsWith("$reduce/"))return r?.acc;if(s.startsWith("$args/")){let o=s.slice(6).split("/"),i=r?.args?.[o[0]];return o.length>1?Bt(i,o.slice(1).join("/")):i}if(s.startsWith("event#/")){let o=s.slice(7);return Bt(n,o)}if(s.startsWith("$map/")){let o=s.split("/"),[,i]=o,a,l=Bm(t);if(i==="item")a=r?.item??l?.item??t["$map/item"];else if(i==="index")a=r?.index??l?.index??t["$map/index"];else a=l?.[i]??t[`$map/${i}`];return o.length>2?Bt(a,o.slice(2).join("/")):a}if(s.startsWith("#/state/"))return Bt(t,s.slice(8));if(s.startsWith("parent#/"))return Bt(t,s.slice(8));if(s.startsWith("window#/"))return Bt(gv(),s.slice(8));if(s.startsWith("document#/"))return Bt(globalThis.document,s.slice(10));return Bt(t,s)??null}function KI(e,t,n,r){let s=sn(e);if(s.startsWith("$map/")){let o=s.split("/"),[,i]=o,a,l=Bm(t);if(i==="item")a=r?.item??l?.item??t["$map/item"];else if(i==="index")a=r?.index??l?.index??t["$map/index"];else a=l?.[i]??t[`$map/${i}`];if(o.length>2){let c=o.slice(2),u=c.pop(),d=c.length>0?Bt(a,c.join("/")):a;return{key:u,obj:d}}return{key:i==="item"?"$map/item":"$map/index",obj:Bm(t)??t}}if(s.startsWith("#/state/")){let o=s.slice(8);if(o.indexOf("/")===-1)return{key:o,obj:t};let a=Un(o),l=a.pop(),c=t;for(let u of a)c=c[u];return{key:l,obj:c}}return{key:s,obj:t}}function Nn(e,t,n,r,s){let o=GI(e,t,n,r,s);return s?.report(s.path??[],o),o}function fv(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 GI(e,t,n,r,s){let{operator:o,target:i,value:a,initial:l}=e;if(!VI.has(o))throw Error(`$expression: unknown operator "${o}"`);if(zm.has(o)&&!("value"in e)){let c=rt(i,t,n,r,it(s,"target"));if(o==="!")return!c;if(o==="-")return-c}if(o==="call"){let c=ki(i)?i.$ref:void 0;if(!k(c))throw TypeError("$expression: call target must be a $ref pointer");let u=(r?.callDepth??0)+1;if(u>uv)throw Error(`$expression: call depth exceeded (${uv})`);let d=Array.isArray(a)?a.map((m,y)=>rt(m,t,n,r,it(s,["value",y]))):[];if(c.startsWith("window#/")){if(!yv(c))throw Error(`$expression: "${c}" is not a blessed pure global`);let m=c.slice(8),y=HI.get(m);if(y)return y(...WI(m,d,t));let S=gv(),g=Bt(S,m),x=m.lastIndexOf("/"),P=x===-1?S:Bt(S,m.slice(0,x));return g.apply(P,d)}let p=Du(c,t,n,r);if(_t(p))return p.apply(zI(c,t,n,r),d);if(D(p)&&"$expression"in p){let m=p,y={};for(let[S,g]of(m.parameters??[]).entries()){let x=k(g)?g:g?.name??"";if(!x)continue;y[x]=d[S]===void 0&&D(g)&&"default"in g?g.default:d[S]}return Nn(m.$expression,t,n,{args:y,callDepth:u})}throw TypeError(`$expression: call target "${c}" is not callable`)}if(Xm.has(o)){if(o==="?:"){let m=rt(i,t,n,r,it(s,"target"));if(s){let y=rt(a,t,n,r,it(s,"value")),S=rt(l,t,n,r,it(s,"initial"));return m?y:S}return m?rt(a,t,n,r):rt(l,t,n,r)}let c=rt(i,t,n,r,it(s,"target")),u=String(c),d=e.cases??{},p=Object.hasOwn(d,u);if(s){let m;for(let[S,g]of Object.entries(d)){let x=rt(g,t,n,r,it(s,["cases",S]));if(S===u)m=x}let y=rt(e.default,t,n,r,it(s,"default"));return p?m:y}return p?rt(d[u],t,n,r):rt(e.default,t,n,r)}if(Km.has(o)){let c=rt(i,t,n,r,it(s,"target")),u=rt(a,t,n,r,it(s,"value"));switch(o){case"===":return c===u;case"!==":return c!==u;case"&&":return c&&u;case"||":return c||u;case"??":return c??u;default:return fv(o,c,u)}}if(mv.has(o)){let c=rt(a,t,n,r,it(s,"value")),{obj:u,key:d}=KI(i.$ref,t,n,r);u[d]=o==="="?c:fv(o.slice(0,-1),u[d],c);return}if(hv.has(o)){let c=rt(i,t,n,r,it(s,"target"));switch(o){case"push":return c.push(rt(a,t,n,r,it(s,"value")));case"unshift":return c.unshift(rt(a,t,n,r,it(s,"value")));case"pop":return c.pop();case"shift":return c.shift();case"splice":{let u=rt(a,t,n,r,it(s,"value"));return c.splice(...u)}default:break}}if(Ym.has(o)){let c=rt(i,t,n,r,it(s,"target")),u=a===void 0?[]:Array.isArray(a)?xv(a,t,n,r,it(s,"value")):[rt(a,t,n,r,it(s,"value"))],d=Bt(c,o);if(!_t(d))return;return d.apply(c,u)}if(Gm.has(o)){let c=rt(i,t,n,r,it(s,"target")),u=a;if(o==="reduce"){let d=rt(l,t,n,r,it(s,"initial"));for(let[p,m]of c.entries())d=Nn(u,t,n,{acc:d,index:p,item:m},p===0?it(s,"value"):void 0);return d}if(o==="map")return c.map((d,p)=>Nn(u,t,n,{...r,index:p,item:d},p===0?it(s,"value"):void 0));if(o==="filter")return c.filter((d,p)=>Nn(u,t,n,{...r,index:p,item:d},p===0?it(s,"value"):void 0))}return}function dt(e,t){if(e===null)return"null";if(e===void 0)return"undefined";if(Lu(e))return gn(e,t);if(ki(e))return eh(e.$ref,t);if(Array.isArray(e))return e.map((n)=>dt(n,t)).join(", ");return JSON.stringify(e)}function XI(e){return`_fx_${e.replaceAll(/[^A-Za-z0-9_$]/g,"_")}`}function eh(e,t){let n=sn(e),r=t.statePrefix??"state",s=t.eventParam??"event";if(n==="$reduce/acc")return"_acc";if(n.startsWith("$reduce/"))return"_acc";if(n.startsWith("$args/"))return Re("_args",n.slice(6));if(n.startsWith("event#/"))return Re(s,n.slice(7));if(n.startsWith("$map/")){let o=n.split("/"),[,i]=o;if(i==="item")return o.length>2?Re("_item",o.slice(2).join("/")):"_item";if(i==="index")return"_index";return`_${i}`}if(n.startsWith("#/state/"))return Re(r,n.slice(8));if(n.startsWith("parent#/"))return Re(r,n.slice(8));if(n.startsWith("window#/"))return Re("window",n.slice(8));if(n.startsWith("document#/"))return Re("document",n.slice(10));return Re(r,n)}function dv(e,t){if(ki(e))return eh(e.$ref,t);return dt(e,t)}function YI(e,t,n){let r=(i)=>t[i]??"undefined",s=`(${n.statePrefix??"state"}?.$page?.locale ?? ${JSON.stringify(Cr)})`,o=JSON.stringify(Vm);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 gn(e,t={}){let{operator:n,target:r,value:s,initial:o}=e;if(zm.has(n)&&!("value"in e)){let i=dt(r,t);if(n==="!")return`!(${i})`;if(n==="-")return`-(${i})`}if(n==="call"){let i=(ki(r)?r.$ref:void 0)??"",a=Array.isArray(s)?s.map((l)=>dt(l,t)):[];if(i.startsWith("window#/")){if(!yv(i))throw Error(`$expression: "${i}" is not a blessed pure global`);let l=YI(i.slice(8),a,t);if(l)return l;return`window.${i.slice(8).replaceAll("/",".")}(${a.join(", ")})`}if(i.startsWith("#/state/")){let l=i.slice(8),c=t.formulaParams?.[l];if(c){let u=c.map((d,p)=>`${JSON.stringify(d)}: ${a[p]??"undefined"}`).join(", ");return`${XI(l)}(${t.statePrefix??"state"}, { ${u} })`}}return`${eh(i,t)}(${a.join(", ")})`}if(Xm.has(n)){if(n==="?:"){let c=dt(r,t),u=dt(s,t),d=dt(o,t);return`(${c} ? ${u} : ${d})`}let i=dt(r,t),a=Object.entries(e.cases??{}).map(([c,u])=>`_d === ${JSON.stringify(c)} ? ${dt(u,t)} : `).join(""),l="default"in e?dt(e.default,t):"undefined";return`((_d) => ${a}${l})(String(${i}))`}if(Km.has(n)){let i=dt(r,t),a=dt(s,t);return`(${i} ${n} ${a})`}if(mv.has(n)){let i=dv(r,t),a=dt(s,t);return`${i} ${n} ${a}`}if(hv.has(n)){let i=dv(r,t);switch(n){case"push":return`${i}.push(${dt(s,t)})`;case"unshift":return`${i}.unshift(${dt(s,t)})`;case"pop":return`${i}.pop()`;case"shift":return`${i}.shift()`;case"splice":{let a=Array.isArray(s)?s.map((l)=>dt(l,t)).join(", "):dt(s,t);return`${i}.splice(${a})`}default:break}}if(Ym.has(n)){let i=dt(r,t),a=s===void 0?"":Array.isArray(s)?s.map((l)=>dt(l,t)).join(", "):dt(s,t);return`(${i})?.${n}?.(${a})`}if(Gm.has(n)){let i=dt(r,t),a=gn(s,t);if(n==="reduce"){let l=dt(o,t);return`${i}.reduce((_acc, _item, _index) => ${a}, ${l})`}if(n==="map")return`${i}.map((_item, _index) => ${a})`;if(n==="filter")return`${i}.filter((_item, _index) => ${a})`}return"undefined"}function Oi(e,t,n,r){return rt(e,t,n,r)}function fs(e,t={}){return dt(e,t)}var pv,zm,Km,mv,hv,Gm,Xm,Ym,VI,qI,HI,BI,uv=64,UI=64;var Ai=J(()=>{Hm();ce();_i();pv=new Set(["=","+=","-=","*=","/=","push","pop","shift","unshift","splice"]),zm=new Set(["!","-"]),Km=new Set(["+","-","*","/","%","===","!==","<","<=",">",">=","&&","||","??"]),mv=new Set(["=","+=","-=","*=","/="]),hv=new Set(["push","pop","shift","unshift","splice"]),Gm=new Set(["reduce","map","filter"]),Xm=new Set(["?:","switch"]),Ym=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"]),VI=new Set([...pv,...zm,...Km,...Gm,...Xm,...Ym,"call"]),qI=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",...qm]),HI=new Map([["Intl/compare",(e,t,n,r)=>new Intl.Collator(n??Cr,r).compare(e,t)],["Intl/displayName",(e,t,n,r)=>new Intl.DisplayNames(n??Cr,{...r,type:t??"language"}).of(e)],["Intl/formatDate",(e,t,n)=>new Intl.DateTimeFormat(t??Cr,{timeZone:Vm,...n}).format(new Date(e))],["Intl/formatList",(e,t,n)=>new Intl.ListFormat(t??Cr,n).format(e)],["Intl/formatNumber",(e,t,n)=>new Intl.NumberFormat(t??Cr,n).format(e)],["Intl/formatRelativeTime",(e,t,n,r)=>new Intl.RelativeTimeFormat(n??Cr,r).format(e,t)],["Intl/plural",(e,t,n)=>new Intl.PluralRules(t??Cr,n).select(e)],["Intl/segment",(e,t,n)=>[...new Intl.Segmenter(n??Cr,{granularity:t??"grapheme"}).segment(e)].map((r)=>r.segment)]]);BI=/^(?:\$args\/|\$reduce\/|\$map\/|window#\/|document#\/|event#\/)/});function bv(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 ZI(e){return(D(e)||_t(e))&&"then"in e&&_t(e.then)}async function Ci(e,t,n,r={}){let s=r.args?{args:r.args}:void 0;for(let o of e){let i=bv(o);switch(i.kind){case"expression":{let a=Nn(i.node,t,n,s);if(ZI(a))await a;break}case"if":{let a=i.node,l=Oi(a.if,t,n,s)?a.then:a.else;if(Array.isArray(l))await Ci(l,t,n,r);break}case"switch":{let a=i.node,l=String(Oi(a.$switch,t,n,s)),c=a.cases??{},u=Object.hasOwn(c,l)?c[l]:a.default;if(Array.isArray(u))await Ci(u,t,n,r);break}case"dispatch":{let a=i.node,l=_t(r.target)?r.target():r.target,c=n?.currentTarget??l;if(!c)break;let u={};if("detail"in a)u.detail=Oi(a.detail,t,n,s);if(a.bubbles!==void 0)u.bubbles=a.bubbles;if(a.composed!==void 0)u.composed=a.composed;c.dispatchEvent(new CustomEvent(a.dispatchEvent,u));break}case"stopPropagation":{n?.stopPropagation();break}case"preventDefault":{n?.preventDefault();break}default:break}}}function zn(e,t={}){let n=t.indent??"",r=[];for(let s of e){let o=bv(s);switch(o.kind){case"expression":{r.push(`${n}${gn(o.node,t)};`);break}case"if":{let i=o.node,a=fs(i.if,t),l={...t,indent:`${n} `};if(r.push(`${n}if (${a}) {`,zn(i.then??[],l)),i.else)r.push(`${n}} else {`,zn(i.else,l));r.push(`${n}}`);break}case"switch":{let i=o.node,a=fs(i.$switch,t),l={...t,indent:`${n} `};r.push(`${n}switch (String(${a})) {`);for(let[c,u]of Object.entries(i.cases??{}))r.push(`${n} case ${JSON.stringify(c)}: {`,zn(u,l),`${n} break;`,`${n} }`);if(i.default)r.push(`${n} default: {`,zn(i.default,l),`${n} }`);r.push(`${n}}`);break}case"dispatch":{let i=o.node,a=t.eventParam??"event",l=t.dispatchTarget??`(${a} && ${a}.currentTarget)`,c=[];if("detail"in i)c.push(`detail: ${fs(i.detail,t)}`);if(i.bubbles!==void 0)c.push(`bubbles: ${JSON.stringify(i.bubbles)}`);if(i.composed!==void 0)c.push(`composed: ${JSON.stringify(i.composed)}`);let u=c.length>0?`, { ${c.join(", ")} }`:"";r.push(`${n}${l}?.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(`
129
- `)}var Fu=J(()=>{ce();Ai()});var th=J(()=>{ce()});function Ri(e){if(e===QI)return"client";if(e===e1)return"server";return null}function t1(e){return e.replaceAll("\\","/").replace(/^(?:\.\/)+/,"")}function Sv(e,t){return`${sh}${t1(e)}#${t}`}function Vu(e){return e.startsWith(sh)}function Ni(e){if(!Vu(e))return null;let t=e.slice(sh.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 nh(e,t){if(Array.isArray(e)){let r=e.map((s)=>nh(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=Ri(s);o=i===null?s:Sv(t,i)}else if(r!=="$script")o=nh(s,t);if(o!==s)n??={...e},n[r]=o}return n===null?e:n}function pl(e,t){return nh(e,t)}function s1(e){return n1.test(e)&&!r1.test(e)}function $v(e){return Ri(e)==="client"||Ni(e)?.side==="client"}function rh(e,t,n){if(Array.isArray(e)){for(let[r,s]of e.entries())rh(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")rh(s,[...t,r],n);return n}function o1(e){let t=e.at(-1);return k(t)?`"${t}"`:"this entry"}function wv(e){let t=rh(e,[],[]),n=t.some((s)=>!s.lazy&&$v(s.src)),r=[];for(let s of t){let o=o1(s.path);if(!s.lazy&&s1(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&&$v(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 sh="jx-script:",QI="#client",e1="#server",n1,r1;var Ti=J(()=>{ce();n1=/^\.{1,2}\//u,r1=/\.json$/iu});function u1(e){for(let t of Object.keys(e))if(c1.has(t))return!0;return!1}function Ji(e){if(!e.startsWith("${")||!e.endsWith("}"))return!1;let[t,...n]=Hb(e);return t!==void 0&&n.length===0&&t.start===0&&t.end===e.length}function jv(){return[...Ev].toSorted()}function Rr(e,t){let n=e.toLowerCase();if(n.startsWith("aria-")||Ev.has(n))return String(t);return t?"":null}function Pv(e,t,n){if(!Array.isArray(e))return[];let r=e;if(_t(t))r=r.filter(t);if(_t(n))r=[...r].toSorted(n);return r}function _v(e,t,n,r){let s=Qo(t);if(r?.has(s)&&r.get(s)===void 0)return;let o=e[s];if(Ge(o)){e[s]=n!==null&&n!=="false";return}if(n===null){let i=r?.get(s);e[s]=i===void 0?Ie(o)?0:"":i;return}e[s]=Ie(o)?Number(n):n}function oh(e){let t=vv.get(e);if(t)return t;let n=new Set,r=Or(e);for(let[s,o]of Object.entries(e.state??{}))if(k(o)?le(o):fn(o)?!wr(o)&&!dr(o.$expression.operator):r.get(s)==="computed")n.add(s);return vv.set(e,n),n}function kv(e){let t=e.state??{},n=oh(e),r=(s)=>(s in t)&&!n.has(s);return{checked:r("checked"),disabled:r("disabled"),required:r("required"),value:r("value")}}function ih(e){let t=new Map;for(let[n,r]of Object.entries(e.state??{})){if(k(r)&&le(r)){t.set(n,void 0);continue}if(D(r)&&!Array.isArray(r)){if("default"in r){t.set(n,r.default);continue}if(f1.some((s)=>(s in r))){t.set(n,void 0);continue}if(u1(r))continue}t.set(n,r)}return t}var c1,pr,Ev,yY,vv,f1,ah=32,qu,Hu="jx-slot",ml="data-jx-slots",lh="jx.slot.group",xY;var Mi=J(()=>{dl();Ai();_i();ce();$i();An();Fu();th();Ti();th();dl();c1=new Set(["type","properties","items","enum","minimum","maximum","minLength","maxLength","pattern","required","examples"]);pr=new Set(["$schema","$shadow","formAssociated","formValue","$id","$defs","state","$ref","$props","$elements","$title","$description","$switch","$prototype","$src","$export","$script","$media","$map","timing","default","description","body","parameters","arguments","tagName","children","style","attributes","items","map","filter","sort","cases","observedAttributes"]),Ev=new Set(["contenteditable","draggable","spellcheck"]);yY=Object.freeze({emptyRow:!0});vv=new WeakMap;f1=["$expression","$prototype","$ref","$src"],qu=/^[\t\n\f\r ]+$/u,xY=(()=>{let e=Symbol.for(lh),t=globalThis;return t[e]??=new WeakMap,t[e]})()});function m1(){if(!hl){hl=new Map;for(let[e,t,n]of p1){let r=hl.get(e);if(!r)r=new Map,hl.set(e,r);for(let s of t.split(" "))r.set(s,n)}}return hl}function Bu(e,t){return Ov??=new Map(d1),Ov.get(t)??m1().get(t)?.get(e.toLowerCase())??null}function ch(e,t){if(t==="innerText")return!0;if(t==="value"||t==="defaultValue")return h1.has(e.toLowerCase());return t==="text"&&g1.has(e.toLowerCase())}var C=(e,t={})=>({attribute:e,kind:"text",...t}),we=(e,t={})=>({attribute:e,kind:"boolean",...t}),Wu,d1,p1,Ov,hl,h1,g1;var uh=J(()=>{Wu={live:!0},d1=[["accessKey",C("accesskey")],["ariaAtomic",C("aria-atomic")],["ariaAutoComplete",C("aria-autocomplete")],["ariaBrailleLabel",C("aria-braillelabel")],["ariaBrailleRoleDescription",C("aria-brailleroledescription")],["ariaBusy",C("aria-busy")],["ariaChecked",C("aria-checked")],["ariaColCount",C("aria-colcount")],["ariaColIndex",C("aria-colindex")],["ariaColIndexText",C("aria-colindextext")],["ariaColSpan",C("aria-colspan")],["ariaCurrent",C("aria-current")],["ariaDescription",C("aria-description")],["ariaDisabled",C("aria-disabled")],["ariaExpanded",C("aria-expanded")],["ariaHasPopup",C("aria-haspopup")],["ariaHidden",C("aria-hidden")],["ariaInvalid",C("aria-invalid")],["ariaKeyShortcuts",C("aria-keyshortcuts")],["ariaLabel",C("aria-label")],["ariaLevel",C("aria-level")],["ariaLive",C("aria-live")],["ariaModal",C("aria-modal")],["ariaMultiLine",C("aria-multiline")],["ariaMultiSelectable",C("aria-multiselectable")],["ariaOrientation",C("aria-orientation")],["ariaPlaceholder",C("aria-placeholder")],["ariaPosInSet",C("aria-posinset")],["ariaPressed",C("aria-pressed")],["ariaReadOnly",C("aria-readonly")],["ariaRelevant",C("aria-relevant")],["ariaRequired",C("aria-required")],["ariaRoleDescription",C("aria-roledescription")],["ariaRowCount",C("aria-rowcount")],["ariaRowIndex",C("aria-rowindex")],["ariaRowIndexText",C("aria-rowindextext")],["ariaRowSpan",C("aria-rowspan")],["ariaSelected",C("aria-selected")],["ariaSetSize",C("aria-setsize")],["ariaSort",C("aria-sort")],["ariaValueMax",C("aria-valuemax")],["ariaValueMin",C("aria-valuemin")],["ariaValueNow",C("aria-valuenow")],["ariaValueText",C("aria-valuetext")],["autocapitalize",C("autocapitalize")],["autocorrect",we("autocorrect",{keywords:["on","off"]})],["autofocus",we("autofocus")],["className",C("class")],["contentEditable",C("contenteditable")],["dir",C("dir")],["draggable",we("draggable")],["enterKeyHint",C("enterkeyhint")],["headingOffset",C("headingoffset")],["headingReset",we("headingreset")],["hidden",{attribute:"hidden",kind:"hidden"}],["id",C("id")],["inert",we("inert")],["inputMode",C("inputmode")],["lang",C("lang")],["popover",C("popover")],["role",C("role")],["slot",C("slot")],["spellcheck",we("spellcheck")],["tabIndex",C("tabindex")],["title",C("title")],["translate",we("translate",{keywords:["yes","no"]})],["writingSuggestions",C("writingsuggestions")]],p1=[["aLink","body",C("alink")],["abbr","td th",C("abbr")],["accept","input",C("accept")],["acceptCharset","form",C("accept-charset")],["action","form",C("action")],["align","caption col colgroup div embed h1 h2 h3 h4 h5 h6 hr iframe img input legend object p table tbody td tfoot th thead tr",C("align")],["allow","iframe",C("allow")],["allowFullscreen","iframe",we("allowfullscreen")],["alpha","input",we("alpha")],["alt","area img input",C("alt")],["archive","object",C("archive")],["as","link",C("as")],["async","script",we("async")],["autocomplete","form input select textarea",C("autocomplete")],["autoplay","audio video",we("autoplay")],["axis","td th",C("axis")],["background","body",C("background")],["behavior","marquee",C("behavior")],["bgColor","body marquee table td th tr",C("bgcolor")],["border","img object table",C("border")],["cellPadding","table",C("cellpadding")],["cellSpacing","table",C("cellspacing")],["ch","col colgroup tbody td tfoot th thead tr",C("char")],["chOff","col colgroup tbody td tfoot th thead tr",C("charoff")],["charset","a link script",C("charset")],["checked","input",we("checked",Wu)],["cite","blockquote del ins q",C("cite")],["clear","br",C("clear")],["closedBy","dialog",C("closedby")],["code","object",C("code")],["codeBase","object",C("codebase")],["codeType","object",C("codetype")],["colSpan","td th",C("colspan")],["color","font hr",C("color")],["colorSpace","input",C("colorspace")],["cols","frameset textarea",C("cols")],["command","button",C("command")],["compact","dir dl menu ol ul",we("compact")],["content","meta",C("content")],["controls","audio img video",we("controls")],["coords","a area",C("coords")],["crossOrigin","audio img link script video",C("crossorigin")],["data","object",C("data")],["dateTime","del ins time",C("datetime")],["declare","object",we("declare")],["decoding","img",C("decoding")],["default","track",we("default")],["defaultChecked","input",we("checked")],["defaultMuted","audio video",we("muted")],["defaultSelected","option",we("selected")],["defaultValue","input",C("value")],["defer","script",we("defer")],["dirName","input textarea",C("dirname")],["direction","marquee",C("direction")],["disabled","button fieldset input link optgroup option select textarea",we("disabled")],["download","a area",C("download")],["encoding","form",C("enctype")],["enctype","form",C("enctype")],["event","script",C("event")],["face","font",C("face")],["fetchPriority","img link script",C("fetchpriority")],["formAction","button input",C("formaction")],["formEnctype","button input",C("formenctype")],["formMethod","button input",C("formmethod")],["formNoValidate","button input",we("formnovalidate")],["formTarget","button input",C("formtarget")],["frame","table",C("frame")],["frameBorder","frame iframe",C("frameborder")],["headers","td th",C("headers")],["height","canvas embed iframe img input marquee object source td th video",C("height")],["high","meter",C("high")],["href","a area base link",C("href")],["hreflang","a area link",C("hreflang")],["hspace","embed img input marquee object",C("hspace")],["htmlFor","label script template",C("for")],["httpEquiv","meta",C("http-equiv")],["imageSizes","link",C("imagesizes")],["imageSrcset","link",C("imagesrcset")],["integrity","link script",C("integrity")],["isMap","img",we("ismap")],["kind","track",C("kind")],["label","optgroup option track",C("label")],["link","body",C("link")],["loading","audio iframe img video",C("loading")],["longDesc","frame iframe img",C("longdesc")],["loop","audio video",we("loop")],["low","meter",C("low")],["lowsrc","img",C("lowsrc")],["marginHeight","frame iframe",C("marginheight")],["marginWidth","frame iframe",C("marginwidth")],["max","input meter progress",C("max")],["maxLength","input textarea",C("maxlength")],["media","link meta source style",C("media")],["method","form",C("method")],["min","input meter",C("min")],["minLength","input textarea",C("minlength")],["multiple","input select",we("multiple")],["muted","audio video",we("muted",Wu)],["name","a button details embed fieldset form frame iframe img input map meta object output param select slot textarea",C("name")],["noHref","area",we("nohref")],["noModule","script",we("nomodule")],["noResize","frame",we("noresize")],["noShade","hr",we("noshade")],["noValidate","form",we("novalidate")],["noWrap","td th",we("nowrap")],["open","details dialog",we("open")],["optimum","meter",C("optimum")],["pattern","input",C("pattern")],["ping","a area",C("ping")],["placeholder","input textarea",C("placeholder")],["playsInline","video",we("playsinline")],["popoverTargetAction","button input",C("popovertargetaction")],["poster","video",C("poster")],["preload","audio video",C("preload")],["readOnly","input textarea",we("readonly")],["referrerPolicy","a area iframe img link script",C("referrerpolicy")],["rel","a area form link",C("rel")],["required","input select textarea",we("required")],["rev","a link",C("rev")],["reversed","ol",we("reversed")],["rowSpan","td th",C("rowspan")],["rows","frameset textarea",C("rows")],["rules","table",C("rules")],["scheme","meta",C("scheme")],["scope","td th",C("scope")],["scrollAmount","marquee",C("scrollamount")],["scrollDelay","marquee",C("scrolldelay")],["scrolling","frame iframe",C("scrolling")],["selected","option",we("selected",Wu)],["shadowRootClonable","template",we("shadowrootclonable")],["shadowRootCustomElementRegistry","template",C("shadowrootcustomelementregistry")],["shadowRootDelegatesFocus","template",we("shadowrootdelegatesfocus")],["shadowRootMode","template",C("shadowrootmode")],["shadowRootSerializable","template",we("shadowrootserializable")],["shadowRootSlotAssignment","template",C("shadowrootslotassignment")],["shape","a area",C("shape")],["size","font hr input select",C("size")],["sizes","img source",C("sizes")],["span","col colgroup",C("span")],["src","audio embed frame iframe img input source track video",C("src")],["srcdoc","iframe",C("srcdoc")],["srclang","track",C("srclang")],["srcset","img source",C("srcset")],["standby","object",C("standby")],["start","ol",C("start")],["step","input",C("step")],["summary","table",C("summary")],["target","a area base form link",C("target")],["text","body",C("text")],["trueSpeed","marquee",we("truespeed")],["type","a area button embed input li link object ol param script source style ul",C("type")],["useMap","img input object",C("usemap")],["vAlign","col colgroup tbody td tfoot th thead tr",C("valign")],["vLink","body",C("vlink")],["value","button data li meter option param progress",C("value")],["value","input",C("value",Wu)],["valueType","param",C("valuetype")],["version","html",C("version")],["vspace","embed img input marquee object",C("vspace")],["width","canvas col colgroup embed hr iframe img input listing marquee object pre source table td th video xmp",C("width")],["wrap","textarea",C("wrap")]];h1=new Set(["output","textarea"]),g1=new Set(["a","option","title"])});var fh,dh;var ph=J(()=>{fh={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."},dh={anyOf:[{$ref:"#/$defs/TagName"},{additionalProperties:!1,properties:{$expression:{$ref:"#/$defs/TagExpression"}},required:["$expression"],type:"object"}]}});var mh;var hh=J(()=>{mh={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 gh,yh,xh;var bh=J(()=>{gh={oneOf:[{type:"string"},{$ref:"#/$defs/RefObject"}]},yh={oneOf:[{type:"boolean"},{$ref:"#/$defs/RefObject"}]},xh={oneOf:[{type:"number"},{$ref:"#/$defs/RefObject"}]}});var $h;var Sh=J(()=>{$h={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 wh,vh;var Eh=J(()=>{wh={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"},vh={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 gl;var jh=J(()=>{gl={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 Ph;var _h=J(()=>{Ph={enum:["string","number","integer","boolean","array","object","null"],type:"string"}});var kh,Oh,Ah,Ch,Rh,Nh,Th,Jh,Mh;var Ih=J(()=>{kh={description:"Reference to a $defs type definition in the current component.",examples:["#/$defs/Count","#/$defs/TodoItem","#/$defs/Status"],pattern:String.raw`^#/\$defs/`,type:"string"},Oh={description:"Reference to a state entry (runtime variable) in the current component.",examples:["#/state/count","#/state/addTask","#/state/items"],pattern:"^#/state/",type:"string"},Ah={description:"Reference to an external Jx component file.",examples:["./card.json","https://cdn.example.com/button.json"],pattern:String.raw`^(\./|\.\./).*\.json$|^https?://`,type:"string"},Ch={description:"Reference to a window or document global.",examples:["window#/currentUser","document#/appConfig"],pattern:"^(window|document)#/",type:"string"},Rh={description:"Reference to a named state entry passed via $props from a parent component.",examples:["parent#/sharedState","parent#/theme"],pattern:"^parent#/",type:"string"},Nh={description:"Reference to the current Array map iteration context.",examples:["$map/item","$map/index","$map/item/text","$map/item/done","#/$map/item/text"],pattern:String.raw`^(#/)?\$map/(item|index)(/.*)?$`,type:"string"},Th={oneOf:[{$ref:"#/$defs/InternalRef"},{$ref:"#/$defs/StateRef"},{$ref:"#/$defs/ExternalRef"},{$ref:"#/$defs/GlobalRef"},{$ref:"#/$defs/ParentRef"},{$ref:"#/$defs/MapRef"}],type:"string"},Jh={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"},Mh={properties:{$props:{$ref:"#/$defs/PropsObject"},$ref:{$ref:"#/$defs/ExternalRef"}},required:["$ref"],type:"object"}});var yl;var Dh=J(()=>{yl={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 Lh,Fh;var Vh=J(()=>{Lh={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, in either spelling ($map/item/id or #/$map/item/id). 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"},Fh={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 qh,Hh,Wh,Bh,Uh,Uu;var zh=J(()=>{qh={additionalProperties:{oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{$ref:"#/$defs/RefObject"}]},description:"HTML attributes and ARIA attributes set via element.setAttribute().",type:"object"},Hh={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"},Wh={oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"null"},{$ref:"#/$defs/RefObject"}]},Bh={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"},Uh={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"},Uu={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 Kh;var Gh=J(()=>{Kh={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 Xh;var Yh=J(()=>{Xh={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 Zh,Qh;var eg=J(()=>{Zh={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"}]},Qh={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 tg,ng;var rg=J(()=>{tg=["Function","Request","URLSearchParams","FormData","LocalStorage","SessionStorage","Cookie","IndexedDB","Array","Set","Map","Blob","ReadableStream"],ng={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 sg;var og=J(()=>{sg={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 ig,ag,lg,cg,ug,fg,dg,pg,mg,hg,gg,yg,xg,bg,$g,Sg,wg;var vg=J(()=>{Hm();ig={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"},ag={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."},lg={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."},cg={enum:["!","-"]},ug={enum:["+","-","*","/","%","===","!==","<","<=",">",">=","&&","||","??"]},fg={const:"?:"},dg={const:"switch"},pg={const:"call"},mg={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"]},hg={enum:["=","+=","-=","*=","/="]},gg={enum:["pop","shift"]},yg={enum:["push","unshift"]},xg={const:"splice"},bg={const:"reduce"},$g={enum:["map","filter"]},Sg={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 "+`${av()}) — 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"},wg={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 Eg,jg,Pg,_g;var kg=J(()=>{Eg={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"}]},jg={additionalProperties:{$ref:"#/$defs/StateEntry"},description:"Map of runtime variables. Keys are camelCase (public) or #-prefixed (private). All entries are reactive by default.",type:"object"},Pg={additionalProperties:{$ref:"#/$defs/TypeDefEntry"},description:"Map of reusable JSON Schema type definitions. Keys are PascalCase type names. No runtime artifacts are produced.",type:"object"},_g={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 Av,zu,Ku,Gu,Xu,Yu,Zu,Qu,ef,tf,Og;var Ag=J(()=>{Av=["method","accessor","parse","serialize","rewrite","discover","load","projectData","resolvePaths","lower","emit","head","assets","mount","dialect","deploySchema","bindings","testConnection"],zu={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"},Ku={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"},Xu={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:Av,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"},Yu={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"},Zu={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"},Qu={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"},ef={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"},tf={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"},Og={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 Cv,nf;var Cg=J(()=>{Jo();Cv=[301,302,303,307,308],nf={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:[...Cv],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 Rg;var Ng=J(()=>{Rg={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 xl="https://jxsuite.com/schema/project/fields/v2",Io="https://jxsuite.com/schema/document/paths/v2",Tg,Jg,bl,Mg;var $l=J(()=>{Tg={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"},Jg={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"},bl=[{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"}],Mg={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 Rv=J(()=>{ph();hh();bh();Sh();Eh();jh();_h();Ih();Dh();Vh();zh();Gh();Yh();eg();rg();og();vg();kg();Ag();Cg();Ng();$l()});function Nv(e,t,n){let r=e.$description;if(k(r))(Object.keys(t).length>0?t:n).$description=r}function Tv(e,t,n,r,s=y1,o={}){let i=[],a=(p,m)=>{let y={mediaQueries:t,scope:m,transposeValue:n};if(r)y.resolveValue=(S,g)=>r(S,g,m);for(let S of Pi(p,y))i.push(o.comments===!0?fl(S):S.text)},l={},c={},u=[],d=[];for(let[p,m]of Object.entries(e)){if(D(m)&&!Array.isArray(m)){if(p.startsWith("@"))u.push([p,m]);else if(!p.startsWith("--"))d.push([p,m]);continue}if(ul(p)||p.startsWith("@")||p.startsWith("$"))continue;if(p.startsWith("--")||p==="colorScheme"||p==="color-scheme")l[p]=m;else c[p]=m}Nv(e,l,c),a(l,s.root),a(c,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(ll(p)||cl(p)){a({[p]:m},null);continue}let y={},S={},g=[];for(let[x,P]of Object.entries(m)){if(D(P)&&!Array.isArray(P)){if(!x.startsWith("@"))g.push([x,P]);continue}if(x.startsWith("$"))continue;if(x.startsWith("--"))y[x]=P;else S[x]=P}Nv(m,y,S),a({[p]:y},s.root),a({[p]:S},s.body);for(let[x,P]of g)a({[p]:P},x)}if(Object.values(t).some((p)=>fr(p)!==null)&&!("colorScheme"in e))i.push(`${s.root} { color-scheme: light dark }`,`${s.root}:where([${ur}="light"]) { color-scheme: light }`,`${s.root}:where([${ur}="dark"]) { color-scheme: dark }`);return i.join(`
130
- `)}var y1;var Jv=J(()=>{dl();ce();y1={body:"body",root:":root"}});function Mv(e,t){return t===null?e:":host"}var Sl=J(()=>{dl()});function kl(e,t){let n=[];for(let[r,s]of(e.parameters??[]).entries()){let o=Iv(s);if(!o)continue;let i=Dv(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 Iv(e){return k(e)?e:e?.name??""}function Dv(e){return D(e)&&"default"in e}function x1(e,t){let n=Lv(e,t);return n===e?e:`${n} as ${e}`}function Lv(e,t){let n=t?.$export;return k(n)&&n!==""?n:e}function cf(e,t,n={}){let{statePrefix:r="state",indent:s="",collect:o}=n,{url:i}=t,a=le(i),l=t.method??"GET";if(t.manual)return`${s}// ${e}: manual Request — fetch triggered by user action`;let c=[`// ${e}: auto-fetch from ${a?"(dynamic URL)":i}`,o?`${o}.push(effect(() => {`:"effect(() => {"];if(a)c.push(` const url = \`${$1(i,r)}\`;`,' if (!url || url === "undefined" || url.includes("undefined")) return;');else c.push(` const url = ${JSON.stringify(i)};`);let u=[];if(l!=="GET")u.push(`method: ${JSON.stringify(l)}`);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 c.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?"}));":"});"),c.map((p)=>`${s}${p}`).join(`
131
- `)}function uf(e,t,n={}){let{statePrefix:r="state",indent:s="",collect:o,serverBaseUrl:i="/_jx/server"}=n,a=JSON.stringify(`${i}/${t.$export}`),l=Object.entries(t.arguments??{}),c=l.map(([S,g])=>{if(!me(g))return`${us(S)}: ${JSON.stringify(g)}`;if(b1.some((x)=>g.$ref.startsWith(x)))throw Error(`Server function "${e}": argument "${S}" references "${g.$ref}", which a state entry cannot read. Use a #/state/, parent#/, window#/ or document#/ reference.`);return`${us(S)}: ${fs({$ref:g.$ref},{statePrefix:r})}`}),u=l.some(([,S])=>me(S)),d=`${Qv}(${a}, ${c.length>0?`{ ${c.join(", ")} }`:"{}"})`,p=Re(r,Wt(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((S)=>`${s}${S}`).join(`
132
- `)}function $1(e,t){if(t==="state")return e;return e.replaceAll(/\$\{([^}]*)\}/g,(n,r)=>`\${${r.replaceAll(/(?<!this\.)\bstate\./g,`${t}.`)}}`)}function Pl(e){return`<script type="importmap">
197
+ `);return e}function cv(e,t,n){let{code:r,problems:s}=oD(e),[o,...i]=s.filter((a)=>a.kind==="unsupported");if(o)throw new Ku(t,[o,...i]);for(let a of s)n.push({...t,problem:a});return r}function vg(e,t,n){if(Array.isArray(e))return e.map((i,a)=>vg(i,{...t,pointer:`${t.pointer}/${a}`},n));if(!L(e))return e;let r=_p(e),s=[],o={set:(i,a)=>{s.push([i,a])}};for(let[i,a]of Object.entries(e)){let l={...t,pointer:`${t.pointer}/${iD(i)}`};if(r&&i==="body")o.set(i,lv(a,l,n));else if(r&&(i==="getter"||i==="setter")&&L(a)){let c={...a};if(a.body!==void 0)c.body=lv(a.body,{...l,pointer:`${l.pointer}/body`},n);o.set(i,c)}else o.set(i,vg(a,l,n))}return Object.fromEntries(s)}function yl(e,t,n=[]){return vg(e,{path:t,pointer:""},n)}function mv(e,t,n=[]){return yl(e,t,n)}var nD,$g,zu=null,wg=null,av,Ku;var Eg=M(()=>{ae();nD=/(^|[\n;{}])(\s*)(import|export)(?=[\s{*"'])/gu;$g=new Map;av=new Map;Ku=class Ku 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 aD}from"node:module";var Gu=M(()=>{Eg();Eg();fv(()=>aD(import.meta.url)("ts-blank-space").default)});function gv(e){for(let{path:t,pointer:n,problem:r}of e){let s=`${t}${n} (line ${r.line}, column ${r.column}): ${r.message}`;if(!hv.has(s))hv.add(s),console.warn(`Warning: ${s}`)}}function Cr(e,t){let n=[],r=yl(e,t,n);return gv(n),r}function yv(e,t){let n=[],r=mv(e,t,n);return gv(n),r}var hv;var Ai=M(()=>{Gu();hv=new Set});function cD(e){return e.split("\\").join("/").replace(/^\.\//,"").replace(/^\//,"").replace(/^pages\//,"")}function xv(e){let t=cD(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(lD,(l,c,u)=>{if(o=!0,c)return i=!0,s.push(c),"*";return s.push(u),`:${u}`});return{isCatchAll:i,isDynamic:o,params:s,urlPattern:a}}function bv(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 lD;var $v=M(()=>{lD=/\[\.\.\.(\w+)\]|\[(\w+)\]/g});function fD(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function Sv(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=_(s)?uD.exec(s)?.[1]:void 0;if(o===void 0)throw TypeError('$paths.paginate must be { "$ref": "#/state/<key>" }');if(!De(n)||!Number.isInteger(n)||n<1)throw TypeError("$paths.pageSize must be a positive integer");let i={key:fD(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 jg(e,t){return Math.max(1,Math.ceil(e/t))}function wv(e,t,n){let r=(t-1)*n;return e.slice(r,r+n)}function Lo(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 vv(e,t,n,r){let s=jg(r,n),o=[];for(let i=1;i<=s;i++)o.push({current:i===t,number:i,url:Lo(e,i)});return{first:Lo(e,1),itemCount:r,last:Lo(e,s),next:t<s?Lo(e,t+1):null,number:t,pageCount:s,pageSize:n,pages:o,prev:t>1?Lo(e,t-1):null}}var uD;var Ev=M(()=>{ae();uD=/^#\/state\/([^/]+)$/});function xn(e){return e.replaceAll(/[A-Z]/g,(t)=>`-${t.toLowerCase()}`)}function Pv(e,t){if(e.startsWith("@--"))return t[e.slice(1)]??e.slice(1);if(e.startsWith("@(")){let n=e.slice(2,-1).trim();return dD.has(n.toLowerCase())?n:e.slice(1)}return null}function xl(e){return e.startsWith("@position-try")||e.startsWith("@property")||e.startsWith("@font-face")||e.startsWith("@counter-style")}function bl(e){return e.startsWith("@keyframes")}function kv(e,t){let n=[];for(let r of Ci(e))for(let s of Ci(t))n.push(Pg(r,s));return n.join(", ")}function Pg(e,t){let n=mD(e,t);if(n!==null)return n;let r=Tv(t,e);if(r!==null)return r;if(t.startsWith("[")||t.startsWith(":")||t.startsWith("."))return`${e}${t}`;return`${e} ${t}`}function _v(e,t){let n=0,r=null;for(let s=t;s<e.length;s+=1){let o=e[s];if(o==="\\")s+=1;else if(r)r=o===r?null:r;else if(o==='"'||o==="'")r=o;else if(o==="(")n+=1;else if(o===")"){if(n-=1,n===0)return s+1}}return-1}function Ov(e){if(e.endsWith(":host"))return{inner:"",prefix:e.slice(0,-5)};let t=e.lastIndexOf(":host(");if(t===-1||_v(e,t+5)!==e.length)return null;return{inner:e.slice(t+6,-1),prefix:e.slice(0,t)}}function Av(e){if(!e.startsWith(":host"))return null;let t=e.slice(5);if(t.startsWith("(")){let n=_v(t,0);return n===-1?null:{inner:t.slice(1,n-1),rest:t.slice(n)}}return/^[\w-]/u.test(t)?null:{inner:null,rest:t}}function Cv(e){let t=0,n=null;for(let r=0;r<e.length;r+=1){let s=e[r];if(s==="\\")r+=1;else if(n)n=s===n?null:n;else if(s==='"'||s==="'")n=s;else if(s==="("||s==="[")t+=1;else if(s===")"||s==="]")t-=1;else if(t===0){if(/[\s>+~]/u.test(s)||e.startsWith("::",r))return r;if(s===":"&&pD.test(e.slice(r)))return r}}return e.length}function mD(e,t){let n=Ov(e);if(n===null||!Og(t))return null;let r=Yu(t);if(r.length>1||r.length===1&&r[0]!==0)return null;let s=r.length===1?t.slice(1):t,o=Cv(s);if(o===0)return`${e}${s}`;return`${n.prefix}:host(${n.inner}${s.slice(0,o)})${s.slice(o)}`}function gD(e,t,n){let r=Av(e);if(r===null)return n==="shadow"&&hD.test(e)?e:Pg(t,e);let{inner:s,rest:o}=r;if(n==="light")return`${t}${s??""}${o}`;let a=`${Ov(t)?.prefix??""}:host${s===null?"":`(${s})`}`;if(o==="")return a;return/^[\s>+~]/u.test(o)?`${a}${o}`:Pg(a,o)}function Rv(e,t,n){let r=[];for(let s of Ci(t))for(let o of Ci(e))r.push(gD(o,s,n));return r.join(", ")}function yD(e){return Ci(e).every((t)=>{let n=Av(t);if(n===null)return Og(t);let r=Cv(n.rest);return n.rest.slice(r).replace(/^::?[\w-]+(?:\([^)]*\))?/u,"")===""})}function Yu(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 Tv(e,t){return Yu(e).length>0?xD(e,t):null}function xD(e,t){let n="",r=0;for(let s of Yu(e))n+=e.slice(r,s)+t,r=s+1;return n+e.slice(r)}function Ci(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 mr(e){let t=/^\(\s*prefers-color-scheme\s*:\s*(light|dark)\s*\)$/.exec(e.trim())?.[1];return t==="light"||t==="dark"?t:null}function kg(e,t){if(e===":root"||e==="html")return{auto:`${e}:where(:not([${pr}]))`,forced:`${e}:where([${pr}="${t}"])`};return{auto:`:where(:root:not([${pr}])) ${e}`,forced:`:where(:root[${pr}="${t}"]) ${e}`}}function $l(e){return e.startsWith(":")||e.startsWith(".")||e.startsWith("&")||e.startsWith("[")}function _g(e){return e.startsWith("--")?e:xn(e)}function Xu(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 Nv(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 Sl(e){if(e.description===void 0)return e.text;return`/* ${e.description.replaceAll("*/","* /")} */
198
+ ${e.text}`}function bD(e,t,n){let r=n.map(({selector:o,declarations:i})=>`${o} { ${i.map(([a,l])=>`${a}: ${l}`).join("; ")} }`).join(" "),s=`@keyframes ${t} { ${r} }`;for(let o=e.length-1;o>=0;o-=1)s=`${e[o]} { ${s} }`;return s}function $D(e){let t=Object.keys(e).filter((r)=>bl(r));if(t.length===0)return e;let n={...e};for(let r of t)delete n[r];return n}function Og(e){let n=Yu(e).at(-1),r=n===void 0?e:e.slice(n+1);return r===""||r.startsWith(":")||r.startsWith(".")||r.startsWith("[")}function Ri(e,t={}){let{scope:n=null,mediaQueries:r={},transposeValue:s=(w)=>w,transposeSelector:o=(w)=>w,resolveValue:i,host:a,shadowTree:l=!1}=t,c=[],u=(w)=>w!==null&&typeof w==="object"&&!Array.isArray(w)&&!pe(w),d=(w,v)=>{if(u(v))return[v];if(!xl(w)||!Array.isArray(v)||v.length===0)return[];return v.every((E)=>u(E))?v:[]},p=(w,v,E,O)=>{if(v===void 0||v===null)return null;if(pe(v))return E?i?.(w,v,O)??null:null;if(F(v))return null;let I=String(v);if(ce(I))return E?i?.(w,I,O)??null:null;return s(I)},m=(w,v,E=!0,O="self")=>{let I=[];for(let[D,V]of Object.entries(w)){if(d(D,V).length>0)continue;if(v&&(D.startsWith("@")||$l(D)))continue;if(D.startsWith("$"))continue;let W=p(D,V,E,O);if(W!==null)I.push([_g(D),W])}return I},g=(w)=>_(w)&&w!==""?{description:w}:{},b=(w,v,E,O,I)=>{if(E.length===0)return;let D=v;if(D!==null){let A=o(D);if(A===null)return;D=A}let V=Nv(w,D,E),W={text:V,conditions:[...w],selector:D,declarations:E,target:O,key:Xu(V)};c.push({...W,...g(I)})},h=(w,v,E)=>{let O=w.slice(10).trim();if(O==="")return;let I=[];for(let[V,W]of Object.entries(v)){if(!u(W))continue;let A=m(W,!0,!1,"unscoped");if(A.length>0)I.push({declarations:A,selector:V.trim()})}if(I.length===0)return;let D=bD(E,O,I);c.push({blocks:I,conditions:[...E],declarations:[],key:Xu(D),selector:null,target:"unscoped",text:D,...g(v.$description)})},x=(w,v,E,O,I,D)=>{if(w==="@--")return;if(xl(w)){b([...O,w],null,m(v,!1,!0,"unscoped"),"unscoped",v.$description);return}if(bl(w)){h(w,v,O);return}let V=Pv(w,r),W=V===null?w:`@media ${V}`,A=V===null?null:mr(V);if(A!==null&&E!==null&&!l){let{auto:J,forced:G}=kg(E,A);k(v,J,[...O,W],I,D),k($D(v),G,O,I,D);return}k(v,E,[...O,W],I,D)};function k(w,v,E,O,I){b(E,v,m(w,!0,!0,O),O,w.$description);for(let[D,V]of Object.entries(w))for(let W of d(D,V))if(D.startsWith("@"))x(D,W,v,E,O,I);else if(v!==null&&I&&a!==void 0)k(W,Rv(D,v,a),E,yD(D)?O:"descendant",!1);else if(v!==null)k(W,kv(v,D),E,Og(D)?O:"descendant",!1)}return k(e,n,[],"self",!0),c}function jv(e){return e===!1||e==="open"||e==="closed"}function Jn(e,t){let n=e?.$shadow;if(jv(n))return n===!1?null:n;let r=t?.shadow;return jv(r)&&r!==!1?r:null}var dD,pD,hD,pr="data-color-scheme",Zu="jx-color-scheme";var wl=M(()=>{ae();dD=new Set(["all","print","screen","speech"]);pD=/^:(?:before|after|first-line|first-letter)(?![\w-])/u;hD=/^::(?:slotted|part)\(/u});function SD(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function Ut(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function an(e){return e.startsWith("#/$map/")?e.slice(2):e}function Xn(e){if(e==="")return[];return e.split("/").map((t)=>SD(t))}function zt(e,t){let n=e;for(let r of Xn(t))n=n?.[r];return n}function Je(e,t){let n=e;for(let r of Xn(t))n+=Ag.test(r)?`.${r}`:`[${JSON.stringify(r)}]`;return n}function Jv(e,t){let n=e;for(let[r,s]of Xn(t).entries()){let o=r===0?"":"?.";n+=Ag.test(s)?`${r===0?".":o}${s}`:`${o}[${JSON.stringify(s)}]`}return n}function fs(e){return Ag.test(e)?e:JSON.stringify(e)}function Mv(e){let t=e.replaceAll(/[^A-Za-z0-9_$]/g,"_");if(t==="")return"ref";return/^\d/.test(t)?`_${t}`:t}var Ag;var Ti=M(()=>{Ag=/^[A-Za-z_$][A-Za-z0-9_$]*$/});function Cg(e){let t=e.$map;return F(t)?t:void 0}function tf(e){return F(e)&&!Array.isArray(e)&&"operator"in e}function Ni(e){return F(e)&&!Array.isArray(e)&&"$ref"in e}function jD(e,t,n){let r=tw[e];if(r===void 0||r<0||t[r]!=null)return t;let s=zt(n.$page,"locale");if(!_(s)||s==="")return t;let o=[...t];return o[r]=s,o}function Hv(){return globalThis.window??globalThis}function Wv(e){return e.startsWith("window#/")&&vD.has(e.slice(8))}function hr(e){return Fv.has(e)}function Qu(e){if(Array.isArray(e))return e.some((t)=>Qu(t));if(e===void 0||!tf(e))return!1;return hr(e.operator)||[e.target,e.value,e.initial,e.default].some((t)=>Qu(t))||Object.values(e.cases??{}).some((t)=>Qu(t))}function Fo(e){return wr(e)&&!Qu(e.$expression)}function Rg(e,t){if(Array.isArray(e)){for(let n of e)Rg(n,t);return}if(e===void 0||!F(e))return;if(Ni(e)){if(!PD.test(e.$ref)){let n=e.$ref.replace(/^(?:#\/state\/|parent#\/)/,"");t.add(Xn(n)[0]??"")}return}if(tf(e)){let n=[e.target,e.value,e.initial,e.default];for(let r of[...n,...Object.values(e.cases??{})])Rg(r,t)}}function Dg(e){let t=new Set;return Rg(e.$expression,t),[...t]}function Lg(e){let t=new Map;for(let[r,s]of Object.entries(e??{}))if(!r.startsWith("$")&&Fo(s))t.set(r,s);let n=!1;while(!n){n=!0;for(let[r,s]of t)if(Dg(s).some((o)=>!t.has(o)))t.delete(r),n=!1}return Object.fromEntries(t)}function ut(e,t){if(!e)return;let n=(e.depth??0)+1;if(n>kD)return;return{depth:n,path:[...e.path??[],...Array.isArray(t)?t:[t]],report:e.report}}function at(e,t,n,r,s){if(e===null||e===void 0)return e;if(tf(e))return Mn(e,t,n,r,s);if(Ni(e)){let o=ef(e.$ref,t,n,r);return s?.report(s.path??[],o),o}if(Array.isArray(e))return Bv(e,t,n,r,s);return s?.report(s.path??[],e),e}function Bv(e,t,n,r,s){return e.map((o,i)=>at(o,t,n,r,ut(s,i)))}function _D(e,t,n,r){let s=an(e),o=(i)=>{if(!s.slice(i.length).includes("/"))return t;return ef(s.slice(0,s.lastIndexOf("/")),t,n,r)};if(s.startsWith("#/state/"))return o("#/state/");if(s.startsWith("parent#/"))return o("parent#/");if(s.startsWith("$map/")||s.startsWith("$args/"))return s.split("/").length>2?ef(s.slice(0,s.lastIndexOf("/")),t,n,r):void 0;return}function ef(e,t,n,r){let s=an(e);if(s==="$reduce/acc")return r?.acc;if(s.startsWith("$reduce/"))return r?.acc;if(s.startsWith("$args/")){let o=s.slice(6).split("/"),i=r?.args?.[o[0]];return o.length>1?zt(i,o.slice(1).join("/")):i}if(s.startsWith("event#/")){let o=s.slice(7);return zt(n,o)}if(s.startsWith("$map/")){let o=s.split("/"),[,i]=o,a,l=Cg(t);if(i==="item")a=r?.item??l?.item??t["$map/item"];else if(i==="index")a=r?.index??l?.index??t["$map/index"];else a=l?.[i]??t[`$map/${i}`];return o.length>2?zt(a,o.slice(2).join("/")):a}if(s.startsWith("#/state/"))return zt(t,s.slice(8));if(s.startsWith("parent#/"))return zt(t,s.slice(8));if(s.startsWith("window#/"))return zt(Hv(),s.slice(8));if(s.startsWith("document#/"))return zt(globalThis.document,s.slice(10));return zt(t,s)??null}function OD(e,t,n,r){let s=an(e);if(s.startsWith("$map/")){let o=s.split("/"),[,i]=o,a,l=Cg(t);if(i==="item")a=r?.item??l?.item??t["$map/item"];else if(i==="index")a=r?.index??l?.index??t["$map/index"];else a=l?.[i]??t[`$map/${i}`];if(o.length>2){let c=o.slice(2),u=c.pop(),d=c.length>0?zt(a,c.join("/")):a;return{key:u,obj:d}}return{key:i==="item"?"$map/item":"$map/index",obj:Cg(t)??t}}if(s.startsWith("#/state/")){let o=s.slice(8);if(o.indexOf("/")===-1)return{key:o,obj:t};let a=Xn(o),l=a.pop(),c=t;for(let u of a)c=c[u];return{key:l,obj:c}}return{key:s,obj:t}}function Mn(e,t,n,r,s){let o=AD(e,t,n,r,s);return s?.report(s.path??[],o),o}function Dv(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 AD(e,t,n,r,s){let{operator:o,target:i,value:a,initial:l}=e;if(!wD.has(o))throw Error(`$expression: unknown operator "${o}"`);if(Tg.has(o)&&!("value"in e)){let c=at(i,t,n,r,ut(s,"target"));if(o==="!")return!c;if(o==="-")return-c}if(o==="call"){let c=Ni(i)?i.$ref:void 0;if(!_(c))throw TypeError("$expression: call target must be a $ref pointer");let u=(r?.callDepth??0)+1;if(u>Iv)throw Error(`$expression: call depth exceeded (${Iv})`);let d=Array.isArray(a)?a.map((m,g)=>at(m,t,n,r,ut(s,["value",g]))):[];if(c.startsWith("window#/")){if(!Wv(c))throw Error(`$expression: "${c}" is not a blessed pure global`);let m=c.slice(8),g=ED.get(m);if(g)return g(...jD(m,d,t));let b=Hv(),h=zt(b,m),x=m.lastIndexOf("/"),k=x===-1?b:zt(b,m.slice(0,x));return h.apply(k,d)}let p=ef(c,t,n,r);if(Ot(p))return p.apply(_D(c,t,n,r),d);if(F(p)&&"$expression"in p){let m=p,g={};for(let[b,h]of(m.parameters??[]).entries()){let x=_(h)?h:h?.name??"";if(!x)continue;g[x]=d[b]===void 0&&F(h)&&"default"in h?h.default:d[b]}return Mn(m.$expression,t,n,{args:g,callDepth:u})}throw TypeError(`$expression: call target "${c}" is not callable`)}if(Mg.has(o)){if(o==="?:"){let m=at(i,t,n,r,ut(s,"target"));if(s){let g=at(a,t,n,r,ut(s,"value")),b=at(l,t,n,r,ut(s,"initial"));return m?g:b}return m?at(a,t,n,r):at(l,t,n,r)}let c=at(i,t,n,r,ut(s,"target")),u=String(c),d=e.cases??{},p=Object.hasOwn(d,u);if(s){let m;for(let[b,h]of Object.entries(d)){let x=at(h,t,n,r,ut(s,["cases",b]));if(b===u)m=x}let g=at(e.default,t,n,r,ut(s,"default"));return p?m:g}return p?at(d[u],t,n,r):at(e.default,t,n,r)}if(Ng.has(o)){let c=at(i,t,n,r,ut(s,"target")),u=at(a,t,n,r,ut(s,"value"));switch(o){case"===":return c===u;case"!==":return c!==u;case"&&":return c&&u;case"||":return c||u;case"??":return c??u;default:return Dv(o,c,u)}}if(Vv.has(o)){let c=at(a,t,n,r,ut(s,"value")),{obj:u,key:d}=OD(i.$ref,t,n,r);u[d]=o==="="?c:Dv(o.slice(0,-1),u[d],c);return}if(qv.has(o)){let c=at(i,t,n,r,ut(s,"target"));switch(o){case"push":return c.push(at(a,t,n,r,ut(s,"value")));case"unshift":return c.unshift(at(a,t,n,r,ut(s,"value")));case"pop":return c.pop();case"shift":return c.shift();case"splice":{let u=at(a,t,n,r,ut(s,"value"));return c.splice(...u)}default:break}}if(Ig.has(o)){let c=at(i,t,n,r,ut(s,"target")),u=a===void 0?[]:Array.isArray(a)?Bv(a,t,n,r,ut(s,"value")):[at(a,t,n,r,ut(s,"value"))],d=zt(c,o);if(!Ot(d))return;return d.apply(c,u)}if(Jg.has(o)){let c=at(i,t,n,r,ut(s,"target")),u=a;if(o==="reduce"){let d=at(l,t,n,r,ut(s,"initial"));for(let[p,m]of c.entries())d=Mn(u,t,n,{acc:d,index:p,item:m},p===0?ut(s,"value"):void 0);return d}if(o==="map")return c.map((d,p)=>Mn(u,t,n,{...r,index:p,item:d},p===0?ut(s,"value"):void 0));if(o==="filter")return c.filter((d,p)=>Mn(u,t,n,{...r,index:p,item:d},p===0?ut(s,"value"):void 0))}return}function mt(e,t){if(e===null)return"null";if(e===void 0)return"undefined";if(tf(e))return bn(e,t);if(Ni(e))return Fg(e.$ref,t);if(Array.isArray(e))return e.map((n)=>mt(n,t)).join(", ");return JSON.stringify(e)}function CD(e){return`_fx_${e.replaceAll(/[^A-Za-z0-9_$]/g,"_")}`}function Fg(e,t){let n=an(e),r=t.statePrefix??"state",s=t.eventParam??"event";if(n==="$reduce/acc")return"_acc";if(n.startsWith("$reduce/"))return"_acc";if(n.startsWith("$args/"))return Je("_args",n.slice(6));if(n.startsWith("event#/"))return Je(s,n.slice(7));if(n.startsWith("$map/")){let o=n.split("/"),[,i]=o;if(i==="item")return o.length>2?Je("_item",o.slice(2).join("/")):"_item";if(i==="index")return"_index";return`_${i}`}if(n.startsWith("#/state/"))return Je(r,n.slice(8));if(n.startsWith("parent#/"))return Je(r,n.slice(8));if(n.startsWith("window#/"))return Je("window",n.slice(8));if(n.startsWith("document#/"))return Je("document",n.slice(10));return Je(r,n)}function Lv(e,t){if(Ni(e))return Fg(e.$ref,t);return mt(e,t)}function RD(e,t,n){let r=(i)=>t[i]??"undefined",s=`(${n.statePrefix??"state"}?.$page?.locale ?? ${JSON.stringify(_r)})`,o=JSON.stringify(hh);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 bn(e,t={}){let{operator:n,target:r,value:s,initial:o}=e;if(Tg.has(n)&&!("value"in e)){let i=mt(r,t);if(n==="!")return`!(${i})`;if(n==="-")return`-(${i})`}if(n==="call"){let i=(Ni(r)?r.$ref:void 0)??"",a=Array.isArray(s)?s.map((l)=>mt(l,t)):[];if(i.startsWith("window#/")){if(!Wv(i))throw Error(`$expression: "${i}" is not a blessed pure global`);let l=RD(i.slice(8),a,t);if(l)return l;return`window.${i.slice(8).replaceAll("/",".")}(${a.join(", ")})`}if(i.startsWith("#/state/")){let l=i.slice(8),c=t.formulaParams?.[l];if(c){let u=c.map((d,p)=>`${JSON.stringify(d)}: ${a[p]??"undefined"}`).join(", ");return`${CD(l)}(${t.statePrefix??"state"}, { ${u} })`}}return`${Fg(i,t)}(${a.join(", ")})`}if(Mg.has(n)){if(n==="?:"){let c=mt(r,t),u=mt(s,t),d=mt(o,t);return`(${c} ? ${u} : ${d})`}let i=mt(r,t),a=Object.entries(e.cases??{}).map(([c,u])=>`_d === ${JSON.stringify(c)} ? ${mt(u,t)} : `).join(""),l="default"in e?mt(e.default,t):"undefined";return`((_d) => ${a}${l})(String(${i}))`}if(Ng.has(n)){let i=mt(r,t),a=mt(s,t);return`(${i} ${n} ${a})`}if(Vv.has(n)){let i=Lv(r,t),a=mt(s,t);return`${i} ${n} ${a}`}if(qv.has(n)){let i=Lv(r,t);switch(n){case"push":return`${i}.push(${mt(s,t)})`;case"unshift":return`${i}.unshift(${mt(s,t)})`;case"pop":return`${i}.pop()`;case"shift":return`${i}.shift()`;case"splice":{let a=Array.isArray(s)?s.map((l)=>mt(l,t)).join(", "):mt(s,t);return`${i}.splice(${a})`}default:break}}if(Ig.has(n)){let i=mt(r,t),a=s===void 0?"":Array.isArray(s)?s.map((l)=>mt(l,t)).join(", "):mt(s,t);return`(${i})?.${n}?.(${a})`}if(Jg.has(n)){let i=mt(r,t),a=bn(s,t);if(n==="reduce"){let l=mt(o,t);return`${i}.reduce((_acc, _item, _index) => ${a}, ${l})`}if(n==="map")return`${i}.map((_item, _index) => ${a})`;if(n==="filter")return`${i}.filter((_item, _index) => ${a})`}return"undefined"}function Ji(e,t,n,r){return at(e,t,n,r)}function ds(e,t={}){return mt(e,t)}var Fv,Tg,Ng,Vv,qv,Jg,Mg,Ig,wD,vD,ED,PD,Iv=64,kD=64;var Mi=M(()=>{yh();ae();Ti();Fv=new Set(["=","+=","-=","*=","/=","push","pop","shift","unshift","splice"]),Tg=new Set(["!","-"]),Ng=new Set(["+","-","*","/","%","===","!==","<","<=",">",">=","&&","||","??"]),Vv=new Set(["=","+=","-=","*=","/="]),qv=new Set(["push","pop","shift","unshift","splice"]),Jg=new Set(["reduce","map","filter"]),Mg=new Set(["?:","switch"]),Ig=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"]),wD=new Set([...Fv,...Tg,...Ng,...Jg,...Mg,...Ig,"call"]),vD=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",...gh]),ED=new Map([["Intl/compare",(e,t,n,r)=>new Intl.Collator(n??_r,r).compare(e,t)],["Intl/displayName",(e,t,n,r)=>new Intl.DisplayNames(n??_r,{...r,type:t??"language"}).of(e)],["Intl/formatDate",(e,t,n)=>new Intl.DateTimeFormat(t??_r,{timeZone:hh,...n}).format(new Date(e))],["Intl/formatList",(e,t,n)=>new Intl.ListFormat(t??_r,n).format(e)],["Intl/formatNumber",(e,t,n)=>new Intl.NumberFormat(t??_r,n).format(e)],["Intl/formatRelativeTime",(e,t,n,r)=>new Intl.RelativeTimeFormat(n??_r,r).format(e,t)],["Intl/plural",(e,t,n)=>new Intl.PluralRules(t??_r,n).select(e)],["Intl/segment",(e,t,n)=>[...new Intl.Segmenter(n??_r,{granularity:t??"grapheme"}).segment(e)].map((r)=>r.segment)]]);PD=/^(?:\$args\/|\$reduce\/|\$map\/|window#\/|document#\/|event#\/)/});function Uv(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 TD(e){return(F(e)||Ot(e))&&"then"in e&&Ot(e.then)}async function Ii(e,t,n,r={}){let s=r.args?{args:r.args}:void 0;for(let o of e){let i=Uv(o);switch(i.kind){case"expression":{let a=Mn(i.node,t,n,s);if(TD(a))await a;break}case"if":{let a=i.node,l=Ji(a.if,t,n,s)?a.then:a.else;if(Array.isArray(l))await Ii(l,t,n,r);break}case"switch":{let a=i.node,l=String(Ji(a.$switch,t,n,s)),c=a.cases??{},u=Object.hasOwn(c,l)?c[l]:a.default;if(Array.isArray(u))await Ii(u,t,n,r);break}case"dispatch":{let a=i.node,l=Ot(r.target)?r.target():r.target,c=n?.currentTarget??l;if(!c)break;let u={};if("detail"in a)u.detail=Ji(a.detail,t,n,s);if(a.bubbles!==void 0)u.bubbles=a.bubbles;if(a.composed!==void 0)u.composed=a.composed;c.dispatchEvent(new CustomEvent(a.dispatchEvent,u));break}case"stopPropagation":{n?.stopPropagation();break}case"preventDefault":{n?.preventDefault();break}default:break}}}function Yn(e,t={}){let n=t.indent??"",r=[];for(let s of e){let o=Uv(s);switch(o.kind){case"expression":{r.push(`${n}${bn(o.node,t)};`);break}case"if":{let i=o.node,a=ds(i.if,t),l={...t,indent:`${n} `};if(r.push(`${n}if (${a}) {`,Yn(i.then??[],l)),i.else)r.push(`${n}} else {`,Yn(i.else,l));r.push(`${n}}`);break}case"switch":{let i=o.node,a=ds(i.$switch,t),l={...t,indent:`${n} `};r.push(`${n}switch (String(${a})) {`);for(let[c,u]of Object.entries(i.cases??{}))r.push(`${n} case ${JSON.stringify(c)}: {`,Yn(u,l),`${n} break;`,`${n} }`);if(i.default)r.push(`${n} default: {`,Yn(i.default,l),`${n} }`);r.push(`${n}}`);break}case"dispatch":{let i=o.node,a=t.eventParam??"event",l=t.dispatchTarget??`(${a} && ${a}.currentTarget)`,c=[];if("detail"in i)c.push(`detail: ${ds(i.detail,t)}`);if(i.bubbles!==void 0)c.push(`bubbles: ${JSON.stringify(i.bubbles)}`);if(i.composed!==void 0)c.push(`composed: ${JSON.stringify(i.composed)}`);let u=c.length>0?`, { ${c.join(", ")} }`:"";r.push(`${n}${l}?.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(`
199
+ `)}var nf=M(()=>{ae();Mi()});var Vg=M(()=>{ae()});function Di(e){if(e===ND)return"client";if(e===JD)return"server";return null}function MD(e){return e.replaceAll("\\","/").replace(/^(?:\.\/)+/,"")}function Kv(e,t){return`${Wg}${MD(e)}#${t}`}function rf(e){return e.startsWith(Wg)}function Li(e){if(!rf(e))return null;let t=e.slice(Wg.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 qg(e,t){if(Array.isArray(e)){let r=e.map((s)=>qg(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"&&_(s)){let i=Di(s);o=i===null?s:Kv(t,i)}else if(r!=="$script")o=qg(s,t);if(o!==s)n??={...e},n[r]=o}return n===null?e:n}function vl(e,t){return qg(e,t)}function LD(e){return ID.test(e)&&!DD.test(e)}function zv(e){return Di(e)==="client"||Li(e)?.side==="client"}function Hg(e,t,n){if(Array.isArray(e)){for(let[r,s]of e.entries())Hg(s,[...t,r],n);return n}if(!L(e))return n;if(_(e.$src))n.push({lazy:e.$lazy===!0,path:t,src:e.$src});for(let[r,s]of Object.entries(e))if(r!=="$script")Hg(s,[...t,r],n);return n}function FD(e){let t=e.at(-1);return _(t)?`"${t}"`:"this entry"}function Gv(e){let t=Hg(e,[],[]),n=t.some((s)=>!s.lazy&&zv(s.src)),r=[];for(let s of t){let o=FD(s.path);if(!s.lazy&&LD(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&&zv(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 Wg="jx-script:",ND="#client",JD="#server",ID,DD;var Fi=M(()=>{ae();ID=/^\.{1,2}\//u,DD=/\.json$/iu});function BD(e){for(let t of Object.keys(e))if(WD.has(t))return!0;return!1}function Vi(e){if(!e.startsWith("${")||!e.endsWith("}"))return!1;let[t,...n]=f$(e);return t!==void 0&&n.length===0&&t.start===0&&t.end===e.length}function Zv(){return[...Yv].toSorted()}function Rr(e,t){let n=e.toLowerCase();if(n.startsWith("aria-")||Yv.has(n))return String(t);return t?"":null}function Qv(e,t,n){if(!Array.isArray(e))return[];let r=e;if(Ot(t))r=r.filter(t);if(Ot(n))r=[...r].toSorted(n);return r}function e0(e,t,n,r){let s=oi(t);if(r?.has(s)&&r.get(s)===void 0)return;let o=e[s];if(Xe(o)){e[s]=n!==null&&n!=="false";return}if(n===null){let i=r?.get(s);e[s]=i===void 0?De(o)?0:"":i;return}e[s]=De(o)?Number(n):n}function Bg(e){let t=Xv.get(e);if(t)return t;let n=new Set,r=Ar(e);for(let[s,o]of Object.entries(e.state??{}))if(_(o)?ce(o):pn(o)?!wr(o)&&!hr(o.$expression.operator):r.get(s)==="computed")n.add(s);return Xv.set(e,n),n}function t0(e){let t=e.state??{},n=Bg(e),r=(s)=>(s in t)&&!n.has(s);return{checked:r("checked"),disabled:r("disabled"),required:r("required"),value:r("value")}}function Ug(e){let t=new Map;for(let[n,r]of Object.entries(e.state??{})){if(_(r)&&ce(r)){t.set(n,void 0);continue}if(F(r)&&!Array.isArray(r)){if("default"in r){t.set(n,r.default);continue}if(UD.some((s)=>(s in r))){t.set(n,void 0);continue}if(BD(r))continue}t.set(n,r)}return t}var WD,gr,Yv,d7,Xv,UD,zg=32,sf,of="jx-slot",El="data-jx-slots",Kg="jx.slot.group",p7;var qi=M(()=>{wl();Mi();Ti();ae();Pi();hn();nf();Vg();Fi();Vg();wl();WD=new Set(["type","properties","items","enum","minimum","maximum","minLength","maxLength","pattern","required","examples"]);gr=new Set(["$schema","$shadow","formAssociated","formValue","$id","$defs","state","$ref","$props","$elements","$title","$description","$switch","$prototype","$src","$export","$script","$media","$map","timing","default","description","body","parameters","arguments","tagName","children","style","attributes","items","map","filter","sort","cases","observedAttributes"]),Yv=new Set(["contenteditable","draggable","spellcheck"]);d7=Object.freeze({emptyRow:!0});Xv=new WeakMap;UD=["$expression","$prototype","$ref","$src"],sf=/^[\t\n\f\r ]+$/u,p7=(()=>{let e=Symbol.for(Kg),t=globalThis;return t[e]??=new WeakMap,t[e]})()});function GD(){if(!jl){jl=new Map;for(let[e,t,n]of KD){let r=jl.get(e);if(!r)r=new Map,jl.set(e,r);for(let s of t.split(" "))r.set(s,n)}}return jl}function lf(e,t){return n0??=new Map(zD),n0.get(t)??GD().get(t)?.get(e.toLowerCase())??null}function Gg(e,t){if(t==="innerText")return!0;if(t==="value"||t==="defaultValue")return XD.has(e.toLowerCase());return t==="text"&&YD.has(e.toLowerCase())}var C=(e,t={})=>({attribute:e,kind:"text",...t}),we=(e,t={})=>({attribute:e,kind:"boolean",...t}),af,zD,KD,n0,jl,XD,YD;var Xg=M(()=>{af={live:!0},zD=[["accessKey",C("accesskey")],["ariaAtomic",C("aria-atomic")],["ariaAutoComplete",C("aria-autocomplete")],["ariaBrailleLabel",C("aria-braillelabel")],["ariaBrailleRoleDescription",C("aria-brailleroledescription")],["ariaBusy",C("aria-busy")],["ariaChecked",C("aria-checked")],["ariaColCount",C("aria-colcount")],["ariaColIndex",C("aria-colindex")],["ariaColIndexText",C("aria-colindextext")],["ariaColSpan",C("aria-colspan")],["ariaCurrent",C("aria-current")],["ariaDescription",C("aria-description")],["ariaDisabled",C("aria-disabled")],["ariaExpanded",C("aria-expanded")],["ariaHasPopup",C("aria-haspopup")],["ariaHidden",C("aria-hidden")],["ariaInvalid",C("aria-invalid")],["ariaKeyShortcuts",C("aria-keyshortcuts")],["ariaLabel",C("aria-label")],["ariaLevel",C("aria-level")],["ariaLive",C("aria-live")],["ariaModal",C("aria-modal")],["ariaMultiLine",C("aria-multiline")],["ariaMultiSelectable",C("aria-multiselectable")],["ariaOrientation",C("aria-orientation")],["ariaPlaceholder",C("aria-placeholder")],["ariaPosInSet",C("aria-posinset")],["ariaPressed",C("aria-pressed")],["ariaReadOnly",C("aria-readonly")],["ariaRelevant",C("aria-relevant")],["ariaRequired",C("aria-required")],["ariaRoleDescription",C("aria-roledescription")],["ariaRowCount",C("aria-rowcount")],["ariaRowIndex",C("aria-rowindex")],["ariaRowIndexText",C("aria-rowindextext")],["ariaRowSpan",C("aria-rowspan")],["ariaSelected",C("aria-selected")],["ariaSetSize",C("aria-setsize")],["ariaSort",C("aria-sort")],["ariaValueMax",C("aria-valuemax")],["ariaValueMin",C("aria-valuemin")],["ariaValueNow",C("aria-valuenow")],["ariaValueText",C("aria-valuetext")],["autocapitalize",C("autocapitalize")],["autocorrect",we("autocorrect",{keywords:["on","off"]})],["autofocus",we("autofocus")],["className",C("class")],["contentEditable",C("contenteditable")],["dir",C("dir")],["draggable",we("draggable")],["enterKeyHint",C("enterkeyhint")],["headingOffset",C("headingoffset")],["headingReset",we("headingreset")],["hidden",{attribute:"hidden",kind:"hidden"}],["id",C("id")],["inert",we("inert")],["inputMode",C("inputmode")],["lang",C("lang")],["popover",C("popover")],["role",C("role")],["slot",C("slot")],["spellcheck",we("spellcheck")],["tabIndex",C("tabindex")],["title",C("title")],["translate",we("translate",{keywords:["yes","no"]})],["writingSuggestions",C("writingsuggestions")]],KD=[["aLink","body",C("alink")],["abbr","td th",C("abbr")],["accept","input",C("accept")],["acceptCharset","form",C("accept-charset")],["action","form",C("action")],["align","caption col colgroup div embed h1 h2 h3 h4 h5 h6 hr iframe img input legend object p table tbody td tfoot th thead tr",C("align")],["allow","iframe",C("allow")],["allowFullscreen","iframe",we("allowfullscreen")],["alpha","input",we("alpha")],["alt","area img input",C("alt")],["archive","object",C("archive")],["as","link",C("as")],["async","script",we("async")],["autocomplete","form input select textarea",C("autocomplete")],["autoplay","audio video",we("autoplay")],["axis","td th",C("axis")],["background","body",C("background")],["behavior","marquee",C("behavior")],["bgColor","body marquee table td th tr",C("bgcolor")],["border","img object table",C("border")],["cellPadding","table",C("cellpadding")],["cellSpacing","table",C("cellspacing")],["ch","col colgroup tbody td tfoot th thead tr",C("char")],["chOff","col colgroup tbody td tfoot th thead tr",C("charoff")],["charset","a link script",C("charset")],["checked","input",we("checked",af)],["cite","blockquote del ins q",C("cite")],["clear","br",C("clear")],["closedBy","dialog",C("closedby")],["code","object",C("code")],["codeBase","object",C("codebase")],["codeType","object",C("codetype")],["colSpan","td th",C("colspan")],["color","font hr",C("color")],["colorSpace","input",C("colorspace")],["cols","frameset textarea",C("cols")],["command","button",C("command")],["compact","dir dl menu ol ul",we("compact")],["content","meta",C("content")],["controls","audio img video",we("controls")],["coords","a area",C("coords")],["crossOrigin","audio img link script video",C("crossorigin")],["data","object",C("data")],["dateTime","del ins time",C("datetime")],["declare","object",we("declare")],["decoding","img",C("decoding")],["default","track",we("default")],["defaultChecked","input",we("checked")],["defaultMuted","audio video",we("muted")],["defaultSelected","option",we("selected")],["defaultValue","input",C("value")],["defer","script",we("defer")],["dirName","input textarea",C("dirname")],["direction","marquee",C("direction")],["disabled","button fieldset input link optgroup option select textarea",we("disabled")],["download","a area",C("download")],["encoding","form",C("enctype")],["enctype","form",C("enctype")],["event","script",C("event")],["face","font",C("face")],["fetchPriority","img link script",C("fetchpriority")],["formAction","button input",C("formaction")],["formEnctype","button input",C("formenctype")],["formMethod","button input",C("formmethod")],["formNoValidate","button input",we("formnovalidate")],["formTarget","button input",C("formtarget")],["frame","table",C("frame")],["frameBorder","frame iframe",C("frameborder")],["headers","td th",C("headers")],["height","canvas embed iframe img input marquee object source td th video",C("height")],["high","meter",C("high")],["href","a area base link",C("href")],["hreflang","a area link",C("hreflang")],["hspace","embed img input marquee object",C("hspace")],["htmlFor","label script template",C("for")],["httpEquiv","meta",C("http-equiv")],["imageSizes","link",C("imagesizes")],["imageSrcset","link",C("imagesrcset")],["integrity","link script",C("integrity")],["isMap","img",we("ismap")],["kind","track",C("kind")],["label","optgroup option track",C("label")],["link","body",C("link")],["loading","audio iframe img video",C("loading")],["longDesc","frame iframe img",C("longdesc")],["loop","audio video",we("loop")],["low","meter",C("low")],["lowsrc","img",C("lowsrc")],["marginHeight","frame iframe",C("marginheight")],["marginWidth","frame iframe",C("marginwidth")],["max","input meter progress",C("max")],["maxLength","input textarea",C("maxlength")],["media","link meta source style",C("media")],["method","form",C("method")],["min","input meter",C("min")],["minLength","input textarea",C("minlength")],["multiple","input select",we("multiple")],["muted","audio video",we("muted",af)],["name","a button details embed fieldset form frame iframe img input map meta object output param select slot textarea",C("name")],["noHref","area",we("nohref")],["noModule","script",we("nomodule")],["noResize","frame",we("noresize")],["noShade","hr",we("noshade")],["noValidate","form",we("novalidate")],["noWrap","td th",we("nowrap")],["open","details dialog",we("open")],["optimum","meter",C("optimum")],["pattern","input",C("pattern")],["ping","a area",C("ping")],["placeholder","input textarea",C("placeholder")],["playsInline","video",we("playsinline")],["popoverTargetAction","button input",C("popovertargetaction")],["poster","video",C("poster")],["preload","audio video",C("preload")],["readOnly","input textarea",we("readonly")],["referrerPolicy","a area iframe img link script",C("referrerpolicy")],["rel","a area form link",C("rel")],["required","input select textarea",we("required")],["rev","a link",C("rev")],["reversed","ol",we("reversed")],["rowSpan","td th",C("rowspan")],["rows","frameset textarea",C("rows")],["rules","table",C("rules")],["scheme","meta",C("scheme")],["scope","td th",C("scope")],["scrollAmount","marquee",C("scrollamount")],["scrollDelay","marquee",C("scrolldelay")],["scrolling","frame iframe",C("scrolling")],["selected","option",we("selected",af)],["shadowRootClonable","template",we("shadowrootclonable")],["shadowRootCustomElementRegistry","template",C("shadowrootcustomelementregistry")],["shadowRootDelegatesFocus","template",we("shadowrootdelegatesfocus")],["shadowRootMode","template",C("shadowrootmode")],["shadowRootSerializable","template",we("shadowrootserializable")],["shadowRootSlotAssignment","template",C("shadowrootslotassignment")],["shape","a area",C("shape")],["size","font hr input select",C("size")],["sizes","img source",C("sizes")],["span","col colgroup",C("span")],["src","audio embed frame iframe img input source track video",C("src")],["srcdoc","iframe",C("srcdoc")],["srclang","track",C("srclang")],["srcset","img source",C("srcset")],["standby","object",C("standby")],["start","ol",C("start")],["step","input",C("step")],["summary","table",C("summary")],["target","a area base form link",C("target")],["text","body",C("text")],["trueSpeed","marquee",we("truespeed")],["type","a area button embed input li link object ol param script source style ul",C("type")],["useMap","img input object",C("usemap")],["vAlign","col colgroup tbody td tfoot th thead tr",C("valign")],["vLink","body",C("vlink")],["value","button data li meter option param progress",C("value")],["value","input",C("value",af)],["valueType","param",C("valuetype")],["version","html",C("version")],["vspace","embed img input marquee object",C("vspace")],["width","canvas col colgroup embed hr iframe img input listing marquee object pre source table td th video xmp",C("width")],["wrap","textarea",C("wrap")]];XD=new Set(["output","textarea"]),YD=new Set(["a","option","title"])});function r0(e,t,n){let r=e.$description;if(_(r))(Object.keys(t).length>0?t:n).$description=r}function s0(e,t,n,r,s=ZD,o={}){let i=[],a=(p,m)=>{let g={mediaQueries:t,scope:m,transposeValue:n};if(r)g.resolveValue=(b,h)=>r(b,h,m);for(let b of Ri(p,g))i.push(o.comments===!0?Sl(b):b.text)},l={},c={},u=[],d=[];for(let[p,m]of Object.entries(e)){if(F(m)&&!Array.isArray(m)){if(p.startsWith("@"))u.push([p,m]);else if(!p.startsWith("--"))d.push([p,m]);continue}if($l(p)||p.startsWith("@")||p.startsWith("$"))continue;if(p.startsWith("--")||p==="colorScheme"||p==="color-scheme")l[p]=m;else c[p]=m}r0(e,l,c),a(l,s.root),a(c,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(xl(p)||bl(p)){a({[p]:m},null);continue}let g={},b={},h=[];for(let[x,k]of Object.entries(m)){if(F(k)&&!Array.isArray(k)){if(!x.startsWith("@"))h.push([x,k]);continue}if(x.startsWith("$"))continue;if(x.startsWith("--"))g[x]=k;else b[x]=k}r0(m,g,b),a({[p]:g},s.root),a({[p]:b},s.body);for(let[x,k]of h)a({[p]:k},x)}if(Object.values(t).some((p)=>mr(p)!==null)&&!("colorScheme"in e))i.push(`${s.root} { color-scheme: light dark }`,`${s.root}:where([${pr}="light"]) { color-scheme: light }`,`${s.root}:where([${pr}="dark"]) { color-scheme: dark }`);return i.join(`
200
+ `)}var ZD;var o0=M(()=>{wl();ae();ZD={body:"body",root:":root"}});function a0(e){return QD.has(e.toLowerCase())?"block":"inline"}function l0(e){let t=e;for(let r=i0.exec(t);r;r=i0.exec(t))t=t.slice(r[0].length);if(t==="")return null;let n=e1.exec(t);return n?a0(n[1]):"text"}function c0(e){let t=e;while(t.endsWith("-->")){let r=t.lastIndexOf("<!--");if(r===-1)break;t=t.slice(0,r)}if(t==="")return null;let n=t1.exec(t)??n1.exec(t);return n?a0(n[1]):"text"}function r1(e,t){let n=c0(e),r=l0(t);if(n===null||r===null)return!1;return n!=="text"&&r!=="text"&&(n==="block"||r==="block")}function Kt(e,t={}){let{lead:n="",preformatted:r=!1,separator:s=`
201
+ `}=t;if(r)return e.join("");let o=e.filter((a)=>a!==""&&a!==n),i="";for(let[a,l]of o.entries()){if(a===0){i=l;continue}let c=o[a-1],u=Yg(l,n);i+=r1(c,u)?`${s}${l}`:u}return i}function cf(e,t){let{close:n,lead:r="",open:s}=t;if(e==="")return e;let o=l0(Yg(e,r)),i=c0(e),a=o==="block"?s:"",l=i==="block"?n:"";return`${a}${a===""?Yg(e,r):e}${l}`}function Zg(e,t){let{close:n,open:r,...s}=t,o=Kt(e,s);return s.preformatted?o:cf(o,{close:n,lead:s.lead,open:r})}function Yg(e,t){return e.startsWith(t)?e.slice(t.length):e}var QD,i0,e1,t1,n1;var Hi=M(()=>{QD=new Set(["address","article","aside","blockquote","body","br","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","legend","li","listing","main","menu","nav","ol","optgroup","option","p","plaintext","pre","search","section","summary","table","tbody","td","tfoot","th","thead","tr","ul","xmp"]);i0=/^<!--[\s\S]*?-->/u,e1=/^<([a-zA-Z][^\s/>]*)/u,t1=/<\/([a-zA-Z][^\s>]*)\s*>$/u,n1=/<([a-zA-Z][^\s/<>]*)(?:\s[^<]*)?>$/u});function u0(e,t){return t===null?e:":host"}var Pl=M(()=>{wl()});function Tl(e,t){let n=[];for(let[r,s]of(e.parameters??[]).entries()){let o=f0(s);if(!o)continue;let i=d0(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 f0(e){return _(e)?e:e?.name??""}function d0(e){return F(e)&&"default"in e}function s1(e,t){let n=p0(e,t);return n===e?e:`${n} as ${e}`}function p0(e,t){let n=t?.$export;return _(n)&&n!==""?n:e}function hf(e,t,n={}){let{statePrefix:r="state",indent:s="",collect:o}=n,{url:i}=t,a=ce(i),l=t.method??"GET";if(t.manual)return`${s}// ${e}: manual Request — fetch triggered by user action`;let c=[`// ${e}: auto-fetch from ${a?"(dynamic URL)":i}`,o?`${o}.push(effect(() => {`:"effect(() => {"];if(a)c.push(` const url = \`${i1(i,r)}\`;`,' if (!url || url === "undefined" || url.includes("undefined")) return;');else c.push(` const url = ${JSON.stringify(i)};`);let u=[];if(l!=="GET")u.push(`method: ${JSON.stringify(l)}`);if(t.headers)u.push(`headers: ${JSON.stringify(t.headers)}`);if(t.body){let p=F(t.body)?JSON.stringify(JSON.stringify(t.body)):JSON.stringify(t.body);u.push(`body: ${p}`)}let d=u.length>0?`, { ${u.join(", ")} }`:"";return c.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?"}));":"});"),c.map((p)=>`${s}${p}`).join(`
202
+ `)}function gf(e,t,n={}){let{statePrefix:r="state",indent:s="",collect:o,serverBaseUrl:i="/_jx/server"}=n,a=JSON.stringify(`${i}/${t.$export}`),l=Object.entries(t.arguments??{}),c=l.map(([b,h])=>{if(!pe(h))return`${fs(b)}: ${JSON.stringify(h)}`;if(o1.some((x)=>h.$ref.startsWith(x)))throw Error(`Server function "${e}": argument "${b}" references "${h.$ref}", which a state entry cannot read. Use a #/state/, parent#/, window#/ or document#/ reference.`);return`${fs(b)}: ${ds({$ref:h.$ref},{statePrefix:r})}`}),u=l.some(([,b])=>pe(b)),d=`${k0}(${a}, ${c.length>0?`{ ${c.join(", ")} }`:"{}"})`,p=Je(r,Ut(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((b)=>`${s}${b}`).join(`
203
+ `)}function i1(e,t){if(t==="state")return e;return e.replaceAll(/\$\{([^}]*)\}/g,(n,r)=>`\${${r.replaceAll(/(?<!this\.)\bstate\./g,`${t}.`)}}`)}function Cl(e){return`<script type="importmap">
133
204
  {
134
205
  "imports": {
135
206
  ${Object.entries(e).map(([n,r])=>` ${JSON.stringify(n)}: ${JSON.stringify(r)}`).join(`,
136
207
  `)}
137
208
  }
138
209
  }
139
- </script>`}function Ii(e){if(e.runtimeImports!==void 0)return Pl(e.runtimeImports);let t={"@vue/reactivity":e.reactivitySrc,"lit-html":e.litHtmlSrc};return Pl(e.litHtmlSrc===Nr?{...t,"lit-html/":`${Nr}/`}:t)}function ff(e,t){let n=t.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`),r=String.raw`\bstate${vl}\??\.${vl}${n}(?![\w$])`,s="(?:\\\\\"|['`])",o=String.raw`\bstate${vl}(?:\?\.)?\[${vl}${"(?:\\\\\"|['`])"}${n}${"(?:\\\\\"|['`])"}`,i=String.raw`#/state/${n}(?=["/])`;return new RegExp(`${r}|${o}|${i}`).test(e)||S1.test(e)}function df(e,t){let n=Qm(t),r=e.state??{},s=Object.keys(n).filter((c)=>!(c in r));if(s.length===0)return e;let o=JSON.stringify(e),i=Object.values(r).some((c)=>D(c)&&!Array.isArray(c)&&k(c.$src)),a=new Set(s.filter((c)=>i||ff(o,c)));for(let c of a)for(let u of Zm(n[c]))if(!(u in r))a.add(u);if(a.size===0)return e;let l=Object.fromEntries(s.filter((c)=>a.has(c)).map((c)=>[c,n[c]]));return{...e,state:{...l,...r}}}function w1(e){let t=Object.fromEntries(Object.entries(e.state??{}).filter(([,n])=>!Mo(n)));return JSON.stringify({...e,state:t})}function pf(e){if(k(e))return le(e);if(!D(e))return!1;if(e.state){let n;for(let[r,s]of Object.entries(e.state)){if(r==="$site"||r==="$page")continue;if(!D(s)||Array.isArray(s))return!0;if(s.timing==="compiler")continue;if(Mo(s)){if(n??=w1(e),ff(n,r))return!0;continue}if(s.$prototype)return!0;if("default"in s)return!0;if($s(s))continue;return!0}}if(e.$switch)return!0;if(Le(e)||Lb(e.children))return!0;if(Array.isArray(e.children)&&e.children.some((n)=>pf(n)))return!0;let t=Di(e);for(let[n,r]of Object.entries(e)){if(pr.has(n)||t&&n==="innerHTML")continue;if(me(r))return!0;if(le(r))return!0}if(D(e.style)){for(let n of Object.values(e.style))if(le(n))return!0}if(D(e.attributes)){for(let n of Object.values(e.attributes))if(le(n))return!0}return!1}function Di(e){return e.$static===!0||e.$prerendered===!0}function Li(e,t=null,n={},r={}){let s=e?.state?Do(e.state,t):t??of();return{media:r,scope:s,scopeDefs:n}}function of(e=null){return Object.create(e)}function Fg(e){return e[Fv]}function Vg(e,t){return Fg(e)?.has(t)??!1}function Ol(e,t){if(!e.startsWith("#/state/"))return!1;let[n=""]=e.slice(8).split("/");return Vg(t,n.replaceAll("~1","/").replaceAll("~0","~"))}function Lg(e,t,n){if(t>0&&j1.test(e.charAt(t-1)))return!1;let r=t+5;if(n)return!P1.test(e.charAt(r));while(/\s/u.test(e.charAt(r)))r+=1;return e.charAt(r)==="."}function Vv(e){for(let t=e.indexOf("state");t!==-1;t=e.indexOf("state",t+1))if(Lg(e,t,!0)&&!Lg(e,t,!1))return!0;return!1}function Fi(e,t,n={}){if(!e.includes("state"))return e;let r=n.bare===!0,s=n.code===!1?e:po(e),o="",i=0;for(let a=s.indexOf("state");a!==-1;a=s.indexOf("state",a+1))if(Lg(s,a,r))o+=e.slice(i,a)+t,i=a+5;return o+e.slice(i)}function af(e,t){if(k(e)){if(!e.includes("state."))return;let o=po(e);for(let i of o.matchAll(v1))t.add(i[1]);for(let i of o.matchAll(E1))t.add(i[1]);return}if(Array.isArray(e)){for(let o of e)af(o,t);return}if(!D(e))return;let n=e,{operator:r,target:s}=n;if(k(r)&&dr(r)&&me(s)&&s.$ref.startsWith("#/state/"))t.add(s.$ref.slice(8).split("/")[0]);for(let o of Object.values(n))af(o,t)}function sf(e,t){for(let n of Bi(e)){if(Le(n)){sf(n.map?[n.map]:[],t);continue}if(!Ot(n))continue;for(let[r,s]of Object.entries(n))if(r.startsWith("on")&&(kt(s)||fn(s)))af(s.body??s.$expression,t);sf(Object.values(n.cases??{}).filter((r)=>Ot(r)&&!Xe(r)),t),sf(n.children,t)}}function ps(e,t){if(kt(t)&&fm(t))throw Error(`${e} declares both "body" and "$src"; they are mutually exclusive (spec.md §5.3 4d). Keep one.`)}function mf(e,t){let n={eager:new Map,lazy:new Map};for(let[r,s]of Object.entries(e)){if(ps(`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:Lv(r,s)});continue}let o=n.eager.get(s.$src);if(!o)o=new Set,n.eager.set(s.$src,o);o.add(x1(r,s))}return n}function hf(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:l,exportName:c})=>`const ${l} = (...args) => ${a}Load().then((m) => m.${c}(...args));`))}return{imports:n,loaders:r}}function Do(e={},t=null,n={}){let r=of(t),s=t?Fg(t):void 0,o=new Set(s);if(Object.defineProperty(r,Fv,{configurable:!0,enumerable:!1,value:o,writable:!0}),n.holdMutable===!0){let d=new Set;for(let p of Object.values(e))if(kt(p)||fn(p))af(p.body??p.$expression,d);if(n.document)sf([n.document],d);for(let p of d)if(p in e)o.add(p)}let i=Or({state:e});for(let[d,p]of Object.entries(e)){if(!D(p)||Array.isArray(p)){ds(r,d,rf(p));continue}if("default"in p){ds(r,d,rf(p.default));continue}if(Zr(p)){o.add(d);continue}if(!p.$prototype&&!("$expression"in p)&&!$s(p))ds(r,d,rf(p))}let a=[],l=[],c=[];for(let[d,p]of Object.entries(e)){if(le(p)){a.push([d,p]);continue}if(!D(p))continue;if(fn(p)){let m=p.$expression;if(c.push([d,JSON.stringify(m)]),wr(p)){let y=p.parameters;ds(r,d,(...S)=>{let g={};for(let[x,P]of y.entries()){let w=Iv(P);if(!w)continue;g[w]=S[x]===void 0&&Dv(P)?P.default:S[x]}return Nn(m,r,null,{args:g})})}else if(dr(m.operator))ds(r,d,(y,S)=>Nn(m,y,S));else Ig(r,d,()=>Nn(m,r,null));continue}if(kt(p)){if(ps(`state entry "${d}"`,p),vr(p)){let{body:m}=p;c.push([d,JSON.stringify(m)]),ds(r,d,(y,S)=>{Ci(m,y??r,S??null)})}else if(k(p.body)){let{body:m}=p,y=Function(...kr(p),m);if(i.get(d)==="computed")Ig(r,d,()=>y(r)),l.push([d,m]);else ds(r,d,y),c.push([d,m])}else ds(r,d,()=>{}),o.add(d);continue}if(Pn(p)&&(p.$prototype==="LocalStorage"||p.$prototype==="SessionStorage")){ds(r,d,rf(p.default??null));continue}if(Pn(p)&&p.$prototype==="Request")o.add(d);if(Hi(p))o.add(d)}let u=!0;while(u){u=!1;for(let[d,p]of[...l,...a])if(!o.has(d)&&Hv(p,r))o.add(d),u=!0;for(let[d,p]of c)if(!o.has(d)&&_1(p,o))o.add(d),u=!0}for(let[d,p]of a)Ig(r,d,()=>Gt(p,r));return r}function ds(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0})}function Ig(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:n})}function tt(e,t){if(me(e))return qv(e.$ref,t);if(le(e))return Gt(e,t);return e}function Xe(e){return me(e)}function qv(e,t){if(!k(e))return e;let n=sn(e);if(n.startsWith("$map/")){let r=n.split("/"),s=r[1],i=t.$map?.[s]??t[`$map/${s}`];return r.length>2?Dg(i,r.slice(2).join("/")):i}if(e.startsWith("#/state/"))return Dg(t,e.slice(8));return Dg(t,e)??null}function Hv(e,t){if(!t)return!1;let n=Fg(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 _1(e,t){for(let n of e.matchAll(/#\/state\/([^"/\\]+)|\bstate\.([A-Za-z_$][\w$]*)/g)){let[,r,s]=n,o=r===void 0?s:r.replaceAll("~1","/").replaceAll("~0","~");if(o!==void 0&&t.has(o))return!0}return!1}function gf(e){return Ji(e)?`(${e.slice(2,-1)})`:`\`${e}\``}function Gt(e,t){if(Hv(e,t))return null;let n=["state","$map","$site","$page"],r=[t,t?.$map,t?.$site,t?.$page],s=t?.$map;if(D(s)&&!Array.isArray(s)){n.push("item","index");let o=s;r.push(o.item,o.index)}try{let o=Ji(e)?`return (${e.slice(2,-1)})`:`return \`${e}\``;return Function(...n,o)(...r)}catch{return null}}function Dg(e,t){return Bt(e,t)}function rf(e){if(!D(e))return e;return structuredClone(e)}function k1(e,t){if(!e||!t)return"";return Object.entries(e).filter(([n,r])=>!n.startsWith(":")&&!n.startsWith(".")&&!n.startsWith("&")&&!n.startsWith("[")&&!n.startsWith("@")&&le(r)).map(([n,r])=>{let s=tt(r,t);return s==null?null:`${hn(n)}: ${s}`}).filter(Boolean).join("; ")}function qg(e,t){if(!k(t)&&!Ie(t)&&!Ge(t))return null;if(e.kind==="text")return String(t);if(e.kind==="hidden"){if(k(t)&&t.toLowerCase()==="until-found")return"until-found";return t?"":null}let n=Boolean(t);if(e.keywords)return e.keywords[n?0:1];return Rr(e.attribute,n)}function Bv(e,t){if(me(e)&&(t===null||Ol(e.$ref,t)))return;try{return tt(e,t)}catch{return}}function wl(e,t,n){return n&&t===""?` ${e}`:` ${e}="${Ne(t)}"`}function Lo(e,t,n=""){let r=Il(e.tagName,t),s=new Map,o,i=tt(e.id,t);if(i)s.set("id",wl("id",String(i),!1));let a=Jl(e),l=a?tt(Ml(e),t):null,c=[k(l)||Ie(l)?String(l):"",Js(e)??""].filter((S)=>S!=="").join(" ");if(c)s.set("class",wl("class",c,!1));let u=(S,g)=>{if(g===void 0)return;let x=Bu(r,S);if(!x)return;let P=Bv(g,t);if(x.live&&P!==void 0)o??=new Set,o.add(x.attribute);let w=qg(x,P);if(w!==null)s.set(x.attribute,wl(x.attribute,w,x.kind!=="text"))};for(let S of Wv)u(S,e[S]);let d=e;for(let S of Object.keys(d)){if(A1.has(S)||S.startsWith("$")||S.startsWith("on")||ch(r,S))continue;u(S,d[S])}let p="";if(e.attributes)for(let[S,g]of Object.entries(e.attributes)){if(a&&S==="class")continue;let x=tt(g,t),P=null;if(Ge(x)){let E=Rr(S,x);P=E===null?null:wl(S,E,!0)}else if(k(x)||Ie(x))P=wl(S,String(x),!1);let w=S.toLowerCase();if(o?.has(w))continue;if(s.has(w)){if(P===null&&(x===null||x===void 0||Ge(x)))s.delete(w);else if(P!==null)s.set(w,P);continue}p+=P??""}let m="";for(let S of s.values())m+=S;let y=[k1(e.style,t),n].filter(Boolean).join("; ");if(y)m+=` style="${Ne(y)}"`;if(m+=p,e.$static)m+=" data-jx-static";else if(e.$prerendered)m+=" data-jx-prerendered";return m}function Al(e,t,n){if(Di(e))return;if(!(("innerText"in e)||("value"in e)||("defaultValue"in e)||("text"in e)))return;for(let[r,s]of Object.entries(e)){if(s===void 0||!ch(t,r))continue;let o=Bv(s,n),i=o===null||o===void 0?"":Ne(String(o));return r==="innerText"?i.replaceAll(/\r\n|\r|\n/gu,"<br>"):i}return}function Cl(e,t=" "){return e?"":`
140
- ${t}`}function Vi(){let e=JSON.stringify(Mu),t=JSON.stringify(ur);return`(function(){try{var s=localStorage.getItem(${e});if(s==="light"||s==="dark"){document.documentElement.setAttribute(${t},s)}}catch(e){}})()`}function Uv(e,t,n,r,s={}){for(let o of Pi(t,{...s,mediaQueries:r,resolveValue:(i,a)=>zv(i,a,n),scope:n}))e.push(fl(o))}function zv(e,t,n){let r=k(t)?t:t.$ref;return C1.push({property:e,selector:n,source:r}),null}function yf(){return`const __jxEnumAttrs = new Set(${JSON.stringify(jv())});
141
- function ${Vo}(n, v) {
210
+ </script>`}function Wi(e){if(e.runtimeImports!==void 0)return Cl(e.runtimeImports);let t={"@vue/reactivity":e.reactivitySrc,"lit-html":e.litHtmlSrc};return Cl(e.litHtmlSrc===Tr?{...t,"lit-html/":`${Tr}/`}:t)}function yf(e,t){let n=t.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`),r=String.raw`\bstate${_l}\??\.${_l}${n}(?![\w$])`,s="(?:\\\\\"|['`])",o=String.raw`\bstate${_l}(?:\?\.)?\[${_l}${"(?:\\\\\"|['`])"}${n}${"(?:\\\\\"|['`])"}`,i=String.raw`#/state/${n}(?=["/])`;return new RegExp(`${r}|${o}|${i}`).test(e)||a1.test(e)}function xf(e,t){let n=Lg(t),r=e.state??{},s=Object.keys(n).filter((c)=>!(c in r));if(s.length===0)return e;let o=JSON.stringify(e),i=Object.values(r).some((c)=>F(c)&&!Array.isArray(c)&&_(c.$src)),a=new Set(s.filter((c)=>i||yf(o,c)));for(let c of a)for(let u of Dg(n[c]))if(!(u in r))a.add(u);if(a.size===0)return e;let l=Object.fromEntries(s.filter((c)=>a.has(c)).map((c)=>[c,n[c]]));return{...e,state:{...l,...r}}}function l1(e){let t=Object.fromEntries(Object.entries(e.state??{}).filter(([,n])=>!Fo(n)));return JSON.stringify({...e,state:t})}function bf(e){if(_(e))return ce(e);if(!F(e))return!1;if(e.state){let n;for(let[r,s]of Object.entries(e.state)){if(r==="$site"||r==="$page")continue;if(!F(s)||Array.isArray(s))return!0;if(s.timing==="compiler")continue;if(Fo(s)){if(n??=l1(e),yf(n,r))return!0;continue}if(s.$prototype)return!0;if("default"in s)return!0;if(vs(s))continue;return!0}}if(e.$switch)return!0;if(Le(e)||a$(e.children))return!0;if(Array.isArray(e.children)&&e.children.some((n)=>bf(n)))return!0;let t=Bi(e);for(let[n,r]of Object.entries(e)){if(gr.has(n)||t&&n==="innerHTML")continue;if(pe(r))return!0;if(ce(r))return!0}if(F(e.style)){for(let n of Object.values(e.style))if(ce(n))return!0}if(F(e.attributes)){for(let n of Object.values(e.attributes))if(ce(n))return!0}return!1}function Bi(e){return e.$static===!0||e.$prerendered===!0}function Ui(e,t=null,n={},r={}){let s=e?.state?Vo(e.state,t):t??df();return{media:r,scope:s,scopeDefs:n}}function df(e=null){return Object.create(e)}function ny(e){return e[m0]}function ry(e,t){return ny(e)?.has(t)??!1}function Nl(e,t){if(!e.startsWith("#/state/"))return!1;let[n=""]=e.slice(8).split("/");return ry(t,n.replaceAll("~1","/").replaceAll("~0","~"))}function ty(e,t,n){if(t>0&&f1.test(e.charAt(t-1)))return!1;let r=t+5;if(n)return!d1.test(e.charAt(r));while(/\s/u.test(e.charAt(r)))r+=1;return e.charAt(r)==="."}function h0(e){for(let t=e.indexOf("state");t!==-1;t=e.indexOf("state",t+1))if(ty(e,t,!0)&&!ty(e,t,!1))return!0;return!1}function zi(e,t,n={}){if(!e.includes("state"))return e;let r=n.bare===!0,s=n.code===!1?e:go(e),o="",i=0;for(let a=s.indexOf("state");a!==-1;a=s.indexOf("state",a+1))if(ty(s,a,r))o+=e.slice(i,a)+t,i=a+5;return o+e.slice(i)}function pf(e,t){if(_(e)){if(!e.includes("state."))return;let o=go(e);for(let i of o.matchAll(c1))t.add(i[1]);for(let i of o.matchAll(u1))t.add(i[1]);return}if(Array.isArray(e)){for(let o of e)pf(o,t);return}if(!F(e))return;let n=e,{operator:r,target:s}=n;if(_(r)&&hr(r)&&pe(s)&&s.$ref.startsWith("#/state/"))t.add(s.$ref.slice(8).split("/")[0]);for(let o of Object.values(n))pf(o,t)}function ff(e,t){for(let n of Zi(e)){if(Le(n)){ff(n.map?[n.map]:[],t);continue}if(!Ct(n))continue;for(let[r,s]of Object.entries(n))if(r.startsWith("on")&&(At(s)||pn(s)))pf(s.body??s.$expression,t);ff(Object.values(n.cases??{}).filter((r)=>Ct(r)&&!Ye(r)),t),ff(n.children,t)}}function ms(e,t){if(At(t)&&Qh(t))throw Error(`${e} declares both "body" and "$src"; they are mutually exclusive (spec.md §5.3 4d). Keep one.`)}function $f(e,t){let n={eager:new Map,lazy:new Map};for(let[r,s]of Object.entries(e)){if(ms(`state entry "${r}"`,s),!At(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:p0(r,s)});continue}let o=n.eager.get(s.$src);if(!o)o=new Set,n.eager.set(s.$src,o);o.add(s1(r,s))}return n}function Sf(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:l,exportName:c})=>`const ${l} = (...args) => ${a}Load().then((m) => m.${c}(...args));`))}return{imports:n,loaders:r}}function Vo(e={},t=null,n={}){let r=df(t),s=t?ny(t):void 0,o=new Set(s);if(Object.defineProperty(r,m0,{configurable:!0,enumerable:!1,value:o,writable:!0}),n.holdMutable===!0){let d=new Set;for(let p of Object.values(e))if(At(p)||pn(p))pf(p.body??p.$expression,d);if(n.document)ff([n.document],d);for(let p of d)if(p in e)o.add(p)}let i=Ar({state:e});for(let[d,p]of Object.entries(e)){if(!F(p)||Array.isArray(p)){ps(r,d,uf(p));continue}if("default"in p){ps(r,d,uf(p.default));continue}if(Zr(p)){o.add(d);continue}if(!p.$prototype&&!("$expression"in p)&&!vs(p))ps(r,d,uf(p))}let a=[],l=[],c=[];for(let[d,p]of Object.entries(e)){if(ce(p)){a.push([d,p]);continue}if(!F(p))continue;if(pn(p)){let m=p.$expression;if(c.push([d,JSON.stringify(m)]),wr(p)){let g=p.parameters;ps(r,d,(...b)=>{let h={};for(let[x,k]of g.entries()){let w=f0(k);if(!w)continue;h[w]=b[x]===void 0&&d0(k)?k.default:b[x]}return Mn(m,r,null,{args:h})})}else if(hr(m.operator))ps(r,d,(g,b)=>Mn(m,g,b));else Qg(r,d,()=>Mn(m,r,null));continue}if(At(p)){if(ms(`state entry "${d}"`,p),vr(p)){let{body:m}=p;c.push([d,JSON.stringify(m)]),ps(r,d,(g,b)=>{Ii(m,g??r,b??null)})}else if(_(p.body)){let{body:m}=p,g=Function(...Or(p),m);if(i.get(d)==="computed")Qg(r,d,()=>g(r)),l.push([d,m]);else ps(r,d,g),c.push([d,m])}else ps(r,d,()=>{}),o.add(d);continue}if(An(p)&&(p.$prototype==="LocalStorage"||p.$prototype==="SessionStorage")){ps(r,d,uf(p.default??null));continue}if(An(p)&&p.$prototype==="Request")o.add(d);if(Xi(p))o.add(d)}let u=!0;while(u){u=!1;for(let[d,p]of[...l,...a])if(!o.has(d)&&y0(p,r))o.add(d),u=!0;for(let[d,p]of c)if(!o.has(d)&&p1(p,o))o.add(d),u=!0}for(let[d,p]of a)Qg(r,d,()=>Zt(p,r));return r}function ps(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0})}function Qg(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:n})}function rt(e,t){if(pe(e))return g0(e.$ref,t);if(ce(e))return Zt(e,t);return e}function Ye(e){return pe(e)}function g0(e,t){if(!_(e))return e;let n=an(e);if(n.startsWith("$map/")){let r=n.split("/"),s=r[1],i=t.$map?.[s]??t[`$map/${s}`];return r.length>2?ey(i,r.slice(2).join("/")):i}if(e.startsWith("#/state/"))return ey(t,e.slice(8));return ey(t,e)??null}function y0(e,t){if(!t)return!1;let n=ny(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(Ot(o))return!0}return!1}function p1(e,t){for(let n of e.matchAll(/#\/state\/([^"/\\]+)|\bstate\.([A-Za-z_$][\w$]*)/g)){let[,r,s]=n,o=r===void 0?s:r.replaceAll("~1","/").replaceAll("~0","~");if(o!==void 0&&t.has(o))return!0}return!1}function wf(e){return Vi(e)?`(${e.slice(2,-1)})`:`\`${e}\``}function Zt(e,t){if(y0(e,t))return null;let n=["state","$map","$site","$page"],r=[t,t?.$map,t?.$site,t?.$page],s=t?.$map;if(F(s)&&!Array.isArray(s)){n.push("item","index");let o=s;r.push(o.item,o.index)}try{let o=Vi(e)?`return (${e.slice(2,-1)})`:`return \`${e}\``;return Function(...n,o)(...r)}catch{return null}}function ey(e,t){return zt(e,t)}function uf(e){if(!F(e))return e;return structuredClone(e)}function m1(e,t){if(!e||!t)return"";return Object.entries(e).filter(([n,r])=>!n.startsWith(":")&&!n.startsWith(".")&&!n.startsWith("&")&&!n.startsWith("[")&&!n.startsWith("@")&&ce(r)).map(([n,r])=>{let s=rt(r,t);return s==null?null:`${xn(n)}: ${s}`}).filter(Boolean).join("; ")}function sy(e,t){if(!_(t)&&!De(t)&&!Xe(t))return null;if(e.kind==="text")return String(t);if(e.kind==="hidden"){if(_(t)&&t.toLowerCase()==="until-found")return"until-found";return t?"":null}let n=Boolean(t);if(e.keywords)return e.keywords[n?0:1];return Rr(e.attribute,n)}function b0(e,t){if(pe(e)&&(t===null||Nl(e.$ref,t)))return;try{return rt(e,t)}catch{return}}function kl(e,t,n){return n&&t===""?` ${e}`:` ${e}="${Me(t)}"`}function qo(e,t,n=""){let r=Vl(e.tagName,t),s=new Map,o,i=rt(e.id,t);if(i)s.set("id",kl("id",String(i),!1));let a=Ll(e),l=a?rt(Fl(e),t):null,c=[_(l)||De(l)?String(l):"",Ds(e)??""].filter((b)=>b!=="").join(" ");if(c)s.set("class",kl("class",c,!1));let u=(b,h)=>{if(h===void 0)return;let x=lf(r,b);if(!x)return;let k=b0(h,t);if(x.live&&k!==void 0)o??=new Set,o.add(x.attribute);let w=sy(x,k);if(w!==null)s.set(x.attribute,kl(x.attribute,w,x.kind!=="text"))};for(let b of x0)u(b,e[b]);let d=e;for(let b of Object.keys(d)){if(g1.has(b)||b.startsWith("$")||b.startsWith("on")||Gg(r,b))continue;u(b,d[b])}let p="";if(e.attributes)for(let[b,h]of Object.entries(e.attributes)){if(a&&b==="class")continue;let x=rt(h,t),k=null;if(Xe(x)){let v=Rr(b,x);k=v===null?null:kl(b,v,!0)}else if(_(x)||De(x))k=kl(b,String(x),!1);let w=b.toLowerCase();if(o?.has(w))continue;if(s.has(w)){if(k===null&&(x===null||x===void 0||Xe(x)))s.delete(w);else if(k!==null)s.set(w,k);continue}p+=k??""}let m="";for(let b of s.values())m+=b;let g=[m1(e.style,t),n].filter(Boolean).join("; ");if(g)m+=` style="${Me(g)}"`;if(m+=p,e.$static)m+=" data-jx-static";else if(e.$prerendered)m+=" data-jx-prerendered";return m}function Jl(e,t,n){if(Bi(e))return;if(!(("innerText"in e)||("value"in e)||("defaultValue"in e)||("text"in e)))return;for(let[r,s]of Object.entries(e)){if(s===void 0||!Gg(t,r))continue;let o=b0(s,n),i=o===null||o===void 0?"":Me(String(o));return r==="innerText"?i.replaceAll(/\r\n|\r|\n/gu,"<br>"):i}return}function Ki(){let e=JSON.stringify(Zu),t=JSON.stringify(pr);return`(function(){try{var s=localStorage.getItem(${e});if(s==="light"||s==="dark"){document.documentElement.setAttribute(${t},s)}}catch(e){}})()`}function $0(e,t,n,r,s={}){for(let o of Ri(t,{...s,mediaQueries:r,resolveValue:(i,a)=>S0(i,a,n),scope:n}))e.push(Sl(o))}function S0(e,t,n){let r=_(t)?t:t.$ref;return y1.push({property:e,selector:n,source:r}),null}function vf(){return`const __jxEnumAttrs = new Set(${JSON.stringify(Zv())});
211
+ function ${Wo}(n, v) {
142
212
  if (typeof v !== 'boolean') return v;
143
213
  const l = n.toLowerCase();
144
214
  if (l.startsWith('aria-') || __jxEnumAttrs.has(l)) return String(v);
145
215
  return v ? '' : null;
146
- }`}function xf(e){let t={keyed:!1,arranged:!1},n=(r)=>{for(let s of Bi(r)){if(Le(s)){t.arranged||=me(s.filter)||me(s.sort),t.keyed||=me(s.key),n(s.map?[s.map]:[]);continue}if(!Ot(s))continue;n(Object.values(s.cases??{}).filter((o)=>Ot(o)&&!Xe(o))),n(s.children)}};return n([e]),t}function Hg(e,t){for(let r of[e.items,e.filter,e.sort])if(me(r)&&Ol(r.$ref,t))return!1;let n=(r)=>{for(let s of Bi(r)){if(Le(s)){if(!Hg(s,t))return!1;continue}if(!Ot(s))continue;let o=Object.values(s.cases??{}).filter((i)=>Ot(i)&&!Xe(i));if(!n(o)||!n(s.children))return!1}return!0};return n(e.map?[e.map]:[])}function qo(e){let{items:t}=e;if(le(t))throw Error(`A repeater's items must be a $ref or a literal array, not the template string ${JSON.stringify(t)}. A template is not read as a list: bind items to a state entry by $ref, and compute the list in that entry.`)}function bf(e){let t=sn(e);if(t==="$map/item")return[];return t.startsWith("$map/item/")?Un(t.slice(10)):null}function $f(){return`function ${qi}(items, filter, sort) {
216
+ }`}function Ef(e){let t={keyed:!1,arranged:!1},n=(r)=>{for(let s of Zi(r)){if(Le(s)){t.arranged||=pe(s.filter)||pe(s.sort),t.keyed||=pe(s.key),n(s.map?[s.map]:[]);continue}if(!Ct(s))continue;n(Object.values(s.cases??{}).filter((o)=>Ct(o)&&!Ye(o))),n(s.children)}};return n([e]),t}function oy(e,t){for(let r of[e.items,e.filter,e.sort])if(pe(r)&&Nl(r.$ref,t))return!1;let n=(r)=>{for(let s of Zi(r)){if(Le(s)){if(!oy(s,t))return!1;continue}if(!Ct(s))continue;let o=Object.values(s.cases??{}).filter((i)=>Ct(i)&&!Ye(i));if(!n(o)||!n(s.children))return!1}return!0};return n(e.map?[e.map]:[])}function Bo(e){let{items:t}=e;if(ce(t))throw Error(`A repeater's items must be a $ref or a literal array, not the template string ${JSON.stringify(t)}. A template is not read as a list: bind items to a state entry by $ref, and compute the list in that entry.`)}function jf(e){let t=an(e);if(t==="$map/item")return[];return t.startsWith("$map/item/")?Xn(t.slice(10)):null}function Pf(){return`function ${Gi}(items, filter, sort) {
147
217
  if (!Array.isArray(items)) return [];
148
218
  let list = items;
149
219
  if (typeof filter === 'function') list = list.filter(filter);
150
220
  if (typeof sort === 'function') list = [...list].sort(sort);
151
221
  return list;
152
222
  }
153
- function ${Kv}(list, path, pointer, warn) {
223
+ function ${w0}(list, path, pointer, warn) {
154
224
  const keys = list.map((item, index) => {
155
225
  if (pointer === null) return index;
156
226
  if (path === null) {
@@ -173,202 +243,135 @@ function ${Kv}(list, path, pointer, warn) {
173
243
  }
174
244
  }
175
245
  return keys;
176
- }`}function wf(){return["class __JxKeyedList extends AsyncDirective {"," #args = null;"," #runner = null;"," #queued = false;"," #warned = false;"," #snap = shallowRef({ list: [], keys: [] });"," #warn = (message) => {"," if (this.#warned) return;"," this.#warned = true;"," console.warn(`Jx $map: ${message}`);"," };"," #compute = () => {"," const [items, filter, sort, path, pointer] = this.#args;",` const list = Array.from(${qi}(items, filter, sort));`,` this.#snap.value = { list, keys: ${Kv}(list, path, pointer, this.#warn) };`," };"," #schedule = () => {"," if (this.#queued) return;"," this.#queued = true;"," queueMicrotask(() => {"," this.#queued = false;"," if (this.#runner) this.#runner();"," });"," };"," #start(lazy) {"," this.#runner = effect(this.#compute, { lazy, scheduler: this.#schedule });"," if (lazy) this.#schedule();"," }"," render() {}"," update(_part, args) {"," const previous = this.#args;"," this.#args = args;"," if (!this.#runner) {"," if (this.isConnected) this.#start(false);"," } else if (previous[0] !== args[0] || previous[1] !== args[1] || previous[2] !== args[2]) {"," this.#schedule();"," }"," const snap = this.#snap.value;"," return repeat(snap.list, (_item, index) => snap.keys[index], args[5]);"," }"," disconnected() {"," if (this.#runner) stop(this.#runner);"," this.#runner = null;"," }"," reconnected() {"," if (!this.#runner && this.#args) this.#start(true);"," }","}",`const ${Nl} = directive(__JxKeyedList);`,"const __jxLiterals = new Map();",`function ${Rl}(text) {`," if (!__jxLiterals.has(text)) __jxLiterals.set(text, JSON.parse(text));"," return __jxLiterals.get(text);","}"].join(`
177
- `)}function Gv(){return[`function ${Wg}(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 ${Bg}(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(`
178
- `)}function Xv(){return[`function ${vf}(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(`
179
- `)}function Yv(e){return Qo(e)}function Tl(e){let{observedAttributes:t}=e;return Array.isArray(t)?t.filter((n)=>k(n)):[]}function Zv(e){let t=ih(e),n=new Set(Tl(e).map((s)=>Yv(s)));return`new Map([${[...t].flatMap(([s,o])=>n.has(s)?[`[${JSON.stringify(s)}, ${o===void 0?"undefined":JSON.stringify(o)}]`]:[]).join(", ")}])`}function Ef(){return[`async function ${Qv}(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(`
180
- `)}function Ug(e){let t={};for(let[n,r]of Object.entries(e))if(!R1.has(n)&&r!==void 0)t[n]=r;return t}function zg(e){return Pn(e)&&!N1.has(e.$prototype)}function Hi(e){return zg(e)&&e.timing==="client"}function jf(){return[`async function ${e0}(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(`
181
- `)}function Pf(e,t){let n=[],r=new Map;for(let[s,o]of Object.entries(e)){if(!Hi(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:Ug(o),key:s,name:o.$prototype})}return{entries:n,imports:[...r].map(([s,o])=>`import ${o} from '${s}';`)}}function _f(e,t){let{indent:n,instances:r,statePrefix:s}=t,o=["Promise.all(["];for(let{binding:i,config:a,key:l,name:c}of e){let u=Re(s,Wt(l)),d=JSON.stringify(l);o.push(`${n} ${e0}(${i}, ${JSON.stringify(c)}, ${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 "${l}" failed`)}, e); }),`)}return o.push(`${n}])`),o.join(`
182
- `)}function t0(){return[`function ${Kg}(host, internals, state, keys, root, formValue, watch) {`," const initial = { checked: state.checked, value: state.value };"," let ownDisabled = state.disabled;"," let forced = false;"," const control = () => root().querySelector('input, textarea, select');"," const mayBeLabelled = () => {"," if (host.closest('label')) return true;"," const id = host.id;"," if (id === '') return false;"," const tree = host.getRootNode();"," const scope = tree instanceof DocumentFragment ? tree : host.ownerDocument;"," return Array.from(scope.querySelectorAll('label[for]'))"," .some((label) => label.getAttribute('for') === id);"," };"," const nameControl = () => {"," if (!mayBeLabelled()) return;"," const target = control();"," const labels = internals.labels;"," if (target && labels.length > 0 && 'ariaLabelledByElements' in target &&"," !target.hasAttribute('aria-label') && !target.getAttribute('aria-labelledby')) {"," target.ariaLabelledByElements = Array.from(labels).filter((l) => l instanceof Element);"," }"," };"," host.addEventListener('click', (event) => {"," const target = control();"," if (event.target !== host || !target || target.disabled) return;"," target.focus();"," if (target.type === 'checkbox' || target.type === 'radio') target.click();"," });"," host.addEventListener('focusin', nameControl);"," const valueMissingMessage = () => {"," const probe = host.ownerDocument.createElement('input');"," probe.required = true;"," if (keys.checked) probe.type = 'checkbox';"," return probe.validationMessage || 'Please fill out this field.';"," };"," return {"," disabled(flag) {"," if (!keys.disabled) return;"," if (flag) {"," if (!forced) { ownDisabled = host.hasAttribute('disabled') ? false : state.disabled; forced = true; }"," state.disabled = true;"," } else if (forced) {"," forced = false;"," state.disabled = ownDisabled;"," }"," },"," reset() {"," if (keys.value) state.value = initial.value;"," if (keys.checked) state.checked = initial.checked;"," },"," start() {"," if (formValue) {"," watch(() => {"," const value = formValue();"," if (value === null || value === undefined) internals.setFormValue(null);"," else if (value instanceof File || value instanceof FormData) internals.setFormValue(value);"," else internals.setFormValue(String(value));"," });"," }"," if (keys.required) {"," watch(() => {"," const empty = keys.checked"," ? !state.checked"," : state.value === null || state.value === undefined || state.value === '';"," if (state.required && empty) {"," internals.setValidity({ valueMissing: true }, valueMissingMessage(), control() ?? undefined);"," } else {"," internals.setValidity({});"," }"," });"," }"," nameControl();"," },"," };","}"].join(`
183
- `)}function n0(){let e=`new RegExp(${JSON.stringify(qu.source)}, ${JSON.stringify(qu.flags)})`,t=`Symbol.for(${JSON.stringify(lh)})`,n=JSON.stringify(ml),r=JSON.stringify(Hu);return[`const __jxSlotWs = ${e};`,`const __jxSlotRec = globalThis[${t}] || (globalThis[${t}] = new WeakMap());`,`function ${Gg}(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 ${Xg}(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(`
184
- `)}function Ns(e){for(let t of Bi(e)){if(Le(t)){if(t.map&&Ns([t.map]))return!0;continue}if(!Ot(t))continue;if(t.tagName==="slot")return!0;let n=Object.values(t.cases??{}).filter((r)=>Ot(r)&&!Xe(r));if(Ns(n)||Ns(t.children))return!0}return!1}function Bi(e){if(Le(e))return[e];if(!Array.isArray(e))return[];return e}function Ui(e,t={},n=null){let r=[],s=Tv(D(n)?n:{},t,(i)=>i,zv,void 0,{comments:!0});if(s!=="")r.push(s);if(Af(e,r,t,"",{n:0}),r.length===0)return"";return`<style>
185
- ${kf(r.join(`
246
+ }`}function _f(){return["class __JxKeyedList extends AsyncDirective {"," #args = null;"," #runner = null;"," #queued = false;"," #warned = false;"," #snap = shallowRef({ list: [], keys: [] });"," #warn = (message) => {"," if (this.#warned) return;"," this.#warned = true;"," console.warn(`Jx $map: ${message}`);"," };"," #compute = () => {"," const [items, filter, sort, path, pointer] = this.#args;",` const list = Array.from(${Gi}(items, filter, sort));`,` this.#snap.value = { list, keys: ${w0}(list, path, pointer, this.#warn) };`," };"," #schedule = () => {"," if (this.#queued) return;"," this.#queued = true;"," queueMicrotask(() => {"," this.#queued = false;"," if (this.#runner) this.#runner();"," });"," };"," #start(lazy) {"," this.#runner = effect(this.#compute, { lazy, scheduler: this.#schedule });"," if (lazy) this.#schedule();"," }"," render() {}"," update(_part, args) {"," const previous = this.#args;"," this.#args = args;"," if (!this.#runner) {"," if (this.isConnected) this.#start(false);"," } else if (previous[0] !== args[0] || previous[1] !== args[1] || previous[2] !== args[2]) {"," this.#schedule();"," }"," const snap = this.#snap.value;"," return repeat(snap.list, (_item, index) => snap.keys[index], args[5]);"," }"," disconnected() {"," if (this.#runner) stop(this.#runner);"," this.#runner = null;"," }"," reconnected() {"," if (!this.#runner && this.#args) this.#start(true);"," }","}",`const ${Il} = directive(__JxKeyedList);`,"const __jxLiterals = new Map();",`function ${Ml}(text) {`," if (!__jxLiterals.has(text)) __jxLiterals.set(text, JSON.parse(text));"," return __jxLiterals.get(text);","}"].join(`
247
+ `)}function v0(){return[`function ${iy}(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 ${ay}(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(`
248
+ `)}function E0(){return[`function ${Of}(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(`
249
+ `)}function j0(e){return oi(e)}function Dl(e){let{observedAttributes:t}=e;return Array.isArray(t)?t.filter((n)=>_(n)):[]}function P0(e){let t=Ug(e),n=new Set(Dl(e).map((s)=>j0(s)));return`new Map([${[...t].flatMap(([s,o])=>n.has(s)?[`[${JSON.stringify(s)}, ${o===void 0?"undefined":JSON.stringify(o)}]`]:[]).join(", ")}])`}function Af(){return[`async function ${k0}(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(`
250
+ `)}function ly(e){let t={};for(let[n,r]of Object.entries(e))if(!x1.has(n)&&r!==void 0)t[n]=r;return t}function cy(e){return An(e)&&!b1.has(e.$prototype)}function Xi(e){return cy(e)&&e.timing==="client"}function Cf(){return[`async function ${_0}(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(`
251
+ `)}function Rf(e,t){let n=[],r=new Map;for(let[s,o]of Object.entries(e)){if(!Xi(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:ly(o),key:s,name:o.$prototype})}return{entries:n,imports:[...r].map(([s,o])=>`import ${o} from '${s}';`)}}function Tf(e,t){let{indent:n,instances:r,statePrefix:s}=t,o=["Promise.all(["];for(let{binding:i,config:a,key:l,name:c}of e){let u=Je(s,Ut(l)),d=JSON.stringify(l);o.push(`${n} ${_0}(${i}, ${JSON.stringify(c)}, ${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 "${l}" failed`)}, e); }),`)}return o.push(`${n}])`),o.join(`
252
+ `)}function O0(){return[`function ${uy}(host, internals, state, keys, root, formValue, watch) {`," const initial = { checked: state.checked, value: state.value };"," let ownDisabled = state.disabled;"," let forced = false;"," const control = () => root().querySelector('input, textarea, select');"," const mayBeLabelled = () => {"," if (host.closest('label')) return true;"," const id = host.id;"," if (id === '') return false;"," const tree = host.getRootNode();"," const scope = tree instanceof DocumentFragment ? tree : host.ownerDocument;"," return Array.from(scope.querySelectorAll('label[for]'))"," .some((label) => label.getAttribute('for') === id);"," };"," const nameControl = () => {"," if (!mayBeLabelled()) return;"," const target = control();"," const labels = internals.labels;"," if (target && labels.length > 0 && 'ariaLabelledByElements' in target &&"," !target.hasAttribute('aria-label') && !target.getAttribute('aria-labelledby')) {"," target.ariaLabelledByElements = Array.from(labels).filter((l) => l instanceof Element);"," }"," };"," host.addEventListener('click', (event) => {"," const target = control();"," if (event.target !== host || !target || target.disabled) return;"," target.focus();"," if (target.type === 'checkbox' || target.type === 'radio') target.click();"," });"," host.addEventListener('focusin', nameControl);"," const valueMissingMessage = () => {"," const probe = host.ownerDocument.createElement('input');"," probe.required = true;"," if (keys.checked) probe.type = 'checkbox';"," return probe.validationMessage || 'Please fill out this field.';"," };"," return {"," disabled(flag) {"," if (!keys.disabled) return;"," if (flag) {"," if (!forced) { ownDisabled = host.hasAttribute('disabled') ? false : state.disabled; forced = true; }"," state.disabled = true;"," } else if (forced) {"," forced = false;"," state.disabled = ownDisabled;"," }"," },"," reset() {"," if (keys.value) state.value = initial.value;"," if (keys.checked) state.checked = initial.checked;"," },"," start() {"," if (formValue) {"," watch(() => {"," const value = formValue();"," if (value === null || value === undefined) internals.setFormValue(null);"," else if (value instanceof File || value instanceof FormData) internals.setFormValue(value);"," else internals.setFormValue(String(value));"," });"," }"," if (keys.required) {"," watch(() => {"," const empty = keys.checked"," ? !state.checked"," : state.value === null || state.value === undefined || state.value === '';"," if (state.required && empty) {"," internals.setValidity({ valueMissing: true }, valueMissingMessage(), control() ?? undefined);"," } else {"," internals.setValidity({});"," }"," });"," }"," nameControl();"," },"," };","}"].join(`
253
+ `)}function A0(){let e=`new RegExp(${JSON.stringify(sf.source)}, ${JSON.stringify(sf.flags)})`,t=`Symbol.for(${JSON.stringify(Kg)})`,n=JSON.stringify(El),r=JSON.stringify(of);return[`const __jxSlotWs = ${e};`,`const __jxSlotRec = globalThis[${t}] || (globalThis[${t}] = new WeakMap());`,`function ${fy}(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 ${dy}(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(`
254
+ `)}function Ms(e){for(let t of Zi(e)){if(Le(t)){if(t.map&&Ms([t.map]))return!0;continue}if(!Ct(t))continue;if(t.tagName==="slot")return!0;let n=Object.values(t.cases??{}).filter((r)=>Ct(r)&&!Ye(r));if(Ms(n)||Ms(t.children))return!0}return!1}function Zi(e){if(Le(e))return[e];if(!Array.isArray(e))return[];return e}function Qi(e,t={},n=null){let r=[],s=s0(F(n)?n:{},t,(i)=>i,S0,void 0,{comments:!0});if(s!=="")r.push(s);if(Mf(e,r,t,"",{n:0}),r.length===0)return"";return`<style>
255
+ ${Nf(r.join(`
186
256
  `))}
187
- </style>`}function kf(e){return e.replaceAll(/<\/(?=style)/gi,String.raw`<\/`)}function Js(e){return e[r0]}function s0(e,t,n){let r=Js(e);if(r!==void 0)return r;let s=`${n}-${t.n}`;return t.n+=1,e[r0]=s,s}function Of(e){let{children:t}=e;if(Array.isArray(t))return t;return Le(t)?[t]:[]}function jl(e,t){if(!D(e))return;if(Le(e)){if(e.map)jl(e.map,t);return}t(e);for(let n of Of(e))jl(n,t);if(D(e.cases))for(let n of Object.values(e.cases))jl(n,t)}function o0(e,t,n){jl(e,(r)=>{if(r.style)s0(r,t,n)})}function Jl(e){return Js(e)!==void 0||Boolean(e.className)}function Ml(e){let{attributes:t}=e;return D(t)&&Object.hasOwn(t,"class")?t.class:e.className}function Af(e,t,n,r="",s,o="jx",i={}){let a=s??{n:0};jl(e,(l)=>{if(l.style)Uv(t,l.style,`.${s0(l,a,o)}`,n,i)})}function Ne(e){return String(e).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#39;")}function Ms(e){return e.split("-").map((t)=>t.charAt(0).toUpperCase()+t.slice(1)).join("")}function i0(e){let t=new Set;return a0(e,t),[...t]}function a0(e,t){if(!D(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)a0(n,t)}function l0(e){let t=[];return c0(e,t),t}function c0(e,t){if(!D(e))return;if(e.state){for(let[n,r]of Object.entries(e.state))if(Zr(r))t.push({exportName:r.$export,key:n,src:r.$src})}if(Array.isArray(e.children))for(let n of e.children)c0(n,t)}function Il(e,t){if(k(e))return e;let n=Yo(e);if(n.length===0)return"div";if(!rr(e))return n[0];let r=e.$expression,s=r.target;if(r.operator==="?:")return tt(s,t)?r.value:r.initial;let o=tt(s,t);return r.cases[String(o)]??r.default}function Zg(e){if(!e?.slotIds)return null;return e.slotIds.n+=1,e.slotIds.n}function Qg(e,t,n,r=null){let s=new Map;for(let o of Bi(e)){let i="",a=!0,l;if(k(o)||Ie(o)||Ge(o)){if(l=n(o),qu.test(l))continue;a=l!==""}else if(Le(o))l=n(o);else if(!Ot(o))l=n(o),a=l!=="";else{let u=tt(o.attributes?.slot,t),d=k(o.slot)?tt(o.slot,t):null;if(k(u)&&u!=="")i=u,l=n(o);else if(k(d)&&d!==""){i=d;let{slot:p,...m}=o;l=n({...m,attributes:{...m.attributes,slot:d}})}else l=n(o)}let c=s.get(i);if(c)c.html=c.html===""?l:`${c.html}
188
- ${l}`,c.content||=a;else s.set(i,{content:a,html:l})}return{groups:s,id:r,taken:new Set}}function u0(e,t,n){for(let r of Bi(e)){if(Le(r)||!Ot(r))continue;if(r.tagName==="slot"){let s=tt(r.attributes?.name,t);n.taken.add(k(s)?s:"")}u0(r.children,t,n)}}function ey(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 Dl(e,t){if(!t)return Do(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 Do(n,null)}function ty(e,t,n){let r=Tl(e).filter((a)=>Object.hasOwn(t??{},a));if(!t||r.length===0)return null;let s=ih(e),o=Dl(e,null),i=null;for(let a of r){let l=tt(t[a],n),c=null;if(Ge(l))c=Rr(a,l);else if(k(l)||Ie(l))c=String(l);let u=Yv(a);if(c===null||s.has(u)&&s.get(u)===void 0)continue;_v(o,a,c,s),i??={},i[u]=o[u]}return i}function ny(e,t){let n={};for(let[r,s]of Object.entries(e??{})){if(me(s)&&Ol(s.$ref,t))continue;let o;try{o=tt(s,t)}catch{continue}if(k(o)||Ie(o)||Ge(o))n[r]=o}return n}function ry(e,t){return Object.fromEntries(Object.entries(e??{}).flatMap(([n,r])=>{if(!le(r))return[];let s=tt(r,t);return s==null?[]:[[n,s]]}))}function _l(e,t,n,r,s=!1){if(e.textContent!==void 0){let i=tt(e.textContent,t);return i!=null?Ne(String(i)):""}if(e.innerHTML){let i=tt(e.innerHTML,t);return i!=null?String(i):e.innerHTML}let o=Al(e,Il(e.tagName,t),t);if(o!==void 0)return o;if(Le(e.children))return f0(e.children,t,n,r,s);if(Array.isArray(e.children))return e.children.map((i)=>Fo(i,t,n,r,s)).join(s?"":`
189
- `);return""}function f0(e,t,n=null,r=null,s=!1){let o=e.map;if(!o)return"";qo(e);let i=t??of(),a=sy(e,i);if(a===null)return"";return a.map((l,c)=>{let u=of(i);return u.$map={index:c,item:l},u["$map/item"]=l,u["$map/index"]=c,Fo(o,u,n,r,s)}).join(s?"":`
190
- `)}function sy(e,t){let n=(r)=>me(r)?qv(r.$ref,t):void 0;for(let r of[e.items,e.filter,e.sort])if(me(r)&&Ol(r.$ref,t))return null;try{let r=me(e.items)?n(e.items):e.items;if(!Array.isArray(r))return null;return Pv(r,n(e.filter),n(e.sort))}catch{return null}}function Fo(e,t,n=null,r=null,s=!1){if(k(e)){if(le(e)&&t){let c=Gt(e,t);if(c!=null)return Ne(String(c));return r?"":Ne(e)}return Ne(e)}if(Ie(e)||Ge(e))return Ne(String(e));if(Array.isArray(e))return e.map((c)=>Fo(c,t,n,r,s)).join(s?"":`
191
- `);if(!D(e))return"";if(Le(e))return f0(e,t,n,r,s);if(e.$switch){let c=e.tagName??"div",u=Lo(e,t),p=me(e.$switch)&&t!==null&&Ol(e.$switch.$ref,t)?null:tt(e.$switch,t),m=p==null?void 0:e.cases?.[String(p)],y=m!==void 0&&!Xe(m)?Fo(m,t,n,r,s):"";return`<${c}${u}>${y}</${c}>`}let o=Il(e.tagName,t);if(o==="slot"&&n){let c=tt(e.attributes?.name,t),u=k(c)?c:"",d;if(!n.taken.has(u))n.taken.add(u),d=n.groups.get(u);let p=d?.html??"";if(p!==""&&n.id!==null)p=`<!--${Hu} ${n.id} ${encodeURIComponent(u)}-->${p}<!--/${Hu} ${n.id}-->`;if(d?.content)return u0(e.children,t,n),p;let m=_l(e,t,n,r,s);return p===""?m:m===""?p:`${p}
192
- ${m}`}let i=r?.componentDefs.get(o);if(i&&r)return T1(e,i,t,n,r);let a=Lo(e,t);if(Yg.has(o))return`<${o}${a}>`;let l=_l(e,t,n,r,s||ms.has(o));return`<${o}${a}>${l}</${o}>`}function T1(e,t,n,r,s){let o=t.tagName,{lifted:i,rest:a}=ey(e.attributes),l={...i,...e.$props},c={};for(let[O,N]of Object.entries(l))c[O]=tt(N,n)??N;let u=Object.keys(c).length>0,d={...ty(t,a,n),...c},p=Object.keys(d).length>0,m=s.path??[],y={key:JSON.stringify(d),tag:o},S=[...m.map((O)=>O.tag),o].join(" → ");if(m.some((O)=>O.tag===y.tag&&O.key===y.key))throw Error(`Component <${o}> renders itself: ${S}. A component cannot appear inside its own `+"definition with the same props — the expansion would never end.");if(m.length>=ah)throw Error(`Component nesting exceeds ${ah} levels: ${S}. A component that renders itself with changing props needs a case that stops.`);let g={...s,path:[...m,y]},{children:x}=e,P=(O)=>Fo(O,n,r,s),w=Rn(t,s.defaults),E=!oy(o,t,s.liveTags),j=Dl(t,p?d:null),A,T=null;if(w){let O=Array.isArray(x)?x.map((N)=>P(N)).join(`
193
- `):"";A=`<template shadowrootmode="${w}"><link rel="stylesheet" href="${Rf(o)}">${_l(t,j,null,g)}</template>${O}`}else{T=!E&&Ns(t.children)?Zg(s):null;let O=Qg(x,n,P,T);A=_l(t,j,O,g)}let I=Object.entries(ry(t.style,j)).map(([O,N])=>`${hn(O)}: ${N}`).join("; "),V={...e};delete V.$props,delete V.children;let H={...a,...ny(t.attributes,j)};if(V.attributes=!E&&u?{...H,"data-jx-props":JSON.stringify(c)}:H,T!==null)V.attributes={...V.attributes,[ml]:String(T)};if(E)V.$static=!0;else V.$prerendered=!0;return`<${o}${Lo(V,n,I)}>${A}</${o}>`}function d0(e,t=null,n=null,r=null){return _l(e,Dl(e,t),n,r)}function oy(e,t,n){return n?n.has(e):!m0(t)}function lf(e,t){let n=new Set,r=(s,o)=>{if(Array.isArray(s)){for(let i of s)r(i,!1);return}if(!D(s))return;if(Le(s)){r(s.map,!1);return}if(!o){for(let i of Yo(s.tagName))if(t.has(i))n.add(i)}r(s.children,!1);for(let i of Object.values(s.cases??{}))if(!Xe(i))r(i,!1)};return r(e,!0),n}function p0(e,t){let n=(i)=>{let a=new Set(i),l=[...a];for(let c=l.pop();c!==void 0;c=l.pop())for(let u of lf(e.get(c),e))if(!a.has(u))a.add(u),l.push(u);return a},r=t?n(lf(t,e)):void 0,s=new Set,o=[];for(let[i,a]of e)if(!m0(a)){if(s.add(i),!r||r.has(i))o.push(i)}for(let i of n(o))s.add(i);return s}function Cf(e,t){let n=new Set(e),r=new Set,s=[],o=(i)=>{if(r.has(i))return;r.add(i);let a=t.get(i);if(a)for(let l of[...lf(a,t)].toSorted())o(l);if(n.has(i))s.push(i)};for(let i of[...e].toSorted())o(i);return s}function m0(e){if(Tl(e).length>0)return!1;return El(e)}function El(e){if(!D(e))return!0;if(Array.isArray(e))return e.every((t)=>El(t));if(Le(e))return Array.isArray(e.items)&&e.filter===void 0&&e.sort===void 0&&e.key===void 0&&(e.map===void 0||El(e.map));if(e.$prototype)return!1;if(e.$switch!==void 0||rr(e.tagName))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)=>El(t));if(Le(e.children))return El(e.children);return!0}function Rf(e){return`/components/${e}.css`}function h0(e,t,n,r){let s=new Set([e]),o=[n.get(e)??""],i=(a)=>{for(let l of lf(t.get(a)??{},t)){if(s.has(l)||r.has(l))continue;s.add(l),o.push(n.get(l)??""),i(l)}};return i(e),o.join("")}function Nf(e,t,n=null,r={},s=null){let o=[],i=Mv(e,s),a={host:s===null?"light":"shadow"};if(s!==null)a.shadowTree=!0;let l=D(t)?t:{};if(Uv(o,"display"in l?l:{display:"block",...l},i,r,a),n){let c={n:0};for(let u of Of(n))Af(u,o,r,"",c,e,{shadowTree:s!==null})}return o.length>0?`${o.join(`
257
+ </style>`}function Nf(e){return e.replaceAll(/<\/(?=style)/gi,String.raw`<\/`)}function Ds(e){return e[C0]}function R0(e,t,n){let r=Ds(e);if(r!==void 0)return r;let s=`${n}-${t.n}`;return t.n+=1,e[C0]=s,s}function Jf(e){let{children:t}=e;if(Array.isArray(t))return t;return Le(t)?[t]:[]}function Al(e,t){if(!F(e))return;if(Le(e)){if(e.map)Al(e.map,t);return}t(e);for(let n of Jf(e))Al(n,t);if(F(e.cases))for(let n of Object.values(e.cases))Al(n,t)}function T0(e,t,n){Al(e,(r)=>{if(r.style)R0(r,t,n)})}function Ll(e){return Ds(e)!==void 0||Boolean(e.className)}function Fl(e){let{attributes:t}=e;return F(t)&&Object.hasOwn(t,"class")?t.class:e.className}function Mf(e,t,n,r="",s,o="jx",i={}){let a=s??{n:0};Al(e,(l)=>{if(l.style)$0(t,l.style,`.${R0(l,a,o)}`,n,i)})}function Me(e){return String(e).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#39;")}function Ls(e){return e.split("-").map((t)=>t.charAt(0).toUpperCase()+t.slice(1)).join("")}function N0(e){let t=new Set;return J0(e,t),[...t]}function J0(e,t){if(!F(e))return;if(e.state){for(let n of Object.values(e.state))if(At(n)&&n.$src)t.add(n.$src)}if(Array.isArray(e.children))for(let n of e.children)J0(n,t)}function M0(e){let t=[];return I0(e,t),t}function I0(e,t){if(!F(e))return;if(e.state){for(let[n,r]of Object.entries(e.state))if(Zr(r))t.push({exportName:r.$export,key:n,src:r.$src})}if(Array.isArray(e.children))for(let n of e.children)I0(n,t)}function Vl(e,t){if(_(e))return e;let n=ri(e);if(n.length===0)return"div";if(!ir(e))return n[0];let r=e.$expression,s=r.target;if(r.operator==="?:")return rt(s,t)?r.value:r.initial;let o=rt(s,t);return r.cases[String(o)]??r.default}function my(e){if(!e?.slotIds)return null;return e.slotIds.n+=1,e.slotIds.n}function hy(e,t,n,r=null){let s=new Map;for(let o of Zi(e)){let i="",a=!0,l;if(_(o)||De(o)||Xe(o)){if(l=n(o),sf.test(l))continue;a=l!==""}else if(Le(o))l=n(o);else if(!Ct(o))l=n(o),a=l!=="";else{let u=rt(o.attributes?.slot,t),d=_(o.slot)?rt(o.slot,t):null;if(_(u)&&u!=="")i=u,l=n(o);else if(_(d)&&d!==""){i=d;let{slot:p,...m}=o;l=n({...m,attributes:{...m.attributes,slot:d}})}else l=n(o)}let c=s.get(i);if(c)c.html=Kt([c.html,l],{separator:`
258
+ `}),c.content||=a;else s.set(i,{content:a,html:l})}return{groups:s,id:r,taken:new Set}}function D0(e,t,n){for(let r of Zi(e)){if(Le(r)||!Ct(r))continue;if(r.tagName==="slot"){let s=rt(r.attributes?.name,t);n.taken.add(_(s)?s:"")}D0(r.children,t,n)}}function gy(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 ql(e,t){if(!t)return Vo(e.state??{},null);let n={...e.state};for(let[r,s]of Object.entries(t)){let o=n[r];n[r]=F(o)&&!Array.isArray(o)&&"default"in o?{...o,default:s}:s}return Vo(n,null)}function yy(e,t,n){let r=Dl(e).filter((a)=>Object.hasOwn(t??{},a));if(!t||r.length===0)return null;let s=Ug(e),o=ql(e,null),i=null;for(let a of r){let l=rt(t[a],n),c=null;if(Xe(l))c=Rr(a,l);else if(_(l)||De(l))c=String(l);let u=j0(a);if(c===null||s.has(u)&&s.get(u)===void 0)continue;e0(o,a,c,s),i??={},i[u]=o[u]}return i}function xy(e,t){let n={};for(let[r,s]of Object.entries(e??{})){if(pe(s)&&Nl(s.$ref,t))continue;let o;try{o=rt(s,t)}catch{continue}if(_(o)||De(o)||Xe(o))n[r]=o}return n}function by(e,t){return Object.fromEntries(Object.entries(e??{}).flatMap(([n,r])=>{if(!ce(r))return[];let s=rt(r,t);return s==null?[]:[[n,s]]}))}function Rl(e,t,n,r,s=!1){if(e.textContent!==void 0){let i=rt(e.textContent,t);return i!=null?Me(String(i)):""}if(e.innerHTML){let i=rt(e.innerHTML,t);return i!=null?String(i):e.innerHTML}let o=Jl(e,Vl(e.tagName,t),t);if(o!==void 0)return o;if(Le(e.children))return L0(e.children,t,n,r,s);if(Array.isArray(e.children))return Kt(e.children.map((i)=>Ho(i,t,n,r,s)),{preformatted:s,separator:`
259
+ `});return""}function L0(e,t,n=null,r=null,s=!1){let o=e.map;if(!o)return"";Bo(e);let i=t??df(),a=$y(e,i);if(a===null)return"";return Kt(a.map((l,c)=>{let u=df(i);return u.$map={index:c,item:l},u["$map/item"]=l,u["$map/index"]=c,Ho(o,u,n,r,s)}),{preformatted:s,separator:`
260
+ `})}function $y(e,t){let n=(r)=>pe(r)?g0(r.$ref,t):void 0;for(let r of[e.items,e.filter,e.sort])if(pe(r)&&Nl(r.$ref,t))return null;try{let r=pe(e.items)?n(e.items):e.items;if(!Array.isArray(r))return null;return Qv(r,n(e.filter),n(e.sort))}catch{return null}}function Ho(e,t,n=null,r=null,s=!1){if(_(e)){if(ce(e)&&t){let c=Zt(e,t);if(c!=null)return Me(String(c));return r?"":Me(e)}return Me(e)}if(De(e)||Xe(e))return Me(String(e));if(Array.isArray(e))return Kt(e.map((c)=>Ho(c,t,n,r,s)),{preformatted:s,separator:`
261
+ `});if(!F(e))return"";if(Le(e))return L0(e,t,n,r,s);if(e.$switch){let c=e.tagName??"div",u=qo(e,t),p=pe(e.$switch)&&t!==null&&Nl(e.$switch.$ref,t)?null:rt(e.$switch,t),m=p==null?void 0:e.cases?.[String(p)],g=m!==void 0&&!Ye(m)?Ho(m,t,n,r,s):"";return`<${c}${u}>${g}</${c}>`}let o=Vl(e.tagName,t);if(o==="slot"&&n){let c=rt(e.attributes?.name,t),u=_(c)?c:"",d;if(!n.taken.has(u))n.taken.add(u),d=n.groups.get(u);let p=d?.html??"";if(p!==""&&n.id!==null)p=`<!--${of} ${n.id} ${encodeURIComponent(u)}-->${p}<!--/${of} ${n.id}-->`;if(d?.content)return D0(e.children,t,n),p;let m=Rl(e,t,n,r,s);return Kt([p,m],{preformatted:s,separator:`
262
+ `})}let i=r?.componentDefs.get(o);if(i&&r)return $1(e,i,t,n,r);let a=qo(e,t);if(py.has(o))return`<${o}${a}>`;let l=Rl(e,t,n,r,s||hs.has(o));return`<${o}${a}>${l}</${o}>`}function $1(e,t,n,r,s){let o=t.tagName,{lifted:i,rest:a}=gy(e.attributes),l={...i,...e.$props},c={};for(let[A,J]of Object.entries(l))c[A]=rt(J,n)??J;let u=Object.keys(c).length>0,d={...yy(t,a,n),...c},p=Object.keys(d).length>0,m=s.path??[],g={key:JSON.stringify(d),tag:o},b=[...m.map((A)=>A.tag),o].join(" → ");if(m.some((A)=>A.tag===g.tag&&A.key===g.key))throw Error(`Component <${o}> renders itself: ${b}. A component cannot appear inside its own `+"definition with the same props — the expansion would never end.");if(m.length>=zg)throw Error(`Component nesting exceeds ${zg} levels: ${b}. A component that renders itself with changing props needs a case that stops.`);let h={...s,path:[...m,g]},{children:x}=e,k=(A)=>Ho(A,n,r,s),w=Jn(t,s.defaults),v=!Sy(o,t,s.liveTags),E=ql(t,p?d:null),O,I=null;if(w){let A=Array.isArray(x)?Kt(x.map((J)=>k(J)),{separator:`
263
+ `}):"";O=`<template shadowrootmode="${w}"><link rel="stylesheet" href="${Df(o)}">${Rl(t,E,null,h)}</template>${A}`}else{I=!v&&Ms(t.children)?my(s):null;let A=hy(x,n,k,I);O=Rl(t,E,A,h)}let D=Object.entries(by(t.style,E)).map(([A,J])=>`${xn(A)}: ${J}`).join("; "),V={...e};delete V.$props,delete V.children;let W={...a,...xy(t.attributes,E)};if(V.attributes=!v&&u?{...W,"data-jx-props":JSON.stringify(c)}:W,I!==null)V.attributes={...V.attributes,[El]:String(I)};if(v)V.$static=!0;else V.$prerendered=!0;return`<${o}${qo(V,n,D)}>${O}</${o}>`}function F0(e,t=null,n=null,r=null){return Rl(e,ql(e,t),n,r)}function Sy(e,t,n){return n?n.has(e):!q0(t)}function mf(e,t){let n=new Set,r=(s,o)=>{if(Array.isArray(s)){for(let i of s)r(i,!1);return}if(!F(s))return;if(Le(s)){r(s.map,!1);return}if(!o){for(let i of ri(s.tagName))if(t.has(i))n.add(i)}r(s.children,!1);for(let i of Object.values(s.cases??{}))if(!Ye(i))r(i,!1)};return r(e,!0),n}function V0(e,t){let n=(i)=>{let a=new Set(i),l=[...a];for(let c=l.pop();c!==void 0;c=l.pop())for(let u of mf(e.get(c),e))if(!a.has(u))a.add(u),l.push(u);return a},r=t?n(mf(t,e)):void 0,s=new Set,o=[];for(let[i,a]of e)if(!q0(a)){if(s.add(i),!r||r.has(i))o.push(i)}for(let i of n(o))s.add(i);return s}function If(e,t){let n=new Set(e),r=new Set,s=[],o=(i)=>{if(r.has(i))return;r.add(i);let a=t.get(i);if(a)for(let l of[...mf(a,t)].toSorted())o(l);if(n.has(i))s.push(i)};for(let i of[...e].toSorted())o(i);return s}function q0(e){if(Dl(e).length>0)return!1;return Ol(e)}function Ol(e){if(!F(e))return!0;if(Array.isArray(e))return e.every((t)=>Ol(t));if(Le(e))return Array.isArray(e.items)&&e.filter===void 0&&e.sort===void 0&&e.key===void 0&&(e.map===void 0||Ol(e.map));if(e.$prototype)return!1;if(e.$switch!==void 0||ir(e.tagName))return!1;if(e.$ref)return!1;if(e.state)for(let t of Object.values(e.state)){if(!F(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)=>Ol(t));if(Le(e.children))return Ol(e.children);return!0}function Df(e){return`/components/${e}.css`}function H0(e,t,n,r){let s=new Set([e]),o=[n.get(e)??""],i=(a)=>{for(let l of mf(t.get(a)??{},t)){if(s.has(l)||r.has(l))continue;s.add(l),o.push(n.get(l)??""),i(l)}};return i(e),o.join("")}function Lf(e,t,n=null,r={},s=null){let o=[],i=u0(e,s),a={host:s===null?"light":"shadow"};if(s!==null)a.shadowTree=!0;let l=F(t)?t:{};if($0(o,"display"in l?l:{display:"block",...l},i,r,a),n){let c={n:0};for(let u of Jf(n))Mf(u,o,r,"",c,e,{shadowTree:s!==null})}return o.length>0?`${o.join(`
194
264
  `)}
195
- `:""}var b1,Fv,Ts="https://esm.sh/@vue/reactivity@3.5.40",Nr="https://esm.sh/lit-html@3.3.0",vl,S1,v1,E1,j1,P1,Wv,O1,A1,ms,C1,Vo="__jxAttrText",qi="__jxListItems",Kv="__jxRowKeys",Rl="__jxLiteral",Nl="__jxKeyed",Sf,Wg="__jxSupplies",Bg="__jxNativeSetter",vf="__jxAbsorbAttr",Qv="__jxServerCall",R1,N1,e0="__jxInstantiate",Kg="__jxAssociateForm",Gg="__jxCaptureSlotted",Xg="__jxDistributeSlots",Wi="<!---->",r0,Yg;var yn=J(()=>{$i();Mi();uh();Ai();Fu();Rv();Jv();ce();Sl();_i();Mi();Ai();Fu();ce();Ai();b1=["$map/","event#/","$args/","$reduce/"];Fv=Symbol("jx.runtimeOnlyStateKeys");vl=String.raw`(?:\s|\\[nrt])*`,S1=new RegExp(String.raw`(?:=|\.\.\.)${vl}state[ \t]*(?:[;,)}\]"]|\\[nr])`);v1=/\bstate\.([A-Za-z_$][\w$]*)\s*(?:\+\+|--|(?:\*\*|\|\||&&|\?\?|<<|>>>|>>|[-+*/%&|^])?=(?!=))/g,E1=/\bstate\.([A-Za-z_$][\w$]*)\s*\.\s*(?:push|pop|shift|unshift|splice|sort|reverse|fill|copyWithin)\s*\(/g,j1=/[\w$.]/u,P1=/[\w$]/u;Wv=["hidden","tabIndex","title","lang","dir"],O1=new Set([...Wv,"id","className"]),A1=new Set([...pr,...O1,"textContent","innerHTML"]);ms=new Set(["pre","textarea","listing","plaintext","xmp"]);C1=[];Sf=["import { AsyncDirective, directive } from 'lit-html/async-directive.js';","import { repeat } from 'lit-html/directives/repeat.js';"];R1=new Set(["$prototype","$src","$export","timing","default","description"]);N1=new Set(tg);r0=Symbol("jx.styleHandle");Yg=new Set(["input","br","hr","img","meta","link","area","col","source"])});import{relative as J1,sep as M1}from"node:path";function Ll(e){return e===I1}function zi(e,t){if(e==="/")return"/";if(t==="always")return e.endsWith("/")?e:`${e}/`;if(t==="never")return e.replace(/\/+$/,"")||"/";return e}function Tf(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 g0(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(Tf(r,"name")?.trim().toLowerCase()!=="robots")continue;let s=new Set((Tf(r,"content")??"").toLowerCase().split(",").map((o)=>o.trim()));if(s.has("noindex")||s.has("none"))return!0}return!1}function y0(e){let t=e.search(/<\/head\s*>/i);return{end:t,head:t===-1?e:e.slice(0,t)}}function D1(e,t){let n=t.trim().toLowerCase();for(let[r]of y0(e).head.matchAll(/<link\b[^>]*>/gi)){let s=(Tf(r,"rel")??"").toLowerCase().split(/\s+/),o=(Tf(r,"type")??"").split(";")[0]?.trim().toLowerCase();if(s.includes("alternate")&&o===n)return!0}return!1}function x0(e,t){let{end:n}=y0(e);if(n===-1||D1(e,t.type))return e;let r=`<link href="${Ne(t.href)}" rel="alternate" type="${Ne(t.type)}">`;return`${e.slice(0,n)}${r}
196
- ${e.slice(n)}`}function b0(e,t){return new URL(`/${J1(e,t).split(M1).join("/")}`,"http://localhost").pathname}var I1="/404";var iy=J(()=>{yn()});function $0(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=Bn(s);if(o===null||!t.locales.includes(o))n.push(r.urlPattern)}return n}function S0(e,t){if(t===null)return null;let n=e.split("/").find(Boolean),r=Bn(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 L1(e,t){let n=e.split("/").filter(Boolean),r=Bn(n[0]);if(t!==null&&r!==null&&t.locales.includes(r))return n.slice(1).join("/");return n.join("/")}function ay(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?L1(i.urlPattern,t):i.translationKey.replaceAll(/^\/+|\/+$/g,"");if(i.translationKey!==void 0)o.add(i.urlPattern);let l=cr(i.urlPattern,t);if(l===null)continue;let c=s.get(a)??[],u=c.find((d)=>d.locale===l);if(u===void 0)c.push({locale:l,urlPattern:i.urlPattern});else r.push({declared:o.has(u.urlPattern)||i.translationKey!==void 0,key:a,locale:l,urlPatterns:[u.urlPattern,i.urlPattern]});s.set(a,c)}for(let i of s.values()){let a=i.toSorted((l,c)=>l.locale===c.locale?0:l.locale<c.locale?-1:1);for(let l of i)n.set(l.urlPattern,a)}return{conflicts:r,sets:n}}function w0(e,t,n,r){let s=new Map;if(t===null||n==="")return s;let o=new Map;for(let[i,a]of ay(e,t).sets){if(a.length<2)continue;let l=o.get(a);if(l===void 0){l=a.map((u)=>({href:Cs(zi(u.urlPattern,r),n),hreflang:u.locale}));let c=a.find((u)=>u.locale===t.defaultLocale);if(c!==void 0)l.push({href:Cs(zi(c.urlPattern,r),n),hreflang:"x-default"});o.set(a,l)}s.set(i,l)}return s}function v0({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 al(s)==="rtl"?{dir:"rtl",lang:s}:{lang:s}}var ly=J(()=>{An();Jo();iy();Jo();Jo()});function E0(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])=>!F1.has(u))),name:t.name??"Jx Site",url:t.url??"",...i};let a=(k(e.$lang)?e.$lang:void 0)??cr(n.urlPattern,s)??t.defaults?.lang,l=o.map((u)=>({code:u.locale,current:u.urlPattern===n.urlPattern,dir:al(u.locale),label:Kw(u.locale),url:u.urlPattern})),c={params:n._pathParams??{},title:e.title??e._pageTitle??t.name??"",url:n.urlPattern};if(l.length>0)c.alternates=l;if(n.pagination){let{first:u,itemCount:d,last:p,next:m,number:y,pageCount:S,pageSize:g,pages:x,prev:P}=n.pagination;c.pagination={first:u,itemCount:d,last:p,next:m,number:y,pageCount:S,pageSize:g,pages:x.map(({current:w,number:E,url:j})=>({current:w,number:E,url:j})),prev:P}}if(a!==void 0)c.dir=al(a),c.locale=a;if(e.state.$page=c,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 F1;var j0=J(()=>{ce();Jo();F1=new Set(["defaultLocale","locales","name","url"])});import{dirname as V1,relative as q1,resolve as H1}from"node:path";function cy(e){return(t,n)=>{if(!n.sourcePath)return t;return`./${q1(V1(n.sourcePath),H1(e,t))}`}}function P0(e,t,n,r=null,s=null,o=[]){return E0(e,t,n,r===null?null:cy(r),s,o)}var uy=J(()=>{j0()});function Fl(e){let t=Fw(e,e.title??"a class"),n=t.title;if(!n)throw Error("compileClassJson: missing title (class name)");let r=B1(t.extends),s=t.$defs,o=s?.fields??{},i=s?.constructor,a=W1(i)?i:void 0,l=s?.methods??{},c=["// Generated by @jxsuite/compiler from .class.json — do not edit manually"];if(t.$id)c.push(`// Source: ${t.$id}`);c.push("");let u=U1(t.extends);if(u!==null)c.push(u,"");let d=r!=="Object"?` extends ${r}`:"";c.push(`class ${n}${d} {`);for(let[p,m]of Object.entries(o)){if(m.scope!=="static")continue;let y=m.identifier??p,S=m.access==="private"?"#":"",g=m.initializer!==void 0?JSON.stringify(m.initializer):m.default!==void 0?JSON.stringify(m.default):"null";c.push(` static ${S}${y} = ${g};`)}for(let[p,m]of Object.entries(o)){if(m.scope==="static")continue;if(m.access!=="private")continue;let y=m.identifier??p;c.push(` #${y};`)}if(Object.keys(o).length>0)c.push("");if(c.push(" constructor(config = {}) {"),a?.superCall||r!=="Object"){let p=a?.superCall?.arguments?a.superCall.arguments.join(", "):"";c.push(` super(${p});`)}for(let[p,m]of Object.entries(o)){if(m.scope==="static")continue;let y=m.identifier??p,S=m.access==="private"?"#":"",g=m.initializer!==void 0?JSON.stringify(m.initializer):m.default!==void 0?JSON.stringify(m.default):"null";c.push(` this.${S}${y} = config.${y} !== undefined ? config.${y} : ${g};`)}if(a?.body){let p=Array.isArray(a.body)?a.body:[a.body];for(let m of p)c.push(` ${m}`)}c.push(" }");for(let[p,m]of Object.entries(l)){let y=m.identifier??p,S=m.scope==="static",x=m.access==="private"?"#":"",P=S?"static ":"",w=m.returnType?.$ref?.includes("Promise")||K1(m)?"async ":"",E=_0(m.parameters??[]),j=z1(m.body);if(c.push(""),m.role==="accessor"){if(m.getter)c.push(` ${P}get ${x}${y}() {`,` ${m.getter.body}`," }");if(m.setter){let A=_0(m.setter.parameters??[])||"v";c.push(` ${P}set ${x}${y}(${A}) {`,` ${m.setter.body}`," }")}}else{c.push(` ${P}${w}${x}${y}(${E}) {`);for(let A of j)c.push(` ${A}`);c.push(" }")}}return c.push("}","",`export { ${n} };`,`export default ${n};`,""),c.join(`
197
- `)}function W1(e){return typeof e==="object"}function B1(e){if(!e)return"Object";if(k(e))return e;if(e.$ref){let t=e.$ref.match(k0);return t?t[1]:"Object"}return"Object"}function U1(e){if(!e||k(e)||!e.$ref)return null;let t=e.$ref.match(k0);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 _0(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 z1(e){if(!e)return[""];return Array.isArray(e)?e:[e]}function K1(e){return(Array.isArray(e.body)?e.body.join(`
198
- `):e.body??"").includes("await ")}var k0;var fy=J(()=>{Ei();ce();k0=/([A-Za-z0-9_]+)\.class\.json/});import{createHash as G1}from"node:crypto";import{mkdirSync as X1,readFileSync as Y1,rmSync as Z1,writeFileSync as Q1}from"node:fs";import{createRequire as eD}from"node:module";import{tmpdir as tD}from"node:os";import{dirname as C0,join as O0,resolve as Jf}from"node:path";import{pathToFileURL as nD}from"node:url";function Mf(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=Jf(t.docDir??t.projectRoot,n);else r=eD(Jf(t.projectRoot,"package.json")).resolve(n);let s=Qb(Y1(r,"utf8"),r);return{classDef:s,classJsonPath:r,exportName:e.$export??s.title??e.$prototype}}function R0(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 rD(e){R0(e);let t=Fl(e.classDef),n=G1("sha256").update(t).digest("hex").slice(0,16),r=A0.get(n);if(r===void 0){let s=O0(tD(),`jx-class-${process.pid}`);X1(s,{recursive:!0});let o=O0(s,`${e.classDef.title}-${n}.mjs`);Q1(o,t,"utf8"),r=import(nD(o).href).then((i)=>i.default).finally(()=>{Z1(o,{force:!0})}),A0.set(n,r)}return r}async function N0(e){let{classDef:t,classJsonPath:n,exportName:r}=e;if(!t.$implementation)return rD(e);let s=await om(Jf(C0(n),t.$implementation)),o=s[r]??s.default?.[r];if(!_t(o))throw Error(`Module ${t.$implementation} does not export "${r}"`);return o}function sD(e){return"resolve"in e&&_t(e.resolve)}function oD(e){return"value"in e}async function T0(e,t){let n=new e(t);if(sD(n))return{instance:n,value:await n.resolve()};if(oD(n))return{instance:n,value:n.value};return{instance:n,value:n}}function J0(e){return JSON.stringify(e).includes('"#/$context/')}function M0(e){let{classDef:t,classJsonPath:n,exportName:r}=e;if(!t.$implementation)return R0(e),Fl(t);let s=CS(Jf(C0(n),t.$implementation)),o=JSON.stringify(r);return[`import * as m from ${JSON.stringify(s)};`,`export default m[${o}] ?? m.default?.[${o}];`,""].join(`
199
- `)}var A0;var dy=J(()=>{ce();Lt();fy();is();A0=new Map});import{dirname as I0}from"node:path";async function Vl(e,t,n,r={}){let s={},{state:o}=e;if(!o)return s;let i=[],a={docDir:t.sourcePath?I0(t.sourcePath):null,imports:e.imports,projectRoot:n,registry:r.registry};for(let[l,c]of Object.entries(o)){if(!Pn(c))continue;if(iD.has(c.$prototype))continue;let u=`"${l}" ($prototype "${c.$prototype}")`;if(c.timing&&c.timing!=="compiler"){let d=r.registry?.byName(c.$prototype);if(d?.capabilities.lower)try{let p=await d.call("lower",c,{projectConfig:r.config,root:n,route:t});if(L(p)){let m=p.$bundle;if(Array.isArray(m)){for(let y of m)if(k(y))r.registerBundle?.(y)}delete p.$bundle}o[l]=p,s[l]=p}catch(p){i.push(`${u}: its class could not lower it: ${be(p)}`)}continue}try{let d=Mf(c,a);if(d===void 0){if(c.timing==="compiler"&&zg(c))i.push(`${u} names no class: give it a $src or an imports entry, or enable the extension that provides "${c.$prototype}"`);continue}let p=await N0(d),{value:m}=await T0(p,aD(c,t,n,o,r));if(r.asInitialValues)o[l]={default:m??null};else{if(c.timing&&L(m))m.timing=c.timing;o[l]=m}s[l]=o[l]}catch(d){let p=c.timing?"":' (set "timing": "client" if it must run in the browser)';i.push(`${u}: ${be(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 aD(e,t,n,r,s){let o={...Ug(e)};if(o.src&&!o.basePath&&t.sourcePath)o.basePath=I0(t.sourcePath);return o._project={config:s.config??null,root:n,...s.sections},o._document={route:t,state:r},o}var iD;var py=J(()=>{ce();Lt();yn();dy();iD=new Set(["Function","LocalStorage","SessionStorage","Array"])});import{readFileSync as my,readdirSync as lD,statSync as cD}from"node:fs";import{extname as L0,join as uD,relative as fD,resolve as dD}from"node:path";async function hs(e,t){let n=my(e,"utf8");if(Vn(e))return Ar(kn(n,e),e);let r=L0(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 Ar(await s.parseDocument(n),e)}async function F0(e,t){let n=new Map,r=new Map;for(let s of e){if(!r.has(s.sourcePath))r.set(s.sourcePath,await mD(s.sourcePath,t));let o=r.get(s.sourcePath);if(o!==null&&o!==void 0)n.set(s.urlPattern,pD(o,s._pathParams))}return n}function pD(e,t){if(!e.includes("${"))return e;return e.replaceAll(/\$\{(\w+)\}/g,(n,r)=>t?.[r]??n)}async function mD(e,t){if(!my(e,"utf8").includes("$translationKey"))return null;let n;try{n=await hs(e,t)}catch{return null}return k(n.$translationKey)&&n.$translationKey!==""?n.$translationKey:null}async function V0(e,t){let n=[],r=new Set([".json",".jxn",...t?.documentExtensions("page")??[]]);return await q0(e,e,n,r,t),n.sort(qw),n}async function q0(e,t,n,r,s){let o=lD(e,{withFileTypes:!0});for(let i of o){let a=uD(e,i.name);if(i.isDirectory()){if(i.name.startsWith("_"))continue;await q0(a,t,n,r,s);continue}let l=L0(i.name).toLowerCase();if(!r.has(l))continue;if(i.name.startsWith("_"))continue;let c=fD(t,a);n.push(await hD(c,a,s))}}async function hD(e,t,n){let{isCatchAll:r,isDynamic:s,params:o,urlPattern:i}=Vw(e),a=null;try{let c=(await hs(t,n)).$layout;if(k(c))a=c}catch{}return{$layout:a,isCatchAll:r,isDynamic:s,params:o,relativePath:e,sourcePath:t,urlPattern:i}}function gD(e){let t=e[If];if(!L(t))return null;let{mtime:n}=t;return k(n)&&n!==""?n:null}function H0(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 W0(e,t,n={},r,s,o,i={}){let a=[],l=(u,d)=>{let p=`Dynamic route ${u.urlPattern}: ${d}`;if(i.errors===void 0)throw Error(p);i.errors.push(p)},c=e.flatMap((u)=>u.isDynamic?[u.urlPattern]:[]);for(let u of e){if(!u.isDynamic){a.push(u);continue}let d;try{d=await hs(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=Ww(d.$paths)}catch(y){l(u,be(y));continue}if(p!==null){let y=cr(u.urlPattern,o??null),S=p.each===void 0?[{}]:await D0(p.each,t,n,r,s,y,u,c);for(let g of S){let x=await yD(u,d,p,g,{locale:y,projectConfig:s,projectRoot:t,registry:r,report:l,sections:n});a.push(...x)}continue}let m=await D0(d.$paths,t,n,r,s,cr(u.urlPattern,o??null),u,c);for(let y of m){let S=u.urlPattern,g={};for(let[E,j]of Object.entries(y)){if(E===If)continue;g[E]=String(j),S=S.replace(`:${E}`,g[E]),S=S.replace("*",g[E])}let x=H0(S);if(x!==null){console.warn(`Warning: $paths for ${u.urlPattern} produced "${S}", which ${x}; skipping it`);continue}let P=gD(y),w={...u,_pathParams:g,isCatchAll:!1,isDynamic:!1,params:[],urlPattern:S};if(P!==null)w.sourceMtime=P;a.push(w)}}return a}function B0(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 yD(e,t,n,r,s){let o={};for(let[y,S]of Object.entries(r))if(y!==If)o[y]=String(S);let i=e.params.filter((y)=>!(y 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 l=B0(e.urlPattern,o),c=H0(l);if(c!==null)return console.warn(`Warning: $paths for ${e.urlPattern} produced "${l}", which ${c}; skipping it`),[];let u;try{u=await bD(t,n.key,e,o,s)}catch(y){return s.report(e,be(y)),[]}if(!Array.isArray(u))return s.report(e,`state entry "${n.key}" did not resolve to an array at build time`),[];let d=xD(u,e.sourcePath),p=Jm(u.length,n.pageSize),m=[];for(let y=1;y<=p;y++){let S={...e,_pathParams:{...o,[a]:String(y)},isCatchAll:!1,isDynamic:!1,pagedState:{items:Bw(u,y,n.pageSize),key:n.key},pagination:Uw(l,y,n.pageSize,u.length),params:[],urlPattern:To(l,y)};if(d!==null)S.sourceMtime=d;m.push(S)}return m}function xD(e,t){let n=null,r=cD(t).mtime.getTime();for(let s of e){let o=L(s)?s[If]: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 bD(e,t,n,r,s){let o=e.state?.[t];if(o===void 0||Array.isArray(o))return o;let i={},a=cy(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 l={imports:i,state:{[t]:structuredClone(o)}},c={_pathParams:r,locale:s.locale,sourcePath:n.sourcePath,urlPattern:B0(n.urlPattern,r)};return await Vl(l,c,s.projectRoot,{...s.projectConfig&&{config:s.projectConfig},...s.registry&&{registry:s.registry},sections:s.sections}),l.state?.[t]}async function D0(e,t,n,r,s,o,i,a){if(Array.isArray(e))return e;if("values"in e&&Array.isArray(e.values)){let l=k(e.param)?e.param:"value";return e.values.map((c)=>({[l]:c}))}if("$ref"in e&&k(e.$ref)&&e.$ref){let l=e.$ref,c=dD(t,l),u;try{u=JSON.parse(my(c,"utf8"))}catch(m){return console.warn(`Warning: $paths.$ref could not load "${l}": ${be(m)}`),[]}if(!Array.isArray(u))return console.warn(`Warning: $paths.$ref "${l}" 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 "${l}" contains a null entry`);return{[d]:(L(m)?m[p]??m.id:void 0)??String(m)}})}for(let l of Object.keys(e)){let c=r?.byPathsDiscriminator(l);if(!c?.project)continue;let u={data:n[c.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 c.call("resolvePaths",e,u)}return console.warn("Warning: unrecognized $paths shape — skipping"),[]}var If="_meta";var hy=J(()=>{Ei();ce();os();Lt();Hw();zw();ly();uy();py()});import{createHash as $D}from"node:crypto";function U0(){return{fontOrigins:new Set,frameOrigins:new Set,imgOrigins:new Set,scriptHashes:new Set,scriptOrigins:new Set,styleOrigins:new Set}}function Ho(e,t){let n=new RegExp(`\\b${t}\\s*=\\s*("([^"]*)"|'([^']*)')`,"i").exec(e);return n?.[2]??n?.[3]}function gy(e){if(e===void 0||!/^https?:\/\//i.test(e))return null;try{return new URL(e).origin}catch{return null}}function kD(e){return`'sha256-${$D("sha256").update(e,"utf8").digest("base64")}'`}function z0(e,t){for(let n of e.matchAll(wD)){let r=n[1]??"",s=Ho(r,"src"),o=(Ho(r,"type")??"").trim().toLowerCase();if(s!==void 0){let i=gy(s);if(i)t.scriptOrigins.add(i);continue}if(SD.has(o))t.scriptHashes.add(kD(n[2]??""))}for(let n of e.matchAll(vD)){let r=n[1]??"",s=(Ho(r,"rel")??"").toLowerCase(),o=Ho(r,"href"),i=gy(o);if(!i)continue;if(s.includes("stylesheet"))t.styleOrigins.add(i);if(_D.test(o??"")||(Ho(r,"as")??"")==="font")t.fontOrigins.add(i)}for(let[n,r]of[[ED,t.imgOrigins],[jD,t.imgOrigins],[PD,t.frameOrigins]])for(let s of e.matchAll(n)){let o=s[1]??"";for(let i of[Ho(o,"src"),...OD(Ho(o,"srcset"))]){let a=gy(i);if(a)r.add(a)}}}function OD(e){return e===void 0?[]:e.split(",").map((t)=>t.trim().split(/\s+/)[0]??"").filter(Boolean)}function AD(e){if(e===!1)return!1;return e==="DENY"?"'none'":"'self'"}function K0(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 G0(e,t,n="SAMEORIGIN"){let r=(a,l)=>[...a,...l].join(" "),s={"base-uri":"'self'","default-src":"'self'","font-src":r(["'self'"],e.fontOrigins),"form-action":"'self'","frame-ancestors":AD(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,l]of Object.entries(t.directives??{}))s[a]=l;let o=Object.entries(s).filter(([,a])=>a!==!1&&a!=="").toSorted(([a],[l])=>a<l?-1:1).map(([a,l])=>`${a} ${String(l)}`).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 SD,wD,vD,ED,jD,PD,_D;var yy=J(()=>{SD=new Set(["","module","importmap","text/javascript","module-shim","speculationrules"]),wD=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,vD=/<link\b([^>]*)>/gi,ED=/<img\b([^>]*)>/gi,jD=/<source\b([^>]*)>/gi,PD=/<iframe\b([^>]*)>/gi,_D=/\.(woff2?|ttf|otf|eot)(\?|#|$)/i});import{existsSync as Df,readFileSync as CD,writeFileSync as Y0}from"node:fs";import{join as Lf}from"node:path";function Z0(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??X0,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=K0(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,G0(t,a,s.frameOptions));let l=n.cache??"auto";if(l==="auto")o["Cache-Control"]="public, max-age=0, must-revalidate";let c=[];if(Object.keys(o).length>0)c.push({headers:o,pattern:"/*"});if(l==="auto")c.push({headers:{"Cache-Control":`public, max-age=${X0}, immutable`},pattern:RD});for(let[u,d]of Object.entries(n.rules??{}))c.push({headers:d,pattern:u});return{errors:r,rules:c}}function Q0(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(Df(Lf(e,r)))n.push({headers:{"Content-Type":s},pattern:`/${r}`});if(Df(Lf(e,"feed","archive")))n.push({headers:{"Content-Type":"application/atom+xml; charset=utf-8"},pattern:"/feed/archive/*"});return n}function eE(e,t){if(t==="")return[...e];return e.map((n)=>({headers:n.headers,pattern:Fe(t,n.pattern)}))}function JD(e){let t=e.map((n)=>{let r=Object.entries(n.headers).map(([s,o])=>` ${s}: ${o}`);return[n.pattern,...r].join(`
200
- `)});return`${[ND,"",...t].join(`
265
+ `:""}var o1,m0,Is="https://esm.sh/@vue/reactivity@3.5.40",Tr="https://esm.sh/lit-html@3.3.0",_l,a1,c1,u1,f1,d1,x0,h1,g1,hs,y1,Wo="__jxAttrText",Gi="__jxListItems",w0="__jxRowKeys",Ml="__jxLiteral",Il="__jxKeyed",kf,iy="__jxSupplies",ay="__jxNativeSetter",Of="__jxAbsorbAttr",k0="__jxServerCall",x1,b1,_0="__jxInstantiate",uy="__jxAssociateForm",fy="__jxCaptureSlotted",dy="__jxDistributeSlots",Yi="<!---->",C0,py;var $n=M(()=>{Pi();qi();Xg();Mi();nf();ol();o0();ae();Hi();Pl();Ti();qi();Mi();nf();ae();Mi();o1=["$map/","event#/","$args/","$reduce/"];m0=Symbol("jx.runtimeOnlyStateKeys");_l=String.raw`(?:\s|\\[nrt])*`,a1=new RegExp(String.raw`(?:=|\.\.\.)${_l}state[ \t]*(?:[;,)}\]"]|\\[nr])`);c1=/\bstate\.([A-Za-z_$][\w$]*)\s*(?:\+\+|--|(?:\*\*|\|\||&&|\?\?|<<|>>>|>>|[-+*/%&|^])?=(?!=))/g,u1=/\bstate\.([A-Za-z_$][\w$]*)\s*\.\s*(?:push|pop|shift|unshift|splice|sort|reverse|fill|copyWithin)\s*\(/g,f1=/[\w$.]/u,d1=/[\w$]/u;x0=["hidden","tabIndex","title","lang","dir"],h1=new Set([...x0,"id","className"]),g1=new Set([...gr,...h1,"textContent","innerHTML"]);hs=new Set(["pre","textarea","listing","plaintext","xmp"]);y1=[];kf=["import { AsyncDirective, directive } from 'lit-html/async-directive.js';","import { repeat } from 'lit-html/directives/repeat.js';"];x1=new Set(["$prototype","$src","$export","timing","default","description"]);b1=new Set(uh);C0=Symbol("jx.styleHandle");py=new Set(["input","br","hr","img","meta","link","area","col","source"])});import{relative as S1,sep as w1}from"node:path";function Hl(e){return e===v1}function ea(e,t){if(e==="/")return"/";if(t==="always")return e.endsWith("/")?e:`${e}/`;if(t==="never")return e.replace(/\/+$/,"")||"/";return e}function Ff(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 W0(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(Ff(r,"name")?.trim().toLowerCase()!=="robots")continue;let s=new Set((Ff(r,"content")??"").toLowerCase().split(",").map((o)=>o.trim()));if(s.has("noindex")||s.has("none"))return!0}return!1}function B0(e){let t=e.search(/<\/head\s*>/i);return{end:t,head:t===-1?e:e.slice(0,t)}}function E1(e,t){let n=t.trim().toLowerCase();for(let[r]of B0(e).head.matchAll(/<link\b[^>]*>/gi)){let s=(Ff(r,"rel")??"").toLowerCase().split(/\s+/),o=(Ff(r,"type")??"").split(";")[0]?.trim().toLowerCase();if(s.includes("alternate")&&o===n)return!0}return!1}function U0(e,t){let{end:n}=B0(e);if(n===-1||E1(e,t.type))return e;let r=`<link href="${Me(t.href)}" rel="alternate" type="${Me(t.type)}">`;return`${e.slice(0,n)}${r}
266
+ ${e.slice(n)}`}function z0(e,t){return new URL(`/${S1(e,t).split(w1).join("/")}`,"http://localhost").pathname}var v1="/404";var wy=M(()=>{$n()});function K0(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=zn(s);if(o===null||!t.locales.includes(o))n.push(r.urlPattern)}return n}function G0(e,t){if(t===null)return null;let n=e.split("/").find(Boolean),r=zn(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 j1(e,t){let n=e.split("/").filter(Boolean),r=zn(n[0]);if(t!==null&&r!==null&&t.locales.includes(r))return n.slice(1).join("/");return n.join("/")}function vy(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?j1(i.urlPattern,t):i.translationKey.replaceAll(/^\/+|\/+$/g,"");if(i.translationKey!==void 0)o.add(i.urlPattern);let l=fr(i.urlPattern,t);if(l===null)continue;let c=s.get(a)??[],u=c.find((d)=>d.locale===l);if(u===void 0)c.push({locale:l,urlPattern:i.urlPattern});else r.push({declared:o.has(u.urlPattern)||i.translationKey!==void 0,key:a,locale:l,urlPatterns:[u.urlPattern,i.urlPattern]});s.set(a,c)}for(let i of s.values()){let a=i.toSorted((l,c)=>l.locale===c.locale?0:l.locale<c.locale?-1:1);for(let l of i)n.set(l.urlPattern,a)}return{conflicts:r,sets:n}}function X0(e,t,n,r){let s=new Map;if(t===null||n==="")return s;let o=new Map;for(let[i,a]of vy(e,t).sets){if(a.length<2)continue;let l=o.get(a);if(l===void 0){l=a.map((u)=>({href:Ns(ea(u.urlPattern,r),n),hreflang:u.locale}));let c=a.find((u)=>u.locale===t.defaultLocale);if(c!==void 0)l.push({href:Ns(ea(c.urlPattern,r),n),hreflang:"x-default"});o.set(a,l)}s.set(i,l)}return s}function Y0({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 tl(s)==="rtl"?{dir:"rtl",lang:s}:{lang:s}}var Ey=M(()=>{hn();_o();wy();_o();_o()});function Z0(e,t){if(!_(t)||t.trim()==="")return[...e];return[{attributes:{content:t,name:"description"},tagName:"meta"},...e]}function Q0(e=[],t=[],n=[],r={}){let s=[{attributes:{charset:r.charset??Ts},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 l=jy(a);o.set(l,a)}let i=r.title??r.siteName??"Jx Site";if(o.set("title",{children:[i],tagName:"title"}),r.pageUrl&&r.siteUrl){let a=Ns(r.pageUrl,r.siteUrl);if(![...o.values()].some((c)=>F(c)&&c.tagName==="link"&&c.attributes?.rel==="canonical")){let c={attributes:{href:a,rel:"canonical"},tagName:"link"};o.set(jy(c),c)}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 l={attributes:{href:a.href,hreflang:a.hreflang,rel:"alternate"},tagName:"link"},c=jy(l);if(!o.has(c))o.set(c,l)}return[...o.values()]}function jy(e){if(!F(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=F(r)?JSON.stringify(r):r??"";return`style:${P1(s)}`}return`${t}:${JSON.stringify(e)}`}function P1(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 eE(e){return e.map((t)=>_1(t)).join(`
267
+ `)}function tE(e){let t=new Set;for(let n of e){if(!L(n))continue;let r=n.tagName;if(r==="title"){t.add(`$head: a <title> entry is discarded. The page title is the document's "title" property (site-architecture.md §8.1).`);continue}for(let s of Object.keys(n))if(!k1.has(s)&&!s.startsWith("$"))t.add(`$head: <${String(r)}> has a top-level "${s}", which is not rendered. A head element's HTML attributes go under "attributes" (site-architecture.md §8.1).`)}return[...t]}function _1(e){if(_(e))return e;if(!F(e))return"";let t=e.tagName,n=e.attributes??{},r=Object.entries(n).map(([l,c])=>c===!0?l:`${l}="${O1(c)}"`).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=F(i)?JSON.stringify(i,null,2):i??"";return`${s}${a}</${t}>`}function O1(e){return String(e).replaceAll("&","&amp;").replaceAll('"',"&quot;").replaceAll("<","&lt;")}var k1;var Py=M(()=>{hn();ol();ae();k1=new Set(["tagName","attributes","textContent","children"])});async function A1(e,t){let n=[],r=[],s=e;while(_(s)&&s!==""){if(n.includes(s))throw new sE([...n,s]);n.push(s);let o=await t(s);r.unshift({doc:o,ref:s}),s=F(o)?o.$layout:void 0}return r}function Vf(e){let t={};if(_(e.title))t.title=e.title;let n=Z0(Array.isArray(e.$head)?e.$head:[],e.description);if(n.length>0)t.head=n;if(_(e.$lang))t.lang=e.$lang;return t}async function oE(e,t,n){let r=e.$layout??t.defaults?.layout??null;if(!r)return e;let[s,...o]=await A1(r,n),i=rE(s.doc);for(let a of o){let l=rE(a.doc);if(nE(i,l),l.$head)i.$head=[...i.$head??[],...l.$head]}return nE(i,e),delete i.$layout,i}function nE(e,t){let n=t.children??[],r=_(n)?[n]:Array.isArray(n)?n:[];if(C1(e,r),t.state)e.state={...e.state,...t.state};if(t.$media)e.$media={...e.$media,...t.$media};if(t.style)e.style={...e.style,...t.style};if(t.attributes)e.attributes={...e.attributes,...t.attributes}}function C1(e,t){let n=new Map,r=[];for(let s of t){let o=F(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)}iE(e,n,r)}function iE(e,t,n){if(!F(e))return;if(!Array.isArray(e.children))return;let r=[];for(let s of e.children)if(F(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 iE(s,t,n),r.push(s);e.children=r}function rE(e){return structuredClone(e)}var sE;var qf=M(()=>{ae();Py();sE=class sE extends Error{name;constructor(e){super(`Layout cycle: ${e.join(" → ")}`);this.name="LayoutCycleError"}}});function ky(e){let t;for(let n of e)if(F(n)&&n.tagName==="meta"&&n.attributes?.name==="description"&&_(n.attributes.content))t=n.attributes.content;return t}function aE(e,t,n,r=null,s=null,o=[],i=Vf(e)){if(!e.state)e.state={};let a={};if(s!==null)a.defaultLocale=s.defaultLocale,a.locales=s.locales;let l=t.name??"Jx Site";e.state.$site={...Object.fromEntries(Object.entries(t.state??{}).filter(([m])=>!R1.has(m))),name:l,url:t.url??"",...a};let c=i.lang??fr(n.urlPattern,s)??t.defaults?.lang,u=o.map((m)=>({code:m.locale,current:m.urlPattern===n.urlPattern,dir:tl(m.locale),label:sw(m.locale),url:m.urlPattern})),d={params:n._pathParams??{},title:i.title??l,url:n.urlPattern},p=ky(i.head??[]);if(p!==void 0)d.description=p;if(u.length>0)d.alternates=u;if(n.pagination){let{first:m,itemCount:g,last:b,next:h,number:x,pageCount:k,pageSize:w,pages:v,prev:E}=n.pagination;d.pagination={first:m,itemCount:g,last:b,next:h,number:x,pageCount:k,pageSize:w,pages:v.map(({current:O,number:I,url:D})=>({current:O,number:I,url:D})),prev:E}}if(c!==void 0)d.dir=tl(c),d.locale=c;if(e.state.$page=d,t.state){for(let[m,g]of Object.entries(t.state))if(m!=="$site"&&m!=="$page"&&!(m in e.state))e.state[m]=g}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[m,g]of Object.entries(t.imports))if(!(m in e.imports))e.imports[m]=r&&(g.startsWith("./")||g.startsWith("../"))?r(g,n):g}if(t.$elements?.length)if(!e.$elements?.length)e.$elements=[...t.$elements];else{let m=new Set,g=[];for(let b of[...t.$elements,...e.$elements]){let h=_(b)?b:F(b)?b.$ref:void 0;if(h&&!m.has(h))m.add(h),g.push(b)}e.$elements=g}return e}var R1;var _y=M(()=>{ae();_o();qf();R1=new Set(["defaultLocale","locales","name","url"])});import{dirname as T1,relative as N1,resolve as J1}from"node:path";function Oy(e){return(t,n)=>{if(!n.sourcePath)return t;return`./${N1(T1(n.sourcePath),J1(e,t))}`}}function lE(e,t,n,r=null,s=null,o=[],i){return aE(e,t,n,r===null?null:Oy(r),s,o,i)}var Ay=M(()=>{_y()});function Wl(e){let t=yv(e,e.title??"a class"),n=t.title;if(!n)throw Error("compileClassJson: missing title (class name)");let r=I1(t.extends),s=t.$defs,o=s?.fields??{},i=s?.constructor,a=M1(i)?i:void 0,l=s?.methods??{},c=["// Generated by @jxsuite/compiler from .class.json — do not edit manually"];if(t.$id)c.push(`// Source: ${t.$id}`);c.push("");let u=D1(t.extends);if(u!==null)c.push(u,"");let d=r!=="Object"?` extends ${r}`:"";c.push(`class ${n}${d} {`);for(let[p,m]of Object.entries(o)){if(m.scope!=="static")continue;let g=m.identifier??p,b=m.access==="private"?"#":"",h=m.initializer!==void 0?JSON.stringify(m.initializer):m.default!==void 0?JSON.stringify(m.default):"null";c.push(` static ${b}${g} = ${h};`)}for(let[p,m]of Object.entries(o)){if(m.scope==="static")continue;if(m.access!=="private")continue;let g=m.identifier??p;c.push(` #${g};`)}if(Object.keys(o).length>0)c.push("");if(c.push(" constructor(config = {}) {"),a?.superCall||r!=="Object"){let p=a?.superCall?.arguments?a.superCall.arguments.join(", "):"";c.push(` super(${p});`)}for(let[p,m]of Object.entries(o)){if(m.scope==="static")continue;let g=m.identifier??p,b=m.access==="private"?"#":"",h=m.initializer!==void 0?JSON.stringify(m.initializer):m.default!==void 0?JSON.stringify(m.default):"null";c.push(` this.${b}${g} = config.${g} !== undefined ? config.${g} : ${h};`)}if(a?.body){let p=Array.isArray(a.body)?a.body:[a.body];for(let m of p)c.push(` ${m}`)}c.push(" }");for(let[p,m]of Object.entries(l)){let g=m.identifier??p,b=m.scope==="static",x=m.access==="private"?"#":"",k=b?"static ":"",w=m.returnType?.$ref?.includes("Promise")||F1(m)?"async ":"",v=cE(m.parameters??[]),E=L1(m.body);if(c.push(""),m.role==="accessor"){if(m.getter)c.push(` ${k}get ${x}${g}() {`,` ${m.getter.body}`," }");if(m.setter){let O=cE(m.setter.parameters??[])||"v";c.push(` ${k}set ${x}${g}(${O}) {`,` ${m.setter.body}`," }")}}else{c.push(` ${k}${w}${x}${g}(${v}) {`);for(let O of E)c.push(` ${O}`);c.push(" }")}}return c.push("}","",`export { ${n} };`,`export default ${n};`,""),c.join(`
268
+ `)}function M1(e){return typeof e==="object"}function I1(e){if(!e)return"Object";if(_(e))return e;if(e.$ref){let t=e.$ref.match(uE);return t?t[1]:"Object"}return"Object"}function D1(e){if(!e||_(e)||!e.$ref)return null;let t=e.$ref.match(uE);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 cE(e){return e.map((t)=>{if(t.$ref)return t.$ref.split("/").pop();let n=t.identifier??t.name;return _(n)?n:"arg"}).join(", ")}function L1(e){if(!e)return[""];return Array.isArray(e)?e:[e]}function F1(e){return(Array.isArray(e.body)?e.body.join(`
269
+ `):e.body??"").includes("await ")}var uE;var Cy=M(()=>{Ai();ae();uE=/([A-Za-z0-9_]+)\.class\.json/});import{createHash as V1}from"node:crypto";import{mkdirSync as q1,readFileSync as H1,rmSync as W1,writeFileSync as B1}from"node:fs";import{createRequire as U1}from"node:module";import{tmpdir as z1}from"node:os";import{dirname as pE,join as fE,resolve as Hf}from"node:path";import{pathToFileURL as K1}from"node:url";function Wf(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=Hf(t.docDir??t.projectRoot,n);else r=U1(Hf(t.projectRoot,"package.json")).resolve(n);let s=S$(H1(r,"utf8"),r);return{classDef:s,classJsonPath:r,exportName:e.$export??s.title??e.$prototype}}function mE(e){let t=e.classDef.extends;if(t!==void 0&&!_(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 G1(e){mE(e);let t=Wl(e.classDef),n=V1("sha256").update(t).digest("hex").slice(0,16),r=dE.get(n);if(r===void 0){let s=fE(z1(),`jx-class-${process.pid}`);q1(s,{recursive:!0});let o=fE(s,`${e.classDef.title}-${n}.mjs`);B1(o,t,"utf8"),r=import(K1(o).href).then((i)=>i.default).finally(()=>{W1(o,{force:!0})}),dE.set(n,r)}return r}async function hE(e){let{classDef:t,classJsonPath:n,exportName:r}=e;if(!t.$implementation)return G1(e);let s=await ym(Hf(pE(n),t.$implementation)),o=s[r]??s.default?.[r];if(!Ot(o))throw Error(`Module ${t.$implementation} does not export "${r}"`);return o}function X1(e){return"resolve"in e&&Ot(e.resolve)}function Y1(e){return"value"in e}async function gE(e,t){let n=new e(t);if(X1(n))return{instance:n,value:await n.resolve()};if(Y1(n))return{instance:n,value:n.value};return{instance:n,value:n}}function yE(e){return JSON.stringify(e).includes('"#/$context/')}function xE(e){let{classDef:t,classJsonPath:n,exportName:r}=e;if(!t.$implementation)return mE(e),Wl(t);let s=QS(Hf(pE(n),t.$implementation)),o=JSON.stringify(r);return[`import * as m from ${JSON.stringify(s)};`,`export default m[${o}] ?? m.default?.[${o}];`,""].join(`
270
+ `)}var dE;var Ry=M(()=>{ae();Ft();Cy();is();dE=new Map});import{dirname as bE}from"node:path";async function Bl(e,t,n,r={}){let s={},{state:o}=e;if(!o)return s;let i=[],a={docDir:t.sourcePath?bE(t.sourcePath):null,imports:e.imports,projectRoot:n,registry:r.registry};for(let[l,c]of Object.entries(o)){if(!An(c))continue;if(Z1.has(c.$prototype))continue;let u=`"${l}" ($prototype "${c.$prototype}")`;if(c.timing&&c.timing!=="compiler"){let d=r.registry?.byName(c.$prototype);if(d?.capabilities.lower)try{let p=await d.call("lower",c,{projectConfig:r.config,root:n,route:t});if(L(p)){let m=p.$bundle;if(Array.isArray(m)){for(let g of m)if(_(g))r.registerBundle?.(g)}delete p.$bundle}o[l]=p,s[l]=p}catch(p){i.push(`${u}: its class could not lower it: ${ye(p)}`)}continue}try{let d=Wf(c,a);if(d===void 0){if(c.timing==="compiler"&&cy(c))i.push(`${u} names no class: give it a $src or an imports entry, or enable the extension that provides "${c.$prototype}"`);continue}let p=await hE(d),{value:m}=await gE(p,Q1(c,t,n,o,r));if(r.asInitialValues)o[l]={default:m??null};else{if(c.timing&&L(m))m.timing=c.timing;o[l]=m}s[l]=o[l]}catch(d){let p=c.timing?"":' (set "timing": "client" if it must run in the browser)';i.push(`${u}: ${ye(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 Q1(e,t,n,r,s){let o={...ly(e)};if(o.src&&!o.basePath&&t.sourcePath)o.basePath=bE(t.sourcePath);return o._project={config:s.config??null,root:n,...s.sections},o._document={route:t,state:r},o}var Z1;var Ty=M(()=>{ae();Ft();$n();Ry();Z1=new Set(["Function","LocalStorage","SessionStorage","Array"])});import{readFileSync as Ny,readdirSync as eL,statSync as tL}from"node:fs";import{extname as SE,join as nL,relative as rL,resolve as sL}from"node:path";async function gs(e,t){let n=Ny(e,"utf8");if(Bn(e))return Cr(Rn(n,e),e);let r=SE(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 Cr(await s.parseDocument(n),e)}async function wE(e,t){let n=new Map,r=new Map;for(let s of e){if(!r.has(s.sourcePath))r.set(s.sourcePath,await iL(s.sourcePath,t));let o=r.get(s.sourcePath);if(o!==null&&o!==void 0)n.set(s.urlPattern,oL(o,s._pathParams))}return n}function oL(e,t){if(!e.includes("${"))return e;return e.replaceAll(/\$\{(\w+)\}/g,(n,r)=>t?.[r]??n)}async function iL(e,t){if(!Ny(e,"utf8").includes("$translationKey"))return null;let n;try{n=await gs(e,t)}catch{return null}return _(n.$translationKey)&&n.$translationKey!==""?n.$translationKey:null}async function vE(e,t){let n=[],r=new Set([".json",".jxn",...t?.documentExtensions("page")??[]]);return await EE(e,e,n,r,t),n.sort(bv),n}async function EE(e,t,n,r,s){let o=eL(e,{withFileTypes:!0});for(let i of o){let a=nL(e,i.name);if(i.isDirectory()){if(i.name.startsWith("_"))continue;await EE(a,t,n,r,s);continue}let l=SE(i.name).toLowerCase();if(!r.has(l))continue;if(i.name.startsWith("_"))continue;let c=rL(t,a);n.push(await aL(c,a,s))}}async function aL(e,t,n){let{isCatchAll:r,isDynamic:s,params:o,urlPattern:i}=xv(e),a=null;try{let c=(await gs(t,n)).$layout;if(_(c))a=c}catch{}return{$layout:a,isCatchAll:r,isDynamic:s,params:o,relativePath:e,sourcePath:t,urlPattern:i}}function lL(e){let t=e[Bf];if(!L(t))return null;let{mtime:n}=t;return _(n)&&n!==""?n:null}function jE(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 PE(e,t,n={},r,s,o,i={}){let a=[],l=(u,d)=>{let p=`Dynamic route ${u.urlPattern}: ${d}`;if(i.errors===void 0)throw Error(p);i.errors.push(p)},c=e.flatMap((u)=>u.isDynamic?[u.urlPattern]:[]);for(let u of e){if(!u.isDynamic){a.push(u);continue}let d;try{d=await gs(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=Sv(d.$paths)}catch(g){l(u,ye(g));continue}if(p!==null){let g=fr(u.urlPattern,o??null),b=p.each===void 0?[{}]:await $E(p.each,t,n,r,s,g,u,c);for(let h of b){let x=await cL(u,d,p,h,{locale:g,projectConfig:s,projectRoot:t,registry:r,report:l,sections:n});a.push(...x)}continue}let m=await $E(d.$paths,t,n,r,s,fr(u.urlPattern,o??null),u,c);for(let g of m){let b=u.urlPattern,h={};for(let[v,E]of Object.entries(g)){if(v===Bf)continue;h[v]=String(E),b=b.replace(`:${v}`,h[v]),b=b.replace("*",h[v])}let x=jE(b);if(x!==null){console.warn(`Warning: $paths for ${u.urlPattern} produced "${b}", which ${x}; skipping it`);continue}let k=lL(g),w={...u,_pathParams:h,isCatchAll:!1,isDynamic:!1,params:[],urlPattern:b};if(k!==null)w.sourceMtime=k;a.push(w)}}return a}function kE(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 cL(e,t,n,r,s){let o={};for(let[g,b]of Object.entries(r))if(g!==Bf)o[g]=String(b);let i=e.params.filter((g)=>!(g 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 l=kE(e.urlPattern,o),c=jE(l);if(c!==null)return console.warn(`Warning: $paths for ${e.urlPattern} produced "${l}", which ${c}; skipping it`),[];let u;try{u=await fL(t,n.key,e,o,s)}catch(g){return s.report(e,ye(g)),[]}if(!Array.isArray(u))return s.report(e,`state entry "${n.key}" did not resolve to an array at build time`),[];let d=uL(u,e.sourcePath),p=jg(u.length,n.pageSize),m=[];for(let g=1;g<=p;g++){let b={...e,_pathParams:{...o,[a]:String(g)},isCatchAll:!1,isDynamic:!1,pagedState:{items:wv(u,g,n.pageSize),key:n.key},pagination:vv(l,g,n.pageSize,u.length),params:[],urlPattern:Lo(l,g)};if(d!==null)b.sourceMtime=d;m.push(b)}return m}function uL(e,t){let n=null,r=tL(t).mtime.getTime();for(let s of e){let o=L(s)?s[Bf]:void 0,i=L(o)?o.mtime:void 0;if(_(i)&&Date.parse(i)>r)r=Date.parse(i),n=i}return n}async function fL(e,t,n,r,s){let o=e.state?.[t];if(o===void 0||Array.isArray(o))return o;let i={},a=Oy(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 l={imports:i,state:{[t]:structuredClone(o)}},c={_pathParams:r,locale:s.locale,sourcePath:n.sourcePath,urlPattern:kE(n.urlPattern,r)};return await Bl(l,c,s.projectRoot,{...s.projectConfig&&{config:s.projectConfig},...s.registry&&{registry:s.registry},sections:s.sections}),l.state?.[t]}async function $E(e,t,n,r,s,o,i,a){if(Array.isArray(e))return e;if("values"in e&&Array.isArray(e.values)){let l=_(e.param)?e.param:"value";return e.values.map((c)=>({[l]:c}))}if("$ref"in e&&_(e.$ref)&&e.$ref){let l=e.$ref,c=sL(t,l),u;try{u=JSON.parse(Ny(c,"utf8"))}catch(m){return console.warn(`Warning: $paths.$ref could not load "${l}": ${ye(m)}`),[]}if(!Array.isArray(u))return console.warn(`Warning: $paths.$ref "${l}" must be a JSON array`),[];let d=_(e.param)?e.param:"id",p=_(e.field)?e.field:"id";return u.map((m)=>{if(m===null)throw TypeError(`$paths.$ref "${l}" contains a null entry`);return{[d]:(L(m)?m[p]??m.id:void 0)??String(m)}})}for(let l of Object.keys(e)){let c=r?.byPathsDiscriminator(l);if(!c?.project)continue;let u={data:n[c.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 c.call("resolvePaths",e,u)}return console.warn("Warning: unrecognized $paths shape — skipping"),[]}var Bf="_meta";var Jy=M(()=>{Ai();ae();os();Ft();$v();Ev();Ey();Ay();Ty()});import{createHash as dL}from"node:crypto";function _E(){return{fontOrigins:new Set,frameOrigins:new Set,imgOrigins:new Set,scriptHashes:new Set,scriptOrigins:new Set,styleOrigins:new Set}}function Uo(e,t){let n=new RegExp(`\\b${t}\\s*=\\s*("([^"]*)"|'([^']*)')`,"i").exec(e);return n?.[2]??n?.[3]}function My(e){if(e===void 0||!/^https?:\/\//i.test(e))return null;try{return new URL(e).origin}catch{return null}}function $L(e){return`'sha256-${dL("sha256").update(e,"utf8").digest("base64")}'`}function OE(e,t){for(let n of e.matchAll(mL)){let r=n[1]??"",s=Uo(r,"src"),o=(Uo(r,"type")??"").trim().toLowerCase();if(s!==void 0){let i=My(s);if(i)t.scriptOrigins.add(i);continue}if(pL.has(o))t.scriptHashes.add($L(n[2]??""))}for(let n of e.matchAll(hL)){let r=n[1]??"",s=(Uo(r,"rel")??"").toLowerCase(),o=Uo(r,"href"),i=My(o);if(!i)continue;if(s.includes("stylesheet"))t.styleOrigins.add(i);if(bL.test(o??"")||(Uo(r,"as")??"")==="font")t.fontOrigins.add(i)}for(let[n,r]of[[gL,t.imgOrigins],[yL,t.imgOrigins],[xL,t.frameOrigins]])for(let s of e.matchAll(n)){let o=s[1]??"";for(let i of[Uo(o,"src"),...SL(Uo(o,"srcset"))]){let a=My(i);if(a)r.add(a)}}}function SL(e){return e===void 0?[]:e.split(",").map((t)=>t.trim().split(/\s+/)[0]??"").filter(Boolean)}function wL(e){if(e===!1)return!1;return e==="DENY"?"'none'":"'self'"}function AE(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 CE(e){return(Array.isArray(e)?e:[e]).flatMap((t)=>t.split(/\s+/)).filter(Boolean)}function RE(e){let t=[],n=new Set(Object.keys(e.directives??{}).map((r)=>r.toLowerCase()));for(let[r,s]of Object.entries(e.sources??{})){let o=`build.headers.security.csp.sources["${r}"]`;if(!/^[A-Za-z][A-Za-z0-9-]*$/.test(r))t.push(`${o}: not a CSP directive name.`);if(n.has(r.toLowerCase()))t.push(`${o}: csp.directives also sets "${r}" and replaces it wholesale, so put the sources in that string, or remove one of the two.`);for(let i of CE(s))if(/[;,]/.test(i))t.push(`${o}: "${i}" contains ";" or "," and would split the directive.`)}return t}function EL(e,t){let n=new Set(Object.keys(t.directives??{}).map((r)=>r.toLowerCase()));for(let[r,s]of Object.entries(t.sources??{})){let o=r.toLowerCase(),i=CE(s);if(n.has(o)||i.length===0)continue;let a=e[o];if(a===void 0||a===!1){a="";for(let c of vL.get(o)??[]){let u=e[c];if(u!==void 0&&u!==!1){a=u;break}}}let l=a.split(/\s+/).filter(Boolean);for(let c of i)if(!l.includes(c))l.push(c);e[o]=l.filter((c)=>c!=="'none'").join(" ")}}function TE(e,t,n="SAMEORIGIN"){let r=(a,l)=>[...a,...l].join(" "),s={"base-uri":"'self'","default-src":"'self'","font-src":r(["'self'"],e.fontOrigins),"form-action":"'self'","frame-ancestors":wL(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,l]of Object.entries(t.directives??{}))s[a]=l;EL(s,t);let o=Object.entries(s).filter(([,a])=>a!==!1&&a!=="").toSorted(([a],[l])=>a<l?-1:1).map(([a,l])=>`${a} ${String(l)}`).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 pL,mL,hL,gL,yL,xL,bL,vL;var Iy=M(()=>{pL=new Set(["","module","importmap","text/javascript","module-shim","speculationrules"]),mL=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,hL=/<link\b([^>]*)>/gi,gL=/<img\b([^>]*)>/gi,yL=/<source\b([^>]*)>/gi,xL=/<iframe\b([^>]*)>/gi,bL=/\.(woff2?|ttf|otf|eot)(\?|#|$)/i;vL=new Map([["child-src",["default-src"]],["connect-src",["default-src"]],["font-src",["default-src"]],["frame-src",["child-src","default-src"]],["img-src",["default-src"]],["manifest-src",["default-src"]],["media-src",["default-src"]],["object-src",["default-src"]],["prefetch-src",["default-src"]],["script-src",["default-src"]],["script-src-attr",["script-src","default-src"]],["script-src-elem",["script-src","default-src"]],["style-src",["default-src"]],["style-src-attr",["style-src","default-src"]],["style-src-elem",["style-src","default-src"]],["worker-src",["child-src","script-src","default-src"]]])});import{existsSync as Uf,readFileSync as jL,writeFileSync as JE}from"node:fs";import{join as zf}from"node:path";function ME(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??NE,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=AE(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 r.push(...RE(a)),Object.assign(o,TE(t,a,s.frameOptions));let l=n.cache??"auto";if(l==="auto")o["Cache-Control"]="public, max-age=0, must-revalidate";let c=[];if(Object.keys(o).length>0)c.push({headers:o,pattern:"/*"});if(l==="auto")c.push({headers:{"Cache-Control":`public, max-age=${NE}, immutable`},pattern:PL});for(let[u,d]of Object.entries(n.rules??{}))c.push({headers:d,pattern:u});return{errors:r,rules:c}}function IE(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(Uf(zf(e,r)))n.push({headers:{"Content-Type":s},pattern:`/${r}`});if(Uf(zf(e,"feed","archive")))n.push({headers:{"Content-Type":"application/atom+xml; charset=utf-8"},pattern:"/feed/archive/*"});return n}function DE(e,t){if(t==="")return[...e];return e.map((n)=>({headers:n.headers,pattern:Te(t,n.pattern)}))}function OL(e){let t=e.map((n)=>{let r=Object.entries(n.headers).map(([s,o])=>` ${s}: ${o}`);return[n.pattern,...r].join(`
271
+ `)});return`${[kL,"",...t].join(`
201
272
  `)}
202
- `}function tE(e,t){if(t.length===0)return 0;let n=Lf(e,"_headers"),r=Df(n)?CD(n,"utf8").trim():"",s=JD(t),o=r===""?s:`${s}
203
- ${TD}
273
+ `}function LE(e,t){if(t.length===0)return 0;let n=zf(e,"_headers"),r=Uf(n)?jL(n,"utf8").trim():"",s=OL(t),o=r===""?s:`${s}
274
+ ${_L}
204
275
  ${r}
205
- `;return Y0(n,o,"utf8"),1}function nE(e){let t=Lf(e,".nojekyll");if(Df(t))return 0;return Y0(t,"","utf8"),1}var RD="/images/_optimized/*",X0=31536000,ND="# Generated by @jxsuite/compiler — configure via build.headers in project.json.",TD="# ─── public/_headers (hand-authored; these rules override the block above) ───";var rE=J(()=>{An();yy()});async function sE(e,t,n,r={}){let s={},o=am(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 oE=J(()=>{is()});import{cpSync as MD,existsSync as ID,mkdirSync as DD}from"node:fs";import{dirname as LD,resolve as FD}from"node:path";async function iE(e,t,n){let r=[],s=[],o=new Map;for(let i of e.assetProviders()){let a=i.project?.key,l=a?t[a]:void 0;if(a&&(l==null||D(l)&&Object.keys(l).length===0))continue;try{let c=await i.call("assets",l??null,{projectConfig:t,root:n});for(let u of c??[]){if(!D(u)||!u.urlPrefix||!u.dir)continue;let d={dir:u.dir,urlPrefix:yu(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(c){s.push(`Error in ${i.name}.assets: ${be(c)}`)}}return{errors:s,mounts:r}}function Ff(e,t,n){if(t.length===0||!e)return;for(let r of HS(e,t))n.add(r)}function aE(e,t,n){let r=0,s=[];for(let o of e){let i=xu(t,o);if(!i||!ID(i)){s.push(o);continue}let a=FD(n,decodeURIComponent(o).replace(/^\//,""));DD(LD(a),{recursive:!0}),MD(i,a),r+=1}return{copied:r,missing:s}}var lE=J(()=>{An();ce();Lt()});import{readFileSync as VD}from"node:fs";import{dirname as qD,isAbsolute as HD,relative as WD,resolve as cE,sep as BD}from"node:path";function Vf(e,t){return`${e}${t==="client"?xy:by}`}function GD(e){if(e.endsWith(xy))return{documentPath:e.slice(0,-xy.length),side:"client"};if(e.endsWith(by))return{documentPath:e.slice(0,-by.length),side:"server"};return null}function Ki(e,t,n){return pl(e,uE(t,n))}function uE(e,t){return WD(t,e).split(BD).join("/")}function XD(e){return kn(VD(e,"utf8"),e)}function fE(e,t=XD){let n=new Map,r=(c)=>uE(c,e),s=(c)=>{let u=n.get(c);if(u===void 0)u=(async()=>t(c))(),n.set(c,u);return u},o=async(c,u)=>{let d;try{d=await s(c)}catch(S){throw Error(`Cannot read ${r(c)} for its ${u} script`,{cause:S})}let p=d.$script?.[u];if(p===void 0)throw Error(`${r(c)} has no ${u} script: nothing in it is $script.${u}, but something names its ${u} module`);let[m,...y]=Mw(p).problems;if(m!==void 0)throw new Cu({path:r(c),pointer:`/$script/${u}`},[m,...y]);return p},i=(c)=>{let u=Ni(c);if(u===null)return null;return{documentPath:cE(e,u.path),side:u.side}},a=(c)=>({name:`jx-document-scripts-${c}`,setup:(u)=>{u.onResolve({filter:zD},({path:d})=>{let p=i(d);if(p===null)return;if(p.side==="server"&&c==="client")throw Error(`${r(p.documentPath)}: its server script cannot be imported by code a browser runs`);return{path:Vf(p.documentPath,p.side)}}),u.onResolve({filter:KD},({importer:d,path:p})=>{if(HD(p))return{path:Vf(p,"client")};return p.startsWith("./")||p.startsWith("../")?{path:Vf(cE(qD(d),p),"client")}:void 0}),u.onLoad({filter:UD},async({path:d})=>{let p=GD(d);return{contents:await o(p.documentPath,p.side),loader:"ts"}})}}),l=async(c)=>{let u=i(c);if(u===null)throw Error(`"${c}" does not name a document's script`);return{contents:await o(u.documentPath,u.side),path:Vf(u.documentPath,u.side)}};return{clientPlugin:a("client"),module:l,serverPlugin:a("server")}}var xy=".jx-client.ts",by=".jx-server.ts",UD,zD,KD;var qf=J(()=>{Ru();Ti();os();UD=/\.jx-(?:client|server)\.ts$/,zD=/^jx-script:/,KD=/\.jxn$/});async function $y(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 $y(s,t,n);let o=e.children??[],i=k(o)?[o]:Array.isArray(o)?o:[],a=ZD(s);if(YD(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 YD(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)}dE(e,n,r)}function dE(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 dE(s,t,n),r.push(s);e.children=r}function ZD(e){return structuredClone(e)}var pE=J(()=>{ce()});import{existsSync as QD,readFileSync as eL}from"node:fs";import{resolve as mE}from"node:path";function hE(e){return(t)=>{let n=mE(e,t);if(!QD(n))throw Error(`Layout not found: ${t} (resolved to ${n})`);try{let r=kn(eL(n,"utf8"),n);return Ki(Ar(r,n),n,e)}catch(r){throw Error(`Invalid layout at ${n}: ${be(r)}`,{cause:r})}}}function gE(e,t,n){return $y(e,t,hE(n))}function Hf(e,t,n){let r=hE(n),s=[],o=e.$layout??t.defaults?.layout;while(o){let i=mE(n,o);if(s.some((l)=>l.path===i))break;let a=r(o);s.push({doc:a,path:i}),o=a.$layout}return s}var Sy=J(()=>{Ei();qf();os();Lt();pE()});import{existsSync as yE,readdirSync as tL}from"node:fs";import{dirname as nL,isAbsolute as rL,relative as sL,resolve as wy}from"node:path";function oL(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 xE(e){let{formatRegistry:t,pageSources:n,projectConfig:r,projectRoot:s}=e,o=[],i=[],a=new Set,l=new Map,c=(m)=>sL(s,m).replaceAll("\\","/"),u=async(m,y)=>{if(a.has(m))return;let S=c(m),g=y?`${y.declarer}: $elements entry "${y.ref}" names`:"";if(y){if(S.startsWith("..")||rL(S)){a.add(m),i.push(`${g} ${S}, outside the project`);return}if(!yE(m)){a.add(m),i.push(`${g} no file (${S})`);return}}a.add(m);let x;try{x=Ki(await hs(m,t),m,s)}catch(E){i.push(`Error compiling component ${S}: ${be(E)}`);return}let P=k(x.tagName)?x.tagName:"";if(!P.includes("-")){i.push(y?`${g} ${S}, which is not a component (no hyphenated tagName)`:`Error compiling component ${S}: tagName "${P}" must contain a hyphen`);return}let w=l.get(P);if(w!==void 0){i.push(`${c(w)} and ${S} both declare tagName "${P}"; rename one`);return}l.set(P,m),o.push({doc:x,path:m,tagName:P}),await d(x,m)},d=async(m,y,S=nL(y))=>{for(let g of oL(m))await u(wy(S,g),{declarer:c(y),ref:g})},p=wy(s,"components");if(yE(p)){let m=[".json",...t.documentExtensions("component")],y=tL(p).filter((S)=>m.some((g)=>S.endsWith(g))).toSorted();for(let S of y)await u(wy(p,S),null)}await d(r,qn(s),s);for(let m of new Set(n))try{let y=await hs(m,t),S=Hf(y,r,s);await d(y,m);for(let g of S)await d(g.doc,g.path)}catch{}return{components:o,errors:i}}var bE=J(()=>{ce();Lt();Eo();qf();Sy();hy()});import{dirname as iL,relative as aL,resolve as lL,sep as cL}from"node:path";function $E(e,t){return aL(t,e).split(cL).join("/")}function uL(e,t,n){if(!e.startsWith("./")&&!e.startsWith("../"))return e;return`./${$E(lL(t,e),n)}`}function ql(e,t,n){let r=iL(t),s=$E(t,n);return l0(e).map((o)=>({exportName:o.exportName,src:uL(o.src,r,n),declaredIn:s}))}function SE(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(([l,c])=>`${l} (declared in ${c})`);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 wE=J(()=>{yn()});function vE(e,t){if(!k(t)||t.trim()==="")return[...e];return[{attributes:{content:t,name:"description"},tagName:"meta"},...e]}function EE(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 l=vy(a);o.set(l,a)}let i=r.title??r.siteName??"Jx Site";if(o.set("title",{children:[i],tagName:"title"}),r.pageUrl&&r.siteUrl){let a=Cs(r.pageUrl,r.siteUrl);if(![...o.values()].some((c)=>D(c)&&c.tagName==="link"&&c.attributes?.rel==="canonical")){let c={attributes:{href:a,rel:"canonical"},tagName:"link"};o.set(vy(c),c)}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 l={attributes:{href:a.href,hreflang:a.hreflang,rel:"alternate"},tagName:"link"},c=vy(l);if(!o.has(c))o.set(c,l)}return[...o.values()]}function vy(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:${fL(s)}`}return`${t}:${JSON.stringify(e)}`}function fL(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 jE(e){return e.map((t)=>dL(t)).join(`
206
- `)}function dL(e){if(k(e))return e;if(!D(e))return"";let t=e.tagName,n=e.attributes??{},r=Object.entries(n).map(([l,c])=>c===!0?l:`${l}="${pL(c)}"`).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 pL(e){return String(e).replaceAll("&","&amp;").replaceAll('"',"&quot;").replaceAll("<","&lt;")}var PE=J(()=>{An();ce()});function gL(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 yL(e){if(!k(e))return[];return e.split(/\s+/).filter((t)=>{if(t==="")return!1;let n=t.toLowerCase();return!mL.has(n)&&!hL.has(n)&&!gL(t)})}function _E(e){let t=new Set;for(let n of e){if(!D(n)||n.tagName!=="link")continue;for(let r of yL(n.attributes?.rel))t.add(r)}return[...t]}var mL,hL;var kE=J(()=>{ce();mL=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"]),hL=new Set(["shortcut"])});function bL(e){let t=JSON.stringify(e);return/^\.{1,2}\//u.test(e)?`new URL(${t}, import.meta.url).href`:t}async function Gi(e,t={}){let{resolveElementPath:n,$media:r,formats:s}=t,o=[],i=new Set;async function a(l,c){let u,d;if(k(l)){let{readFileSync:T}=await import("node:fs"),{resolve:I}=await import("node:path");if(d=c?I(c,l):I(l),i.has(d))return;if(i.add(d),Vn(d))u=kn(T(d,"utf8"),d);else{let{extname:V}=await import("node:path"),H=V(d).toLowerCase(),O=s?.byExtension(H,"parse");if(!O){await Promise.resolve().then(() => is());throw du(d,H)}u=await O.parseDocument(T(d,"utf8"))}if(u=Ar(u,d),t.projectRoot!==void 0){let{relative:V}=await import("node:path");u=pl(u,V(t.projectRoot,d))}}else{if(u=Ar(l,l.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=df(u,t.projectState);let{tagName:m}=u;if(!m||!m.includes("-"))throw Error(`compileElement: tagName "${m}" must contain a hyphen`);let{dirname:y}=await import("node:path"),S=d?y(d):null,g=[];if(Array.isArray(u.$elements))for(let T of u.$elements){let I=me(T)?T.$ref:T;if(!k(I))continue;if(S)await a(I,S);let V=n?n(I,S):I.replace(/\.(?:json|jxn)$/i,".js");g.push(V)}let x=Ms(m);if(r)u.$media={...r,...u.$media};let{resolveClass:P,rewriteSrc:w}=t,E=u.imports??{},j=Ey(u,x,g,w?(T)=>w(T,S):void 0,Rn(u,t.defaults),t.serverBaseUrl,Object.keys(u.state??{}).filter((T)=>!(T in p)),P?(T)=>P(T,S,E):void 0,t.stylesheetHref?.(m)??null),A=d?d.replace(/\.(?:json|jxn)$/i,".js"):`${m}.js`;o.push({content:j,path:A,tagName:m})}return await a(e,t.basePath??null),{files:o}}async function $L(e,t={}){let{title:n="Jx App",reactivitySrc:r=Ts,litHtmlSrc:s=Nr}=t,o=await Gi(e,t),i=o.files.at(-1);if(!i)throw Error("compileElementPage: no element modules were produced");let{basename:a}=await import("node:path"),l=a(i.path),c=`<!DOCTYPE html>
276
+ `;return JE(n,o,"utf8"),1}function FE(e){let t=zf(e,".nojekyll");if(Uf(t))return 0;return JE(t,"","utf8"),1}var PL="/images/_optimized/*",NE=31536000,kL="# Generated by @jxsuite/compiler — configure via build.headers in project.json.",_L="# ─── public/_headers (hand-authored; these rules override the block above) ───";var VE=M(()=>{hn();Iy()});async function qE(e,t,n,r={}){let s={},o=bm(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 HE=M(()=>{is()});import{cpSync as AL,existsSync as CL,mkdirSync as RL}from"node:fs";import{dirname as TL,resolve as NL}from"node:path";async function WE(e,t,n){let r=[],s=[],o=new Map;for(let i of e.assetProviders()){let a=i.project?.key,l=a?t[a]:void 0;if(a&&(l==null||F(l)&&Object.keys(l).length===0))continue;try{let c=await i.call("assets",l??null,{projectConfig:t,root:n});for(let u of c??[]){if(!F(u)||!u.urlPrefix||!u.dir)continue;let d={dir:u.dir,urlPrefix:Tu(u.urlPrefix)};if(Ot(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(c){s.push(`Error in ${i.name}.assets: ${ye(c)}`)}}return{errors:s,mounts:r}}function Kf(e,t,n){if(t.length===0||!e)return;for(let r of yw(e,t))n.add(r)}function BE(e,t,n){let r=0,s=[];for(let o of e){let i=Nu(t,o);if(!i||!CL(i)){s.push(o);continue}let a=NL(n,decodeURIComponent(o).replace(/^\//,""));RL(TL(a),{recursive:!0}),AL(i,a),r+=1}return{copied:r,missing:s}}var UE=M(()=>{hn();ae();Ft()});import{readFileSync as JL}from"node:fs";import{dirname as ML,isAbsolute as IL,relative as DL,resolve as zE,sep as LL}from"node:path";function Gf(e,t){return`${e}${t==="client"?Dy:Ly}`}function HL(e){if(e.endsWith(Dy))return{documentPath:e.slice(0,-Dy.length),side:"client"};if(e.endsWith(Ly))return{documentPath:e.slice(0,-Ly.length),side:"server"};return null}function ta(e,t,n){return vl(e,KE(t,n))}function KE(e,t){return DL(t,e).split(LL).join("/")}function WL(e){return Rn(JL(e,"utf8"),e)}function GE(e,t=WL){let n=new Map,r=(c)=>KE(c,e),s=(c)=>{let u=n.get(c);if(u===void 0)u=(async()=>t(c))(),n.set(c,u);return u},o=async(c,u)=>{let d;try{d=await s(c)}catch(b){throw Error(`Cannot read ${r(c)} for its ${u} script`,{cause:b})}let p=d.$script?.[u];if(p===void 0)throw Error(`${r(c)} has no ${u} script: nothing in it is $script.${u}, but something names its ${u} module`);let[m,...g]=pv(p).problems;if(m!==void 0)throw new Ku({path:r(c),pointer:`/$script/${u}`},[m,...g]);return p},i=(c)=>{let u=Li(c);if(u===null)return null;return{documentPath:zE(e,u.path),side:u.side}},a=(c)=>({name:`jx-document-scripts-${c}`,setup:(u)=>{u.onResolve({filter:VL},({path:d})=>{let p=i(d);if(p===null)return;if(p.side==="server"&&c==="client")throw Error(`${r(p.documentPath)}: its server script cannot be imported by code a browser runs`);return{path:Gf(p.documentPath,p.side)}}),u.onResolve({filter:qL},({importer:d,path:p})=>{if(IL(p))return{path:Gf(p,"client")};return p.startsWith("./")||p.startsWith("../")?{path:Gf(zE(ML(d),p),"client")}:void 0}),u.onLoad({filter:FL},async({path:d})=>{let p=HL(d);return{contents:await o(p.documentPath,p.side),loader:"ts"}})}}),l=async(c)=>{let u=i(c);if(u===null)throw Error(`"${c}" does not name a document's script`);return{contents:await o(u.documentPath,u.side),path:Gf(u.documentPath,u.side)}};return{clientPlugin:a("client"),module:l,serverPlugin:a("server")}}var Dy=".jx-client.ts",Ly=".jx-server.ts",FL,VL,qL;var Xf=M(()=>{Gu();Fi();os();FL=/\.jx-(?:client|server)\.ts$/,VL=/^jx-script:/,qL=/\.jxn$/});import{existsSync as BL,readFileSync as UL}from"node:fs";import{resolve as XE}from"node:path";function YE(e){return(t)=>{let n=XE(e,t);if(!BL(n))throw Error(`Layout not found: ${t} (resolved to ${n})`);try{let r=Rn(UL(n,"utf8"),n);return ta(Cr(r,n),n,e)}catch(r){throw Error(`Invalid layout at ${n}: ${ye(r)}`,{cause:r})}}}function ZE(e,t,n){return oE(e,t,YE(n))}function Yf(e,t,n){let r=YE(n),s=[],o=e.$layout??t.defaults?.layout;while(o){let i=XE(n,o);if(s.some((l)=>l.path===i))break;let a=r(o);s.push({doc:a,path:i}),o=a.$layout}return s}var Fy=M(()=>{Ai();Xf();os();Ft();qf()});import{existsSync as QE,readdirSync as zL}from"node:fs";import{dirname as KL,isAbsolute as GL,relative as XL,resolve as Vy}from"node:path";function YL(e){let{$elements:t}=e;if(!Array.isArray(t))return[];let n=[];for(let r of t)if(L(r)&&_(r.$ref)&&r.$ref!=="")n.push(r.$ref);return n}async function ej(e){let{formatRegistry:t,pageSources:n,projectConfig:r,projectRoot:s}=e,o=[],i=[],a=new Set,l=new Map,c=(m)=>XL(s,m).replaceAll("\\","/"),u=async(m,g)=>{if(a.has(m))return;let b=c(m),h=g?`${g.declarer}: $elements entry "${g.ref}" names`:"";if(g){if(b.startsWith("..")||GL(b)){a.add(m),i.push(`${h} ${b}, outside the project`);return}if(!QE(m)){a.add(m),i.push(`${h} no file (${b})`);return}}a.add(m);let x;try{x=ta(await gs(m,t),m,s)}catch(v){i.push(`Error compiling component ${b}: ${ye(v)}`);return}let k=_(x.tagName)?x.tagName:"";if(!k.includes("-")){i.push(g?`${h} ${b}, which is not a component (no hyphenated tagName)`:`Error compiling component ${b}: tagName "${k}" must contain a hyphen`);return}let w=l.get(k);if(w!==void 0){i.push(`${c(w)} and ${b} both declare tagName "${k}"; rename one`);return}l.set(k,m),o.push({doc:x,path:m,tagName:k}),await d(x,m)},d=async(m,g,b=KL(g))=>{for(let h of YL(m))await u(Vy(b,h),{declarer:c(g),ref:h})},p=Vy(s,"components");if(QE(p)){let m=[".json",...t.documentExtensions("component")],g=zL(p).filter((b)=>m.some((h)=>b.endsWith(h))).toSorted();for(let b of g)await u(Vy(p,b),null)}await d(r,Un(s),s);for(let m of new Set(n))try{let g=await gs(m,t),b=Yf(g,r,s);await d(g,m);for(let h of b)await d(h.doc,h.path)}catch{}return{components:o,errors:i}}var tj=M(()=>{ae();Ft();ko();Xf();Fy();Jy()});import{dirname as ZL,relative as QL,resolve as eF,sep as tF}from"node:path";function nj(e,t){return QL(t,e).split(tF).join("/")}function nF(e,t,n){if(!e.startsWith("./")&&!e.startsWith("../"))return e;return`./${nj(eF(t,e),n)}`}function Ul(e,t,n){let r=ZL(t),s=nj(t,n);return M0(e).map((o)=>({exportName:o.exportName,src:nF(o.src,r,n),declaredIn:s}))}function rj(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(([l,c])=>`${l} (declared in ${c})`);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 sj=M(()=>{$n()});function oF(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 iF(e){if(!_(e))return[];return e.split(/\s+/).filter((t)=>{if(t==="")return!1;let n=t.toLowerCase();return!rF.has(n)&&!sF.has(n)&&!oF(t)})}function oj(e){let t=new Set;for(let n of e){if(!F(n)||n.tagName!=="link")continue;for(let r of iF(n.attributes?.rel))t.add(r)}return[...t]}var rF,sF;var ij=M(()=>{ae();rF=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"]),sF=new Set(["shortcut"])});function lF(e){let t=JSON.stringify(e);return/^\.{1,2}\//u.test(e)?`new URL(${t}, import.meta.url).href`:t}async function na(e,t={}){let{resolveElementPath:n,$media:r,formats:s}=t,o=[],i=new Set;async function a(l,c){let u,d;if(_(l)){let{readFileSync:I}=await import("node:fs"),{resolve:D}=await import("node:path");if(d=c?D(c,l):D(l),i.has(d))return;if(i.add(d),Bn(d))u=Rn(I(d,"utf8"),d);else{let{extname:V}=await import("node:path"),W=V(d).toLowerCase(),A=s?.byExtension(W,"parse");if(!A){await Promise.resolve().then(() => is());throw gu(d,W)}u=await A.parseDocument(I(d,"utf8"))}if(u=Cr(u,d),t.projectRoot!==void 0){let{relative:V}=await import("node:path");u=vl(u,V(t.projectRoot,d))}}else{if(u=Cr(l,l.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=xf(u,t.projectState);let{tagName:m}=u;if(!m||!m.includes("-"))throw Error(`compileElement: tagName "${m}" must contain a hyphen`);let{dirname:g}=await import("node:path"),b=d?g(d):null,h=[];if(Array.isArray(u.$elements))for(let I of u.$elements){let D=pe(I)?I.$ref:I;if(!_(D))continue;if(b)await a(D,b);let V=n?n(D,b):D.replace(/\.(?:json|jxn)$/i,".js");h.push(V)}let x=Ls(m);if(r)u.$media={...r,...u.$media};let{resolveClass:k,rewriteSrc:w}=t,v=u.imports??{},E=qy(u,x,h,w?(I)=>w(I,b):void 0,Jn(u,t.defaults),t.serverBaseUrl,Object.keys(u.state??{}).filter((I)=>!(I in p)),k?(I)=>k(I,b,v):void 0,t.stylesheetHref?.(m)??null),O=d?d.replace(/\.(?:json|jxn)$/i,".js"):`${m}.js`;o.push({content:E,path:O,tagName:m})}return await a(e,t.basePath??null),{files:o}}async function cF(e,t={}){let{title:n="Jx App",reactivitySrc:r=Is,litHtmlSrc:s=Tr}=t,o=await na(e,t),i=o.files.at(-1);if(!i)throw Error("compileElementPage: no element modules were produced");let{basename:a}=await import("node:path"),l=a(i.path),c=`<!DOCTYPE html>
207
277
  <html lang="en">
208
278
  <head>
209
279
  <meta charset="utf-8">
210
280
  <meta name="viewport" content="width=device-width, initial-scale=1">
211
- <title>${Ne(n)}</title>
212
- ${Ii({litHtmlSrc:s,reactivitySrc:r,runtimeImports:t.runtimeImports})}
281
+ <title>${Me(n)}</title>
282
+ ${Wi({litHtmlSrc:s,reactivitySrc:r,runtimeImports:t.runtimeImports})}
213
283
  </head>
214
284
  <body>
215
285
  <${i.tagName}></${i.tagName}>
216
286
  <script type="module" src="./${l}"></script>
217
287
  </body>
218
- </html>`;return{files:o.files,html:c}}function SL(e){if(!D(e)||Array.isArray(e))return JSON.stringify(e);if("default"in e)return JSON.stringify(e.default);if($s(e))return;if(e.$prototype==="LocalStorage"||e.$prototype==="SessionStorage")return JSON.stringify(e.default??null);if(e.$prototype==="Request")return"null";if(Hi(e))return"null";if(Zr(e))return"null";return JSON.stringify(e)}function Ey(e,t,n,r,s=null,o="/_jx/server",i=[],a,l=null){let c=["// Generated by @jxsuite/compiler — do not edit manually"];if(e.$id)c.push(`// Source: ${e.$id}`);for(let B of n)c.push(`import '${B}';`);let u=e.state??{},d=Or(e),p=hf(mf(u,d),r);c.push(...p.imports);let m=Pf(u,a),y=m.entries.length>0;c.push(...m.imports);let S=Object.entries(u).flatMap(([B,q])=>Pn(q)&&q.$prototype==="Request"?[[B,q]]:[]),g=Object.entries(u).flatMap(([B,q])=>Zr(q)?[[B,q]]:[]),x=xf(e);if(c.push(x.keyed?"import { reactive, computed, effect, stop, shallowRef } from '@vue/reactivity';":"import { reactive, computed, effect, stop } from '@vue/reactivity';","import { render, html, nothing } from 'lit-html';",...x.keyed?Sf:[],yf()),x.arranged||x.keyed)c.push($f());if(x.keyed)c.push(wf());let P=Object.keys(u).filter((B)=>!Zo(B)),w=P.filter((B)=>!xL.has(B)),E=w.filter((B)=>i.includes(B)),j=E.length>0;c.push(`const __jxProps = ${JSON.stringify(P)};`);let A=oh(e),T=w.filter((B)=>A.has(B));if(w.length>0)c.push(`const __jxBridged = ${JSON.stringify(w)};`,Gv());if(T.length>0)c.push(`const __jxDerived = new Set(${JSON.stringify(T)});`);if(j)c.push(`const __jxInherited = new Set(${JSON.stringify(E)});`);let I=Tl(e);if(I.length>0)c.push(Xv(),`const __jxObserved = ${JSON.stringify(I)};`,`const __jxObservedDefaults = () => ${Zv(e)};`);if(g.length>0)c.push(Ef());if(y)c.push(jf());let V=s===null&&Ns(e.children);if(V)c.push(n0());let H=e.formAssociated===!0;if(H)c.push(t0());c.push(...p.loaders,"",`class ${t} extends HTMLElement {`," #effects = [];"," #rendered = false;",...x.keyed?[" #part = null;"]:[],...s===null?[]:[" #root = null;"],...H?[" #internals;"," #form = null;"]:[],...y?[" #jxInstances = new Map();"," #jxReady = null;"," #jxConnection = 0;"," #jxDrawn = false;"]:[],"",...I.length>0?[" static get observedAttributes() { return __jxObserved; }",""]:[],...H?[" static formAssociated = true;",""," #attach() {"," if (this.#internals === undefined) {"," this.#internals = typeof this.attachInternals === 'function' ? this.attachInternals() : null;"," }"," return this.#internals;"," }",""]:[]," constructor() {"," super();");let O=[],N=[],G=[],Q=[],re=[];for(let[B,q]of Object.entries(u))if(fn(q))if(wr(q))Q.push([B,q]);else if(dr(q.$expression.operator))G.push([B,q]);else N.push([B,q]);else if(kt(q))(d.get(B)==="computed"?N:G).push([B,q]);else if(k(q)&&q.includes("${"))re.push([B,q]);else{let z=SL(q);if(z!==void 0)O.push([B,z])}c.push(" this.state = reactive({");for(let[B,q]of O)c.push(` ${us(B)}: ${q},`);c.push(" });");for(let[B,q]of G)if(c.push(""),fn(q)){let z=gn(q.$expression,{eventParam:"e",statePrefix:"s"});c.push(` ${Re("this.state",Wt(B))} = (s, e) => { ${z}; };`)}else if(vr(q)){let z=zn(q.body,{dispatchTarget:"this",eventParam:"e",indent:" ",statePrefix:"this.state"});c.push(` ${Re("this.state",Wt(B))} = (s, e) => {`,z," };")}else{let z=Re("this.state",Wt(B));if(q.$src)c.push(` ${z} = ${B};`);else{let We=k(q.body)?q.body:"";c.push(` ${z} = (${kr(q).join(", ")}) => {`,` ${We}`," };")}}for(let[B,q]of Q){c.push("");let z=gn(q.$expression,{eventParam:"e",statePrefix:"this.state"});c.push(` ${Re("this.state",Wt(B))} = ${kl(q,z)};`)}for(let[B,q]of re){let z=Fi(q,"this.state",{code:!1}),We=gf(z);c.push("",zf(z)?` ${Re("this.state",Wt(B))} = computed(() => { const state = this.state; return ${We}; });`:` ${Re("this.state",Wt(B))} = computed(() => ${We});`)}for(let[B,q]of N)if(c.push(""),fn(q)){let z=gn(q.$expression,{eventParam:"e",statePrefix:"this.state"});c.push(` ${Re("this.state",Wt(B))} = computed(() => ${z});`)}else if(q.$src)c.push(` ${Re("this.state",Wt(B))} = computed(() => ${B}(this.state));`);else{c.push(` ${Re("this.state",Wt(B))} = computed(() => {`);let z=Fi(k(q.body)?q.body:"","this.state");c.push(` ${z}`," });")}let ue=wL(e);if(ue.length>0){c.push(""," {"," const s = this.state;");for(let{type:B,source:q}of ue)c.push(` this.addEventListener(${JSON.stringify(B)}, ${q});`);c.push(" }")}c.push(" }","");let ne={n:0};for(let B of Of(e))o0(B,ne,e.tagName??"jx");let fe=CE(),xe=!Array.isArray(e.children)&&e.textContent!==void 0?` ${Kf(e.textContent)}`:Bf(e.children,e.style," ",!1,!1,fe),X=[xe,...fe.decls].some((B)=>zf(B));if(c.push(" template() {"," const s = this.state;",...X?[" const state = s;"]:[],...fe.decls," return html`",xe," `;"," }","",...s===null?[]:[" #renderRoot() {"," if (this.#root) return this.#root;",s==="closed"?H?" const _a = this.#attach()?.shadowRoot ?? null;":" const _a = this.attachInternals().shadowRoot;":" const _a = this.shadowRoot;",` this.#root = _a ?? this.attachShadow({ mode: '${s}' });`,...l===null?[]:[` if (!_a) this.#root.append(Object.assign(document.createElement('link'), { rel: 'stylesheet', href: ${bL(l)} }));`]," return this.#root;"," }",""]," connectedCallback() {"," const _first = !this.#rendered;"," this.#rendered = true;",...x.keyed?[" this.#part?.setConnected(true);"]:[],...j?[" const _given = new Set();"]:[],...I.length>0?[" if (_first) {"," const _d = __jxObservedDefaults();"," for (const _a of __jxObserved) {",` if (this.hasAttribute(_a)) ${vf}(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;",j?" 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);",...j?[" _given.add(_k);"]:[]," this.removeAttribute(_n);"," }"," }"),w.length>0)c.push(" if (_first) {"," for (const _k of __jxBridged) {",...T.length>0?[" if (__jxDerived.has(_k)) continue;"]:[],` if (_k in this && this[_k] !== undefined && ${Wg}(this, _k)) {`," this.state[_k] = this[_k];",...j?[" _given.add(_k);"]:[]," }"," }"," for (const _k of __jxBridged) {",...j?[" if (__jxInherited.has(_k) && !_given.has(_k)) continue;"]:[],...T.length>0?[" if (__jxDerived.has(_k)) {"," Object.defineProperty(this, _k, { configurable: true, get: () => this.state[_k] });"," continue;"," }"]:[],` const _set = ${Bg}(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(y)c.push(` this.#jxReady ??= ${_f(m.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[B,q]of S)c.push(cf(B,q,{collect:"this.#effects",indent:" ",statePrefix:"this.state"}));for(let[B,q]of g)c.push(uf(B,q,{collect:"this.#effects",indent:" ",serverBaseUrl:o,statePrefix:"this.state"}));if(c.push(...vL(e)),D(e.style)){let B=[];for(let[q,z]of Object.entries(e.style)){if(q.startsWith(":")||q.startsWith(".")||q.startsWith("&")||q.startsWith("[")||q.startsWith("@"))continue;if(k(z)&&z.includes("${"))B.push([hn(q),z])}if(B.length>0){c.push(" this.#effects.push(effect(() => {");for(let[q,z]of B){let We=z.replaceAll(/\$\{([^}]+)\}/g,(qe,Ye)=>`\${${Fi(Ye,"this.state")}}`);c.push(` this.style['${q}'] = \`${We}\`;`)}c.push(" }));")}}if(V)c.push(` const _slotted = _first ? ${Gg}(this) : null;`);if(c.push(" if (this.hasAttribute('data-jx-prerendered')) {"," this.removeAttribute('data-jx-prerendered');"," }"),s===null)c.push(" if (_first) this.replaceChildren();",x.keyed?" this.#effects.push(effect(() => { this.#part = render(this.template(), this); }));":" 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();"," }"," }",x.keyed?" this.#effects.push(effect(() => { this.#part = render(this.template(), _root); }));":" this.#effects.push(effect(() => render(this.template(), _root)));");if(V)c.push(` if (_first) ${Xg}(this, _slotted);`);if(H)c.push(" if (_first) {"," const _i = this.#attach();"," if (_i) {",` this.#form = ${Kg}(this, _i, this.state, ${JSON.stringify(kv(e))}, () => ${s===null?"this":"this.#renderRoot()"}, ${EL(e.formValue)}, (fn) => { this.#effects.push(effect(fn)); });`," }"," }"," if (this.#form) this.#form.start();");if(c.push(" if (_first && typeof this.state.onMount === 'function') {"," queueMicrotask(() => this.state.onMount.call(this, this.state, this));"," }"," }",""," disconnectedCallback() {",...x.keyed?[" this.#part?.setConnected(false);"]:[]," 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 u)c.push(""," adoptedCallback() {"," if (typeof this.state.onAdopted === 'function') { this.state.onAdopted(this.state); }"," }");if(H)c.push(""," formResetCallback() { if (this.#form) this.#form.reset(); }",""," formDisabledCallback(disabled) { if (this.#form) this.#form.disabled(disabled); }");if(I.length>0)c.push(""," attributeChangedCallback(name, oldVal, newVal) {"," if (oldVal === newVal) return;",` ${vf}(this.state, name, newVal, __jxObservedDefaults());`," }");return c.push("}","",`customElements.define('${e.tagName}', ${t});`,""),c.join(`
219
- `)}function CE(){return{byText:new Map,decls:[]}}function RE(e,t){let n=e.byText.get(t);if(n)return n;let r=`_c${e.decls.length}`;e.decls.push(` const ${r} = html\`
288
+ </html>`;return{files:o.files,html:c}}function uF(e){if(!F(e)||Array.isArray(e))return JSON.stringify(e);if("default"in e)return JSON.stringify(e.default);if(vs(e))return;if(e.$prototype==="LocalStorage"||e.$prototype==="SessionStorage")return JSON.stringify(e.default??null);if(e.$prototype==="Request")return"null";if(Xi(e))return"null";if(Zr(e))return"null";return JSON.stringify(e)}function qy(e,t,n,r,s=null,o="/_jx/server",i=[],a,l=null){let c=["// Generated by @jxsuite/compiler — do not edit manually"];if(e.$id)c.push(`// Source: ${e.$id}`);for(let U of n)c.push(`import '${U}';`);let u=e.state??{},d=Ar(e),p=Sf($f(u,d),r);c.push(...p.imports);let m=Rf(u,a),g=m.entries.length>0;c.push(...m.imports);let b=Object.entries(u).flatMap(([U,H])=>An(H)&&H.$prototype==="Request"?[[U,H]]:[]),h=Object.entries(u).flatMap(([U,H])=>Zr(H)?[[U,H]]:[]),x=Ef(e);if(c.push(x.keyed?"import { reactive, computed, effect, stop, shallowRef } from '@vue/reactivity';":"import { reactive, computed, effect, stop } from '@vue/reactivity';","import { render, html, nothing } from 'lit-html';",...x.keyed?kf:[],vf()),x.arranged||x.keyed)c.push(Pf());if(x.keyed)c.push(_f());let k=Object.keys(u).filter((U)=>!si(U)),w=k.filter((U)=>!aF.has(U)),v=w.filter((U)=>i.includes(U)),E=v.length>0;c.push(`const __jxProps = ${JSON.stringify(k)};`);let O=Bg(e),I=w.filter((U)=>O.has(U));if(w.length>0)c.push(`const __jxBridged = ${JSON.stringify(w)};`,v0());if(I.length>0)c.push(`const __jxDerived = new Set(${JSON.stringify(I)});`);if(E)c.push(`const __jxInherited = new Set(${JSON.stringify(v)});`);let D=Dl(e);if(D.length>0)c.push(E0(),`const __jxObserved = ${JSON.stringify(D)};`,`const __jxObservedDefaults = () => ${P0(e)};`);if(h.length>0)c.push(Af());if(g)c.push(Cf());let V=s===null&&Ms(e.children);if(V)c.push(A0());let W=e.formAssociated===!0;if(W)c.push(O0());c.push(...p.loaders,"",`class ${t} extends HTMLElement {`," #effects = [];"," #rendered = false;",...x.keyed?[" #part = null;"]:[],...s===null?[]:[" #root = null;"],...W?[" #internals;"," #form = null;"]:[],...g?[" #jxInstances = new Map();"," #jxReady = null;"," #jxConnection = 0;"," #jxDrawn = false;"]:[],"",...D.length>0?[" static get observedAttributes() { return __jxObserved; }",""]:[],...W?[" static formAssociated = true;",""," #attach() {"," if (this.#internals === undefined) {"," this.#internals = typeof this.attachInternals === 'function' ? this.attachInternals() : null;"," }"," return this.#internals;"," }",""]:[]," constructor() {"," super();");let A=[],J=[],G=[],se=[],ie=[];for(let[U,H]of Object.entries(u))if(pn(H))if(wr(H))se.push([U,H]);else if(hr(H.$expression.operator))G.push([U,H]);else J.push([U,H]);else if(At(H))(d.get(U)==="computed"?J:G).push([U,H]);else if(_(H)&&H.includes("${"))ie.push([U,H]);else{let K=uF(H);if(K!==void 0)A.push([U,K])}c.push(" this.state = reactive({");for(let[U,H]of A)c.push(` ${fs(U)}: ${H},`);c.push(" });");for(let[U,H]of G)if(c.push(""),pn(H)){let K=bn(H.$expression,{eventParam:"e",statePrefix:"s"});c.push(` ${Je("this.state",Ut(U))} = (s, e) => { ${K}; };`)}else if(vr(H)){let K=Yn(H.body,{dispatchTarget:"this",eventParam:"e",indent:" ",statePrefix:"this.state"});c.push(` ${Je("this.state",Ut(U))} = (s, e) => {`,K," };")}else{let K=Je("this.state",Ut(U));if(H.$src)c.push(` ${K} = ${U};`);else{let He=_(H.body)?H.body:"";c.push(` ${K} = (${Or(H).join(", ")}) => {`,` ${He}`," };")}}for(let[U,H]of se){c.push("");let K=bn(H.$expression,{eventParam:"e",statePrefix:"this.state"});c.push(` ${Je("this.state",Ut(U))} = ${Tl(H,K)};`)}for(let[U,H]of ie){let K=zi(H,"this.state",{code:!1}),He=wf(K);c.push("",td(K)?` ${Je("this.state",Ut(U))} = computed(() => { const state = this.state; return ${He}; });`:` ${Je("this.state",Ut(U))} = computed(() => ${He});`)}for(let[U,H]of J)if(c.push(""),pn(H)){let K=bn(H.$expression,{eventParam:"e",statePrefix:"this.state"});c.push(` ${Je("this.state",Ut(U))} = computed(() => ${K});`)}else if(H.$src)c.push(` ${Je("this.state",Ut(U))} = computed(() => ${U}(this.state));`);else{c.push(` ${Je("this.state",Ut(U))} = computed(() => {`);let K=zi(_(H.body)?H.body:"","this.state");c.push(` ${K}`," });")}let le=fF(e);if(le.length>0){c.push(""," {"," const s = this.state;");for(let{type:U,source:H}of le)c.push(` this.addEventListener(${JSON.stringify(U)}, ${H});`);c.push(" }")}c.push(" }","");let te={n:0};for(let U of Jf(e))T0(U,te,e.tagName??"jx");let de=cj(),xe=!Array.isArray(e.children)&&e.textContent!==void 0?` ${nd(e.textContent)}`:Qf(e.children,e.style," ",!1,!1,de),X=[xe,...de.decls].some((U)=>td(U));if(c.push(" template() {"," const s = this.state;",...X?[" const state = s;"]:[],...de.decls," return html`",xe," `;"," }","",...s===null?[]:[" #renderRoot() {"," if (this.#root) return this.#root;",s==="closed"?W?" const _a = this.#attach()?.shadowRoot ?? null;":" const _a = this.attachInternals().shadowRoot;":" const _a = this.shadowRoot;",` this.#root = _a ?? this.attachShadow({ mode: '${s}' });`,...l===null?[]:[` if (!_a) this.#root.append(Object.assign(document.createElement('link'), { rel: 'stylesheet', href: ${lF(l)} }));`]," return this.#root;"," }",""]," connectedCallback() {"," const _first = !this.#rendered;"," this.#rendered = true;",...x.keyed?[" this.#part?.setConnected(true);"]:[],...E?[" const _given = new Set();"]:[],...D.length>0?[" if (_first) {"," const _d = __jxObservedDefaults();"," for (const _a of __jxObserved) {",` if (this.hasAttribute(_a)) ${Of}(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;",E?" 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);",...E?[" _given.add(_k);"]:[]," this.removeAttribute(_n);"," }"," }"),w.length>0)c.push(" if (_first) {"," for (const _k of __jxBridged) {",...I.length>0?[" if (__jxDerived.has(_k)) continue;"]:[],` if (_k in this && this[_k] !== undefined && ${iy}(this, _k)) {`," this.state[_k] = this[_k];",...E?[" _given.add(_k);"]:[]," }"," }"," for (const _k of __jxBridged) {",...E?[" if (__jxInherited.has(_k) && !_given.has(_k)) continue;"]:[],...I.length>0?[" if (__jxDerived.has(_k)) {"," Object.defineProperty(this, _k, { configurable: true, get: () => this.state[_k] });"," continue;"," }"]:[],` const _set = ${ay}(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(g)c.push(` this.#jxReady ??= ${Tf(m.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[U,H]of b)c.push(hf(U,H,{collect:"this.#effects",indent:" ",statePrefix:"this.state"}));for(let[U,H]of h)c.push(gf(U,H,{collect:"this.#effects",indent:" ",serverBaseUrl:o,statePrefix:"this.state"}));if(c.push(...dF(e)),F(e.style)){let U=[];for(let[H,K]of Object.entries(e.style)){if(H.startsWith(":")||H.startsWith(".")||H.startsWith("&")||H.startsWith("[")||H.startsWith("@"))continue;if(_(K)&&K.includes("${"))U.push([xn(H),K])}if(U.length>0){c.push(" this.#effects.push(effect(() => {");for(let[H,K]of U){let He=K.replaceAll(/\$\{([^}]+)\}/g,(Ve,Ze)=>`\${${zi(Ze,"this.state")}}`);c.push(` this.style['${H}'] = \`${He}\`;`)}c.push(" }));")}}if(V)c.push(` const _slotted = _first ? ${fy}(this) : null;`);if(c.push(" if (this.hasAttribute('data-jx-prerendered')) {"," this.removeAttribute('data-jx-prerendered');"," }"),s===null)c.push(" if (_first) this.replaceChildren();",x.keyed?" this.#effects.push(effect(() => { this.#part = render(this.template(), this); }));":" 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();"," }"," }",x.keyed?" this.#effects.push(effect(() => { this.#part = render(this.template(), _root); }));":" this.#effects.push(effect(() => render(this.template(), _root)));");if(V)c.push(` if (_first) ${dy}(this, _slotted);`);if(W)c.push(" if (_first) {"," const _i = this.#attach();"," if (_i) {",` this.#form = ${uy}(this, _i, this.state, ${JSON.stringify(t0(e))}, () => ${s===null?"this":"this.#renderRoot()"}, ${pF(e.formValue)}, (fn) => { this.#effects.push(effect(fn)); });`," }"," }"," if (this.#form) this.#form.start();");if(c.push(" if (_first && typeof this.state.onMount === 'function') {"," queueMicrotask(() => this.state.onMount.call(this, this.state, this));"," }"," }",""," disconnectedCallback() {",...x.keyed?[" this.#part?.setConnected(false);"]:[]," 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 u)c.push(""," adoptedCallback() {"," if (typeof this.state.onAdopted === 'function') { this.state.onAdopted(this.state); }"," }");if(W)c.push(""," formResetCallback() { if (this.#form) this.#form.reset(); }",""," formDisabledCallback(disabled) { if (this.#form) this.#form.disabled(disabled); }");if(D.length>0)c.push(""," attributeChangedCallback(name, oldVal, newVal) {"," if (oldVal === newVal) return;",` ${Of}(this.state, name, newVal, __jxObservedDefaults());`," }");return c.push("}","",`customElements.define('${e.tagName}', ${t});`,""),c.join(`
289
+ `)}function cj(){return{byText:new Map,decls:[]}}function uj(e,t){let n=e.byText.get(t);if(n)return n;let r=`_c${e.decls.length}`;e.decls.push(` const ${r} = html\`
220
290
  ${t}
221
- \`;`);let s=`\${${r}}`;return e.byText.set(t,s),s}function Bf(e,t,n,r=!1,s=!1,o=null,i=!1){if(!e)return"";let a=i?Wi:"";if(Le(e))return`${AE(e,n)}${a}`;if(!Array.isArray(e))return"";return e.map((l)=>{if(Le(l))return`${AE(l,n)}${a}`;let c=jy(l,r?"":n,r,s,o);return k(l)&&l.includes("${")||D(l)&&rr(l.tagName)?`${c}${a}`:c}).join(r?"":`
222
- `)}function jy(e,t,n=!1,r=!1,s=null,o=null){if(k(e)){if(e.includes("${"))return`${t}${Kf(e)}`;return`${t}${Ne(e)}`}if(Ie(e)||Ge(e))return`${t}${Ne(String(e))}`;if(!D(e))return"";if(rr(e.tagName)){let g=e.tagName.$expression,x=fs(g.target,{eventParam:"e",statePrefix:"s"}),P=g.operator==="?:"?[[!0,g.value],[!1,g.initial]]:[...Object.entries(g.cases),["__default__",g.default]],w=P.map(([,V])=>V),E=w.map((V)=>n||ms.has(V)),j=null;if(s&&E.every((V)=>V===E[0])){let V=OE(e,`${t} `,E[0]===!0,r,s,w.some((H)=>H.includes("-")));if(V.trim()!=="")j=RE(s,V)}let A=P.map(([V,H])=>{let O={...e,tagName:H};return[V,jy(O,`${t} `,n,r,s,j)]});if(g.operator==="?:"){let[,V]=A[0],[,H]=A[1];return`${t}\${${x}
291
+ \`;`);let s=`\${${r}}`;return e.byText.set(t,s),s}function Qf(e,t,n,r=!1,s=!1,o=null,i=!1){if(!e)return"";let a=i?Yi:"";if(Le(e))return`${lj(e,n)}${a}`;if(!Array.isArray(e))return"";return Kt(e.map((l)=>{if(Le(l))return`${lj(l,n)}${a}`;let c=Hy(l,r?"":n,r,s,o);return _(l)&&l.includes("${")||F(l)&&ir(l.tagName)?`${c}${a}`:c}),{lead:n,preformatted:r,separator:`
292
+ `})}function Hy(e,t,n=!1,r=!1,s=null,o=null){if(_(e)){if(e.includes("${"))return`${t}${nd(e)}`;return`${t}${Me(e)}`}if(De(e)||Xe(e))return`${t}${Me(String(e))}`;if(!F(e))return"";if(ir(e.tagName)){let h=e.tagName.$expression,x=ds(h.target,{eventParam:"e",statePrefix:"s"}),k=h.operator==="?:"?[[!0,h.value],[!1,h.initial]]:[...Object.entries(h.cases),["__default__",h.default]],w=k.map(([,V])=>V),v=w.map((V)=>n||hs.has(V)),E=null;if(s&&v.every((V)=>V===v[0])){let V=aj(e,`${t} `,v[0]===!0,r,s,w.some((W)=>W.includes("-")));if(V.trim()!=="")E=uj(s,V)}let O=k.map(([V,W])=>{let A={...e,tagName:W};return[V,Hy(A,`${t} `,n,r,s,E)]});if(h.operator==="?:"){let[,V]=O[0],[,W]=O[1];return`${t}\${${x}
223
293
  ? html\`
224
294
  ${V}
225
295
  \`
226
296
  : html\`
227
- ${H}
228
- \`}`}let T=A.flatMap(([V,H])=>V==="__default__"?[]:[` ${JSON.stringify(V)}: html\`
229
- ${H}
230
- \``]),[,I]=A.at(-1);return`${t}\${{
231
- ${T.join(`,
297
+ ${W}
298
+ \`}`}let I=O.flatMap(([V,W])=>V==="__default__"?[]:[` ${JSON.stringify(V)}: html\`
299
+ ${W}
300
+ \``]),[,D]=O.at(-1);return`${t}\${{
301
+ ${I.join(`,
232
302
  `)}
233
303
  }[String(${x})] ?? html\`
234
- ${I}
235
- \`}`}let i=e.tagName??"div",a=n||ms.has(i),l=[],c=NE(e,Xt,xn);if(e.attributes)for(let[g,x]of Object.entries(e.attributes)){if(g==="class"&&c!==null)continue;if(me(x))l.push(`${g}="\${${Vo}('${g}', ${xn(x.$ref)}) ?? nothing}"`);else if(k(x)&&Py(x))l.push(`${g}="\${${Vo}('${g}', ${Xt(x).slice(2,-1)}) ?? nothing}"`);else if(k(x)&&x.includes("${"))l.push(`${g}="${Xt(x)}"`);else if(Ge(x)){let P=Rr(g,x);if(P!==null)l.push(P===""?g:`${g}="${P}"`)}else l.push(`${g}="${x}"`)}if(e.id)l.push(`id="${Xt(String(e.id))}"`);if(c!==null)l.push(c);for(let[g,x]of Object.entries(e)){if(pr.has(g)||g.startsWith("$")||g.startsWith("on")||g==="tagName"||g==="id"||g==="className"||g==="style"||g==="children"||g==="textContent"||g==="innerHTML"||g==="attributes")continue;if(Uf(x))l.push(`.${g}="\${${xn(x.$ref)}}"`);else if(k(x)&&x.includes("${"))l.push(`.${g}="${Xt(x)}"`);else l.push(`.${g}="\${${JSON.stringify(x)}}"`)}if(e.$props)for(let[g,x]of Object.entries(e.$props))if(Uf(x))l.push(`.${g}="\${${xn(x.$ref)}}"`);else if(k(x)&&x.includes("${"))l.push(`.${g}="${Xt(x)}"`);else l.push(`.${g}="\${${JSON.stringify(x)}}"`);let u=r?"s.$map = $map; ":"";for(let[g,x]of Object.entries(e)){if(!g.startsWith("on")||g==="observedAttributes")continue;ps(`inline "${g}" handler`,x);let P=g.slice(2).toLowerCase(),w=_y(x,u);if(w!==null)l.push(`@${P}="\${${w}}"`)}let d=JE(e.style);if(d)l.push(`style="${d}"`);let p=l.length>0?`
304
+ ${D}
305
+ \`}`}let i=e.tagName??"div",a=n||hs.has(i),l=[],c=fj(e,Qt,Sn);if(e.attributes)for(let[h,x]of Object.entries(e.attributes)){if(h==="class"&&c!==null)continue;if(pe(x))l.push(`${h}="\${${Wo}('${h}', ${Sn(x.$ref)}) ?? nothing}"`);else if(_(x)&&Wy(x))l.push(`${h}="\${${Wo}('${h}', ${Qt(x).slice(2,-1)}) ?? nothing}"`);else if(_(x)&&x.includes("${"))l.push(`${h}="${Qt(x)}"`);else if(Xe(x)){let k=Rr(h,x);if(k!==null)l.push(k===""?h:`${h}="${k}"`)}else l.push(`${h}="${x}"`)}if(e.id)l.push(`id="${Qt(String(e.id))}"`);if(c!==null)l.push(c);for(let[h,x]of Object.entries(e)){if(gr.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(ed(x))l.push(`.${h}="\${${Sn(x.$ref)}}"`);else if(_(x)&&x.includes("${"))l.push(`.${h}="${Qt(x)}"`);else l.push(`.${h}="\${${JSON.stringify(x)}}"`)}if(e.$props)for(let[h,x]of Object.entries(e.$props))if(ed(x))l.push(`.${h}="\${${Sn(x.$ref)}}"`);else if(_(x)&&x.includes("${"))l.push(`.${h}="${Qt(x)}"`);else l.push(`.${h}="\${${JSON.stringify(x)}}"`);let u=r?"s.$map = $map; ":"";for(let[h,x]of Object.entries(e)){if(!h.startsWith("on")||h==="observedAttributes")continue;ms(`inline "${h}" handler`,x);let k=h.slice(2).toLowerCase(),w=By(x,u);if(w!==null)l.push(`@${k}="\${${w}}"`)}let d=pj(e.style);if(d)l.push(`style="${d}"`);let p=l.length>0?`
236
306
  ${t} ${l.join(`
237
307
  ${t} `)}`:"";if(new Set(["input","br","hr","img","meta","link"]).has(i))return`${t}<${i}${p}
238
- ${t}>`;let y=o??OE(e,t,a,r,s,i.includes("-")),S=i==="slot"?Wi:"";return a?`${S}<${i}${p}>${y}${S}</${i}>`:`${t}${S}<${i}${p}
239
- ${t}>${y}${S}</${i}>`}function OE(e,t,n,r,s,o=!1){if(e.$switch){let i=me(e.$switch)?e.$switch.$ref:e.$switch,a=xn(i),l=[];for(let[p,m]of Object.entries(e.cases??{})){if(!m||me(m))continue;l.push([p,jy(m,`${t} `,!1,r,s)])}let c=l.map(([,p])=>p),u=new Set(c.filter((p,m)=>c.indexOf(p)!==m&&p.trim()!==""));return`\${{
240
- ${l.map(([p,m])=>{let y=s&&u.has(m)?RE(s,m):m;return` ${JSON.stringify(p)}: html\`
241
- ${y}
308
+ ${t}>`;let g=o??aj(e,t,a,r,s,i.includes("-")),b=i==="slot"?Yi:"";return a?`${b}<${i}${p}>${g}${b}</${i}>`:`${t}${b}<${i}${p}
309
+ ${t}>${g}${b}</${i}>`}function aj(e,t,n,r,s,o=!1){if(e.$switch){let i=pe(e.$switch)?e.$switch.$ref:e.$switch,a=Sn(i),l=[];for(let[p,m]of Object.entries(e.cases??{})){if(!m||pe(m))continue;l.push([p,Hy(m,`${t} `,!1,r,s)])}let c=l.map(([,p])=>p),u=new Set(c.filter((p,m)=>c.indexOf(p)!==m&&p.trim()!==""));return`\${{
310
+ ${l.map(([p,m])=>{let g=s&&u.has(m)?uj(s,m):m;return` ${JSON.stringify(p)}: html\`
311
+ ${g}
242
312
  \``}).join(`,
243
313
  `)}
244
- }[${a}]}`}if(e.textContent!==void 0){let i=Kf(e.textContent),a=me(e.textContent)||k(e.textContent)&&e.textContent.includes("${");return o&&a?`${i}${Wi}`:i}if(e.innerHTML!==void 0)return e.innerHTML;if(e.children)return n?Bf(e.children,e.style,"",!0,r,s,o):`
245
- ${Bf(e.children,e.style,`${t} `,!1,r,s,o)}
246
- ${t}`;return""}function AE(e,t){qo(e);let n=me(e.key),r=JSON.stringify(Array.isArray(e.items)?e.items:[]),s=n?`${Rl}(${JSON.stringify(r)})`:r;if(me(e.items))s=`(${xn(e.items.$ref)} ?? [])`;let o=me(e.filter)?xn(e.filter.$ref):"undefined",i=me(e.sort)?xn(e.sort.$ref):"undefined",a=me(e.filter)||me(e.sort),l=e.map;if(!l)return"";let c=l.tagName??"div",u=[],d=NE(l,Xt,Wf);if(l.attributes)for(let[E,j]of Object.entries(l.attributes)){if(E==="class"&&d!==null)continue;if(me(j))u.push(`${E}="\${${Wf(j.$ref)}}"`);else if(k(j)&&j.includes("${"))u.push(`${E}="${Xt(j)}"`);else u.push(`${E}="${j}"`)}if(l.id)u.push(`id="${Xt(String(l.id))}"`);if(d!==null)u.push(d);for(let[E,j]of Object.entries(l)){if(pr.has(E)||E.startsWith("$")||E.startsWith("on")||E==="tagName"||E==="id"||E==="className"||E==="style"||E==="children"||E==="textContent"||E==="innerHTML"||E==="attributes")continue;if(Uf(j))u.push(`.${E}="\${${Wf(j.$ref)}}"`);else if(k(j)&&j.includes("${"))u.push(`.${E}="${Xt(j)}"`);else u.push(`.${E}="\${${JSON.stringify(j)}}"`)}if(l.$props)for(let[E,j]of Object.entries(l.$props))if(me(j))u.push(`.${E}="\${${Wf(j.$ref)}}"`);else if(k(j)&&j.includes("${"))u.push(`.${E}="${Xt(j)}"`);else u.push(`.${E}="\${${JSON.stringify(j)}}"`);let p=JE(l.style);if(p)u.push(`style="${p}"`);for(let[E,j]of Object.entries(l)){if(!E.startsWith("on"))continue;ps(`inline "${E}" handler`,j);let A=E.slice(2).toLowerCase(),T=_y(j,"s.$map = $map; ");if(T!==null)u.push(`@${A}="\${${T}}"`)}let m=u.length>0?`
314
+ }[${a}]}`}if(e.textContent!==void 0){let i=nd(e.textContent),a=pe(e.textContent)||_(e.textContent)&&e.textContent.includes("${");return o&&a?`${i}${Yi}`:i}if(e.innerHTML!==void 0)return e.innerHTML;if(e.children)return n?Qf(e.children,e.style,"",!0,r,s,o):cf(Qf(e.children,e.style,`${t} `,!1,r,s,o),{close:`
315
+ ${t}`,lead:`${t} `,open:`
316
+ `});return""}function lj(e,t){Bo(e);let n=pe(e.key),r=JSON.stringify(Array.isArray(e.items)?e.items:[]),s=n?`${Ml}(${JSON.stringify(r)})`:r;if(pe(e.items))s=`(${Sn(e.items.$ref)} ?? [])`;let o=pe(e.filter)?Sn(e.filter.$ref):"undefined",i=pe(e.sort)?Sn(e.sort.$ref):"undefined",a=pe(e.filter)||pe(e.sort),l=e.map;if(!l)return"";let c=l.tagName??"div",u=[],d=fj(l,Qt,Zf);if(l.attributes)for(let[v,E]of Object.entries(l.attributes)){if(v==="class"&&d!==null)continue;if(pe(E))u.push(`${v}="\${${Zf(E.$ref)}}"`);else if(_(E)&&E.includes("${"))u.push(`${v}="${Qt(E)}"`);else u.push(`${v}="${E}"`)}if(l.id)u.push(`id="${Qt(String(l.id))}"`);if(d!==null)u.push(d);for(let[v,E]of Object.entries(l)){if(gr.has(v)||v.startsWith("$")||v.startsWith("on")||v==="tagName"||v==="id"||v==="className"||v==="style"||v==="children"||v==="textContent"||v==="innerHTML"||v==="attributes")continue;if(ed(E))u.push(`.${v}="\${${Zf(E.$ref)}}"`);else if(_(E)&&E.includes("${"))u.push(`.${v}="${Qt(E)}"`);else u.push(`.${v}="\${${JSON.stringify(E)}}"`)}if(l.$props)for(let[v,E]of Object.entries(l.$props))if(pe(E))u.push(`.${v}="\${${Zf(E.$ref)}}"`);else if(_(E)&&E.includes("${"))u.push(`.${v}="${Qt(E)}"`);else u.push(`.${v}="\${${JSON.stringify(E)}}"`);let p=pj(l.style);if(p)u.push(`style="${p}"`);for(let[v,E]of Object.entries(l)){if(!v.startsWith("on"))continue;ms(`inline "${v}" handler`,E);let O=v.slice(2).toLowerCase(),I=By(E,"s.$map = $map; ");if(I!==null)u.push(`@${O}="\${${I}}"`)}let m=u.length>0?`
247
317
  ${t} ${u.join(`
248
- ${t} `)}`:"",y=CE(),S="";if(l.textContent!==void 0)S=Kf(l.textContent);else if(l.children)S=`
249
- ${Bf(l.children,null,`${t} `,!1,!0,y)}
250
- ${t} `;let g=`html\`
318
+ ${t} `)}`:"",g=cj(),b="";if(l.textContent!==void 0)b=nd(l.textContent);else if(l.children)b=cf(Qf(l.children,null,`${t} `,!1,!0,g),{close:`
319
+ ${t} `,lead:`${t} `,open:`
320
+ `});let h=`html\`
251
321
  ${t} <${c}${m}
252
- ${t} >${S}</${c}>
253
- ${t}\``,x=(g.includes("$map")?"const $map = { item, index }; ":"")+y.decls.map((E)=>`${E.trim()} `).join(""),P=x?`(item, index) => { ${x}return ${g}; }`:`(item, index) => ${g}`;if(me(e.key)){let E=e.key.$ref,j=[s,o,i,JSON.stringify(bf(E)),JSON.stringify(E),P];return`${t}\${${Nl}(${j.join(", ")})}`}let w=a?`${qi}(${s}, ${o}, ${i})`:s;return`${t}\${${w}.map(${P})}`}function NE(e,t,n){if(!Jl(e))return null;let r=Ml(e),s="";if(me(r))s=`\${${n(r.$ref)} ?? ""}`;else if(k(r))s=t(r);else if(Ie(r))s=String(r);let o=Js(e)??"";return`class="${[s,o].filter((i)=>i!=="").join(" ")}"`}function Uf(e){return me(e)&&e.$ref!==""}function xn(e){let t=sn(e);if(t.startsWith("#/state/"))return Re("s",t.slice(8));if(t.startsWith("$map/"))return TE(t.slice(5));if(t.startsWith("parent#/"))return Re("s",t.slice(8));if(t.startsWith("window#/"))return Re("window",t.slice(8));if(t.startsWith("document#/"))return Re("document",t.slice(10));return Re("s",t)}function TE(e){let[t,...n]=Un(e);return Re(t??"",n.map((r)=>Wt(r)).join("/"))}function Wf(e){let t=sn(e);if(t.startsWith("$map/"))return TE(t.slice(5));return xn(t)}function Xt(e){return Fi(e,"s",{code:!1})}function Py(e){return e.startsWith("${")&&e.endsWith("}")&&!e.slice(2).includes("${")}function Kf(e){if(me(e))return`\${${xn(e.$ref)}}`;if(k(e)&&e.includes("${"))return Xt(e);return String(e)}function zf(e){let t=0,n="";for(let r=0;r<e.length;r++){let s=e.charAt(r);if(t===0){if(s==="$"&&e.charAt(r+1)==="{")t=1,n="",r+=1;continue}if(s==="{")t+=1;else if(s==="}"){if(t-=1,t===0){if(Vv(n))return!0;continue}}n+=s}return!1}function _y(e,t){if(Uf(e))return t?`(e) => { ${t}${xn(e.$ref)}(s, e); }`:`(e) => ${xn(e.$ref)}(s, e)`;if(D(e)&&"$expression"in e){let n=gn(e.$expression,{eventParam:"e",statePrefix:"s"});return`(e) => { ${t}${n}; }`}if(kt(e))return`(e) => { ${t}${jL(e)} }`;return null}function wL(e){let t=[];for(let[n,r]of Object.entries(e)){if(!n.startsWith("on")||pr.has(n))continue;ps(`root "${n}" handler`,r);let s=_y(r,"");if(s!==null)t.push({source:s,type:n.slice(2).toLowerCase()})}return t}function vL(e){let t=[],n=(r,s,o)=>[" this.#effects.push(effect(() => {",o?" const s = this.state, state = s;":" const s = this.state;",` const _v = ${Vo}(${r}, ${s});`,` if (_v === null || _v === undefined) this.removeAttribute(${r});`,` else this.setAttribute(${r}, String(_v));`," }));"];for(let[r,s]of Object.entries(e.attributes??{})){let o=JSON.stringify(r);if(me(s))t.push(...n(o,xn(s.$ref),!1));else if(k(s)&&Py(s)){let i=Xt(s);t.push(...n(o,i.slice(2,-1),zf(i)))}else if(k(s)&&s.includes("${")){let i=Xt(s);t.push(...n(o,`\`${i}\``,zf(i)))}else if(Ge(s)){let i=Rr(r,s);if(i!==null)t.push(` if (_first) this.setAttribute(${o}, ${JSON.stringify(i)});`)}else if(k(s)||Ie(s))t.push(` if (_first) this.setAttribute(${o}, ${JSON.stringify(String(s))});`)}return t}function EL(e){if(e===void 0)return"null";if(me(e))return`() => { const s = this.state; return ${xn(e.$ref)}; }`;if(k(e)&&e.includes("${")){let t=Xt(e);return`() => { const s = this.state, state = s; try { return ${Py(e)?t.slice(2,-1):`\`${t}\``}; } catch { return null; } }`}return`() => ${JSON.stringify(e)}`}function jL(e){if(vr(e))return zn(e.body,{dispatchTarget:"e.currentTarget",eventParam:"e",statePrefix:"s"});let t=k(e.body)?e.body:"";if(Xa(e))return`((${kr(e).join(", ")}) => { ${t}
254
- })(s, e);`;return`${Fi(t,"s",{bare:!0})}
255
- `}function JE(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=hn(n);t.push(`${s}: ${Xt(r)}`)}}return t.join("; ")}var xL;var Hl=J(()=>{Ei();Ti();$i();Mi();yn();ce();os();Sl();_i();xL=new Set(["state","template","constructor","connectedCallback","disconnectedCallback","adoptedCallback","attributeChangedCallback","formResetCallback","formDisabledCallback"])});function ME(e,t){let{title:n="Jx App"}=t,r=Li(e,null,e.state??{},e.$media??{}),s=Ui(e,e.$media??{},t.projectStyle??null),o=IE(e,r),i=[],a=t.prePaintScheme!==!1&&Object.values(e.$media??{}).some((c)=>fr(String(c))!==null)?`<script>${Vi()}</script>
322
+ ${t} >${b}</${c}>
323
+ ${t}\``,x=(h.includes("$map")?"const $map = { item, index }; ":"")+g.decls.map((v)=>`${v.trim()} `).join(""),k=x?`(item, index) => { ${x}return ${h}; }`:`(item, index) => ${h}`;if(pe(e.key)){let v=e.key.$ref,E=[s,o,i,JSON.stringify(jf(v)),JSON.stringify(v),k];return`${t}\${${Il}(${E.join(", ")})}`}let w=a?`${Gi}(${s}, ${o}, ${i})`:s;return`${t}\${${w}.map(${k})}`}function fj(e,t,n){if(!Ll(e))return null;let r=Fl(e),s="";if(pe(r))s=`\${${n(r.$ref)} ?? ""}`;else if(_(r))s=t(r);else if(De(r))s=String(r);let o=Ds(e)??"";return`class="${[s,o].filter((i)=>i!=="").join(" ")}"`}function ed(e){return pe(e)&&e.$ref!==""}function Sn(e){let t=an(e);if(t.startsWith("#/state/"))return Je("s",t.slice(8));if(t.startsWith("$map/"))return dj(t.slice(5));if(t.startsWith("parent#/"))return Je("s",t.slice(8));if(t.startsWith("window#/"))return Je("window",t.slice(8));if(t.startsWith("document#/"))return Je("document",t.slice(10));return Je("s",t)}function dj(e){let[t,...n]=Xn(e);return Je(t??"",n.map((r)=>Ut(r)).join("/"))}function Zf(e){let t=an(e);if(t.startsWith("$map/"))return dj(t.slice(5));return Sn(t)}function Qt(e){return zi(e,"s",{code:!1})}function Wy(e){return e.startsWith("${")&&e.endsWith("}")&&!e.slice(2).includes("${")}function nd(e){if(pe(e))return`\${${Sn(e.$ref)}}`;if(_(e)&&e.includes("${"))return Qt(e);return String(e)}function td(e){let t=0,n="";for(let r=0;r<e.length;r++){let s=e.charAt(r);if(t===0){if(s==="$"&&e.charAt(r+1)==="{")t=1,n="",r+=1;continue}if(s==="{")t+=1;else if(s==="}"){if(t-=1,t===0){if(h0(n))return!0;continue}}n+=s}return!1}function By(e,t){if(ed(e))return t?`(e) => { ${t}${Sn(e.$ref)}(s, e); }`:`(e) => ${Sn(e.$ref)}(s, e)`;if(F(e)&&"$expression"in e){let n=bn(e.$expression,{eventParam:"e",statePrefix:"s"});return`(e) => { ${t}${n}; }`}if(At(e))return`(e) => { ${t}${mF(e)} }`;return null}function fF(e){let t=[];for(let[n,r]of Object.entries(e)){if(!n.startsWith("on")||gr.has(n))continue;ms(`root "${n}" handler`,r);let s=By(r,"");if(s!==null)t.push({source:s,type:n.slice(2).toLowerCase()})}return t}function dF(e){let t=[],n=(r,s,o)=>[" this.#effects.push(effect(() => {",o?" const s = this.state, state = s;":" const s = this.state;",` const _v = ${Wo}(${r}, ${s});`,` if (_v === null || _v === undefined) this.removeAttribute(${r});`,` else this.setAttribute(${r}, String(_v));`," }));"];for(let[r,s]of Object.entries(e.attributes??{})){let o=JSON.stringify(r);if(pe(s))t.push(...n(o,Sn(s.$ref),!1));else if(_(s)&&Wy(s)){let i=Qt(s);t.push(...n(o,i.slice(2,-1),td(i)))}else if(_(s)&&s.includes("${")){let i=Qt(s);t.push(...n(o,`\`${i}\``,td(i)))}else if(Xe(s)){let i=Rr(r,s);if(i!==null)t.push(` if (_first) this.setAttribute(${o}, ${JSON.stringify(i)});`)}else if(_(s)||De(s))t.push(` if (_first) this.setAttribute(${o}, ${JSON.stringify(String(s))});`)}return t}function pF(e){if(e===void 0)return"null";if(pe(e))return`() => { const s = this.state; return ${Sn(e.$ref)}; }`;if(_(e)&&e.includes("${")){let t=Qt(e);return`() => { const s = this.state, state = s; try { return ${Wy(e)?t.slice(2,-1):`\`${t}\``}; } catch { return null; } }`}return`() => ${JSON.stringify(e)}`}function mF(e){if(vr(e))return Yn(e.body,{dispatchTarget:"e.currentTarget",eventParam:"e",statePrefix:"s"});let t=_(e.body)?e.body:"";if(al(e))return`((${Or(e).join(", ")}) => { ${t}
324
+ })(s, e);`;return`${zi(t,"s",{bare:!0})}
325
+ `}function pj(e){if(!F(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(_(r)&&r.includes("${")){let s=xn(n);t.push(`${s}: ${Qt(r)}`)}}return t.join("; ")}var aF;var zl=M(()=>{Hi();Ai();Fi();Pi();qi();$n();ae();os();Pl();Ti();aF=new Set(["state","template","constructor","connectedCallback","disconnectedCallback","adoptedCallback","attributeChangedCallback","formResetCallback","formDisabledCallback"])});function mj(e,t){let{title:n="Jx App"}=t,r=Ui(e,null,e.state??{},e.$media??{}),s=Qi(e,e.$media??{},t.projectStyle??null),o=hj(e,r),i=[],a=t.prePaintScheme!==!1&&Object.values(e.$media??{}).some((c)=>mr(String(c))!==null)?`<script>${Ki()}</script>
256
326
  `:"",l=`<!DOCTYPE html>
257
327
  <html lang="en">
258
328
  <head>
259
329
  <meta charset="utf-8">
260
330
  <meta name="viewport" content="width=device-width, initial-scale=1">
261
- <title>${Ne(n)}</title>
331
+ <title>${Me(n)}</title>
262
332
  ${a}
263
333
  ${s}
264
334
  </head>
265
335
  <body>
266
336
  ${o}
267
337
  </body>
268
- </html>`;return{files:i,html:l}}function IE(e,t){if(k(e))return Ne(e);if(Ie(e)||Ge(e))return Ne(String(e));if(!D(e))return"";let n=Li(e,t.scope,e.state??t.scopeDefs,e.$media??t.media),r=Il(e.tagName,n.scope),s=Lo(e,n.scope);if(Yg.has(r))return`<${r}${s}>`;let o=t.preformatted===!0||ms.has(r),i=PL(e,r,{...n,preformatted:o});return`<${r}${s}>${i}</${r}>`}function PL(e,t,n){if(e.textContent!==void 0){let s=tt(e.textContent,n.scope);return s==null?"":Ne(String(s))}if(e.innerHTML){if(Di(e))return e.innerHTML;let s=tt(e.innerHTML,n.scope);return s==null?e.innerHTML:String(s)}let r=Al(e,t,n.scope);if(r!==void 0)return r;if(Array.isArray(e.children))return e.children.map((s)=>IE(s,n)).join(Cl(n.preformatted));return""}var DE=J(()=>{yn();ce()});function Ry(e,t){let{title:n="Jx App",reactivitySrc:r=Ts,litHtmlSrc:s=Nr,modulePath:o="app.js",serverBaseUrl:i="/_jx/server"}=t,a=Li(e,null,e.state??{},e.$media??{}),l=Or(e),c=Ui(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=[],y=[],S=[],g=[],x=[],P=[],w=e.state??{},E=Pf(w,t.resolveClass);for(let[O,N]of Object.entries(w)){if(!D(N)||Array.isArray(N)){if(le(N))y.push([O,`() => ${gf(N)}`]);else m.push([O,N]);continue}if(fn(N)){let G=N.$expression,Q=gn(G,{eventParam:"e",statePrefix:"state"});if(wr(N))x.push(`state[${JSON.stringify(O)}] = ${kl(N,Q)};`);else if(dr(G.operator))g.push([O,{args:["state","e"],body:Q}]);else y.push([O,`() => ${Q}`]);continue}if(kt(N)){let{body:G}=N;if(Array.isArray(G)){let Q=zn(G,{eventParam:"e",statePrefix:"state"});if(N.parameters&&N.parameters.length>0)x.push(`state[${JSON.stringify(O)}] = ${kl(N,`(() => {
269
- ${Q}
270
- })()`)};`);else g.push([O,{args:["state","e"],body:Q}])}else if(N.$src)if(l.get(O)==="computed")y.push([O,`() => { return ${O}(state); }`]);else x.push(`state[${JSON.stringify(O)}] = ${O};`),g.push([O,{args:["state","event"],body:`return ${O}(state, event);`}]);else if(k(G)&&l.get(O)==="computed")y.push([O,`() => { ${G} }`]);else g.push([O,{args:kr(N),body:G}]);continue}if($s(N))continue;if(jc(N)){m.push([O,N.default]);continue}if(Pn(N)){if(N.$prototype==="LocalStorage"||N.$prototype==="SessionStorage"){let G=N.$prototype==="LocalStorage"?"localStorage":"sessionStorage",Q=N.key??O,re=N.default??null;m.push([O,null]),x.push(AL(O,G,Q,re));continue}if(N.$prototype==="Request"){m.push([O,null]),x.push(cf(O,N));continue}if(N.$prototype==="Cookie"){m.push([O,null]),x.push(CL(O,N.name??O,N.default??null));continue}if(Hi(N)){m.push([O,null]);continue}}if(Zr(N)){m.push([O,null]),P.push(uf(O,N,{serverBaseUrl:i}));continue}m.push([O,N])}let j=LE(e,a,d,p,u);for(let[O,N]of d)if(!S.some(([G])=>G===O))S.push([O,N]);for(let[O,N]of p)if(!g.some(([G])=>G===O))g.push([O,N]);let A=mf(w,l),T=OL(m,y,S,g,x,P,A,u,r,t.rewriteSrc,E,xf(e)),I=Ii({litHtmlSrc:s,reactivitySrc:r,runtimeImports:t.runtimeImports}),V=t.prePaintScheme!==!1&&Object.values(e.$media??{}).some((O)=>fr(String(O))!==null)?`<script>${Vi()}</script>
271
- `:"",H=`<!DOCTYPE html>
338
+ </html>`;return{files:i,html:l}}function hj(e,t){if(_(e))return Me(e);if(De(e)||Xe(e))return Me(String(e));if(!F(e))return"";let n=Ui(e,t.scope,e.state??t.scopeDefs,e.$media??t.media),r=Vl(e.tagName,n.scope),s=qo(e,n.scope);if(py.has(r))return`<${r}${s}>`;let o=t.preformatted===!0||hs.has(r),i=hF(e,r,{...n,preformatted:o});return`<${r}${s}>${i}</${r}>`}function hF(e,t,n){if(e.textContent!==void 0){let s=rt(e.textContent,n.scope);return s==null?"":Me(String(s))}if(e.innerHTML){if(Bi(e))return e.innerHTML;let s=rt(e.innerHTML,n.scope);return s==null?e.innerHTML:String(s)}let r=Jl(e,t,n.scope);if(r!==void 0)return r;if(Array.isArray(e.children))return Kt(e.children.map((s)=>hj(s,n)),{preformatted:n.preformatted});return""}var gj=M(()=>{Hi();$n();ae()});function Xy(e,t){let{title:n="Jx App",reactivitySrc:r=Is,litHtmlSrc:s=Tr,modulePath:o="app.js",serverBaseUrl:i="/_jx/server"}=t,a=Ui(e,null,e.state??{},e.$media??{}),l=Ar(e),c=Qi(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=[],g=[],b=[],h=[],x=[],k=[],w=e.state??{},v=Rf(w,t.resolveClass);for(let[A,J]of Object.entries(w)){if(!F(J)||Array.isArray(J)){if(ce(J))g.push([A,`() => ${wf(J)}`]);else m.push([A,J]);continue}if(pn(J)){let G=J.$expression,se=bn(G,{eventParam:"e",statePrefix:"state"});if(wr(J))x.push(`state[${JSON.stringify(A)}] = ${Tl(J,se)};`);else if(hr(G.operator))h.push([A,{args:["state","e"],body:se}]);else g.push([A,`() => ${se}`]);continue}if(At(J)){let{body:G}=J;if(Array.isArray(G)){let se=Yn(G,{eventParam:"e",statePrefix:"state"});if(J.parameters&&J.parameters.length>0)x.push(`state[${JSON.stringify(A)}] = ${Tl(J,`(() => {
339
+ ${se}
340
+ })()`)};`);else h.push([A,{args:["state","e"],body:se}])}else if(J.$src)if(l.get(A)==="computed")g.push([A,`() => { return ${A}(state); }`]);else x.push(`state[${JSON.stringify(A)}] = ${A};`),h.push([A,{args:["state","event"],body:`return ${A}(state, event);`}]);else if(_(G)&&l.get(A)==="computed")g.push([A,`() => { ${G} }`]);else h.push([A,{args:Or(J),body:G}]);continue}if(vs(J))continue;if(Oc(J)){m.push([A,J.default]);continue}if(An(J)){if(J.$prototype==="LocalStorage"||J.$prototype==="SessionStorage"){let G=J.$prototype==="LocalStorage"?"localStorage":"sessionStorage",se=J.key??A,ie=J.default??null;m.push([A,null]),x.push(bF(A,G,se,ie));continue}if(J.$prototype==="Request"){m.push([A,null]),x.push(hf(A,J));continue}if(J.$prototype==="Cookie"){m.push([A,null]),x.push($F(A,J.name??A,J.default??null));continue}if(Xi(J)){m.push([A,null]);continue}}if(Zr(J)){m.push([A,null]),k.push(gf(A,J,{serverBaseUrl:i}));continue}m.push([A,J])}let E=yj(e,a,d,p,u);for(let[A,J]of d)if(!b.some(([G])=>G===A))b.push([A,J]);for(let[A,J]of p)if(!h.some(([G])=>G===A))h.push([A,J]);let O=$f(w,l),I=xF(m,g,b,h,x,k,O,u,r,t.rewriteSrc,v,Ef(e)),D=Wi({litHtmlSrc:s,reactivitySrc:r,runtimeImports:t.runtimeImports}),V=t.prePaintScheme!==!1&&Object.values(e.$media??{}).some((A)=>mr(String(A))!==null)?`<script>${Ki()}</script>
341
+ `:"",W=`<!DOCTYPE html>
272
342
  <html lang="en">
273
343
  <head>
274
344
  <meta charset="utf-8">
275
345
  <meta name="viewport" content="width=device-width, initial-scale=1">
276
- <title>${Ne(n)}</title>
277
- ${V}${I}
346
+ <title>${Me(n)}</title>
347
+ ${V}${D}
278
348
  ${c}
279
349
  <script type="module" src="./${o}"></script>
280
350
  </head>
281
351
  <body>
282
- ${j}
352
+ ${E}
283
353
  </body>
284
- </html>`;return{files:[{content:T,path:o}],html:H}}function LE(e,t,n,r,s){if(k(e)){if(!le(e))return Ne(e);let g=`_t${s.t}`;s.t+=1,s.textParts=!0,n.set(g,`() => \`${e}\``);let x=tt(e,t.scope),P=x==null?"":Ne(String(x));return`<!--jx-text:${g}-->${P}<!--/jx-text-->`}if(Ie(e)||Ge(e))return Ne(String(e));if(!D(e))return"";let o=Li(e,t.scope,e.state??t.scopeDefs,e.$media??t.media);if(rr(e.tagName))throw Error(`A tag chosen at creation is not supported on a dynamic page yet (candidates: ${Yo(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||ms.has(i);let a=[],l=!1;if(e.textContent!==void 0){let g=e.textContent;if(Xe(g)){let x=Wl(g.$ref);a.push(`:text-content="${x}"`),Oy(n,x,g.$ref),l=!0}else if(le(g)){let x=`_t${s.t}`;s.t+=1,a.push(`:text-content="${x}"`),n.set(x,`() => \`${g}\``),l=!0}}for(let[g,x]of Object.entries(e)){if(!g.startsWith("on")||g==="observedAttributes")continue;ps(`inline "${g}" handler`,x);let P=g.slice(2).toLowerCase();if(Xe(x)){let w=Wl(x.$ref);a.push(`@${P}="${w}"`),l=!0}else if(kt(x)){let w=`_h${s.h}`;s.h+=1,a.push(`@${P}="${w}"`);let{body:E}=x;r.set(w,Array.isArray(E)?{args:["state","e"],body:zn(E,{eventParam:"e",statePrefix:"state"})}:{args:Xa(x)?kr(x):["state","event"],body:E}),l=!0}else if(fn(x)){let w=`_h${s.h}`;s.h+=1,a.push(`@${P}="${w}"`);let E=gn(x.$expression,{eventParam:"e",statePrefix:"state"});r.set(w,{args:["state","e"],body:E}),l=!0}}if(D(e.style))for(let[g,x]of Object.entries(e.style)){if(g.startsWith(":")||g.startsWith(".")||g.startsWith("&")||g.startsWith("[")||g.startsWith("@"))continue;if(HE(x))continue;if(le(x)){let P=`_s${s.s}`;s.s+=1,a.push(`:style.${hn(g)}="${P}"`),n.set(P,`() => \`${x}\``),l=!0}}if(D(e.attributes))for(let[g,x]of Object.entries(e.attributes)){let P=g==="class"?Js(e):void 0;if(P!==void 0&&(Xe(x)||le(x))){let w=`_t${s.t}`;s.t+=1;let E=Xe(x)?Cy(x.$ref):`\`${x}\``;a.push(`:attr.class="${w}"`),n.set(w,`() => [${E}, ${JSON.stringify(P)}].filter((c) => c != null && c !== "").join(" ")`),l=!0;continue}if(Xe(x)){let w=Wl(x.$ref);a.push(`:attr.${g}="${w}"`),Oy(n,w,x.$ref),l=!0}else if(le(x)){let w=`_t${s.t}`;s.t+=1,a.push(`:attr.${g}="${w}"`),n.set(w,`() => \`${x}\``),l=!0}}for(let[g,x]of Object.entries(e)){if(pr.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(Xe(x)){let P=Wl(x.$ref);a.push(`:${hn(g)}="${P}"`),Oy(n,P,x.$ref),l=!0}else if(le(x)){let P=`_t${s.t}`;s.t+=1,a.push(`:${hn(g)}="${P}"`),n.set(P,`() => \`${x}\``),l=!0}}let c=Lo(e,o.scope),u=l?" 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 x=Xe(m.$switch)?Cy(m.$switch.$ref):`\`${String(m.$switch)}\``,P=m.cases??{},w=Object.entries(P).filter(([,j])=>j&&!Xe(j)).map(([j,A])=>`${JSON.stringify(j)}: html\`${Ay(A,o.preformatted)}\``);n.set(g,`() => ({${w.join(", ")}})[String(${x})] ?? html\`\``),a.push(`:render="${g}"`);let E=` ${a.join(" ")}`;return`<${i}${c} data-bind${E}></${i}>`}let y=Al(m,i,o.scope);if(m.textContent!==void 0&&!l){let g=tt(m.textContent,o.scope);p=g==null?"":Ne(String(g))}else if(m.textContent!==void 0&&l){let g=tt(m.textContent,o.scope);p=g==null?"":Ne(String(g))}else if(m.innerHTML){let g=Di(m)?m.innerHTML:tt(m.innerHTML,o.scope);p=g==null?m.innerHTML:String(g)}else if(y!==void 0)p=y;else if(Le(m.children)){s.needsLit=!0;let g=`_list${s.l}`;s.l+=1;let x=m.children;n.set(g,`() => ${qE(x)}`),a.push(`:render="${g}"`),l=!0;let P=" data-bind",w=` ${a.join(" ")}`;if(new Set(["input","br","hr","img","meta","link"]).has(i))return`<${i}${c}${P}${w}>`;return`<${i}${c}${P}${w}></${i}>`}else if(Array.isArray(m.children)&&m.children.some((g)=>Le(g))){s.needsLit=!0;let g=`_children${s.l}`;s.l+=1;let x=m.children.map((w)=>Ay(w,o.preformatted)).join(Cl(o.preformatted," "));n.set(g,o.preformatted?`() => html\`${x}\``:`() => html\`
354
+ </html>`;return{files:[{content:I,path:o}],html:W}}function yj(e,t,n,r,s){if(_(e)){if(!ce(e))return Me(e);let h=`_t${s.t}`;s.t+=1,s.textParts=!0,n.set(h,`() => \`${e}\``);let x=rt(e,t.scope),k=x==null?"":Me(String(x));return`<!--jx-text:${h}-->${k}<!--/jx-text-->`}if(De(e)||Xe(e))return Me(String(e));if(!F(e))return"";let o=Ui(e,t.scope,e.state??t.scopeDefs,e.$media??t.media);if(ir(e.tagName))throw Error(`A tag chosen at creation is not supported on a dynamic page yet (candidates: ${ri(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||hs.has(i);let a=[],l=!1;if(e.textContent!==void 0){let h=e.textContent;if(Ye(h)){let x=Kl(h.$ref);a.push(`:text-content="${x}"`),zy(n,x,h.$ref),l=!0}else if(ce(h)){let x=`_t${s.t}`;s.t+=1,a.push(`:text-content="${x}"`),n.set(x,`() => \`${h}\``),l=!0}}for(let[h,x]of Object.entries(e)){if(!h.startsWith("on")||h==="observedAttributes")continue;ms(`inline "${h}" handler`,x);let k=h.slice(2).toLowerCase();if(Ye(x)){let w=Kl(x.$ref);a.push(`@${k}="${w}"`),l=!0}else if(At(x)){let w=`_h${s.h}`;s.h+=1,a.push(`@${k}="${w}"`);let{body:v}=x;r.set(w,Array.isArray(v)?{args:["state","e"],body:Yn(v,{eventParam:"e",statePrefix:"state"})}:{args:al(x)?Or(x):["state","event"],body:v}),l=!0}else if(pn(x)){let w=`_h${s.h}`;s.h+=1,a.push(`@${k}="${w}"`);let v=bn(x.$expression,{eventParam:"e",statePrefix:"state"});r.set(w,{args:["state","e"],body:v}),l=!0}}if(F(e.style))for(let[h,x]of Object.entries(e.style)){if(h.startsWith(":")||h.startsWith(".")||h.startsWith("&")||h.startsWith("[")||h.startsWith("@"))continue;if(Sj(x))continue;if(ce(x)){let k=`_s${s.s}`;s.s+=1,a.push(`:style.${xn(h)}="${k}"`),n.set(k,`() => \`${x}\``),l=!0}}if(F(e.attributes))for(let[h,x]of Object.entries(e.attributes)){let k=h==="class"?Ds(e):void 0;if(k!==void 0&&(Ye(x)||ce(x))){let w=`_t${s.t}`;s.t+=1;let v=Ye(x)?Gy(x.$ref):`\`${x}\``;a.push(`:attr.class="${w}"`),n.set(w,`() => [${v}, ${JSON.stringify(k)}].filter((c) => c != null && c !== "").join(" ")`),l=!0;continue}if(Ye(x)){let w=Kl(x.$ref);a.push(`:attr.${h}="${w}"`),zy(n,w,x.$ref),l=!0}else if(ce(x)){let w=`_t${s.t}`;s.t+=1,a.push(`:attr.${h}="${w}"`),n.set(w,`() => \`${x}\``),l=!0}}for(let[h,x]of Object.entries(e)){if(gr.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(Ye(x)){let k=Kl(x.$ref);a.push(`:${xn(h)}="${k}"`),zy(n,k,x.$ref),l=!0}else if(ce(x)){let k=`_t${s.t}`;s.t+=1,a.push(`:${xn(h)}="${k}"`),n.set(k,`() => \`${x}\``),l=!0}}let c=qo(e,o.scope),u=l?" 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 x=Ye(m.$switch)?Gy(m.$switch.$ref):`\`${String(m.$switch)}\``,k=m.cases??{},w=Object.entries(k).filter(([,E])=>E&&!Ye(E)).map(([E,O])=>`${JSON.stringify(E)}: html\`${Ky(O,o.preformatted)}\``);n.set(h,`() => ({${w.join(", ")}})[String(${x})] ?? html\`\``),a.push(`:render="${h}"`);let v=` ${a.join(" ")}`;return`<${i}${c} data-bind${v}></${i}>`}let g=Jl(m,i,o.scope);if(m.textContent!==void 0&&!l){let h=rt(m.textContent,o.scope);p=h==null?"":Me(String(h))}else if(m.textContent!==void 0&&l){let h=rt(m.textContent,o.scope);p=h==null?"":Me(String(h))}else if(m.innerHTML){let h=Bi(m)?m.innerHTML:rt(m.innerHTML,o.scope);p=h==null?m.innerHTML:String(h)}else if(g!==void 0)p=g;else if(Le(m.children)){s.needsLit=!0;let h=`_list${s.l}`;s.l+=1;let x=m.children;n.set(h,`() => ${$j(x)}`),a.push(`:render="${h}"`),l=!0;let k=" data-bind",w=` ${a.join(" ")}`;if(new Set(["input","br","hr","img","meta","link"]).has(i))return`<${i}${c}${k}${w}>`;return`<${i}${c}${k}${w}></${i}>`}else if(Array.isArray(m.children)&&m.children.some((h)=>Le(h))){s.needsLit=!0;let h=`_children${s.l}`;s.l+=1;let x=Kt(m.children.map((w)=>Ky(w,o.preformatted)),{preformatted:o.preformatted,separator:`
355
+ `});n.set(h,o.preformatted?`() => html\`${x}\``:`() => html\`
285
356
  ${x}
286
- \``),a.push(`:render="${g}"`),l=!0;let P=` ${a.join(" ")}`;return`<${i}${c} data-bind${P}></${i}>`}else if(Array.isArray(m.children)){if(_L.has(i)&&m.children.some((g)=>le(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)=>LE(g,o,n,r,s)).join(Cl(o.preformatted))}if(new Set(["input","br","hr","img","meta","link"]).has(i))return`<${i}${c}${u}${d}>`;return`<${i}${c}${u}${d}>${p}</${i}>`}function FE(e,t=!1){if(!e)return"";if(rr(e.tagName))throw Error(`A tag chosen at creation is not supported inside a dynamic page's repeater yet (candidates: ${Yo(e.tagName).join(", ")}). Move the item into a component, or give it a literal tagName.`);let n=e.tagName??"div",r=t||ms.has(n),s="";if(e.id)s+=` id="${e.id}"`;let o=Jl(e);if(o){let c=Ml(e),u="";if(Xe(c))u=`\${${Xi(c.$ref)} ?? ""}`;else if(k(c))u=Is(c);else if(Ie(c))u=String(c);let d=[u,Js(e)??""].filter((p)=>p!=="").join(" ");s+=` class="${d}"`}if(D(e.$props))for(let[c,u]of Object.entries(e.$props))if(Xe(u))s+=` .${c}="\${${Xi(u.$ref)}}"`;else if(le(u))s+=` .${c}="${Is(u)}"`;else s+=` .${c}="\${${JSON.stringify(u)}}"`;if(D(e.attributes))for(let[c,u]of Object.entries(e.attributes)){if(o&&c==="class")continue;if(le(u)){s+=` ${c}="${Is(u)}"`;continue}if(Xe(u)){s+=` ${c}="\${${Xi(u.$ref)}}"`;continue}if(Ge(u)){let d=Rr(c,u);if(d!==null)s+=d===""?` ${c}`:` ${c}="${Ne(d)}"`;continue}s+=` ${c}="${Ne(String(u))}"`}if(D(e.style)){let c=[];for(let[u,d]of Object.entries(e.style)){if(u.startsWith(":")||u.startsWith(".")||u.startsWith("&")||u.startsWith("[")||u.startsWith("@"))continue;if(HE(d))continue;if(le(String(d)))c.push(`${hn(u)}: ${Is(String(d))}`)}if(c.length>0)s+=` style="${c.join("; ")}"`}for(let[c,u]of Object.entries(e)){if(!c.startsWith("on")||c==="observedAttributes")continue;ps(`inline "${c}" handler`,u);let d=c.slice(2).toLowerCase();if(Xe(u)){let p=Wl(u.$ref);s+=` @${d}=\${(e) => { state.$map = { item, index }; on.${p}(e); }}`}else if(vr(u)){let p=zn(u.body,{eventParam:"e",statePrefix:"state"});s+=` @${d}=\${(e) => { state.$map = { item, index }; ${p} }}`}else if(kt(u)){let p=kL(u.body),m=Xa(u)?`((${kr(u).join(", ")}) => { ${p}
357
+ \``),a.push(`:render="${h}"`),l=!0;let k=` ${a.join(" ")}`;return`<${i}${c} data-bind${k}></${i}>`}else if(Array.isArray(m.children)){if(gF.has(i)&&m.children.some((h)=>ce(h)))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=Kt(m.children.map((h)=>yj(h,o,n,r,s)),{preformatted:o.preformatted})}if(new Set(["input","br","hr","img","meta","link"]).has(i))return`<${i}${c}${u}${d}>`;return`<${i}${c}${u}${d}>${p}</${i}>`}function xj(e,t=!1){if(!e)return"";if(ir(e.tagName))throw Error(`A tag chosen at creation is not supported inside a dynamic page's repeater yet (candidates: ${ri(e.tagName).join(", ")}). Move the item into a component, or give it a literal tagName.`);let n=e.tagName??"div",r=t||hs.has(n),s="";if(e.id)s+=` id="${e.id}"`;let o=Ll(e);if(o){let c=Fl(e),u="";if(Ye(c))u=`\${${ra(c.$ref)} ?? ""}`;else if(_(c))u=Fs(c);else if(De(c))u=String(c);let d=[u,Ds(e)??""].filter((p)=>p!=="").join(" ");s+=` class="${d}"`}if(F(e.$props))for(let[c,u]of Object.entries(e.$props))if(Ye(u))s+=` .${c}="\${${ra(u.$ref)}}"`;else if(ce(u))s+=` .${c}="${Fs(u)}"`;else s+=` .${c}="\${${JSON.stringify(u)}}"`;if(F(e.attributes))for(let[c,u]of Object.entries(e.attributes)){if(o&&c==="class")continue;if(ce(u)){s+=` ${c}="${Fs(u)}"`;continue}if(Ye(u)){s+=` ${c}="\${${ra(u.$ref)}}"`;continue}if(Xe(u)){let d=Rr(c,u);if(d!==null)s+=d===""?` ${c}`:` ${c}="${Me(d)}"`;continue}s+=` ${c}="${Me(String(u))}"`}if(F(e.style)){let c=[];for(let[u,d]of Object.entries(e.style)){if(u.startsWith(":")||u.startsWith(".")||u.startsWith("&")||u.startsWith("[")||u.startsWith("@"))continue;if(Sj(d))continue;if(ce(String(d)))c.push(`${xn(u)}: ${Fs(String(d))}`)}if(c.length>0)s+=` style="${c.join("; ")}"`}for(let[c,u]of Object.entries(e)){if(!c.startsWith("on")||c==="observedAttributes")continue;ms(`inline "${c}" handler`,u);let d=c.slice(2).toLowerCase();if(Ye(u)){let p=Kl(u.$ref);s+=` @${d}=\${(e) => { state.$map = { item, index }; on.${p}(e); }}`}else if(vr(u)){let p=Yn(u.body,{eventParam:"e",statePrefix:"state"});s+=` @${d}=\${(e) => { state.$map = { item, index }; ${p} }}`}else if(At(u)){let p=yF(u.body),m=al(u)?`((${Or(u).join(", ")}) => { ${p}
287
358
  })(state, e);`:`${p}
288
- `;s+=` @${d}=\${(e) => { state.$map = { item, index }; ${m}}}`}else if(D(u)&&"$expression"in u){let p=gn(u.$expression,{eventParam:"e",statePrefix:"state"});s+=` @${d}=\${(e) => { state.$map = { item, index }; ${p}; }}`}}for(let[c,u]of Object.entries(e)){if(pr.has(c)||c.startsWith("$")||c.startsWith("on")||c==="tagName"||c==="id"||c==="className"||c==="style"||c==="children"||c==="textContent"||c==="innerHTML"||c==="attributes")continue;if(Xe(u))s+=` .${c}="\${${Xi(u.$ref)}}"`;else if(le(u))s+=` .${c}="${Is(u)}"`;else s+=` .${c}="\${${JSON.stringify(u)}}"`}let i=n.includes("-")?Wi:"",a="";if(e.textContent!==void 0){let c=String(e.textContent);if(le(c))a=`${Is(c)}${i}`;else if(Xe(e.textContent))a=`\${${Xi(e.textContent.$ref)}}${i}`;else a=Ne(c)}else if(e.innerHTML)a=Is(String(e.innerHTML));else if(Le(e.children))a=`
289
- ${VE(e.children)}${i}
290
- `;else if(Array.isArray(e.children)){let c=e.children.map((u)=>{let d=Ay(u,r);return Le(u)||k(u)&&le(u)?`${d}${i}`:d});a=r?c.join(""):`
291
- ${c.join(`
292
- `)}
293
- `}if(new Set(["input","br","hr","img","meta","link"]).has(n))return`<${n}${s}>`;return`<${n}${s}>${a}</${n}>`}function Ay(e,t=!1){if(k(e))return le(e)?Is(e):Ne(e);if(Ie(e)||Ge(e))return Ne(String(e));if(Le(e))return VE(e);return FE(e,t)}function VE(e){return`\${${qE(e)}}`}function ky(e){return sn(e).startsWith("$map/")?Xi(e):Cy(e)}function qE(e){qo(e);let{items:t,filter:n,sort:r,key:s}=e,o=Xe(s),i=JSON.stringify(t??[]),a=o?`${Rl}(${JSON.stringify(i)})`:i;if(Xe(t))a=ky(t.$ref);let l=Xe(n)?ky(n.$ref):"undefined",c=Xe(r)?ky(r.$ref):"undefined",u=`(item, index) => html\`${FE(e.map)}\``;if(o){let d=s.$ref,p=[`(${a} ?? [])`,l,c,JSON.stringify(bf(d)),JSON.stringify(d),u];return`${Nl}(${p.join(", ")})`}if(Xe(n)||Xe(r))return`${qi}(${a}, ${l}, ${c}).map(${u})`;return`(${a} ?? []).map(${u})`}function Is(e){return e.replaceAll("$map.","")}function kL(e){return e.replaceAll(/(?<![\w$.])\$map\./gu,"")}function OL(e,t,n,r,s,o,i,a,l,c,u,d){let p=[],{needsLit:m,textParts:y}=a,S=t.length>0;p.push("// Generated by @jxsuite/compiler — do not edit manually");let g=["reactive","effect"];if(S)g.push("computed");if(d.keyed)g.push("stop","shallowRef");if(p.push(`import { ${g.join(", ")} } from '@vue/reactivity';`),m)p.push("import { html, render } from 'lit-html';");if(d.keyed)p.push(...Sf);let x=hf(i,c);if(p.push(...x.imports,...u.imports,...x.loaders,"",yf()),d.arranged||d.keyed)p.push($f());if(d.keyed)p.push(wf());if(o.length>0)p.push("",Ef());let P=u.entries.length>0;if(P)p.push("",jf(),"const _jxInstances = new Map();");p.push("","const state = reactive({");for(let[w,E]of e)p.push(` ${us(w)}: ${JSON.stringify(E)},`);if(p.push("});",""),s.length>0){for(let w of s)p.push(w);p.push("")}if(t.length>0){for(let[w,E]of t)p.push(`${Re("state",Wt(w))} = computed(${E});`);p.push("")}if(o.length>0){for(let w of o)p.push(w);p.push("")}if(n.length>0){p.push("const bind = {");for(let[w,E]of n)p.push(` ${us(w)}: ${E},`);p.push("};")}else p.push("const bind = {};");if(p.push(""),r.length>0){p.push("const on = {");for(let[w,E]of r)p.push(` ${us(w)}: (e) => { const fn = (${E.args.join(", ")}) => { ${E.body}
294
- }; fn(state, e); },`);p.push("};")}else p.push("const on = {};");if(p.push("","function hydrate(root) {"),y)p.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(p.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;"),m)p.push(" if (parts[0] === 'render') {"," effect(() => { render(bind[key](), el); });"," } else if (parts[0] === 'style' && parts.length > 1) {");else p.push(" if (parts[0] === 'style' && parts.length > 1) {");if(p.push(" effect(() => { el.style[parts[1]] = bind[key](); });"," } else if (parts[0] === 'attr' && parts.length > 1) {"," effect(() => {",` const _t = ${Vo}(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]);"," }"," });"," });"),y)p.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(p.push("}",""),P)p.push(`await ${_f(u.entries,{indent:"",instances:"_jxInstances",statePrefix:"state"})};`);return p.push("hydrate(document);",""),p.join(`
295
- `)}function AL(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(`
296
- `)}function CL(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(`
297
- `)}function HE(e){return e===null||D(e)}function Xi(e){let t=sn(e);if(t.startsWith("$map/")){let[n,...r]=Un(t.slice(5));return Re(n??"",r.map((s)=>Wt(s)).join("/"))}if(t.startsWith("#/state/"))return Re("state",t.slice(8));return Re("state",t)}function Cy(e){return lv("state",e.startsWith("#/state/")?e.slice(8):e)}function Wl(e){return cv(e.startsWith("#/state/")?e.slice(8):e)}function Oy(e,t,n){if(e.has(t))return;e.set(t,`() => ${Re("state",n.startsWith("#/state/")?n.slice(8):n)}`)}var _L;var Ny=J(()=>{$i();Mi();yn();ce();_i();_L=new Set(["script","style","textarea","title"])});function RL(e,t){if(t.routing==="prefix-except-default"&&e===t.defaultLocale)return"/";return`/${e.toLowerCase()}/`}function WE(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,RL(s,e)])));return`
298
- // ─── Locale negotiation (RFC 4647 Lookup over Accept-Language) ───────────────
299
- const JX_LOCALES = ${t}
300
- const JX_DEFAULT_LOCALE = ${n}
301
- const JX_LOCALE_HOMES = ${r}
302
-
303
- function jxParseAcceptLanguage(header) {
304
- const parsed = []
305
- header.split(',').forEach((part, index) => {
306
- const [rawRange, ...params] = part.split(';')
307
- const range = (rawRange || '').trim().toLowerCase()
308
- if (range === '') return
309
- let quality = 1
310
- for (const param of params) {
311
- const [name, value] = param.split('=')
312
- if ((name || '').trim().toLowerCase() === 'q') {
313
- const q = Number((value || '').trim())
314
- quality = Number.isNaN(q) ? 0 : q
315
- }
316
- }
317
- if (quality <= 0) return
318
- parsed.push({ at: index, quality, range })
319
- })
320
- return parsed.sort((a, b) => b.quality - a.quality || a.at - b.at).map((p) => p.range)
321
- }
322
-
323
- function jxLookupRange(range, available) {
324
- let candidate = range
325
- while (candidate !== '') {
326
- const wanted = candidate
327
- const match = available.find((tag) => tag.toLowerCase() === wanted)
328
- if (match !== undefined) return match
329
- const cut = candidate.lastIndexOf('-')
330
- if (cut === -1) return null
331
- candidate = candidate.slice(0, cut)
332
- const previous = candidate.lastIndexOf('-')
333
- if (candidate.length - previous === 2) candidate = candidate.slice(0, previous)
334
- }
335
- return null
336
- }
337
-
338
- function jxNegotiateLocale(header, available, fallback) {
339
- if (typeof header !== 'string' || header.trim() === '') return fallback
340
- for (const range of jxParseAcceptLanguage(header)) {
341
- if (range === '*') return available[0] || fallback
342
- const match = jxLookupRange(range, available)
343
- if (match !== null) return match
344
- }
345
- return fallback
346
- }
347
-
348
- app.use('/', async (c, next) => {
349
- const locale = jxNegotiateLocale(c.req.header('accept-language'), JX_LOCALES, JX_DEFAULT_LOCALE)
350
- const home = JX_LOCALE_HOMES[locale] || '/'
351
- if (home !== '/') {
352
- // 302, never 301: the target depends on the request, so it must never be cached as permanent.
353
- return new Response(null, {
354
- headers: { 'Content-Language': locale, Location: home, Vary: 'Accept-Language' },
355
- status: 302,
356
- })
357
- }
358
- // '/' already holds this locale (prefix-except-default). Let the chain serve it, then say the
359
- // Response depended on the header — a cache that missed this would pin every visitor to it.
360
- await next()
361
- const res = new Response(c.res.body, c.res)
362
- res.headers.set('Vary', 'Accept-Language')
363
- res.headers.set('Content-Language', locale)
364
- c.res = res
365
- })
366
- `}function Gf(e,t="/_jx/server"){return Fe(e,t)}function Ty(e,t={}){let{adapter:n=null,mounts:r=[],connectors:s=[],i18n:o=null,base:i=""}=t,a=Gf(i,t.baseUrl);if(e.length===0&&r.length===0&&!n)return null;let l=e.map(({exportName:y,src:S})=>`import { ${y} } from '${S}'`).join(`
367
- `),c=NL(r,s),u=e.map(({exportName:y})=>ML(y,a)).join(`
359
+ `;s+=` @${d}=\${(e) => { state.$map = { item, index }; ${m}}}`}else if(F(u)&&"$expression"in u){let p=bn(u.$expression,{eventParam:"e",statePrefix:"state"});s+=` @${d}=\${(e) => { state.$map = { item, index }; ${p}; }}`}}for(let[c,u]of Object.entries(e)){if(gr.has(c)||c.startsWith("$")||c.startsWith("on")||c==="tagName"||c==="id"||c==="className"||c==="style"||c==="children"||c==="textContent"||c==="innerHTML"||c==="attributes")continue;if(Ye(u))s+=` .${c}="\${${ra(u.$ref)}}"`;else if(ce(u))s+=` .${c}="${Fs(u)}"`;else s+=` .${c}="\${${JSON.stringify(u)}}"`}let i=n.includes("-")?Yi:"",a="";if(e.textContent!==void 0){let c=String(e.textContent);if(ce(c))a=`${Fs(c)}${i}`;else if(Ye(e.textContent))a=`\${${ra(e.textContent.$ref)}}${i}`;else a=Me(c)}else if(e.innerHTML)a=Fs(String(e.innerHTML));else if(Le(e.children))a=Zg([`${bj(e.children)}${i}`],{close:`
360
+ `,open:`
361
+ `,separator:`
362
+ `});else if(Array.isArray(e.children)){let c=e.children.map((u)=>{let d=Ky(u,r);return Le(u)||_(u)&&ce(u)?`${d}${i}`:d});a=Zg(c,{close:`
363
+ `,open:`
364
+ `,preformatted:r,separator:`
365
+ `})}if(new Set(["input","br","hr","img","meta","link"]).has(n))return`<${n}${s}>`;return`<${n}${s}>${a}</${n}>`}function Ky(e,t=!1){if(_(e))return ce(e)?Fs(e):Me(e);if(De(e)||Xe(e))return Me(String(e));if(Le(e))return bj(e);return xj(e,t)}function bj(e){return`\${${$j(e)}}`}function Uy(e){return an(e).startsWith("$map/")?ra(e):Gy(e)}function $j(e){Bo(e);let{items:t,filter:n,sort:r,key:s}=e,o=Ye(s),i=JSON.stringify(t??[]),a=o?`${Ml}(${JSON.stringify(i)})`:i;if(Ye(t))a=Uy(t.$ref);let l=Ye(n)?Uy(n.$ref):"undefined",c=Ye(r)?Uy(r.$ref):"undefined",u=`(item, index) => html\`${xj(e.map)}\``;if(o){let d=s.$ref,p=[`(${a} ?? [])`,l,c,JSON.stringify(jf(d)),JSON.stringify(d),u];return`${Il}(${p.join(", ")})`}if(Ye(n)||Ye(r))return`${Gi}(${a}, ${l}, ${c}).map(${u})`;return`(${a} ?? []).map(${u})`}function Fs(e){return e.replaceAll("$map.","")}function yF(e){return e.replaceAll(/(?<![\w$.])\$map\./gu,"")}function xF(e,t,n,r,s,o,i,a,l,c,u,d){let p=[],{needsLit:m,textParts:g}=a,b=t.length>0;p.push("// Generated by @jxsuite/compiler — do not edit manually");let h=["reactive","effect"];if(b)h.push("computed");if(d.keyed)h.push("stop","shallowRef");if(p.push(`import { ${h.join(", ")} } from '@vue/reactivity';`),m)p.push("import { html, render } from 'lit-html';");if(d.keyed)p.push(...kf);let x=Sf(i,c);if(p.push(...x.imports,...u.imports,...x.loaders,"",vf()),d.arranged||d.keyed)p.push(Pf());if(d.keyed)p.push(_f());if(o.length>0)p.push("",Af());let k=u.entries.length>0;if(k)p.push("",Cf(),"const _jxInstances = new Map();");p.push("","const state = reactive({");for(let[w,v]of e)p.push(` ${fs(w)}: ${JSON.stringify(v)},`);if(p.push("});",""),s.length>0){for(let w of s)p.push(w);p.push("")}if(t.length>0){for(let[w,v]of t)p.push(`${Je("state",Ut(w))} = computed(${v});`);p.push("")}if(o.length>0){for(let w of o)p.push(w);p.push("")}if(n.length>0){p.push("const bind = {");for(let[w,v]of n)p.push(` ${fs(w)}: ${v},`);p.push("};")}else p.push("const bind = {};");if(p.push(""),r.length>0){p.push("const on = {");for(let[w,v]of r)p.push(` ${fs(w)}: (e) => { const fn = (${v.args.join(", ")}) => { ${v.body}
366
+ }; fn(state, e); },`);p.push("};")}else p.push("const on = {};");if(p.push("","function hydrate(root) {"),g)p.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(p.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;"),m)p.push(" if (parts[0] === 'render') {"," effect(() => { render(bind[key](), el); });"," } else if (parts[0] === 'style' && parts.length > 1) {");else p.push(" if (parts[0] === 'style' && parts.length > 1) {");if(p.push(" effect(() => { el.style[parts[1]] = bind[key](); });"," } else if (parts[0] === 'attr' && parts.length > 1) {"," effect(() => {",` const _t = ${Wo}(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]);"," }"," });"," });"),g)p.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(p.push("}",""),k)p.push(`await ${Tf(u.entries,{indent:"",instances:"_jxInstances",statePrefix:"state"})};`);return p.push("hydrate(document);",""),p.join(`
367
+ `)}function bF(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(`
368
+ `)}function $F(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(`
369
+ `)}function Sj(e){return e===null||F(e)}function ra(e){let t=an(e);if(t.startsWith("$map/")){let[n,...r]=Xn(t.slice(5));return Je(n??"",r.map((s)=>Ut(s)).join("/"))}if(t.startsWith("#/state/"))return Je("state",t.slice(8));return Je("state",t)}function Gy(e){return Jv("state",e.startsWith("#/state/")?e.slice(8):e)}function Kl(e){return Mv(e.startsWith("#/state/")?e.slice(8):e)}function zy(e,t,n){if(e.has(t))return;e.set(t,`() => ${Je("state",n.startsWith("#/state/")?n.slice(8):n)}`)}var gF;var Yy=M(()=>{Pi();qi();$n();ae();Hi();Ti();gF=new Set(["script","style","textarea","title"])});function rd(e,t="/_jx/server"){return Te(e,t)}function Zy(e,t={}){let{adapter:n=null,mounts:r=[],connectors:s=[],i18n:o=null,base:i=""}=t,a=rd(i,t.baseUrl);if(e.length===0&&r.length===0&&!n)return null;let l=e.map(({exportName:g,src:b})=>`import { ${g} } from '${b}'`).join(`
370
+ `),c=SF(r,s),u=e.map(({exportName:g})=>EF(g,a)).join(`
368
371
  `),d=n==="cloudflare-workers"||n==="cloudflare-pages"?`
369
372
  app.all('*', (c) => c.env.ASSETS.fetch(c.req.raw))
370
373
  `:`
371
- `,p=WE(o),m=e.length===0&&r.length===0?"":JL(i,a);return`// Generated by @jxsuite/compiler — do not edit manually
374
+ `,p=iv(o,i),m=e.length===0&&r.length===0?"":vF(i,a);return`// Generated by @jxsuite/compiler — do not edit manually
372
375
  import { Hono } from 'hono'
373
376
  ${l}${c.imports}
374
377
 
@@ -376,11 +379,11 @@ const app = new Hono()
376
379
  ${p}${m}${c.routes}${u}
377
380
  ${d}
378
381
  export default app
379
- `}function NL(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:`
382
+ `}function SF(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:`
380
383
  ${r.join(`
381
384
  `)}`,routes:`${s.join(`
382
385
  `)}
383
- `}}function JL(e,t){let n=Fe(e,TL);return`// Request gate (specs/compiler.md §6.4): another site may link here, never call here.
386
+ `}}function vF(e,t){let n=Te(e,wF);return`// Request gate (specs/compiler.md §6.4): another site may link here, never call here.
384
387
  const jxGate = async (c, next) => {
385
388
  const site = c.req.header('sec-fetch-site')
386
389
  const foreign = site !== undefined && site !== 'same-origin' && site !== 'none'
@@ -397,7 +400,7 @@ const jxGate = async (c, next) => {
397
400
  }
398
401
  ${(t===n||t.startsWith(`${n}/`)?[n]:[n,t]).map((o)=>`app.use('${o}/*', jxGate)`).join(`
399
402
  `)}
400
- `}function ML(e,t){return`
403
+ `}function EF(e,t){return`
401
404
  app.post('${t}/${e}', async (c) => {
402
405
  if (!/^application\\/([\\w.-]+\\+)?json\\b/i.test(c.req.header('content-type') ?? '')) {
403
406
  return c.json({ ok: false, error: 'Expected an application/json body' }, 415)
@@ -409,26 +412,26 @@ app.post('${t}/${e}', async (c) => {
409
412
  console.error('jx: server function ${e} threw:', e)
410
413
  return c.json({ ok: false, error: 'Server error' }, 500)
411
414
  }
412
- })`}var TL="/_jx";var Jy=J(()=>{An()});async function FL(e){let{readdirSync:t}=await import("node:fs"),{resolve:n}=await import("node:path");if(!k(e))return e.map((r)=>n(r));return t(e).filter((r)=>Vn(r)).toSorted().map((r)=>n(e,r))}async function VL(e){let{readFileSync:t}=await import("node:fs");if(!Vn(e))throw Error(`compileElementPack: ${e} is not a .json or .jxn document, the two a pack compiles`);return kn(t(e,"utf8"),e)}async function qL(e){let{resolve:t}=await import("node:path"),n=(e.packDir??"dist").replaceAll(/^\.?\/+|\/+$/gu,""),r=await FL(e.components),s=new Map,o=new Map;for(let y of r){let S=await VL(y),{tagName:g}=S;if(!k(g)||!g.includes("-"))throw Error(`compileElementPack: ${y} is not a component: its tagName must contain a hyphen`);let x=[...o].find(([,P])=>P===g);if(x)throw Error(`compileElementPack: ${x[0]} and ${y} both declare the tagName "${g}"`);s.set(g,S),o.set(y,g)}let i={stylesheetHref:(y)=>`./${y}.css`,resolveElementPath:(y,S)=>{let g=S===null?t(y):t(S,y),x=o.get(g);if(x===void 0)throw Error(`compileElementPack: "${y}" names a component outside the pack (${g})`);return`./${x}.js`}};if(e.rewriteSrc)i.rewriteSrc=e.rewriteSrc;if(e.$media)i.$media=e.$media;if(e.defaults)i.defaults=e.defaults;let a=new Map;for(let y of r){let{files:S}=await Gi(y,i);for(let g of S)if(!a.has(g.tagName))a.set(g.tagName,g.content)}let l=Cf([...s.keys()],s),c=[],u=[],d=[];for(let y of l){let S=s.get(y),g=a.get(y);if(!S||g===void 0)continue;c.push({content:g,path:`${y}.js`});let x=Rn(S,e.defaults),P=Nf(y,S.style,S,e.$media??S.$media??{},x);if(P!==""){if(c.push({content:P,path:`${y}.css`}),x===null)u.push(P)}d.push({className:Ms(y),doc:S,modulePath:n===""?`${y}.js`:`${n}/${y}.js`,shadow:x!==null,tagName:y})}let{manifest:p,warnings:m}=pu(d);return c.push({content:`// Generated by @jxsuite/compiler — do not edit manually
413
- ${l.map((y)=>`import './${y}.js';`).join(`
415
+ })`}var wF="/_jx";var Qy=M(()=>{hn();bg()});async function _F(e){let{readdirSync:t}=await import("node:fs"),{resolve:n}=await import("node:path");if(!_(e))return e.map((r)=>n(r));return t(e).filter((r)=>Bn(r)).toSorted().map((r)=>n(e,r))}async function OF(e){let{readFileSync:t}=await import("node:fs");if(!Bn(e))throw Error(`compileElementPack: ${e} is not a .json or .jxn document, the two a pack compiles`);return Rn(t(e,"utf8"),e)}async function AF(e){let{resolve:t}=await import("node:path"),n=(e.packDir??"dist").replaceAll(/^\.?\/+|\/+$/gu,""),r=await _F(e.components),s=new Map,o=new Map;for(let g of r){let b=await OF(g),{tagName:h}=b;if(!_(h)||!h.includes("-"))throw Error(`compileElementPack: ${g} is not a component: its tagName must contain a hyphen`);let x=[...o].find(([,k])=>k===h);if(x)throw Error(`compileElementPack: ${x[0]} and ${g} both declare the tagName "${h}"`);s.set(h,b),o.set(g,h)}let i={stylesheetHref:(g)=>`./${g}.css`,resolveElementPath:(g,b)=>{let h=b===null?t(g):t(b,g),x=o.get(h);if(x===void 0)throw Error(`compileElementPack: "${g}" names a component outside the pack (${h})`);return`./${x}.js`}};if(e.rewriteSrc)i.rewriteSrc=e.rewriteSrc;if(e.$media)i.$media=e.$media;if(e.defaults)i.defaults=e.defaults;let a=new Map;for(let g of r){let{files:b}=await na(g,i);for(let h of b)if(!a.has(h.tagName))a.set(h.tagName,h.content)}let l=If([...s.keys()],s),c=[],u=[],d=[];for(let g of l){let b=s.get(g),h=a.get(g);if(!b||h===void 0)continue;c.push({content:h,path:`${g}.js`});let x=Jn(b,e.defaults),k=Lf(g,b.style,b,e.$media??b.$media??{},x);if(k!==""){if(c.push({content:k,path:`${g}.css`}),x===null)u.push(k)}d.push({className:Ls(g),doc:b,modulePath:n===""?`${g}.js`:`${n}/${g}.js`,shadow:x!==null,tagName:g})}let{manifest:p,warnings:m}=Ou(d);return c.push({content:`// Generated by @jxsuite/compiler — do not edit manually
416
+ ${l.map((g)=>`import './${g}.js';`).join(`
414
417
  `)}
415
- `,path:IL},{content:u.join(""),path:DL},{content:mu(p),path:LL}),{files:c,manifest:p,tags:l,warnings:m}}async function HL(e,t){let{mkdirSync:n,writeFileSync:r}=await import("node:fs"),{dirname:s,resolve:o}=await import("node:path");return e.files.map((i)=>{let a=o(t,i.path);return n(s(a),{recursive:!0}),r(a,i.content,"utf8"),a})}var IL="index.js",DL="elements.css",LL="custom-elements.json";var BE=J(()=>{dm();ce();os();Sl();yn();Hl()});import{readFileSync as WL}from"node:fs";async function My(e,t={}){let{title:n="Jx App",reactivitySrc:r=Ts,litHtmlSrc:s=Nr,projectStyle:o=null}=t,i;if(k(e)){let l=WL(e,"utf8");if(Vn(e))i=kn(l,e);else{let{extname:c}=await import("node:path"),u=c(e).toLowerCase(),d=t.formats?.byExtension(u,"parse");if(!d){await Promise.resolve().then(() => is());throw du(e,u)}i=await d.parseDocument(l)}}else i=e;if(i=Ar(i,k(e)?e:"the document"),Fb(i)){await Promise.resolve().then(() => fy());let c=Fl(i),u=k(e)?e.replace(/(\.class)?\.[^./\\]+$/,".js"):`${i.title}.js`;return{files:[{content:c,path:u}],html:""}}if(!pf(i)){let l={projectStyle:o,title:n};if(t.prePaintScheme===!1)l.prePaintScheme=!1;return ME(i,l)}if(i.tagName&&i.tagName.includes("-")){let{tagName:l}=i,c=Ms(l),d={content:Ey(i,c,[],t.rewriteSrc,null,t.serverBaseUrl,[],t.resolveClass),path:`${l}.js`,tagName:l},p=Ui(i,i.$media??{},o),m=`<!DOCTYPE html>
418
+ `,path:jF},{content:u.join(""),path:PF},{content:Au(p),path:kF}),{files:c,manifest:p,tags:l,warnings:m}}async function CF(e,t){let{mkdirSync:n,writeFileSync:r}=await import("node:fs"),{dirname:s,resolve:o}=await import("node:path");return e.files.map((i)=>{let a=o(t,i.path);return n(s(a),{recursive:!0}),r(a,i.content,"utf8"),a})}var jF="index.js",PF="elements.css",kF="custom-elements.json";var wj=M(()=>{eg();ae();os();Pl();$n();zl()});import{readFileSync as RF}from"node:fs";async function ex(e,t={}){let{title:n="Jx App",reactivitySrc:r=Is,litHtmlSrc:s=Tr,projectStyle:o=null}=t,i;if(_(e)){let l=RF(e,"utf8");if(Bn(e))i=Rn(l,e);else{let{extname:c}=await import("node:path"),u=c(e).toLowerCase(),d=t.formats?.byExtension(u,"parse");if(!d){await Promise.resolve().then(() => is());throw gu(e,u)}i=await d.parseDocument(l)}}else i=e;if(i=Cr(i,_(e)?e:"the document"),l$(i)){await Promise.resolve().then(() => Cy());let c=Wl(i),u=_(e)?e.replace(/(\.class)?\.[^./\\]+$/,".js"):`${i.title}.js`;return{files:[{content:c,path:u}],html:""}}if(!bf(i)){let l={projectStyle:o,title:n};if(t.prePaintScheme===!1)l.prePaintScheme=!1;return mj(i,l)}if(i.tagName&&i.tagName.includes("-")){let{tagName:l}=i,c=Ls(l),d={content:qy(i,c,[],t.rewriteSrc,null,t.serverBaseUrl,[],t.resolveClass),path:`${l}.js`,tagName:l},p=Qi(i,i.$media??{},o),m=`<!DOCTYPE html>
416
419
  <html lang="en">
417
420
  <head>
418
421
  <meta charset="utf-8">
419
422
  <meta name="viewport" content="width=device-width, initial-scale=1">
420
- <title>${Ne(n)}</title>
421
- ${Ii({litHtmlSrc:s,reactivitySrc:r,runtimeImports:t.runtimeImports})}
423
+ <title>${Me(n)}</title>
424
+ ${Wi({litHtmlSrc:s,reactivitySrc:r,runtimeImports:t.runtimeImports})}
422
425
  ${p}
423
426
  </head>
424
427
  <body>
425
428
  <${l}></${l}>
426
429
  <script type="module" src="./${l}.js"></script>
427
430
  </body>
428
- </html>`;return{files:[d],html:m}}let a={litHtmlSrc:s,projectStyle:o,reactivitySrc:r,...BL(t),title:n};if(t.serverBaseUrl!==void 0)a.serverBaseUrl=t.serverBaseUrl;if(t.resolveClass!==void 0)a.resolveClass=t.resolveClass;if(t.runtimeImports!==void 0)a.runtimeImports=t.runtimeImports;return Ry(i,a)}function BL(e){let t={};if(e.prePaintScheme===!1)t.prePaintScheme=!1;if(e.rewriteSrc)t.rewriteSrc=e.rewriteSrc;return t}async function uee(e,t){let n=await My(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 l of n.files){let c=i(a,l.path);s(o(c),{recursive:!0}),r(c,l.content,"utf8"),console.error(`Written to ${c}`)}}else process.stdout.write(n.html)}var UE=J(()=>{Ei();yn();Hl();DE();Ny();ce();os();yn();Jy();Hl();BE();Ny()});function zE(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 KE(e){return`jx-compiler.${e}.node`}function GE(e){return`@jxsuite/compiler-binding-${e}`}var XE=()=>{};import{createRequire as UL}from"node:module";import{existsSync as zL}from"node:fs";import{dirname as QE,join as KL}from"node:path";function GL(e,t){return e==="linux"&&t!==void 0&&!t.header?.glibcVersionRuntime}function XL(e){try{return[QE(e("@jxsuite/compiler-binding/package.json"))]}catch{return[]}}function YL(){return{arch:process.arch,exists:zL,load:(e)=>{let t=YE(e);return ZL(t)?t:void 0},localDirs:[...new Set([QE(import.meta.dirname),import.meta.dirname,...XL((e)=>YE.resolve(e))])],musl:GL(process.platform,process.report.getReport()),platform:process.platform}}function ZL(e){return typeof e==="object"&&e!==null&&"processImage"in e&&typeof e.processImage==="function"}function QL(e){let t=zE(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)=>KL(i,KE(s))).filter((i)=>e.exists(i)),GE(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(`
431
+ </html>`;return{files:[d],html:m}}let a={litHtmlSrc:s,projectStyle:o,reactivitySrc:r,...TF(t),title:n};if(t.serverBaseUrl!==void 0)a.serverBaseUrl=t.serverBaseUrl;if(t.resolveClass!==void 0)a.resolveClass=t.resolveClass;if(t.runtimeImports!==void 0)a.runtimeImports=t.runtimeImports;return Xy(i,a)}function TF(e){let t={};if(e.prePaintScheme===!1)t.prePaintScheme=!1;if(e.rewriteSrc)t.rewriteSrc=e.rewriteSrc;return t}async function bte(e,t){let n=await ex(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 l of n.files){let c=i(a,l.path);s(o(c),{recursive:!0}),r(c,l.content,"utf8"),console.error(`Written to ${c}`)}}else process.stdout.write(n.html)}var vj=M(()=>{Ai();$n();zl();gj();Yy();ae();os();$n();Qy();zl();wj();Yy()});function Ej(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 jj(e){return`jx-compiler.${e}.node`}function Pj(e){return`@jxsuite/compiler-binding-${e}`}var kj=()=>{};import{createRequire as NF}from"node:module";import{existsSync as JF}from"node:fs";import{dirname as Aj,join as MF}from"node:path";function IF(e,t){return e==="linux"&&t!==void 0&&!t.header?.glibcVersionRuntime}function DF(e){try{return[Aj(e("@jxsuite/compiler-binding/package.json"))]}catch{return[]}}function LF(){return{arch:process.arch,exists:JF,load:(e)=>{let t=_j(e);return FF(t)?t:void 0},localDirs:[...new Set([Aj(import.meta.dirname),import.meta.dirname,...DF((e)=>_j.resolve(e))])],musl:IF(process.platform,process.report.getReport()),platform:process.platform}}function FF(e){return typeof e==="object"&&e!==null&&"processImage"in e&&typeof e.processImage==="function"}function VF(e){let t=Ej(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)=>MF(i,jj(s))).filter((i)=>e.exists(i)),Pj(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(`
429
432
  `);throw Error(`The Jx compiler's native addon could not be loaded.
430
433
  ${r}
431
- 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 tj(){return ZE??=QL(YL()),ZE}async function nj(e){return tj().imageMetadata(e)}async function rj(e){return tj().processImage(e)}var ej,YE,ZE;var sj=J(()=>{XE();ej={avif:65,jpeg:80},YE=UL(import.meta.url)});import{createHash as Iy}from"node:crypto";import{readFileSync as eF}from"node:fs";import{basename as tF,extname as nF,resolve as oj}from"node:path";async function ij(e){return nj(e)}function Yi(e){let t=eF(e);return Iy("md5").update(t).digest("hex").slice(0,8)}function oF(e,t){let n=new Map(Object.entries(e)).get(t);if(n!==void 0)return n;return new Map(Object.entries(ej)).get(t)??sF}function iF(e,t,n){return Iy("md5").update(`${Yi(e)}:${aj}:${t}:${n}`).digest("hex").slice(0,8)}function lj(e){let t=JSON.stringify({formats:e.formats,quality:e.quality,v:aj,widths:e.widths});return Iy("md5").update(t).digest("hex").slice(0,8)}async function cj(e,t,n){let r=oj(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 rj({formats:n.formats,hashes:Object.fromEntries(n.formats.map((i)=>[i,iF(e,i,oF(n.quality,i))])),outDir:r,quality:s,source:e,stem:tF(e,nF(e)),widths:n.widths});return{contentHash:Yi(e),original:o.original,variants:o.variants.map((i)=>({absolutePath:oj(r,i.fileName),format:i.format,outputPath:`/${rF}/${i.fileName}`,width:i.width}))}}function uj(e,t){return e.flatMap((n)=>n.format===t?[`${Dy(n.outputPath)} ${n.width}w`]:[]).join(", ")}function Dy(e){return e.split("/").map((t)=>encodeURIComponent(t)).join("/")}var rF="images/_optimized",aj=4,sF=100;var Ly=J(()=>{sj()});import{existsSync as aF,mkdirSync as lF,readFileSync as cF,rmSync as uF,writeFileSync as fF}from"node:fs";import{basename as fj,extname as dF,resolve as Bl}from"node:path";import{execSync as pF}from"node:child_process";import{createHash as mF}from"node:crypto";import{tmpdir as hF}from"node:os";function yF(){let e=process.env.npm_config_cache??process.env.NPM_CONFIG_CACHE;if(e)return e;try{let t=pF("npm config get cache",{cwd:hF(),encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:gF}).trim();return t&&t!=="undefined"?t:null}catch{return null}}function Yf(e){if(Xf===void 0)Xf=yF();if(Xf){let t=Bl(e),n=mF("md5").update(t).digest("hex").slice(0,8);return Bl(Xf,"jxsuite-images",`${fj(t)}-${n}`)}return Bl(e,".cache/images")}function dj(e,t){return`${Yi(e)}:${lj(t)}:${fj(e,dF(e))}`}function pj(e){let t=Bl(Yf(e),"manifest.json");if(!aF(t))return{entries:{},touched:new Set,version:1};try{let n=JSON.parse(cF(t,"utf8"));return n.touched=new Set,n}catch{return{entries:{},touched:new Set,version:1}}}function mj(e,t,n={}){if(n.prune&&t.touched)xF(t,t.touched);let r=Yf(e);lF(r,{recursive:!0}),fF(Bl(r,"manifest.json"),JSON.stringify({entries:t.entries,version:t.version},null,2),"utf8")}function xF(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))uF(i.absolutePath,{force:!0});delete e.entries[s]}}function hj(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 gj(e,t){e.touched?.add(t);let n=e.entries[t];if(!n)return null;return n.manifest}function yj(e,t,n,r){e.touched?.add(t),e.entries[t]={manifest:r,source:n,timestamp:Date.now()}}var Xf,gF=3000;var Fy=J(()=>{Ly()});function Vy(e,t){if(!t||xj(e.loading))return{};if(String(e.fetchpriority??"").toLowerCase()==="high")return{};return xj(e.decoding)?{loading:"lazy"}:{decoding:"async",loading:"lazy"}}var xj=(e)=>e!==void 0&&e!==null&&e!=="";function $j(e){let t=e.lastIndexOf(".");return bF.get(t>0?e.slice(t).toLowerCase():"")??null}function Qf(e){try{return SF.decode(e)}catch{throw new Tn("The metadata is not valid UTF-8.")}}function Zf(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Ul(e,t,n){return String.fromCodePoint(...e.subarray(t,t+n))}function Sj(e,t){switch(t){case"jpeg":return EF(e).packet;case"png":return kF(e).packet;case"webp":return AF(e).packet;default:return TF(Qf(e)).packet}}function wF(e){if(e[0]!==255||e[1]!==216)throw new Tn("Not a JPEG file.");let t=[],n=2;while(n+4<=e.length){if(e[n]!==255)throw new Tn("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=Zf(e).getUint16(n+2),o=n+2+s;if(s<2||o>e.length)throw new Tn("The JPEG's markers are damaged.");t.push({end:o,marker:r,start:n}),n=o}return t}function vF(e,t){let n=t.start+4;return t.marker===225&&t.end-n>=qy.length&&qy.every((r,s)=>e[n+s]===r)}function EF(e){let t=wF(e),n=t.find((s)=>vF(e,s));return{packet:n===void 0?null:Qf(e.subarray(n.start+4+qy.length,n.end)),parts:t}}function PF(e){if(!bj.every((r,s)=>e[s]===r))throw new Tn("Not a PNG file.");let t=[],n=bj.length;while(n+12<=e.length){let r=Zf(e).getUint32(n),s=n+12+r;if(s>e.length)throw new Tn("The PNG's chunks are damaged.");let o=Ul(e,n+4,4);if(t.push({dataStart:n+8,end:s,start:n,type:o}),n=s,o==="IEND")break}return t}function _F(e,t){if(t.type!=="iTXt")return null;let n=e.subarray(t.dataStart,t.end-4),r=n.indexOf(0);if(r===-1||Ul(n,0,r)!==jF)return null;if(n[r+1]!==0)throw new Tn("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 Tn("The PNG's metadata chunk is damaged.");return Qf(n.subarray(o+1))}function kF(e){let t=PF(e);return{packet:t.map((r)=>_F(e,r)).find((r)=>r!==null)??null,parts:t}}function OF(e){if(Ul(e,0,4)!=="RIFF"||Ul(e,8,4)!=="WEBP")throw new Tn("Not a WebP file.");let t=Math.min(e.length,8+Zf(e).getUint32(4,!0)),n=[],r=12;while(r+8<=t){let s=Zf(e).getUint32(r+4,!0),o=r+8,i=o+s+s%2;if(o+s>t)throw new Tn("The WebP's chunks are damaged.");n.push({dataStart:o,end:Math.min(i,t),fourcc:Ul(e,r,4),size:s,start:r}),r=i}return n}function AF(e){let t=OF(e),n=t.find((s)=>s.fourcc==="XMP ");return{packet:n===void 0?null:Qf(e.subarray(n.dataStart,n.dataStart+n.size)),parts:t}}function RF(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 NF(e){let t=/<svg[\s>/]/.exec(e);if(t===null)throw new Tn("Not an SVG file.");let n=RF(e,t.index);if(n===-1)throw new Tn("The SVG's root element is damaged.");return{end:n,selfClosing:e[n-1]==="/",start:t.index}}function TF(e){NF(e);let t=CF.exec(e);return t===null?{end:-1,packet:null,start:-1}:{end:t.index+t[0].length,packet:t[0],start:t.index}}var Tn,bF,$F,SF,qy,bj,jF="XML:com.adobe.xmp",CF;var wj=J(()=>{Tn=class Tn extends Error{name="XmpContainerError"};bF=new Map([[".jpeg","jpeg"],[".jpg","jpeg"],[".png","png"],[".svg","svg"],[".webp","webp"]]);$F=new TextEncoder,SF=new TextDecoder("utf-8",{fatal:!0});qy=$F.encode("http://ns.adobe.com/xap/1.0/\x00");bj=Uint8Array.of(137,80,78,71,13,10,26,10);CF=/<([\w.-]+:)?xmpmeta\b[\s\S]*?<\/\1?xmpmeta\s*>/});function vj(){return{alt:"",focus:null,tags:[]}}function MF(e){if(e.startsWith("#x")||e.startsWith("#X"))return Number.parseInt(e.slice(2),16);return e.startsWith("#")?Number(e.slice(1)):null}function Hy(e){return e.replaceAll(/&(#x[\da-f]+|#\d+|\w+);/gi,(t,n)=>{let r=MF(n),s=r===null?JF.get(n):r<=1114111?String.fromCodePoint(r):void 0;if(s===void 0)throw new Jn(`Unknown entity ${t}`);return s})}function IF(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:Hy(e.slice(r))});break}if(o>r)s().children.push({type:"text",value:Hy(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 l=e.indexOf(">",o);if(l===-1)throw new Jn("Unclosed end tag.");let c=e.slice(o+2,l).trim(),u=n.pop();if(u===void 0||u===t||u.name!==c)throw new Jn(`Unexpected </${c}>.`);r=l+1;continue}else{r=DF(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 DF(e,t,n){let r=t+1,s=Ej.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=Ej.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 l=e[r];if(l!=='"'&&l!=="'")throw new Jn(`${a[0]} is not quoted.`);let c=e.indexOf(l,r+1);if(c===-1)throw new Jn(`${a[0]} is never closed.`);o.attrs.push([a[0],Hy(e.slice(r+1,c))]),r=c+1}}function Zi(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 LF(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 mr(e,t,n,r,s=!1){let o=LF(e,t,s);return o!==null&&o[0]===n&&o[1]===r}function Qi(e){return e.filter((t)=>t.type==="element")}function ea(e){return e.children.map((t)=>t.type==="text"?t.value:t.type==="element"?ea(t):"").join("")}function Pj(e,t=new Map){let n=[];for(let r of Qi(e)){let s=Zi(r,t);if(mr(r.name,s,"http://www.w3.org/1999/02/22-rdf-syntax-ns#","Description"))n.push([r,s]);else n.push(...Pj(r.children,s))}return n}function ta(e,t){let n=[];for(let r of Qi(e.children)){let s=Zi(r,t);for(let o of Qi(r.children)){let i=Zi(o,s);if(mr(o.name,i,"http://www.w3.org/1999/02/22-rdf-syntax-ns#","li"))n.push([o,i])}}return n}function FF(e,t){let n=e.attrs.find(([r])=>mr(r,t,"http://www.w3.org/XML/1998/namespace","lang",!0));return n===void 0?null:n[1]}function VF(e,t){let n=ta(e,t),r=n.find(([s,o])=>FF(s,o)?.toLowerCase()==="x-default")??n[0];return r===void 0?ea(e).trim():ea(r[0])}function ed(e,t){if(!e.attrs.some(([r,s])=>s==="Resource"&&mr(r,t,"http://www.w3.org/1999/02/22-rdf-syntax-ns#","parseType",!0)))for(let r of Qi(e.children)){let s=Zi(r,t);if(mr(r.name,s,"http://www.w3.org/1999/02/22-rdf-syntax-ns#","Description"))return[r,s]}return[e,t]}function Kl(e,t,n,r){for(let s of Qi(e.children)){let o=Zi(s,t);if(mr(s.name,o,n,r))return[s,o]}return null}function zl(e,t,n,r){let s=e.attrs.find(([i])=>mr(i,t,n,r,!0));if(s!==void 0)return s[1].trim();let o=Kl(e,t,n,r);return o===null?null:ea(o[0]).trim()}function jj(e){if(e===null||e==="")return null;let t=Number(e);return Number.isFinite(t)&&t>=0&&t<=1?t:null}function qF(e,t){let n=Kl(e,t,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rRole");if(n===null)return!1;return ta(...n).some(([r,s])=>{let[o,i]=ed(r,s),a=Kl(o,i,"http://ns.adobe.com/xap/1.0/","Identifier");return(a===null?[zl(o,i,"http://ns.adobe.com/xap/1.0/","Identifier")??""]:ta(...a).map(([c])=>ea(c).trim())).some((c)=>c.replace(/^https:/,"http:")==="http://cv.iptc.org/newscodes/imageregionrole/areaOfInterest")})}function HF(e,t){let[n,r]=ed(e,t),s=Kl(n,r,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","RegionBoundary");if(s===null||!qF(n,r))return null;let[o,i]=ed(...s),a=Kl(o,i,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbVertices");if(zl(o,i,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbShape")!=="polygon"||zl(o,i,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbUnit")!=="relative"||a===null)return null;let l=ta(...a);if(l.length!==1)return null;let[c,u]=ed(...l[0]),d=jj(zl(c,u,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbX")),p=jj(zl(c,u,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbY"));return d===null||p===null?null:{x:d,y:p}}function WF(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 _j(e){if(e===null)return vj();let t=vj(),n=!1;for(let[r,s]of Pj(IF(e))){for(let[o,i]of r.attrs)if(!n&&mr(o,s,"http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/","AltTextAccessibility",!0))t.alt=i,n=!0;for(let o of Qi(r.children)){let i=Zi(o,s);if(!n&&mr(o.name,i,"http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/","AltTextAccessibility"))t.alt=VF(o,i),n=!0;else if(mr(o.name,i,"http://purl.org/dc/elements/1.1/","subject"))t.tags.push(...ta(o,i).map(([a])=>ea(a)));else if(t.focus===null&&mr(o.name,i,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","ImageRegion"))for(let[a,l]of ta(o,i))t.focus??=HF(a,l)}}return t.tags=WF(t.tags),t.alt=t.alt.trim(),t}var Jn,JF,Ej;var kj=J(()=>{Jn=class Jn extends Error{name="XmpParseError"};JF=new Map([["amp","&"],["apos","'"],["gt",">"],["lt","<"],["quot",'"']]);Ej=/^[A-Za-z_][\w.:-]*/});import{existsSync as Mj,readFileSync as BF,statSync as UF}from"node:fs";import{basename as zF,extname as Uy,resolve as Oj}from"node:path";async function XF(e,t){let n=t.get(e);if(!n){let r=Yi(e);try{let s=await ij(e);n={width:s.width,height:s.height,hash:r}}catch(s){if(!Aj)Aj=!0,console.warn(`Could not read image dimensions (${be(s)}) — `+"emitting srcsets without width/height attributes.");n={width:null,height:null,hash:r}}t.set(e,n)}return n}function Cj(e,t,n,r){let s=t.quality.webp??80,o=e.startsWith("/")?"":"/",i=r?`?v=${r}`:"",a=YF(e);return t.widths.filter((l)=>l<=n).toSorted((l,c)=>l-c).map((l)=>`/cdn-cgi/image/width=${l},quality=${s},fit=scale-down,format=auto${o}${a}${i} ${l}w`).join(", ")}function YF(e){return e.replaceAll(/[\s,]/g,(t)=>encodeURIComponent(t))}async function ZF(e,t,n,r,s){let o=dj(e,n),i=gj(s,o);if(i){if(i.variants.every((c)=>Mj(c.absolutePath)))return i}if(!i)console.log(` Optimizing ${zF(e)}...`);let a=await cj(e,Yf(r),n);return yj(s,o,t,a),a}function QF(e){if(!e)return!0;if(e.includes("${"))return!0;if(Dj.some((n)=>e.startsWith(n)))return!0;let t=Uy(e).toLowerCase();return!KF.has(t)&&!Ij.has(t)}function e2(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(GF.has(Uy(n.pathname).toLowerCase()))return!1;return t.remoteDomains.includes(n.hostname)}catch{return!1}}function Lj(e,t,n){let r=n?.length?xu(n,e):null;if(r)return r;if(e.startsWith("/"))return Oj(t,"public",e.slice(1));return Oj(t,e)}function Nj(e){return`${Math.round(e*1000)/10}%`}function t2(e){let t=$j(e);if(t===null)return null;let n;try{let o=UF(e);n=`${e}|${o.mtimeMs}|${o.size}`}catch{return null}let r=Rj.get(n);if(r!==void 0)return r;let s=null;try{let o=new Uint8Array(BF(e)),{focus:i}=_j(Sj(o,t));s=i===null?null:`${Nj(i.x)} ${Nj(i.y)}`}catch{s=null}return Rj.set(n,s),s}function n2(e,t,n,r){if(!k(t)||t===""||t.includes("${"))return;if(Dj.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=t2(Lj(o,n,r));if(i!==null)e.style={...s,objectPosition:i}}function gs(e){return e.replaceAll("$","$$$$")}async function zy(e,t,n,r,s,o=[]){let i=new Map;return await Fj(e,t,n,r,s??new Map,i,o),{imageRefs:i}}async function Fj(e,t,n,r,s,o,i,a=null){if(e.tagName==="img"){if(await u2(e,t,n,r,s,o,i,a))return}if(k(e.innerHTML)&&e.innerHTML.includes("<img"))e.innerHTML=await g2(e.innerHTML,t,n,r,s,o,i,By(e,a));let l=By(e,a);for(let c of r2(e))await Fj(c,t,n,r,s,o,i,l)}function r2(e){let t=[],n=(s)=>{if(!Ot(s))return;if(s.$prototype==="Array"){n(s.map);return}t.push(s)};if(Array.isArray(e.children))for(let s of e.children)n(s);else n(e.children);let r=e.cases??{};for(let s of Object.values(r))n(s);return t}async function Vj(e,t,n,r,s,o,i,a){if(!k(e)||t)return null;let l=e2(e,n);if(!l&&QF(e))return null;if(l)return{dims:null,sources:[],srcset:Cj(e,n,1/0,null)};let c=Lj(e,r,a);if(!Mj(c))return null;if(n.service==="cloudflare"){let g=await XF(c,o),x=Cj(e,n,g.width??1/0,g.hash);return{dims:g.width&&g.height?{height:g.height,width:g.width}:null,sources:[],srcset:x}}if(Ij.has(Uy(c).toLowerCase()))return null;let u=i.get(c);if(!u)u=await ZF(c,e,n,r,s),i.set(c,u);let d=o2(n.formats,u.variants),m=[...Tj.filter((g)=>d.includes(g)),...d.filter((g)=>!Tj.includes(g))].flatMap((g)=>{let x=uj(u.variants,g);return x===""?[]:[{srcset:x,type:s2.get(g)??`image/${g}`}]}),y=u.original?.width&&u.original.height?{height:u.original.height,width:u.original.width}:null,S=n.picture!==!1&&m.length>1;return{dims:y,fallbackSrc:a2(u.variants,d),sources:S?m:[],srcset:m[0]?.srcset??""}}function o2(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 a2(e,t){let n=i2.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&&Dy(r.outputPath)}function Jj(e){if(!k(e))return null;let t=l2.exec(e.trim());if(!t)return null;let n=Number(t[1]);return t[2]==="rem"?n*16:n}function By(e,t){let{style:n}=e;if(!D(n))return t;let r=t;for(let s of[Jj(n.maxWidth),Jj(n.width)])if(s!==null&&(r===null||s<r))r=s;return r}function qj(e){if(e===null)return;let t=Math.round(e);return`(max-width: ${t}px) 100vw, ${t}px`}function c2(e,t){for(let[n,r]of Object.entries(e)){if(n==="id"||n==="className")continue;let s=Bu("img",n);if(!s)continue;if(delete e[n],t[s.attribute]!==void 0)continue;if(me(r)||le(r)){t[s.attribute]=r;continue}let o=qg(s,r);if(o===null)continue;t[s.attribute]=o===""&&s.kind!=="text"?!0:o}}async function u2(e,t,n,r,s,o,i,a=null){if(!e.attributes)e.attributes={};let l=e.attributes;c2(e,l),n2(e,l.src,n,i);let c=t.optimize?await Vj(l.src,l["data-no-optimize"]!==void 0||l.srcset!==void 0,t,n,r,s,o,i):null,u=By(e,a),d=l.sizes??qj(u)??t.sizes;if(c){if(c.srcset!==""){if(l.srcset=c.srcset,d!==void 0)l.sizes=d;if(c.fallbackSrc!==void 0)l.src=c.fallbackSrc}if(c.dims&&l.width===void 0&&l.height===void 0)l.width=String(c.dims.width),l.height=String(c.dims.height)}if(Object.assign(l,Vy(l,t.lazyLoad)),c&&c.sources.length>0)return f2(e,c.sources,d),!0;return!1}function f2(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 l={};if(s!==void 0&&s!=="")l.sizes=s;return l.srcset=a.srcset,l.type=a.type,{attributes:l,tagName:"source"}});i.push(o),e.tagName="picture",e.attributes={},e.children=i}async function g2(e,t,n,r,s,o,i,a){let l=[];for(let u of e.matchAll(d2)){let d=u[0],p=u[1],m=(Gl(p,"src")??"").replaceAll("&amp;","&"),y=t.optimize&&m!==""?await Vj(m,p2.test(p)||Wy(p,"srcset")||y2(e,u.index),t,n,r,s,o,i):null,S=Gl(p,"sizes"),g=S??qj(a)??t.sizes,x=p,P="";if(y&&y.srcset!==""){if(P+=` srcset="${y.srcset}"`,S===void 0&&g!==void 0&&g!=="")P+=` sizes="${g}"`;let{fallbackSrc:j}=y;if(j!==void 0)x=p.replace(m2,(A,T)=>`${T}src="${j}"`)}if(y?.dims&&!Wy(p,"width")&&!Wy(p,"height"))P+=` width="${y.dims.width}" height="${y.dims.height}"`;let w=Vy({decoding:Gl(p,"decoding"),fetchpriority:Gl(p,"fetchpriority"),loading:Gl(p,"loading")},t.lazyLoad);for(let[j,A]of Object.entries(w))P+=` ${j}="${A}"`;if(P==="")continue;let E=y&&y.sources.length>0?x2(x,y.sources,g,P):`<img${x}${P}>`;l.push({match:d,replacement:E})}let c=e;for(let{match:u,replacement:d}of l)c=c.replace(u,gs(d));return c}function y2(e,t){let n=e.slice(0,t).toLowerCase();return n.lastIndexOf("<picture")>n.lastIndexOf("</picture>")}function x2(e,t,n,r){let s=e.replace(h2,""),o=r.replace(/ srcset="[^"]*"/,"").replace(/ sizes="[^"]*"/,""),i=n===void 0||n===""?"":` sizes="${n}"`;return`<picture>${t.map((l)=>`<source type="${l.type}" srcset="${l.srcset}"${i}>`).join("")}<img${s}${o}></picture>`}function Gl(e,t){return new RegExp(`(?:^|\\s)${t}="([^"]*)"`,"i").exec(e)?.[1]}function Wy(e,t){return new RegExp(`(?:^|\\s)${t}=`,"i").test(e)}var KF,Ij,GF,Dj,Aj=!1,Rj,Tj,s2,i2,l2,d2,p2,m2,h2;var Hj=J(()=>{Ly();Fy();An();uh();ce();yn();Lt();wj();kj();KF=new Set([".jpg",".jpeg",".png",".webp",".tif",".tiff",".bmp"]),Ij=new Set([".avif"]),GF=new Set([".svg",".gif"]),Dj=["http://","https://","data:","//"];Rj=new Map;Tj=["avif","webp","jpeg","png"],s2=new Map([["avif","image/avif"],["jpeg","image/jpeg"],["png","image/png"],["webp","image/webp"]]);i2=["jpeg","png"];l2=/^(\d+(?:\.\d+)?)(px|rem)$/;d2=/<img\b([^>]*)>/gi,p2=/\bdata-no-optimize\b/,m2=/(^|\s)src="[^"]*"/i,h2=/(?:^|\s)sizes="[^"]*"/i});import{createHash as b2}from"node:crypto";import{existsSync as $2}from"node:fs";import{join as Wj}from"node:path";function v2(e,t){let n=e.replace(/^\//,"");return e.endsWith("/")||n===""?Wj(t,n,"index.html"):Wj(t,n)}function Gy(e){if(e===void 0)return null;if(e===!1)return!1;if(e===!0)return{};return e.enabled===!1?!1:e}function E2(e){let t=JSON.stringify({fallback:e.offlineFallback??null,precache:[...e.precache??[]].toSorted(),scope:e.scope??"/"});return b2("sha256").update(t,"utf8").digest("hex").slice(0,8)}function Bj(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(!$2(v2(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)=>Fe(n,m)),l=Fe(n,S2),c=i===void 0?null:Fe(n,i),u=`${Fe(n,w2)}/`,d=`jx-${E2(e)}`,p=`/*
434
+ 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 Rj(){return Oj??=VF(LF()),Oj}async function Tj(e){return Rj().imageMetadata(e)}async function Nj(e){return Rj().processImage(e)}var Cj,_j,Oj;var Jj=M(()=>{kj();Cj={avif:65,jpeg:80},_j=NF(import.meta.url)});import{createHash as tx}from"node:crypto";import{readFileSync as qF}from"node:fs";import{basename as HF,extname as WF,resolve as Mj}from"node:path";async function sd(e){return Tj(e)}function sa(e){let t=qF(e);return tx("md5").update(t).digest("hex").slice(0,8)}function zF(e,t){let n=new Map(Object.entries(e)).get(t);if(n!==void 0)return n;return new Map(Object.entries(Cj)).get(t)??UF}function KF(e,t,n){return tx("md5").update(`${sa(e)}:${Ij}:${t}:${n}`).digest("hex").slice(0,8)}function Dj(e){let t=JSON.stringify({formats:e.formats,quality:e.quality,v:Ij,widths:e.widths});return tx("md5").update(t).digest("hex").slice(0,8)}async function Lj(e,t,n){let r=Mj(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 Nj({formats:n.formats,hashes:Object.fromEntries(n.formats.map((i)=>[i,KF(e,i,zF(n.quality,i))])),outDir:r,quality:s,source:e,stem:HF(e,WF(e)),widths:n.widths});return{contentHash:sa(e),original:o.original,variants:o.variants.map((i)=>({absolutePath:Mj(r,i.fileName),format:i.format,outputPath:`/${BF}/${i.fileName}`,width:i.width}))}}function Fj(e,t){return e.flatMap((n)=>n.format===t?[`${nx(n.outputPath)} ${n.width}w`]:[]).join(", ")}function nx(e){return e.split("/").map((t)=>encodeURIComponent(t)).join("/")}var BF="images/_optimized",Ij=4,UF=100;var od=M(()=>{Jj()});import{existsSync as GF,mkdirSync as XF,readFileSync as YF,rmSync as ZF,writeFileSync as QF}from"node:fs";import{basename as Vj,extname as e2,resolve as Gl}from"node:path";import{execSync as t2}from"node:child_process";import{createHash as n2}from"node:crypto";import{tmpdir as r2}from"node:os";function o2(){let e=process.env.npm_config_cache??process.env.NPM_CONFIG_CACHE;if(e)return e;try{let t=t2("npm config get cache",{cwd:r2(),encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:s2}).trim();return t&&t!=="undefined"?t:null}catch{return null}}function ad(e){if(id===void 0)id=o2();if(id){let t=Gl(e),n=n2("md5").update(t).digest("hex").slice(0,8);return Gl(id,"jxsuite-images",`${Vj(t)}-${n}`)}return Gl(e,".cache/images")}function qj(e,t){return`${sa(e)}:${Dj(t)}:${Vj(e,e2(e))}`}function Hj(e){let t=Gl(ad(e),"manifest.json");if(!GF(t))return{entries:{},touched:new Set,version:1};try{let n=JSON.parse(YF(t,"utf8"));return n.touched=new Set,n}catch{return{entries:{},touched:new Set,version:1}}}function Wj(e,t,n={}){if(n.prune&&t.touched)i2(t,t.touched);let r=ad(e);XF(r,{recursive:!0}),QF(Gl(r,"manifest.json"),JSON.stringify({entries:t.entries,version:t.version},null,2),"utf8")}function i2(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))ZF(i.absolutePath,{force:!0});delete e.entries[s]}}function Bj(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 Uj(e,t){e.touched?.add(t);let n=e.entries[t];if(!n)return null;return n.manifest}function zj(e,t,n,r){e.touched?.add(t),e.entries[t]={manifest:r,source:n,timestamp:Date.now()}}var id,s2=3000;var rx=M(()=>{od()});function sx(e,t){if(!t||Kj(e.loading))return{};if(String(e.fetchpriority??"").toLowerCase()==="high")return{};return Kj(e.decoding)?{loading:"lazy"}:{decoding:"async",loading:"lazy"}}var Kj=(e)=>e!==void 0&&e!==null&&e!=="";function Xj(e){let t=e.lastIndexOf(".");return a2.get(t>0?e.slice(t).toLowerCase():"")??null}function cd(e){try{return c2.decode(e)}catch{throw new In("The metadata is not valid UTF-8.")}}function ld(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Xl(e,t,n){return String.fromCodePoint(...e.subarray(t,t+n))}function Yj(e,t){switch(t){case"jpeg":return d2(e).packet;case"png":return g2(e).packet;case"webp":return x2(e).packet;default:return w2(cd(e)).packet}}function u2(e){if(e[0]!==255||e[1]!==216)throw new In("Not a JPEG file.");let t=[],n=2;while(n+4<=e.length){if(e[n]!==255)throw new In("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=ld(e).getUint16(n+2),o=n+2+s;if(s<2||o>e.length)throw new In("The JPEG's markers are damaged.");t.push({end:o,marker:r,start:n}),n=o}return t}function f2(e,t){let n=t.start+4;return t.marker===225&&t.end-n>=ox.length&&ox.every((r,s)=>e[n+s]===r)}function d2(e){let t=u2(e),n=t.find((s)=>f2(e,s));return{packet:n===void 0?null:cd(e.subarray(n.start+4+ox.length,n.end)),parts:t}}function m2(e){if(!Gj.every((r,s)=>e[s]===r))throw new In("Not a PNG file.");let t=[],n=Gj.length;while(n+12<=e.length){let r=ld(e).getUint32(n),s=n+12+r;if(s>e.length)throw new In("The PNG's chunks are damaged.");let o=Xl(e,n+4,4);if(t.push({dataStart:n+8,end:s,start:n,type:o}),n=s,o==="IEND")break}return t}function h2(e,t){if(t.type!=="iTXt")return null;let n=e.subarray(t.dataStart,t.end-4),r=n.indexOf(0);if(r===-1||Xl(n,0,r)!==p2)return null;if(n[r+1]!==0)throw new In("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 In("The PNG's metadata chunk is damaged.");return cd(n.subarray(o+1))}function g2(e){let t=m2(e);return{packet:t.map((r)=>h2(e,r)).find((r)=>r!==null)??null,parts:t}}function y2(e){if(Xl(e,0,4)!=="RIFF"||Xl(e,8,4)!=="WEBP")throw new In("Not a WebP file.");let t=Math.min(e.length,8+ld(e).getUint32(4,!0)),n=[],r=12;while(r+8<=t){let s=ld(e).getUint32(r+4,!0),o=r+8,i=o+s+s%2;if(o+s>t)throw new In("The WebP's chunks are damaged.");n.push({dataStart:o,end:Math.min(i,t),fourcc:Xl(e,r,4),size:s,start:r}),r=i}return n}function x2(e){let t=y2(e),n=t.find((s)=>s.fourcc==="XMP ");return{packet:n===void 0?null:cd(e.subarray(n.dataStart,n.dataStart+n.size)),parts:t}}function $2(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 S2(e){let t=/<svg[\s>/]/.exec(e);if(t===null)throw new In("Not an SVG file.");let n=$2(e,t.index);if(n===-1)throw new In("The SVG's root element is damaged.");return{end:n,selfClosing:e[n-1]==="/",start:t.index}}function w2(e){S2(e);let t=b2.exec(e);return t===null?{end:-1,packet:null,start:-1}:{end:t.index+t[0].length,packet:t[0],start:t.index}}var In,a2,l2,c2,ox,Gj,p2="XML:com.adobe.xmp",b2;var Zj=M(()=>{In=class In extends Error{name="XmpContainerError"};a2=new Map([[".jpeg","jpeg"],[".jpg","jpeg"],[".png","png"],[".svg","svg"],[".webp","webp"]]);l2=new TextEncoder,c2=new TextDecoder("utf-8",{fatal:!0});ox=l2.encode("http://ns.adobe.com/xap/1.0/\x00");Gj=Uint8Array.of(137,80,78,71,13,10,26,10);b2=/<([\w.-]+:)?xmpmeta\b[\s\S]*?<\/\1?xmpmeta\s*>/});function Qj(){return{alt:"",focus:null,tags:[]}}function E2(e){if(e.startsWith("#x")||e.startsWith("#X"))return Number.parseInt(e.slice(2),16);return e.startsWith("#")?Number(e.slice(1)):null}function ix(e){return e.replaceAll(/&(#x[\da-f]+|#\d+|\w+);/gi,(t,n)=>{let r=E2(n),s=r===null?v2.get(n):r<=1114111?String.fromCodePoint(r):void 0;if(s===void 0)throw new Dn(`Unknown entity ${t}`);return s})}function j2(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:ix(e.slice(r))});break}if(o>r)s().children.push({type:"text",value:ix(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 Dn("A packet may not declare a document type.");else if(i.startsWith("</")){let l=e.indexOf(">",o);if(l===-1)throw new Dn("Unclosed end tag.");let c=e.slice(o+2,l).trim(),u=n.pop();if(u===void 0||u===t||u.name!==c)throw new Dn(`Unexpected </${c}>.`);r=l+1;continue}else{r=P2(e,o,n);continue}if(a===-1)throw new Dn("Unterminated markup.");s().children.push({source:e.slice(o,a),type:"raw"}),r=a}if(n.length!==1)throw new Dn(`<${s().name}> is never closed.`);return t.children}function P2(e,t,n){let r=t+1,s=eP.exec(e.slice(r));if(s===null)throw new Dn("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 Dn(`<${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=eP.exec(e.slice(r));if(a===null)throw new Dn(`<${o.name}> has a malformed attribute.`);r+=a[0].length;while(/\s/.test(e[r]??""))r+=1;if(e[r]!=="=")throw new Dn(`${a[0]} has no value.`);r+=1;while(/\s/.test(e[r]??""))r+=1;let l=e[r];if(l!=='"'&&l!=="'")throw new Dn(`${a[0]} is not quoted.`);let c=e.indexOf(l,r+1);if(c===-1)throw new Dn(`${a[0]} is never closed.`);o.attrs.push([a[0],ix(e.slice(r+1,c))]),r=c+1}}function oa(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 k2(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 yr(e,t,n,r,s=!1){let o=k2(e,t,s);return o!==null&&o[0]===n&&o[1]===r}function ia(e){return e.filter((t)=>t.type==="element")}function aa(e){return e.children.map((t)=>t.type==="text"?t.value:t.type==="element"?aa(t):"").join("")}function nP(e,t=new Map){let n=[];for(let r of ia(e)){let s=oa(r,t);if(yr(r.name,s,"http://www.w3.org/1999/02/22-rdf-syntax-ns#","Description"))n.push([r,s]);else n.push(...nP(r.children,s))}return n}function la(e,t){let n=[];for(let r of ia(e.children)){let s=oa(r,t);for(let o of ia(r.children)){let i=oa(o,s);if(yr(o.name,i,"http://www.w3.org/1999/02/22-rdf-syntax-ns#","li"))n.push([o,i])}}return n}function _2(e,t){let n=e.attrs.find(([r])=>yr(r,t,"http://www.w3.org/XML/1998/namespace","lang",!0));return n===void 0?null:n[1]}function O2(e,t){let n=la(e,t),r=n.find(([s,o])=>_2(s,o)?.toLowerCase()==="x-default")??n[0];return r===void 0?aa(e).trim():aa(r[0])}function ud(e,t){if(!e.attrs.some(([r,s])=>s==="Resource"&&yr(r,t,"http://www.w3.org/1999/02/22-rdf-syntax-ns#","parseType",!0)))for(let r of ia(e.children)){let s=oa(r,t);if(yr(r.name,s,"http://www.w3.org/1999/02/22-rdf-syntax-ns#","Description"))return[r,s]}return[e,t]}function Zl(e,t,n,r){for(let s of ia(e.children)){let o=oa(s,t);if(yr(s.name,o,n,r))return[s,o]}return null}function Yl(e,t,n,r){let s=e.attrs.find(([i])=>yr(i,t,n,r,!0));if(s!==void 0)return s[1].trim();let o=Zl(e,t,n,r);return o===null?null:aa(o[0]).trim()}function tP(e){if(e===null||e==="")return null;let t=Number(e);return Number.isFinite(t)&&t>=0&&t<=1?t:null}function A2(e,t){let n=Zl(e,t,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rRole");if(n===null)return!1;return la(...n).some(([r,s])=>{let[o,i]=ud(r,s),a=Zl(o,i,"http://ns.adobe.com/xap/1.0/","Identifier");return(a===null?[Yl(o,i,"http://ns.adobe.com/xap/1.0/","Identifier")??""]:la(...a).map(([c])=>aa(c).trim())).some((c)=>c.replace(/^https:/,"http:")==="http://cv.iptc.org/newscodes/imageregionrole/areaOfInterest")})}function C2(e,t){let[n,r]=ud(e,t),s=Zl(n,r,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","RegionBoundary");if(s===null||!A2(n,r))return null;let[o,i]=ud(...s),a=Zl(o,i,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbVertices");if(Yl(o,i,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbShape")!=="polygon"||Yl(o,i,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbUnit")!=="relative"||a===null)return null;let l=la(...a);if(l.length!==1)return null;let[c,u]=ud(...l[0]),d=tP(Yl(c,u,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbX")),p=tP(Yl(c,u,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbY"));return d===null||p===null?null:{x:d,y:p}}function R2(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 rP(e){if(e===null)return Qj();let t=Qj(),n=!1;for(let[r,s]of nP(j2(e))){for(let[o,i]of r.attrs)if(!n&&yr(o,s,"http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/","AltTextAccessibility",!0))t.alt=i,n=!0;for(let o of ia(r.children)){let i=oa(o,s);if(!n&&yr(o.name,i,"http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/","AltTextAccessibility"))t.alt=O2(o,i),n=!0;else if(yr(o.name,i,"http://purl.org/dc/elements/1.1/","subject"))t.tags.push(...la(o,i).map(([a])=>aa(a)));else if(t.focus===null&&yr(o.name,i,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","ImageRegion"))for(let[a,l]of la(o,i))t.focus??=C2(a,l)}}return t.tags=R2(t.tags),t.alt=t.alt.trim(),t}var Dn,v2,eP;var sP=M(()=>{Dn=class Dn extends Error{name="XmpParseError"};v2=new Map([["amp","&"],["apos","'"],["gt",">"],["lt","<"],["quot",'"']]);eP=/^[A-Za-z_][\w.:-]*/});import{existsSync as dP,readFileSync as T2,statSync as N2}from"node:fs";import{basename as J2,extname as cx,resolve as oP}from"node:path";async function D2(e,t){let n=t.get(e);if(!n){let r=sa(e);try{let s=await sd(e);n={width:s.width,height:s.height,hash:r}}catch(s){if(!iP)iP=!0,console.warn(`Could not read image dimensions (${ye(s)}) — `+"emitting srcsets without width/height attributes.");n={width:null,height:null,hash:r}}t.set(e,n)}return n}function aP(e,t,n,r){let s=t.quality.webp??80,o=e.startsWith("/")?"":"/",i=r?`?v=${r}`:"",a=L2(e);return t.widths.filter((l)=>l<=n).toSorted((l,c)=>l-c).map((l)=>`/cdn-cgi/image/width=${l},quality=${s},fit=scale-down,format=auto${o}${a}${i} ${l}w`).join(", ")}function L2(e){return e.replaceAll(/[\s,]/g,(t)=>encodeURIComponent(t))}async function F2(e,t,n,r,s){let o=qj(e,n),i=Uj(s,o);if(i){if(i.variants.every((c)=>dP(c.absolutePath)))return i}if(!i)console.log(` Optimizing ${J2(e)}...`);let a=await Lj(e,ad(r),n);return zj(s,o,t,a),a}function V2(e){if(!e)return!0;if(e.includes("${"))return!0;if(mP.some((n)=>e.startsWith(n)))return!0;let t=cx(e).toLowerCase();return!M2.has(t)&&!pP.has(t)}function q2(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(I2.has(cx(n.pathname).toLowerCase()))return!1;return t.remoteDomains.includes(n.hostname)}catch{return!1}}function fd(e,t,n){let r=n?.length?Nu(n,e):null;if(r)return r;if(e.startsWith("/"))return oP(t,"public",e.slice(1));return oP(t,e)}function cP(e){return`${Math.round(e*1000)/10}%`}function H2(e){let t=Xj(e);if(t===null)return null;let n;try{let o=N2(e);n=`${e}|${o.mtimeMs}|${o.size}`}catch{return null}let r=lP.get(n);if(r!==void 0)return r;let s=null;try{let o=new Uint8Array(T2(e)),{focus:i}=rP(Yj(o,t));s=i===null?null:`${cP(i.x)} ${cP(i.y)}`}catch{s=null}return lP.set(n,s),s}function W2(e,t,n,r){if(!_(t)||t===""||t.includes("${"))return;if(mP.some((a)=>t.startsWith(a)))return;let{style:s}=e;if(s!==void 0&&!F(s))return;if(s?.objectPosition!==void 0)return;let[o=""]=t.split(/[?#]/),i=H2(fd(o,n,r));if(i!==null)e.style={...s,objectPosition:i}}function ys(e){return e.replaceAll("$","$$$$")}async function ux(e,t,n,r,s,o=[]){let i=new Map;return await hP(e,t,n,r,s??new Map,i,o),{imageRefs:i}}async function hP(e,t,n,r,s,o,i,a=null){if(e.tagName==="img"){if(await Z2(e,t,n,r,s,o,i,a))return}if(_(e.innerHTML)&&e.innerHTML.includes("<img"))e.innerHTML=await sV(e.innerHTML,t,n,r,s,o,i,lx(e,a));let l=lx(e,a);for(let c of B2(e))await hP(c,t,n,r,s,o,i,l)}function B2(e){let t=[],n=(s)=>{if(!Ct(s))return;if(s.$prototype==="Array"){n(s.map);return}t.push(s)};if(Array.isArray(e.children))for(let s of e.children)n(s);else n(e.children);let r=e.cases??{};for(let s of Object.values(r))n(s);return t}async function gP(e,t,n,r,s,o,i,a){if(!_(e)||t)return null;let l=q2(e,n);if(!l&&V2(e))return null;if(l)return{dims:null,sources:[],srcset:aP(e,n,1/0,null)};let c=fd(e,r,a);if(!dP(c))return null;if(n.service==="cloudflare"){let h=await D2(c,o),x=aP(e,n,h.width??1/0,h.hash);return{dims:h.width&&h.height?{height:h.height,width:h.width}:null,sources:[],srcset:x}}if(pP.has(cx(c).toLowerCase()))return null;let u=i.get(c);if(!u)u=await F2(c,e,n,r,s),i.set(c,u);let d=z2(n.formats,u.variants),m=[...uP.filter((h)=>d.includes(h)),...d.filter((h)=>!uP.includes(h))].flatMap((h)=>{let x=Fj(u.variants,h);return x===""?[]:[{srcset:x,type:U2.get(h)??`image/${h}`}]}),g=u.original?.width&&u.original.height?{height:u.original.height,width:u.original.width}:null,b=n.picture!==!1&&m.length>1;return{dims:g,fallbackSrc:G2(u.variants,d),sources:b?m:[],srcset:m[0]?.srcset??""}}function z2(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 G2(e,t){let n=K2.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&&nx(r.outputPath)}function fP(e){if(!_(e))return null;let t=X2.exec(e.trim());if(!t)return null;let n=Number(t[1]);return t[2]==="rem"?n*16:n}function lx(e,t){let{style:n}=e;if(!F(n))return t;let r=t;for(let s of[fP(n.maxWidth),fP(n.width)])if(s!==null&&(r===null||s<r))r=s;return r}function yP(e){if(e===null)return;let t=Math.round(e);return`(max-width: ${t}px) 100vw, ${t}px`}function Y2(e,t){for(let[n,r]of Object.entries(e)){if(n==="id"||n==="className")continue;let s=lf("img",n);if(!s)continue;if(delete e[n],t[s.attribute]!==void 0)continue;if(pe(r)||ce(r)){t[s.attribute]=r;continue}let o=sy(s,r);if(o===null)continue;t[s.attribute]=o===""&&s.kind!=="text"?!0:o}}async function Z2(e,t,n,r,s,o,i,a=null){if(!e.attributes)e.attributes={};let l=e.attributes;Y2(e,l),W2(e,l.src,n,i);let c=t.optimize?await gP(l.src,l["data-no-optimize"]!==void 0||l.srcset!==void 0,t,n,r,s,o,i):null,u=lx(e,a),d=l.sizes??yP(u)??t.sizes;if(c){if(c.srcset!==""){if(l.srcset=c.srcset,d!==void 0)l.sizes=d;if(c.fallbackSrc!==void 0)l.src=c.fallbackSrc}if(c.dims&&l.width===void 0&&l.height===void 0)l.width=String(c.dims.width),l.height=String(c.dims.height)}if(Object.assign(l,sx(l,t.lazyLoad)),c&&c.sources.length>0)return Q2(e,c.sources,d),!0;return!1}function Q2(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 l={};if(s!==void 0&&s!=="")l.sizes=s;return l.srcset=a.srcset,l.type=a.type,{attributes:l,tagName:"source"}});i.push(o),e.tagName="picture",e.attributes={},e.children=i}async function sV(e,t,n,r,s,o,i,a){let l=[];for(let u of e.matchAll(eV)){let d=u[0],p=u[1],m=(Ql(p,"src")??"").replaceAll("&amp;","&"),g=t.optimize&&m!==""?await gP(m,tV.test(p)||ax(p,"srcset")||oV(e,u.index),t,n,r,s,o,i):null,b=Ql(p,"sizes"),h=b??yP(a)??t.sizes,x=p,k="";if(g&&g.srcset!==""){if(k+=` srcset="${g.srcset}"`,b===void 0&&h!==void 0&&h!=="")k+=` sizes="${h}"`;let{fallbackSrc:E}=g;if(E!==void 0)x=p.replace(nV,(O,I)=>`${I}src="${E}"`)}if(g?.dims&&!ax(p,"width")&&!ax(p,"height"))k+=` width="${g.dims.width}" height="${g.dims.height}"`;let w=sx({decoding:Ql(p,"decoding"),fetchpriority:Ql(p,"fetchpriority"),loading:Ql(p,"loading")},t.lazyLoad);for(let[E,O]of Object.entries(w))k+=` ${E}="${O}"`;if(k==="")continue;let v=g&&g.sources.length>0?iV(x,g.sources,h,k):`<img${x}${k}>`;l.push({match:d,replacement:v})}let c=e;for(let{match:u,replacement:d}of l)c=c.replace(u,ys(d));return c}function oV(e,t){let n=e.slice(0,t).toLowerCase();return n.lastIndexOf("<picture")>n.lastIndexOf("</picture>")}function iV(e,t,n,r){let s=e.replace(rV,""),o=r.replace(/ srcset="[^"]*"/,"").replace(/ sizes="[^"]*"/,""),i=n===void 0||n===""?"":` sizes="${n}"`;return`<picture>${t.map((l)=>`<source type="${l.type}" srcset="${l.srcset}"${i}>`).join("")}<img${s}${o}></picture>`}function Ql(e,t){return new RegExp(`(?:^|\\s)${t}="([^"]*)"`,"i").exec(e)?.[1]}function ax(e,t){return new RegExp(`(?:^|\\s)${t}=`,"i").test(e)}var M2,pP,I2,mP,iP=!1,lP,uP,U2,K2,X2,eV,tV,nV,rV;var fx=M(()=>{od();rx();hn();Xg();ae();$n();Ft();Zj();sP();M2=new Set([".jpg",".jpeg",".png",".webp",".tif",".tiff",".bmp"]),pP=new Set([".avif"]),I2=new Set([".svg",".gif"]),mP=["http://","https://","data:","//"];lP=new Map;uP=["avif","webp","jpeg","png"],U2=new Map([["avif","image/avif"],["jpeg","image/jpeg"],["png","image/png"],["webp","image/webp"]]);K2=["jpeg","png"];X2=/^(\d+(?:\.\d+)?)(px|rem)$/;eV=/<img\b([^>]*)>/gi,tV=/\bdata-no-optimize\b/,nV=/(^|\s)src="[^"]*"/i,rV=/(?:^|\s)sizes="[^"]*"/i});import{closeSync as aV,existsSync as lV,openSync as cV,readSync as uV,statSync as xP}from"node:fs";function fV(e){let t=new Uint8Array(10),n=cV(e,"r");try{if(uV(n,t,0,10,0)<10)return null}finally{aV(n)}let r=String.fromCodePoint(...t.subarray(0,6));if(r!=="GIF87a"&&r!=="GIF89a")return null;let s=new DataView(t.buffer),o=s.getUint16(6,!0),i=s.getUint16(8,!0);return o>0&&i>0?{height:i,width:o}:null}async function dV(e){let t=xP(e),n=`${e}:${t.mtimeMs}:${t.size}`;if(dx.has(n))return dx.get(n)??null;let r=null;try{if(r=fV(e),r===null){let{height:s,width:o}=await sd(e);r=o>0&&s>0?{height:s,width:o}:null}}catch{r=null}return dx.set(n,r),r}function pV(e,t){let n=e.trim(),r=t?.replace(/\/+$/,"");if(r&&n.startsWith(`${r}/`))n=n.slice(r.length);if(!n.startsWith("/")||n.startsWith("//"))return null;n=n.split("#")[0].split("?")[0];try{n=decodeURIComponent(n)}catch{return null}return n.split("/").includes("..")?null:n}async function bP(e,t){let n=(c,u)=>F(c)&&c.tagName==="meta"&&c.attributes?.property===u,r=e.findLastIndex((c)=>n(c,"og:image"));if(r===-1||e.some((c)=>n(c,"og:image:width")||n(c,"og:image:height")))return e;let s=e[r].attributes?.content,o=_(s)?pV(s,t.siteUrl):null;if(o===null)return e;let i=fd(o,t.projectRoot,t.mounts);if(!lV(i)||!xP(i).isFile())return e;let a=await dV(i);if(a===null)return e;let l=(c,u)=>({attributes:{content:String(u),property:c},tagName:"meta"});return[...e.slice(0,r+1),l("og:image:width",a.width),l("og:image:height",a.height),...e.slice(r+1)]}var dx;var $P=M(()=>{od();fx();ae();dx=new Map});import{createHash as mV}from"node:crypto";import{existsSync as hV}from"node:fs";import{join as SP}from"node:path";function xV(e,t){let n=e.replace(/^\//,"");return e.endsWith("/")||n===""?SP(t,n,"index.html"):SP(t,n)}function mx(e){if(e===void 0)return null;if(e===!1)return!1;if(e===!0)return{};return e.enabled===!1?!1:e}function bV(e){let t=JSON.stringify({fallback:e.offlineFallback??null,precache:[...e.precache??[]].toSorted(),scope:e.scope??"/"});return mV("sha256").update(t,"utf8").digest("hex").slice(0,8)}function wP(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(!hV(xV(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)=>Te(n,m)),l=Te(n,gV),c=i===void 0?null:Te(n,i),u=`${Te(n,yV)}/`,d=`jx-${bV(e)}`,p=`/*
432
435
  * Generated by @jxsuite/compiler — configure via \`serviceWorker\` in project.json.
433
436
  * Set \`"serviceWorker": false\` to replace this with a worker that removes itself.
434
437
  */
@@ -529,7 +532,7 @@ self.addEventListener("fetch", (event) => {
529
532
  })(),
530
533
  );
531
534
  });
532
- `;return{errors:s,path:Ky,source:p,warnings:r}}function Uj(){return{errors:[],path:Ky,source:`/*
535
+ `;return{errors:s,path:px,source:p,warnings:r}}function vP(){return{errors:[],path:px,source:`/*
533
536
  * Generated by @jxsuite/compiler. This site had a service worker and no longer does.
534
537
  *
535
538
  * A worker is sticky: removing the file would leave every previous visitor running the old one
@@ -552,89 +555,89 @@ self.addEventListener("activate", (event) => {
552
555
  })(),
553
556
  );
554
557
  });
555
- `,warnings:[]}}function zj(e,t=""){return`if('serviceWorker' in navigator){addEventListener('load',function(){navigator.serviceWorker.register('${Fe(t,`/${Ky}`)}',{scope:${JSON.stringify(Fe(t,e))}}).catch(function(){})})}`}var Ky="sw.js",S2="/images/_optimized/",w2="/_jx";var Kj=J(()=>{An()});import{mkdirSync as j2,writeFileSync as P2}from"node:fs";import{dirname as _2,join as k2}from"node:path";function Ds(e,t,n){if(n!==void 0)e[t]=n}function Gj(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=Po(e.url),i=[];for(let u of t.icons??[])i.push(k(u.src)?{...u,src:Fe(o,u.src)}:u);let a={display:t.display??"standalone",icons:i,name:s,short_name:t.shortName??s,start_url:Fe(o,t.startUrl??"/")};Ds(a,"description",t.description),Ds(a,"theme_color",t.themeColor),Ds(a,"background_color",t.backgroundColor),Ds(a,"scope",t.scope===void 0?void 0:Fe(o,t.scope)),Ds(a,"orientation",t.orientation),Ds(a,"lang",t.lang),Ds(a,"dir",t.dir),Ds(a,"categories",t.categories);let l=new Set(i.flatMap((u)=>(u.sizes??"").split(/\s+/).map((d)=>Math.trunc(Number(d.split("x")[0]))))),c=O2.filter((u)=>!l.has(u));if(c.length>0)r.push(`manifest: no ${c.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)}
556
- `,path:"manifest.webmanifest"}],warnings:r}}function Xj(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 Yj(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 l=new Date(n.expires);if(Number.isNaN(l.getTime()))r.push(`securityTxt: \`expires\` is not a valid date: "${n.expires}".`);else if(l.getTime()<=t.getTime())r.push(`securityTxt: \`expires\` is in the past (${l.toISOString()}) — an expired `+"security.txt tells a reporter not to trust what it says.")}let i=[];for(let l of n.preferredLanguages??[]){let c=Bn(l);if(c===null)r.push(`securityTxt.preferredLanguages: "${l}" is not a well-formed language tag.`);else i.push(c)}if(r.length>0)return{errors:r,files:[],warnings:s};let a=["# Generated by @jxsuite/compiler — configure via securityTxt in project.json.",...o.map((l)=>`Contact: ${l}`),`Expires: ${new Date(n.expires).toISOString().replace(/\.\d{3}Z$/,"Z")}`,...(n.encryption??[]).map((l)=>`Encryption: ${l}`),...(n.acknowledgments??[]).map((l)=>`Acknowledgments: ${l}`),...i.length>0?[`Preferred-Languages: ${i.join(", ")}`]:[],...n.canonical===void 0?[]:[`Canonical: ${n.canonical}`],...(n.policy??[]).map((l)=>`Policy: ${l}`),...(n.hiring??[]).map((l)=>`Hiring: ${l}`)];return{errors:r,files:[{content:`${a.join(`
558
+ `,warnings:[]}}function EP(e,t=""){return`if('serviceWorker' in navigator){addEventListener('load',function(){navigator.serviceWorker.register('${Te(t,`/${px}`)}',{scope:${JSON.stringify(Te(t,e))}}).catch(function(){})})}`}var px="sw.js",gV="/images/_optimized/",yV="/_jx";var jP=M(()=>{hn()});import{mkdirSync as $V,writeFileSync as SV}from"node:fs";import{dirname as wV,join as vV}from"node:path";function Vs(e,t,n){if(n!==void 0)e[t]=n}function PP(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=Co(e.url),i=[];for(let u of t.icons??[])i.push(_(u.src)?{...u,src:Te(o,u.src)}:u);let a={display:t.display??"standalone",icons:i,name:s,short_name:t.shortName??s,start_url:Te(o,t.startUrl??"/")};Vs(a,"description",t.description),Vs(a,"theme_color",t.themeColor),Vs(a,"background_color",t.backgroundColor),Vs(a,"scope",t.scope===void 0?void 0:Te(o,t.scope)),Vs(a,"orientation",t.orientation),Vs(a,"lang",t.lang),Vs(a,"dir",t.dir),Vs(a,"categories",t.categories);let l=new Set(i.flatMap((u)=>(u.sizes??"").split(/\s+/).map((d)=>Math.trunc(Number(d.split("x")[0]))))),c=EV.filter((u)=>!l.has(u));if(c.length>0)r.push(`manifest: no ${c.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)}
559
+ `,path:"manifest.webmanifest"}],warnings:r}}function kP(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 _P(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 l=new Date(n.expires);if(Number.isNaN(l.getTime()))r.push(`securityTxt: \`expires\` is not a valid date: "${n.expires}".`);else if(l.getTime()<=t.getTime())r.push(`securityTxt: \`expires\` is in the past (${l.toISOString()}) — an expired `+"security.txt tells a reporter not to trust what it says.")}let i=[];for(let l of n.preferredLanguages??[]){let c=zn(l);if(c===null)r.push(`securityTxt.preferredLanguages: "${l}" is not a well-formed language tag.`);else i.push(c)}if(r.length>0)return{errors:r,files:[],warnings:s};let a=["# Generated by @jxsuite/compiler — configure via securityTxt in project.json.",...o.map((l)=>`Contact: ${l}`),`Expires: ${new Date(n.expires).toISOString().replace(/\.\d{3}Z$/,"Z")}`,...(n.encryption??[]).map((l)=>`Encryption: ${l}`),...(n.acknowledgments??[]).map((l)=>`Acknowledgments: ${l}`),...i.length>0?[`Preferred-Languages: ${i.join(", ")}`]:[],...n.canonical===void 0?[]:[`Canonical: ${n.canonical}`],...(n.policy??[]).map((l)=>`Policy: ${l}`),...(n.hiring??[]).map((l)=>`Hiring: ${l}`)];return{errors:r,files:[{content:`${a.join(`
557
560
  `)}
558
- `,path:".well-known/security.txt"}],warnings:s}}function Zj(e,t,n){let r=0,s=[];for(let o of e){let i=k2(t,o.path);if(n(i)){s.push(o.path);continue}j2(_2(i),{recursive:!0}),P2(i,o.content,"utf8"),r+=1}return{skipped:s,written:r}}var O2;var Qj=J(()=>{An();Jo();ce();O2=[192,512]});import{existsSync as A2,mkdirSync as Yy,readFileSync as C2,readdirSync as R2,writeFileSync as N2}from"node:fs";import{dirname as Xl,join as T2,relative as J2,resolve as td}from"node:path";function M2(e){return e.endsWith("/")}function tP(e=Zy){let t={},n=[],r=[];for(let s of nd)if(I2(s.specifier,e))t[s.specifier]=s.assetPath,t[`${s.specifier}/`]=s.assetDir,r.push(s.assetPath);else t[s.specifier]=s.fallback,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 nP(e,t,n=Zy,r=!0){let s=[],o=0;for(let i of nd){if(!e.assetPaths.includes(i.assetPath))continue;let a=td(t,i.assetPath.replace(/^\//,""));Yy(Xl(a),{recursive:!0});try{await No(`export * from ${JSON.stringify(i.specifier)};
559
- `,{outfile:a,resolveDir:n},{minify:r,target:"browser"}),o+=1}catch(l){s.push(`Bundling client runtime "${i.specifier}": ${be(l)}`)}}return{errors:s,written:o}}function Qy(e){return Object.entries(e).filter(([t,n])=>!M2(t)&&n.startsWith("/")).map(([,t])=>t)}function rP(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(!D(s))continue;let o=Object.entries(s).flatMap(([i,a])=>k(a)?[[i,a]]:[]);t.push(...Qy(Object.fromEntries(o)))}return t}function I2(e,t){try{return jw(e,t),!0}catch{return!1}}async function sP(e,t=Zy,n=!0){let r=[],s=new Set,o=new Map,i=new Map,a=0,l=async(u)=>{if(!i.has(u.specifier))i.set(u.specifier,await kw(u.specifier,t,{target:"browser"}));return i.get(u.specifier)},c=async(u)=>[...C2(u,"utf8").matchAll(/(?:from|import)\s*["']([^"']+)["']/g)].map((p)=>p[1]);for(let u=0;u<eP;u++){let d=0,p=[];try{p=R2(e,{recursive:!0}).map(String).filter((m)=>m.endsWith(".js")).map((m)=>T2(e,m))}catch{return Xy(e,o,r,a)}for(let m of p){let y=[];try{y=await c(m)}catch{continue}for(let S of y){let g=nd.find((w)=>S.startsWith(`${w.specifier}/`));if(!g||s.has(S))continue;s.add(S);let x=S.slice(g.specifier.length+1),P=td(e,`${g.assetDir.replace(/^\//,"")}${x}`);Yy(Xl(P),{recursive:!0});try{await No(`export * from ${JSON.stringify(S)};
560
- `,{outfile:P,resolveDir:t},{minify:n,resolver:D2(g,P,await l(g),o),target:"browser"}),a+=1,d+=1}catch(w){r.push(`Bundling runtime subpath "${S}": ${be(w)}`)}}}if(d===0)return Xy(e,o,r,a)}return r.push(`Runtime subpath resolution did not settle in ${eP} passes — a package subpath `+"graph this deep is more likely a cycle in the scan than a real dependency chain."),Xy(e,o,r,a)}function D2(e,t,n,r){return{filter:/.*/,resolve:({importer:s,path:o})=>{if(km(s))return;if(nd.find((a)=>o===a.specifier||o.startsWith(`${a.specifier}/`))!==void 0)return{external:!0,path:o};if(n===void 0||!o.startsWith("."))return;if(td(Xl(s),o)!==n)return;return r.set(td(Xl(t),o),e.specifier),{external:!0,path:o}}}}function Xy(e,t,n,r){let s=r;for(let[o,i]of t){if(A2(o))continue;try{Yy(Xl(o),{recursive:!0}),N2(o,`export * from ${JSON.stringify(i)};
561
- `,"utf8"),s+=1}catch(a){n.push(`Writing shared core stub ${J2(e,o)}: ${be(a)}`)}}return{errors:n,written:s}}var nd,Zy,eP=10;var oP=J(()=>{Om();yn();ce();Lt();yn();nd=[{assetDir:"/assets/@vue/reactivity/",assetPath:"/assets/vue-reactivity.js",fallback:Ts,specifier:"@vue/reactivity"},{assetDir:"/assets/lit-html/",assetPath:"/assets/lit-html.js",fallback:Nr,specifier:"lit-html"}];Zy=import.meta.dirname});import{copyFileSync as L2,cpSync as ex,existsSync as Ls,mkdirSync as hr,mkdtempSync as F2,readFileSync as V2,rmSync as iP,statSync as q2,writeFileSync as on}from"node:fs";import{createHash as H2}from"node:crypto";import{tmpdir as W2}from"node:os";import{basename as tx,dirname as gr,join as Tr,relative as nx,resolve as at,sep as aP}from"node:path";async function fP(e,t={}){let{clean:n=!0,includeHeld:r=!1,optimizeImages:s=!0,verbose:o=!1}=t,i=[],a=o?console.log.bind(console):()=>{},l={bundles:0,components:0,content:0,outputs:0,routes:0,setup:0,total:0},c=performance.now(),u=c,d=(h)=>{let b=performance.now();l[h]=b-u,u=b};a("Loading project.json...");let{config:p}=As(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=at(e,p.build.outDir),y=at(e,"pages"),S=at(e,"public"),g=p.build.trailingSlash??"always",x=p.build.minify!==!1,P=new Map,w=new Map,E=new Map,j=(h)=>{let b=h.toSorted(),_=`/assets/elements-${H2("sha1").update(b.join("\x00")).digest("hex").slice(0,12)}.js`;return E.set(_,b),_},A=tP(),T=A.imports,I=new Set,V=U0(),{errors:H,i18n:O}=Mm(p);for(let h of H)i.push(h),console.error(h);for(let h of A.warnings)console.warn(h);let N=new Map,G=(h,b,v)=>{let _=N.get(h);if(_!==void 0&&_.entryPath!==b)throw Error(`"${v}" and "${_.specifier}" both map to ${h} — rename one`);N.set(h,{entryPath:b,specifier:v})},Q=new Set,re=(h)=>{if(!Q.has(h))Q.add(h),i.push(h),console.error(h)},ue=(h)=>{let b=Ni(h);if(b===null)return re(`$src "${h}" is not a document script specifier`),h;if(b.side==="server")return re(`${b.path}: a client function names "#server". A server module is called by a timing: "server" entry and never imported by a page`),h;try{let v=gu(`./${b.path}`);return G(v,h,h),P.set(v,{entryPath:h,script:!0,specifier:h}),v}catch(v){return re(`Script of ${b.path}: ${be(v)}`),h}},ne=(h,b)=>{if(Vu(h))return ue(h);if(Ri(h)!==null)return re(`$src "${h}" 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`),h;if(!Ew(h))return h;try{let v=Pm(h,b??e,e);if(!jo(h)&&!Ls(v))return console.warn(`Sidecar "${h}" not found at ${v} — emitting unbundled`),h;let _=jo(h)?h:`./${nx(e,v)}`,M=gu(_);return G(M,v,h),P.set(M,{entryPath:v,specifier:h}),M}catch(v){return i.push(`Sidecar "${h}": ${be(v)}`),h}},fe=(h)=>{let b=VS(h);try{let v=Pm(`npm:${h}`,e,e);return G(b,v,h),w.set(b,v),b}catch(v){return i.push(`$head specifier "${h}": ${be(v)}`),h}},xe=await Os(e,p),X=new Map,B=(h,b,v)=>{let _=Mf(h,{docDir:b,imports:v,projectRoot:e,registry:xe});if(_===void 0)throw Error(`external class "${h.$prototype}" names no class: give it a $src or an imports entry, or enable the extension that provides "${h.$prototype}"`);if(J0(_.classDef))throw Error(`external class "${h.$prototype}" reads the build's context (#/$context/) and cannot run in a browser: use "timing": "compiler"`);let M=M0(_),K=gu(`class:${_.exportName}`);return G(K,_.classJsonPath,h.$prototype),X.set(K,M),K},q=xe.formats,z=fE(e,(h)=>hs(h,q));if(q.entries.length>0)a(` Registered ${q.entries.length} format(s): ${q.entries.map((h)=>h.name).join(", ")}`);let We=xe.serverMounts().filter((h)=>{if(!h.project)return!0;let b=p[h.project.key];return D(b)&&Object.keys(b).length>0});if(We.length>0&&!p.build.adapter){let h=We.map((b)=>b.project?`"${b.project.key}"`:`"${b.server.basePath}"`).join(", ");throw Error(`project.json declares dynamic section(s) ${h} served by extension mounts, but `+`build.adapter is "static". Dynamic tables need a server-capable adapter — ${lP}`)}if(d("setup"),n&&Ls(m))iP(m,{force:!0,recursive:!0});if(hr(m,{recursive:!0}),!Ls(y))throw Error(`pages/ directory not found in ${e}`);a("Discovering pages...");let qe=await V0(y,q);a(` Found ${qe.length} page(s)`),a("Loading project sections...");let Ye=await sE(e,p,xe,{includeHeld:r}),te=Object.keys(Ye);if(te.length>0)a(` Loaded ${te.length} section(s): ${te.join(", ")}`);let{errors:Ut,mounts:Je}=await iE(xe,p,e);i.push(...Ut);for(let h of Ut)console.error(h);if(Je.length>0)a(` Mounted ${Je.length} asset dir(s): ${Je.map((h)=>h.urlPrefix).join(", ")}`);let jt=new Set,bt=await z2(xe,p,e),ct=(await W0(qe,e,Ye,xe,p,O,{errors:i})).map((h)=>Object.assign(h,{locale:cr(h.urlPattern,O)}));a(` ${ct.length} route(s) after expansion`);let Se=0;d("content");let Ze=p.images.optimize&&p.images.service==="cloudflare",Nt=p.images.optimize&&!Ze?pj(e):null,co=Ze?new Map:null;if(Nt&&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(Ze)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 $t=[],tr=new Map,tn=new Map,Xr=new Map,{components:Mn,errors:Ca}=await xE({formatRegistry:q,pageSources:ct.map((h)=>h.sourcePath),projectConfig:p,projectRoot:e});for(let h of Ca)i.push(h),console.error(h);if(Mn.length>0){a("Compiling components...");let h=at(m,"components");hr(h,{recursive:!0});let b=new Map(Mn.map((ie)=>[ie.path,ie.tagName])),v=new Set(b.values()),_=new Map,M=new Set,K=Po(p.url),ae=Gf(K),U=new Map,oe=async(ie,ge)=>{await zy(ie,p.images,e,Nt,co??void 0,Je);let De=ge??"",ut=U.get(De);if(ut===void 0){let Me=Vl(ie,ge===null?{}:{sourcePath:ge},e,{asInitialValues:!0,config:p,registerBundle:(Pt)=>{ne(Pt,null)},registry:xe,sections:Ye});U.set(De,Me),await Me;return}let In=await ut;if(ie.state)Object.assign(ie.state,In)};for(let{doc:ie,path:ge}of Mn){let De=df(ie,p.state);try{await oe(De,ge);let ut={formats:q,prepareDocument:async(Me,Pt)=>{await oe(Me,Pt),US(Me,K)},resolveClass:(Me,Pt,Dt)=>Fe(K,B(Me,Pt,Dt)),resolveElementPath:(Me,Pt)=>{let Dt=Pt?at(Pt,Me):at(Me),$r=b.get(Dt);return $r?`./${$r}.js`:Me.replace(/\.(?:json|jxn)$/i,".js")},projectRoot:e,projectState:p.state,rewriteSrc:(Me,Pt)=>Fe(K,ne(Me,Pt)),serverBaseUrl:ae,stylesheetHref:(Me)=>v.has(Me)?Fe(K,Rf(Me)):null};if(p.$media)ut.$media=p.$media;ut.defaults=p.defaults;let In=await Gi(ge,ut);for(let Me of In.files){let Pt=Me.tagName?`${Me.tagName}.js`:tx(Me.path);if(!$t.includes(Me.tagName))on(at(h,Pt),Me.content,"utf8"),$t.push(Me.tagName),Se+=1}if(De.tagName){tn.set(De.tagName,De),Xr.set(De.tagName,ge);let Me=Rn(De,p.defaults),Pt=Nf(De.tagName,De.style,De,p.$media??{},Me);if(_.set(De.tagName,Pt),Me===null)tr.set(De.tagName,Pt),Ff(Pt,Je,jt),on(at(h,`${De.tagName}.css`),Qa(Pt,K),"utf8"),Se+=1;else M.add(De.tagName)}}catch(ut){let In=be(ut),Me=nx(e,ge).replaceAll("\\","/");i.push(`Error compiling component ${Me}: ${In}`),console.error(`Error compiling component ${Me}: ${In}`)}}for(let ie of M){let ge=h0(ie,tn,_,M);Ff(ge,Je,jt),on(at(h,`${ie}.css`),Qa(ge,K),"utf8"),Se+=1}a(` Compiled ${$t.length} component(s): ${$t.join(", ")}`)}if(tn.size>0){let h=[...tn].map(([_,M])=>({className:Ms(_),doc:M,modulePath:nx(e,at(m,"components",`${_}.js`)).split(aP).join("/"),shadow:Rn(M,p.defaults)!==null,tagName:_})),{manifest:b,warnings:v}=pu(h);for(let _ of v)console.warn(_);on(at(m,"custom-elements.json"),mu(b),"utf8"),Se+=1,a(` Wrote custom-elements.json (${h.length} element(s))`)}let dp=Cf($t,tn),xr=[];for(let[h,b]of tn)xr.push(...ql(b,Xr.get(h),e));if(p.state){let h=ql({state:p.state},qn(e),e);for(let b of h)if(Ri(b.src)===null)xr.push(b);else re(`Server function "${b.exportName}" in ${b.declaredIn} names "${b.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 br=p.url,nr=Po(br),bs=Boolean(br)&&p.build.sitemap!==!1,uo=[],bc=ct.filter((h)=>!h.urlPattern.includes(":")&&!h.urlPattern.includes("*")),pp=O===null?new Map:await F0(bc,q),un=bc.map((h)=>({translationKey:pp.get(h.urlPattern),urlPattern:h.urlPattern})),Xo=w0(un,O,br,g),{conflicts:$c,sets:mp}=ay(un,O);for(let h of $c){let[b,v]=h.urlPatterns,_=h.declared?"Give one of them a different $translationKey.":"Move one out of the locale tree, or give it its own $translationKey.",M=`${v} and ${b} are both the "${h.locale}" version of "${h.key}". A translation set names one URL per language, so ${v} is `+`dropped from it — it carries no alternates and no switcher. ${_}`;if(h.declared)i.push(M),console.error(M);else console.warn(M)}let fo=$0(ct,O);if(fo.length>0)console.warn(`i18n.routing is "prefix-always", but ${fo.length} route(s) sit outside the locale tree and are served as "${O?.defaultLocale}": ${fo.slice(0,10).join(", ")}${fo.length>10?`, and ${fo.length-10} more`:""}. Move them under a locale directory, or use "prefix-except-default".`);if(O!==null&&O.routing==="prefix-always"&&!p.build.adapter&&!ct.some((h)=>h.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 "/${O.defaultLocale.toLowerCase()}/", set build.adapter, or use "prefix-except-default".`);let Sc=new Set,wc=new Set;for(let h of ct){let b=S0(h.urlPattern,O);if(b&&!Sc.has(b.segment))Sc.add(b.segment),console.warn(`Routes under /${b.segment}/ are served as "${O?.defaultLocale}" — `+`i18n.locales declares "${b.meant}", not "${b.segment}". Rename the directory to "${b.meant.toLowerCase()}" or declare the shorter tag.`);try{a(` Compiling ${h.urlPattern} ...`);let v=await B2(h,p,e,Ye,Nt,tn,co,q,xe,ne,Je,bt,fe,{alternates:Xo.get(h.urlPattern)??[],i18n:O,translations:mp.get(h.urlPattern)??[]},T,j,B);xr.push(...v.serverEntries);for(let U of v.unregisteredRelations)if(!wc.has(U))wc.add(U),console.warn(`<link rel="${U}"> — "${U}" 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).");if($t.length>0)v.html=Y2(v.html,$t,tr,new Set($t.filter((U)=>!v.liveTags.has(U))),v.files.map((U)=>U.content).join(`
562
- `),T,dp);for(let U of rP(v.html))I.add(U);Ff(v.html,Je,jt),z0(v.html,V);let _=gP(h.urlPattern,m,g);hr(gr(_),{recursive:!0});let M=!h.urlPattern.includes(":")&&!h.urlPattern.includes("*"),K=!Ll(h.urlPattern)&&!g0(v.html);if(bs&&!v.excludeFromSitemap&&K&&M){let U=Xo.get(h.urlPattern)??[];uo.push({lastmod:k(h.sourceMtime)&&h.sourceMtime!==""?h.sourceMtime:tV(q2(h.sourcePath).mtime),loc:Cs(zi(h.urlPattern,g),br),...U.length>0&&{alternates:U}})}let ae=[];for(let U of q.withCapability("serialize")){if(!U.exportTarget||Ll(h.urlPattern))continue;try{let oe=await U.call("serialize",v.doc,{buildScope:(ie)=>Do(ie,null),componentDefs:tn,evaluateTemplate:(ie,ge)=>{if(!le(ie))return;return Gt(ie,ge)??ie},mode:"export"});if(oe){let ie=_.replace(/\.html$/,U.extensions[0]);ae.push({content:oe,path:ie,type:U.mediaTypeEssence})}}catch(oe){i.push(`Error exporting ${U.name} for ${h.urlPattern}: ${be(oe)}`)}}for(let U of ae)if(U.type!==null)v.html=x0(v.html,{href:b0(m,U.path),type:U.type});on(_,ym(v.html,nr),"utf8"),Se+=1;for(let U of ae)on(U.path,U.content,"utf8"),Se+=1;for(let U of v.files){let oe=at(gr(_),U.path);hr(gr(oe),{recursive:!0}),on(oe,U.content,"utf8"),Se+=1}}catch(v){let _=`Error compiling ${h.urlPattern}: ${be(v)}`;i.push(_),console.error(_)}}if(d("routes"),Nt&&p.images.optimize){mj(e,Nt,{prune:i.length===0});let h=hj(Nt).filter((v)=>Ls(v));if(h.length>0){let v=at(m,"images/_optimized");hr(v,{recursive:!0});for(let _ of h)L2(_,at(v,tx(_)))}let b=Object.keys(Nt.entries).length;if(b>0)a(` Optimized ${b} image(s)`)}let f=[];if(!p.build.adapter&&xr.length>0){let b=`timing: "server" entries ${[...new Set(xr.map(({exportName:v,declaredIn:_})=>`${v} (${_})`))].join(", ")} need a server-capable adapter, but `+`build.adapter is "static": a static deployment has nothing to serve /_jx/server — ${lP}`;i.push(b),console.error(b)}if(p.build.adapter){let{adapter:h}=p.build;a("Generating site-wide server worker...");let{entries:b,errors:v}=SE(xr);f=b;for(let U of v)i.push(U),console.error(U);let{mounts:_,connectors:M}=U2(We,xe,p);if(_.length>0)a(` Mounting ${_.length} extension route(s): ${_.map((U)=>U.basePath).join(", ")}`);let ae=h==="cloudflare-pages"&&f.length===0&&_.length===0?null:Ty(f,{adapter:h,base:nr,connectors:M,i18n:O,mounts:_});if(ae){let U=h==="cloudflare-pages"?"_worker.js":"worker.js";try{await Ow(ae,{adapter:h,outfile:at(m,U),plugins:[z.serverPlugin],projectRoot:e}),Se+=1,a(` Generated dist/${U} (bundled, ${f.length} server function(s))`)}catch(oe){let ie=`Error bundling dist/${U}: ${be(oe)}`;i.push(ie),console.error(ie)}if(h==="cloudflare-pages")on(at(m,"_routes.json"),`${JSON.stringify({exclude:[],include:(O&&O.locales.length>1?["/","/_jx/*"]:["/_jx/*"]).map((oe)=>Fe(nr,oe)),version:1},null,2)}
563
- `,"utf8"),Se+=1}}if(I.size>0){a(`Bundling ${I.size} client runtime module(s)...`);let h=await nP({...A,assetPaths:[...I]},m,void 0,x);Se+=h.written;for(let b of h.errors)i.push(b),console.error(b)}if(w.size>0){a(`Copying ${w.size} package asset(s)...`);for(let[h,b]of w){let v=at(m,h.replace(/^\//,""));hr(gr(v),{recursive:!0}),ex(b,v),Se+=1,a(` ${b} → ${h}`)}}if(P.size>0){a(`Bundling ${P.size} client sidecar module(s)...`);for(let[h,b]of P)try{let v=at(m,h.replace(/^\//,""));hr(gr(v),{recursive:!0});let _={entryPath:b.entryPath,outfile:v};if(b.script){let M=await z.module(b.specifier);_.entryPath=M.path,_.contents=M.contents}await Pw(_,{external:jm,minify:x,plugins:[z.clientPlugin],target:"browser"}),Se+=1,a(` ${b.specifier} → ${h}`)}catch(v){let _=`Error bundling sidecar "${b.specifier}": ${be(v)}`;i.push(_),console.error(_)}}if(X.size>0){a(`Bundling ${X.size} external class module(s)...`);let h=F2(Tr(W2(),"jx-class-entries-"));try{let b=[...X].map(([_,M])=>{let K=Tr(h,tx(_));return on(K,M,"utf8"),K}),v=await _w(b,at(m,"assets"),{external:jm,minify:x,target:"browser"});Se+=v.length;for(let _ of X.keys())a(` ${_}`)}catch(b){let v=`Error bundling external classes: ${be(b)}`;i.push(v),console.error(v)}finally{iP(h,{force:!0,recursive:!0})}}if(E.size>0){a(`Bundling ${E.size} npm element set(s)...`);for(let[h,b]of E){let v=at(m,h.replace(/^\//,""));hr(gr(v),{recursive:!0});try{await No(`${b.map((_)=>`import ${JSON.stringify(_)};`).join(`
561
+ `,path:".well-known/security.txt"}],warnings:s}}function OP(e,t,n){let r=0,s=[];for(let o of e){let i=vV(t,o.path);if(n(i)){s.push(o.path);continue}$V(wV(i),{recursive:!0}),SV(i,o.content,"utf8"),r+=1}return{skipped:s,written:r}}var EV;var AP=M(()=>{hn();_o();ae();EV=[192,512]});import{existsSync as jV,mkdirSync as gx,readFileSync as PV,readdirSync as kV,writeFileSync as _V}from"node:fs";import{dirname as ec,join as OV,relative as AV,resolve as dd}from"node:path";function CV(e){return e.endsWith("/")}function RP(e=yx){let t={},n=[],r=[];for(let s of pd)if(RV(s.specifier,e))t[s.specifier]=s.assetPath,t[`${s.specifier}/`]=s.assetDir,r.push(s.assetPath);else t[s.specifier]=s.fallback,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 TP(e,t,n=yx,r=!0){let s=[],o=0;for(let i of pd){if(!e.assetPaths.includes(i.assetPath))continue;let a=dd(t,i.assetPath.replace(/^\//,""));gx(ec(a),{recursive:!0});try{await Do(`export * from ${JSON.stringify(i.specifier)};
562
+ `,{outfile:a,resolveDir:n},{minify:r,target:"browser"}),o+=1}catch(l){s.push(`Bundling client runtime "${i.specifier}": ${ye(l)}`)}}return{errors:s,written:o}}function xx(e){return Object.entries(e).filter(([t,n])=>!CV(t)&&n.startsWith("/")).map(([,t])=>t)}function NP(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(!F(s))continue;let o=Object.entries(s).flatMap(([i,a])=>_(a)?[[i,a]]:[]);t.push(...xx(Object.fromEntries(o)))}return t}function RV(e,t){try{return tv(e,t),!0}catch{return!1}}async function JP(e,t=yx,n=!0){let r=[],s=new Set,o=new Map,i=new Map,a=0,l=async(u)=>{if(!i.has(u.specifier))i.set(u.specifier,await sv(u.specifier,t,{target:"browser"}));return i.get(u.specifier)},c=async(u)=>[...PV(u,"utf8").matchAll(/(?:from|import)\s*["']([^"']+)["']/g)].map((p)=>p[1]);for(let u=0;u<CP;u++){let d=0,p=[];try{p=kV(e,{recursive:!0}).map(String).filter((m)=>m.endsWith(".js")).map((m)=>OV(e,m))}catch{return hx(e,o,r,a)}for(let m of p){let g=[];try{g=await c(m)}catch{continue}for(let b of g){let h=pd.find((w)=>b.startsWith(`${w.specifier}/`));if(!h||s.has(b))continue;s.add(b);let x=b.slice(h.specifier.length+1),k=dd(e,`${h.assetDir.replace(/^\//,"")}${x}`);gx(ec(k),{recursive:!0});try{await Do(`export * from ${JSON.stringify(b)};
563
+ `,{outfile:k,resolveDir:t},{minify:n,resolver:TV(h,k,await l(h),o),target:"browser"}),a+=1,d+=1}catch(w){r.push(`Bundling runtime subpath "${b}": ${ye(w)}`)}}}if(d===0)return hx(e,o,r,a)}return r.push(`Runtime subpath resolution did not settle in ${CP} passes — a package subpath `+"graph this deep is more likely a cycle in the scan than a real dependency chain."),hx(e,o,r,a)}function TV(e,t,n,r){return{filter:/.*/,resolve:({importer:s,path:o})=>{if(yg(s))return;if(pd.find((a)=>o===a.specifier||o.startsWith(`${a.specifier}/`))!==void 0)return{external:!0,path:o};if(n===void 0||!o.startsWith("."))return;if(dd(ec(s),o)!==n)return;return r.set(dd(ec(t),o),e.specifier),{external:!0,path:o}}}}function hx(e,t,n,r){let s=r;for(let[o,i]of t){if(jV(o))continue;try{gx(ec(o),{recursive:!0}),_V(o,`export * from ${JSON.stringify(i)};
564
+ `,"utf8"),s+=1}catch(a){n.push(`Writing shared core stub ${AV(e,o)}: ${ye(a)}`)}}return{errors:n,written:s}}var pd,yx,CP=10;var MP=M(()=>{xg();$n();ae();Ft();$n();pd=[{assetDir:"/assets/@vue/reactivity/",assetPath:"/assets/vue-reactivity.js",fallback:Is,specifier:"@vue/reactivity"},{assetDir:"/assets/lit-html/",assetPath:"/assets/lit-html.js",fallback:Tr,specifier:"lit-html"}];yx=import.meta.dirname});import{copyFileSync as NV,cpSync as bx,existsSync as qs,mkdirSync as xr,mkdtempSync as JV,readFileSync as MV,rmSync as IP,statSync as IV,writeFileSync as ln}from"node:fs";import{createHash as DV}from"node:crypto";import{tmpdir as LV}from"node:os";import{basename as $x,dirname as br,join as Nr,relative as Sx,resolve as ft,sep as DP}from"node:path";async function qP(e,t={}){let{clean:n=!0,includeHeld:r=!1,optimizeImages:s=!0,verbose:o=!1}=t,i=[],a=o?console.log.bind(console):()=>{},l={bundles:0,components:0,content:0,outputs:0,routes:0,setup:0,total:0},c=performance.now(),u=c,d=(y)=>{let P=performance.now();l[y]=P-u,u=P};a("Loading project.json...");let{config:p}=as(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=ft(e,p.build.outDir),g=ft(e,"pages"),b=ft(e,"public"),h=p.build.trailingSlash??"always",x=p.build.minify!==!1,k=new Map,w=new Map,v=new Map,E=(y)=>{let P=y.toSorted(),N=`/assets/elements-${DV("sha1").update(P.join("\x00")).digest("hex").slice(0,12)}.js`;return v.set(N,P),N},O=RP(),I=O.imports,D=new Set,V=_E(),{errors:W,i18n:A}=Hh(p);for(let y of W)i.push(y),console.error(y);for(let y of O.warnings)console.warn(y);let J=new Map,G=(y,P,R)=>{let N=J.get(y);if(N!==void 0&&N.entryPath!==P)throw Error(`"${R}" and "${N.specifier}" both map to ${y} — rename one`);J.set(y,{entryPath:P,specifier:R})},se=new Set,ie=(y)=>{if(!se.has(y))se.add(y),i.push(y),console.error(y)},le=(y)=>{let P=Li(y);if(P===null)return ie(`$src "${y}" is not a document script specifier`),y;if(P.side==="server")return ie(`${P.path}: a client function names "#server". A server module is called by a timing: "server" entry and never imported by a page`),y;try{let R=Ru(`./${P.path}`);return G(R,y,y),k.set(R,{entryPath:y,script:!0,specifier:y}),R}catch(R){return ie(`Script of ${P.path}: ${ye(R)}`),y}},te=(y,P)=>{if(rf(y))return le(y);if(Di(y)!==null)return ie(`$src "${y}" 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`),y;if(!ev(y))return y;try{let R=hg(y,P??e,e);if(!Ao(y)&&!qs(R))return console.warn(`Sidecar "${y}" not found at ${R} — emitting unbundled`),y;let N=Ao(y)?y:`./${Sx(e,R)}`,z=Ru(N);return G(z,R,y),k.set(z,{entryPath:R,specifier:y}),z}catch(R){return i.push(`Sidecar "${y}": ${ye(R)}`),y}},de=(y)=>{let P=hw(y);try{let R=hg(`npm:${y}`,e,e);return G(P,R,y),w.set(P,R),P}catch(R){return i.push(`$head specifier "${y}": ${ye(R)}`),y}},xe=await Rs(e,p),X=new Map,U=(y,P,R)=>{let N=Wf(y,{docDir:P,imports:R,projectRoot:e,registry:xe});if(N===void 0)throw Error(`external class "${y.$prototype}" names no class: give it a $src or an imports entry, or enable the extension that provides "${y.$prototype}"`);if(yE(N.classDef))throw Error(`external class "${y.$prototype}" reads the build's context (#/$context/) and cannot run in a browser: use "timing": "compiler"`);let z=xE(N),Q=Ru(`class:${N.exportName}`);return G(Q,N.classJsonPath,y.$prototype),X.set(Q,z),Q},H=xe.formats,K=GE(e,(y)=>gs(y,H));if(H.entries.length>0)a(` Registered ${H.entries.length} format(s): ${H.entries.map((y)=>y.name).join(", ")}`);let He=xe.serverMounts().filter((y)=>{if(!y.project)return!0;let P=p[y.project.key];return F(P)&&Object.keys(P).length>0});if(He.length>0&&!p.build.adapter){let y=He.map((P)=>P.project?`"${P.project.key}"`:`"${P.server.basePath}"`).join(", ");throw Error(`project.json declares dynamic section(s) ${y} served by extension mounts, but `+`build.adapter is "static". Dynamic tables need a server-capable adapter — ${LP}`)}if(d("setup"),n&&qs(m))IP(m,{force:!0,recursive:!0});if(xr(m,{recursive:!0}),!qs(g))throw Error(`pages/ directory not found in ${e}`);a("Discovering pages...");let Ve=await vE(g,H);a(` Found ${Ve.length} page(s)`),a("Loading project sections...");let Ze=await qE(e,p,xe,{includeHeld:r}),re=Object.keys(Ze);if(re.length>0)a(` Loaded ${re.length} section(s): ${re.join(", ")}`);let{errors:Gt,mounts:Qe}=await WE(xe,p,e);i.push(...Gt);for(let y of Gt)console.error(y);if(Qe.length>0)a(` Mounted ${Qe.length} asset dir(s): ${Qe.map((y)=>y.urlPrefix).join(", ")}`);let ht=new Set,kt=await qV(xe,p,e),We=(await PE(Ve,e,Ze,xe,p,A,{errors:i})).map((y)=>Object.assign(y,{locale:fr(y.urlPattern,A)}));a(` ${We.length} route(s) after expansion`);let Pe=0;d("content");let Ln=p.images.optimize&&p.images.service==="cloudflare",me=p.images.optimize&&!Ln?Hj(e):null,Xr=Ln?new Map:null;if(me&&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(Ln)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 st=[],et=new Map,Jt=new Map,$s=new Map,{components:ei,errors:po}=await ej({formatRegistry:H,pageSources:We.map((y)=>y.sourcePath),projectConfig:p,projectRoot:e});for(let y of po)i.push(y),console.error(y);if(ei.length>0){a("Compiling components...");let y=ft(m,"components");xr(y,{recursive:!0});let P=new Map(ei.map((ke)=>[ke.path,ke.tagName])),R=new Set(P.values()),N=new Map,z=new Set,Q=Co(p.url),ue=rd(Q),Y=new Map,ge=async(ke,ze)=>{await ux(ke,p.images,e,me,Xr??void 0,Qe);let gt=ze??"",Vn=Y.get(gt);if(Vn===void 0){let Se=Bl(ke,ze===null?{}:{sourcePath:ze},e,{asInitialValues:!0,config:p,registerBundle:(ot)=>{te(ot,null)},registry:xe,sections:Ze});Y.set(gt,Se),await Se;return}let Yr=await Vn;if(ke.state)Object.assign(ke.state,Yr)};for(let{doc:ke,path:ze}of ei){let gt=xf(ke,p.state);try{await ge(gt,ze);let Vn={formats:H,prepareDocument:async(Se,ot)=>{await ge(Se,ot),ww(Se,Q)},resolveClass:(Se,ot,On)=>Te(Q,U(Se,ot,On)),resolveElementPath:(Se,ot)=>{let On=ot?ft(ot,Se):ft(Se),ws=P.get(On);return ws?`./${ws}.js`:Se.replace(/\.(?:json|jxn)$/i,".js")},projectRoot:e,projectState:p.state,rewriteSrc:(Se,ot)=>Te(Q,te(Se,ot)),serverBaseUrl:ue,stylesheetHref:(Se)=>R.has(Se)?Te(Q,Df(Se)):null};if(p.$media)Vn.$media=p.$media;Vn.defaults=p.defaults;let Yr=await na(ze,Vn);for(let Se of Yr.files){let ot=Se.tagName?`${Se.tagName}.js`:$x(Se.path);if(!st.includes(Se.tagName))ln(ft(y,ot),Se.content,"utf8"),st.push(Se.tagName),Pe+=1}if(gt.tagName){Jt.set(gt.tagName,gt),$s.set(gt.tagName,ze);let Se=Jn(gt,p.defaults),ot=Lf(gt.tagName,gt.style,gt,p.$media??{},Se);if(N.set(gt.tagName,ot),Se===null)et.set(gt.tagName,ot),Kf(ot,Qe,ht),ln(ft(y,`${gt.tagName}.css`),ul(ot,Q),"utf8"),Pe+=1;else z.add(gt.tagName)}}catch(Vn){let Yr=ye(Vn),Se=Sx(e,ze).replaceAll("\\","/");i.push(`Error compiling component ${Se}: ${Yr}`),console.error(`Error compiling component ${Se}: ${Yr}`)}}for(let ke of z){let ze=H0(ke,Jt,N,z);Kf(ze,Qe,ht),ln(ft(y,`${ke}.css`),ul(ze,Q),"utf8"),Pe+=1}a(` Compiled ${st.length} component(s): ${st.join(", ")}`)}if(Jt.size>0){let y=[...Jt].map(([N,z])=>({className:Ls(N),doc:z,modulePath:Sx(e,ft(m,"components",`${N}.js`)).split(DP).join("/"),shadow:Jn(z,p.defaults)!==null,tagName:N})),{manifest:P,warnings:R}=Ou(y);for(let N of R)console.warn(N);ln(ft(m,"custom-elements.json"),Au(P),"utf8"),Pe+=1,a(` Wrote custom-elements.json (${y.length} element(s))`)}let ti=If(st,Jt),Fn=[];for(let[y,P]of Jt)Fn.push(...Ul(P,$s.get(y),e));if(p.state){let y=Ul({state:p.state},Un(e),e);for(let P of y)if(Di(P.src)===null)Fn.push(P);else ie(`Server function "${P.exportName}" in ${P.declaredIn} names "${P.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 Lt=p.url,or=Co(Lt),Ss=Boolean(Lt)&&p.build.sitemap!==!1,mo=[],vc=We.filter((y)=>!y.urlPattern.includes(":")&&!y.urlPattern.includes("*")),jp=A===null?new Map:await wE(vc,H),dn=vc.map((y)=>({translationKey:jp.get(y.urlPattern),urlPattern:y.urlPattern})),ni=X0(dn,A,Lt,h),{conflicts:Ec,sets:Pp}=vy(dn,A);for(let y of Ec){let[P,R]=y.urlPatterns,N=y.declared?"Give one of them a different $translationKey.":"Move one out of the locale tree, or give it its own $translationKey.",z=`${R} and ${P} are both the "${y.locale}" version of "${y.key}". A translation set names one URL per language, so ${R} is `+`dropped from it — it carries no alternates and no switcher. ${N}`;if(y.declared)i.push(z),console.error(z);else console.warn(z)}let ho=K0(We,A);if(ho.length>0)console.warn(`i18n.routing is "prefix-always", but ${ho.length} route(s) sit outside the locale tree and are served as "${A?.defaultLocale}": ${ho.slice(0,10).join(", ")}${ho.length>10?`, and ${ho.length-10} more`:""}. Move them under a locale directory, or use "prefix-except-default".`);if(A!==null&&A.routing==="prefix-always"&&!p.build.adapter&&!We.some((y)=>y.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 jc=new Set,Pc=new Set,f=new Set;for(let y of We){let P=G0(y.urlPattern,A);if(P&&!jc.has(P.segment))jc.add(P.segment),console.warn(`Routes under /${P.segment}/ are served as "${A?.defaultLocale}" — `+`i18n.locales declares "${P.meant}", not "${P.segment}". Rename the directory to "${P.meant.toLowerCase()}" or declare the shorter tag.`);try{a(` Compiling ${y.urlPattern} ...`);let R=await FV(y,p,e,Ze,me,Jt,Xr,H,xe,te,Qe,kt,de,{alternates:ni.get(y.urlPattern)??[],i18n:A,translations:Pp.get(y.urlPattern)??[]},I,E,U);Fn.push(...R.serverEntries);for(let Y of R.unregisteredRelations)if(!Pc.has(Y))Pc.add(Y),console.warn(`<link rel="${Y}"> — "${Y}" 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).");for(let Y of R.unrenderedHeadMaterial)if(!f.has(Y))f.add(Y),console.warn(Y);if(st.length>0)R.html=UV(R.html,st,et,new Set(st.filter((Y)=>!R.liveTags.has(Y))),R.files.map((Y)=>Y.content).join(`
565
+ `),I,ti);for(let Y of NP(R.html))D.add(Y);Kf(R.html,Qe,ht),OE(R.html,V);let N=zP(y.urlPattern,m,h);xr(br(N),{recursive:!0});let z=!y.urlPattern.includes(":")&&!y.urlPattern.includes("*"),Q=!Hl(y.urlPattern)&&!W0(R.html);if(Ss&&!R.excludeFromSitemap&&Q&&z){let Y=ni.get(y.urlPattern)??[];mo.push({lastmod:_(y.sourceMtime)&&y.sourceMtime!==""?y.sourceMtime:XV(IV(y.sourcePath).mtime),loc:Ns(ea(y.urlPattern,h),Lt),...Y.length>0&&{alternates:Y}})}let ue=[];for(let Y of H.withCapability("serialize")){if(!Y.exportTarget||Hl(y.urlPattern))continue;try{let ge=await Y.call("serialize",R.doc,{buildScope:(ke)=>Vo(ke,null),componentDefs:Jt,evaluateTemplate:(ke,ze)=>{if(!ce(ke))return;return Zt(ke,ze)??ke},mode:"export"});if(ge){let ke=N.replace(/\.html$/,Y.extensions[0]);ue.push({content:ge,path:ke,type:Y.mediaTypeEssence})}}catch(ge){i.push(`Error exporting ${Y.name} for ${y.urlPattern}: ${ye(ge)}`)}}for(let Y of ue)if(Y.type!==null)R.html=U0(R.html,{href:z0(m,Y.path),type:Y.type});ln(N,ig(R.html,or),"utf8"),Pe+=1;for(let Y of ue)ln(Y.path,Y.content,"utf8"),Pe+=1;for(let Y of R.files){let ge=ft(br(N),Y.path);xr(br(ge),{recursive:!0}),ln(ge,Y.content,"utf8"),Pe+=1}}catch(R){let N=`Error compiling ${y.urlPattern}: ${ye(R)}`;i.push(N),console.error(N)}}if(d("routes"),me&&p.images.optimize){Wj(e,me,{prune:i.length===0});let y=Bj(me).filter((R)=>qs(R));if(y.length>0){let R=ft(m,"images/_optimized");xr(R,{recursive:!0});for(let N of y)NV(N,ft(R,$x(N)))}let P=Object.keys(me.entries).length;if(P>0)a(` Optimized ${P} image(s)`)}let S=[];if(!p.build.adapter&&Fn.length>0){let P=`timing: "server" entries ${[...new Set(Fn.map(({exportName:R,declaredIn:N})=>`${R} (${N})`))].join(", ")} need a server-capable adapter, but `+`build.adapter is "static": a static deployment has nothing to serve /_jx/server — ${LP}`;i.push(P),console.error(P)}if(p.build.adapter){let{adapter:y}=p.build;a("Generating site-wide server worker...");let{entries:P,errors:R}=rj(Fn);S=P;for(let Y of R)i.push(Y),console.error(Y);let{mounts:N,connectors:z}=VV(He,xe,p);if(N.length>0)a(` Mounting ${N.length} extension route(s): ${N.map((Y)=>Y.basePath).join(", ")}`);let ue=y==="cloudflare-pages"&&S.length===0&&N.length===0&&!Uu(A)?null:Zy(S,{adapter:y,base:or,connectors:z,i18n:A,mounts:N});if(ue){let Y=y==="cloudflare-pages"?"_worker.js":"worker.js";try{await ov(ue,{adapter:y,outfile:ft(m,Y),plugins:[K.serverPlugin],projectRoot:e}),Pe+=1,a(` Generated dist/${Y} (bundled, ${S.length} server function(s))`)}catch(ge){let ke=`Error bundling dist/${Y}: ${ye(ge)}`;i.push(ke),console.error(ke)}if(y==="cloudflare-pages")ln(ft(m,"_routes.json"),`${JSON.stringify({exclude:[],include:(Uu(A)?["/","/_jx/*"]:["/_jx/*"]).map((ge)=>Te(or,ge)),version:1},null,2)}
566
+ `,"utf8"),Pe+=1}}if(D.size>0){a(`Bundling ${D.size} client runtime module(s)...`);let y=await TP({...O,assetPaths:[...D]},m,void 0,x);Pe+=y.written;for(let P of y.errors)i.push(P),console.error(P)}if(w.size>0){a(`Copying ${w.size} package asset(s)...`);for(let[y,P]of w){let R=ft(m,y.replace(/^\//,""));xr(br(R),{recursive:!0}),bx(P,R),Pe+=1,a(` ${P} → ${y}`)}}if(k.size>0){a(`Bundling ${k.size} client sidecar module(s)...`);for(let[y,P]of k)try{let R=ft(m,y.replace(/^\//,""));xr(br(R),{recursive:!0});let N={entryPath:P.entryPath,outfile:R};if(P.script){let z=await K.module(P.specifier);N.entryPath=z.path,N.contents=z.contents}await nv(N,{external:mg,minify:x,plugins:[K.clientPlugin],target:"browser"}),Pe+=1,a(` ${P.specifier} → ${y}`)}catch(R){let N=`Error bundling sidecar "${P.specifier}": ${ye(R)}`;i.push(N),console.error(N)}}if(X.size>0){a(`Bundling ${X.size} external class module(s)...`);let y=JV(Nr(LV(),"jx-class-entries-"));try{let P=[...X].map(([N,z])=>{let Q=Nr(y,$x(N));return ln(Q,z,"utf8"),Q}),R=await rv(P,ft(m,"assets"),{external:mg,minify:x,target:"browser"});Pe+=R.length;for(let N of X.keys())a(` ${N}`)}catch(P){let R=`Error bundling external classes: ${ye(P)}`;i.push(R),console.error(R)}finally{IP(y,{force:!0,recursive:!0})}}if(v.size>0){a(`Bundling ${v.size} npm element set(s)...`);for(let[y,P]of v){let R=ft(m,y.replace(/^\//,""));xr(br(R),{recursive:!0});try{await Do(`${P.map((N)=>`import ${JSON.stringify(N)};`).join(`
564
567
  `)}
565
- `,{outfile:v,resolveDir:e},{minify:x,target:"browser"}),Se+=1,a(` ${b.length} element(s) → ${h}`)}catch(_){let M=`Error bundling npm $elements [${b.join(", ")}]: ${be(_)}`;i.push(M),console.error(M)}}}if(I.size>0){let h=await sP(m,void 0,x);if(h.written>0)a(`Bundling ${h.written} runtime subpath module(s)...`);Se+=h.written;for(let b of h.errors)i.push(b),console.error(b)}for(let h of xe.emitters()){let b=h.project?.key,v=b?p[b]:void 0;if(b&&(v==null||D(v)&&Object.keys(v).length===0))continue;try{let _=await h.call("emit",v??null,{projectConfig:p,root:e,routes:ct,sections:Ye});for(let M of _??[]){let K=at(m,M.path.replace(/^\//,""));if(!K.startsWith(m+aP))throw Error(`emit path escapes outDir: ${M.path}`);hr(gr(K),{recursive:!0}),on(K,M.content),Se+=1,a(` ${h.name} emitted ${M.path}`)}}catch(_){let M=`Error in ${h.name}.emit: ${be(_)}`;i.push(M),console.error(M)}}if(d("bundles"),p.redirects&&Object.keys(p.redirects).length>0){a("Generating redirects...");let h=new Set(ct.map((v)=>v.urlPattern)),b=eV(p.redirects,m,{basePath:nr,compiledUrls:h,trailingSlash:p.build.trailingSlash});Se+=b.files,i.push(...b.errors)}if(bs)a(`Generating sitemap (${uo.length} URL(s))...`),Se+=rV(uo,m);else if(!br&&p.build.sitemap!==!1)console.warn("sitemap.xml skipped — set `url` in project.json to enable sitemap generation.");if(jt.size>0){let{copied:h,missing:b}=aE(jt,Je,m);Se+=h,a(`Copying ${h} mounted asset(s)...`);for(let v of b)console.warn(`Referenced asset not found: ${v}`)}if(Ls(S))a("Copying public/ assets..."),ex(S,m,{recursive:!0});if(bs)Se+=sV(m,br);{let h=[Gj(p),Yj(p,new Date)];for(let _ of h){for(let M of _.errors)i.push(M),console.error(M);for(let M of _.warnings)console.warn(M)}let{skipped:b,written:v}=Zj(h.flatMap((_)=>_.files),m,Ls);Se+=v;for(let _ of b)a(` ${_} — kept the copy from public/`)}{let h=Gy(p.serviceWorker);if(h!==null){let b=h===!1?Uj():Bj(h,m,nr);for(let v of b.warnings)console.warn(v);for(let v of b.errors)i.push(v),console.error(v);if(b.path!==null)on(Tr(m,b.path),b.source,"utf8"),Se+=1,a(h===!1?" sw.js — tombstone (unregisters and clears)":" sw.js")}}{let{errors:h,rules:b}=Z0(p.build,V);i.push(...h);let v=eE([...b,...Q0(m)],nr);if(v.length>0){a("Writing response headers..."),Se+=tE(m,v);let{adapter:_,deploy:M}=p.build;if(_==="node"||_==="bun")console.warn(`The "${_}" 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(_===void 0&&M===void 0)if(Ls(at(S,"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.")}Se+=nE(m)}if(p.copy){a("Copying mapped files...");for(let[h,b]of Object.entries(p.copy)){if(!k(b))throw TypeError(`project.json copy["${h}"] must be a destination path string`);let v=at(e,h),_=at(m,b);hr(gr(_),{recursive:!0}),ex(v,_)}}if(a(`
566
- Build complete: ${ct.length} routes, ${Se} files`),i.length>0)a(` ${i.length} error(s)`);return d("outputs"),l.total=performance.now()-c,{errors:i,files:Se,routes:ct.length,serverEntries:f,timings:l}}async function B2(e,t,n,r,s,o,i,a,l,c,u,d,p,m,y,S,g){let x=Po(t.url),P=Ki(await hs(e.sourcePath,a),e.sourcePath,n),w=await gE(P,t,n),E=Hf(P,t,n),j=[...ql(P,e.sourcePath,n),...E.flatMap((pe)=>ql(pe.doc,pe.path,n))],A=vE(P.$head??w._pageHead??[],P.description),T=w.$head??[],I=P.title??w._pageTitle??null;delete w._pageHead,delete w._pageTitle;let V=new Set(Object.keys(w.state??{}));P0(w,t,e,n,m.i18n,m.translations);let H=Object.keys(t.state??{}).filter((pe)=>pe!=="$site"&&pe!=="$page"&&!V.has(pe)),O=v0({defaults:t.defaults,pageDir:k(P.$dir)?P.$dir:void 0,pageLang:k(P.$lang)?P.$lang:void 0,routeLocale:cr(e.urlPattern,m.i18n)}),N={...w.state};if(e.pagedState&&w.state&&e.pagedState.key in w.state)w.state[e.pagedState.key]=e.pagedState.items;await Vl(w,e,n,{config:t,registerBundle:(pe)=>{c(pe,null)},registry:l,sections:r});let G=G2(N,w.state??{},e.pagedState?.key),Q=Do(w.state??{},null,{document:w,holdMutable:!0}),re=I??t.name;if(le(re))re=Gt(re,Q)??re;let ue=rx(cP(A,Q),p),ne=rx(cP(T,Q),p);Zl(w,Q,G);let fe={counter:{n:0},media:{...t.$media,...w.$media},rules:[]},xe={n:0},X,B=()=>X??=Do(w.state??{}),q=p0(o,w);if(lx(w,o,{defaults:t.defaults,liveTags:q,slotCss:fe,slotIds:xe,slotScope:B}),w.state){let pe=new Set,ct=new Set(H);for(let[Ze,Nt]of Object.entries(w.state)){if(Ze==="$site"||Ze==="$page")continue;if(L(Nt)&&Nt.timing==="compiler")delete w.state[Ze];else if(Array.isArray(Nt))pe.add(Ze);else if(Mo(Nt))pe.add(Ze),ct.add(Ze)}for(let Ze of H)if(Ze in w.state)pe.add(Ze);let Se=!0;while(Se){Se=!1;let Ze={...w.state};delete Ze.$site,delete Ze.$page;for(let Mn of pe)delete Ze[Mn];let{$head:Nt,$paths:co,title:$t,...tr}=w,tn={...tr,state:Ze};if(i0(tn).length>0){for(let Mn of ct)if(pe.delete(Mn))Se=!0}let Xr=JSON.stringify(tn);for(let Mn of pe)if(ff(Xr,Mn))pe.delete(Mn),Se=!0}for(let Ze of pe)delete w.state[Ze]}let z=Gy(t.serviceWorker),We=z===null||z===!1?[]:[{tagName:"script",textContent:zj(z.scope??"/",x)}],qe=[...Xj(t),...We,...d,...rx(t.$head??[],p)],Ye=EE(qe,ne,ue,{title:re,charset:t.defaults.charset??"utf8",siteName:t.name,siteUrl:t.url,...m.alternates.length>0&&{alternates:m.alternates},...!Ll(e.urlPattern)&&{pageUrl:zi(e.urlPattern,t.build.trailingSlash)}});if(t.$media)w.$media={...t.$media,...w.$media};if(Object.values(w.$media??{}).some((pe)=>fr(String(pe))!==null))Ye.splice(2,0,{tagName:"script",textContent:Vi()});let te=t.images;await zy(w,te,n,s,i??void 0,u);let Ut={lang:O.lang,prePaintScheme:!1,projectStyle:t.style??null,resolveClass:(pe)=>Fe(x,g(pe,gr(e.sourcePath),w.imports??{})),rewriteSrc:(pe)=>Fe(x,c(pe,gr(e.sourcePath))),runtimeImports:y,serverBaseUrl:Gf(x),title:re},Je=await My(w,Ut);if(fe.rules.length>0){let pe=`<style>
567
- ${kf(fe.rules.join(`
568
+ `,{outfile:R,resolveDir:e},{minify:x,target:"browser"}),Pe+=1,a(` ${P.length} element(s) → ${y}`)}catch(N){let z=`Error bundling npm $elements [${P.join(", ")}]: ${ye(N)}`;i.push(z),console.error(z)}}}if(D.size>0){let y=await JP(m,void 0,x);if(y.written>0)a(`Bundling ${y.written} runtime subpath module(s)...`);Pe+=y.written;for(let P of y.errors)i.push(P),console.error(P)}let j;try{j=sg(process.env)}catch(y){i.push(ye(y)),console.error(ye(y)),j=sg({})}for(let y of xe.emitters()){let P=y.project?.key,R=P?p[P]:void 0;if(P&&(R==null||F(R)&&Object.keys(R).length===0))continue;try{let N=await y.call("emit",R??null,{buildTime:j,projectConfig:p,root:e,routes:We,sections:Ze});for(let z of N??[]){let Q=ft(m,z.path.replace(/^\//,""));if(!Q.startsWith(m+DP))throw Error(`emit path escapes outDir: ${z.path}`);xr(br(Q),{recursive:!0}),ln(Q,z.content),Pe+=1,a(` ${y.name} emitted ${z.path}`)}}catch(N){let z=`Error in ${y.name}.emit: ${ye(N)}`;i.push(z),console.error(z)}}if(d("bundles"),p.redirects&&Object.keys(p.redirects).length>0){a("Generating redirects...");let y=new Set(We.map((R)=>R.urlPattern)),P=GV(p.redirects,m,{basePath:or,compiledUrls:y,trailingSlash:p.build.trailingSlash});Pe+=P.files,i.push(...P.errors)}if(Ss)a(`Generating sitemap (${mo.length} URL(s))...`),Pe+=ZV(mo,m);else if(!Lt&&p.build.sitemap!==!1)console.warn("sitemap.xml skipped — set `url` in project.json to enable sitemap generation.");if(ht.size>0){let{copied:y,missing:P}=BE(ht,Qe,m);Pe+=y,a(`Copying ${y} mounted asset(s)...`);for(let R of P)console.warn(`Referenced asset not found: ${R}`)}if(qs(b))a("Copying public/ assets..."),bx(b,m,{recursive:!0});if(Ss)Pe+=QV(m,Lt);{let y=[PP(p),_P(p,new Date)];for(let N of y){for(let z of N.errors)i.push(z),console.error(z);for(let z of N.warnings)console.warn(z)}let{skipped:P,written:R}=OP(y.flatMap((N)=>N.files),m,qs);Pe+=R;for(let N of P)a(` ${N} — kept the copy from public/`)}{let y=mx(p.serviceWorker);if(y!==null){let P=y===!1?vP():wP(y,m,or);for(let R of P.warnings)console.warn(R);for(let R of P.errors)i.push(R),console.error(R);if(P.path!==null)ln(Nr(m,P.path),P.source,"utf8"),Pe+=1,a(y===!1?" sw.js — tombstone (unregisters and clears)":" sw.js")}}{let{errors:y,rules:P}=ME(p.build,V);i.push(...y);let R=DE([...P,...IE(m)],or);if(R.length>0){a("Writing response headers..."),Pe+=LE(m,R);let{adapter:N,deploy:z}=p.build;if(N==="node"||N==="bun")console.warn(`The "${N}" 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(N===void 0&&z===void 0)if(qs(ft(b,"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.")}Pe+=FE(m)}if(p.copy){a("Copying mapped files...");for(let[y,P]of Object.entries(p.copy)){if(!_(P))throw TypeError(`project.json copy["${y}"] must be a destination path string`);let R=ft(e,y),N=ft(m,P);xr(br(N),{recursive:!0}),bx(R,N)}}if(a(`
569
+ Build complete: ${We.length} routes, ${Pe} files`),i.length>0)a(` ${i.length} error(s)`);return d("outputs"),l.total=performance.now()-c,{errors:i,files:Pe,routes:We.length,serverEntries:S,timings:l}}async function FV(e,t,n,r,s,o,i,a,l,c,u,d,p,m,g,b,h){let x=Co(t.url),k=ta(await gs(e.sourcePath,a),e.sourcePath,n),w=await ZE(k,t,n),v=Yf(k,t,n),E=[...Ul(k,e.sourcePath,n),...v.flatMap((me)=>Ul(me.doc,me.path,n))],O=Vf(k),I=[...O.head??[]],D=w.$head??[],V=O.title??null,W=new Set(Object.keys(w.state??{}));lE(w,t,e,n,m.i18n,m.translations,O),delete w.title;let A=Object.keys(t.state??{}).filter((me)=>me!=="$site"&&me!=="$page"&&!W.has(me)),J=Y0({defaults:t.defaults,pageDir:_(k.$dir)?k.$dir:void 0,pageLang:O.lang,routeLocale:fr(e.urlPattern,m.i18n)}),G={...w.state};if(e.pagedState&&w.state&&e.pagedState.key in w.state)w.state[e.pagedState.key]=e.pagedState.items;await Bl(w,e,n,{config:t,registerBundle:(me)=>{c(me,null)},registry:l,sections:r});let se=WV(G,w.state??{},e.pagedState?.key),ie=Vo(w.state??{},null,{document:w,holdMutable:!0}),le=(me)=>{Object.assign(w.state.$page,me),Object.assign(ie.$page,me)},te=V??t.name;if(ce(te))te=Zt(te,ie)??te;le({title:te});let de=wx(FP(I,ie),p),xe=ky(de);if(xe!==void 0)le({description:xe});let X=wx(FP(D,ie),p);nc(w,ie,se);let U={counter:{n:0},media:{...t.$media,...w.$media},rules:[]},H={n:0},K,He=()=>K??=Vo(w.state??{}),Ve=V0(o,w);if(kx(w,o,{defaults:t.defaults,liveTags:Ve,slotCss:U,slotIds:H,slotScope:He}),w.state){let me=new Set,Xr=new Set(A);for(let[et,Jt]of Object.entries(w.state)){if(et==="$site"||et==="$page")continue;if(L(Jt)&&Jt.timing==="compiler")delete w.state[et];else if(Array.isArray(Jt))me.add(et);else if(Fo(Jt))me.add(et),Xr.add(et)}for(let et of A)if(et in w.state)me.add(et);let st=!0;while(st){st=!1;let et={...w.state};delete et.$site,delete et.$page;for(let Lt of me)delete et[Lt];let{$head:Jt,$paths:$s,title:ei,...po}=w,ti={...po,state:et};if(N0(ti).length>0){for(let Lt of Xr)if(me.delete(Lt))st=!0}let Fn=JSON.stringify(ti);for(let Lt of me)if(yf(Fn,Lt))me.delete(Lt),st=!0}for(let et of me)delete w.state[et]}let Ze=mx(t.serviceWorker),re=Ze===null||Ze===!1?[]:[{tagName:"script",textContent:EP(Ze.scope??"/",x)}],Gt=[...kP(t),...re,...d,...wx(t.$head??[],p)],Qe=Q0(Gt,X,de,{title:te,charset:t.defaults.charset??Ts,siteName:t.name,siteUrl:t.url,...m.alternates.length>0&&{alternates:m.alternates},...!Hl(e.urlPattern)&&{pageUrl:ea(e.urlPattern,t.build.trailingSlash)}}),ht=await bP(Qe,{mounts:u,projectRoot:n,siteUrl:t.url});if(t.$media)w.$media={...t.$media,...w.$media};if(Object.values(w.$media??{}).some((me)=>mr(String(me))!==null))ht.splice(2,0,{tagName:"script",textContent:Ki()});let kt=t.images;await ux(w,kt,n,s,i??void 0,u);let _t={lang:J.lang,prePaintScheme:!1,projectStyle:t.style??null,resolveClass:(me)=>Te(x,h(me,br(e.sourcePath),w.imports??{})),rewriteSrc:(me)=>Te(x,c(me,br(e.sourcePath))),runtimeImports:g,serverBaseUrl:rd(x),title:te},We=await ex(w,_t);if(U.rules.length>0){let me=`<style>
570
+ ${Nf(U.rules.join(`
568
571
  `))}
569
572
  </style>
570
- </head>`;Je.html=Je.html.replace("</head>",gs(pe))}Je.html=Q2(Je.html,Ye,O);let jt=(pe)=>typeof pe==="string"&&!pe.startsWith("./")&&!pe.startsWith("../"),bt=[...new Set([...w.$elements??[],...E.flatMap((pe)=>pe.doc.$elements??[]),...P.$elements??[]].filter((pe)=>jt(pe)))];if(bt.length>0)Je.html=Z2(Je.html,S(bt));return{doc:w,excludeFromSitemap:P.$sitemap===!1,files:Je.files,html:Je.html,liveTags:q,unregisteredRelations:_E(Ye),serverEntries:j}}function U2(e,t,n){if(e.length===0)return{connectors:[],mounts:[]};let r=Po(n.url),s={};for(let l of t.projectContributions()){let{key:c}=l.project;if(c in n)s[c]=n[c]}let o=e.map((l)=>{let c=l.server,{module:u}=c;if(!k(u)||u==="")throw Error(`Extension class "${l.name}": server.module (a bare import specifier) is required to generate a deployable worker`);let d=Fe(r,c.basePath);return{basePath:d,className:l.classDef.title??l.name,module:u,options:{basePath:d,sections:s},order:c.order??100}}),i=new Set;for(let l of Object.values(s)){if(!L(l))continue;for(let c of Object.values(l)){let u=L(c)?c.provider:void 0;if(k(u))i.add(u)}}let a=[];for(let l of t.connectors()){let c=String(l.connector.provider);if(!i.has(c))continue;let{module:u}=l.connector;if(!k(u)||u==="")throw Error(`Connector class "${l.name}": connector.module (a bare import specifier) is required to generate a deployable worker`);a.push({className:l.classDef.title??l.name,module:u,provider:c})}return{connectors:a,mounts:o}}async function z2(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: ${be(a)}`)}}return r}function ax(e,t){if(Array.isArray(e))return e.map((n)=>ax(n,t));if(L(e))return Object.fromEntries(Object.entries(e).map(([n,r])=>[n,ax(r,t)]));if(le(e))return Gt(e,t)??e;return e}function cP(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(le(o))r.attributes[s]=Gt(o,t)??o}if(le(r.textContent))r.textContent=Gt(r.textContent,t)??r.textContent;else if(D(r.textContent))r.textContent=ax(r.textContent,t);return r})}function rx(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)&&K2(o))r.attributes[s]=t(o)}return r})}function K2(e){return!e.startsWith("/")&&!e.startsWith("./")&&!e.startsWith("../")&&!e.startsWith("http")&&!e.startsWith("data:")}function dP(e){return yP(e).replaceAll("${","&#36;{")}function pP(e){return e.replaceAll("${","$​{")}function mP(e){return k(e)||Ie(e)||Ge(e)?String(e):null}function hP(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 le(o)?mP(Yl(o,t))??o:o;return hP(o,t)});else if(r==="style"&&D(e.style)){let o={...e.style};for(let[i,a]of Object.entries(o))if(le(a))o[i]=Yl(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(le(a)){let l=Yl(a,t);o[i]=k(l)&&l.includes("${")?pP(l):l??a}n.attributes=o}else if(r==="$props"&&D(e.$props)){let o={...e.$props};for(let[i,a]of Object.entries(o))if(le(a)){let l=Yl(a,t);o[i]=l!==null?l??null:a}n.$props=o}else if(le(s)){let o=Yl(s,t);if(r==="textContent"&&k(o)&&o.includes("${"))n.innerHTML=dP(o);else n[r]=o??s}else n[r]=s;return n}function Yl(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=Ji(e)?`return (${e.slice(2,-1)})`:`return \`${e}\``;return Function("state","$map","item","index",o)(t,n,r,s)}catch{return null}}function Zl(e,t,n){if(!D(e))return;if(le(e.innerHTML)){let o=Gt(e.innerHTML,t);if(o!=null)e.innerHTML=String(o).replaceAll("${","&#36;{")}let r=e.textContent;if(le(r)){let o=Gt(r,t);if(k(o)&&o.includes("${"))e.innerHTML=dP(o),delete e.textContent;else e.textContent=o??r}if(D(e.style)){for(let[o,i]of Object.entries(e.style))if(le(i))e.style[o]=Gt(i,t)??i}if(D(e.attributes)){for(let[o,i]of Object.entries(e.attributes))if(le(i)){let a=Gt(i,t);e.attributes[o]=k(a)&&a.includes("${")?pP(a):a??i}}if(D(e.$props)){let o=e.$props;for(let[i,a]of Object.entries(o))if(le(a))o[i]=Gt(a,t)??a}let s=e.children;if(Le(s)){let o=uP(s,t,n);if(o){e.children=o;return}}if(le(s)){let o=Gt(s,t);if(Array.isArray(o)){let i=o;e.children=i;for(let a of i)Zl(a,t,n)}}else if(Array.isArray(e.children)){let o=0;while(o<e.children.length){let i=e.children[o];if(le(i)){let a=Gt(i,t);if(Array.isArray(a)){let c=a;e.children.splice(o,1,...c);for(let u of c)Zl(u,t,n);o+=c.length;continue}let l=mP(a);if(l!==null){e.children[o]=l,o+=1;continue}}if(Le(i)){let a=uP(i,t,n);if(a){e.children.splice(o,1,...a),o+=a.length;continue}}Zl(i,t,n),o+=1}}}function G2(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(Pn(o)&&(o.timing===void 0||o.timing==="compiler")&&t[s]!==o)r.add(s);return r}function X2(e,t,n){if(!me(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)&&!Vg(t,o)}function uP(e,t,n){qo(e);let{items:r,map:s}=e;if(!s||!Hg(e,t))return null;let o=sy(e,t);if(o===null)return null;if(o.length===0&&!X2(r,t,n))return null;return o.map((i,a)=>{let l=Object.create(t);l.$map={index:a,item:i},l["$map/item"]=i,l["$map/index"]=a;let c=hP(s,l);return Zl(c,l,n),c})}function lx(e,t,n={}){let{defaults:r,liveTags:s,slotCss:o,slotIds:i,slotScope:a}=n;if(!D(e))return;if(Array.isArray(e)){for(let u of e)lx(u,t,n);return}if(Array.isArray(e.children))for(let u of e.children)lx(u,t,n);let{tagName:l}=e;if(!k(l))return;let c=t.get(l);if(c){if(e.attributes){let{lifted:I,rest:V}=ey(e.attributes);if(I)e.attributes=V,e.$props={...I,...e.$props}}let u=()=>a?.()??{},d=(I)=>{if(o&&D(I)&&!Array.isArray(I))Af(I,o.rules,o.media,"",o.counter,"jxs");return Fo(I,u(),null)},p=Rn(c,r),m=ty(c,e.attributes,{}),y=m?{...m,...e.$props}:e.$props||null,S={componentDefs:t,defaults:r,liveTags:s,path:[{key:JSON.stringify(y??{}),tag:l}],slotIds:i},g=!oy(l,c,s),{children:x}=e,P=!p&&!g&&Ns(c.children)?Zg(S):null,w=p?(Array.isArray(x)?x:[]).map((I)=>d(I)).join(`
571
- `):null,E=d0(c,y,p?null:Qg(x,u(),d,P),S);if(P!==null)e.attributes={...e.attributes,[ml]:String(P)};e.innerHTML=p?`<template shadowrootmode="${p}"><link rel="stylesheet" href="${Rf(l)}">${E}</template>${w??""}`:E,delete e.children;let j=Dl(c,y),A=ry(c.style,j);if(Object.keys(A).length>0)e.style={...e.style,...A};let T=ny(c.attributes,j);if(Object.keys(T).length>0)e.attributes={...e.attributes,...T};if(!g&&e.$props&&Object.keys(e.$props).length>0)e.attributes={...e.attributes,"data-jx-props":JSON.stringify(e.$props)};if(delete e.$props,g)e.$static=!0;else e.$prerendered=!0}}function Y2(e,t,n=new Map,r=new Set,s="",o={},i=t){let a=(j)=>e.includes(`<${j}`),l=(j)=>s.includes(`<${j}`),c=t.filter((j)=>a(j)||l(j));if(c.length===0)return e;let u=c.flatMap((j)=>{let A=n.get(j);return A===void 0||A===""?[]:[A]}).join(`
573
+ </head>`;We.html=We.html.replace("</head>",ys(me))}We.html=KV(We.html,ht,J);let Pe=(me)=>typeof me==="string"&&!me.startsWith("./")&&!me.startsWith("../"),Ln=[...new Set([...w.$elements??[],...v.flatMap((me)=>me.doc.$elements??[]),...k.$elements??[]].filter((me)=>Pe(me)))];if(Ln.length>0)We.html=zV(We.html,b(Ln));return{doc:w,excludeFromSitemap:k.$sitemap===!1,files:We.files,html:We.html,liveTags:Ve,unregisteredRelations:oj(ht),unrenderedHeadMaterial:tE([...t.$head??[],...D,...I]),serverEntries:E}}function VV(e,t,n){if(e.length===0)return{connectors:[],mounts:[]};let r=Co(n.url),s={};for(let l of t.projectContributions()){let{key:c}=l.project;if(c in n)s[c]=n[c]}let o=e.map((l)=>{let c=l.server,{module:u}=c;if(!_(u)||u==="")throw Error(`Extension class "${l.name}": server.module (a bare import specifier) is required to generate a deployable worker`);let d=Te(r,c.basePath);return{basePath:d,className:l.classDef.title??l.name,module:u,options:{basePath:d,sections:s},order:c.order??100}}),i=new Set;for(let l of Object.values(s)){if(!L(l))continue;for(let c of Object.values(l)){let u=L(c)?c.provider:void 0;if(_(u))i.add(u)}}let a=[];for(let l of t.connectors()){let c=String(l.connector.provider);if(!i.has(c))continue;let{module:u}=l.connector;if(!_(u)||u==="")throw Error(`Connector class "${l.name}": connector.module (a bare import specifier) is required to generate a deployable worker`);a.push({className:l.classDef.title??l.name,module:u,provider:c})}return{connectors:a,mounts:o}}async function qV(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: ${ye(a)}`)}}return r}function Px(e,t){if(Array.isArray(e))return e.map((n)=>Px(n,t));if(L(e))return Object.fromEntries(Object.entries(e).map(([n,r])=>[n,Px(r,t)]));if(ce(e))return Zt(e,t)??e;return e}function FP(e,t){return e.map((n)=>{if(!F(n))return n;let r={...n};if(r.attributes){r.attributes={...r.attributes};for(let[s,o]of Object.entries(r.attributes))if(ce(o))r.attributes[s]=Zt(o,t)??o}if(ce(r.textContent))r.textContent=Zt(r.textContent,t)??r.textContent;else if(F(r.textContent))r.textContent=Px(r.textContent,t);return r})}function wx(e,t){return e.map((n)=>{if(!F(n)||!n.attributes)return n;let r={...n,attributes:{...n.attributes}};for(let s of["href","src"]){let o=r.attributes[s];if(_(o)&&HV(o))r.attributes[s]=t(o)}return r})}function HV(e){return!e.startsWith("/")&&!e.startsWith("./")&&!e.startsWith("../")&&!e.startsWith("http")&&!e.startsWith("data:")}function HP(e){return KP(e).replaceAll("${","&#36;{")}function WP(e){return e.replaceAll("${","$​{")}function BP(e){return _(e)||De(e)||Xe(e)?String(e):null}function UP(e,t){if(!F(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(_(o))return ce(o)?BP(tc(o,t))??o:o;return UP(o,t)});else if(r==="style"&&F(e.style)){let o={...e.style};for(let[i,a]of Object.entries(o))if(ce(a))o[i]=tc(a,t)??a;n.style=o}else if(r==="attributes"&&F(e.attributes)){let o={...e.attributes};for(let[i,a]of Object.entries(o))if(ce(a)){let l=tc(a,t);o[i]=_(l)&&l.includes("${")?WP(l):l??a}n.attributes=o}else if(r==="$props"&&F(e.$props)){let o={...e.$props};for(let[i,a]of Object.entries(o))if(ce(a)){let l=tc(a,t);o[i]=l!==null?l??null:a}n.$props=o}else if(ce(s)){let o=tc(s,t);if(r==="textContent"&&_(o)&&o.includes("${"))n.innerHTML=HP(o);else n[r]=o??s}else n[r]=s;return n}function tc(e,t){try{let n=t.$map,r=F(n)&&"item"in n?n.item:void 0,s=F(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 nc(e,t,n){if(!F(e))return;if(ce(e.innerHTML)){let o=Zt(e.innerHTML,t);if(o!=null)e.innerHTML=String(o).replaceAll("${","&#36;{")}let r=e.textContent;if(ce(r)){let o=Zt(r,t);if(_(o)&&o.includes("${"))e.innerHTML=HP(o),delete e.textContent;else e.textContent=o??r}if(F(e.style)){for(let[o,i]of Object.entries(e.style))if(ce(i))e.style[o]=Zt(i,t)??i}if(F(e.attributes)){for(let[o,i]of Object.entries(e.attributes))if(ce(i)){let a=Zt(i,t);e.attributes[o]=_(a)&&a.includes("${")?WP(a):a??i}}if(F(e.$props)){let o=e.$props;for(let[i,a]of Object.entries(o))if(ce(a))o[i]=Zt(a,t)??a}let s=e.children;if(Le(s)){let o=VP(s,t,n);if(o){e.children=o;return}}if(ce(s)){let o=Zt(s,t);if(Array.isArray(o)){let i=o;e.children=i;for(let a of i)nc(a,t,n)}}else if(Array.isArray(e.children)){let o=0;while(o<e.children.length){let i=e.children[o];if(ce(i)){let a=Zt(i,t);if(Array.isArray(a)){let c=a;e.children.splice(o,1,...c);for(let u of c)nc(u,t,n);o+=c.length;continue}let l=BP(a);if(l!==null){e.children[o]=l,o+=1;continue}}if(Le(i)){let a=VP(i,t,n);if(a){e.children.splice(o,1,...a),o+=a.length;continue}}nc(i,t,n),o+=1}}}function WV(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(An(o)&&(o.timing===void 0||o.timing==="compiler")&&t[s]!==o)r.add(s);return r}function BV(e,t,n){if(!pe(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)&&!ry(t,o)}function VP(e,t,n){Bo(e);let{items:r,map:s}=e;if(!s||!oy(e,t))return null;let o=$y(e,t);if(o===null)return null;if(o.length===0&&!BV(r,t,n))return null;return o.map((i,a)=>{let l=Object.create(t);l.$map={index:a,item:i},l["$map/item"]=i,l["$map/index"]=a;let c=UP(s,l);return nc(c,l,n),c})}function kx(e,t,n={}){let{defaults:r,liveTags:s,slotCss:o,slotIds:i,slotScope:a}=n;if(!F(e))return;if(Array.isArray(e)){for(let u of e)kx(u,t,n);return}if(Array.isArray(e.children))for(let u of e.children)kx(u,t,n);let{tagName:l}=e;if(!_(l))return;let c=t.get(l);if(c){if(e.attributes){let{lifted:D,rest:V}=gy(e.attributes);if(D)e.attributes=V,e.$props={...D,...e.$props}}let u=()=>a?.()??{},d=(D)=>{if(o&&F(D)&&!Array.isArray(D))Mf(D,o.rules,o.media,"",o.counter,"jxs");return Ho(D,u(),null)},p=Jn(c,r),m=yy(c,e.attributes,{}),g=m?{...m,...e.$props}:e.$props||null,b={componentDefs:t,defaults:r,liveTags:s,path:[{key:JSON.stringify(g??{}),tag:l}],slotIds:i},h=!Sy(l,c,s),{children:x}=e,k=!p&&!h&&Ms(c.children)?my(b):null,w=p?Kt((Array.isArray(x)?x:[]).map((D)=>d(D)),{separator:`
574
+ `}):null,v=F0(c,g,p?null:hy(x,u(),d,k),b);if(k!==null)e.attributes={...e.attributes,[El]:String(k)};e.innerHTML=p?`<template shadowrootmode="${p}"><link rel="stylesheet" href="${Df(l)}">${v}</template>${w??""}`:v,delete e.children;let E=ql(c,g),O=by(c.style,E);if(Object.keys(O).length>0)e.style={...e.style,...O};let I=xy(c.attributes,E);if(Object.keys(I).length>0)e.attributes={...e.attributes,...I};if(!h&&e.$props&&Object.keys(e.$props).length>0)e.attributes={...e.attributes,"data-jx-props":JSON.stringify(e.$props)};if(delete e.$props,h)e.$static=!0;else e.$prerendered=!0}}function UV(e,t,n=new Map,r=new Set,s="",o={},i=t){let a=(E)=>e.includes(`<${E}`),l=(E)=>s.includes(`<${E}`),c=t.filter((E)=>a(E)||l(E));if(c.length===0)return e;let u=c.flatMap((E)=>{let O=n.get(E);return O===void 0||O===""?[]:[O]}).join(`
572
575
  `),d=u===""?"":`<style>
573
- ${kf(u)}
574
- </style>`,p=(j)=>{let A=j.filter(Boolean).join(`
575
- `);return A===""?e:e.replace("</head>",gs(` ${A}
576
- </head>`))},m=new Set(c),y=i.filter((j)=>m.has(j)&&(l(j)||!r.has(j)));if(y.length===0)return p([d]);let S=Pl(o),x=[...Qy(o),...y.map((j)=>`/components/${j}.js`)].map((j)=>`<link rel="modulepreload" href="${j}">`).join(`
577
- `),P=e.includes('<script type="importmap">'),w=p([P?"":S,x,d]),E=y.map((j)=>`<script type="module" src="/components/${j}.js"></script>`).join(`
578
- `);return w.replace("</body>",gs(` ${E}
579
- </body>`))}function Z2(e,t){return e.replace("</body>",gs(` <script type="module" src="${t}"></script>
580
- </body>`))}function Q2(e,t,n){let r=jE(t),s=/<head>([\s\S]*?)<\/head>/i,o=e.match(s),i="";if(o){let l=o[1].match(/<style>[\s\S]*?<\/style>/gi);if(l)i+=`
576
+ ${Nf(u)}
577
+ </style>`,p=(E)=>{let O=E.filter(Boolean).join(`
578
+ `);return O===""?e:e.replace("</head>",ys(` ${O}
579
+ </head>`))},m=new Set(c),g=i.filter((E)=>m.has(E)&&(l(E)||!r.has(E)));if(g.length===0)return p([d]);let b=Cl(o),x=[...xx(o),...g.map((E)=>`/components/${E}.js`)].map((E)=>`<link rel="modulepreload" href="${E}">`).join(`
580
+ `),k=e.includes('<script type="importmap">'),w=p([k?"":b,x,d]),v=g.map((E)=>`<script type="module" src="/components/${E}.js"></script>`).join(`
581
+ `);return w.replace("</body>",ys(` ${v}
582
+ </body>`))}function zV(e,t){return e.replace("</body>",ys(` <script type="module" src="${t}"></script>
583
+ </body>`))}function KV(e,t,n){let r=eE(t),s=/<head>([\s\S]*?)<\/head>/i,o=e.match(s),i="";if(o){let l=o[1].match(/<style>[\s\S]*?<\/style>/gi);if(l)i+=`
581
584
  ${l.join(`
582
585
  `)}`;let c=o[1].match(/<script[\s\S]*?<\/script>/gi);if(c)i+=`
583
586
  ${c.join(`
584
- `)}`}let a=e;if(s.test(a))a=a.replace(s,gs(`<head>
587
+ `)}`}let a=e;if(s.test(a))a=a.replace(s,ys(`<head>
585
588
  ${r}${i}
586
- </head>`));return a=a.replace(/<html\s[^>]*>/i,(l)=>{let c=/lang=/.test(l)?l.replace(/lang="[^"]*"/,gs(`lang="${n.lang}"`)):l.replace("<html",`<html lang="${n.lang}"`);if(n.dir!==void 0)c=/\sdir=/.test(c)?c.replace(/\sdir="[^"]*"/,` dir="${n.dir}"`):c.replace("<html",gs(`<html dir="${n.dir}"`));return c}),a}function gP(e,t,n){if(e==="/")return Tr(t,"index.html");if(Ll(e))return Tr(t,"404.html");let r=e.replace(/^\//,"");if(n==="always")return Tr(t,r,"index.html");return Tr(t,`${r}.html`)}function eV(e,t,n={}){let r=0,s=[],o=[],i=(c)=>c.length>1&&c.endsWith("/")?c.slice(0,-1):c,a=new Set([...n.compiledUrls??[]].map((c)=>i(c))),l=n.trailingSlash??"always";for(let[c,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&&!sx.has(String(m))){s.push(`Redirect "${c}" has status ${m}, which is not an RFC 9110 §15.4 redirection `+`status. Use one of ${[...sx.keys()].join(", ")}, or { destination, rewrite: true } for a proxy.`);continue}let y=n.basePath??"";if(o.push(`${Fe(y,c)} ${Fe(y,d)} ${m}`),c.includes(":")||c.includes("*"))continue;if(a.has(i(c)))console.warn(`The ${p?"rewrite":"redirect"} "${c}" collides with a compiled page at the same route — `+"remove one or the other.");if(p)continue;let S=sx.get(String(m));if(!S.html)continue;let g=gP(c,t,l),x=S.canonical?`
587
- <link rel="canonical" href="${ox(d)}">`:`
588
- <meta name="robots" content="noindex">`,P=`<!DOCTYPE html>
589
+ </head>`));return a=a.replace(/<html\s[^>]*>/i,(l)=>{let c=/lang=/.test(l)?l.replace(/lang="[^"]*"/,ys(`lang="${n.lang}"`)):l.replace("<html",`<html lang="${n.lang}"`);if(n.dir!==void 0)c=/\sdir=/.test(c)?c.replace(/\sdir="[^"]*"/,` dir="${n.dir}"`):c.replace("<html",ys(`<html dir="${n.dir}"`));return c}),a}function zP(e,t,n){if(e==="/")return Nr(t,"index.html");if(Hl(e))return Nr(t,"404.html");let r=e.replace(/^\//,"");if(n==="always")return Nr(t,r,"index.html");return Nr(t,`${r}.html`)}function GV(e,t,n={}){let r=0,s=[],o=[],i=(c)=>c.length>1&&c.endsWith("/")?c.slice(0,-1):c,a=new Set([...n.compiledUrls??[]].map((c)=>i(c))),l=n.trailingSlash??"always";for(let[c,u]of Object.entries(e)){let d=_(u)?u:u.destination,p=!_(u)&&"rewrite"in u&&u.rewrite,m=p?200:!_(u)&&("status"in u)?u.status??301:301;if(!p&&!vx.has(String(m))){s.push(`Redirect "${c}" has status ${m}, which is not an RFC 9110 §15.4 redirection `+`status. Use one of ${[...vx.keys()].join(", ")}, or { destination, rewrite: true } for a proxy.`);continue}let g=n.basePath??"";if(o.push(`${Te(g,c)} ${Te(g,d)} ${m}`),c.includes(":")||c.includes("*"))continue;if(a.has(i(c)))console.warn(`The ${p?"rewrite":"redirect"} "${c}" collides with a compiled page at the same route — `+"remove one or the other.");if(p)continue;let b=vx.get(String(m));if(!b.html)continue;let h=zP(c,t,l),x=b.canonical?`
590
+ <link rel="canonical" href="${Ex(d)}">`:`
591
+ <meta name="robots" content="noindex">`,k=`<!DOCTYPE html>
589
592
  <html>
590
593
  <head>
591
594
  <meta charset="utf-8">
592
- <meta http-equiv="refresh" content="0;url=${ox(d)}">${x}
595
+ <meta http-equiv="refresh" content="0;url=${Ex(d)}">${x}
593
596
  <title>Redirecting...</title>
594
597
  </head>
595
598
  <body>
596
- <p>Redirecting to <a href="${ox(d)}">${yP(d)}</a>...</p>
599
+ <p>Redirecting to <a href="${Ex(d)}">${KP(d)}</a>...</p>
597
600
  </body>
598
- </html>`;hr(gr(g),{recursive:!0}),on(g,P,"utf8"),r+=1}if(o.length>0)on(Tr(t,"_redirects"),`${o.join(`
601
+ </html>`;xr(br(h),{recursive:!0}),ln(h,k,"utf8"),r+=1}if(o.length>0)ln(Nr(t,"_redirects"),`${o.join(`
599
602
  `)}
600
- `,"utf8"),r+=1;return{errors:s,files:r}}function yP(e){return String(e).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;")}function ox(e){return String(e).replaceAll("&","&amp;").replaceAll('"',"&quot;").replaceAll("<","&lt;")}function ix(e){return String(e).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&apos;")}function tV(e){return e.toISOString().replace(/\.\d{3}Z$/,"Z")}function rV(e,t){if(e.length===0)return 0;let n=e.map((o)=>{let i=(o.alternates??[]).map((a)=>` <xhtml:link rel="alternate" hreflang="${ix(a.hreflang)}" href="${ix(a.href)}"/>`).join(`
603
+ `,"utf8"),r+=1;return{errors:s,files:r}}function KP(e){return String(e).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;")}function Ex(e){return String(e).replaceAll("&","&amp;").replaceAll('"',"&quot;").replaceAll("<","&lt;")}function jx(e){return String(e).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&apos;")}function XV(e){return e.toISOString().replace(/\.\d{3}Z$/,"Z")}function ZV(e,t){if(e.length===0)return 0;let n=e.map((o)=>{let i=(o.alternates??[]).map((a)=>` <xhtml:link rel="alternate" hreflang="${jx(a.hreflang)}" href="${jx(a.href)}"/>`).join(`
601
604
  `);return` <url>
602
- <loc>${ix(o.loc)}</loc>
605
+ <loc>${jx(o.loc)}</loc>
603
606
  <lastmod>${o.lastmod}</lastmod>
604
607
  ${i===""?"":`${i}
605
608
  `} </url>`}).join(`
606
609
  `),s=`<?xml version="1.0" encoding="UTF-8"?>
607
- <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"${e.some((o)=>(o.alternates?.length??0)>0)?` xmlns:xhtml="${nV}"`:""}>
610
+ <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"${e.some((o)=>(o.alternates?.length??0)>0)?` xmlns:xhtml="${YV}"`:""}>
608
611
  ${n}
609
612
  </urlset>
610
- `;return on(Tr(t,"sitemap.xml"),s,"utf8"),1}function sV(e,t){let n=Tr(e,"robots.txt"),r=Ls(n),s=r?V2(n,"utf8"):`User-agent: *
613
+ `;return ln(Nr(t,"sitemap.xml"),s,"utf8"),1}function QV(e,t){let n=Nr(e,"robots.txt"),r=qs(n),s=r?MV(n,"utf8"):`User-agent: *
611
614
  Allow: /
612
615
  `;if(/^Sitemap:/im.test(s))return 0;if(!s.endsWith(`
613
616
  `))s+=`
614
617
  `;return s+=`
615
- Sitemap: ${Cs("/sitemap.xml",t)}
616
- `,on(n,s,"utf8"),r?0:1}var lP='set build.adapter to "cloudflare-workers", "cloudflare-pages", "node", or "bun".',sx,nV="http://www.w3.org/1999/xhtml";var xP=J(()=>{ce();dm();Lt();An();zS();Om();bi();hy();rE();is();oE();lE();bE();qf();Ti();Sy();wE();PE();kE();uy();UE();Hl();Jy();yn();Mi();py();dy();Hj();yy();Sl();Kj();iy();Qj();ly();oP();Fy();Eo();sx=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 oV}from"node:module";import{join as iV}from"node:path";import{spawn as aV}from"node:child_process";function lV(e){try{return oV(iV(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 bP(e,t,n=aV,r=process){let o=[lV(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 $P=()=>{};import{createServer as cV}from"node:http";import{existsSync as rd,readFileSync as SP,statSync as uV}from"node:fs";import{extname as fV,join as cx,normalize as dV,resolve as wP,sep as pV}from"node:path";function hV(e,t){let n=dV(t).replaceAll("\\","/"),r=wP(e,`.${n.startsWith("/")?n:`/${n}`}`);if(r!==e&&!r.startsWith(e+pV))return null;if(rd(r)){if(uV(r).isDirectory()){let o=cx(r,"index.html");return rd(o)?o:null}return r}let s=cx(r,"index.html");return rd(s)?s:null}function vP(e,t){let n=wP(e),r=cV((s,o)=>{let i=new URL(s.url??"/","http://localhost"),a=hV(n,decodeURIComponent(i.pathname));if(a){o.writeHead(200,{"Content-Type":mV.get(fV(a).toLowerCase())??"application/octet-stream"}),o.end(SP(a));return}let l=cx(n,"404.html");if(rd(l)){o.writeHead(404,{"Content-Type":"text/html; charset=utf-8"}),o.end(SP(l));return}o.writeHead(404,{"Content-Type":"text/plain; charset=utf-8"}),o.end("Not found")});return r.listen(t),r}var mV;var EP=J(()=>{bp();mV=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",...m$}))});function gV(e){let{corePath:t,fragments:n,fieldSchemaRefs:r=[]}=e;return{$comment:kP,$defs:{Fields:{$id:xl,anyOf:[{$ref:`${jP}#/$defs/JxFieldSchema`},{$ref:`${jP}#/$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 ec(e,t,n,r=[]){let s=structuredClone(e),o=new Map,i=new Set;ux(s,i);let a=0,l=async(u)=>{let d=Ql(u),p=o.get(d);if(p!==void 0)return p;let m;try{m=structuredClone(await t(d))}catch(x){throw Error(`bundleSchema: cannot load $ref target "${d}": ${vV(x)}`,{cause:x})}let y=k(m.$id)&&Fs(m.$id)?m.$id:null;a+=y===null?1:0;let S=y??`urn:jx:bundled:${a}`;if(o.set(d,S),i.has(S))return S;i.add(S),m.$id=S,await c(m,wV(d),!0);let g=s.$defs??={};return g[S]=m,S},c=async(u,d,p=!1)=>{if(Array.isArray(u)){for(let g of u)await c(g,d);return}if(!L(u))return;let m=u,y=d;if(!p&&k(m.$id)&&Fs(m.$id))y=null;let S=m.$ref;if(k(S)&&y!==null&&!S.startsWith("#")&&!Fs(S)){let g=S.indexOf("#"),x=g===-1?S:S.slice(0,g),P=g===-1?"":S.slice(g);if(x){let w=await l(`${y}/${x}`);m.$ref=`${w}${P}`}}for(let g of Object.values(m))await c(g,y)};await c(s,Ql(n),!0);for(let u of r)await l(`${Ql(n)}/${u}`);return s}function $V(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function*PP(e,t){for(let n of yV){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 xV){let r=e[n];if(!L(r))continue;for(let[s,o]of Object.entries(r))if(L(o))yield[o,`${t}/${n}/${$V(s)}`]}for(let n of bV){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 SV(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 tc(e){let t=structuredClone(e);if(L(t.$defs)){let o=new Set(Object.keys(t.$defs).filter((a)=>!Fs(a))),i={};for(let[a,l]of Object.entries(t.$defs)){let c=L(l)&&k(l.$id)?l.$id:a;i[Fs(a)?SV(c,o):a]=l}t.$defs=i}let n=new Map,r=(o,i)=>{let{$id:a}=o;if(k(a)&&Fs(a)&&!n.has(a))n.set(a,i);for(let[l,c]of PP(o,i))r(l,c)};r(t,"#");let s=(o,i)=>{let a=i,{$id:l}=o;if(k(l)&&Fs(l)){if(a=n.get(l)??i,a!=="#")delete o.$id}let c=o.$ref;if(k(c)){let u=c.indexOf("#"),d=u===-1?c:c.slice(0,u),p=u===-1?"":c.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 PP(o,a))s(u,a)};return s(t,"#"),t}function ux(e,t){if(Array.isArray(e)){for(let r of e)ux(r,t);return}if(!L(e))return;let n=e;if(k(n.$id)&&Fs(n.$id))t.add(n.$id);for(let r of Object.values(n))ux(r,t)}function Fs(e){return/^[a-zA-Z][a-zA-Z\d+.-]*:/.test(e)}function Ql(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 wV(e){let t=e.lastIndexOf("/");if(t===-1)return".";return t===0?"/":e.slice(0,t)}function vV(e){return e instanceof Error?e.message:String(e)}function EV(e){let{corePath:t,pathsValueRefs:n}=e;return{$comment:kP,$defs:{PathsValue:{$id:Io,anyOf:[...bl,...n.map((r)=>({$ref:r}))]}},$schema:"https://json-schema.org/draft/2020-12/schema",allOf:[{$ref:t}]}}async function OP(e){let{baseDir:t,coreDocumentRef:n,coreProjectRef:r,extensions:s,loadJson:o}=e,i=[],a=[],l=[],c=[];for(let p of s){if(p.project)i.push(p.project);if(p.document){let m=await _P(p.document,o,t);if(a.push(...m),m.length>0)l.push(p.document)}if(p.fields)c.push(...await _P(p.fields,o,t)),i.push(p.fields)}let u=gV({corePath:r,fieldSchemaRefs:c,fragments:i}),d=EV({corePath:n,pathsValueRefs:a});return{document:tc(await ec(d,o,t,l)),project:tc(await ec(u,o,t))}}async function _P(e,t,n){let r;try{r=await t(Ql(`${Ql(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 jP="https://jxsuite.com/schema/project/core/v2",kP="Generated by `jx schema` from project.json#/extensions — do not edit.",yV,xV,bV;var AP=J(()=>{$l();ce();$l();yV=["additionalItems","additionalProperties","contains","contentSchema","else","if","items","not","propertyNames","then","unevaluatedItems","unevaluatedProperties"],xV=["$defs","definitions","dependencies","dependentSchemas","patternProperties","properties"],bV=["allOf","anyOf","oneOf","prefixItems"]});import{existsSync as NP,readFileSync as jV,statSync as CP,writeFileSync as sd}from"node:fs";import{createRequire as dx}from"node:module";import{dirname as PV,isAbsolute as _V,relative as px,resolve as Vs,sep as mx}from"node:path";async function TP(e){let{config:t}=As(e),n=await Os(e,t),r=Vs(e),{document:s,project:o}=await OP({baseDir:r,coreDocumentRef:RP(e,OV),coreProjectRef:RP(e,kV),extensions:n.extensions.map((i)=>({document:i.schemas.document&&fx(e,i,i.schemas.document),fields:i.schemas.fields&&fx(e,i,i.schemas.fields),project:i.schemas.project&&fx(e,i,i.schemas.project)})),loadJson:IP(r)});return{documentSchema:s,projectSchema:o}}async function JP(e){let{documentSchema:t,projectSchema:n}=await TP(e),r=Vs(e,"project.schema.json"),s=Vs(e,"document.schema.json");return sd(r,`${JSON.stringify(n,null,2)}
617
- `,"utf8"),sd(s,`${JSON.stringify(t,null,2)}
618
- `,"utf8"),{documentSchemaPath:s,projectSchemaPath:r}}async function MP(e,t={}){let{write:n=!0}=t,r=Vs(e),s=qn(r),o=Vs(r,"project.schema.json"),i=Vs(r,"document.schema.json"),a=(S)=>{if(!NP(S))return!0;try{return CP(s).mtimeMs>CP(S).mtimeMs}catch{return!1}},c=a(o)||a(i)?await TP(r):null;if(c&&n)sd(o,`${JSON.stringify(c.projectSchema,null,2)}
619
- `,"utf8"),sd(i,`${JSON.stringify(c.documentSchema,null,2)}
620
- `,"utf8");let u=IP(r),d=c?.projectSchema??nc(o),p=c?.documentSchema??nc(i),m=tc(await ec(d,u,r));return{document:tc(await ec(p,u,r)),project:m}}function nc(e){let t=JSON.parse(jV(e,"utf8"));if(!L(t))throw TypeError(`Schema file "${e}" is not a JSON object`);return t}function CV(e){return e.startsWith(AV)&&e.endsWith(".json")}function RV(e,t){try{return dx(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 IP(e){return async(t)=>{let n=Vs(t),r=px(e,n);if(r.startsWith("..")||_V(r))throw Error(`Schema ref "${t}" escapes the project root ${e}`);let s=r.split(mx).join("/"),o="node_modules/",i=s.lastIndexOf(o),a=i===-1?null:s.slice(i+o.length);if(a!==null&&CV(a))return nc(RV(a,t));if(NP(n))return nc(n);if(a===null)throw Error(`Schema ref "${t}" does not exist`);let l;try{l=im(e,a)}catch(c){throw Error(`Schema ref "${t}" does not exist and "${a}" is not resolvable from the `+"project — is the package installed?",{cause:c})}return nc(l)}}function RP(e,t){let n=null;try{n=dx(Vs(e,"package.json")).resolve(t)}catch{try{n=dx(import.meta.url).resolve(t)}catch{n=null}}let r=`./node_modules/${t}`;return n?DP(e,n,r):r}function fx(e,t,n){let r=px(PV(t.manifestPath),n).split(mx).join("/"),s=`./node_modules/${t.specifier}/${r}`;return DP(e,n,s)}function DP(e,t,n){let r=px(e,t).split(mx).join("/");if(r.startsWith(".."))return n;return r.startsWith("./")?r:`./${r}`}var kV="@jxsuite/schema/schemas/project.core.schema.json",OV="@jxsuite/schema/schema.json",AV="@jxsuite/schema/";var hx=J(()=>{AP();ce();is();bi();Eo()});var VP=W(function(Pne,FP){var __dirname="/home/runner/work/jx/jx/node_modules/@webref/elements",LP=pt("fs").promises,od=pt("path");async function NV({folder:e=__dirname}={}){let t={},n=await LP.readdir(e);for(let r of n)if(r.endsWith(".json")&&r!=="package.json"){let s=await LP.readFile(od.join(e,r),"utf8");t[od.basename(r,".json")]=JSON.parse(s)}return t}FP.exports={listAll:NV}});var BP=W(function(_ne,WP){var __dirname="/home/runner/work/jx/jx/node_modules/@webref/css",TV=pt("fs").promises,qP=pt("path");async function HP({folder:e=__dirname}={}){let t=await TV.readFile(qP.join(e,"css.json"),"utf8");return JSON.parse(t)}async function JV({folder:e=__dirname}={}){let t=await HP(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((l)=>l!==o&&l.name===o.name);if(a)i+=" for "+o.for[0];if(n[r][i]=o,o.descriptors){let l=o.descriptors;o.descriptors={};for(let c of l)o.descriptors[c.name]=c}}}return n}WP.exports={listAll:HP,index:JV}});var UP=W(function(id,gx){(function(e,t){typeof id=="object"&&typeof gx=="object"?gx.exports=t():typeof define=="function"&&define.amd?define([],t):typeof id=="object"?id.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,v,_,{level:M="error",autofix:K,ruleName:ae}={}){function U(Dt){return Dt>0?f.slice(h,h+Dt):f.slice(Math.max(h+Dt,0),h)}function oe(Dt,{precedes:$r}={}){let Yr=Dt.map((Na)=>Na.trivia+Na.value).join(""),Ra=f[h];return Ra.type==="eof"?Yr:$r?Yr+Ra.trivia:Yr.slice(Ra.trivia.length)}let ie=f[h].type!=="eof"?f[h].line:f.length>1?f[h-1].line:1,ge=function(Dt){let $r=Dt.split(`
621
- `);return $r[$r.length-1]}(oe(U(-5),{precedes:!0})),De=U(5),ut=oe(De),In=ge+ut.split(`
618
+ Sitemap: ${Ns("/sitemap.xml",t)}
619
+ `,ln(n,s,"utf8"),r?0:1}var LP='set build.adapter to "cloudflare-workers", "cloudflare-pages", "node", or "bun".',vx,YV="http://www.w3.org/1999/xhtml";var GP=M(()=>{ae();eg();ol();Ft();hn();bw();vw();xg();bg();ji();Jy();VE();is();HE();UE();tj();Xf();Fi();Fy();sj();Py();_y();qf();ij();Ay();Hi();vj();zl();Qy();$n();qi();Ty();Ry();fx();$P();Iy();Pl();jP();wy();AP();Ey();MP();rx();ko();vx=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 eq}from"node:module";import{join as tq}from"node:path";import{spawn as nq}from"node:child_process";function rq(e){try{return eq(tq(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 XP(e,t,n=nq,r=process){let o=[rq(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 YP=()=>{};import{createServer as sq}from"node:http";import{existsSync as md,readFileSync as ZP,statSync as oq}from"node:fs";import{extname as iq,join as _x,normalize as aq,resolve as QP,sep as lq}from"node:path";function uq(e,t){let n=aq(t).replaceAll("\\","/"),r=QP(e,`.${n.startsWith("/")?n:`/${n}`}`);if(r!==e&&!r.startsWith(e+lq))return null;if(md(r)){if(oq(r).isDirectory()){let o=_x(r,"index.html");return md(o)?o:null}return r}let s=_x(r,"index.html");return md(s)?s:null}function ek(e,t){let n=QP(e),r=sq((s,o)=>{let i=new URL(s.url??"/","http://localhost"),a=uq(n,decodeURIComponent(i.pathname));if(a){o.writeHead(200,{"Content-Type":cq.get(iq(a).toLowerCase())??"application/octet-stream"}),o.end(ZP(a));return}let l=_x(n,"404.html");if(md(l)){o.writeHead(404,{"Content-Type":"text/html; charset=utf-8"}),o.end(ZP(l));return}o.writeHead(404,{"Content-Type":"text/plain; charset=utf-8"}),o.end("Not found")});return r.listen(t),r}var cq;var tk=M(()=>{Cp();cq=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",...M$}))});function fq(e){let{corePath:t,fragments:n,fieldSchemaRefs:r=[]}=e;return{$comment:ok,$defs:{Fields:{$id:nl,anyOf:[{$ref:`${nk}#/$defs/JxFieldSchema`},{$ref:`${nk}#/$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 sc(e,t,n,r=[]){let s=structuredClone(e),o=new Map,i=new Set;Ox(s,i);let a=0,l=async(u)=>{let d=rc(u),p=o.get(d);if(p!==void 0)return p;let m;try{m=structuredClone(await t(d))}catch(x){throw Error(`bundleSchema: cannot load $ref target "${d}": ${xq(x)}`,{cause:x})}let g=_(m.$id)&&Hs(m.$id)?m.$id:null;a+=g===null?1:0;let b=g??`urn:jx:bundled:${a}`;if(o.set(d,b),i.has(b))return b;i.add(b),m.$id=b,await c(m,yq(d),!0);let h=s.$defs??={};return h[b]=m,b},c=async(u,d,p=!1)=>{if(Array.isArray(u)){for(let h of u)await c(h,d);return}if(!L(u))return;let m=u,g=d;if(!p&&_(m.$id)&&Hs(m.$id))g=null;let b=m.$ref;if(_(b)&&g!==null&&!b.startsWith("#")&&!Hs(b)){let h=b.indexOf("#"),x=h===-1?b:b.slice(0,h),k=h===-1?"":b.slice(h);if(x){let w=await l(`${g}/${x}`);m.$ref=`${w}${k}`}}for(let h of Object.values(m))await c(h,g)};await c(s,rc(n),!0);for(let u of r)await l(`${rc(n)}/${u}`);return s}function hq(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function*rk(e,t){for(let n of dq){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 pq){let r=e[n];if(!L(r))continue;for(let[s,o]of Object.entries(r))if(L(o))yield[o,`${t}/${n}/${hq(s)}`]}for(let n of mq){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 gq(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 oc(e){let t=structuredClone(e);if(L(t.$defs)){let o=new Set(Object.keys(t.$defs).filter((a)=>!Hs(a))),i={};for(let[a,l]of Object.entries(t.$defs)){let c=L(l)&&_(l.$id)?l.$id:a;i[Hs(a)?gq(c,o):a]=l}t.$defs=i}let n=new Map,r=(o,i)=>{let{$id:a}=o;if(_(a)&&Hs(a)&&!n.has(a))n.set(a,i);for(let[l,c]of rk(o,i))r(l,c)};r(t,"#");let s=(o,i)=>{let a=i,{$id:l}=o;if(_(l)&&Hs(l)){if(a=n.get(l)??i,a!=="#")delete o.$id}let c=o.$ref;if(_(c)){let u=c.indexOf("#"),d=u===-1?c:c.slice(0,u),p=u===-1?"":c.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 rk(o,a))s(u,a)};return s(t,"#"),t}function Ox(e,t){if(Array.isArray(e)){for(let r of e)Ox(r,t);return}if(!L(e))return;let n=e;if(_(n.$id)&&Hs(n.$id))t.add(n.$id);for(let r of Object.values(n))Ox(r,t)}function Hs(e){return/^[a-zA-Z][a-zA-Z\d+.-]*:/.test(e)}function rc(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 yq(e){let t=e.lastIndexOf("/");if(t===-1)return".";return t===0?"/":e.slice(0,t)}function xq(e){return e instanceof Error?e.message:String(e)}function bq(e){let{corePath:t,pathsValueRefs:n}=e;return{$comment:ok,$defs:{PathsValue:{$id:Oo,anyOf:[...rl,...n.map((r)=>({$ref:r}))]}},$schema:"https://json-schema.org/draft/2020-12/schema",allOf:[{$ref:t}]}}async function ik(e){let{baseDir:t,coreDocumentRef:n,coreProjectRef:r,extensions:s,loadJson:o}=e,i=[],a=[],l=[],c=[];for(let p of s){if(p.project)i.push(p.project);if(p.document){let m=await sk(p.document,o,t);if(a.push(...m),m.length>0)l.push(p.document)}if(p.fields)c.push(...await sk(p.fields,o,t)),i.push(p.fields)}let u=fq({corePath:r,fieldSchemaRefs:c,fragments:i}),d=bq({corePath:n,pathsValueRefs:a});return{document:oc(await sc(d,o,t,l)),project:oc(await sc(u,o,t))}}async function sk(e,t,n){let r;try{r=await t(rc(`${rc(n)}/${e}`))}catch{return[]}let{$id:s}=r;if(!_(s)||!r.$defs)return[];return Object.keys(r.$defs).map((o)=>`${s}#/$defs/${o}`)}var nk="https://jxsuite.com/schema/project/core/v2",ok="Generated by `jx schema` from project.json#/extensions — do not edit.",dq,pq,mq;var ak=M(()=>{sl();ae();sl();dq=["additionalItems","additionalProperties","contains","contentSchema","else","if","items","not","propertyNames","then","unevaluatedItems","unevaluatedProperties"],pq=["$defs","definitions","dependencies","dependentSchemas","patternProperties","properties"],mq=["allOf","anyOf","oneOf","prefixItems"]});import{existsSync as uk,readFileSync as $q,statSync as lk,writeFileSync as hd}from"node:fs";import{createRequire as Cx}from"node:module";import{dirname as Sq,isAbsolute as wq,relative as Rx,resolve as Ws,sep as Tx}from"node:path";async function fk(e){let{config:t}=as(e),n=await Rs(e,t),r=Ws(e),{document:s,project:o}=await ik({baseDir:r,coreDocumentRef:ck(e,Eq),coreProjectRef:ck(e,vq),extensions:n.extensions.map((i)=>({document:i.schemas.document&&Ax(e,i,i.schemas.document),fields:i.schemas.fields&&Ax(e,i,i.schemas.fields),project:i.schemas.project&&Ax(e,i,i.schemas.project)})),loadJson:mk(r)});return{documentSchema:s,projectSchema:o}}async function dk(e){let{documentSchema:t,projectSchema:n}=await fk(e),r=Ws(e,"project.schema.json"),s=Ws(e,"document.schema.json");return hd(r,`${JSON.stringify(n,null,2)}
620
+ `,"utf8"),hd(s,`${JSON.stringify(t,null,2)}
621
+ `,"utf8"),{documentSchemaPath:s,projectSchemaPath:r}}async function pk(e,t={}){let{write:n=!0}=t,r=Ws(e),s=Un(r),o=Ws(r,"project.schema.json"),i=Ws(r,"document.schema.json"),a=(b)=>{if(!uk(b))return!0;try{return lk(s).mtimeMs>lk(b).mtimeMs}catch{return!1}},c=a(o)||a(i)?await fk(r):null;if(c&&n)hd(o,`${JSON.stringify(c.projectSchema,null,2)}
622
+ `,"utf8"),hd(i,`${JSON.stringify(c.documentSchema,null,2)}
623
+ `,"utf8");let u=mk(r),d=c?.projectSchema??ic(o),p=c?.documentSchema??ic(i),m=oc(await sc(d,u,r));return{document:oc(await sc(p,u,r)),project:m}}function ic(e){let t=JSON.parse($q(e,"utf8"));if(!L(t))throw TypeError(`Schema file "${e}" is not a JSON object`);return t}function Pq(e){return e.startsWith(jq)&&e.endsWith(".json")}function kq(e,t){try{return Cx(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 mk(e){return async(t)=>{let n=Ws(t),r=Rx(e,n);if(r.startsWith("..")||wq(r))throw Error(`Schema ref "${t}" escapes the project root ${e}`);let s=r.split(Tx).join("/"),o="node_modules/",i=s.lastIndexOf(o),a=i===-1?null:s.slice(i+o.length);if(a!==null&&Pq(a))return ic(kq(a,t));if(uk(n))return ic(n);if(a===null)throw Error(`Schema ref "${t}" does not exist`);let l;try{l=xm(e,a)}catch(c){throw Error(`Schema ref "${t}" does not exist and "${a}" is not resolvable from the `+"project — is the package installed?",{cause:c})}return ic(l)}}function ck(e,t){let n=null;try{n=Cx(Ws(e,"package.json")).resolve(t)}catch{try{n=Cx(import.meta.url).resolve(t)}catch{n=null}}let r=`./node_modules/${t}`;return n?hk(e,n,r):r}function Ax(e,t,n){let r=Rx(Sq(t.manifestPath),n).split(Tx).join("/"),s=`./node_modules/${t.specifier}/${r}`;return hk(e,n,s)}function hk(e,t,n){let r=Rx(e,t).split(Tx).join("/");if(r.startsWith(".."))return n;return r.startsWith("./")?r:`./${r}`}var vq="@jxsuite/schema/schemas/project.core.schema.json",Eq="@jxsuite/schema/schema.json",jq="@jxsuite/schema/";var Nx=M(()=>{ak();ae();is();ji();ko()});var xk=B(function(zre,yk){var __dirname="/home/runner/work/jx/jx/node_modules/@webref/elements",gk=yt("fs").promises,gd=yt("path");async function _q({folder:e=__dirname}={}){let t={},n=await gk.readdir(e);for(let r of n)if(r.endsWith(".json")&&r!=="package.json"){let s=await gk.readFile(gd.join(e,r),"utf8");t[gd.basename(r,".json")]=JSON.parse(s)}return t}yk.exports={listAll:_q}});var wk=B(function(Kre,Sk){var __dirname="/home/runner/work/jx/jx/node_modules/@webref/css",Oq=yt("fs").promises,bk=yt("path");async function $k({folder:e=__dirname}={}){let t=await Oq.readFile(bk.join(e,"css.json"),"utf8");return JSON.parse(t)}async function Aq({folder:e=__dirname}={}){let t=await $k(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((l)=>l!==o&&l.name===o.name);if(a)i+=" for "+o.for[0];if(n[r][i]=o,o.descriptors){let l=o.descriptors;o.descriptors={};for(let c of l)o.descriptors[c.name]=c}}}return n}Sk.exports={listAll:$k,index:Aq}});var vk=B(function(yd,Jx){(function(e,t){typeof yd=="object"&&typeof Jx=="object"?Jx.exports=t():typeof define=="function"&&define.amd?define([],t):typeof yd=="object"?yd.WebIDL2=t():e.WebIDL2=t()})(globalThis,()=>(()=>{var e={d:(f,S)=>{for(var j in S)e.o(S,j)&&!e.o(f,j)&&Object.defineProperty(f,j,{enumerable:!0,get:S[j]})},o:(f,S)=>Object.prototype.hasOwnProperty.call(f,S),r:(f)=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(f,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(f,"__esModule",{value:!0})}},t={};function n(f,S,j,y,P,{level:R="error",autofix:N,ruleName:z}={}){function Q(Se){return Se>0?f.slice(S,S+Se):f.slice(Math.max(S+Se,0),S)}function ue(Se,{precedes:ot}={}){let On=Se.map((Ia)=>Ia.trivia+Ia.value).join(""),ws=f[S];return ws.type==="eof"?On:ot?On+ws.trivia:On.slice(ws.trivia.length)}let Y=f[S].type!=="eof"?f[S].line:f.length>1?f[S-1].line:1,ge=function(Se){let ot=Se.split(`
624
+ `);return ot[ot.length-1]}(ue(Q(-5),{precedes:!0})),ke=Q(5),ze=ue(ke),gt=ge+ze.split(`
622
625
  `)[0]+`
623
- `+(" ".repeat(ge.length)+"^"),Me=_==="Syntax"?"since":"inside",Pt=`${_} error at line ${ie}${f.name?` in ${f.name}`:""}${b&&b.name?`, ${Me} \`${b.partial?"partial ":""}${function(Dt){let $r=[Dt];for(;Dt&&Dt.parent;){let{parent:Yr}=Dt;$r.unshift(Yr),Dt=Yr}return $r.map((Yr)=>function(Ra,Na){let Nb=Ra;return Na&&(Nb+=` ${Na}`),Nb}(Yr.type,Yr.name)).join(" -> ")}(b)}\``:""}:
624
- ${In}`;return{message:`${Pt} ${v}`,bareMessage:v,context:Pt,line:ie,sourceName:f.name,level:M,ruleName:ae,autofix:K,input:ut,tokens:De}}function r(f,h,b,v){return n(f,h,b,v,"Syntax")}function s(f,h,b,v,_={}){return _.ruleName=b,n(h.source,f.index,h,v,"Validation",_)}e.r(t),e.d(t,{WebIDLParseError:()=>pe,parse:()=>pp,validate:()=>wc,write:()=>mp});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[v,_]of Object.entries(b))(_.enumerable||_.get)&&(f[v]=this[v]);h=Object.getPrototypeOf(h)}return f}}function i(f,h,{useNullableInner:b}={}){if(!f.union){let v=h.unique.get(f.idlType);if(!v)return;if(v.type==="typedef"){let{typedefIncludesDictionary:_}=h.cache;if(_.has(v))return _.get(v);h.cache.typedefIncludesDictionary.set(v,void 0);let M=i(v.idlType,h);if(h.cache.typedefIncludesDictionary.set(v,M),M)return{reference:f,dictionary:M.dictionary}}if(v.type==="dictionary"&&(b||!f.nullable))return{reference:f,dictionary:v}}for(let v of f.subtype){let _=i(v,h);if(_)return v.union?_:{reference:v,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((v)=>v.required);if(!b&&f.inheritance){let v=h.unique.get(f.inheritance);v?a(v,h)&&(b=!0):b=!0}return h.cache.dictionaryIncludesRequiredField.set(f,b),b}class l extends Array{constructor({source:f,tokens:h}){super(),Object.defineProperties(this,{source:{value:f},tokens:{value:h},parent:{value:null,writable:!0}})}}class c extends o{static parser(f,h){return()=>{let b=f.consumeKind(h);if(b)return new c({source:f.source,tokens:{value:b}})}}get value(){return O(this.tokens.value.value)}write(f){return f.ts.wrap([f.token(this.tokens.value),f.token(this.tokens.separator)])}}class u extends c{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:c.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 y(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 S extends o{static parse(f){let h={assign:f.consume("=")},b=z(new S({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?y(f):ue(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 g extends o{static parse(f){let h=f.consumeKind("identifier");if(h)return new g({source:f.source,tokens:{name:h},params:S.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?O(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 v=`\`[${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",v,{level:"warning",autofix:(b=this,()=>{let{name:_}=b;b.tokens.name.value=m.get(_),_==="TreatNullAs"&&(b.params.tokens={})})})}var b;for(let v of this.arguments)yield*v.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 x extends l{static parse(f){let h={};h.open=f.consume("[");let b=new x({source:f.source,tokens:h});return h.open?(b.push(...N(f,{parser:g.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 P(f,h){let b=f.consume("?");b&&(h.tokens.nullable=b),f.probe("?")&&f.error("Can't nullable more than once")}function w(f,h){let b=function(v,_){let M=v.consume("FrozenArray","ObservableArray","Promise","async_sequence","sequence","record");if(!M)return;let K=z(new E({source:v.source,tokens:{base:M}}));switch(K.tokens.open=v.consume("<")||v.error(`No opening bracket after ${M.value}`),M.value){case"Promise":{v.probe("[")&&v.error("Promise type cannot have extended attribute");let ae=fe(v,_)||v.error("Missing Promise subtype");K.subtype.push(ae);break}case"async_sequence":case"sequence":case"FrozenArray":case"ObservableArray":{let ae=ne(v,_)||v.error(`Missing ${M.value} subtype`);K.subtype.push(ae);break}case"record":{v.probe("[")&&v.error("Record key cannot have extended attribute");let ae=v.consume(...Ye)||v.error(`Record key must be one of: ${Ye.join(", ")}`),U=new E({source:v.source,tokens:{base:ae}});U.tokens.separator=v.consume(",")||v.error("Missing comma after record key type"),U.type=_;let oe=ne(v,_)||v.error("Error parsing generic type record");K.subtype.push(U,oe);break}}return K.idlType||v.error(`Error parsing generic type ${M.value}`),K.tokens.close=v.consume(">")||v.error(`Missing closing bracket after ${M.value}`),K.this}(f,h)||re(f);if(!b){let v=f.consumeKind("identifier")||f.consume(...Ye,...qe);if(!v)return;b=new E({source:f.source,tokens:{base:v}}),f.probe("<")&&f.error(`Unsupported generic type ${v.value}`)}return b.generic==="Promise"&&f.probe("?")&&f.error("Promise type cannot be nullable"),b.type=h||null,P(f,b),b.nullable&&b.idlType==="any"&&f.error("Type `any` cannot be made nullable"),b}class E extends o{static parse(f,h){return w(f,h)||function(b,v){let _={};if(_.open=b.consume("("),!_.open)return;let M=z(new E({source:b.source,tokens:_}));for(M.type=v||null;;){let K=ne(b,v)||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"),M.subtype.push(K);let ae=b.consume("or");if(!ae)break;K.tokens.separator=ae}return M.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"),P(b,M),M.this}(f,h)}constructor({source:f,tokens:h}){super({source:f,tokens:h}),Object.defineProperty(this,"subtype",{value:[],writable:!0}),this.extAttrs=new x({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 O([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 M of _){if(M.name!=="AllowShared")continue;let K="`[AllowShared] BufferSource` is now replaced with AllowSharedBufferSource.";yield s(this.tokens.base,this,"migrate-allowshared",K,{autofix:j(this,M,_)})}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),v=this.union?this:b&&b.type==="typedef"?b.idlType:void 0;if(v&&this.nullable){let{reference:_}=i(v,f)||{};if(_){let M=(this.union?_:this).tokens.base;yield s(M,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)]:[],v=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),v])})(),f.token(this.tokens.nullable),f.token(this.tokens.separator)])}}function j(f,h,b){return()=>{let v=b.indexOf(h);b.splice(v,1),!b.length&&f.tokens.base.trivia.match(/^\s$/)&&(f.tokens.base.trivia=""),f.tokens.base.value="AllowSharedBufferSource"}}class A extends o{static parse(f){let h=f.consume("=");if(!h)return null;let b=G(f)||f.consumeKind("string")||f.consume("null","[","{")||f.error("No value for default"),v=[b];if(b.value==="["){let _=f.consume("]")||f.error("Default sequence value must be empty");v.push(_)}else if(b.value==="{"){let _=f.consume("}")||f.error("Default dictionary value must be empty");v.push(_)}return new A({source:f.source,tokens:{assign:h},expression:v})}constructor({source:f,tokens:h,expression:b}){super({source:f,tokens:h}),b.parent=this,Object.defineProperty(this,"expression",{value:b})}get type(){return Q(this.expression[0]).type}get value(){return Q(this.expression[0]).value}get negative(){return Q(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={},v=z(new T({source:f.source,tokens:b}));return v.extAttrs=x.parse(f),b.optional=f.consume("optional"),v.idlType=ne(f,"argument-type"),v.idlType?(b.optional||(b.variadic=f.consume("...")),b.name=f.consumeKind("identifier")||f.consume(...te),b.name?(v.default=b.optional?A.parse(f):null,v.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 O(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:I(this)})}else if(this.parent&&!a(h.dictionary,f)&&function(v){let _=v.parent.arguments||v.parent.list,M=_.indexOf(v);return!_.slice(M+1).some((ae)=>!ae.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 _=q(b.idlType);b.tokens.optional={..._,type:"optional",value:"optional"},_.trivia=" ",I(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 I(f){return()=>{f.default=A.parse(new bt(" = {}"))}}class V extends o{static parse(f,{special:h,regular:b}={}){let v={special:h},_=z(new V({source:f.source,tokens:v}));return h&&h.value==="stringifier"&&(v.termination=f.consume(";"),v.termination)?(_.arguments=[],_):(h||b||(v.special=f.consume("getter","setter","deleter")),_.idlType=fe(f)||f.error("Missing return type"),v.name=f.consumeKind("identifier")||f.consume("includes"),v.open=f.consume("(")||f.error("Invalid operation"),_.arguments=ue(f),v.close=f.consume(")")||f.error("Unterminated operation"),v.termination=f.consume(";")||f.error("Unterminated operation, expected `;`"),_.this)}get type(){return"operation"}get name(){let{name:f}=this.tokens;return f?O(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((v)=>v.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:v=!1}={}){let _=f.position,M={special:h},K=z(new H({source:f.source,tokens:M}));if(h||b||(M.special=f.consume("inherit")),K.special==="inherit"&&f.probe("readonly")&&f.error("Inherited attributes cannot be read-only"),M.readonly=f.consume("readonly"),v&&!M.readonly&&f.probe("attribute")&&f.error("Attributes must be readonly in this context"),M.base=f.consume("attribute"),M.base)return K.idlType=ne(f,"attribute-type")||f.error("Attribute lacks a type"),M.name=f.consumeKind("identifier")||f.consume("async","required")||f.error("Attribute lacks a name"),M.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 O(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 v=b.unique.get(h.idlType);return v?.type==="typedef"&&v.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 O(f){return f.startsWith("_")?f.slice(1):f}function N(f,{parser:h,allowDangler:b,listName:v="list"}){let _=h(f);if(!_)return[];_.tokens.separator=f.consume(",");let M=[_];for(;_.tokens.separator;){let K=h(f);if(!K){b||f.error(`Trailing comma in ${v}`);break}if(K.tokens.separator=f.consume(","),M.push(K),!K.tokens.separator)break}return M}function G(f){return f.consumeKind("decimal","integer")||f.consume("true","false","Infinity","-Infinity","NaN")}function Q({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 re(f){let{source:h}=f,b=function(){let _=f.consume("unsigned"),M=f.consume("short","long");if(M){let K=f.consume("long");return new E({source:h,tokens:{prefix:_,base:M,postfix:K}})}_&&f.error("Failed to parse integer type")}()||function(){let _=f.consume("unrestricted"),M=f.consume("float","double");if(M)return new E({source:h,tokens:{prefix:_,base:M}});_&&f.error("Failed to parse float type")}();if(b)return b;let v=f.consume("bigint","boolean","byte","octet","undefined");return v?new E({source:h,tokens:{base:v}}):void 0}function ue(f){return N(f,{parser:T.parse,listName:"arguments list"})}function ne(f,h){let b=x.parse(f),v=E.parse(f,h);return v&&(z(v).extAttrs=b),v}function fe(f,h){let b=E.parse(f,h||"return-type");if(b)return b;let v=f.consume("void");if(v){let _=new E({source:f.source,tokens:{base:v}});return _.type="return-type",_}}function xe(f){let h=f.consume("stringifier");if(!h)return;return H.parse(f,{special:h})||V.parse(f,{special:h})||f.error("Unterminated stringifier")}function X(f){let h=f.split(`
625
- `);if(h.length){let b=h[h.length-1].match(/^\s+/);if(b)return b[0]}return""}function B(f){return()=>{if(f.extAttrs.length){let h=new bt("Exposed=Window,"),b=g.parse(h);b.tokens.separator=h.consume(",");let v=f.extAttrs[0];/^\s/.test(v.tokens.name.trivia)||(v.tokens.name.trivia=` ${v.tokens.name.trivia}`),f.extAttrs.unshift(b)}else{z(f).extAttrs=x.parse(new bt("[Exposed=Window]"));let h=f.tokens.base.trivia;f.extAttrs.tokens.open.trivia=h,f.tokens.base.trivia=`
626
- ${X(h)}`}}}function q(f){if(f.extAttrs.length)return f.extAttrs.tokens.open;if(f.type==="operation"&&!f.special)return q(f.idlType);return Object.values(f.tokens).sort((h,b)=>h.index-b.index)[0]}function z(f,h){if(h||(h=f),!f)return f;return new Proxy(f,{get(b,v){let _=b[v];return Array.isArray(_)&&v!=="source"?z(_,b):_},set(b,v,_){if(b[v]=_,!_)return!0;if(Array.isArray(_))for(let M of _)M.parent!==void 0&&(M.parent=h);else _.parent!==void 0&&(_.parent=h);return!0}})}let We={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},qe=["ArrayBuffer","SharedArrayBuffer","DataView","Int8Array","Int16Array","Int32Array","Uint8Array","Uint16Array","Uint32Array","Uint8ClampedArray","BigInt64Array","BigUint64Array","Float16Array","Float32Array","Float64Array","any","object","symbol"],Ye=["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"],Ut=["-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,Ye,qe),Je=["(",")",",","...",":",";","<","=",">","?","*","[","]","{","}"],jt=["_constructor","toString","_toString"];class bt{constructor(f){this.source=function(h){let b=[],v=0,_="",M=1,K=0;for(;v<h.length;){let U=h.charAt(v),oe=-1;if(/[\t\n\r ]/.test(U)?oe=ae("whitespace",{noFlushTrivia:!0}):U==="/"&&(oe=ae("comment",{noFlushTrivia:!0})),oe!==-1){let ie=b.pop().value;M+=(ie.match(/\n/g)||[]).length,_+=ie,K-=1}else if(/[-0-9.A-Z_a-z]/.test(U)){if(oe=ae("decimal"),oe===-1&&(oe=ae("integer")),oe===-1){oe=ae("identifier");let ie=b.length-1,ge=b[ie];if(oe!==-1){if(jt.includes(ge.value)){let De=`${O(ge.value)} is a reserved identifier and must not be used.`;throw new pe(r(b,ie,null,De))}Ut.includes(ge.value)&&(ge.type="inline")}}}else U==='"'&&(oe=ae("string"));for(let ie of Je)if(h.startsWith(ie,v)){b.push({type:"inline",value:ie,trivia:_,line:M,index:K}),_="",v+=ie.length,oe=v;break}if(oe===-1&&(oe=ae("other")),oe===-1)throw Error("Token stream not progressing");v=oe,K+=1}return b.push({type:"eof",value:"",trivia:_,line:M,index:K}),b;function ae(U,{noFlushTrivia:oe}={}){let ie=We[U];ie.lastIndex=v;let ge=ie.exec(h);return ge?(b.push({type:U,value:ge[0],trivia:_,line:M,index:K}),oe||(_=""),ie.lastIndex):-1}}(f),this.position=0}error(f){throw new pe(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 pe extends Error{constructor({message:f,bareMessage:h,context:b,line:v,sourceName:_,input:M,tokens:K}){super(f),this.name="WebIDLParseError",this.bareMessage=h,this.context=b,this.line=v,this.sourceName=_,this.input=M,this.tokens=K}}class ct extends c{static parse(f){let h=f.consumeKind("string");if(h)return new ct({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 Se 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=z(new Se({source:f.source,tokens:h}));return f.current=b.this,h.open=f.consume("{")||f.error("Bodyless enum"),b.values=N(f,{parser:ct.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 O(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 Ze 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 Ze({source:f.source,tokens:b});f.unconsume(h.index)}get type(){return"includes"}get target(){return O(this.tokens.target.value)}get includes(){return O(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 Nt extends o{static parse(f){let h={},b=z(new Nt({source:f.source,tokens:h}));if(h.base=f.consume("typedef"),h.base)return b.idlType=ne(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 O(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 co extends o{static parse(f,h){let b={base:h},v=z(new co({source:f.source,tokens:b}));return b.name=f.consumeKind("identifier")||f.error("Callback lacks a name"),f.current=v.this,b.assign=f.consume("=")||f.error("Callback lacks an assignment"),v.idlType=fe(f)||f.error("Callback lacks a return type"),b.open=f.consume("(")||f.error("Callback lacks parentheses for arguments"),v.arguments=ue(f),b.close=f.consume(")")||f.error("Unterminated callback"),b.termination=f.consume(";")||f.error("Unterminated callback, expected `;`"),v.this}get type(){return"callback"}get name(){return O(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 $t extends o{static parse(f,h,{inheritable:b,allowedMembers:v}){let{tokens:_,type:M}=h;for(_.name=f.consumeKind("identifier")||f.error(`Missing name in ${M}`),f.current=h,h=z(h),b&&Object.assign(_,function(K){let ae=K.consume(":");return ae?{colon:ae,inheritance:K.consumeKind("identifier")||K.error("Inheritance lacks a type")}:{}}(f)),_.open=f.consume("{")||f.error(`Bodyless ${M}`),h.members=[];;){if(_.close=f.consume("}"),_.close)return _.termination=f.consume(";")||f.error(`Missing semicolon after ${M}`),h.this;let K=x.parse(f),ae;for(let[U,...oe]of v)if(ae=z(U(f,...oe)),ae)break;ae||f.error("Unknown member"),ae.extAttrs=K,h.members.push(ae.this)}}get partial(){return!!this.tokens.partial}get name(){return O(this.tokens.name.value)}get inheritance(){return this.tokens.inheritance?O(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 tr extends o{static parse(f){let h={};if(h.base=f.consume("const"),!h.base)return;let b=re(f);if(!b){let _=f.consumeKind("identifier")||f.error("Const lacks a type");b=new E({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=G(f)||f.error("Const lacks a value"),h.termination=f.consume(";")||f.error("Unterminated const, expected `;`");let v=new tr({source:f.source,tokens:h});return z(v).idlType=b,v}get type(){return"const"}get name(){return O(this.tokens.name.value)}get value(){return Q(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 tn extends o{static parse(f){let h=f.position,b=z(new tn({source:f.source,tokens:{}})),{tokens:v}=b;if(v.readonly=f.consume("readonly"),v.readonly||(v.async=f.consume("async")),v.base=v.readonly?f.consume("maplike","setlike"):v.async?f.consume("iterable"):f.consume("iterable","async_iterable","maplike","setlike"),!v.base)return void f.unconsume(h);let{type:_}=b,M=_==="maplike",K=M||_==="iterable"||_==="async_iterable",ae=_==="async_iterable"||b.async&&_==="iterable";v.open=f.consume("<")||f.error(`Missing less-than sign \`<\` in ${_} declaration`);let U=ne(f)||f.error(`Missing a type argument in ${_} declaration`);return b.idlType=[U],b.arguments=[],K&&(U.tokens.separator=f.consume(","),U.tokens.separator?b.idlType.push(ne(f)):M&&f.error(`Missing second type argument in ${_} declaration`)),v.close=f.consume(">")||f.error(`Missing greater-than sign \`>\` in ${_} declaration`),f.probe("(")&&(ae?(v.argsOpen=f.consume("("),b.arguments.push(...ue(f)),v.argsClose=f.consume(")")||f.error("Unterminated async iterable argument list")):f.error("Arguments are only allowed for `async iterable`")),v.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 v=h.tokens.async;h.tokens.base={...v,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 Xr 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 v=ue(f);b.close=f.consume(")")||f.error("Unterminated constructor"),b.termination=f.consume(";")||f.error("No semicolon after constructor");let _=new Xr({source:f.source,tokens:b});return z(_).arguments=v,_}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 Mn(f){let h=f.consume("static");if(!h)return;return H.parse(f,{special:h})||V.parse(f,{special:h})||f.error("No body in static member")}class Ca extends $t{static parse(f,h,{extMembers:b=[],partial:v=null}={}){let _={partial:v,base:h};return $t.parse(f,new Ca({source:f.source,tokens:_}),{inheritable:!v,allowedMembers:[...b,[tr.parse],[Xr.parse],[Mn],[xe],[tn.parse],[H.parse],[V.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:B(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:dp(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 v=this.members.filter((_)=>_.type==="constructor");for(let _ of v)yield s(_.tokens.base,this,"no-constructible-global","Interfaces marked as `[Global]` cannot have constructors.")}yield*super.validate(f),this.partial||(yield*function*(b,v){let _=function(oe){let ie=U(oe);return{statics:new Set(ie.filter((ge)=>ge.special==="static").map((ge)=>ge.name)),nonstatics:new Set(ie.filter((ge)=>ge.special!=="static").map((ge)=>ge.name))}}(v),M=b.partials.get(v.name)||[],K=b.mixinMap.get(v.name)||[];for(let oe of[...M,...K]){let ie=U(oe),ge=ie.filter((ut)=>ut.special==="static"),De=ie.filter((ut)=>ut.special!=="static");yield*ae(ge,_.statics,oe,v),yield*ae(De,_.nonstatics,oe,v),ge.forEach((ut)=>_.statics.add(ut.name)),De.forEach((ut)=>_.nonstatics.add(ut.name))}function*ae(oe,ie,ge,De){for(let ut of oe){let{name:In}=ut;if(In&&ie.has(In)){let Me=`The ${ut.special==="static"?"static ":""}operation "${In}" has already been defined for the base interface "${De.name}" either in itself or in a mixin`;yield s(ut.tokens.name,ge,"no-cross-overload",Me)}}}function U(oe){return oe.members.filter(({type:ie})=>ie==="operation")}}(f,this))}}function dp(f,h){return f=z(f),()=>{let b=X(f.extAttrs.tokens.open.trivia),v=f.members.length?X(q(f.members[0]).trivia):function(ie){let ge=X(ie),De=ge.includes("\t")?"\t":" ";return ge+De}(b),_=Xr.parse(new bt(`
627
- ${v}constructor();`));_.extAttrs=new x({source:f.source,tokens:{}}),z(_).arguments=h.arguments;let M=function(ie,ge){let De=ie.slice().reverse().findIndex(ge);return De===-1?De:ie.length-De-1}(f.members,(ie)=>ie.type==="constructor");f.members.splice(M+1,0,_);let{close:K}=f.tokens;K.trivia.includes(`
628
- `)||(K.trivia+=`
629
- ${b}`);let{extAttrs:ae}=f,U=ae.indexOf(h),oe=ae.splice(U,1);ae.length?ae.length===U?ae[U-1].tokens.separator=void 0:ae[U].tokens.name.trivia.trim()||(ae[U].tokens.name.trivia=oe[0].tokens.name.trivia):ae.tokens.open=ae.tokens.close=void 0}}class xr extends $t{static parse(f,h,{extMembers:b=[],partial:v}={}){let _={partial:v,base:h};if(_.mixin=f.consume("mixin"),_.mixin)return $t.parse(f,new xr({source:f.source,tokens:_}),{allowedMembers:[...b,[tr.parse],[xe],[H.parse,{noInherit:!0}],[V.parse,{regular:!0}]]})}get type(){return"interface mixin"}}class br extends o{static parse(f){let h={},b=z(new br({source:f.source,tokens:h}));return b.extAttrs=x.parse(f),h.required=f.consume("required"),b.idlType=ne(f,"dictionary-type")||f.error("Dictionary member lacks a type"),h.name=f.consumeKind("identifier")||f.error("Dictionary member lacks a name"),b.default=A.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 O(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 nr extends $t{static parse(f,{extMembers:h=[],partial:b}={}){let v={partial:b};if(v.base=f.consume("dictionary"),v.base)return $t.parse(f,new nr({source:f.source,tokens:v}),{inheritable:!b,allowedMembers:[...h,[br.parse]]})}get type(){return"dictionary"}}class bs extends $t{static parse(f,{extMembers:h=[],partial:b}={}){let v={partial:b};if(v.base=f.consume("namespace"),v.base)return $t.parse(f,new bs({source:f.source,tokens:v}),{allowedMembers:[...h,[H.parse,{noInherit:!0,readonly:!0}],[tr.parse],[V.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:B(this)});yield*super.validate(f)}}class uo extends $t{static parse(f,h,{extMembers:b=[]}={}){let v={callback:h};if(v.base=f.consume("interface"),v.base)return $t.parse(f,new uo({source:f.source,tokens:v}),{allowedMembers:[...b,[tr.parse],[V.parse,{regular:!0}]]})}get type(){return"callback interface"}}function bc(f,h){let b=f.source;function v(U){f.error(U)}function _(...U){return f.consume(...U)}function M(U){let oe=_("interface");if(oe)return xr.parse(f,oe,{...U,...h?.extensions?.mixin})||Ca.parse(f,oe,{...U,...h?.extensions?.interface})||v("Interface has no proper body")}function K(){if(h.productions)for(let U of h.productions){let oe=U(f);if(oe)return oe}return function(){let U=_("callback");if(U)return f.probe("interface")?uo.parse(f,U,{...h?.extensions?.callbackInterface}):co.parse(f,U)}()||M()||function(){let U=_("partial");if(U)return nr.parse(f,{partial:U,...h?.extensions?.dictionary})||M({partial:U})||bs.parse(f,{partial:U,...h?.extensions?.namespace})||v("Partial doesn't apply to anything")}()||nr.parse(f,h?.extensions?.dictionary)||Se.parse(f)||Nt.parse(f)||Ze.parse(f)||bs.parse(f,h?.extensions?.namespace)}let ae=function(){if(!b.length)return[];let U=[];for(;;){let ie=x.parse(f),ge=K();if(!ge){ie.length&&v("Stray extended attributes");break}z(ge).extAttrs=ie,U.push(ge)}let oe=u.parse(f);return h.concrete&&U.push(oe),U}();return f.position<b.length&&v("Unrecognised tokens"),ae}function pp(f,h={}){let b=new bt(f);return h.sourceName!==void 0&&(b.source.name=h.sourceName),bc(b,h)}function un(f){return f}let Xo={wrap:(f)=>f.join(""),trivia:un,name:un,reference:un,type:un,generic:un,nameless:un,inheritance:un,definition:un,extendedAttribute:un,extendedAttributeReference:un};class $c{constructor(f){this.ts=Object.assign({},Xo,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=un,...b){if(!f)return"";let v=h(f.value,...b);return this.ts.wrap([this.ts.trivia(f.trivia),v])}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 mp(f,{templates:h=Xo}={}){h=Object.assign({},Xo,h);let b=new $c(h);return h.wrap(f.map((v)=>v.write(b)))}function fo(f,h){let b=new Map,v=f.filter((_)=>_.type==="includes");for(let _ of v){let M=h.get(_.includes);if(!M)continue;let K=b.get(_.target);K?K.push(M):b.set(_.target,[M])}return b}function*Sc(f){let h=function(b){let v=new Map,_=new Set,M=new Map;for(let K of b)if(K.partial){let ae=M.get(K.name);ae?ae.push(K):M.set(K.name,[K])}else K.name&&(v.has(K.name)?_.add(K):v.set(K.name,K));return{all:b,unique:v,partials:M,duplicates:_,mixinMap:fo(b,v),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:v}){for(let _ of v){let{name:M}=_,K=`The name "${M}" of type "${b.get(M).type}" was already seen`;yield s(_.tokens.name,_,"no-duplicate",K)}}(h)}function wc(f){return[...Sc((h=f,h.flat?h.flat():[].concat(...h)))];var h}return t})())});var ZP=W(function(kne,YP){var __dirname="/home/runner/work/jx/jx/node_modules/@webref/idl",zP=pt("fs").promises,ad=pt("path"),KP=UP();class GP{constructor(e,t){this.filename=t,this.shortname=ad.basename(t,".idl"),this.path=ad.join(e,t)}async text(){return await zP.readFile(this.path,"utf8")}async parse(){let e=await this.text();return KP.parse(e)}}async function XP({folder:e=__dirname}={}){let t={},n=await zP.readdir(e);for(let r of n)if(r.endsWith(".idl")){let s=new GP(e,r);t[s.shortname]=s}return t}async function MV(e){let t=await XP(e);for(let[n,r]of Object.entries(t))t[n]=await r.parse();return t}YP.exports={listAll:XP,parseAll:MV}});function IV(){return QP??=DV(),QP}async function DV(){let[e,t,n]=await Promise.all([t_.listAll(),n_.default.listAll(),r_.default.parseAll()]),r=new Set;for(let{elements:c}of Object.values(e))for(let u of c)if(!u.obsolete)r.add(u.name);let s=[...r].toSorted(),o=new Set;for(let c of t.properties)for(let u of c.styleDeclaration??[])o.add(u);let i=[...o].toSorted(),a=new Set;for(let c of Object.values(n))for(let u of c){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 l=[...a].toSorted();return{cssProps:i,eventHandlers:l,tagExamples:s}}function LV(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 FV(e){let t={...yl.properties};for(let n of e)t[n]={oneOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/RefObject"}]};return t}async function VV(){let{tagExamples:e,cssProps:t,eventHandlers:n}=await IV();return{$defs:{DefsMap:Pg,TypeDefEntry:_g,StateMap:jg,StateEntry:Eg,TypedStateDef:Kh,PureTypeDef:sg,FunctionDef:Xh,ClassDef:Og,ClassParameterDef:zu,ClassFieldDef:Ku,ClassConstructorDef:Gu,ClassMethodDef:Xu,FormatDef:Yu,ProjectBlockDef:Zu,ServerBlockDef:Qu,ConnectorBlockDef:ef,StudioHints:tf,ExternalClassDef:ng,ExpressionPointer:ig,ExpressionLiteral:ag,ExpressionOperand:lg,UnaryOperator:cg,BinaryOperator:ug,ConditionalOperator:fg,SwitchOperator:dg,CallOperator:pg,PureMethod:mg,AssignmentOperator:hg,NoArgMethod:gg,OneArgMethod:yg,SpliceMethod:xg,ReduceMethod:bg,MapFilterMethod:$g,ExpressionNode:Sg,ExpressionEntry:wg,Statement:Zh,StatementList:Qh,ElementDef:{...Uu,properties:{...Uu.properties,...LV(n)}},ChildrenValue:Fh,ArrayNamespace:Lh,SwitchDef:Bh,SwitchNode:Uh,StyleObject:{...yl,properties:FV(t)},AttributesObject:qh,PropsObject:Hh,RefObject:Jh,AnyRef:Th,InternalRef:kh,StateRef:Oh,ExternalRef:Ah,ExternalComponentRef:Mh,GlobalRef:Ch,ParentRef:Rh,MapRef:Nh,ElementPropertyValue:Wh,StringOrRef:gh,BoolOrRef:yh,NumberOrRef:xh,CemParameter:wh,CemEvent:vh,TagName:{...mh,examples:[...e,"my-counter","todo-app","user-card"]},TagExpression:fh,ElementTagName:dh,JsonSchemaType:Ph,HeadEntry:$h,ImageConfig:gl,PathsValue:{$id:Io,anyOf:[...bl,Mg],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:Io,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"},formAssociated:{description:"Makes the custom element a form-associated one (the Web Components formAssociated static): it attaches ElementInternals, a form's reset and a disabled fieldset reach its `value`, `checked` and `disabled` state, `required` with an empty value is reported as a missing value, and a label naming it reaches its control.",type:"boolean"},formValue:{description:"The value a form-associated custom element submits under its `name`, through ElementInternals.setFormValue: a `$ref`, a `${}` template or a literal. Omit it when a named native control inside the element already submits the value."},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 qV(){return{$defs:{ImageConfig:gl,StyleObject:s_},$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:nf.properties,title:"Jx Project",type:"object"}}function HV(){return{$defs:{ImageConfig:gl,JxFieldSchema:Tg,RelationshipRef:Jg,StyleObject:s_},$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:nf.properties,title:"Jx Project Core",type:"object"}}function WV(){return{$id:xl,$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 BV(){return{$id:Io,$schema:"https://json-schema.org/draft/2020-12/schema",anyOf:[...bl,Mg],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 UV(){return{$id:"https://jxsuite.com/schema/extension-manifest/v1",$schema:"https://json-schema.org/draft/2020-12/schema",title:"Jx Extension Manifest",...Rg}}function yx(){return{$defs:{ClassConstructorDef:Gu,ClassFieldDef:Ku,ClassMethodDef:Xu,ClassParameterDef:zu,ConnectorBlockDef:ef,FormatDef:Yu,ProjectBlockDef:Zu,ServerBlockDef:Qu,StudioHints:tf},$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 zV(e){let{mkdirSync:t,writeFileSync:n}=await import("node:fs"),{resolve:r,dirname:s}=await import("node:path"),o=s(r(e,"..")),i=await VV(),a=qV(),l=yx(),c=HV(),u=UV(),d=WV(),p=BV(),m=JSON.stringify(i,null,2),y=JSON.stringify(a,null,2),S=JSON.stringify(l,null,2),g=JSON.stringify(c,null,2),x=JSON.stringify(u,null,2),P=JSON.stringify(d,null,2),w=JSON.stringify(p,null,2),[E]=process.argv.slice(2);if(E)n(E,m,"utf8"),console.error(`Jx component schema written to ${E}`);else{n(r(o,"schema.json"),m,"utf8"),n(r(o,"project-schema.json"),y,"utf8"),n(r(o,"class-schema.json"),S,"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"),P,"utf8"),n(r(o,"schemas","document.paths.schema.json"),w,"utf8"),n(r(o,"extension-manifest.schema.json"),x,"utf8");let j=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(j.exitCode!==0){let A=j.stderr.toString()||j.stdout.toString()||`exit ${j.exitCode}${j.signalCode?`, signal ${j.signalCode}`:""}`;console.error(`Warning: skipped oxfmt reformat of generated schemas (${A})`)}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 t_,n_,r_,QP=null,s_,e_,Yne;var o_=J(()=>{ph();hh();bh();Sh();Eh();_h();Ih();Dh();Vh();zh();Gh();Yh();eg();rg();og();vg();kg();Ag();Ng();$l();jh();Cg();t_=Sr(VP(),1),n_=Sr(BP(),1),r_=Sr(ZP(),1);s_={...yl,additionalProperties:{anyOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/StyleObject"}]}};[,e_]=process.argv,Yne=e_?.endsWith("schema.ts")?zV(e_):void 0});var sc=W(function(l_){Object.defineProperty(l_,"__esModule",{value:!0});l_.regexpCode=l_.getEsmExportName=l_.getProperty=l_.safeStringify=l_.stringify=l_.strConcat=l_.addCodeArg=l_.str=l_._=l_.nil=l_._Code=l_.Name=l_.IDENTIFIER=l_._CodeOrName=void 0;class ld{}l_._CodeOrName=ld;l_.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class na extends ld{constructor(e){super();if(!l_.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}}}l_.Name=na;class yr extends ld{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 na)t[n.str]=(t[n.str]||0)+1;return t},{})}}l_._Code=yr;l_.nil=new yr("");function i_(e,...t){let n=[e[0]],r=0;while(r<t.length)bx(n,t[r]),n.push(e[++r]);return new yr(n)}l_._=i_;var xx=new yr("+");function a_(e,...t){let n=[rc(e[0])],r=0;while(r<t.length)n.push(xx),bx(n,t[r]),n.push(xx,rc(e[++r]));return KV(n),new yr(n)}l_.str=a_;function bx(e,t){if(t instanceof yr)e.push(...t._items);else if(t instanceof na)e.push(t);else e.push(YV(t))}l_.addCodeArg=bx;function KV(e){let t=1;while(t<e.length-1){if(e[t]===xx){let n=GV(e[t-1],e[t+1]);if(n!==void 0){e.splice(t-1,3,n);continue}e[t++]="+"}t++}}function GV(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string"){if(t instanceof na||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 na))return`"${e}${t.slice(1)}`;return}function XV(e,t){return t.emptyStr()?e:e.emptyStr()?t:a_`${e}${t}`}l_.strConcat=XV;function YV(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:rc(Array.isArray(e)?e.join(","):e)}function ZV(e){return new yr(rc(e))}l_.stringify=ZV;function rc(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}l_.safeStringify=rc;function QV(e){return typeof e=="string"&&l_.IDENTIFIER.test(e)?new yr(`.${e}`):i_`[${e}]`}l_.getProperty=QV;function eq(e){if(typeof e=="string"&&l_.IDENTIFIER.test(e))return new yr(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}l_.getEsmExportName=eq;function tq(e){return new yr(e.toString())}l_.regexpCode=tq});var vx=W(function(d_){Object.defineProperty(d_,"__esModule",{value:!0});d_.ValueScope=d_.ValueScopeName=d_.Scope=d_.varKinds=d_.UsedValueState=void 0;var ze=sc();class u_ extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var ud;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(ud||(d_.UsedValueState=ud={}));d_.varKinds={const:new ze.Name("const"),let:new ze.Name("let"),var:new ze.Name("var")};class Sx{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof ze.Name?e:this.name(e)}name(e){return new ze.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}}}d_.Scope=Sx;class wx extends ze.Name{constructor(e,t){super(t);this.prefix=e}setValue(e,{property:t,itemIndex:n}){this.value=e,this.scopePath=ze._`.${new ze.Name(t)}[${n}]`}}d_.ValueScopeName=wx;var mq=ze._`\n`;class f_ extends Sx{constructor(e){super(e);this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?mq:ze.nil}}get(){return this._scope}name(e){return new wx(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 c=i.get(o);if(c)return c}else i=this._values[s]=new Map;i.set(o,r);let a=this._scope[s]||(this._scope[s]=[]),l=a.length;return a[l]=t.ref,r.setValue(t,{property:s,itemIndex:l}),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 ze._`${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=ze.nil;for(let o in e){let i=e[o];if(!i)continue;let a=n[o]=n[o]||new Map;i.forEach((l)=>{if(a.has(l))return;a.set(l,ud.Started);let c=t(l);if(c){let u=this.opts.es5?d_.varKinds.var:d_.varKinds.const;s=ze._`${s}${u} ${l} = ${c};${this.opts._n}`}else if(c=r===null||r===void 0?void 0:r(l))s=ze._`${s}${c}${this.opts._n}`;else throw new u_(l);a.set(l,ud.Completed)})}return s}}d_.ValueScope=f_});var $e=W(function(bn){Object.defineProperty(bn,"__esModule",{value:!0});bn.or=bn.and=bn.not=bn.CodeGen=bn.operators=bn.varKinds=bn.ValueScopeName=bn.ValueScope=bn.Scope=bn.Name=bn.regexpCode=bn.stringify=bn.getProperty=bn.nil=bn.strConcat=bn.str=bn._=void 0;var Z=sc(),mt=vx(),qs=sc();Object.defineProperty(bn,"_",{enumerable:!0,get:function(){return qs._}});Object.defineProperty(bn,"str",{enumerable:!0,get:function(){return qs.str}});Object.defineProperty(bn,"strConcat",{enumerable:!0,get:function(){return qs.strConcat}});Object.defineProperty(bn,"nil",{enumerable:!0,get:function(){return qs.nil}});Object.defineProperty(bn,"getProperty",{enumerable:!0,get:function(){return qs.getProperty}});Object.defineProperty(bn,"stringify",{enumerable:!0,get:function(){return qs.stringify}});Object.defineProperty(bn,"regexpCode",{enumerable:!0,get:function(){return qs.regexpCode}});Object.defineProperty(bn,"Name",{enumerable:!0,get:function(){return qs.Name}});var gd=vx();Object.defineProperty(bn,"Scope",{enumerable:!0,get:function(){return gd.Scope}});Object.defineProperty(bn,"ValueScope",{enumerable:!0,get:function(){return gd.ValueScope}});Object.defineProperty(bn,"ValueScopeName",{enumerable:!0,get:function(){return gd.ValueScopeName}});Object.defineProperty(bn,"varKinds",{enumerable:!0,get:function(){return gd.varKinds}});bn.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 Hs{optimizeNodes(){return this}optimizeNames(e,t){return this}}class m_ extends Hs{constructor(e,t,n){super();this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){let n=e?mt.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=sa(this.rhs,e,t);return this}get names(){return this.rhs instanceof Z._CodeOrName?this.rhs.names:{}}}class Px extends Hs{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=sa(this.rhs,e,t),this}get names(){let e=this.lhs instanceof Z.Name?{}:{...this.lhs.names};return hd(e,this.rhs)}}class h_ extends Px{constructor(e,t,n,r){super(e,n,r);this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class g_ extends Hs{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class y_ extends Hs{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class x_ extends Hs{constructor(e){super();this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class b_ extends Hs{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=sa(this.code,e,t),this}get names(){return this.code instanceof Z._CodeOrName?this.code.names:{}}}class yd extends Hs{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;xq(e,s.names),n.splice(r,1)}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>Wo(e,t.names),{})}}class Ws extends yd{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class $_ extends yd{}class oc extends Ws{}oc.kind="else";class ys extends Ws{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 oc(n):n}if(t){if(e===!1)return t instanceof ys?t:t.nodes;if(this.nodes.length)return this;return new ys(j_(e),t instanceof ys?[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=sa(this.condition,e,t),this}get names(){let e=super.names;if(hd(e,this.condition),this.else)Wo(e,this.else.names);return e}}ys.kind="if";class ra extends Ws{}ra.kind="for";class S_ extends ra{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=sa(this.iteration,e,t),this}get names(){return Wo(super.names,this.iteration.names)}}class w_ extends ra{constructor(e,t,n,r){super();this.varKind=e,this.name=t,this.from=n,this.to=r}render(e){let t=e.es5?mt.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=hd(super.names,this.from);return hd(e,this.to)}}class Ex extends ra{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=sa(this.iterable,e,t),this}get names(){return Wo(super.names,this.iterable.names)}}class fd extends Ws{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)}}fd.kind="func";class dd extends yd{render(e){return"return "+super.render(e)}}dd.kind="return";class v_ extends Ws{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)Wo(e,this.catch.names);if(this.finally)Wo(e,this.finally.names);return e}}class pd extends Ws{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}pd.kind="catch";class md extends Ws{render(e){return"finally"+super.render(e)}}md.kind="finally";class E_{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
630
- `:""},this._extScope=e,this._scope=new mt.Scope({parent:e}),this._nodes=[new $_]}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 m_(e,s,n)),s}const(e,t,n){return this._def(mt.varKinds.const,e,t,n)}let(e,t,n){return this._def(mt.varKinds.let,e,t,n)}var(e,t,n){return this._def(mt.varKinds.var,e,t,n)}assign(e,t,n){return this._leafNode(new Px(e,t,n))}add(e,t){return this._leafNode(new h_(e,bn.operators.ADD,t))}code(e){if(typeof e=="function")e();else if(e!==Z.nil)this._leafNode(new b_(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 ys(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 ys(e))}else(){return this._elseNode(new oc)}endIf(){return this._endBlockNode(ys,oc)}_for(e,t){if(this._blockNode(e),t)this.code(t).endFor();return this}for(e,t){return this._for(new S_(e),t)}forRange(e,t,n,r,s=this.opts.es5?mt.varKinds.var:mt.varKinds.let){let o=this._scope.toName(e);return this._for(new w_(s,o,t,n),()=>r(o))}forOf(e,t,n,r=mt.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 Ex("of",r,s,t),()=>n(s))}forIn(e,t,n,r=this.opts.es5?mt.varKinds.var:mt.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 Ex("in",r,s,t),()=>n(s))}endFor(){return this._endBlockNode(ra)}label(e){return this._leafNode(new g_(e))}break(e){return this._leafNode(new y_(e))}return(e){let t=new dd;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(dd)}try(e,t,n){if(!t&&!n)throw Error('CodeGen: "try" without "catch" and "finally"');let r=new v_;if(this._blockNode(r),this.code(e),t){let s=this.name("e");this._currNode=r.catch=new pd(s),t(s)}if(n)this._currNode=r.finally=new md,this.code(n);return this._endBlockNode(pd,md)}throw(e){return this._leafNode(new x_(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 fd(e,t,n)),r)this.code(r).endFunc();return this}endFunc(){return this._endBlockNode(fd)}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 ys))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}}bn.CodeGen=E_;function Wo(e,t){for(let n in t)e[n]=(e[n]||0)+(t[n]||0);return e}function hd(e,t){return t instanceof Z._CodeOrName?Wo(e,t.names):e}function sa(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 xq(e,t){for(let n in t)e[n]=(e[n]||0)-(t[n]||0)}function j_(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:Z._`!${jx(e)}`}bn.not=j_;var bq=P_(bn.operators.AND);function $q(...e){return e.reduce(bq)}bn.and=$q;var Sq=P_(bn.operators.OR);function wq(...e){return e.reduce(Sq)}bn.or=wq;function P_(e){return(t,n)=>t===Z.nil?n:n===Z.nil?t:Z._`${jx(t)} ${e} ${jx(n)}`}function jx(e){return e instanceof Z.Name?e:Z._`(${e})`}});var Oe=W(function(M_){Object.defineProperty(M_,"__esModule",{value:!0});M_.checkStrictMode=M_.getErrorPath=M_.Type=M_.useFunc=M_.setEvaluated=M_.evaluatedPropsToName=M_.mergeEvaluated=M_.eachItem=M_.unescapeJsonPointer=M_.escapeJsonPointer=M_.escapeFragment=M_.unescapeFragment=M_.schemaRefOrVal=M_.schemaHasRulesButRef=M_.schemaHasRules=M_.checkUnknownRules=M_.alwaysValidSchema=M_.toHash=void 0;var de=$e(),A_=sc();function Pq(e){let t={};for(let n of e)t[n]=!0;return t}M_.toHash=Pq;function _q(e,t){if(typeof t=="boolean")return t;if(Object.keys(t).length===0)return!0;return C_(e,t),!R_(t,e.self.RULES.all)}M_.alwaysValidSchema=_q;function C_(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])J_(e,`unknown keyword: "${o}"`)}M_.checkUnknownRules=C_;function R_(e,t){if(typeof e=="boolean")return!e;for(let n in e)if(t[n])return!0;return!1}M_.schemaHasRules=R_;function kq(e,t){if(typeof e=="boolean")return!e;for(let n in e)if(n!=="$ref"&&t.all[n])return!0;return!1}M_.schemaHasRulesButRef=kq;function Oq({topSchemaRef:e,schemaPath:t},n,r,s){if(!s){if(typeof n=="number"||typeof n=="boolean")return n;if(typeof n=="string")return de._`${n}`}return de._`${e}${t}${de.getProperty(r)}`}M_.schemaRefOrVal=Oq;function Aq(e){return N_(decodeURIComponent(e))}M_.unescapeFragment=Aq;function Cq(e){return encodeURIComponent(kx(e))}M_.escapeFragment=Cq;function kx(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}M_.escapeJsonPointer=kx;function N_(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}M_.unescapeJsonPointer=N_;function Rq(e,t){if(Array.isArray(e))for(let n of e)t(n);else t(e)}M_.eachItem=Rq;function k_({mergeNames:e,mergeToName:t,mergeValues:n,resultToName:r}){return(s,o,i,a)=>{let l=i===void 0?o:i instanceof de.Name?(o instanceof de.Name?e(s,o,i):t(s,o,i),i):o instanceof de.Name?(t(s,i,o),o):n(o,i);return a===de.Name&&!(l instanceof de.Name)?r(s,l):l}}M_.mergeEvaluated={props:k_({mergeNames:(e,t,n)=>e.if(de._`${n} !== true && ${t} !== undefined`,()=>{e.if(de._`${t} === true`,()=>e.assign(n,!0),()=>e.assign(n,de._`${n} || {}`).code(de._`Object.assign(${n}, ${t})`))}),mergeToName:(e,t,n)=>e.if(de._`${n} !== true`,()=>{if(t===!0)e.assign(n,!0);else e.assign(n,de._`${n} || {}`),Ox(e,n,t)}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:T_}),items:k_({mergeNames:(e,t,n)=>e.if(de._`${n} !== true && ${t} !== undefined`,()=>e.assign(n,de._`${t} === true ? true : ${n} > ${t} ? ${n} : ${t}`)),mergeToName:(e,t,n)=>e.if(de._`${n} !== true`,()=>e.assign(n,t===!0?!0:de._`${n} > ${t} ? ${n} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function T_(e,t){if(t===!0)return e.var("props",!0);let n=e.var("props",de._`{}`);if(t!==void 0)Ox(e,n,t);return n}M_.evaluatedPropsToName=T_;function Ox(e,t,n){Object.keys(n).forEach((r)=>e.assign(de._`${t}${de.getProperty(r)}`,!0))}M_.setEvaluated=Ox;var O_={};function Nq(e,t){return e.scopeValue("func",{ref:t,code:O_[t.code]||(O_[t.code]=new A_._Code(t.code))})}M_.useFunc=Nq;var _x;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(_x||(M_.Type=_x={}));function Tq(e,t,n){if(e instanceof de.Name){let r=t===_x.Num;return n?r?de._`"[" + ${e} + "]"`:de._`"['" + ${e} + "']"`:r?de._`"/" + ${e}`:de._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return n?de.getProperty(e).toString():"/"+kx(e)}M_.getErrorPath=Tq;function J_(e,t,n=e.opts.strictSchema){if(!n)return;if(t=`strict mode: ${t}`,n===!0)throw Error(t);e.self.logger.warn(t)}M_.checkStrictMode=J_});var Kn=W(function(D_){Object.defineProperty(D_,"__esModule",{value:!0});var Ve=$e(),Zq={data:new Ve.Name("data"),valCxt:new Ve.Name("valCxt"),instancePath:new Ve.Name("instancePath"),parentData:new Ve.Name("parentData"),parentDataProperty:new Ve.Name("parentDataProperty"),rootData:new Ve.Name("rootData"),dynamicAnchors:new Ve.Name("dynamicAnchors"),vErrors:new Ve.Name("vErrors"),errors:new Ve.Name("errors"),this:new Ve.Name("this"),self:new Ve.Name("self"),scope:new Ve.Name("scope"),json:new Ve.Name("json"),jsonPos:new Ve.Name("jsonPos"),jsonLen:new Ve.Name("jsonLen"),jsonPart:new Ve.Name("jsonPart")};D_.default=Zq});var ic=W(function(q_){Object.defineProperty(q_,"__esModule",{value:!0});q_.extendErrors=q_.resetErrorsCount=q_.reportExtraError=q_.reportError=q_.keyword$DataError=q_.keywordError=void 0;var ee=$e(),Bs=Oe(),an=Kn();q_.keywordError={message:({keyword:e})=>ee.str`must pass "${e}" keyword validation`};q_.keyword$DataError={message:({keyword:e,schemaType:t})=>t?ee.str`"${e}" keyword must be ${t} ($data)`:ee.str`"${e}" keyword is invalid ($data)`};function eH(e,t=q_.keywordError,n,r){let{it:s}=e,{gen:o,compositeRule:i,allErrors:a}=s,l=V_(e,t,n);if(r!==null&&r!==void 0?r:i||a)L_(o,l);else F_(s,ee._`[${l}]`)}q_.reportError=eH;function tH(e,t=q_.keywordError,n){let{it:r}=e,{gen:s,compositeRule:o,allErrors:i}=r,a=V_(e,t,n);if(L_(s,a),!(o||i))F_(r,an.default.vErrors)}q_.reportExtraError=tH;function nH(e,t){e.assign(an.default.errors,t),e.if(ee._`${an.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(ee._`${an.default.vErrors}.length`,t),()=>e.assign(an.default.vErrors,null)))}q_.resetErrorsCount=nH;function rH({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,an.default.errors,(a)=>{if(e.const(i,ee._`${an.default.vErrors}[${a}]`),e.if(ee._`${i}.instancePath === undefined`,()=>e.assign(ee._`${i}.instancePath`,ee.strConcat(an.default.instancePath,o.errorPath))),e.assign(ee._`${i}.schemaPath`,ee.str`${o.errSchemaPath}/${t}`),o.opts.verbose)e.assign(ee._`${i}.schema`,n),e.assign(ee._`${i}.data`,r)})}q_.extendErrors=rH;function L_(e,t){let n=e.const("err",t);e.if(ee._`${an.default.vErrors} === null`,()=>e.assign(an.default.vErrors,ee._`[${n}]`),ee._`${an.default.vErrors}.push(${n})`),e.code(ee._`${an.default.errors}++`)}function F_(e,t){let{gen:n,validateName:r,schemaEnv:s}=e;if(s.$async)n.throw(ee._`new ${e.ValidationError}(${t})`);else n.assign(ee._`${r}.errors`,t),n.return(!1)}var Bo={keyword:new ee.Name("keyword"),schemaPath:new ee.Name("schemaPath"),params:new ee.Name("params"),propertyName:new ee.Name("propertyName"),message:new ee.Name("message"),schema:new ee.Name("schema"),parentSchema:new ee.Name("parentSchema")};function V_(e,t,n){let{createErrors:r}=e.it;if(r===!1)return ee._`{}`;return sH(e,t,n)}function sH(e,t,n={}){let{gen:r,it:s}=e,o=[oH(s,n),iH(e,n)];return aH(e,t,o),r.object(...o)}function oH({errorPath:e},{instancePath:t}){let n=t?ee.str`${e}${Bs.getErrorPath(t,Bs.Type.Str)}`:e;return[an.default.instancePath,ee.strConcat(an.default.instancePath,n)]}function iH({keyword:e,it:{errSchemaPath:t}},{schemaPath:n,parentSchema:r}){let s=r?t:ee.str`${t}/${e}`;if(n)s=ee.str`${s}${Bs.getErrorPath(n,Bs.Type.Str)}`;return[Bo.schemaPath,s]}function aH(e,{params:t,message:n},r){let{keyword:s,data:o,schemaValue:i,it:a}=e,{opts:l,propertyName:c,topSchemaRef:u,schemaPath:d}=a;if(r.push([Bo.keyword,s],[Bo.params,typeof t=="function"?t(e):t||ee._`{}`]),l.messages)r.push([Bo.message,typeof n=="function"?n(e):n]);if(l.verbose)r.push([Bo.schema,i],[Bo.parentSchema,ee._`${u}${d}`],[an.default.data,o]);if(c)r.push([Bo.propertyName,c])}});var G_=W(function(z_){Object.defineProperty(z_,"__esModule",{value:!0});z_.boolOrEmptySchema=z_.topBoolOrEmptySchema=void 0;var W_=ic(),B_=$e(),dH=Kn(),pH={message:"boolean schema is false"};function mH(e){let{gen:t,schema:n,validateName:r}=e;if(n===!1)U_(e,!1);else if(typeof n=="object"&&n.$async===!0)t.return(dH.default.data);else t.assign(B_._`${r}.errors`,null),t.return(!0)}z_.topBoolOrEmptySchema=mH;function hH(e,t){let{gen:n,schema:r}=e;if(r===!1)n.var(t,!1),U_(e);else n.var(t,!0)}z_.boolOrEmptySchema=hH;function U_(e,t){let{gen:n,data:r}=e;W_.reportError({gen:n,keyword:"false schema",data:r,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},pH,void 0,t)}});var Cx=W(function(X_){Object.defineProperty(X_,"__esModule",{value:!0});X_.getRules=X_.isJSONType=void 0;var yH=["string","number","integer","boolean","null","object","array"],xH=new Set(yH);function bH(e){return typeof e=="string"&&xH.has(e)}X_.isJSONType=bH;function $H(){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:{}}}X_.getRules=$H});var Rx=W(function(ek){Object.defineProperty(ek,"__esModule",{value:!0});ek.shouldUseRule=ek.shouldUseGroup=ek.schemaHasRulesForType=void 0;function wH({schema:e,self:t},n){let r=t.RULES.types[n];return r&&r!==!0&&Z_(e,r)}ek.schemaHasRulesForType=wH;function Z_(e,t){return t.rules.some((n)=>Q_(e,n))}ek.shouldUseGroup=Z_;function Q_(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))}ek.shouldUseRule=Q_});var ac=W(function(ak){Object.defineProperty(ak,"__esModule",{value:!0});ak.reportTypeError=ak.checkDataTypes=ak.checkDataType=ak.coerceAndCheckDataType=ak.getJSONTypes=ak.getSchemaTypes=ak.DataType=void 0;var nk=Cx(),rk=Rx(),sk=ic(),Y=$e(),bd=Oe(),oa;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(oa||(ak.DataType=oa={}));function jH(e){let t=ok(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}ak.getSchemaTypes=jH;function ok(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(nk.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}ak.getJSONTypes=ok;function PH(e,t){let{gen:n,data:r,opts:s}=e,o=_H(t,s.coerceTypes),i=t.length>0&&!(o.length===0&&t.length===1&&rk.schemaHasRulesForType(e,t[0]));if(i){let a=Tx(t,r,s.strictNumbers,oa.Wrong);n.if(a,()=>{if(o.length)kH(e,t,o);else Jx(e)})}return i}ak.coerceAndCheckDataType=PH;var ik=new Set(["string","number","integer","boolean","null"]);function _H(e,t){return t?e.filter((n)=>ik.has(n)||t==="array"&&n==="array"):[]}function kH(e,t,n){let{gen:r,data:s,opts:o}=e,i=r.let("dataType",Y._`typeof ${s}`),a=r.let("coerced",Y._`undefined`);if(o.coerceTypes==="array")r.if(Y._`${i} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,()=>r.assign(s,Y._`${s}[0]`).assign(i,Y._`typeof ${s}`).if(Tx(t,s,o.strictNumbers),()=>r.assign(a,s)));r.if(Y._`${a} !== undefined`);for(let c of n)if(ik.has(c)||c==="array"&&o.coerceTypes==="array")l(c);r.else(),Jx(e),r.endIf(),r.if(Y._`${a} !== undefined`,()=>{r.assign(s,a),OH(e,a)});function l(c){switch(c){case"string":r.elseIf(Y._`${i} == "number" || ${i} == "boolean"`).assign(a,Y._`"" + ${s}`).elseIf(Y._`${s} === null`).assign(a,Y._`""`);return;case"number":r.elseIf(Y._`${i} == "boolean" || ${s} === null
631
- || (${i} == "string" && ${s} && ${s} == +${s})`).assign(a,Y._`+${s}`);return;case"integer":r.elseIf(Y._`${i} === "boolean" || ${s} === null
632
- || (${i} === "string" && ${s} && ${s} == +${s} && !(${s} % 1))`).assign(a,Y._`+${s}`);return;case"boolean":r.elseIf(Y._`${s} === "false" || ${s} === 0 || ${s} === null`).assign(a,!1).elseIf(Y._`${s} === "true" || ${s} === 1`).assign(a,!0);return;case"null":r.elseIf(Y._`${s} === "" || ${s} === 0 || ${s} === false`),r.assign(a,null);return;case"array":r.elseIf(Y._`${i} === "string" || ${i} === "number"
633
- || ${i} === "boolean" || ${s} === null`).assign(a,Y._`[${s}]`)}}}function OH({gen:e,parentData:t,parentDataProperty:n},r){e.if(Y._`${t} !== undefined`,()=>e.assign(Y._`${t}[${n}]`,r))}function Nx(e,t,n,r=oa.Correct){let s=r===oa.Correct?Y.operators.EQ:Y.operators.NEQ,o;switch(e){case"null":return Y._`${t} ${s} null`;case"array":o=Y._`Array.isArray(${t})`;break;case"object":o=Y._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":o=i(Y._`!(${t} % 1) && !isNaN(${t})`);break;case"number":o=i();break;default:return Y._`typeof ${t} ${s} ${e}`}return r===oa.Correct?o:Y.not(o);function i(a=Y.nil){return Y.and(Y._`typeof ${t} == "number"`,a,n?Y._`isFinite(${t})`:Y.nil)}}ak.checkDataType=Nx;function Tx(e,t,n,r){if(e.length===1)return Nx(e[0],t,n,r);let s,o=bd.toHash(e);if(o.array&&o.object){let i=Y._`typeof ${t} != "object"`;s=o.null?i:Y._`!${t} || ${i}`,delete o.null,delete o.array,delete o.object}else s=Y.nil;if(o.number)delete o.integer;for(let i in o)s=Y.and(s,Nx(i,t,n,r));return s}ak.checkDataTypes=Tx;var AH={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?Y._`{type: ${e}}`:Y._`{type: ${t}}`};function Jx(e){let t=CH(e);sk.reportError(t,AH)}ak.reportTypeError=Jx;function CH(e){let{gen:t,data:n,schema:r}=e,s=bd.schemaRefOrVal(e,r,"type");return{gen:t,keyword:"type",data:n,schema:r.type,schemaCode:s,schemaValue:s,parentSchema:r,params:{},it:e}}});var pk=W(function(fk){Object.defineProperty(fk,"__esModule",{value:!0});fk.assignDefaults=void 0;var Gn=$e(),uk=Oe();function DH(e,t){let{properties:n,items:r}=e.schema;if(t==="object"&&n)for(let s in n)ck(e,s,n[s].default);else if(t==="array"&&Array.isArray(r))r.forEach((s,o)=>ck(e,o,s.default))}fk.assignDefaults=DH;function ck(e,t,n){let{gen:r,compositeRule:s,data:o,opts:i}=e;if(n===void 0)return;let a=Gn._`${o}${Gn.getProperty(t)}`;if(s){uk.checkStrictMode(e,`default is ignored for: ${a}`);return}let l=Gn._`${a} === undefined`;if(i.useDefaults==="empty")l=Gn._`${l} || ${a} === null || ${a} === ""`;r.if(l,Gn._`${a} = ${Gn.stringify(n)}`)}});var Xn=W(function(yk){Object.defineProperty(yk,"__esModule",{value:!0});yk.validateUnion=yk.validateArray=yk.usePattern=yk.callValidateCode=yk.schemaProperties=yk.allSchemaProperties=yk.noPropertyInData=yk.propertyInData=yk.isOwnProperty=yk.hasPropFunc=yk.reportMissingProp=yk.checkMissingProp=yk.checkReportMissingProp=void 0;var he=$e(),ia=Oe(),Us=Kn(),mk=Oe();function LH(e,t){let{gen:n,data:r,it:s}=e;n.if(Ix(n,r,t,s.opts.ownProperties),()=>{e.setParams({missingProperty:he._`${t}`},!0),e.error()})}yk.checkReportMissingProp=LH;function FH({gen:e,data:t,it:{opts:n}},r,s){return he.or(...r.map((o)=>he.and(Ix(e,t,o,n.ownProperties),he._`${s} = ${o}`)))}yk.checkMissingProp=FH;function VH(e,t){e.setParams({missingProperty:t},!0),e.error()}yk.reportMissingProp=VH;function hk(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:he._`Object.prototype.hasOwnProperty`})}yk.hasPropFunc=hk;function Mx(e,t,n){return he._`${hk(e)}.call(${t}, ${n})`}yk.isOwnProperty=Mx;function qH(e,t,n,r){let s=he._`${t}${he.getProperty(n)} !== undefined`;return r?he._`${s} && ${Mx(e,t,n)}`:s}yk.propertyInData=qH;function Ix(e,t,n,r){let s=he._`${t}${he.getProperty(n)} === undefined`;return r?he.or(s,he.not(Mx(e,t,n))):s}yk.noPropertyInData=Ix;function gk(e){return e?Object.keys(e).filter((t)=>t!=="__proto__"):[]}yk.allSchemaProperties=gk;function HH(e,t){return gk(t).filter((n)=>!ia.alwaysValidSchema(e,t[n]))}yk.schemaProperties=HH;function WH({schemaCode:e,data:t,it:{gen:n,topSchemaRef:r,schemaPath:s,errorPath:o},it:i},a,l,c){let u=c?he._`${e}, ${t}, ${r}${s}`:t,d=[[Us.default.instancePath,he.strConcat(Us.default.instancePath,o)],[Us.default.parentData,i.parentData],[Us.default.parentDataProperty,i.parentDataProperty],[Us.default.rootData,Us.default.rootData]];if(i.opts.dynamicRef)d.push([Us.default.dynamicAnchors,Us.default.dynamicAnchors]);let p=he._`${u}, ${n.object(...d)}`;return l!==he.nil?he._`${a}.call(${l}, ${p})`:he._`${a}(${p})`}yk.callValidateCode=WH;var BH=he._`new RegExp`;function UH({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:he._`${s.code==="new RegExp"?BH:mk.useFunc(e,s)}(${n}, ${r})`})}yk.usePattern=UH;function zH(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 l=t.const("len",he._`${n}.length`);t.forRange("i",0,l,(c)=>{e.subschema({keyword:r,dataProp:c,dataPropType:ia.Type.Num},o),t.if(he.not(o),a)})}}yk.validateArray=zH;function KH(e){let{gen:t,schema:n,keyword:r,it:s}=e;if(!Array.isArray(n))throw Error("ajv implementation error");if(n.some((l)=>ia.alwaysValidSchema(s,l))&&!s.opts.unevaluated)return;let i=t.let("valid",!1),a=t.name("_valid");t.block(()=>n.forEach((l,c)=>{let u=e.subschema({keyword:r,schemaProp:c,compositeRule:!0},a);if(t.assign(i,he._`${i} || ${a}`),!e.mergeValidEvaluated(u,a))t.if(he.not(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}yk.validateUnion=KH});var jk=W(function(vk){Object.defineProperty(vk,"__esModule",{value:!0});vk.validateKeywordUsage=vk.validSchemaType=vk.funcKeywordCode=vk.macroKeywordCode=void 0;var He=$e(),Uo=Kn(),$k=Xn(),Sk=ic();function aW(e,t){let{gen:n,keyword:r,schema:s,parentSchema:o,it:i}=e,a=t.macro.call(i.self,s,o,i),l=wk(n,r,a);if(i.opts.validateSchema!==!1)i.self.validateSchema(a,!0);let c=n.name("valid");e.subschema({schema:a,schemaPath:He.nil,errSchemaPath:`${i.errSchemaPath}/${r}`,topSchemaRef:l,compositeRule:!0},c),e.pass(c,()=>e.error(!0))}vk.macroKeywordCode=aW;function lW(e,t){var n;let{gen:r,keyword:s,schema:o,parentSchema:i,$data:a,it:l}=e;uW(l,t);let c=!a&&t.compile?t.compile.call(l.self,o,i,l):t.validate,u=wk(r,s,c),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(S(),t.modifying)bk(e);g(()=>e.error())}else{let x=t.async?m():y();if(t.modifying)bk(e);g(()=>cW(e,x))}}function m(){let x=r.let("ruleErrs",null);return r.try(()=>S(He._`await `),(P)=>r.assign(d,!1).if(He._`${P} instanceof ${l.ValidationError}`,()=>r.assign(x,He._`${P}.errors`),()=>r.throw(P))),x}function y(){let x=He._`${u}.errors`;return r.assign(x,null),S(He.nil),x}function S(x=t.async?He._`await `:He.nil){let P=l.opts.passContext?Uo.default.this:Uo.default.self,w=!(("compile"in t)&&!a||t.schema===!1);r.assign(d,He._`${x}${$k.callValidateCode(e,u,P,w)}`,t.modifying)}function g(x){var P;r.if(He.not((P=t.valid)!==null&&P!==void 0?P:d),x)}}vk.funcKeywordCode=lW;function bk(e){let{gen:t,data:n,it:r}=e;t.if(r.parentData,()=>t.assign(n,He._`${r.parentData}[${r.parentDataProperty}]`))}function cW(e,t){let{gen:n}=e;n.if(He._`Array.isArray(${t})`,()=>{n.assign(Uo.default.vErrors,He._`${Uo.default.vErrors} === null ? ${t} : ${Uo.default.vErrors}.concat(${t})`).assign(Uo.default.errors,He._`${Uo.default.vErrors}.length`),Sk.extendErrors(e)},()=>e.error())}function uW({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}function wk(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:He.stringify(n)})}function fW(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")}vk.validSchemaType=fW;function dW({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 l=`keyword "${o}" value is invalid at path "${r}": `+n.errorsText(s.validateSchema.errors);if(t.validateSchema==="log")n.logger.error(l);else throw Error(l)}}}vk.validateKeywordUsage=dW});var kk=W(function(Pk){Object.defineProperty(Pk,"__esModule",{value:!0});Pk.extendSubschemaMode=Pk.extendSubschemaData=Pk.getSubschema=void 0;var Rt=$e(),$d=Oe();function gW(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:Rt._`${e.schemaPath}${Rt.getProperty(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[n],schemaPath:Rt._`${e.schemaPath}${Rt.getProperty(t)}${Rt.getProperty(n)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${$d.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')}Pk.getSubschema=gW;function yW(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:c,dataPathArr:u,opts:d}=t,p=a.let("data",Rt._`${t.data}${Rt.getProperty(n)}`,!0);l(p),e.errorPath=Rt.str`${c}${$d.getErrorPath(n,r,d.jsPropertySyntax)}`,e.parentDataProperty=Rt._`${n}`,e.dataPathArr=[...u,e.parentDataProperty]}if(s!==void 0){let c=s instanceof Rt.Name?s:a.let("data",s,!0);if(l(c),i!==void 0)e.propertyName=i}if(o)e.dataTypes=o;function l(c){e.data=c,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,c]}}Pk.extendSubschemaData=yW;function xW(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}Pk.extendSubschemaMode=xW});var Dx=W(function(jre,Ok){Ok.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 Ck=W(function(Pre,Ak){var zs=Ak.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(){};Sd(t,r,s,e,"",e)};zs.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};zs.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};zs.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};zs.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 Sd(e,t,n,r,s,o,i,a,l,c){if(r&&typeof r=="object"&&!Array.isArray(r)){t(r,s,o,i,a,l,c);for(var u in r){var d=r[u];if(Array.isArray(d)){if(u in zs.arrayKeywords)for(var p=0;p<d.length;p++)Sd(e,t,n,d[p],s+"/"+u+"/"+p,o,s,u,r,p)}else if(u in zs.propsKeywords){if(d&&typeof d=="object")for(var m in d)Sd(e,t,n,d[m],s+"/"+u+"/"+SW(m),o,s,u,r,m)}else if(u in zs.keywords||e.allKeys&&!(u in zs.skipKeywords))Sd(e,t,n,d,s+"/"+u,o,s,u,r)}n(r,s,o,i,a,l,c)}}function SW(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var lc=W(function(Mk){Object.defineProperty(Mk,"__esModule",{value:!0});Mk.getSchemaRefs=Mk.resolveUrl=Mk.normalizeId=Mk._getFullPath=Mk.getFullPath=Mk.inlineRef=void 0;var Rk=Oe(),wW=Dx(),vW=Ck(),EW=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function jW(e,t=!0){if(typeof e=="boolean")return!0;if(t===!0)return!Lx(e);if(!t)return!1;return Nk(e)<=t}Mk.inlineRef=jW;var PW=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Lx(e){for(let t in e){if(PW.has(t))return!0;let n=e[t];if(Array.isArray(n)&&n.some(Lx))return!0;if(typeof n=="object"&&Lx(n))return!0}return!1}function Nk(e){let t=0;for(let n in e){if(n==="$ref")return 1/0;if(t++,EW.has(n))continue;if(typeof e[n]=="object")Rk.eachItem(e[n],(r)=>t+=Nk(r));if(t===1/0)return 1/0}return t}function Tk(e,t="",n){if(n!==!1)t=aa(t);let r=e.parse(t);return Jk(e,r)}Mk.getFullPath=Tk;function Jk(e,t){return e.serialize(t).split("#")[0]+"#"}Mk._getFullPath=Jk;var _W=/#\/?$/;function aa(e){return e?e.replace(_W,""):""}Mk.normalizeId=aa;function kW(e,t,n){return n=aa(n),e.resolve(t,n)}Mk.resolveUrl=kW;var OW=/^[a-z_][-a-z0-9._]*$/i;function AW(e,t){if(typeof e=="boolean")return{};let{schemaId:n,uriResolver:r}=this.opts,s=aa(e[n]||t),o={"":s},i=Tk(r,s,!1),a={},l=new Set;return vW(e,{allKeys:!0},(d,p,m,y)=>{if(y===void 0)return;let S=i+p,g=o[y];if(typeof d[n]=="string")g=x.call(this,d[n]);P.call(this,d.$anchor),P.call(this,d.$dynamicAnchor),o[p]=g;function x(w){let E=this.opts.uriResolver.resolve;if(w=aa(g?E(g,w):w),l.has(w))throw u(w);l.add(w);let j=this.refs[w];if(typeof j=="string")j=this.refs[j];if(typeof j=="object")c(d,j.schema,w);else if(w!==aa(S))if(w[0]==="#")c(d,a[w],w),a[w]=d;else this.refs[w]=S;return w}function P(w){if(typeof w=="string"){if(!OW.test(w))throw Error(`invalid anchor "${w}"`);x.call(this,`#${w}`)}}}),a;function c(d,p,m){if(p!==void 0&&!wW(d,p))throw u(m)}function u(d){return Error(`reference "${d}" resolves to more than one schema`)}}Mk.getSchemaRefs=AW});var ua=W(function(Zk){Object.defineProperty(Zk,"__esModule",{value:!0});Zk.getData=Zk.KeywordCxt=Zk.validateFunctionCode=void 0;var vd=G_(),wd=ac(),ca=Rx(),Ks=ac(),Vk=pk(),Mr=jk(),la=kk(),F=$e(),ye=Kn(),qk=lc(),It=Oe(),Jr=ic();function MW(e){if(Bk(e)){if(Uk(e),Wk(e)){LW(e);return}}Hk(e,()=>vd.topBoolOrEmptySchema(e))}Zk.validateFunctionCode=MW;function Hk({gen:e,validateName:t,schema:n,schemaEnv:r,opts:s},o){if(s.code.es5)e.func(t,F._`${ye.default.data}, ${ye.default.valCxt}`,r.$async,()=>{e.code(F._`"use strict"; ${Dk(n,s)}`),DW(e,s),e.code(o)});else e.func(t,F._`${ye.default.data}, ${IW(s)}`,r.$async,()=>e.code(Dk(n,s)).code(o))}function IW(e){return F._`{${ye.default.instancePath}="", ${ye.default.parentData}, ${ye.default.parentDataProperty}, ${ye.default.rootData}=${ye.default.data}${e.dynamicRef?F._`, ${ye.default.dynamicAnchors}={}`:F.nil}}={}`}function DW(e,t){e.if(ye.default.valCxt,()=>{if(e.var(ye.default.instancePath,F._`${ye.default.valCxt}.${ye.default.instancePath}`),e.var(ye.default.parentData,F._`${ye.default.valCxt}.${ye.default.parentData}`),e.var(ye.default.parentDataProperty,F._`${ye.default.valCxt}.${ye.default.parentDataProperty}`),e.var(ye.default.rootData,F._`${ye.default.valCxt}.${ye.default.rootData}`),t.dynamicRef)e.var(ye.default.dynamicAnchors,F._`${ye.default.valCxt}.${ye.default.dynamicAnchors}`)},()=>{if(e.var(ye.default.instancePath,F._`""`),e.var(ye.default.parentData,F._`undefined`),e.var(ye.default.parentDataProperty,F._`undefined`),e.var(ye.default.rootData,ye.default.data),t.dynamicRef)e.var(ye.default.dynamicAnchors,F._`{}`)})}function LW(e){let{schema:t,opts:n,gen:r}=e;Hk(e,()=>{if(n.$comment&&t.$comment)Kk(e);if(WW(e),r.let(ye.default.vErrors,null),r.let(ye.default.errors,0),n.unevaluated)FW(e);zk(e),zW(e)});return}function FW(e){let{gen:t,validateName:n}=e;e.evaluated=t.const("evaluated",F._`${n}.evaluated`),t.if(F._`${e.evaluated}.dynamicProps`,()=>t.assign(F._`${e.evaluated}.props`,F._`undefined`)),t.if(F._`${e.evaluated}.dynamicItems`,()=>t.assign(F._`${e.evaluated}.items`,F._`undefined`))}function Dk(e,t){let n=typeof e=="object"&&e[t.schemaId];return n&&(t.code.source||t.code.process)?F._`/*# sourceURL=${n} */`:F.nil}function VW(e,t){if(Bk(e)){if(Uk(e),Wk(e)){qW(e,t);return}}vd.boolOrEmptySchema(e,t)}function Wk({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 Bk(e){return typeof e.schema!="boolean"}function qW(e,t){let{schema:n,gen:r,opts:s}=e;if(s.$comment&&n.$comment)Kk(e);BW(e),UW(e);let o=r.const("_errs",ye.default.errors);zk(e,o),r.var(t,F._`${o} === ${ye.default.errors}`)}function Uk(e){It.checkUnknownRules(e),HW(e)}function zk(e,t){if(e.opts.jtd)return Lk(e,[],!1,t);let n=wd.getSchemaTypes(e.schema),r=wd.coerceAndCheckDataType(e,n);Lk(e,n,!r,t)}function HW(e){let{schema:t,errSchemaPath:n,opts:r,self:s}=e;if(t.$ref&&r.ignoreKeywordsWithRef&&It.schemaHasRulesButRef(t,s.RULES))s.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}function WW(e){let{schema:t,opts:n}=e;if(t.default!==void 0&&n.useDefaults&&n.strictSchema)It.checkStrictMode(e,"default is ignored in the schema root")}function BW(e){let t=e.schema[e.opts.schemaId];if(t)e.baseId=qk.resolveUrl(e.opts.uriResolver,e.baseId,t)}function UW(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function Kk({gen:e,schemaEnv:t,schema:n,errSchemaPath:r,opts:s}){let o=n.$comment;if(s.$comment===!0)e.code(F._`${ye.default.self}.logger.log(${o})`);else if(typeof s.$comment=="function"){let i=F.str`${r}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code(F._`${ye.default.self}.opts.$comment(${o}, ${i}, ${a}.schema)`)}}function zW(e){let{gen:t,schemaEnv:n,validateName:r,ValidationError:s,opts:o}=e;if(n.$async)t.if(F._`${ye.default.errors} === 0`,()=>t.return(ye.default.data),()=>t.throw(F._`new ${s}(${ye.default.vErrors})`));else{if(t.assign(F._`${r}.errors`,ye.default.vErrors),o.unevaluated)KW(e);t.return(F._`${ye.default.errors} === 0`)}}function KW({gen:e,evaluated:t,props:n,items:r}){if(n instanceof F.Name)e.assign(F._`${t}.props`,n);if(r instanceof F.Name)e.assign(F._`${t}.items`,r)}function Lk(e,t,n,r){let{gen:s,schema:o,data:i,allErrors:a,opts:l,self:c}=e,{RULES:u}=c;if(o.$ref&&(l.ignoreKeywordsWithRef||!It.schemaHasRulesButRef(o,u))){s.block(()=>Xk(e,"$ref",u.all.$ref.definition));return}if(!l.jtd)GW(e,t);s.block(()=>{for(let p of u.rules)d(p);d(u.post)});function d(p){if(!ca.shouldUseGroup(o,p))return;if(p.type){if(s.if(Ks.checkDataType(p.type,i,l.strictNumbers)),Fk(e,p),t.length===1&&t[0]===p.type&&n)s.else(),Ks.reportTypeError(e);s.endIf()}else Fk(e,p);if(!a)s.if(F._`${ye.default.errors} === ${r||0}`)}}function Fk(e,t){let{gen:n,schema:r,opts:{useDefaults:s}}=e;if(s)Vk.assignDefaults(e,t.type);n.block(()=>{for(let o of t.rules)if(ca.shouldUseRule(r,o))Xk(e,o.keyword,o.definition,t.type)})}function GW(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;if(XW(e,t),!e.opts.allowUnionTypes)YW(e,t);ZW(e,e.dataTypes)}function XW(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((n)=>{if(!Gk(e.dataTypes,n))Fx(e,`type "${n}" not allowed by context "${e.dataTypes.join(",")}"`)}),eB(e,t)}function YW(e,t){if(t.length>1&&!(t.length===2&&t.includes("null")))Fx(e,"use allowUnionTypes to allow union type keyword")}function ZW(e,t){let n=e.self.RULES.all;for(let r in n){let s=n[r];if(typeof s=="object"&&ca.shouldUseRule(e.schema,s)){let{type:o}=s.definition;if(o.length&&!o.some((i)=>QW(t,i)))Fx(e,`missing type "${o.join(",")}" for keyword "${r}"`)}}}function QW(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Gk(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function eB(e,t){let n=[];for(let r of e.dataTypes)if(Gk(t,r))n.push(r);else if(t.includes("integer")&&r==="number")n.push("integer");e.dataTypes=n}function Fx(e,t){let n=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${n}" (strictTypes)`,It.checkStrictMode(e,t,e.opts.strictTypes)}class Vx{constructor(e,t,n){if(Mr.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=It.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",Yk(this.$data,e));else if(this.schemaCode=this.schemaValue,!Mr.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",ye.default.errors)}result(e,t,n){this.failResult(F.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(F.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(F._`${t} !== undefined && (${F.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?Jr.reportExtraError:Jr.reportError)(this,this.def.error,t)}$dataError(){Jr.reportError(this,this.def.$dataError||Jr.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');Jr.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=F.nil){this.gen.block(()=>{this.check$data(e,n),t()})}check$data(e=F.nil,t=F.nil){if(!this.$data)return;let{gen:n,schemaCode:r,schemaType:s,def:o}=this;if(n.if(F.or(F._`${r} === undefined`,t)),e!==F.nil)n.assign(e,!0);if(s.length||o.validateSchema){if(n.elseIf(this.invalid$data()),this.$dataError(),e!==F.nil)n.assign(e,!1)}n.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:n,def:r,it:s}=this;return F.or(o(),i());function o(){if(n.length){if(!(t instanceof F.Name))throw Error("ajv implementation error");let a=Array.isArray(n)?n:[n];return F._`${Ks.checkDataTypes(a,t,s.opts.strictNumbers,Ks.DataType.Wrong)}`}return F.nil}function i(){if(r.validateSchema){let a=e.scopeValue("validate$data",{ref:r.validateSchema});return F._`!${a}(${t})`}return F.nil}}subschema(e,t){let n=la.getSubschema(this.it,e);la.extendSubschemaData(n,this.it,e),la.extendSubschemaMode(n,e);let r={...this.it,...n,items:void 0,props:void 0};return VW(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=It.mergeEvaluated.props(r,e.props,n.props,t);if(n.items!==!0&&e.items!==void 0)n.items=It.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,F.Name)),!0}}Zk.KeywordCxt=Vx;function Xk(e,t,n,r){let s=new Vx(e,n,t);if("code"in n)n.code(s,r);else if(s.$data&&n.validate)Mr.funcKeywordCode(s,n);else if("macro"in n)Mr.macroKeywordCode(s,n);else if(n.compile||n.validate)Mr.funcKeywordCode(s,n)}var tB=/^\/(?:[^~]|~0|~1)*$/,nB=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Yk(e,{dataLevel:t,dataNames:n,dataPathArr:r}){let s,o;if(e==="")return ye.default.rootData;if(e[0]==="/"){if(!tB.test(e))throw Error(`Invalid JSON-pointer: ${e}`);s=e,o=ye.default.rootData}else{let c=nB.exec(e);if(!c)throw Error(`Invalid JSON-pointer: ${e}`);let u=+c[1];if(s=c[2],s==="#"){if(u>=t)throw Error(l("property/index",u));return r[t-u]}if(u>t)throw Error(l("data",u));if(o=n[t-u],!s)return o}let i=o,a=s.split("/");for(let c of a)if(c)o=F._`${o}${F.getProperty(It.unescapeJsonPointer(c))}`,i=F._`${i} && ${o}`;return i;function l(c,u){return`Cannot access ${c} ${u} levels up, current level is ${t}`}}Zk.getData=Yk});var cc=W(function(tO){Object.defineProperty(tO,"__esModule",{value:!0});class eO extends Error{constructor(e){super("validation failed");this.errors=e,this.ajv=this.validation=!0}}tO.default=eO});var da=W(function(rO){Object.defineProperty(rO,"__esModule",{value:!0});var fa=lc();class nO extends Error{constructor(e,t,n,r){super(r||`can't resolve reference ${n} from id ${t}`);this.missingRef=fa.resolveUrl(e,t,n),this.missingSchema=fa.normalizeId(fa.getFullPath(e,this.missingRef))}}rO.default=nO});var fc=W(function(iO){Object.defineProperty(iO,"__esModule",{value:!0});iO.resolveSchema=iO.getCompilingSchema=iO.resolveRef=iO.compileSchema=iO.SchemaEnv=void 0;var ht=$e(),aB=cc(),zo=Kn(),gt=lc(),Ed=Oe(),sO=ua();class uc{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:gt.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={}}}iO.SchemaEnv=uc;function Hx(e){let t=oO.call(this,e);if(t)return t;let n=gt.getFullPath(this.opts.uriResolver,e.root.baseId),{es5:r,lines:s}=this.opts.code,{ownProperties:o}=this.opts,i=new ht.CodeGen(this.scope,{es5:r,lines:s,ownProperties:o}),a;if(e.$async)a=i.scopeValue("Error",{ref:aB.default,code:ht._`require("ajv/dist/runtime/validation_error").default`});let l=i.scopeName("validate");e.validateName=l;let c={gen:i,allErrors:this.opts.allErrors,data:zo.default.data,parentData:zo.default.parentData,parentDataProperty:zo.default.parentDataProperty,dataNames:[zo.default.data],dataPathArr:[ht.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:ht.stringify(e.schema)}:{ref:e.schema}),validateName:l,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:n,baseId:e.baseId||n,schemaPath:ht.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:ht._`""`,opts:this.opts,self:this},u;try{this._compilations.add(e),sO.validateFunctionCode(c),i.optimize(this.opts.code.optimize);let d=i.toString();if(u=`${i.scopeRefs(zo.default.scope)}return ${d}`,this.opts.code.process)u=this.opts.code.process(u,e);let m=Function(`${zo.default.self}`,`${zo.default.scope}`,u)(this,this.scope.get());if(this.scope.value(l,{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:l,validateCode:d,scopeValues:i._values};if(this.opts.unevaluated){let{props:y,items:S}=c;if(m.evaluated={props:y instanceof ht.Name?void 0:y,items:S instanceof ht.Name?void 0:S,dynamicProps:y instanceof ht.Name,dynamicItems:S instanceof ht.Name},m.source)m.source.evaluated=ht.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)}}iO.compileSchema=Hx;function lB(e,t,n){var r;n=gt.resolveUrl(this.opts.uriResolver,t,n);let s=e.refs[n];if(s)return s;let o=fB.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 uc({schema:i,schemaId:a,root:e,baseId:t})}if(o===void 0)return;return e.refs[n]=cB.call(this,o)}iO.resolveRef=lB;function cB(e){if(gt.inlineRef(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:Hx.call(this,e)}function oO(e){for(let t of this._compilations)if(uB(t,e))return t}iO.getCompilingSchema=oO;function uB(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function fB(e,t){let n;while(typeof(n=this.refs[t])=="string")t=n;return n||this.schemas[t]||jd.call(this,e,t)}function jd(e,t){let n=this.opts.uriResolver.parse(t),r=gt._getFullPath(this.opts.uriResolver,n),s=gt.getFullPath(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&r===s)return qx.call(this,n,e);let o=gt.normalizeId(r),i=this.refs[o]||this.schemas[o];if(typeof i=="string"){let a=jd.call(this,e,i);if(typeof(a===null||a===void 0?void 0:a.schema)!=="object")return;return qx.call(this,n,a)}if(typeof(i===null||i===void 0?void 0:i.schema)!=="object")return;if(!i.validate)Hx.call(this,i);if(o===gt.normalizeId(t)){let{schema:a}=i,{schemaId:l}=this.opts,c=a[l];if(c)s=gt.resolveUrl(this.opts.uriResolver,s,c);return new uc({schema:a,schemaId:l,root:e,baseId:s})}return qx.call(this,n,i)}iO.resolveSchema=jd;var dB=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function qx(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 l=n[Ed.unescapeFragment(a)];if(l===void 0)return;n=l;let c=typeof n==="object"&&n[this.opts.schemaId];if(!dB.has(a)&&c)t=gt.resolveUrl(this.opts.uriResolver,t,c)}let o;if(typeof n!="boolean"&&n.$ref&&!Ed.schemaHasRulesButRef(n,this.RULES)){let a=gt.resolveUrl(this.opts.uriResolver,t,n.$ref);o=jd.call(this,r,a)}let{schemaId:i}=this.opts;if(o=o||new uc({schema:n,schemaId:i,root:r,baseId:t}),o.schema!==o.root.schema)return o;return}});var lO=W(function(Rre,yB){yB.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 Gx=W(function(Nre,gO){var xB=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Bx=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),bB=RegExp.prototype.test.bind(/^\d*$/u),Ko=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),Ux=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),uO=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),zx=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),$B=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),$n=Array(256);for(let t=0;t<256;t++)$n[t]="%"+"0123456789ABCDEF"[t>>4]+"0123456789ABCDEF"[t&15];function Yt(e){if(e<2048)return $n[192|e>>6]+$n[128|e&63];if(e<65536)return $n[224|e>>12]+$n[128|e>>6&63]+$n[128|e&63];return $n[240|e>>18]+$n[128|e>>12&63]+$n[128|e>>6&63]+$n[128|e&63]}function SB(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 wB=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),vB=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),EB=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),jB=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function PB(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++){if(EB(e[t]))continue;if(e[t]==="%"&&t+2<e.length&&Ko(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function cO(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 _B(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 l=s[a];if(l==="")return;if(l.indexOf(".")!==-1){if(a!==s.length-1||t!==-1&&r.length===0||!Bx(l))return;o+=2;continue}if(!wB(l))return;s[a]=parseInt(l,16).toString(16),o++}if(t===-1){if(o!==8)return;return cO(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 cO(i)}function Wx(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&&vB(r))return r=r.toLowerCase(),{host:`[${r}]`,escapedHost:r,isIPV6:!1,isIPVFuture:!0};if(kB(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),!PB(s))return{host:e,isIPV6:!1,error:!0};r=r.slice(0,o)}let i=_B(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 kB(e,t){let n=0;for(let r=0;r<e.length;r++)if(e[r]===t)n++;return n}function fO(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 OB(e){if(e===""||e[0]==="/")return fO(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 AB={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},CB=/[@/?#:]/g,RB=/[@/?#]/g;function dO(e,t){let n=t?RB:CB;return n.lastIndex=0,e.replace(n,(r)=>AB[r])}function pO(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(Ko(s)){let o=s.toUpperCase(),i=String.fromCharCode(parseInt(o,16));if(t&&Ux(i))n+=i;else n+="%"+o;r+=2;continue}}n+=e[r]}return n}function NB(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(Ko(s)){let o=s.toUpperCase(),i=String.fromCharCode(parseInt(o,16));if(i!=="."&&Ux(i))t+=i;else t+="%"+o;n+=2;continue}}if(uO(r))t+=r;else{let s=e.charCodeAt(n);if(s<128)t+=hO(s)?r:$n[s];else if(s<55296||s>57343)t+=Yt(s);else if(s<=56319&&n+1<e.length){let o=e.charCodeAt(n+1);if(o>=56320&&o<=57343)t+=Yt(65536+(s-55296<<10)+(o-56320)),n++;else t+=Yt(65533)}else t+=Yt(65533)}}return t}function TB(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(Ko(i)){n+="%"+i.toUpperCase(),s+=2;continue}}if(o==="/")r=!1;if(uO(o)&&(o!==":"||!r))n+=o;else{let i=e.charCodeAt(s);if(i<128)n+=$n[i];else if(i<55296||i>57343)n+=Yt(i);else if(i<=56319&&s+1<e.length){let a=e.charCodeAt(s+1);if(a>=56320&&a<=57343)n+=Yt(65536+(i-55296<<10)+(a-56320)),s++;else n+=Yt(65533)}else n+=Yt(65533)}}return n}function Kx(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(Ko(o)){n+="%"+o.toUpperCase(),r+=2;continue}}if(t(s))n+=s;else{let o=e.charCodeAt(r);if(o<128)n+=$n[o];else if(o<55296||o>57343)n+=Yt(o);else if(o<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);if(i>=56320&&i<=57343)n+=Yt(65536+(o-55296<<10)+(i-56320)),r++;else n+=Yt(65533)}else n+=Yt(65533)}}return n}function mO(e){return Kx(e,$B)}function JB(e){return Kx(e,zx)}function MB(e){return Kx(e,zx)}function hO(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 IB(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(Ko(s)){let o=s.toUpperCase(),i=String.fromCharCode(parseInt(o,16));if(Ux(i))t+=i;else t+="%"+o;n+=2;continue}}if(zx(r))t+=r;else{let s=e.charCodeAt(n);if(s<128)t+=hO(s)?r:$n[s];else if(s<55296||s>57343)t+=Yt(s);else if(s<=56319&&n+1<e.length){let o=e.charCodeAt(n+1);if(o>=56320&&o<=57343)t+=Yt(65536+(s-55296<<10)+(o-56320)),n++;else t+=Yt(65533)}else t+=Yt(65533)}}return t}function DB(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(Ko(r)){t+="%"+r.toUpperCase(),n+=2;continue}}t+=escape(e[n])}return t}function LB(e){let t=[];if(e.userinfo!==void 0)t.push(mO(e.userinfo)),t.push("@");if(e.host!==void 0){let n=e.host;if(!Bx(n)){let r=Wx(n);if(r.isIPV6!==!0&&r.isIPVFuture!==!0)n=pO(n,!0),r=Wx(n);if(r.isIPV6===!0||r.isIPVFuture===!0)n=`[${r.escapedHost}]`;else n=dO(n,!1)}t.push(n)}if(typeof e.port==="number"||typeof e.port==="string"){let n=String(e.port);if(!bB(n))throw TypeError("URI port is malformed.");t.push(":"),t.push(n)}return t.length?t.join(""):void 0}gO.exports={nonSimpleDomain:jB,recomposeAuthority:LB,reescapeHostDelimiters:dO,normalizePercentEncoding:pO,normalizePathEncoding:NB,serializePathEncoding:TB,normalizeQueryFragmentEncoding:IB,encodeUserinfo:mO,encodeQuery:JB,encodeFragment:MB,escapePreservingEscapes:DB,removeDotSegments:fO,removeDotSegmentsRelative:OB,isIPv4:Bx,isUUID:xB,normalizeIPv6:Wx,stringArrayToHexStripped:SB}});var SO=W(function(Tre,$O){var{isUUID:FB}=Gx(),VB=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,qB=["http","https","ws","wss","urn","urn:uuid"];function HB(e){return qB.indexOf(e)!==-1}function Xx(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 yO(e){if(!e.host)e.error=e.error||"HTTP URIs must have a host.";return e}function xO(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 WB(e){return e.secure=Xx(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function BB(e){if(e.port===(Xx(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 UB(e,t){if(!e.path)return e.error="URN can not be parsed",e;let n=e.path.match(VB);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=Yx(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 zB(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=Yx(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 KB(e,t){let n=e;if(n.uuid=n.nss,n.nss=void 0,!t.tolerant&&(!n.uuid||!FB(n.uuid)))n.error=n.error||"UUID is not valid.";return n}function GB(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var bO={scheme:"http",domainHost:!0,parse:yO,serialize:xO},XB={scheme:"https",domainHost:bO.domainHost,parse:yO,serialize:xO},Pd={scheme:"ws",domainHost:!0,parse:WB,serialize:BB},YB={scheme:"wss",domainHost:Pd.domainHost,parse:Pd.parse,serialize:Pd.serialize},ZB={scheme:"urn",parse:UB,serialize:zB,skipNormalize:!0},QB={scheme:"urn:uuid",parse:KB,serialize:GB,skipNormalize:!0},_d={http:bO,https:XB,ws:Pd,wss:YB,urn:ZB,"urn:uuid":QB};Object.setPrototypeOf(_d,null);function Yx(e){return e&&(_d[e]||_d[e.toLowerCase()])||void 0}$O.exports={wsIsSecure:Xx,SCHEMES:_d,isValidSchemeName:HB,getSchemeHandler:Yx}});var JO=W(function(Jre,Cd){var{normalizeIPv6:PO,removeDotSegments:pc,removeDotSegmentsRelative:_O,recomposeAuthority:eU,normalizePercentEncoding:Zx,normalizePathEncoding:tU,serializePathEncoding:wO,normalizeQueryFragmentEncoding:vO,encodeQuery:nU,encodeFragment:rU,reescapeHostDelimiters:sU,isIPv4:kO,nonSimpleDomain:oU}=Gx(),{SCHEMES:OO,getSchemeHandler:Qx}=SO(),AO=/^[A-Za-z][A-Za-z0-9+.-]*$/u,iU=/[\0-\x20"#/:<>?@[\\\]^`{|}\x7F]/u;function EO(e){let t=String(e);if(!AO.test(t))throw TypeError("URI scheme is malformed.");return t}function aU(e,t){if(typeof e==="string")e=gU(e,t);else if(typeof e==="object")e=Od(Go(e,t),t);return e}function lU(e,t,n){let r=n?Object.assign({scheme:"null"},n):{scheme:"null"},{parsed:s,malformedAuthorityOrPort:o,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:l,malformedScheme:c}=kd(e,r),{parsed:u,malformedAuthorityOrPort:d,malformedPercentEncoding:p,malformedSchemeSpecific:m,malformedHost:y,malformedScheme:S}=kd(t,r);if(o||d||i||p||a||m||l||y||c||S)throw Error(s.error||u.error||"URI is malformed.");let g=CO(s,u,r,!0),x=Qx(n&&n.scheme||g.scheme),P=g.host,w=P!==void 0&&P!==""&&(kO(P)||PO(P).isIPV6);if(NO(g,n||{},x,w))throw Error("URI host is malformed.");RO(g,n||{},x,w);let E=P&&P.indexOf("%")!==-1&&!/\P{ASCII}/u.test(P);if(g.error&&!E)throw Error(g.error);return r.skipEscape=!0,Go(g,r)}function CO(e,t,n,r){let s={};if(!r)e=Od(Go(e,n),n),t=Od(Go(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=pc(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=pc(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=pc(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]!=="/"?_O(s.path):pc(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 cU(e,t,n){let r=jO(e,n),s=jO(t,n);return r!==void 0&&s!==void 0&&r===s}function Go(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=EO(n.scheme);let o=Qx(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,l=!r.skipEscape&&a;if(n.path!==void 0)if(!r.skipEscape)n.path=wO(n.path,l);else n.path=Zx(n.path);if(r.reference!=="suffix"&&n.scheme)n.scheme=EO(n.scheme),s.push(n.scheme,":");let c=eU(n);if(c!==void 0){if(r.reference!=="suffix")s.push("//");if(s.push(c),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]!=="/"?_O(u):pc(u);if(a)u=wO(u,!0);if(c===void 0&&u[0]==="/"&&u[1]==="/")u="/%2F"+u.slice(2);s.push(u)}if(n.query!==void 0)s.push("?",nU(n.query));if(n.fragment!==void 0)s.push("#",rU(n.fragment));return s.join("")}var uU=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,fU=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,dU=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function pU(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 dc(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 Ad(e){return e[0]==="["&&e[e.length-1]==="]"}function mU(e){let t=e[4];return dc(e[3])||t!==void 0&&!Ad(t)&&dc(t)||dc(e[6])||dc(e[7])||dc(e[8])}function RO(e,t,n,r){if(NO(e,t,n,r))return e.error=e.error||"URI host is malformed.",!0;if(!t.unicodeSupport&&(!n||!n.unicodeSupport)&&e.host&&!Ad(e.host)&&(t.domainHost||n&&n.domainHost)&&r===!1&&oU(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(!hU(s))return e.error=e.error||"URI host is malformed.",!0;e.host=s.hostname}return!1}function NO(e,t,n,r){return Boolean(e.host&&r===!1&&!Ad(e.host)&&(t.domainHost||n&&n.domainHost)&&iU.test(e.host))}function hU(e){return e.username===""&&e.password===""&&e.port===""&&e.pathname==="/"&&e.search===""&&e.hash===""&&e.hostname!==""}function kd(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,l=!1,c=!1,u=!1;if(n.reference==="suffix")if(n.scheme)e=n.scheme+":"+e;else e="//"+e;let d=e.match(fU);if(d!==null&&d[1].indexOf("\\")!==-1)r.error="URI authority must not contain a literal backslash.",s=!0;let p=e.match(dU);if(p!==null){let y=p[1],S=y.replace(/[\t\n\r]/g,"");if(S.length>=2){if(S.slice(0,2)!=="//")r.error=r.error||"URI authority must not contain a literal backslash.",s=!0;else if(y.length!==S.length)r.error=r.error||"URI authority introducer must not contain whitespace.",s=!0}}let m=e.match(uU);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(AO.test(r.scheme))r.scheme=r.scheme.toLowerCase();else r.error=r.error||"URI scheme is malformed.",c=!0;if(o=mU(m),o)r.error=r.error||"URI contains malformed percent-encoding.";if(isNaN(r.port))r.port=m[5];let y=pU(r,m);if(y!==void 0)r.error=r.error||y,s=!0;if(r.host)if(kO(r.host)===!1){let x=Ad(r.host),P=r.host.indexOf("[")!==-1||r.host.indexOf("]")!==-1,w=PO(r.host);if(u=w.isIPV6||w.isIPVFuture===!0,l=P&&(!x||w.error===!0),r.host=u?w.host:w.host.toLowerCase(),l)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 S=Qx(n.scheme||r.scheme);if(!l)a=RO(r,n,S,u);if(e.indexOf("%")!==-1&&r.host!==void 0&&!l){let g=u?r.host:Zx(r.host,!0);if(!u)g=Zx(g.toLowerCase());r.host=u||n.scheme!=="null"?sU(g,u):g}if(!S||S&&!S.skipNormalize){if(r.path)r.path=tU(r.path);if(r.query)r.query=vO(r.query);if(r.fragment)r.fragment=vO(r.fragment)}if(S&&S.parse){if(S.parse(r,n),S===OO.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:c}}function Od(e,t){return kd(e,t).parsed}function gU(e,t){return TO(e,t).normalized}function TO(e,t){let{parsed:n,malformedAuthorityOrPort:r,malformedPercentEncoding:s,malformedSchemeSpecific:o,malformedHost:i,malformedScheme:a}=kd(e,t);return{normalized:r||s||o||i||a?e:Go(n,t),malformedAuthorityOrPort:r,malformedPercentEncoding:s,malformedSchemeSpecific:o,malformedHost:i,malformedScheme:a}}function jO(e,t){if(typeof e!=="string"&&typeof e!=="object")return;let n;try{n=typeof e==="string"?e:Go(e,t)}catch{return}let{normalized:r,malformedAuthorityOrPort:s,malformedPercentEncoding:o,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:l}=TO(n,t);return s||o||i||a||l?void 0:r}var eb={SCHEMES:OO,normalize:aU,resolve:lU,resolveComponent:CO,equal:cU,serialize:Go,parse:Od};Cd.exports=eb;Cd.exports.default=eb;Cd.exports.fastUri=eb});var DO=W(function(IO){Object.defineProperty(IO,"__esModule",{value:!0});var MO=JO();MO.code='require("ajv/dist/runtime/uri").default';IO.default=MO});var nb=W(function(xs){Object.defineProperty(xs,"__esModule",{value:!0});xs.CodeGen=xs.Name=xs.nil=xs.stringify=xs.str=xs._=xs.KeywordCxt=void 0;var xU=ua();Object.defineProperty(xs,"KeywordCxt",{enumerable:!0,get:function(){return xU.KeywordCxt}});var ma=$e();Object.defineProperty(xs,"_",{enumerable:!0,get:function(){return ma._}});Object.defineProperty(xs,"str",{enumerable:!0,get:function(){return ma.str}});Object.defineProperty(xs,"stringify",{enumerable:!0,get:function(){return ma.stringify}});Object.defineProperty(xs,"nil",{enumerable:!0,get:function(){return ma.nil}});Object.defineProperty(xs,"Name",{enumerable:!0,get:function(){return ma.Name}});Object.defineProperty(xs,"CodeGen",{enumerable:!0,get:function(){return ma.CodeGen}});var bU=cc(),HO=da(),WO=Cx(),Ir=fc(),BO=$e(),Dr=lc(),Gs=ac(),pa=Oe(),LO=lO(),$U=DO(),UO=(e,t)=>new RegExp(e,t);UO.code="new RegExp";var SU=["removeAdditional","useDefaults","coerceTypes"],wU=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),vU={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."},EU={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},FO=200;function jU(e){var t,n,r,s,o,i,a,l,c,u,d,p,m,y,S,g,x,P,w,E,j,A,T,I,V;let H=e.strict,O=(t=e.code)===null||t===void 0?void 0:t.optimize,N=O===!0||O===void 0?1:O||0,G=(r=(n=e.code)===null||n===void 0?void 0:n.regExp)!==null&&r!==void 0?r:UO,Q=(s=e.uriResolver)!==null&&s!==void 0?s:$U.default;return{strictSchema:(i=(o=e.strictSchema)!==null&&o!==void 0?o:H)!==null&&i!==void 0?i:!0,strictNumbers:(l=(a=e.strictNumbers)!==null&&a!==void 0?a:H)!==null&&l!==void 0?l:!0,strictTypes:(u=(c=e.strictTypes)!==null&&c!==void 0?c: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:(y=(m=e.strictRequired)!==null&&m!==void 0?m:H)!==null&&y!==void 0?y:!1,code:e.code?{...e.code,optimize:N,regExp:G}:{optimize:N,regExp:G},loopRequired:(S=e.loopRequired)!==null&&S!==void 0?S:FO,loopEnum:(g=e.loopEnum)!==null&&g!==void 0?g:FO,meta:(x=e.meta)!==null&&x!==void 0?x:!0,messages:(P=e.messages)!==null&&P!==void 0?P:!0,inlineRefs:(w=e.inlineRefs)!==null&&w!==void 0?w:!0,schemaId:(E=e.schemaId)!==null&&E!==void 0?E:"$id",addUsedSchema:(j=e.addUsedSchema)!==null&&j!==void 0?j:!0,validateSchema:(A=e.validateSchema)!==null&&A!==void 0?A:!0,validateFormats:(T=e.validateFormats)!==null&&T!==void 0?T:!0,unicodeRegExp:(I=e.unicodeRegExp)!==null&&I!==void 0?I:!0,int32range:(V=e.int32range)!==null&&V!==void 0?V:!0,uriResolver:Q}}class Rd{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,...jU(e)};let{es5:t,lines:n}=this.opts.code;this.scope=new BO.ValueScope({scope:{},prefixes:wU,es5:t,lines:n}),this.logger=CU(e.logger);let r=e.validateFormats;if(e.validateFormats=!1,this.RULES=WO.getRules(),VO.call(this,vU,e,"NOT SUPPORTED"),VO.call(this,EU,e,"DEPRECATED","warn"),this._metaOpts=OU.call(this),e.formats)_U.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords)kU.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);PU.call(this),e.validateFormats=r}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:n}=this.opts,r=LO;if(n==="id")r={...LO},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(c,u){await s.call(this,c.$schema);let d=this._addSchema(c,u);return d.validate||o.call(this,d)}async function s(c){if(c&&!this.getSchema(c))await r.call(this,{$ref:c},!0)}async function o(c){try{return this._compileSchemaEnv(c)}catch(u){if(!(u instanceof HO.default))throw u;return i.call(this,u),await a.call(this,u.missingSchema),o.call(this,c)}}function i({missingSchema:c,missingRef:u}){if(this.refs[c])throw Error(`AnySchema ${c} is loaded but ${u} cannot be resolved`)}async function a(c){let u=await l.call(this,c);if(!this.refs[c])await s.call(this,u.$schema);if(!this.refs[c])this.addSchema(u,c,t)}async function l(c){let u=this._loading[c];if(u)return u;try{return await(this._loading[c]=n(c))}finally{delete this._loading[c]}}}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=Dr.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=qO.call(this,e))=="string")e=t;if(t===void 0){let{schemaId:n}=this.opts,r=new Ir.SchemaEnv({schema:{},schemaId:n});if(t=Ir.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=qO.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=Dr.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(NU.call(this,n,t),!t)return pa.eachItem(n,(s)=>tb.call(this,s)),this;JU.call(this,t);let r={...t,type:Gs.getJSONTypes(t.type),schemaType:Gs.getJSONTypes(t.schemaType)};return pa.eachItem(n,r.type.length===0?(s)=>tb.call(this,s,r):(s)=>r.type.forEach((o)=>tb.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:l}=a.definition,c=o[i];if(l&&c)o[i]=zO(c)}}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=Dr.normalizeId(o||n);let l=Dr.getSchemaRefs.call(this,e,n);if(a=new Ir.SchemaEnv({schema:e,schemaId:i,meta:t,baseId:n,localRefs:l}),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 Ir.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{Ir.compileSchema.call(this,e)}finally{this.opts=t}}}Rd.ValidationError=bU.default;Rd.MissingRefError=HO.default;xs.default=Rd;function VO(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 qO(e){return e=Dr.normalizeId(e),this.schemas[e]||this.refs[e]}function PU(){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 _U(){for(let e in this.opts.formats){let t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function kU(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 OU(){let e={...this.opts};for(let t of SU)delete e[t];return e}var AU={log(){},warn(){},error(){}};function CU(e){if(e===!1)return AU;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 RU=/^[a-z_$][a-z0-9_$:-]*$/i;function NU(e,t){let{RULES:n}=this;if(pa.eachItem(e,(r)=>{if(n.keywords[r])throw Error(`Keyword ${r} is already defined`);if(!RU.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 tb(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:l})=>l===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:Gs.getJSONTypes(t.type),schemaType:Gs.getJSONTypes(t.schemaType)}};if(t.before)TU.call(this,i,a,t.before);else i.rules.push(a);o.all[e]=a,(r=t.implements)===null||r===void 0||r.forEach((l)=>this.addKeyword(l))}function TU(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 JU(e){let{metaSchema:t}=e;if(t===void 0)return;if(e.$data&&this.opts.$data)t=zO(t);e.validateSchema=this.compile(t,!0)}var MU={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function zO(e){return{anyOf:[e,MU]}}});var GO=W(function(KO){Object.defineProperty(KO,"__esModule",{value:!0});var LU={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};KO.default=LU});var Md=W(function(YO){Object.defineProperty(YO,"__esModule",{value:!0});YO.callRef=YO.getValidate=void 0;var VU=da(),Td=Xn(),Ke=$e(),ha=Kn(),Jd=fc(),Xs=Oe(),qU={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:n,it:r}=e,{baseId:s,schemaEnv:o,validateName:i,opts:a,self:l}=r,{root:c}=o;if((n==="#"||n==="#/")&&s===c.baseId)return d();let u=Jd.resolveRef.call(l,c,s,n);if(u===void 0)throw new VU.default(r.opts.uriResolver,s,n);if(u instanceof Jd.SchemaEnv)return p(u);return m(u);function d(){if(o===c)return Nd(e,i,o,o.$async);let y=t.scopeValue("root",{ref:c});return Nd(e,Ke._`${y}.validate`,c,c.$async)}function p(y){let S=XO(e,y);Nd(e,S,y,y.$async)}function m(y){let S=t.scopeValue("schema",a.code.source===!0?{ref:y,code:Ke.stringify(y)}:{ref:y}),g=t.name("valid"),x=e.subschema({schema:y,dataTypes:[],schemaPath:Ke.nil,topSchemaRef:S,errSchemaPath:n},g);e.mergeEvaluated(x),e.ok(g)}}};function XO(e,t){let{gen:n}=e;return t.validate?n.scopeValue("validate",{ref:t.validate}):Ke._`${n.scopeValue("wrapper",{ref:t})}.validate`}YO.getValidate=XO;function Nd(e,t,n,r){let{gen:s,it:o}=e,{allErrors:i,schemaEnv:a,opts:l}=o,c=l.passContext?ha.default.this:Ke.nil;if(r)u();else d();function u(){if(!a.$async)throw Error("async schema referenced by sync schema");let y=s.let("valid");s.try(()=>{if(s.code(Ke._`await ${Td.callValidateCode(e,t,c)}`),m(t),!i)s.assign(y,!0)},(S)=>{if(s.if(Ke._`!(${S} instanceof ${o.ValidationError})`,()=>s.throw(S)),p(S),!i)s.assign(y,!1)}),e.ok(y)}function d(){e.result(Td.callValidateCode(e,t,c),()=>m(t),()=>p(t))}function p(y){let S=Ke._`${y}.errors`;s.assign(ha.default.vErrors,Ke._`${ha.default.vErrors} === null ? ${S} : ${ha.default.vErrors}.concat(${S})`),s.assign(ha.default.errors,Ke._`${ha.default.vErrors}.length`)}function m(y){var S;if(!o.opts.unevaluated)return;let g=(S=n===null||n===void 0?void 0:n.validate)===null||S===void 0?void 0:S.evaluated;if(o.props!==!0)if(g&&!g.dynamicProps){if(g.props!==void 0)o.props=Xs.mergeEvaluated.props(s,g.props,o.props)}else{let x=s.var("props",Ke._`${y}.evaluated.props`);o.props=Xs.mergeEvaluated.props(s,x,o.props,Ke.Name)}if(o.items!==!0)if(g&&!g.dynamicItems){if(g.items!==void 0)o.items=Xs.mergeEvaluated.items(s,g.items,o.items)}else{let x=s.var("items",Ke._`${y}.evaluated.items`);o.items=Xs.mergeEvaluated.items(s,x,o.items,Ke.Name)}}}YO.callRef=Nd;YO.default=qU});var rb=W(function(QO){Object.defineProperty(QO,"__esModule",{value:!0});var BU=GO(),UU=Md(),zU=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",BU.default,UU.default];QO.default=zU});var tA=W(function(eA){Object.defineProperty(eA,"__esModule",{value:!0});var Zs=$e(),Ys=Zs.operators,Id={maximum:{okStr:"<=",ok:Ys.LTE,fail:Ys.GT},minimum:{okStr:">=",ok:Ys.GTE,fail:Ys.LT},exclusiveMaximum:{okStr:"<",ok:Ys.LT,fail:Ys.GTE},exclusiveMinimum:{okStr:">",ok:Ys.GT,fail:Ys.LTE}},GU={message:({keyword:e,schemaCode:t})=>Zs.str`must be ${Id[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>Zs._`{comparison: ${Id[e].okStr}, limit: ${t}}`},XU={keyword:Object.keys(Id),type:"number",schemaType:"number",$data:!0,error:GU,code(e){let{keyword:t,data:n,schemaCode:r}=e;e.fail$data(Zs._`${n} ${Id[t].fail} ${r} || isNaN(${n})`)}};eA.default=XU});var rA=W(function(nA){Object.defineProperty(nA,"__esModule",{value:!0});var Lr=$e(),ZU={message:({schemaCode:e})=>Lr.str`must be multiple of ${e}`,params:({schemaCode:e})=>Lr._`{multipleOf: ${e}}`},QU={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:ZU,code(e){let{gen:t,data:n,schemaCode:r,it:s}=e,o=s.opts.multipleOfPrecision,i=t.let("res"),a=o?Lr._`Math.abs(Math.round(${i}) - ${i}) > 1e-${o}`:Lr._`${i} !== parseInt(${i})`;e.fail$data(Lr._`(${r} === 0 || (${i} = ${n}/${r}, ${a}))`)}};nA.default=QU});var iA=W(function(oA){Object.defineProperty(oA,"__esModule",{value:!0});function sA(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}oA.default=sA;sA.code='require("ajv/dist/runtime/ucs2length").default'});var cA=W(function(lA){Object.defineProperty(lA,"__esModule",{value:!0});var Sn=$e(),aA=Oe(),nz=iA(),rz={message({keyword:e,schemaCode:t}){return Sn.str`must NOT have ${e==="maxLength"?"more":"fewer"} than ${t} characters`},params:({schemaCode:e})=>Sn._`{limit: ${e}}`},sz={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:rz,code(e){let{keyword:t,data:n,schemaCode:r,it:s}=e,o=t==="maxLength"?Sn.operators.GT:Sn.operators.LT,i=s.opts.unicode===!1?Sn._`${n}.length`:Sn._`${aA.useFunc(e.gen,nz.default)}(${n})`;e.fail$data(Sn._`${i} ${o} ${r}`)}};lA.default=sz});var pA=W(function(dA){Object.defineProperty(dA,"__esModule",{value:!0});var uA=Xn(),fA=Oe(),Yn=$e(),iz={message:({schemaCode:e})=>Yn.str`must match pattern "${e}"`,params:({schemaCode:e})=>Yn._`{pattern: ${e}}`},az={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:iz,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:l}=i.opts.code,c=l.code==="new RegExp"?Yn._`new RegExp`:fA.useFunc(t,l),u=t.let("valid");t.try(()=>t.assign(u,Yn._`${c}(${o}, ${a}).test(${n})`),()=>t.assign(u,!1)),e.fail$data(Yn._`!${u}`)}else{let l=uA.usePattern(e,s);e.fail$data(Yn._`!${l}.test(${n})`)}}};dA.default=az});var hA=W(function(mA){Object.defineProperty(mA,"__esModule",{value:!0});var Fr=$e(),cz={message({keyword:e,schemaCode:t}){return Fr.str`must NOT have ${e==="maxProperties"?"more":"fewer"} than ${t} properties`},params:({schemaCode:e})=>Fr._`{limit: ${e}}`},uz={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:cz,code(e){let{keyword:t,data:n,schemaCode:r}=e,s=t==="maxProperties"?Fr.operators.GT:Fr.operators.LT;e.fail$data(Fr._`Object.keys(${n}).length ${s} ${r}`)}};mA.default=uz});var xA=W(function(yA){Object.defineProperty(yA,"__esModule",{value:!0});var Vr=Xn(),qr=$e(),gA=Oe(),dz={message:({params:{missingProperty:e}})=>qr.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>qr._`{missingProperty: ${e}}`},pz={keyword:"required",type:"object",schemaType:"array",$data:!0,error:dz,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 l=n.length>=a.loopRequired;if(i.allErrors)c();else u();if(a.strictRequired){let m=e.parentSchema.properties,{definedProperties:y}=e.it;for(let S of n)if((m===null||m===void 0?void 0:m[S])===void 0&&!y.has(S)){let g=i.schemaEnv.baseId+i.errSchemaPath,x=`required property "${S}" is not defined at "${g}" (strictRequired)`;gA.checkStrictMode(i,x,i.opts.strictRequired)}}function c(){if(l||o)e.block$data(qr.nil,d);else for(let m of n)Vr.checkReportMissingProp(e,m)}function u(){let m=t.let("missing");if(l||o){let y=t.let("valid",!0);e.block$data(y,()=>p(m,y)),e.ok(y)}else t.if(Vr.checkMissingProp(e,n,m)),Vr.reportMissingProp(e,m),t.else()}function d(){t.forOf("prop",r,(m)=>{e.setParams({missingProperty:m}),t.if(Vr.noPropertyInData(t,s,m,a.ownProperties),()=>e.error())})}function p(m,y){e.setParams({missingProperty:m}),t.forOf(m,r,()=>{t.assign(y,Vr.propertyInData(t,s,m,a.ownProperties)),t.if(qr.not(y),()=>{e.error(),t.break()})},qr.nil)}}};yA.default=pz});var $A=W(function(bA){Object.defineProperty(bA,"__esModule",{value:!0});var Hr=$e(),hz={message({keyword:e,schemaCode:t}){return Hr.str`must NOT have ${e==="maxItems"?"more":"fewer"} than ${t} items`},params:({schemaCode:e})=>Hr._`{limit: ${e}}`},gz={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:hz,code(e){let{keyword:t,data:n,schemaCode:r}=e,s=t==="maxItems"?Hr.operators.GT:Hr.operators.LT;e.fail$data(Hr._`${n}.length ${s} ${r}`)}};bA.default=gz});var Dd=W(function(wA){Object.defineProperty(wA,"__esModule",{value:!0});var SA=Dx();SA.code='require("ajv/dist/runtime/equal").default';wA.default=SA});var jA=W(function(EA){Object.defineProperty(EA,"__esModule",{value:!0});var ga=ac(),Te=$e(),vA=Oe(),bz=Dd(),$z={message:({params:{i:e,j:t}})=>Te.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>Te._`{i: ${e}, j: ${t}}`},Sz={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:$z,code(e){let{gen:t,data:n,$data:r,schema:s,parentSchema:o,schemaCode:i,it:a}=e;if(!r&&!s)return;let l=t.let("valid"),c=o.items?ga.getSchemaTypes(o.items):[];e.block$data(l,u,Te._`${i} === false`),e.ok(l);function u(){let y=t.let("i",Te._`${n}.length`),S=t.let("j");e.setParams({i:y,j:S}),t.assign(l,!0),t.if(Te._`${y} > 1`,()=>(d()?p:m)(y,S))}function d(){return c.length>0&&!c.some((y)=>y==="object"||y==="array")}function p(y,S){let g=t.name("item"),x=ga.checkDataTypes(c,g,a.opts.strictNumbers,ga.DataType.Wrong),P=t.const("indices",Te._`{}`);t.for(Te._`;${y}--;`,()=>{if(t.let(g,Te._`${n}[${y}]`),t.if(x,Te._`continue`),c.length>1)t.if(Te._`typeof ${g} == "string"`,Te._`${g} += "_"`);t.if(Te._`typeof ${P}[${g}] == "number"`,()=>{t.assign(S,Te._`${P}[${g}]`),e.error(),t.assign(l,!1).break()}).code(Te._`${P}[${g}] = ${y}`)})}function m(y,S){let g=vA.useFunc(t,bz.default),x=t.name("outer");t.label(x).for(Te._`;${y}--;`,()=>t.for(Te._`${S} = ${y}; ${S}--;`,()=>t.if(Te._`${g}(${n}[${y}], ${n}[${S}])`,()=>{e.error(),t.assign(l,!1).break(x)})))}}};EA.default=Sz});var kA=W(function(_A){Object.defineProperty(_A,"__esModule",{value:!0});var ya=$e(),PA=Oe(),vz=Dd(),Ez={message:"must be equal to constant",params:({schemaCode:e})=>ya._`{allowedValue: ${e}}`},jz={keyword:"const",$data:!0,error:Ez,code(e){let{gen:t,data:n,$data:r,schemaCode:s,schema:o}=e;if(r||o&&typeof o=="object")e.fail$data(ya._`!${PA.useFunc(t,vz.default)}(${n}, ${s})`);else e.fail(ya._`${o} !== ${n}`)}};_A.default=jz});var CA=W(function(AA){Object.defineProperty(AA,"__esModule",{value:!0});var Wr=$e(),OA=Oe(),_z=Dd(),kz={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>Wr._`{allowedValues: ${e}}`},Oz={keyword:"enum",schemaType:"array",$data:!0,error:kz,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,l,c=()=>l!==null&&l!==void 0?l:l=OA.useFunc(t,_z.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=Wr.or(...s.map((y,S)=>p(m,S)))}e.pass(u);function d(){t.assign(u,!1),t.forOf("v",o,(m)=>t.if(Wr._`${c()}(${n}, ${m})`,()=>t.assign(u,!0).break()))}function p(m,y){let S=s[y];return typeof S==="object"&&S!==null?Wr._`${c()}(${n}, ${m}[${y}])`:Wr._`${n} === ${S}`}}};AA.default=Oz});var sb=W(function(RA){Object.defineProperty(RA,"__esModule",{value:!0});var Cz=tA(),Rz=rA(),Nz=cA(),Tz=pA(),Jz=hA(),Mz=xA(),Iz=$A(),Dz=jA(),Lz=kA(),Fz=CA(),Vz=[Cz.default,Rz.default,Nz.default,Tz.default,Jz.default,Mz.default,Iz.default,Dz.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Lz.default,Fz.default];RA.default=Vz});var ob=W(function(TA){Object.defineProperty(TA,"__esModule",{value:!0});TA.validateAdditionalItems=void 0;var wn=$e(),xa=Oe(),Hz={message:({params:{len:e}})=>wn.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>wn._`{limit: ${e}}`},Wz={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Hz,code(e){let{parentSchema:t,it:n}=e,{items:r}=t;if(!Array.isArray(r)){xa.checkStrictMode(n,'"additionalItems" is ignored when "items" is not an array of schemas');return}NA(e,r)}};function NA(e,t){let{gen:n,schema:r,data:s,keyword:o,it:i}=e;i.items=!0;let a=n.const("len",wn._`${s}.length`);if(r===!1)e.setParams({len:t.length}),e.pass(wn._`${a} <= ${t.length}`);else if(typeof r=="object"&&!xa.alwaysValidSchema(i,r)){let c=n.var("valid",wn._`${a} <= ${t.length}`);n.if(wn.not(c),()=>l(c)),e.ok(c)}function l(c){n.forRange("i",t.length,a,(u)=>{if(e.subschema({keyword:o,dataProp:u,dataPropType:xa.Type.Num},c),!i.allErrors)n.if(wn.not(c),()=>n.break())})}}TA.validateAdditionalItems=NA;TA.default=Wz});var ib=W(function(DA){Object.defineProperty(DA,"__esModule",{value:!0});DA.validateTuple=void 0;var Ld=$e(),Qs=Oe(),MA=Xn(),Uz={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:n}=e;if(Array.isArray(t))return IA(e,"additionalItems",t);if(n.items=!0,Qs.alwaysValidSchema(n,t))return;e.ok(MA.validateArray(e))}};function IA(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=Qs.mergeEvaluated.items(r,n.length,a.items);let l=r.name("valid"),c=r.const("len",Ld._`${o}.length`);n.forEach((d,p)=>{if(Qs.alwaysValidSchema(a,d))return;r.if(Ld._`${c} > ${p}`,()=>e.subschema({keyword:i,schemaProp:p,dataProp:p},l)),e.ok(l)});function u(d){let{opts:p,errSchemaPath:m}=a,y=n.length,S=y===d.minItems&&(y===d.maxItems||d[t]===!1);if(p.strictTuples&&!S){let g=`"${i}" is ${y}-tuple, but minItems or maxItems/${t} are not specified or different at path "${m}"`;Qs.checkStrictMode(a,g,p.strictTuples)}}}DA.validateTuple=IA;DA.default=Uz});var qA=W(function(VA){Object.defineProperty(VA,"__esModule",{value:!0});var FA=ib(),Kz={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(e)=>FA.validateTuple(e,"items")};VA.default=Kz});var zA=W(function(UA){Object.defineProperty(UA,"__esModule",{value:!0});var Fd=$e(),HA=Oe(),WA=Xn(),BA=ob(),Xz={message:({params:{len:e}})=>Fd.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Fd._`{limit: ${e}}`},Yz={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Xz,code(e){let{schema:t,parentSchema:n,it:r}=e,{prefixItems:s}=n;if(r.items=!0,HA.alwaysValidSchema(r,t))return;if(s)BA.validateAdditionalItems(e,s);else e.ok(WA.validateArray(e))}};UA.default=Yz});var GA=W(function(KA){Object.defineProperty(KA,"__esModule",{value:!0});var lt=$e(),eo=Oe(),Qz={message:({params:{min:e,max:t}})=>t===void 0?lt.str`must contain at least ${e} valid item(s)`:lt.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?lt._`{minContains: ${e}}`:lt._`{minContains: ${e}, maxContains: ${t}}`},e8={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Qz,code(e){let{gen:t,schema:n,parentSchema:r,data:s,it:o}=e,i,a,{minContains:l,maxContains:c}=r;if(o.opts.next)i=l===void 0?1:l,a=c;else i=1;let u=t.const("len",lt._`${s}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){eo.checkStrictMode(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){eo.checkStrictMode(o,'"minContains" > "maxContains" is always invalid'),e.fail();return}if(eo.alwaysValidSchema(o,n)){let S=lt._`${u} >= ${i}`;if(a!==void 0)S=lt._`${S} && ${u} <= ${a}`;e.pass(S);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(lt._`${s}.length > 0`,p)}else t.let(d,!1),p();e.result(d,()=>e.reset());function p(){let S=t.name("_valid"),g=t.let("count",0);m(S,()=>t.if(S,()=>y(g)))}function m(S,g){t.forRange("i",0,u,(x)=>{e.subschema({keyword:"contains",dataProp:x,dataPropType:eo.Type.Num,compositeRule:!0},S),g()})}function y(S){if(t.code(lt._`${S}++`),a===void 0)t.if(lt._`${S} >= ${i}`,()=>t.assign(d,!0).break());else if(t.if(lt._`${S} > ${a}`,()=>t.assign(d,!1).break()),i===1)t.assign(d,!0);else t.if(lt._`${S} >= ${i}`,()=>t.assign(d,!0))}}};KA.default=e8});var Vd=W(function(QA){Object.defineProperty(QA,"__esModule",{value:!0});QA.validateSchemaDeps=QA.validatePropertyDeps=QA.error=void 0;var ba=$e(),XA=Oe(),Br=Xn();QA.error={message:({params:{property:e,depsCount:t,deps:n}})=>ba.str`must have ${t===1?"property":"properties"} ${n} when property ${e} is present`,params:({params:{property:e,depsCount:t,deps:n,missingProperty:r}})=>ba._`{property: ${e},
626
+ `+(" ".repeat(ge.length)+"^"),Vn=P==="Syntax"?"since":"inside",Yr=`${P} error at line ${Y}${f.name?` in ${f.name}`:""}${j&&j.name?`, ${Vn} \`${j.partial?"partial ":""}${function(Se){let ot=[Se];for(;Se&&Se.parent;){let{parent:On}=Se;ot.unshift(On),Se=On}return ot.map((On)=>function(ws,Ia){let t$=ws;return Ia&&(t$+=` ${Ia}`),t$}(On.type,On.name)).join(" -> ")}(j)}\``:""}:
627
+ ${gt}`;return{message:`${Yr} ${y}`,bareMessage:y,context:Yr,line:Y,sourceName:f.name,level:R,ruleName:z,autofix:N,input:ze,tokens:ke}}function r(f,S,j,y){return n(f,S,j,y,"Syntax")}function s(f,S,j,y,P={}){return P.ruleName=j,n(S.source,f.index,S,y,"Validation",P)}e.r(t),e.d(t,{WebIDLParseError:()=>_t,parse:()=>jp,validate:()=>Pc,write:()=>Pp});class o{constructor({source:f,tokens:S}){Object.defineProperties(this,{source:{value:f},tokens:{value:S,writable:!0},parent:{value:null,writable:!0},this:{value:this}})}toJSON(){let f={type:void 0,name:void 0,inheritance:void 0},S=this;for(;S!==Object.prototype;){let j=Object.getOwnPropertyDescriptors(S);for(let[y,P]of Object.entries(j))(P.enumerable||P.get)&&(f[y]=this[y]);S=Object.getPrototypeOf(S)}return f}}function i(f,S,{useNullableInner:j}={}){if(!f.union){let y=S.unique.get(f.idlType);if(!y)return;if(y.type==="typedef"){let{typedefIncludesDictionary:P}=S.cache;if(P.has(y))return P.get(y);S.cache.typedefIncludesDictionary.set(y,void 0);let R=i(y.idlType,S);if(S.cache.typedefIncludesDictionary.set(y,R),R)return{reference:f,dictionary:R.dictionary}}if(y.type==="dictionary"&&(j||!f.nullable))return{reference:f,dictionary:y}}for(let y of f.subtype){let P=i(y,S);if(P)return y.union?P:{reference:y,dictionary:P.dictionary}}}function a(f,S){if(S.cache.dictionaryIncludesRequiredField.has(f))return S.cache.dictionaryIncludesRequiredField.get(f);S.cache.dictionaryIncludesRequiredField.set(f,void 0);let j=f.members.some((y)=>y.required);if(!j&&f.inheritance){let y=S.unique.get(f.inheritance);y?a(y,S)&&(j=!0):j=!0}return S.cache.dictionaryIncludesRequiredField.set(f,j),j}class l extends Array{constructor({source:f,tokens:S}){super(),Object.defineProperties(this,{source:{value:f},tokens:{value:S},parent:{value:null,writable:!0}})}}class c extends o{static parser(f,S){return()=>{let j=f.consumeKind(S);if(j)return new c({source:f.source,tokens:{value:j}})}}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 c{static parse(f){let S=f.consumeKind("eof");if(S)return new u({source:f.source,tokens:{value:S}})}get type(){return"eof"}}function d(f,S){return J(f,{parser:c.parser(f,S),listName:S+" 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 g(f){for(let S of p){let j=d(f,S);if(j.length)return j}f.error("Expected identifiers, strings, decimals, or integers but none found")}class b extends o{static parse(f){let S={assign:f.consume("=")},j=K(new b({source:f.source,tokens:S}));if(j.list=[],S.assign){if(S.asterisk=f.consume("*"),S.asterisk)return j.this;S.secondaryName=f.consumeKind(...p)}return S.open=f.consume("("),S.open?(j.list=j.rhsIsList?g(f):le(f),S.close=f.consume(")")||f.error("Unexpected token in extended attribute argument list")):S.assign&&!S.secondaryName&&f.error("No right hand side to extended attribute assignment"),j.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:S}=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((j)=>S==="identifier-list"?f.identifier(j,this.parent):j.write(f)),f.token(this.tokens.close)])}}class h extends o{static parse(f){let S=f.consumeKind("identifier");if(S)return new h({source:f.source,tokens:{name:S},params:b.parse(f)})}constructor({source:f,tokens:S,params:j}){super({source:f,tokens:S}),j.parent=this,Object.defineProperty(this,"params",{value:j})}get type(){return"extended-attribute"}get name(){return this.tokens.name.value}get rhs(){let{rhsType:f,tokens:S,list:j}=this.params;if(!f)return null;return{type:f,value:this.params.rhsIsList?j:this.params.tokens.secondaryName?A(S.secondaryName.value):null}}get arguments(){let{rhsIsList:f,list:S}=this.params;return!S||f?[]:S}*validate(f){let{name:S}=this;if(S==="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(S)){let y=`\`[${S}]\` extended attribute is a legacy feature that is now renamed to \`[${m.get(S)}]\`. Refer to the [relevant upstream PR](https://github.com/whatwg/webidl/pull/870) for more information.`;yield s(this.tokens.name,this,"renamed-legacy",y,{level:"warning",autofix:(j=this,()=>{let{name:P}=j;j.tokens.name.value=m.get(P),P==="TreatNullAs"&&(j.params.tokens={})})})}var j;for(let y of this.arguments)yield*y.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 x extends l{static parse(f){let S={};S.open=f.consume("[");let j=new x({source:f.source,tokens:S});return S.open?(j.push(...J(f,{parser:h.parse,listName:"extended attribute"})),S.close=f.consume("]")||f.error("Expected a closing token for the extended attribute list"),j.length||(f.unconsume(S.close.index),f.error("An extended attribute list must not be empty")),f.probe("[")&&f.error("Illegal double extended attribute lists, consider merging them"),j):j}*validate(f){for(let S of this)yield*S.validate(f)}write(f){return this.length?f.ts.wrap([f.token(this.tokens.open),...this.map((S)=>S.write(f)),f.token(this.tokens.close)]):""}}function k(f,S){let j=f.consume("?");j&&(S.tokens.nullable=j),f.probe("?")&&f.error("Can't nullable more than once")}function w(f,S){let j=function(y,P){let R=y.consume("FrozenArray","ObservableArray","Promise","async_sequence","sequence","record");if(!R)return;let N=K(new v({source:y.source,tokens:{base:R}}));switch(N.tokens.open=y.consume("<")||y.error(`No opening bracket after ${R.value}`),R.value){case"Promise":{y.probe("[")&&y.error("Promise type cannot have extended attribute");let z=de(y,P)||y.error("Missing Promise subtype");N.subtype.push(z);break}case"async_sequence":case"sequence":case"FrozenArray":case"ObservableArray":{let z=te(y,P)||y.error(`Missing ${R.value} subtype`);N.subtype.push(z);break}case"record":{y.probe("[")&&y.error("Record key cannot have extended attribute");let z=y.consume(...Ze)||y.error(`Record key must be one of: ${Ze.join(", ")}`),Q=new v({source:y.source,tokens:{base:z}});Q.tokens.separator=y.consume(",")||y.error("Missing comma after record key type"),Q.type=P;let ue=te(y,P)||y.error("Error parsing generic type record");N.subtype.push(Q,ue);break}}return N.idlType||y.error(`Error parsing generic type ${R.value}`),N.tokens.close=y.consume(">")||y.error(`Missing closing bracket after ${R.value}`),N.this}(f,S)||ie(f);if(!j){let y=f.consumeKind("identifier")||f.consume(...Ze,...Ve);if(!y)return;j=new v({source:f.source,tokens:{base:y}}),f.probe("<")&&f.error(`Unsupported generic type ${y.value}`)}return j.generic==="Promise"&&f.probe("?")&&f.error("Promise type cannot be nullable"),j.type=S||null,k(f,j),j.nullable&&j.idlType==="any"&&f.error("Type `any` cannot be made nullable"),j}class v extends o{static parse(f,S){return w(f,S)||function(j,y){let P={};if(P.open=j.consume("("),!P.open)return;let R=K(new v({source:j.source,tokens:P}));for(R.type=y||null;;){let N=te(j,y)||j.error("No type after open parenthesis or 'or' in union type");N.idlType==="any"&&j.error("Type `any` cannot be included in a union type"),N.generic==="Promise"&&j.error("Type `Promise` cannot be included in a union type"),R.subtype.push(N);let z=j.consume("or");if(!z)break;N.tokens.separator=z}return R.idlType.length<2&&j.error("At least two types are expected in a union type but found less"),P.close=j.consume(")")||j.error("Unterminated union type"),k(j,R),R.this}(f,S)}constructor({source:f,tokens:S}){super({source:f,tokens:S}),Object.defineProperty(this,"subtype",{value:[],writable:!0}),this.extAttrs=new x({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 P of[this.extAttrs,this.parent?.extAttrs])for(let R of P){if(R.name!=="AllowShared")continue;let N="`[AllowShared] BufferSource` is now replaced with AllowSharedBufferSource.";yield s(this.tokens.base,this,"migrate-allowshared",N,{autofix:E(this,R,P)})}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:(S=this,()=>{S.tokens.base.value="undefined"})});var S;let j=!this.union&&f.unique.get(this.idlType),y=this.union?this:j&&j.type==="typedef"?j.idlType:void 0;if(y&&this.nullable){let{reference:P}=i(y,f)||{};if(P){let R=(this.union?P:this).tokens.base;yield s(R,this,"no-nullable-union-dict","Nullable union cannot include a dictionary type.")}}else for(let P of this.subtype)yield*P.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((P)=>P.write(f)),f.token(this.tokens.close)]);let S=this.tokens.prefix||this.tokens.base,j=this.tokens.prefix?[this.tokens.prefix.value,f.ts.trivia(this.tokens.base.trivia)]:[],y=f.reference(f.ts.wrap([...j,this.tokens.base.value,f.token(this.tokens.postfix)]),{unescaped:this.idlType,context:this});return f.ts.wrap([f.ts.trivia(S.trivia),y])})(),f.token(this.tokens.nullable),f.token(this.tokens.separator)])}}function E(f,S,j){return()=>{let y=j.indexOf(S);j.splice(y,1),!j.length&&f.tokens.base.trivia.match(/^\s$/)&&(f.tokens.base.trivia=""),f.tokens.base.value="AllowSharedBufferSource"}}class O extends o{static parse(f){let S=f.consume("=");if(!S)return null;let j=G(f)||f.consumeKind("string")||f.consume("null","[","{")||f.error("No value for default"),y=[j];if(j.value==="["){let P=f.consume("]")||f.error("Default sequence value must be empty");y.push(P)}else if(j.value==="{"){let P=f.consume("}")||f.error("Default dictionary value must be empty");y.push(P)}return new O({source:f.source,tokens:{assign:S},expression:y})}constructor({source:f,tokens:S,expression:j}){super({source:f,tokens:S}),j.parent=this,Object.defineProperty(this,"expression",{value:j})}get type(){return se(this.expression[0]).type}get value(){return se(this.expression[0]).value}get negative(){return se(this.expression[0]).negative}write(f){return f.ts.wrap([f.token(this.tokens.assign),...this.expression.map((S)=>f.token(S))])}}class I extends o{static parse(f){let S=f.position,j={},y=K(new I({source:f.source,tokens:j}));return y.extAttrs=x.parse(f),j.optional=f.consume("optional"),y.idlType=te(f,"argument-type"),y.idlType?(j.optional||(j.variadic=f.consume("...")),j.name=f.consumeKind("identifier")||f.consume(...re),j.name?(y.default=j.optional?O.parse(f):null,y.this):f.unconsume(S)):f.unconsume(S)}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 S=i(this.idlType,f,{useNullableInner:!0});if(S){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:D(this)})}else if(this.parent&&!a(S.dictionary,f)&&function(y){let P=y.parent.arguments||y.parent.list,R=P.indexOf(y);return!P.slice(R+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:(j=this,()=>{let P=H(j.idlType);j.tokens.optional={...P,type:"optional",value:"optional"},P.trivia=" ",D(j)()})})}var j}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 D(f){return()=>{f.default=O.parse(new kt(" = {}"))}}class V extends o{static parse(f,{special:S,regular:j}={}){let y={special:S},P=K(new V({source:f.source,tokens:y}));return S&&S.value==="stringifier"&&(y.termination=f.consume(";"),y.termination)?(P.arguments=[],P):(S||j||(y.special=f.consume("getter","setter","deleter")),P.idlType=de(f)||f.error("Missing return type"),y.name=f.consumeKind("identifier")||f.consume("includes"),y.open=f.consume("(")||f.error("Invalid operation"),P.arguments=le(f),y.close=f.consume(")")||f.error("Unterminated operation"),y.termination=f.consume(";")||f.error("Unterminated operation, expected `;`"),P.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 S of this.arguments)yield*S.validate(f)}write(f){let{parent:S}=this,j=this.idlType?[f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this,parent:S}),f.token(this.tokens.open),f.ts.wrap(this.arguments.map((y)=>y.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:S}),...j,f.token(this.tokens.termination)]),{data:this,parent:S})}}class W extends o{static parse(f,{special:S,noInherit:j=!1,readonly:y=!1}={}){let P=f.position,R={special:S},N=K(new W({source:f.source,tokens:R}));if(S||j||(R.special=f.consume("inherit")),N.special==="inherit"&&f.probe("readonly")&&f.error("Inherited attributes cannot be read-only"),R.readonly=f.consume("readonly"),y&&!R.readonly&&f.probe("attribute")&&f.error("Attributes must be readonly in this context"),R.base=f.consume("attribute"),R.base)return N.idlType=te(f,"attribute-type")||f.error("Attribute lacks a type"),R.name=f.consumeKind("identifier")||f.consume("async","required")||f.error("Attribute lacks a name"),R.termination=f.consume(";")||f.error("Unterminated attribute, expected `;`"),N.this;f.unconsume(P)}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 S=`Attributes cannot accept ${this.idlType.generic} types.`;yield s(this.tokens.name,this,"attr-invalid-type",S)}{let{reference:S}=i(this.idlType,f)||{};if(S){let j=(this.idlType.union?S:this.idlType).tokens.base;yield s(j,this,"attr-invalid-type","Attributes cannot accept dictionary types.")}}if(this.readonly&&function(S,j){if(S.union)return!1;if(S.extAttrs.some((P)=>P.name==="EnforceRange"))return!0;let y=j.unique.get(S.idlType);return y?.type==="typedef"&&y.idlType.extAttrs.some((P)=>P.name==="EnforceRange")}(this.idlType,f)){let S=this.idlType.tokens.base;yield s(S,this,"attr-invalid-type","Readonly attributes cannot accept [EnforceRange] extended attribute.")}}write(f){let{parent:S}=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:S}),f.token(this.tokens.termination)]),{data:this,parent:S})}}function A(f){return f.startsWith("_")?f.slice(1):f}function J(f,{parser:S,allowDangler:j,listName:y="list"}){let P=S(f);if(!P)return[];P.tokens.separator=f.consume(",");let R=[P];for(;P.tokens.separator;){let N=S(f);if(!N){j||f.error(`Trailing comma in ${y}`);break}if(N.tokens.separator=f.consume(","),R.push(N),!N.tokens.separator)break}return R}function G(f){return f.consumeKind("decimal","integer")||f.consume("true","false","Infinity","-Infinity","NaN")}function se({type:f,value:S}){switch(f){case"decimal":case"integer":return{type:"number",value:S};case"string":return{type:"string",value:S.slice(1,-1)}}switch(S){case"true":case"false":return{type:"boolean",value:S==="true"};case"Infinity":case"-Infinity":return{type:"Infinity",negative:S.startsWith("-")};case"[":return{type:"sequence",value:[]};case"{":return{type:"dictionary"};default:return{type:S}}}function ie(f){let{source:S}=f,j=function(){let P=f.consume("unsigned"),R=f.consume("short","long");if(R){let N=f.consume("long");return new v({source:S,tokens:{prefix:P,base:R,postfix:N}})}P&&f.error("Failed to parse integer type")}()||function(){let P=f.consume("unrestricted"),R=f.consume("float","double");if(R)return new v({source:S,tokens:{prefix:P,base:R}});P&&f.error("Failed to parse float type")}();if(j)return j;let y=f.consume("bigint","boolean","byte","octet","undefined");return y?new v({source:S,tokens:{base:y}}):void 0}function le(f){return J(f,{parser:I.parse,listName:"arguments list"})}function te(f,S){let j=x.parse(f),y=v.parse(f,S);return y&&(K(y).extAttrs=j),y}function de(f,S){let j=v.parse(f,S||"return-type");if(j)return j;let y=f.consume("void");if(y){let P=new v({source:f.source,tokens:{base:y}});return P.type="return-type",P}}function xe(f){let S=f.consume("stringifier");if(!S)return;return W.parse(f,{special:S})||V.parse(f,{special:S})||f.error("Unterminated stringifier")}function X(f){let S=f.split(`
628
+ `);if(S.length){let j=S[S.length-1].match(/^\s+/);if(j)return j[0]}return""}function U(f){return()=>{if(f.extAttrs.length){let S=new kt("Exposed=Window,"),j=h.parse(S);j.tokens.separator=S.consume(",");let y=f.extAttrs[0];/^\s/.test(y.tokens.name.trivia)||(y.tokens.name.trivia=` ${y.tokens.name.trivia}`),f.extAttrs.unshift(j)}else{K(f).extAttrs=x.parse(new kt("[Exposed=Window]"));let S=f.tokens.base.trivia;f.extAttrs.tokens.open.trivia=S,f.tokens.base.trivia=`
629
+ ${X(S)}`}}}function H(f){if(f.extAttrs.length)return f.extAttrs.tokens.open;if(f.type==="operation"&&!f.special)return H(f.idlType);return Object.values(f.tokens).sort((S,j)=>S.index-j.index)[0]}function K(f,S){if(S||(S=f),!f)return f;return new Proxy(f,{get(j,y){let P=j[y];return Array.isArray(P)&&y!=="source"?K(P,j):P},set(j,y,P){if(j[y]=P,!P)return!0;if(Array.isArray(P))for(let R of P)R.parent!==void 0&&(R.parent=S);else P.parent!==void 0&&(P.parent=S);return!0}})}let He={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},Ve=["ArrayBuffer","SharedArrayBuffer","DataView","Int8Array","Int16Array","Int32Array","Uint8Array","Uint16Array","Uint32Array","Uint8ClampedArray","BigInt64Array","BigUint64Array","Float16Array","Float32Array","Float64Array","any","object","symbol"],Ze=["ByteString","DOMString","USVString"],re=["async","attribute","callback","const","constructor","deleter","dictionary","enum","getter","includes","inherit","interface","iterable","maplike","namespace","partial","required","setlike","setter","static","stringifier","typedef","unrestricted"],Gt=["-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(re,Ze,Ve),Qe=["(",")",",","...",":",";","<","=",">","?","*","[","]","{","}"],ht=["_constructor","toString","_toString"];class kt{constructor(f){this.source=function(S){let j=[],y=0,P="",R=1,N=0;for(;y<S.length;){let Q=S.charAt(y),ue=-1;if(/[\t\n\r ]/.test(Q)?ue=z("whitespace",{noFlushTrivia:!0}):Q==="/"&&(ue=z("comment",{noFlushTrivia:!0})),ue!==-1){let Y=j.pop().value;R+=(Y.match(/\n/g)||[]).length,P+=Y,N-=1}else if(/[-0-9.A-Z_a-z]/.test(Q)){if(ue=z("decimal"),ue===-1&&(ue=z("integer")),ue===-1){ue=z("identifier");let Y=j.length-1,ge=j[Y];if(ue!==-1){if(ht.includes(ge.value)){let ke=`${A(ge.value)} is a reserved identifier and must not be used.`;throw new _t(r(j,Y,null,ke))}Gt.includes(ge.value)&&(ge.type="inline")}}}else Q==='"'&&(ue=z("string"));for(let Y of Qe)if(S.startsWith(Y,y)){j.push({type:"inline",value:Y,trivia:P,line:R,index:N}),P="",y+=Y.length,ue=y;break}if(ue===-1&&(ue=z("other")),ue===-1)throw Error("Token stream not progressing");y=ue,N+=1}return j.push({type:"eof",value:"",trivia:P,line:R,index:N}),j;function z(Q,{noFlushTrivia:ue}={}){let Y=He[Q];Y.lastIndex=y;let ge=Y.exec(S);return ge?(j.push({type:Q,value:ge[0],trivia:P,line:R,index:N}),ue||(P=""),Y.lastIndex):-1}}(f),this.position=0}error(f){throw new _t(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 S of f){if(!this.probeKind(S))continue;let j=this.source[this.position];return this.position++,j}}consume(...f){if(!this.probeKind("inline"))return;let S=this.source[this.position];for(let j of f)if(S.value===j)return this.position++,S}consumeIdentifier(f){if(this.probeKind("identifier")&&this.source[this.position].value===f)return this.consumeKind("identifier")}unconsume(f){this.position=f}}class _t extends Error{constructor({message:f,bareMessage:S,context:j,line:y,sourceName:P,input:R,tokens:N}){super(f),this.name="WebIDLParseError",this.bareMessage=S,this.context=j,this.line=y,this.sourceName=P,this.input=R,this.tokens=N}}class We extends c{static parse(f){let S=f.consumeKind("string");if(S)return new We({source:f.source,tokens:{value:S}})}get type(){return"enum-value"}get value(){return super.value.slice(1,-1)}write(f){let{parent:S}=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:S}),'"']),{data:this,parent:S}),f.token(this.tokens.separator)])}}class Pe extends o{static parse(f){let S={};if(S.base=f.consume("enum"),!S.base)return;S.name=f.consumeKind("identifier")||f.error("No name for enum");let j=K(new Pe({source:f.source,tokens:S}));return f.current=j.this,S.open=f.consume("{")||f.error("Bodyless enum"),j.values=J(f,{parser:We.parse,allowDangler:!0,listName:"enumeration"}),f.probeKind("string")&&f.error("No comma between enum values"),S.close=f.consume("}")||f.error("Unexpected value in enum"),j.values.length||f.error("No value in enum"),S.termination=f.consume(";")||f.error("No semicolon after enum"),j.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((S)=>S.write(f))),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this})}}class Ln extends o{static parse(f){let S=f.consumeKind("identifier");if(!S)return;let j={target:S};if(j.includes=f.consume("includes"),j.includes)return j.mixin=f.consumeKind("identifier")||f.error("Incomplete includes statement"),j.termination=f.consume(";")||f.error("No terminating ; for includes statement"),new Ln({source:f.source,tokens:j});f.unconsume(S.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 me extends o{static parse(f){let S={},j=K(new me({source:f.source,tokens:S}));if(S.base=f.consume("typedef"),S.base)return j.idlType=te(f,"typedef-type")||f.error("Typedef lacks a type"),S.name=f.consumeKind("identifier")||f.error("Typedef lacks a name"),f.current=j.this,S.termination=f.consume(";")||f.error("Unterminated typedef, expected `;`"),j.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 Xr extends o{static parse(f,S){let j={base:S},y=K(new Xr({source:f.source,tokens:j}));return j.name=f.consumeKind("identifier")||f.error("Callback lacks a name"),f.current=y.this,j.assign=f.consume("=")||f.error("Callback lacks an assignment"),y.idlType=de(f)||f.error("Callback lacks a return type"),j.open=f.consume("(")||f.error("Callback lacks parentheses for arguments"),y.arguments=le(f),j.close=f.consume(")")||f.error("Unterminated callback"),j.termination=f.consume(";")||f.error("Unterminated callback, expected `;`"),y.this}get type(){return"callback"}get name(){return A(this.tokens.name.value)}*validate(f){yield*this.extAttrs.validate(f);for(let S of this.arguments)if(yield*S.validate(f),S.idlType.generic==="async_sequence")yield s(S.tokens.name,S,"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((S)=>S.write(f)),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this})}}class st extends o{static parse(f,S,{inheritable:j,allowedMembers:y}){let{tokens:P,type:R}=S;for(P.name=f.consumeKind("identifier")||f.error(`Missing name in ${R}`),f.current=S,S=K(S),j&&Object.assign(P,function(N){let z=N.consume(":");return z?{colon:z,inheritance:N.consumeKind("identifier")||N.error("Inheritance lacks a type")}:{}}(f)),P.open=f.consume("{")||f.error(`Bodyless ${R}`),S.members=[];;){if(P.close=f.consume("}"),P.close)return P.termination=f.consume(";")||f.error(`Missing semicolon after ${R}`),S.this;let N=x.parse(f),z;for(let[Q,...ue]of y)if(z=K(Q(f,...ue)),z)break;z||f.error("Unknown member"),z.extAttrs=N,S.members.push(z.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 S of this.members)S.validate&&(yield*S.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((S)=>S.write(f))),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this})}}class et extends o{static parse(f){let S={};if(S.base=f.consume("const"),!S.base)return;let j=ie(f);if(!j){let P=f.consumeKind("identifier")||f.error("Const lacks a type");j=new v({source:f.source,tokens:{base:P}})}f.probe("?")&&f.error("Unexpected nullable constant type"),j.type="const-type",S.name=f.consumeKind("identifier")||f.error("Const lacks a name"),S.assign=f.consume("=")||f.error("Const lacks value assignment"),S.value=G(f)||f.error("Const lacks a value"),S.termination=f.consume(";")||f.error("Unterminated const, expected `;`");let y=new et({source:f.source,tokens:S});return K(y).idlType=j,y}get type(){return"const"}get name(){return A(this.tokens.name.value)}get value(){return se(this.tokens.value)}write(f){let{parent:S}=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:S}),f.token(this.tokens.assign),f.token(this.tokens.value),f.token(this.tokens.termination)]),{data:this,parent:S})}}class Jt extends o{static parse(f){let S=f.position,j=K(new Jt({source:f.source,tokens:{}})),{tokens:y}=j;if(y.readonly=f.consume("readonly"),y.readonly||(y.async=f.consume("async")),y.base=y.readonly?f.consume("maplike","setlike"):y.async?f.consume("iterable"):f.consume("iterable","async_iterable","maplike","setlike"),!y.base)return void f.unconsume(S);let{type:P}=j,R=P==="maplike",N=R||P==="iterable"||P==="async_iterable",z=P==="async_iterable"||j.async&&P==="iterable";y.open=f.consume("<")||f.error(`Missing less-than sign \`<\` in ${P} declaration`);let Q=te(f)||f.error(`Missing a type argument in ${P} declaration`);return j.idlType=[Q],j.arguments=[],N&&(Q.tokens.separator=f.consume(","),Q.tokens.separator?j.idlType.push(te(f)):R&&f.error(`Missing second type argument in ${P} declaration`)),y.close=f.consume(">")||f.error(`Missing greater-than sign \`>\` in ${P} declaration`),f.probe("(")&&(z?(y.argsOpen=f.consume("("),j.arguments.push(...le(f)),y.argsClose=f.consume(")")||f.error("Unterminated async iterable argument list")):f.error("Arguments are only allowed for `async iterable`")),y.termination=f.consume(";")||f.error(`Missing semicolon after ${P} declaration`),j.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:(S=this,()=>{let y=S.tokens.async;S.tokens.base={...y,type:"async_iterable",value:"async_iterable"},delete S.tokens.async})});var S;for(let j of this.idlType)yield*j.validate(f);for(let j of this.arguments)yield*j.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((S)=>S.write(f))),f.token(this.tokens.close),f.token(this.tokens.argsOpen),f.ts.wrap(this.arguments.map((S)=>S.write(f))),f.token(this.tokens.argsClose),f.token(this.tokens.termination)]),{data:this,parent:this.parent})}}class $s extends o{static parse(f){let S=f.consume("constructor");if(!S)return;let j={base:S};j.open=f.consume("(")||f.error("No argument list in constructor");let y=le(f);j.close=f.consume(")")||f.error("Unterminated constructor"),j.termination=f.consume(";")||f.error("No semicolon after constructor");let P=new $s({source:f.source,tokens:j});return K(P).arguments=y,P}get type(){return"constructor"}*validate(f){for(let S of this.arguments)yield*S.validate(f)}write(f){let{parent:S}=this;return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base,f.ts.nameless,{data:this,parent:S}),f.token(this.tokens.open),f.ts.wrap(this.arguments.map((j)=>j.write(f))),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this,parent:S})}}function ei(f){let S=f.consume("static");if(!S)return;return W.parse(f,{special:S})||V.parse(f,{special:S})||f.error("No body in static member")}class po extends st{static parse(f,S,{extMembers:j=[],partial:y=null}={}){let P={partial:y,base:S};return st.parse(f,new po({source:f.source,tokens:P}),{inheritable:!y,allowedMembers:[...j,[et.parse],[$s.parse],[ei],[xe],[Jt.parse],[W.parse],[V.parse]]})}get type(){return"interface"}*validate(f){if(yield*this.extAttrs.validate(f),!this.partial&&this.extAttrs.every((j)=>j.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:U(this)});let S=this.extAttrs.filter((j)=>j.name==="Constructor");for(let j of S)yield s(j.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:ti(this,j)});if(this.extAttrs.some((j)=>j.name==="Global")){let j=this.extAttrs.filter((P)=>P.name==="LegacyFactoryFunction");for(let P of j)yield s(P.tokens.name,this,"no-constructible-global","Interfaces marked as `[Global]` cannot have factory functions.");let y=this.members.filter((P)=>P.type==="constructor");for(let P of y)yield s(P.tokens.base,this,"no-constructible-global","Interfaces marked as `[Global]` cannot have constructors.")}yield*super.validate(f),this.partial||(yield*function*(j,y){let P=function(ue){let Y=Q(ue);return{statics:new Set(Y.filter((ge)=>ge.special==="static").map((ge)=>ge.name)),nonstatics:new Set(Y.filter((ge)=>ge.special!=="static").map((ge)=>ge.name))}}(y),R=j.partials.get(y.name)||[],N=j.mixinMap.get(y.name)||[];for(let ue of[...R,...N]){let Y=Q(ue),ge=Y.filter((ze)=>ze.special==="static"),ke=Y.filter((ze)=>ze.special!=="static");yield*z(ge,P.statics,ue,y),yield*z(ke,P.nonstatics,ue,y),ge.forEach((ze)=>P.statics.add(ze.name)),ke.forEach((ze)=>P.nonstatics.add(ze.name))}function*z(ue,Y,ge,ke){for(let ze of ue){let{name:gt}=ze;if(gt&&Y.has(gt)){let Vn=`The ${ze.special==="static"?"static ":""}operation "${gt}" has already been defined for the base interface "${ke.name}" either in itself or in a mixin`;yield s(ze.tokens.name,ge,"no-cross-overload",Vn)}}}function Q(ue){return ue.members.filter(({type:Y})=>Y==="operation")}}(f,this))}}function ti(f,S){return f=K(f),()=>{let j=X(f.extAttrs.tokens.open.trivia),y=f.members.length?X(H(f.members[0]).trivia):function(Y){let ge=X(Y),ke=ge.includes("\t")?"\t":" ";return ge+ke}(j),P=$s.parse(new kt(`
630
+ ${y}constructor();`));P.extAttrs=new x({source:f.source,tokens:{}}),K(P).arguments=S.arguments;let R=function(Y,ge){let ke=Y.slice().reverse().findIndex(ge);return ke===-1?ke:Y.length-ke-1}(f.members,(Y)=>Y.type==="constructor");f.members.splice(R+1,0,P);let{close:N}=f.tokens;N.trivia.includes(`
631
+ `)||(N.trivia+=`
632
+ ${j}`);let{extAttrs:z}=f,Q=z.indexOf(S),ue=z.splice(Q,1);z.length?z.length===Q?z[Q-1].tokens.separator=void 0:z[Q].tokens.name.trivia.trim()||(z[Q].tokens.name.trivia=ue[0].tokens.name.trivia):z.tokens.open=z.tokens.close=void 0}}class Fn extends st{static parse(f,S,{extMembers:j=[],partial:y}={}){let P={partial:y,base:S};if(P.mixin=f.consume("mixin"),P.mixin)return st.parse(f,new Fn({source:f.source,tokens:P}),{allowedMembers:[...j,[et.parse],[xe],[W.parse,{noInherit:!0}],[V.parse,{regular:!0}]]})}get type(){return"interface mixin"}}class Lt extends o{static parse(f){let S={},j=K(new Lt({source:f.source,tokens:S}));return j.extAttrs=x.parse(f),S.required=f.consume("required"),j.idlType=te(f,"dictionary-type")||f.error("Dictionary member lacks a type"),S.name=f.consumeKind("identifier")||f.error("Dictionary member lacks a name"),j.default=O.parse(f),S.required&&j.default&&f.error("Required member must not have a default"),S.termination=f.consume(";")||f.error("Unterminated dictionary member, expected `;`"),j.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:S}=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:S}),this.default?this.default.write(f):"",f.token(this.tokens.termination)]),{data:this,parent:S})}}class or extends st{static parse(f,{extMembers:S=[],partial:j}={}){let y={partial:j};if(y.base=f.consume("dictionary"),y.base)return st.parse(f,new or({source:f.source,tokens:y}),{inheritable:!j,allowedMembers:[...S,[Lt.parse]]})}get type(){return"dictionary"}}class Ss extends st{static parse(f,{extMembers:S=[],partial:j}={}){let y={partial:j};if(y.base=f.consume("namespace"),y.base)return st.parse(f,new Ss({source:f.source,tokens:y}),{allowedMembers:[...S,[W.parse,{noInherit:!0,readonly:!0}],[et.parse],[V.parse,{regular:!0}]]})}get type(){return"namespace"}*validate(f){if(!this.partial&&this.extAttrs.every((S)=>S.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:U(this)});yield*super.validate(f)}}class mo extends st{static parse(f,S,{extMembers:j=[]}={}){let y={callback:S};if(y.base=f.consume("interface"),y.base)return st.parse(f,new mo({source:f.source,tokens:y}),{allowedMembers:[...j,[et.parse],[V.parse,{regular:!0}]]})}get type(){return"callback interface"}}function vc(f,S){let j=f.source;function y(Q){f.error(Q)}function P(...Q){return f.consume(...Q)}function R(Q){let ue=P("interface");if(ue)return Fn.parse(f,ue,{...Q,...S?.extensions?.mixin})||po.parse(f,ue,{...Q,...S?.extensions?.interface})||y("Interface has no proper body")}function N(){if(S.productions)for(let Q of S.productions){let ue=Q(f);if(ue)return ue}return function(){let Q=P("callback");if(Q)return f.probe("interface")?mo.parse(f,Q,{...S?.extensions?.callbackInterface}):Xr.parse(f,Q)}()||R()||function(){let Q=P("partial");if(Q)return or.parse(f,{partial:Q,...S?.extensions?.dictionary})||R({partial:Q})||Ss.parse(f,{partial:Q,...S?.extensions?.namespace})||y("Partial doesn't apply to anything")}()||or.parse(f,S?.extensions?.dictionary)||Pe.parse(f)||me.parse(f)||Ln.parse(f)||Ss.parse(f,S?.extensions?.namespace)}let z=function(){if(!j.length)return[];let Q=[];for(;;){let Y=x.parse(f),ge=N();if(!ge){Y.length&&y("Stray extended attributes");break}K(ge).extAttrs=Y,Q.push(ge)}let ue=u.parse(f);return S.concrete&&Q.push(ue),Q}();return f.position<j.length&&y("Unrecognised tokens"),z}function jp(f,S={}){let j=new kt(f);return S.sourceName!==void 0&&(j.source.name=S.sourceName),vc(j,S)}function dn(f){return f}let ni={wrap:(f)=>f.join(""),trivia:dn,name:dn,reference:dn,type:dn,generic:dn,nameless:dn,inheritance:dn,definition:dn,extendedAttribute:dn,extendedAttributeReference:dn};class Ec{constructor(f){this.ts=Object.assign({},ni,f)}reference(f,{unescaped:S,context:j}){return S||(S=f.startsWith("_")?f.slice(1):f),this.ts.reference(f,S,j)}token(f,S=dn,...j){if(!f)return"";let y=S(f.value,...j);return this.ts.wrap([this.ts.trivia(f.trivia),y])}reference_token(f,S){return this.token(f,this.reference.bind(this),{context:S})}name_token(f,S){return this.token(f,this.ts.name,S)}identifier(f,S){return this.ts.wrap([this.reference_token(f.tokens.value,S),this.token(f.tokens.separator)])}}function Pp(f,{templates:S=ni}={}){S=Object.assign({},ni,S);let j=new Ec(S);return S.wrap(f.map((y)=>y.write(j)))}function ho(f,S){let j=new Map,y=f.filter((P)=>P.type==="includes");for(let P of y){let R=S.get(P.includes);if(!R)continue;let N=j.get(P.target);N?N.push(R):j.set(P.target,[R])}return j}function*jc(f){let S=function(j){let y=new Map,P=new Set,R=new Map;for(let N of j)if(N.partial){let z=R.get(N.name);z?z.push(N):R.set(N.name,[N])}else N.name&&(y.has(N.name)?P.add(N):y.set(N.name,N));return{all:j,unique:y,partials:R,duplicates:P,mixinMap:ho(j,y),cache:{typedefIncludesDictionary:new WeakMap,dictionaryIncludesRequiredField:new WeakMap}}}(f);for(let j of S.all)j.validate&&(yield*j.validate(S));yield*function*({unique:j,duplicates:y}){for(let P of y){let{name:R}=P,N=`The name "${R}" of type "${j.get(R).type}" was already seen`;yield s(P.tokens.name,P,"no-duplicate",N)}}(S)}function Pc(f){return[...jc((S=f,S.flat?S.flat():[].concat(...S)))];var S}return t})())});var Ok=B(function(Gre,_k){var __dirname="/home/runner/work/jx/jx/node_modules/@webref/idl",Ek=yt("fs").promises,xd=yt("path"),jk=vk();class Pk{constructor(e,t){this.filename=t,this.shortname=xd.basename(t,".idl"),this.path=xd.join(e,t)}async text(){return await Ek.readFile(this.path,"utf8")}async parse(){let e=await this.text();return jk.parse(e)}}async function kk({folder:e=__dirname}={}){let t={},n=await Ek.readdir(e);for(let r of n)if(r.endsWith(".idl")){let s=new Pk(e,r);t[s.shortname]=s}return t}async function Cq(e){let t=await kk(e);for(let[n,r]of Object.entries(t))t[n]=await r.parse();return t}_k.exports={listAll:kk,parseAll:Cq}});function Rq(){return Ak??=Tq(),Ak}async function Tq(){let[e,t,n]=await Promise.all([Rk.listAll(),Tk.default.listAll(),Nk.default.parseAll()]),r=new Set;for(let{elements:c}of Object.values(e))for(let u of c)if(!u.obsolete)r.add(u.name);let s=[...r].toSorted(),o=new Set;for(let c of t.properties)for(let u of c.styleDeclaration??[])o.add(u);let i=[...o].toSorted(),a=new Set;for(let c of Object.values(n))for(let u of c){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 l=[...a].toSorted();return{cssProps:i,eventHandlers:l,tagExamples:s}}function Nq(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 Jq(e){let t={...el.properties};for(let n of e)t[n]={oneOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/RefObject"}]};return t}async function Mq(){let{tagExamples:e,cssProps:t,eventHandlers:n}=await Rq();return{$defs:{DefsMap:Dh,TypeDefEntry:Lh,StateMap:Ih,StateEntry:Mh,TypedStateDef:rh,PureTypeDef:ph,FunctionDef:oh,ClassDef:Vh,ClassParameterDef:xu,ClassFieldDef:bu,ClassConstructorDef:$u,ClassMethodDef:Su,FormatDef:wu,ProjectBlockDef:vu,ServerBlockDef:Eu,ConnectorBlockDef:ju,StudioHints:Pu,ExternalClassDef:fh,ExpressionPointer:xh,ExpressionLiteral:bh,ExpressionOperand:$h,UnaryOperator:Sh,BinaryOperator:wh,ConditionalOperator:vh,SwitchOperator:Eh,CallOperator:jh,PureMethod:Ph,AssignmentOperator:kh,NoArgMethod:_h,OneArgMethod:Oh,SpliceMethod:Ah,ReduceMethod:Ch,MapFilterMethod:Rh,ExpressionNode:Th,ExpressionEntry:Nh,Statement:ah,StatementList:lh,ElementDef:{...yu,properties:{...yu.properties,...Nq(n)}},ChildrenValue:Gm,ArrayNamespace:Km,SwitchDef:eh,SwitchNode:th,StyleObject:{...el,properties:Jq(t)},AttributesObject:Ym,PropsObject:Zm,RefObject:Wm,AnyRef:Hm,InternalRef:Im,StateRef:Dm,ExternalRef:Lm,ExternalComponentRef:Bm,GlobalRef:Fm,ParentRef:Vm,MapRef:qm,ElementPropertyValue:Qm,StringOrRef:jm,BoolOrRef:Pm,NumberOrRef:km,CemParameter:Cm,CemEvent:Rm,TagName:{...vm,examples:[...e,"my-counter","todo-app","user-card"]},TagExpression:$m,ElementTagName:Sm,JsonSchemaType:Jm,HeadEntry:Om,ImageConfig:Qa,PathsValue:{$id:Oo,anyOf:[...rl,Gh],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"},formAssociated:{description:"Makes the custom element a form-associated one (the Web Components formAssociated static): it attaches ElementInternals, a form's reset and a disabled fieldset reach its `value`, `checked` and `disabled` state, `required` with an empty value is reported as a missing value, and a label naming it reaches its control.",type:"boolean"},formValue:{description:"The value a form-associated custom element submits under its `name`, through ElementInternals.setFormValue: a `$ref`, a `${}` template or a literal. Omit it when a named native control inside the element already submits the value."},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 Iq(){return{$defs:{ImageConfig:Qa,StyleObject:Jk},$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:_u.properties,title:"Jx Project",type:"object"}}function Dq(){return{$defs:{ImageConfig:Qa,JxFieldSchema:zh,RelationshipRef:Kh,StyleObject:Jk},$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:_u.properties,title:"Jx Project Core",type:"object"}}function Lq(){return{$id:nl,$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 Fq(){return{$id:Oo,$schema:"https://json-schema.org/draft/2020-12/schema",anyOf:[...rl,Gh],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 Vq(){return{$id:"https://jxsuite.com/schema/extension-manifest/v1",$schema:"https://json-schema.org/draft/2020-12/schema",title:"Jx Extension Manifest",...Bh}}function Mx(){return{$defs:{ClassConstructorDef:$u,ClassFieldDef:bu,ClassMethodDef:Su,ClassParameterDef:xu,ConnectorBlockDef:ju,FormatDef:wu,ProjectBlockDef:vu,ServerBlockDef:Eu,StudioHints:Pu},$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 qq(e){let{mkdirSync:t,writeFileSync:n}=await import("node:fs"),{resolve:r,dirname:s}=await import("node:path"),o=s(r(e,"..")),i=await Mq(),a=Iq(),l=Mx(),c=Dq(),u=Vq(),d=Lq(),p=Fq(),m=JSON.stringify(i,null,2),g=JSON.stringify(a,null,2),b=JSON.stringify(l,null,2),h=JSON.stringify(c,null,2),x=JSON.stringify(u,null,2),k=JSON.stringify(d,null,2),w=JSON.stringify(p,null,2),[v]=process.argv.slice(2);if(v)n(v,m,"utf8"),console.error(`Jx component schema written to ${v}`);else{n(r(o,"schema.json"),m,"utf8"),n(r(o,"project-schema.json"),g,"utf8"),n(r(o,"class-schema.json"),b,"utf8"),t(r(o,"schemas"),{recursive:!0}),n(r(o,"schemas","project.core.schema.json"),h,"utf8"),n(r(o,"schemas","project.fields.schema.json"),k,"utf8"),n(r(o,"schemas","document.paths.schema.json"),w,"utf8"),n(r(o,"extension-manifest.schema.json"),x,"utf8");let E=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(E.exitCode!==0){let O=E.stderr.toString()||E.stdout.toString()||`exit ${E.exitCode}${E.signalCode?`, signal ${E.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 Rk,Tk,Nk,Ak=null,Jk,Ck,xse;var Mk=M(()=>{wm();Em();_m();Am();Tm();Mm();Um();zm();Xm();nh();sh();ih();ch();dh();mh();Jh();Fh();qh();Uh();sl();Nm();Wh();Rk=Sr(xk(),1),Tk=Sr(wk(),1),Nk=Sr(Ok(),1);Jk={...el,additionalProperties:{anyOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/StyleObject"}]}};[,Ck]=process.argv,xse=Ck?.endsWith("schema.ts")?qq(Ck):void 0});function bd(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function Wq(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function Ik(e,t){return e!==void 0&&Object.hasOwn(e,t)}function Bq(e,t,n){if(!e.startsWith(Ix))return null;let[r="",...s]=e.slice(Ix.length).split("/").map((l)=>Wq(l));if(r==="")return null;let o,i;if(Ik(t,r))o="document",i=t;else if(Ik(n,r))o="project",i=n;else return null;let a=i[r]??null;for(let l of s)if(Array.isArray(a)){if(!Hq.test(l)||Number(l)>=a.length)return null;a=a[Number(l)]??null}else if(L(a)&&Object.hasOwn(a,l))a=a[l]??null;else return null;return{name:r,schema:a,scope:o}}function Dk(e,t=""){let n=[],r=(s,o)=>{if(!L(s))return;let i=s.$ref;if(_(i)&&i.startsWith(Ix))n.push({at:`${o}/$ref`,ref:i});for(let[a,l]of Object.entries(s)){if(!Dx.has(a))continue;let c=`${o}/${bd(a)}`;if(Array.isArray(l))for(let[u,d]of l.entries())r(d,`${c}/${u}`);else if($d.has(a)){if(L(l))for(let[u,d]of Object.entries(l))r(d,`${c}/${bd(u)}`)}else r(l,c)}};return r(e,t),n}function Lx(e,t){let n=[];if(L(e.state)){for(let[r,s]of Object.entries(e.state))if(L(s)&&L(s.type))n.push(...Dk(s.type,`/state/${bd(r)}/type`))}if(L(e.$defs)){for(let[r,s]of Object.entries(e.$defs))if(L(s)&&!Object.hasOwn(s,"$prototype"))n.push(...Dk(s,`/$defs/${bd(r)}`))}return n.filter(({ref:r})=>Bq(r,L(e.$defs)?e.$defs:void 0,t)===null)}var Ix="#/$defs/",$d,Dx,Hq;var Lk=M(()=>{ae();$d=new Set(["$defs","definitions","dependencies","dependentSchemas","patternProperties","properties"]),Dx=new Set([...$d,"additionalItems","additionalProperties","allOf","anyOf","contains","contentSchema","else","if","items","not","oneOf","prefixItems","propertyNames","then","unevaluatedItems","unevaluatedProperties"]),Hq=/^(?:0|[1-9]\d*)$/});var lc=B(function(qk){Object.defineProperty(qk,"__esModule",{value:!0});qk.regexpCode=qk.getEsmExportName=qk.getProperty=qk.safeStringify=qk.stringify=qk.strConcat=qk.addCodeArg=qk.str=qk._=qk.nil=qk._Code=qk.Name=qk.IDENTIFIER=qk._CodeOrName=void 0;class Sd{}qk._CodeOrName=Sd;qk.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class ca extends Sd{constructor(e){super();if(!qk.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}}}qk.Name=ca;class $r extends Sd{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 ca)t[n.str]=(t[n.str]||0)+1;return t},{})}}qk._Code=$r;qk.nil=new $r("");function Fk(e,...t){let n=[e[0]],r=0;while(r<t.length)Vx(n,t[r]),n.push(e[++r]);return new $r(n)}qk._=Fk;var Fx=new $r("+");function Vk(e,...t){let n=[ac(e[0])],r=0;while(r<t.length)n.push(Fx),Vx(n,t[r]),n.push(Fx,ac(e[++r]));return Uq(n),new $r(n)}qk.str=Vk;function Vx(e,t){if(t instanceof $r)e.push(...t._items);else if(t instanceof ca)e.push(t);else e.push(Gq(t))}qk.addCodeArg=Vx;function Uq(e){let t=1;while(t<e.length-1){if(e[t]===Fx){let n=zq(e[t-1],e[t+1]);if(n!==void 0){e.splice(t-1,3,n);continue}e[t++]="+"}t++}}function zq(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string"){if(t instanceof ca||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 ca))return`"${e}${t.slice(1)}`;return}function Kq(e,t){return t.emptyStr()?e:e.emptyStr()?t:Vk`${e}${t}`}qk.strConcat=Kq;function Gq(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:ac(Array.isArray(e)?e.join(","):e)}function Xq(e){return new $r(ac(e))}qk.stringify=Xq;function ac(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}qk.safeStringify=ac;function Yq(e){return typeof e=="string"&&qk.IDENTIFIER.test(e)?new $r(`.${e}`):Fk`[${e}]`}qk.getProperty=Yq;function Zq(e){if(typeof e=="string"&&qk.IDENTIFIER.test(e))return new $r(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}qk.getEsmExportName=Zq;function Qq(e){return new $r(e.toString())}qk.regexpCode=Qq});var Bx=B(function(Uk){Object.defineProperty(Uk,"__esModule",{value:!0});Uk.ValueScope=Uk.ValueScopeName=Uk.Scope=Uk.varKinds=Uk.UsedValueState=void 0;var Ke=lc();class Wk extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var vd;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(vd||(Uk.UsedValueState=vd={}));Uk.varKinds={const:new Ke.Name("const"),let:new Ke.Name("let"),var:new Ke.Name("var")};class Hx{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof Ke.Name?e:this.name(e)}name(e){return new Ke.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}}}Uk.Scope=Hx;class Wx extends Ke.Name{constructor(e,t){super(t);this.prefix=e}setValue(e,{property:t,itemIndex:n}){this.value=e,this.scopePath=Ke._`.${new Ke.Name(t)}[${n}]`}}Uk.ValueScopeName=Wx;var dH=Ke._`\n`;class Bk extends Hx{constructor(e){super(e);this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?dH:Ke.nil}}get(){return this._scope}name(e){return new Wx(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 c=i.get(o);if(c)return c}else i=this._values[s]=new Map;i.set(o,r);let a=this._scope[s]||(this._scope[s]=[]),l=a.length;return a[l]=t.ref,r.setValue(t,{property:s,itemIndex:l}),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 Ke._`${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=Ke.nil;for(let o in e){let i=e[o];if(!i)continue;let a=n[o]=n[o]||new Map;i.forEach((l)=>{if(a.has(l))return;a.set(l,vd.Started);let c=t(l);if(c){let u=this.opts.es5?Uk.varKinds.var:Uk.varKinds.const;s=Ke._`${s}${u} ${l} = ${c};${this.opts._n}`}else if(c=r===null||r===void 0?void 0:r(l))s=Ke._`${s}${c}${this.opts._n}`;else throw new Wk(l);a.set(l,vd.Completed)})}return s}}Uk.ValueScope=Bk});var $e=B(function(wn){Object.defineProperty(wn,"__esModule",{value:!0});wn.or=wn.and=wn.not=wn.CodeGen=wn.operators=wn.varKinds=wn.ValueScopeName=wn.ValueScope=wn.Scope=wn.Name=wn.regexpCode=wn.stringify=wn.getProperty=wn.nil=wn.strConcat=wn.str=wn._=void 0;var ee=lc(),xt=Bx(),Bs=lc();Object.defineProperty(wn,"_",{enumerable:!0,get:function(){return Bs._}});Object.defineProperty(wn,"str",{enumerable:!0,get:function(){return Bs.str}});Object.defineProperty(wn,"strConcat",{enumerable:!0,get:function(){return Bs.strConcat}});Object.defineProperty(wn,"nil",{enumerable:!0,get:function(){return Bs.nil}});Object.defineProperty(wn,"getProperty",{enumerable:!0,get:function(){return Bs.getProperty}});Object.defineProperty(wn,"stringify",{enumerable:!0,get:function(){return Bs.stringify}});Object.defineProperty(wn,"regexpCode",{enumerable:!0,get:function(){return Bs.regexpCode}});Object.defineProperty(wn,"Name",{enumerable:!0,get:function(){return Bs.Name}});var Od=Bx();Object.defineProperty(wn,"Scope",{enumerable:!0,get:function(){return Od.Scope}});Object.defineProperty(wn,"ValueScope",{enumerable:!0,get:function(){return Od.ValueScope}});Object.defineProperty(wn,"ValueScopeName",{enumerable:!0,get:function(){return Od.ValueScopeName}});Object.defineProperty(wn,"varKinds",{enumerable:!0,get:function(){return Od.varKinds}});wn.operators={GT:new ee._Code(">"),GTE:new ee._Code(">="),LT:new ee._Code("<"),LTE:new ee._Code("<="),EQ:new ee._Code("==="),NEQ:new ee._Code("!=="),NOT:new ee._Code("!"),OR:new ee._Code("||"),AND:new ee._Code("&&"),ADD:new ee._Code("+")};class Us{optimizeNodes(){return this}optimizeNames(e,t){return this}}class Kk extends Us{constructor(e,t,n){super();this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){let n=e?xt.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=fa(this.rhs,e,t);return this}get names(){return this.rhs instanceof ee._CodeOrName?this.rhs.names:{}}}class Kx extends Us{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 ee.Name&&!e[this.lhs.str]&&!this.sideEffects)return;return this.rhs=fa(this.rhs,e,t),this}get names(){let e=this.lhs instanceof ee.Name?{}:{...this.lhs.names};return _d(e,this.rhs)}}class Gk extends Kx{constructor(e,t,n,r){super(e,n,r);this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class Xk extends Us{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class Yk extends Us{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class Zk extends Us{constructor(e){super();this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class Qk extends Us{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=fa(this.code,e,t),this}get names(){return this.code instanceof ee._CodeOrName?this.code.names:{}}}class Ad extends Us{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;gH(e,s.names),n.splice(r,1)}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>zo(e,t.names),{})}}class zs extends Ad{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class e_ extends Ad{}class cc extends zs{}cc.kind="else";class xs extends zs{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 xs?t:t.nodes;if(this.nodes.length)return this;return new xs(o_(e),t instanceof xs?[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=fa(this.condition,e,t),this}get names(){let e=super.names;if(_d(e,this.condition),this.else)zo(e,this.else.names);return e}}xs.kind="if";class ua extends zs{}ua.kind="for";class t_ extends ua{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=fa(this.iteration,e,t),this}get names(){return zo(super.names,this.iteration.names)}}class n_ extends ua{constructor(e,t,n,r){super();this.varKind=e,this.name=t,this.from=n,this.to=r}render(e){let t=e.es5?xt.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=_d(super.names,this.from);return _d(e,this.to)}}class Ux extends ua{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=fa(this.iterable,e,t),this}get names(){return zo(super.names,this.iterable.names)}}class Ed extends zs{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)}}Ed.kind="func";class jd extends Ad{render(e){return"return "+super.render(e)}}jd.kind="return";class r_ extends zs{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)zo(e,this.catch.names);if(this.finally)zo(e,this.finally.names);return e}}class Pd extends zs{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}Pd.kind="catch";class kd extends zs{render(e){return"finally"+super.render(e)}}kd.kind="finally";class s_{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
633
+ `:""},this._extScope=e,this._scope=new xt.Scope({parent:e}),this._nodes=[new e_]}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 Kk(e,s,n)),s}const(e,t,n){return this._def(xt.varKinds.const,e,t,n)}let(e,t,n){return this._def(xt.varKinds.let,e,t,n)}var(e,t,n){return this._def(xt.varKinds.var,e,t,n)}assign(e,t,n){return this._leafNode(new Kx(e,t,n))}add(e,t){return this._leafNode(new Gk(e,wn.operators.ADD,t))}code(e){if(typeof e=="function")e();else if(e!==ee.nil)this._leafNode(new Qk(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(":"),ee.addCodeArg(t,r)}return t.push("}"),new ee._Code(t)}if(e,t,n){if(this._blockNode(new xs(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 xs(e))}else(){return this._elseNode(new cc)}endIf(){return this._endBlockNode(xs,cc)}_for(e,t){if(this._blockNode(e),t)this.code(t).endFor();return this}for(e,t){return this._for(new t_(e),t)}forRange(e,t,n,r,s=this.opts.es5?xt.varKinds.var:xt.varKinds.let){let o=this._scope.toName(e);return this._for(new n_(s,o,t,n),()=>r(o))}forOf(e,t,n,r=xt.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let o=t instanceof ee.Name?t:this.var("_arr",t);return this.forRange("_i",0,ee._`${o}.length`,(i)=>{this.var(s,ee._`${o}[${i}]`),n(s)})}return this._for(new Ux("of",r,s,t),()=>n(s))}forIn(e,t,n,r=this.opts.es5?xt.varKinds.var:xt.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,ee._`Object.keys(${t})`,n);let s=this._scope.toName(e);return this._for(new Ux("in",r,s,t),()=>n(s))}endFor(){return this._endBlockNode(ua)}label(e){return this._leafNode(new Xk(e))}break(e){return this._leafNode(new Yk(e))}return(e){let t=new jd;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(jd)}try(e,t,n){if(!t&&!n)throw Error('CodeGen: "try" without "catch" and "finally"');let r=new r_;if(this._blockNode(r),this.code(e),t){let s=this.name("e");this._currNode=r.catch=new Pd(s),t(s)}if(n)this._currNode=r.finally=new kd,this.code(n);return this._endBlockNode(Pd,kd)}throw(e){return this._leafNode(new Zk(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=ee.nil,n,r){if(this._blockNode(new Ed(e,t,n)),r)this.code(r).endFunc();return this}endFunc(){return this._endBlockNode(Ed)}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 xs))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}}wn.CodeGen=s_;function zo(e,t){for(let n in t)e[n]=(e[n]||0)+(t[n]||0);return e}function _d(e,t){return t instanceof ee._CodeOrName?zo(e,t.names):e}function fa(e,t,n){if(e instanceof ee.Name)return r(e);if(!s(e))return e;return new ee._Code(e._items.reduce((o,i)=>{if(i instanceof ee.Name)i=r(i);if(i instanceof ee._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 ee._Code&&o._items.some((i)=>i instanceof ee.Name&&t[i.str]===1&&n[i.str]!==void 0)}}function gH(e,t){for(let n in t)e[n]=(e[n]||0)-(t[n]||0)}function o_(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:ee._`!${zx(e)}`}wn.not=o_;var yH=i_(wn.operators.AND);function xH(...e){return e.reduce(yH)}wn.and=xH;var bH=i_(wn.operators.OR);function $H(...e){return e.reduce(bH)}wn.or=$H;function i_(e){return(t,n)=>t===ee.nil?n:n===ee.nil?t:ee._`${zx(t)} ${e} ${zx(n)}`}function zx(e){return e instanceof ee.Name?e:ee._`(${e})`}});var Ce=B(function(g_){Object.defineProperty(g_,"__esModule",{value:!0});g_.checkStrictMode=g_.getErrorPath=g_.Type=g_.useFunc=g_.setEvaluated=g_.evaluatedPropsToName=g_.mergeEvaluated=g_.eachItem=g_.unescapeJsonPointer=g_.escapeJsonPointer=g_.escapeFragment=g_.unescapeFragment=g_.schemaRefOrVal=g_.schemaHasRulesButRef=g_.schemaHasRules=g_.checkUnknownRules=g_.alwaysValidSchema=g_.toHash=void 0;var fe=$e(),u_=lc();function EH(e){let t={};for(let n of e)t[n]=!0;return t}g_.toHash=EH;function jH(e,t){if(typeof t=="boolean")return t;if(Object.keys(t).length===0)return!0;return f_(e,t),!d_(t,e.self.RULES.all)}g_.alwaysValidSchema=jH;function f_(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])h_(e,`unknown keyword: "${o}"`)}g_.checkUnknownRules=f_;function d_(e,t){if(typeof e=="boolean")return!e;for(let n in e)if(t[n])return!0;return!1}g_.schemaHasRules=d_;function PH(e,t){if(typeof e=="boolean")return!e;for(let n in e)if(n!=="$ref"&&t.all[n])return!0;return!1}g_.schemaHasRulesButRef=PH;function kH({topSchemaRef:e,schemaPath:t},n,r,s){if(!s){if(typeof n=="number"||typeof n=="boolean")return n;if(typeof n=="string")return fe._`${n}`}return fe._`${e}${t}${fe.getProperty(r)}`}g_.schemaRefOrVal=kH;function _H(e){return p_(decodeURIComponent(e))}g_.unescapeFragment=_H;function OH(e){return encodeURIComponent(Xx(e))}g_.escapeFragment=OH;function Xx(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}g_.escapeJsonPointer=Xx;function p_(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}g_.unescapeJsonPointer=p_;function AH(e,t){if(Array.isArray(e))for(let n of e)t(n);else t(e)}g_.eachItem=AH;function l_({mergeNames:e,mergeToName:t,mergeValues:n,resultToName:r}){return(s,o,i,a)=>{let l=i===void 0?o:i instanceof fe.Name?(o instanceof fe.Name?e(s,o,i):t(s,o,i),i):o instanceof fe.Name?(t(s,i,o),o):n(o,i);return a===fe.Name&&!(l instanceof fe.Name)?r(s,l):l}}g_.mergeEvaluated={props:l_({mergeNames:(e,t,n)=>e.if(fe._`${n} !== true && ${t} !== undefined`,()=>{e.if(fe._`${t} === true`,()=>e.assign(n,!0),()=>e.assign(n,fe._`${n} || {}`).code(fe._`Object.assign(${n}, ${t})`))}),mergeToName:(e,t,n)=>e.if(fe._`${n} !== true`,()=>{if(t===!0)e.assign(n,!0);else e.assign(n,fe._`${n} || {}`),Yx(e,n,t)}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:m_}),items:l_({mergeNames:(e,t,n)=>e.if(fe._`${n} !== true && ${t} !== undefined`,()=>e.assign(n,fe._`${t} === true ? true : ${n} > ${t} ? ${n} : ${t}`)),mergeToName:(e,t,n)=>e.if(fe._`${n} !== true`,()=>e.assign(n,t===!0?!0:fe._`${n} > ${t} ? ${n} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function m_(e,t){if(t===!0)return e.var("props",!0);let n=e.var("props",fe._`{}`);if(t!==void 0)Yx(e,n,t);return n}g_.evaluatedPropsToName=m_;function Yx(e,t,n){Object.keys(n).forEach((r)=>e.assign(fe._`${t}${fe.getProperty(r)}`,!0))}g_.setEvaluated=Yx;var c_={};function CH(e,t){return e.scopeValue("func",{ref:t,code:c_[t.code]||(c_[t.code]=new u_._Code(t.code))})}g_.useFunc=CH;var Gx;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Gx||(g_.Type=Gx={}));function RH(e,t,n){if(e instanceof fe.Name){let r=t===Gx.Num;return n?r?fe._`"[" + ${e} + "]"`:fe._`"['" + ${e} + "']"`:r?fe._`"/" + ${e}`:fe._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return n?fe.getProperty(e).toString():"/"+Xx(e)}g_.getErrorPath=RH;function h_(e,t,n=e.opts.strictSchema){if(!n)return;if(t=`strict mode: ${t}`,n===!0)throw Error(t);e.self.logger.warn(t)}g_.checkStrictMode=h_});var Zn=B(function(x_){Object.defineProperty(x_,"__esModule",{value:!0});var Fe=$e(),XH={data:new Fe.Name("data"),valCxt:new Fe.Name("valCxt"),instancePath:new Fe.Name("instancePath"),parentData:new Fe.Name("parentData"),parentDataProperty:new Fe.Name("parentDataProperty"),rootData:new Fe.Name("rootData"),dynamicAnchors:new Fe.Name("dynamicAnchors"),vErrors:new Fe.Name("vErrors"),errors:new Fe.Name("errors"),this:new Fe.Name("this"),self:new Fe.Name("self"),scope:new Fe.Name("scope"),json:new Fe.Name("json"),jsonPos:new Fe.Name("jsonPos"),jsonLen:new Fe.Name("jsonLen"),jsonPart:new Fe.Name("jsonPart")};x_.default=XH});var uc=B(function(w_){Object.defineProperty(w_,"__esModule",{value:!0});w_.extendErrors=w_.resetErrorsCount=w_.reportExtraError=w_.reportError=w_.keyword$DataError=w_.keywordError=void 0;var ne=$e(),Ks=Ce(),cn=Zn();w_.keywordError={message:({keyword:e})=>ne.str`must pass "${e}" keyword validation`};w_.keyword$DataError={message:({keyword:e,schemaType:t})=>t?ne.str`"${e}" keyword must be ${t} ($data)`:ne.str`"${e}" keyword is invalid ($data)`};function ZH(e,t=w_.keywordError,n,r){let{it:s}=e,{gen:o,compositeRule:i,allErrors:a}=s,l=S_(e,t,n);if(r!==null&&r!==void 0?r:i||a)b_(o,l);else $_(s,ne._`[${l}]`)}w_.reportError=ZH;function QH(e,t=w_.keywordError,n){let{it:r}=e,{gen:s,compositeRule:o,allErrors:i}=r,a=S_(e,t,n);if(b_(s,a),!(o||i))$_(r,cn.default.vErrors)}w_.reportExtraError=QH;function eW(e,t){e.assign(cn.default.errors,t),e.if(ne._`${cn.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(ne._`${cn.default.vErrors}.length`,t),()=>e.assign(cn.default.vErrors,null)))}w_.resetErrorsCount=eW;function tW({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,cn.default.errors,(a)=>{if(e.const(i,ne._`${cn.default.vErrors}[${a}]`),e.if(ne._`${i}.instancePath === undefined`,()=>e.assign(ne._`${i}.instancePath`,ne.strConcat(cn.default.instancePath,o.errorPath))),e.assign(ne._`${i}.schemaPath`,ne.str`${o.errSchemaPath}/${t}`),o.opts.verbose)e.assign(ne._`${i}.schema`,n),e.assign(ne._`${i}.data`,r)})}w_.extendErrors=tW;function b_(e,t){let n=e.const("err",t);e.if(ne._`${cn.default.vErrors} === null`,()=>e.assign(cn.default.vErrors,ne._`[${n}]`),ne._`${cn.default.vErrors}.push(${n})`),e.code(ne._`${cn.default.errors}++`)}function $_(e,t){let{gen:n,validateName:r,schemaEnv:s}=e;if(s.$async)n.throw(ne._`new ${e.ValidationError}(${t})`);else n.assign(ne._`${r}.errors`,t),n.return(!1)}var Ko={keyword:new ne.Name("keyword"),schemaPath:new ne.Name("schemaPath"),params:new ne.Name("params"),propertyName:new ne.Name("propertyName"),message:new ne.Name("message"),schema:new ne.Name("schema"),parentSchema:new ne.Name("parentSchema")};function S_(e,t,n){let{createErrors:r}=e.it;if(r===!1)return ne._`{}`;return nW(e,t,n)}function nW(e,t,n={}){let{gen:r,it:s}=e,o=[rW(s,n),sW(e,n)];return oW(e,t,o),r.object(...o)}function rW({errorPath:e},{instancePath:t}){let n=t?ne.str`${e}${Ks.getErrorPath(t,Ks.Type.Str)}`:e;return[cn.default.instancePath,ne.strConcat(cn.default.instancePath,n)]}function sW({keyword:e,it:{errSchemaPath:t}},{schemaPath:n,parentSchema:r}){let s=r?t:ne.str`${t}/${e}`;if(n)s=ne.str`${s}${Ks.getErrorPath(n,Ks.Type.Str)}`;return[Ko.schemaPath,s]}function oW(e,{params:t,message:n},r){let{keyword:s,data:o,schemaValue:i,it:a}=e,{opts:l,propertyName:c,topSchemaRef:u,schemaPath:d}=a;if(r.push([Ko.keyword,s],[Ko.params,typeof t=="function"?t(e):t||ne._`{}`]),l.messages)r.push([Ko.message,typeof n=="function"?n(e):n]);if(l.verbose)r.push([Ko.schema,i],[Ko.parentSchema,ne._`${u}${d}`],[cn.default.data,o]);if(c)r.push([Ko.propertyName,c])}});var O_=B(function(k_){Object.defineProperty(k_,"__esModule",{value:!0});k_.boolOrEmptySchema=k_.topBoolOrEmptySchema=void 0;var E_=uc(),j_=$e(),uW=Zn(),fW={message:"boolean schema is false"};function dW(e){let{gen:t,schema:n,validateName:r}=e;if(n===!1)P_(e,!1);else if(typeof n=="object"&&n.$async===!0)t.return(uW.default.data);else t.assign(j_._`${r}.errors`,null),t.return(!0)}k_.topBoolOrEmptySchema=dW;function pW(e,t){let{gen:n,schema:r}=e;if(r===!1)n.var(t,!1),P_(e);else n.var(t,!0)}k_.boolOrEmptySchema=pW;function P_(e,t){let{gen:n,data:r}=e;E_.reportError({gen:n,keyword:"false schema",data:r,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},fW,void 0,t)}});var Qx=B(function(A_){Object.defineProperty(A_,"__esModule",{value:!0});A_.getRules=A_.isJSONType=void 0;var hW=["string","number","integer","boolean","null","object","array"],gW=new Set(hW);function yW(e){return typeof e=="string"&&gW.has(e)}A_.isJSONType=yW;function xW(){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:{}}}A_.getRules=xW});var eb=B(function(N_){Object.defineProperty(N_,"__esModule",{value:!0});N_.shouldUseRule=N_.shouldUseGroup=N_.schemaHasRulesForType=void 0;function $W({schema:e,self:t},n){let r=t.RULES.types[n];return r&&r!==!0&&R_(e,r)}N_.schemaHasRulesForType=$W;function R_(e,t){return t.rules.some((n)=>T_(e,n))}N_.shouldUseGroup=R_;function T_(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))}N_.shouldUseRule=T_});var fc=B(function(V_){Object.defineProperty(V_,"__esModule",{value:!0});V_.reportTypeError=V_.checkDataTypes=V_.checkDataType=V_.coerceAndCheckDataType=V_.getJSONTypes=V_.getSchemaTypes=V_.DataType=void 0;var M_=Qx(),I_=eb(),D_=uc(),Z=$e(),Rd=Ce(),da;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(da||(V_.DataType=da={}));function vW(e){let t=L_(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}V_.getSchemaTypes=vW;function L_(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(M_.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}V_.getJSONTypes=L_;function EW(e,t){let{gen:n,data:r,opts:s}=e,o=jW(t,s.coerceTypes),i=t.length>0&&!(o.length===0&&t.length===1&&I_.schemaHasRulesForType(e,t[0]));if(i){let a=nb(t,r,s.strictNumbers,da.Wrong);n.if(a,()=>{if(o.length)PW(e,t,o);else rb(e)})}return i}V_.coerceAndCheckDataType=EW;var F_=new Set(["string","number","integer","boolean","null"]);function jW(e,t){return t?e.filter((n)=>F_.has(n)||t==="array"&&n==="array"):[]}function PW(e,t,n){let{gen:r,data:s,opts:o}=e,i=r.let("dataType",Z._`typeof ${s}`),a=r.let("coerced",Z._`undefined`);if(o.coerceTypes==="array")r.if(Z._`${i} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,()=>r.assign(s,Z._`${s}[0]`).assign(i,Z._`typeof ${s}`).if(nb(t,s,o.strictNumbers),()=>r.assign(a,s)));r.if(Z._`${a} !== undefined`);for(let c of n)if(F_.has(c)||c==="array"&&o.coerceTypes==="array")l(c);r.else(),rb(e),r.endIf(),r.if(Z._`${a} !== undefined`,()=>{r.assign(s,a),kW(e,a)});function l(c){switch(c){case"string":r.elseIf(Z._`${i} == "number" || ${i} == "boolean"`).assign(a,Z._`"" + ${s}`).elseIf(Z._`${s} === null`).assign(a,Z._`""`);return;case"number":r.elseIf(Z._`${i} == "boolean" || ${s} === null
634
+ || (${i} == "string" && ${s} && ${s} == +${s})`).assign(a,Z._`+${s}`);return;case"integer":r.elseIf(Z._`${i} === "boolean" || ${s} === null
635
+ || (${i} === "string" && ${s} && ${s} == +${s} && !(${s} % 1))`).assign(a,Z._`+${s}`);return;case"boolean":r.elseIf(Z._`${s} === "false" || ${s} === 0 || ${s} === null`).assign(a,!1).elseIf(Z._`${s} === "true" || ${s} === 1`).assign(a,!0);return;case"null":r.elseIf(Z._`${s} === "" || ${s} === 0 || ${s} === false`),r.assign(a,null);return;case"array":r.elseIf(Z._`${i} === "string" || ${i} === "number"
636
+ || ${i} === "boolean" || ${s} === null`).assign(a,Z._`[${s}]`)}}}function kW({gen:e,parentData:t,parentDataProperty:n},r){e.if(Z._`${t} !== undefined`,()=>e.assign(Z._`${t}[${n}]`,r))}function tb(e,t,n,r=da.Correct){let s=r===da.Correct?Z.operators.EQ:Z.operators.NEQ,o;switch(e){case"null":return Z._`${t} ${s} null`;case"array":o=Z._`Array.isArray(${t})`;break;case"object":o=Z._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":o=i(Z._`!(${t} % 1) && !isNaN(${t})`);break;case"number":o=i();break;default:return Z._`typeof ${t} ${s} ${e}`}return r===da.Correct?o:Z.not(o);function i(a=Z.nil){return Z.and(Z._`typeof ${t} == "number"`,a,n?Z._`isFinite(${t})`:Z.nil)}}V_.checkDataType=tb;function nb(e,t,n,r){if(e.length===1)return tb(e[0],t,n,r);let s,o=Rd.toHash(e);if(o.array&&o.object){let i=Z._`typeof ${t} != "object"`;s=o.null?i:Z._`!${t} || ${i}`,delete o.null,delete o.array,delete o.object}else s=Z.nil;if(o.number)delete o.integer;for(let i in o)s=Z.and(s,tb(i,t,n,r));return s}V_.checkDataTypes=nb;var _W={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?Z._`{type: ${e}}`:Z._`{type: ${t}}`};function rb(e){let t=OW(e);D_.reportError(t,_W)}V_.reportTypeError=rb;function OW(e){let{gen:t,data:n,schema:r}=e,s=Rd.schemaRefOrVal(e,r,"type");return{gen:t,keyword:"type",data:n,schema:r.type,schemaCode:s,schemaValue:s,parentSchema:r,params:{},it:e}}});var z_=B(function(B_){Object.defineProperty(B_,"__esModule",{value:!0});B_.assignDefaults=void 0;var Qn=$e(),W_=Ce();function MW(e,t){let{properties:n,items:r}=e.schema;if(t==="object"&&n)for(let s in n)H_(e,s,n[s].default);else if(t==="array"&&Array.isArray(r))r.forEach((s,o)=>H_(e,o,s.default))}B_.assignDefaults=MW;function H_(e,t,n){let{gen:r,compositeRule:s,data:o,opts:i}=e;if(n===void 0)return;let a=Qn._`${o}${Qn.getProperty(t)}`;if(s){W_.checkStrictMode(e,`default is ignored for: ${a}`);return}let l=Qn._`${a} === undefined`;if(i.useDefaults==="empty")l=Qn._`${l} || ${a} === null || ${a} === ""`;r.if(l,Qn._`${a} = ${Qn.stringify(n)}`)}});var er=B(function(Y_){Object.defineProperty(Y_,"__esModule",{value:!0});Y_.validateUnion=Y_.validateArray=Y_.usePattern=Y_.callValidateCode=Y_.schemaProperties=Y_.allSchemaProperties=Y_.noPropertyInData=Y_.propertyInData=Y_.isOwnProperty=Y_.hasPropFunc=Y_.reportMissingProp=Y_.checkMissingProp=Y_.checkReportMissingProp=void 0;var he=$e(),pa=Ce(),Gs=Zn(),K_=Ce();function IW(e,t){let{gen:n,data:r,it:s}=e;n.if(ob(n,r,t,s.opts.ownProperties),()=>{e.setParams({missingProperty:he._`${t}`},!0),e.error()})}Y_.checkReportMissingProp=IW;function DW({gen:e,data:t,it:{opts:n}},r,s){return he.or(...r.map((o)=>he.and(ob(e,t,o,n.ownProperties),he._`${s} = ${o}`)))}Y_.checkMissingProp=DW;function LW(e,t){e.setParams({missingProperty:t},!0),e.error()}Y_.reportMissingProp=LW;function G_(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:he._`Object.prototype.hasOwnProperty`})}Y_.hasPropFunc=G_;function sb(e,t,n){return he._`${G_(e)}.call(${t}, ${n})`}Y_.isOwnProperty=sb;function FW(e,t,n,r){let s=he._`${t}${he.getProperty(n)} !== undefined`;return r?he._`${s} && ${sb(e,t,n)}`:s}Y_.propertyInData=FW;function ob(e,t,n,r){let s=he._`${t}${he.getProperty(n)} === undefined`;return r?he.or(s,he.not(sb(e,t,n))):s}Y_.noPropertyInData=ob;function X_(e){return e?Object.keys(e).filter((t)=>t!=="__proto__"):[]}Y_.allSchemaProperties=X_;function VW(e,t){return X_(t).filter((n)=>!pa.alwaysValidSchema(e,t[n]))}Y_.schemaProperties=VW;function qW({schemaCode:e,data:t,it:{gen:n,topSchemaRef:r,schemaPath:s,errorPath:o},it:i},a,l,c){let u=c?he._`${e}, ${t}, ${r}${s}`:t,d=[[Gs.default.instancePath,he.strConcat(Gs.default.instancePath,o)],[Gs.default.parentData,i.parentData],[Gs.default.parentDataProperty,i.parentDataProperty],[Gs.default.rootData,Gs.default.rootData]];if(i.opts.dynamicRef)d.push([Gs.default.dynamicAnchors,Gs.default.dynamicAnchors]);let p=he._`${u}, ${n.object(...d)}`;return l!==he.nil?he._`${a}.call(${l}, ${p})`:he._`${a}(${p})`}Y_.callValidateCode=qW;var HW=he._`new RegExp`;function WW({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:he._`${s.code==="new RegExp"?HW:K_.useFunc(e,s)}(${n}, ${r})`})}Y_.usePattern=WW;function BW(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 l=t.const("len",he._`${n}.length`);t.forRange("i",0,l,(c)=>{e.subschema({keyword:r,dataProp:c,dataPropType:pa.Type.Num},o),t.if(he.not(o),a)})}}Y_.validateArray=BW;function UW(e){let{gen:t,schema:n,keyword:r,it:s}=e;if(!Array.isArray(n))throw Error("ajv implementation error");if(n.some((l)=>pa.alwaysValidSchema(s,l))&&!s.opts.unevaluated)return;let i=t.let("valid",!1),a=t.name("_valid");t.block(()=>n.forEach((l,c)=>{let u=e.subschema({keyword:r,schemaProp:c,compositeRule:!0},a);if(t.assign(i,he._`${i} || ${a}`),!e.mergeValidEvaluated(u,a))t.if(he.not(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}Y_.validateUnion=UW});var oO=B(function(rO){Object.defineProperty(rO,"__esModule",{value:!0});rO.validateKeywordUsage=rO.validSchemaType=rO.funcKeywordCode=rO.macroKeywordCode=void 0;var qe=$e(),Go=Zn(),eO=er(),tO=uc();function oB(e,t){let{gen:n,keyword:r,schema:s,parentSchema:o,it:i}=e,a=t.macro.call(i.self,s,o,i),l=nO(n,r,a);if(i.opts.validateSchema!==!1)i.self.validateSchema(a,!0);let c=n.name("valid");e.subschema({schema:a,schemaPath:qe.nil,errSchemaPath:`${i.errSchemaPath}/${r}`,topSchemaRef:l,compositeRule:!0},c),e.pass(c,()=>e.error(!0))}rO.macroKeywordCode=oB;function iB(e,t){var n;let{gen:r,keyword:s,schema:o,parentSchema:i,$data:a,it:l}=e;lB(l,t);let c=!a&&t.compile?t.compile.call(l.self,o,i,l):t.validate,u=nO(r,s,c),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(b(),t.modifying)Q_(e);h(()=>e.error())}else{let x=t.async?m():g();if(t.modifying)Q_(e);h(()=>aB(e,x))}}function m(){let x=r.let("ruleErrs",null);return r.try(()=>b(qe._`await `),(k)=>r.assign(d,!1).if(qe._`${k} instanceof ${l.ValidationError}`,()=>r.assign(x,qe._`${k}.errors`),()=>r.throw(k))),x}function g(){let x=qe._`${u}.errors`;return r.assign(x,null),b(qe.nil),x}function b(x=t.async?qe._`await `:qe.nil){let k=l.opts.passContext?Go.default.this:Go.default.self,w=!(("compile"in t)&&!a||t.schema===!1);r.assign(d,qe._`${x}${eO.callValidateCode(e,u,k,w)}`,t.modifying)}function h(x){var k;r.if(qe.not((k=t.valid)!==null&&k!==void 0?k:d),x)}}rO.funcKeywordCode=iB;function Q_(e){let{gen:t,data:n,it:r}=e;t.if(r.parentData,()=>t.assign(n,qe._`${r.parentData}[${r.parentDataProperty}]`))}function aB(e,t){let{gen:n}=e;n.if(qe._`Array.isArray(${t})`,()=>{n.assign(Go.default.vErrors,qe._`${Go.default.vErrors} === null ? ${t} : ${Go.default.vErrors}.concat(${t})`).assign(Go.default.errors,qe._`${Go.default.vErrors}.length`),tO.extendErrors(e)},()=>e.error())}function lB({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}function nO(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:qe.stringify(n)})}function cB(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")}rO.validSchemaType=cB;function uB({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 l=`keyword "${o}" value is invalid at path "${r}": `+n.errorsText(s.validateSchema.errors);if(t.validateSchema==="log")n.logger.error(l);else throw Error(l)}}}rO.validateKeywordUsage=uB});var lO=B(function(iO){Object.defineProperty(iO,"__esModule",{value:!0});iO.extendSubschemaMode=iO.extendSubschemaData=iO.getSubschema=void 0;var Nt=$e(),Td=Ce();function mB(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:Nt._`${e.schemaPath}${Nt.getProperty(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[n],schemaPath:Nt._`${e.schemaPath}${Nt.getProperty(t)}${Nt.getProperty(n)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${Td.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')}iO.getSubschema=mB;function hB(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:c,dataPathArr:u,opts:d}=t,p=a.let("data",Nt._`${t.data}${Nt.getProperty(n)}`,!0);l(p),e.errorPath=Nt.str`${c}${Td.getErrorPath(n,r,d.jsPropertySyntax)}`,e.parentDataProperty=Nt._`${n}`,e.dataPathArr=[...u,e.parentDataProperty]}if(s!==void 0){let c=s instanceof Nt.Name?s:a.let("data",s,!0);if(l(c),i!==void 0)e.propertyName=i}if(o)e.dataTypes=o;function l(c){e.data=c,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,c]}}iO.extendSubschemaData=hB;function gB(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}iO.extendSubschemaMode=gB});var ib=B(function(Kse,cO){cO.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 fO=B(function(Gse,uO){var Xs=uO.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(){};Nd(t,r,s,e,"",e)};Xs.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Xs.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Xs.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Xs.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 Nd(e,t,n,r,s,o,i,a,l,c){if(r&&typeof r=="object"&&!Array.isArray(r)){t(r,s,o,i,a,l,c);for(var u in r){var d=r[u];if(Array.isArray(d)){if(u in Xs.arrayKeywords)for(var p=0;p<d.length;p++)Nd(e,t,n,d[p],s+"/"+u+"/"+p,o,s,u,r,p)}else if(u in Xs.propsKeywords){if(d&&typeof d=="object")for(var m in d)Nd(e,t,n,d[m],s+"/"+u+"/"+bB(m),o,s,u,r,m)}else if(u in Xs.keywords||e.allKeys&&!(u in Xs.skipKeywords))Nd(e,t,n,d,s+"/"+u,o,s,u,r)}n(r,s,o,i,a,l,c)}}function bB(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var dc=B(function(gO){Object.defineProperty(gO,"__esModule",{value:!0});gO.getSchemaRefs=gO.resolveUrl=gO.normalizeId=gO._getFullPath=gO.getFullPath=gO.inlineRef=void 0;var dO=Ce(),$B=ib(),SB=fO(),wB=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function vB(e,t=!0){if(typeof e=="boolean")return!0;if(t===!0)return!ab(e);if(!t)return!1;return pO(e)<=t}gO.inlineRef=vB;var EB=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function ab(e){for(let t in e){if(EB.has(t))return!0;let n=e[t];if(Array.isArray(n)&&n.some(ab))return!0;if(typeof n=="object"&&ab(n))return!0}return!1}function pO(e){let t=0;for(let n in e){if(n==="$ref")return 1/0;if(t++,wB.has(n))continue;if(typeof e[n]=="object")dO.eachItem(e[n],(r)=>t+=pO(r));if(t===1/0)return 1/0}return t}function mO(e,t="",n){if(n!==!1)t=ma(t);let r=e.parse(t);return hO(e,r)}gO.getFullPath=mO;function hO(e,t){return e.serialize(t).split("#")[0]+"#"}gO._getFullPath=hO;var jB=/#\/?$/;function ma(e){return e?e.replace(jB,""):""}gO.normalizeId=ma;function PB(e,t,n){return n=ma(n),e.resolve(t,n)}gO.resolveUrl=PB;var kB=/^[a-z_][-a-z0-9._]*$/i;function _B(e,t){if(typeof e=="boolean")return{};let{schemaId:n,uriResolver:r}=this.opts,s=ma(e[n]||t),o={"":s},i=mO(r,s,!1),a={},l=new Set;return SB(e,{allKeys:!0},(d,p,m,g)=>{if(g===void 0)return;let b=i+p,h=o[g];if(typeof d[n]=="string")h=x.call(this,d[n]);k.call(this,d.$anchor),k.call(this,d.$dynamicAnchor),o[p]=h;function x(w){let v=this.opts.uriResolver.resolve;if(w=ma(h?v(h,w):w),l.has(w))throw u(w);l.add(w);let E=this.refs[w];if(typeof E=="string")E=this.refs[E];if(typeof E=="object")c(d,E.schema,w);else if(w!==ma(b))if(w[0]==="#")c(d,a[w],w),a[w]=d;else this.refs[w]=b;return w}function k(w){if(typeof w=="string"){if(!kB.test(w))throw Error(`invalid anchor "${w}"`);x.call(this,`#${w}`)}}}),a;function c(d,p,m){if(p!==void 0&&!$B(d,p))throw u(m)}function u(d){return Error(`reference "${d}" resolves to more than one schema`)}}gO.getSchemaRefs=_B});var ya=B(function(RO){Object.defineProperty(RO,"__esModule",{value:!0});RO.getData=RO.KeywordCxt=RO.validateFunctionCode=void 0;var Md=O_(),Jd=fc(),ga=eb(),Ys=fc(),SO=z_(),Mr=oO(),ha=lO(),q=$e(),be=Zn(),wO=dc(),Dt=Ce(),Jr=uc();function NB(e){if(jO(e)){if(PO(e),EO(e)){IB(e);return}}vO(e,()=>Md.topBoolOrEmptySchema(e))}RO.validateFunctionCode=NB;function vO({gen:e,validateName:t,schema:n,schemaEnv:r,opts:s},o){if(s.code.es5)e.func(t,q._`${be.default.data}, ${be.default.valCxt}`,r.$async,()=>{e.code(q._`"use strict"; ${xO(n,s)}`),MB(e,s),e.code(o)});else e.func(t,q._`${be.default.data}, ${JB(s)}`,r.$async,()=>e.code(xO(n,s)).code(o))}function JB(e){return q._`{${be.default.instancePath}="", ${be.default.parentData}, ${be.default.parentDataProperty}, ${be.default.rootData}=${be.default.data}${e.dynamicRef?q._`, ${be.default.dynamicAnchors}={}`:q.nil}}={}`}function MB(e,t){e.if(be.default.valCxt,()=>{if(e.var(be.default.instancePath,q._`${be.default.valCxt}.${be.default.instancePath}`),e.var(be.default.parentData,q._`${be.default.valCxt}.${be.default.parentData}`),e.var(be.default.parentDataProperty,q._`${be.default.valCxt}.${be.default.parentDataProperty}`),e.var(be.default.rootData,q._`${be.default.valCxt}.${be.default.rootData}`),t.dynamicRef)e.var(be.default.dynamicAnchors,q._`${be.default.valCxt}.${be.default.dynamicAnchors}`)},()=>{if(e.var(be.default.instancePath,q._`""`),e.var(be.default.parentData,q._`undefined`),e.var(be.default.parentDataProperty,q._`undefined`),e.var(be.default.rootData,be.default.data),t.dynamicRef)e.var(be.default.dynamicAnchors,q._`{}`)})}function IB(e){let{schema:t,opts:n,gen:r}=e;vO(e,()=>{if(n.$comment&&t.$comment)_O(e);if(qB(e),r.let(be.default.vErrors,null),r.let(be.default.errors,0),n.unevaluated)DB(e);kO(e),BB(e)});return}function DB(e){let{gen:t,validateName:n}=e;e.evaluated=t.const("evaluated",q._`${n}.evaluated`),t.if(q._`${e.evaluated}.dynamicProps`,()=>t.assign(q._`${e.evaluated}.props`,q._`undefined`)),t.if(q._`${e.evaluated}.dynamicItems`,()=>t.assign(q._`${e.evaluated}.items`,q._`undefined`))}function xO(e,t){let n=typeof e=="object"&&e[t.schemaId];return n&&(t.code.source||t.code.process)?q._`/*# sourceURL=${n} */`:q.nil}function LB(e,t){if(jO(e)){if(PO(e),EO(e)){FB(e,t);return}}Md.boolOrEmptySchema(e,t)}function EO({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 jO(e){return typeof e.schema!="boolean"}function FB(e,t){let{schema:n,gen:r,opts:s}=e;if(s.$comment&&n.$comment)_O(e);HB(e),WB(e);let o=r.const("_errs",be.default.errors);kO(e,o),r.var(t,q._`${o} === ${be.default.errors}`)}function PO(e){Dt.checkUnknownRules(e),VB(e)}function kO(e,t){if(e.opts.jtd)return bO(e,[],!1,t);let n=Jd.getSchemaTypes(e.schema),r=Jd.coerceAndCheckDataType(e,n);bO(e,n,!r,t)}function VB(e){let{schema:t,errSchemaPath:n,opts:r,self:s}=e;if(t.$ref&&r.ignoreKeywordsWithRef&&Dt.schemaHasRulesButRef(t,s.RULES))s.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}function qB(e){let{schema:t,opts:n}=e;if(t.default!==void 0&&n.useDefaults&&n.strictSchema)Dt.checkStrictMode(e,"default is ignored in the schema root")}function HB(e){let t=e.schema[e.opts.schemaId];if(t)e.baseId=wO.resolveUrl(e.opts.uriResolver,e.baseId,t)}function WB(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function _O({gen:e,schemaEnv:t,schema:n,errSchemaPath:r,opts:s}){let o=n.$comment;if(s.$comment===!0)e.code(q._`${be.default.self}.logger.log(${o})`);else if(typeof s.$comment=="function"){let i=q.str`${r}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code(q._`${be.default.self}.opts.$comment(${o}, ${i}, ${a}.schema)`)}}function BB(e){let{gen:t,schemaEnv:n,validateName:r,ValidationError:s,opts:o}=e;if(n.$async)t.if(q._`${be.default.errors} === 0`,()=>t.return(be.default.data),()=>t.throw(q._`new ${s}(${be.default.vErrors})`));else{if(t.assign(q._`${r}.errors`,be.default.vErrors),o.unevaluated)UB(e);t.return(q._`${be.default.errors} === 0`)}}function UB({gen:e,evaluated:t,props:n,items:r}){if(n instanceof q.Name)e.assign(q._`${t}.props`,n);if(r instanceof q.Name)e.assign(q._`${t}.items`,r)}function bO(e,t,n,r){let{gen:s,schema:o,data:i,allErrors:a,opts:l,self:c}=e,{RULES:u}=c;if(o.$ref&&(l.ignoreKeywordsWithRef||!Dt.schemaHasRulesButRef(o,u))){s.block(()=>AO(e,"$ref",u.all.$ref.definition));return}if(!l.jtd)zB(e,t);s.block(()=>{for(let p of u.rules)d(p);d(u.post)});function d(p){if(!ga.shouldUseGroup(o,p))return;if(p.type){if(s.if(Ys.checkDataType(p.type,i,l.strictNumbers)),$O(e,p),t.length===1&&t[0]===p.type&&n)s.else(),Ys.reportTypeError(e);s.endIf()}else $O(e,p);if(!a)s.if(q._`${be.default.errors} === ${r||0}`)}}function $O(e,t){let{gen:n,schema:r,opts:{useDefaults:s}}=e;if(s)SO.assignDefaults(e,t.type);n.block(()=>{for(let o of t.rules)if(ga.shouldUseRule(r,o))AO(e,o.keyword,o.definition,t.type)})}function zB(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;if(KB(e,t),!e.opts.allowUnionTypes)GB(e,t);XB(e,e.dataTypes)}function KB(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((n)=>{if(!OO(e.dataTypes,n))lb(e,`type "${n}" not allowed by context "${e.dataTypes.join(",")}"`)}),ZB(e,t)}function GB(e,t){if(t.length>1&&!(t.length===2&&t.includes("null")))lb(e,"use allowUnionTypes to allow union type keyword")}function XB(e,t){let n=e.self.RULES.all;for(let r in n){let s=n[r];if(typeof s=="object"&&ga.shouldUseRule(e.schema,s)){let{type:o}=s.definition;if(o.length&&!o.some((i)=>YB(t,i)))lb(e,`missing type "${o.join(",")}" for keyword "${r}"`)}}}function YB(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function OO(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function ZB(e,t){let n=[];for(let r of e.dataTypes)if(OO(t,r))n.push(r);else if(t.includes("integer")&&r==="number")n.push("integer");e.dataTypes=n}function lb(e,t){let n=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${n}" (strictTypes)`,Dt.checkStrictMode(e,t,e.opts.strictTypes)}class cb{constructor(e,t,n){if(Mr.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=Dt.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",CO(this.$data,e));else if(this.schemaCode=this.schemaValue,!Mr.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",be.default.errors)}result(e,t,n){this.failResult(q.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(q.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(q._`${t} !== undefined && (${q.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?Jr.reportExtraError:Jr.reportError)(this,this.def.error,t)}$dataError(){Jr.reportError(this,this.def.$dataError||Jr.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');Jr.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=q.nil){this.gen.block(()=>{this.check$data(e,n),t()})}check$data(e=q.nil,t=q.nil){if(!this.$data)return;let{gen:n,schemaCode:r,schemaType:s,def:o}=this;if(n.if(q.or(q._`${r} === undefined`,t)),e!==q.nil)n.assign(e,!0);if(s.length||o.validateSchema){if(n.elseIf(this.invalid$data()),this.$dataError(),e!==q.nil)n.assign(e,!1)}n.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:n,def:r,it:s}=this;return q.or(o(),i());function o(){if(n.length){if(!(t instanceof q.Name))throw Error("ajv implementation error");let a=Array.isArray(n)?n:[n];return q._`${Ys.checkDataTypes(a,t,s.opts.strictNumbers,Ys.DataType.Wrong)}`}return q.nil}function i(){if(r.validateSchema){let a=e.scopeValue("validate$data",{ref:r.validateSchema});return q._`!${a}(${t})`}return q.nil}}subschema(e,t){let n=ha.getSubschema(this.it,e);ha.extendSubschemaData(n,this.it,e),ha.extendSubschemaMode(n,e);let r={...this.it,...n,items:void 0,props:void 0};return LB(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=Dt.mergeEvaluated.props(r,e.props,n.props,t);if(n.items!==!0&&e.items!==void 0)n.items=Dt.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,q.Name)),!0}}RO.KeywordCxt=cb;function AO(e,t,n,r){let s=new cb(e,n,t);if("code"in n)n.code(s,r);else if(s.$data&&n.validate)Mr.funcKeywordCode(s,n);else if("macro"in n)Mr.macroKeywordCode(s,n);else if(n.compile||n.validate)Mr.funcKeywordCode(s,n)}var QB=/^\/(?:[^~]|~0|~1)*$/,eU=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function CO(e,{dataLevel:t,dataNames:n,dataPathArr:r}){let s,o;if(e==="")return be.default.rootData;if(e[0]==="/"){if(!QB.test(e))throw Error(`Invalid JSON-pointer: ${e}`);s=e,o=be.default.rootData}else{let c=eU.exec(e);if(!c)throw Error(`Invalid JSON-pointer: ${e}`);let u=+c[1];if(s=c[2],s==="#"){if(u>=t)throw Error(l("property/index",u));return r[t-u]}if(u>t)throw Error(l("data",u));if(o=n[t-u],!s)return o}let i=o,a=s.split("/");for(let c of a)if(c)o=q._`${o}${q.getProperty(Dt.unescapeJsonPointer(c))}`,i=q._`${i} && ${o}`;return i;function l(c,u){return`Cannot access ${c} ${u} levels up, current level is ${t}`}}RO.getData=CO});var pc=B(function(JO){Object.defineProperty(JO,"__esModule",{value:!0});class NO extends Error{constructor(e){super("validation failed");this.errors=e,this.ajv=this.validation=!0}}JO.default=NO});var ba=B(function(IO){Object.defineProperty(IO,"__esModule",{value:!0});var xa=dc();class MO extends Error{constructor(e,t,n,r){super(r||`can't resolve reference ${n} from id ${t}`);this.missingRef=xa.resolveUrl(e,t,n),this.missingSchema=xa.normalizeId(xa.getFullPath(e,this.missingRef))}}IO.default=MO});var hc=B(function(FO){Object.defineProperty(FO,"__esModule",{value:!0});FO.resolveSchema=FO.getCompilingSchema=FO.resolveRef=FO.compileSchema=FO.SchemaEnv=void 0;var bt=$e(),oU=pc(),Xo=Zn(),$t=dc(),Id=Ce(),DO=ya();class mc{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:$t.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={}}}FO.SchemaEnv=mc;function fb(e){let t=LO.call(this,e);if(t)return t;let n=$t.getFullPath(this.opts.uriResolver,e.root.baseId),{es5:r,lines:s}=this.opts.code,{ownProperties:o}=this.opts,i=new bt.CodeGen(this.scope,{es5:r,lines:s,ownProperties:o}),a;if(e.$async)a=i.scopeValue("Error",{ref:oU.default,code:bt._`require("ajv/dist/runtime/validation_error").default`});let l=i.scopeName("validate");e.validateName=l;let c={gen:i,allErrors:this.opts.allErrors,data:Xo.default.data,parentData:Xo.default.parentData,parentDataProperty:Xo.default.parentDataProperty,dataNames:[Xo.default.data],dataPathArr:[bt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:bt.stringify(e.schema)}:{ref:e.schema}),validateName:l,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:n,baseId:e.baseId||n,schemaPath:bt.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:bt._`""`,opts:this.opts,self:this},u;try{this._compilations.add(e),DO.validateFunctionCode(c),i.optimize(this.opts.code.optimize);let d=i.toString();if(u=`${i.scopeRefs(Xo.default.scope)}return ${d}`,this.opts.code.process)u=this.opts.code.process(u,e);let m=Function(`${Xo.default.self}`,`${Xo.default.scope}`,u)(this,this.scope.get());if(this.scope.value(l,{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:l,validateCode:d,scopeValues:i._values};if(this.opts.unevaluated){let{props:g,items:b}=c;if(m.evaluated={props:g instanceof bt.Name?void 0:g,items:b instanceof bt.Name?void 0:b,dynamicProps:g instanceof bt.Name,dynamicItems:b instanceof bt.Name},m.source)m.source.evaluated=bt.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)}}FO.compileSchema=fb;function iU(e,t,n){var r;n=$t.resolveUrl(this.opts.uriResolver,t,n);let s=e.refs[n];if(s)return s;let o=cU.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 mc({schema:i,schemaId:a,root:e,baseId:t})}if(o===void 0)return;return e.refs[n]=aU.call(this,o)}FO.resolveRef=iU;function aU(e){if($t.inlineRef(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:fb.call(this,e)}function LO(e){for(let t of this._compilations)if(lU(t,e))return t}FO.getCompilingSchema=LO;function lU(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function cU(e,t){let n;while(typeof(n=this.refs[t])=="string")t=n;return n||this.schemas[t]||Dd.call(this,e,t)}function Dd(e,t){let n=this.opts.uriResolver.parse(t),r=$t._getFullPath(this.opts.uriResolver,n),s=$t.getFullPath(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&r===s)return ub.call(this,n,e);let o=$t.normalizeId(r),i=this.refs[o]||this.schemas[o];if(typeof i=="string"){let a=Dd.call(this,e,i);if(typeof(a===null||a===void 0?void 0:a.schema)!=="object")return;return ub.call(this,n,a)}if(typeof(i===null||i===void 0?void 0:i.schema)!=="object")return;if(!i.validate)fb.call(this,i);if(o===$t.normalizeId(t)){let{schema:a}=i,{schemaId:l}=this.opts,c=a[l];if(c)s=$t.resolveUrl(this.opts.uriResolver,s,c);return new mc({schema:a,schemaId:l,root:e,baseId:s})}return ub.call(this,n,i)}FO.resolveSchema=Dd;var uU=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function ub(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 l=n[Id.unescapeFragment(a)];if(l===void 0)return;n=l;let c=typeof n==="object"&&n[this.opts.schemaId];if(!uU.has(a)&&c)t=$t.resolveUrl(this.opts.uriResolver,t,c)}let o;if(typeof n!="boolean"&&n.$ref&&!Id.schemaHasRulesButRef(n,this.RULES)){let a=$t.resolveUrl(this.opts.uriResolver,t,n.$ref);o=Dd.call(this,r,a)}let{schemaId:i}=this.opts;if(o=o||new mc({schema:n,schemaId:i,root:r,baseId:t}),o.schema!==o.root.schema)return o;return}});var qO=B(function(toe,hU){hU.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 yb=B(function(noe,XO){var gU=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),pb=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),yU=RegExp.prototype.test.bind(/^\d*$/u),Yo=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),mb=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),WO=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),hb=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),xU=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),vn=Array(256);for(let t=0;t<256;t++)vn[t]="%"+"0123456789ABCDEF"[t>>4]+"0123456789ABCDEF"[t&15];function en(e){if(e<2048)return vn[192|e>>6]+vn[128|e&63];if(e<65536)return vn[224|e>>12]+vn[128|e>>6&63]+vn[128|e&63];return vn[240|e>>18]+vn[128|e>>12&63]+vn[128|e>>6&63]+vn[128|e&63]}function bU(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 $U=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),SU=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),wU=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),vU=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function EU(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++){if(wU(e[t]))continue;if(e[t]==="%"&&t+2<e.length&&Yo(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function HO(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 jU(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 l=s[a];if(l==="")return;if(l.indexOf(".")!==-1){if(a!==s.length-1||t!==-1&&r.length===0||!pb(l))return;o+=2;continue}if(!$U(l))return;s[a]=parseInt(l,16).toString(16),o++}if(t===-1){if(o!==8)return;return HO(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 HO(i)}function db(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&&SU(r))return r=r.toLowerCase(),{host:`[${r}]`,escapedHost:r,isIPV6:!1,isIPVFuture:!0};if(PU(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),!EU(s))return{host:e,isIPV6:!1,error:!0};r=r.slice(0,o)}let i=jU(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 PU(e,t){let n=0;for(let r=0;r<e.length;r++)if(e[r]===t)n++;return n}function BO(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 kU(e){if(e===""||e[0]==="/")return BO(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 _U={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},OU=/[@/?#:]/g,AU=/[@/?#]/g;function UO(e,t){let n=t?AU:OU;return n.lastIndex=0,e.replace(n,(r)=>_U[r])}function zO(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(Yo(s)){let o=s.toUpperCase(),i=String.fromCharCode(parseInt(o,16));if(t&&mb(i))n+=i;else n+="%"+o;r+=2;continue}}n+=e[r]}return n}function CU(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(Yo(s)){let o=s.toUpperCase(),i=String.fromCharCode(parseInt(o,16));if(i!=="."&&mb(i))t+=i;else t+="%"+o;n+=2;continue}}if(WO(r))t+=r;else{let s=e.charCodeAt(n);if(s<128)t+=GO(s)?r:vn[s];else if(s<55296||s>57343)t+=en(s);else if(s<=56319&&n+1<e.length){let o=e.charCodeAt(n+1);if(o>=56320&&o<=57343)t+=en(65536+(s-55296<<10)+(o-56320)),n++;else t+=en(65533)}else t+=en(65533)}}return t}function RU(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(Yo(i)){n+="%"+i.toUpperCase(),s+=2;continue}}if(o==="/")r=!1;if(WO(o)&&(o!==":"||!r))n+=o;else{let i=e.charCodeAt(s);if(i<128)n+=vn[i];else if(i<55296||i>57343)n+=en(i);else if(i<=56319&&s+1<e.length){let a=e.charCodeAt(s+1);if(a>=56320&&a<=57343)n+=en(65536+(i-55296<<10)+(a-56320)),s++;else n+=en(65533)}else n+=en(65533)}}return n}function gb(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(Yo(o)){n+="%"+o.toUpperCase(),r+=2;continue}}if(t(s))n+=s;else{let o=e.charCodeAt(r);if(o<128)n+=vn[o];else if(o<55296||o>57343)n+=en(o);else if(o<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);if(i>=56320&&i<=57343)n+=en(65536+(o-55296<<10)+(i-56320)),r++;else n+=en(65533)}else n+=en(65533)}}return n}function KO(e){return gb(e,xU)}function TU(e){return gb(e,hb)}function NU(e){return gb(e,hb)}function GO(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 JU(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(Yo(s)){let o=s.toUpperCase(),i=String.fromCharCode(parseInt(o,16));if(mb(i))t+=i;else t+="%"+o;n+=2;continue}}if(hb(r))t+=r;else{let s=e.charCodeAt(n);if(s<128)t+=GO(s)?r:vn[s];else if(s<55296||s>57343)t+=en(s);else if(s<=56319&&n+1<e.length){let o=e.charCodeAt(n+1);if(o>=56320&&o<=57343)t+=en(65536+(s-55296<<10)+(o-56320)),n++;else t+=en(65533)}else t+=en(65533)}}return t}function MU(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(Yo(r)){t+="%"+r.toUpperCase(),n+=2;continue}}t+=escape(e[n])}return t}function IU(e){let t=[];if(e.userinfo!==void 0)t.push(KO(e.userinfo)),t.push("@");if(e.host!==void 0){let n=e.host;if(!pb(n)){let r=db(n);if(r.isIPV6!==!0&&r.isIPVFuture!==!0)n=zO(n,!0),r=db(n);if(r.isIPV6===!0||r.isIPVFuture===!0)n=`[${r.escapedHost}]`;else n=UO(n,!1)}t.push(n)}if(typeof e.port==="number"||typeof e.port==="string"){let n=String(e.port);if(!yU(n))throw TypeError("URI port is malformed.");t.push(":"),t.push(n)}return t.length?t.join(""):void 0}XO.exports={nonSimpleDomain:vU,recomposeAuthority:IU,reescapeHostDelimiters:UO,normalizePercentEncoding:zO,normalizePathEncoding:CU,serializePathEncoding:RU,normalizeQueryFragmentEncoding:JU,encodeUserinfo:KO,encodeQuery:TU,encodeFragment:NU,escapePreservingEscapes:MU,removeDotSegments:BO,removeDotSegmentsRelative:kU,isIPv4:pb,isUUID:gU,normalizeIPv6:db,stringArrayToHexStripped:bU}});var tA=B(function(roe,eA){var{isUUID:DU}=yb(),LU=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,FU=["http","https","ws","wss","urn","urn:uuid"];function VU(e){return FU.indexOf(e)!==-1}function xb(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 YO(e){if(!e.host)e.error=e.error||"HTTP URIs must have a host.";return e}function ZO(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 qU(e){return e.secure=xb(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function HU(e){if(e.port===(xb(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 WU(e,t){if(!e.path)return e.error="URN can not be parsed",e;let n=e.path.match(LU);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=bb(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 BU(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=bb(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 UU(e,t){let n=e;if(n.uuid=n.nss,n.nss=void 0,!t.tolerant&&(!n.uuid||!DU(n.uuid)))n.error=n.error||"UUID is not valid.";return n}function zU(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var QO={scheme:"http",domainHost:!0,parse:YO,serialize:ZO},KU={scheme:"https",domainHost:QO.domainHost,parse:YO,serialize:ZO},Ld={scheme:"ws",domainHost:!0,parse:qU,serialize:HU},GU={scheme:"wss",domainHost:Ld.domainHost,parse:Ld.parse,serialize:Ld.serialize},XU={scheme:"urn",parse:WU,serialize:BU,skipNormalize:!0},YU={scheme:"urn:uuid",parse:UU,serialize:zU,skipNormalize:!0},Fd={http:QO,https:KU,ws:Ld,wss:GU,urn:XU,"urn:uuid":YU};Object.setPrototypeOf(Fd,null);function bb(e){return e&&(Fd[e]||Fd[e.toLowerCase()])||void 0}eA.exports={wsIsSecure:xb,SCHEMES:Fd,isValidSchemeName:VU,getSchemeHandler:bb}});var hA=B(function(soe,Wd){var{normalizeIPv6:iA,removeDotSegments:yc,removeDotSegmentsRelative:aA,recomposeAuthority:ZU,normalizePercentEncoding:$b,normalizePathEncoding:QU,serializePathEncoding:nA,normalizeQueryFragmentEncoding:rA,encodeQuery:ez,encodeFragment:tz,reescapeHostDelimiters:nz,isIPv4:lA,nonSimpleDomain:rz}=yb(),{SCHEMES:cA,getSchemeHandler:Sb}=tA(),uA=/^[A-Za-z][A-Za-z0-9+.-]*$/u,sz=/[\0-\x20"#/:<>?@[\\\]^`{|}\x7F]/u;function sA(e){let t=String(e);if(!uA.test(t))throw TypeError("URI scheme is malformed.");return t}function oz(e,t){if(typeof e==="string")e=mz(e,t);else if(typeof e==="object")e=qd(Zo(e,t),t);return e}function iz(e,t,n){let r=n?Object.assign({scheme:"null"},n):{scheme:"null"},{parsed:s,malformedAuthorityOrPort:o,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:l,malformedScheme:c}=Vd(e,r),{parsed:u,malformedAuthorityOrPort:d,malformedPercentEncoding:p,malformedSchemeSpecific:m,malformedHost:g,malformedScheme:b}=Vd(t,r);if(o||d||i||p||a||m||l||g||c||b)throw Error(s.error||u.error||"URI is malformed.");let h=fA(s,u,r,!0),x=Sb(n&&n.scheme||h.scheme),k=h.host,w=k!==void 0&&k!==""&&(lA(k)||iA(k).isIPV6);if(pA(h,n||{},x,w))throw Error("URI host is malformed.");dA(h,n||{},x,w);let v=k&&k.indexOf("%")!==-1&&!/\P{ASCII}/u.test(k);if(h.error&&!v)throw Error(h.error);return r.skipEscape=!0,Zo(h,r)}function fA(e,t,n,r){let s={};if(!r)e=qd(Zo(e,n),n),t=qd(Zo(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=yc(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=yc(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=yc(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]!=="/"?aA(s.path):yc(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 az(e,t,n){let r=oA(e,n),s=oA(t,n);return r!==void 0&&s!==void 0&&r===s}function Zo(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=sA(n.scheme);let o=Sb(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,l=!r.skipEscape&&a;if(n.path!==void 0)if(!r.skipEscape)n.path=nA(n.path,l);else n.path=$b(n.path);if(r.reference!=="suffix"&&n.scheme)n.scheme=sA(n.scheme),s.push(n.scheme,":");let c=ZU(n);if(c!==void 0){if(r.reference!=="suffix")s.push("//");if(s.push(c),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]!=="/"?aA(u):yc(u);if(a)u=nA(u,!0);if(c===void 0&&u[0]==="/"&&u[1]==="/")u="/%2F"+u.slice(2);s.push(u)}if(n.query!==void 0)s.push("?",ez(n.query));if(n.fragment!==void 0)s.push("#",tz(n.fragment));return s.join("")}var lz=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,cz=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,uz=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function fz(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 gc(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 Hd(e){return e[0]==="["&&e[e.length-1]==="]"}function dz(e){let t=e[4];return gc(e[3])||t!==void 0&&!Hd(t)&&gc(t)||gc(e[6])||gc(e[7])||gc(e[8])}function dA(e,t,n,r){if(pA(e,t,n,r))return e.error=e.error||"URI host is malformed.",!0;if(!t.unicodeSupport&&(!n||!n.unicodeSupport)&&e.host&&!Hd(e.host)&&(t.domainHost||n&&n.domainHost)&&r===!1&&rz(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(!pz(s))return e.error=e.error||"URI host is malformed.",!0;e.host=s.hostname}return!1}function pA(e,t,n,r){return Boolean(e.host&&r===!1&&!Hd(e.host)&&(t.domainHost||n&&n.domainHost)&&sz.test(e.host))}function pz(e){return e.username===""&&e.password===""&&e.port===""&&e.pathname==="/"&&e.search===""&&e.hash===""&&e.hostname!==""}function Vd(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,l=!1,c=!1,u=!1;if(n.reference==="suffix")if(n.scheme)e=n.scheme+":"+e;else e="//"+e;let d=e.match(cz);if(d!==null&&d[1].indexOf("\\")!==-1)r.error="URI authority must not contain a literal backslash.",s=!0;let p=e.match(uz);if(p!==null){let g=p[1],b=g.replace(/[\t\n\r]/g,"");if(b.length>=2){if(b.slice(0,2)!=="//")r.error=r.error||"URI authority must not contain a literal backslash.",s=!0;else if(g.length!==b.length)r.error=r.error||"URI authority introducer must not contain whitespace.",s=!0}}let m=e.match(lz);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(uA.test(r.scheme))r.scheme=r.scheme.toLowerCase();else r.error=r.error||"URI scheme is malformed.",c=!0;if(o=dz(m),o)r.error=r.error||"URI contains malformed percent-encoding.";if(isNaN(r.port))r.port=m[5];let g=fz(r,m);if(g!==void 0)r.error=r.error||g,s=!0;if(r.host)if(lA(r.host)===!1){let x=Hd(r.host),k=r.host.indexOf("[")!==-1||r.host.indexOf("]")!==-1,w=iA(r.host);if(u=w.isIPV6||w.isIPVFuture===!0,l=k&&(!x||w.error===!0),r.host=u?w.host:w.host.toLowerCase(),l)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 b=Sb(n.scheme||r.scheme);if(!l)a=dA(r,n,b,u);if(e.indexOf("%")!==-1&&r.host!==void 0&&!l){let h=u?r.host:$b(r.host,!0);if(!u)h=$b(h.toLowerCase());r.host=u||n.scheme!=="null"?nz(h,u):h}if(!b||b&&!b.skipNormalize){if(r.path)r.path=QU(r.path);if(r.query)r.query=rA(r.query);if(r.fragment)r.fragment=rA(r.fragment)}if(b&&b.parse){if(b.parse(r,n),b===cA.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:c}}function qd(e,t){return Vd(e,t).parsed}function mz(e,t){return mA(e,t).normalized}function mA(e,t){let{parsed:n,malformedAuthorityOrPort:r,malformedPercentEncoding:s,malformedSchemeSpecific:o,malformedHost:i,malformedScheme:a}=Vd(e,t);return{normalized:r||s||o||i||a?e:Zo(n,t),malformedAuthorityOrPort:r,malformedPercentEncoding:s,malformedSchemeSpecific:o,malformedHost:i,malformedScheme:a}}function oA(e,t){if(typeof e!=="string"&&typeof e!=="object")return;let n;try{n=typeof e==="string"?e:Zo(e,t)}catch{return}let{normalized:r,malformedAuthorityOrPort:s,malformedPercentEncoding:o,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:l}=mA(n,t);return s||o||i||a||l?void 0:r}var wb={SCHEMES:cA,normalize:oz,resolve:iz,resolveComponent:fA,equal:az,serialize:Zo,parse:qd};Wd.exports=wb;Wd.exports.default=wb;Wd.exports.fastUri=wb});var xA=B(function(yA){Object.defineProperty(yA,"__esModule",{value:!0});var gA=hA();gA.code='require("ajv/dist/runtime/uri").default';yA.default=gA});var Eb=B(function(bs){Object.defineProperty(bs,"__esModule",{value:!0});bs.CodeGen=bs.Name=bs.nil=bs.stringify=bs.str=bs._=bs.KeywordCxt=void 0;var gz=ya();Object.defineProperty(bs,"KeywordCxt",{enumerable:!0,get:function(){return gz.KeywordCxt}});var Sa=$e();Object.defineProperty(bs,"_",{enumerable:!0,get:function(){return Sa._}});Object.defineProperty(bs,"str",{enumerable:!0,get:function(){return Sa.str}});Object.defineProperty(bs,"stringify",{enumerable:!0,get:function(){return Sa.stringify}});Object.defineProperty(bs,"nil",{enumerable:!0,get:function(){return Sa.nil}});Object.defineProperty(bs,"Name",{enumerable:!0,get:function(){return Sa.Name}});Object.defineProperty(bs,"CodeGen",{enumerable:!0,get:function(){return Sa.CodeGen}});var yz=pc(),vA=ba(),EA=Qx(),Ir=hc(),jA=$e(),Dr=dc(),Zs=fc(),$a=Ce(),bA=qO(),xz=xA(),PA=(e,t)=>new RegExp(e,t);PA.code="new RegExp";var bz=["removeAdditional","useDefaults","coerceTypes"],$z=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),Sz={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."},wz={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},$A=200;function vz(e){var t,n,r,s,o,i,a,l,c,u,d,p,m,g,b,h,x,k,w,v,E,O,I,D,V;let W=e.strict,A=(t=e.code)===null||t===void 0?void 0:t.optimize,J=A===!0||A===void 0?1:A||0,G=(r=(n=e.code)===null||n===void 0?void 0:n.regExp)!==null&&r!==void 0?r:PA,se=(s=e.uriResolver)!==null&&s!==void 0?s:xz.default;return{strictSchema:(i=(o=e.strictSchema)!==null&&o!==void 0?o:W)!==null&&i!==void 0?i:!0,strictNumbers:(l=(a=e.strictNumbers)!==null&&a!==void 0?a:W)!==null&&l!==void 0?l:!0,strictTypes:(u=(c=e.strictTypes)!==null&&c!==void 0?c:W)!==null&&u!==void 0?u:"log",strictTuples:(p=(d=e.strictTuples)!==null&&d!==void 0?d:W)!==null&&p!==void 0?p:"log",strictRequired:(g=(m=e.strictRequired)!==null&&m!==void 0?m:W)!==null&&g!==void 0?g:!1,code:e.code?{...e.code,optimize:J,regExp:G}:{optimize:J,regExp:G},loopRequired:(b=e.loopRequired)!==null&&b!==void 0?b:$A,loopEnum:(h=e.loopEnum)!==null&&h!==void 0?h:$A,meta:(x=e.meta)!==null&&x!==void 0?x:!0,messages:(k=e.messages)!==null&&k!==void 0?k:!0,inlineRefs:(w=e.inlineRefs)!==null&&w!==void 0?w:!0,schemaId:(v=e.schemaId)!==null&&v!==void 0?v:"$id",addUsedSchema:(E=e.addUsedSchema)!==null&&E!==void 0?E:!0,validateSchema:(O=e.validateSchema)!==null&&O!==void 0?O:!0,validateFormats:(I=e.validateFormats)!==null&&I!==void 0?I:!0,unicodeRegExp:(D=e.unicodeRegExp)!==null&&D!==void 0?D:!0,int32range:(V=e.int32range)!==null&&V!==void 0?V:!0,uriResolver:se}}class Bd{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,...vz(e)};let{es5:t,lines:n}=this.opts.code;this.scope=new jA.ValueScope({scope:{},prefixes:$z,es5:t,lines:n}),this.logger=Oz(e.logger);let r=e.validateFormats;if(e.validateFormats=!1,this.RULES=EA.getRules(),SA.call(this,Sz,e,"NOT SUPPORTED"),SA.call(this,wz,e,"DEPRECATED","warn"),this._metaOpts=kz.call(this),e.formats)jz.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords)Pz.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);Ez.call(this),e.validateFormats=r}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:n}=this.opts,r=bA;if(n==="id")r={...bA},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(c,u){await s.call(this,c.$schema);let d=this._addSchema(c,u);return d.validate||o.call(this,d)}async function s(c){if(c&&!this.getSchema(c))await r.call(this,{$ref:c},!0)}async function o(c){try{return this._compileSchemaEnv(c)}catch(u){if(!(u instanceof vA.default))throw u;return i.call(this,u),await a.call(this,u.missingSchema),o.call(this,c)}}function i({missingSchema:c,missingRef:u}){if(this.refs[c])throw Error(`AnySchema ${c} is loaded but ${u} cannot be resolved`)}async function a(c){let u=await l.call(this,c);if(!this.refs[c])await s.call(this,u.$schema);if(!this.refs[c])this.addSchema(u,c,t)}async function l(c){let u=this._loading[c];if(u)return u;try{return await(this._loading[c]=n(c))}finally{delete this._loading[c]}}}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=Dr.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=wA.call(this,e))=="string")e=t;if(t===void 0){let{schemaId:n}=this.opts,r=new Ir.SchemaEnv({schema:{},schemaId:n});if(t=Ir.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=wA.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=Dr.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(Cz.call(this,n,t),!t)return $a.eachItem(n,(s)=>vb.call(this,s)),this;Tz.call(this,t);let r={...t,type:Zs.getJSONTypes(t.type),schemaType:Zs.getJSONTypes(t.schemaType)};return $a.eachItem(n,r.type.length===0?(s)=>vb.call(this,s,r):(s)=>r.type.forEach((o)=>vb.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:l}=a.definition,c=o[i];if(l&&c)o[i]=kA(c)}}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=Dr.normalizeId(o||n);let l=Dr.getSchemaRefs.call(this,e,n);if(a=new Ir.SchemaEnv({schema:e,schemaId:i,meta:t,baseId:n,localRefs:l}),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 Ir.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{Ir.compileSchema.call(this,e)}finally{this.opts=t}}}Bd.ValidationError=yz.default;Bd.MissingRefError=vA.default;bs.default=Bd;function SA(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 wA(e){return e=Dr.normalizeId(e),this.schemas[e]||this.refs[e]}function Ez(){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 jz(){for(let e in this.opts.formats){let t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function Pz(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 kz(){let e={...this.opts};for(let t of bz)delete e[t];return e}var _z={log(){},warn(){},error(){}};function Oz(e){if(e===!1)return _z;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 Az=/^[a-z_$][a-z0-9_$:-]*$/i;function Cz(e,t){let{RULES:n}=this;if($a.eachItem(e,(r)=>{if(n.keywords[r])throw Error(`Keyword ${r} is already defined`);if(!Az.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 vb(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:l})=>l===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:Zs.getJSONTypes(t.type),schemaType:Zs.getJSONTypes(t.schemaType)}};if(t.before)Rz.call(this,i,a,t.before);else i.rules.push(a);o.all[e]=a,(r=t.implements)===null||r===void 0||r.forEach((l)=>this.addKeyword(l))}function Rz(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 Tz(e){let{metaSchema:t}=e;if(t===void 0)return;if(e.$data&&this.opts.$data)t=kA(t);e.validateSchema=this.compile(t,!0)}var Nz={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function kA(e){return{anyOf:[e,Nz]}}});var OA=B(function(_A){Object.defineProperty(_A,"__esModule",{value:!0});var Iz={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};_A.default=Iz});var Gd=B(function(CA){Object.defineProperty(CA,"__esModule",{value:!0});CA.callRef=CA.getValidate=void 0;var Lz=ba(),zd=er(),Ge=$e(),wa=Zn(),Kd=hc(),Qs=Ce(),Fz={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:n,it:r}=e,{baseId:s,schemaEnv:o,validateName:i,opts:a,self:l}=r,{root:c}=o;if((n==="#"||n==="#/")&&s===c.baseId)return d();let u=Kd.resolveRef.call(l,c,s,n);if(u===void 0)throw new Lz.default(r.opts.uriResolver,s,n);if(u instanceof Kd.SchemaEnv)return p(u);return m(u);function d(){if(o===c)return Ud(e,i,o,o.$async);let g=t.scopeValue("root",{ref:c});return Ud(e,Ge._`${g}.validate`,c,c.$async)}function p(g){let b=AA(e,g);Ud(e,b,g,g.$async)}function m(g){let b=t.scopeValue("schema",a.code.source===!0?{ref:g,code:Ge.stringify(g)}:{ref:g}),h=t.name("valid"),x=e.subschema({schema:g,dataTypes:[],schemaPath:Ge.nil,topSchemaRef:b,errSchemaPath:n},h);e.mergeEvaluated(x),e.ok(h)}}};function AA(e,t){let{gen:n}=e;return t.validate?n.scopeValue("validate",{ref:t.validate}):Ge._`${n.scopeValue("wrapper",{ref:t})}.validate`}CA.getValidate=AA;function Ud(e,t,n,r){let{gen:s,it:o}=e,{allErrors:i,schemaEnv:a,opts:l}=o,c=l.passContext?wa.default.this:Ge.nil;if(r)u();else d();function u(){if(!a.$async)throw Error("async schema referenced by sync schema");let g=s.let("valid");s.try(()=>{if(s.code(Ge._`await ${zd.callValidateCode(e,t,c)}`),m(t),!i)s.assign(g,!0)},(b)=>{if(s.if(Ge._`!(${b} instanceof ${o.ValidationError})`,()=>s.throw(b)),p(b),!i)s.assign(g,!1)}),e.ok(g)}function d(){e.result(zd.callValidateCode(e,t,c),()=>m(t),()=>p(t))}function p(g){let b=Ge._`${g}.errors`;s.assign(wa.default.vErrors,Ge._`${wa.default.vErrors} === null ? ${b} : ${wa.default.vErrors}.concat(${b})`),s.assign(wa.default.errors,Ge._`${wa.default.vErrors}.length`)}function m(g){var b;if(!o.opts.unevaluated)return;let h=(b=n===null||n===void 0?void 0:n.validate)===null||b===void 0?void 0:b.evaluated;if(o.props!==!0)if(h&&!h.dynamicProps){if(h.props!==void 0)o.props=Qs.mergeEvaluated.props(s,h.props,o.props)}else{let x=s.var("props",Ge._`${g}.evaluated.props`);o.props=Qs.mergeEvaluated.props(s,x,o.props,Ge.Name)}if(o.items!==!0)if(h&&!h.dynamicItems){if(h.items!==void 0)o.items=Qs.mergeEvaluated.items(s,h.items,o.items)}else{let x=s.var("items",Ge._`${g}.evaluated.items`);o.items=Qs.mergeEvaluated.items(s,x,o.items,Ge.Name)}}}CA.callRef=Ud;CA.default=Fz});var jb=B(function(TA){Object.defineProperty(TA,"__esModule",{value:!0});var Hz=OA(),Wz=Gd(),Bz=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Hz.default,Wz.default];TA.default=Bz});var JA=B(function(NA){Object.defineProperty(NA,"__esModule",{value:!0});var to=$e(),eo=to.operators,Xd={maximum:{okStr:"<=",ok:eo.LTE,fail:eo.GT},minimum:{okStr:">=",ok:eo.GTE,fail:eo.LT},exclusiveMaximum:{okStr:"<",ok:eo.LT,fail:eo.GTE},exclusiveMinimum:{okStr:">",ok:eo.GT,fail:eo.LTE}},zz={message:({keyword:e,schemaCode:t})=>to.str`must be ${Xd[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>to._`{comparison: ${Xd[e].okStr}, limit: ${t}}`},Kz={keyword:Object.keys(Xd),type:"number",schemaType:"number",$data:!0,error:zz,code(e){let{keyword:t,data:n,schemaCode:r}=e;e.fail$data(to._`${n} ${Xd[t].fail} ${r} || isNaN(${n})`)}};NA.default=Kz});var IA=B(function(MA){Object.defineProperty(MA,"__esModule",{value:!0});var Lr=$e(),Xz={message:({schemaCode:e})=>Lr.str`must be multiple of ${e}`,params:({schemaCode:e})=>Lr._`{multipleOf: ${e}}`},Yz={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:Xz,code(e){let{gen:t,data:n,schemaCode:r,it:s}=e,o=s.opts.multipleOfPrecision,i=t.let("res"),a=o?Lr._`Math.abs(Math.round(${i}) - ${i}) > 1e-${o}`:Lr._`${i} !== parseInt(${i})`;e.fail$data(Lr._`(${r} === 0 || (${i} = ${n}/${r}, ${a}))`)}};MA.default=Yz});var FA=B(function(LA){Object.defineProperty(LA,"__esModule",{value:!0});function DA(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}LA.default=DA;DA.code='require("ajv/dist/runtime/ucs2length").default'});var HA=B(function(qA){Object.defineProperty(qA,"__esModule",{value:!0});var En=$e(),VA=Ce(),e8=FA(),t8={message({keyword:e,schemaCode:t}){return En.str`must NOT have ${e==="maxLength"?"more":"fewer"} than ${t} characters`},params:({schemaCode:e})=>En._`{limit: ${e}}`},n8={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:t8,code(e){let{keyword:t,data:n,schemaCode:r,it:s}=e,o=t==="maxLength"?En.operators.GT:En.operators.LT,i=s.opts.unicode===!1?En._`${n}.length`:En._`${VA.useFunc(e.gen,e8.default)}(${n})`;e.fail$data(En._`${i} ${o} ${r}`)}};qA.default=n8});var zA=B(function(UA){Object.defineProperty(UA,"__esModule",{value:!0});var WA=er(),BA=Ce(),tr=$e(),s8={message:({schemaCode:e})=>tr.str`must match pattern "${e}"`,params:({schemaCode:e})=>tr._`{pattern: ${e}}`},o8={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:s8,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:l}=i.opts.code,c=l.code==="new RegExp"?tr._`new RegExp`:BA.useFunc(t,l),u=t.let("valid");t.try(()=>t.assign(u,tr._`${c}(${o}, ${a}).test(${n})`),()=>t.assign(u,!1)),e.fail$data(tr._`!${u}`)}else{let l=WA.usePattern(e,s);e.fail$data(tr._`!${l}.test(${n})`)}}};UA.default=o8});var GA=B(function(KA){Object.defineProperty(KA,"__esModule",{value:!0});var Fr=$e(),a8={message({keyword:e,schemaCode:t}){return Fr.str`must NOT have ${e==="maxProperties"?"more":"fewer"} than ${t} properties`},params:({schemaCode:e})=>Fr._`{limit: ${e}}`},l8={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:a8,code(e){let{keyword:t,data:n,schemaCode:r}=e,s=t==="maxProperties"?Fr.operators.GT:Fr.operators.LT;e.fail$data(Fr._`Object.keys(${n}).length ${s} ${r}`)}};KA.default=l8});var ZA=B(function(YA){Object.defineProperty(YA,"__esModule",{value:!0});var Vr=er(),qr=$e(),XA=Ce(),u8={message:({params:{missingProperty:e}})=>qr.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>qr._`{missingProperty: ${e}}`},f8={keyword:"required",type:"object",schemaType:"array",$data:!0,error:u8,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 l=n.length>=a.loopRequired;if(i.allErrors)c();else u();if(a.strictRequired){let m=e.parentSchema.properties,{definedProperties:g}=e.it;for(let b of n)if((m===null||m===void 0?void 0:m[b])===void 0&&!g.has(b)){let h=i.schemaEnv.baseId+i.errSchemaPath,x=`required property "${b}" is not defined at "${h}" (strictRequired)`;XA.checkStrictMode(i,x,i.opts.strictRequired)}}function c(){if(l||o)e.block$data(qr.nil,d);else for(let m of n)Vr.checkReportMissingProp(e,m)}function u(){let m=t.let("missing");if(l||o){let g=t.let("valid",!0);e.block$data(g,()=>p(m,g)),e.ok(g)}else t.if(Vr.checkMissingProp(e,n,m)),Vr.reportMissingProp(e,m),t.else()}function d(){t.forOf("prop",r,(m)=>{e.setParams({missingProperty:m}),t.if(Vr.noPropertyInData(t,s,m,a.ownProperties),()=>e.error())})}function p(m,g){e.setParams({missingProperty:m}),t.forOf(m,r,()=>{t.assign(g,Vr.propertyInData(t,s,m,a.ownProperties)),t.if(qr.not(g),()=>{e.error(),t.break()})},qr.nil)}}};YA.default=f8});var eC=B(function(QA){Object.defineProperty(QA,"__esModule",{value:!0});var Hr=$e(),p8={message({keyword:e,schemaCode:t}){return Hr.str`must NOT have ${e==="maxItems"?"more":"fewer"} than ${t} items`},params:({schemaCode:e})=>Hr._`{limit: ${e}}`},m8={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:p8,code(e){let{keyword:t,data:n,schemaCode:r}=e,s=t==="maxItems"?Hr.operators.GT:Hr.operators.LT;e.fail$data(Hr._`${n}.length ${s} ${r}`)}};QA.default=m8});var Yd=B(function(nC){Object.defineProperty(nC,"__esModule",{value:!0});var tC=ib();tC.code='require("ajv/dist/runtime/equal").default';nC.default=tC});var oC=B(function(sC){Object.defineProperty(sC,"__esModule",{value:!0});var va=fc(),Ie=$e(),rC=Ce(),y8=Yd(),x8={message:({params:{i:e,j:t}})=>Ie.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>Ie._`{i: ${e}, j: ${t}}`},b8={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:x8,code(e){let{gen:t,data:n,$data:r,schema:s,parentSchema:o,schemaCode:i,it:a}=e;if(!r&&!s)return;let l=t.let("valid"),c=o.items?va.getSchemaTypes(o.items):[];e.block$data(l,u,Ie._`${i} === false`),e.ok(l);function u(){let g=t.let("i",Ie._`${n}.length`),b=t.let("j");e.setParams({i:g,j:b}),t.assign(l,!0),t.if(Ie._`${g} > 1`,()=>(d()?p:m)(g,b))}function d(){return c.length>0&&!c.some((g)=>g==="object"||g==="array")}function p(g,b){let h=t.name("item"),x=va.checkDataTypes(c,h,a.opts.strictNumbers,va.DataType.Wrong),k=t.const("indices",Ie._`{}`);t.for(Ie._`;${g}--;`,()=>{if(t.let(h,Ie._`${n}[${g}]`),t.if(x,Ie._`continue`),c.length>1)t.if(Ie._`typeof ${h} == "string"`,Ie._`${h} += "_"`);t.if(Ie._`typeof ${k}[${h}] == "number"`,()=>{t.assign(b,Ie._`${k}[${h}]`),e.error(),t.assign(l,!1).break()}).code(Ie._`${k}[${h}] = ${g}`)})}function m(g,b){let h=rC.useFunc(t,y8.default),x=t.name("outer");t.label(x).for(Ie._`;${g}--;`,()=>t.for(Ie._`${b} = ${g}; ${b}--;`,()=>t.if(Ie._`${h}(${n}[${g}], ${n}[${b}])`,()=>{e.error(),t.assign(l,!1).break(x)})))}}};sC.default=b8});var lC=B(function(aC){Object.defineProperty(aC,"__esModule",{value:!0});var Ea=$e(),iC=Ce(),S8=Yd(),w8={message:"must be equal to constant",params:({schemaCode:e})=>Ea._`{allowedValue: ${e}}`},v8={keyword:"const",$data:!0,error:w8,code(e){let{gen:t,data:n,$data:r,schemaCode:s,schema:o}=e;if(r||o&&typeof o=="object")e.fail$data(Ea._`!${iC.useFunc(t,S8.default)}(${n}, ${s})`);else e.fail(Ea._`${o} !== ${n}`)}};aC.default=v8});var fC=B(function(uC){Object.defineProperty(uC,"__esModule",{value:!0});var Wr=$e(),cC=Ce(),j8=Yd(),P8={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>Wr._`{allowedValues: ${e}}`},k8={keyword:"enum",schemaType:"array",$data:!0,error:P8,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,l,c=()=>l!==null&&l!==void 0?l:l=cC.useFunc(t,j8.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=Wr.or(...s.map((g,b)=>p(m,b)))}e.pass(u);function d(){t.assign(u,!1),t.forOf("v",o,(m)=>t.if(Wr._`${c()}(${n}, ${m})`,()=>t.assign(u,!0).break()))}function p(m,g){let b=s[g];return typeof b==="object"&&b!==null?Wr._`${c()}(${n}, ${m}[${g}])`:Wr._`${n} === ${b}`}}};uC.default=k8});var Pb=B(function(dC){Object.defineProperty(dC,"__esModule",{value:!0});var O8=JA(),A8=IA(),C8=HA(),R8=zA(),T8=GA(),N8=ZA(),J8=eC(),M8=oC(),I8=lC(),D8=fC(),L8=[O8.default,A8.default,C8.default,R8.default,T8.default,N8.default,J8.default,M8.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},I8.default,D8.default];dC.default=L8});var kb=B(function(mC){Object.defineProperty(mC,"__esModule",{value:!0});mC.validateAdditionalItems=void 0;var jn=$e(),ja=Ce(),V8={message:({params:{len:e}})=>jn.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>jn._`{limit: ${e}}`},q8={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:V8,code(e){let{parentSchema:t,it:n}=e,{items:r}=t;if(!Array.isArray(r)){ja.checkStrictMode(n,'"additionalItems" is ignored when "items" is not an array of schemas');return}pC(e,r)}};function pC(e,t){let{gen:n,schema:r,data:s,keyword:o,it:i}=e;i.items=!0;let a=n.const("len",jn._`${s}.length`);if(r===!1)e.setParams({len:t.length}),e.pass(jn._`${a} <= ${t.length}`);else if(typeof r=="object"&&!ja.alwaysValidSchema(i,r)){let c=n.var("valid",jn._`${a} <= ${t.length}`);n.if(jn.not(c),()=>l(c)),e.ok(c)}function l(c){n.forRange("i",t.length,a,(u)=>{if(e.subschema({keyword:o,dataProp:u,dataPropType:ja.Type.Num},c),!i.allErrors)n.if(jn.not(c),()=>n.break())})}}mC.validateAdditionalItems=pC;mC.default=q8});var _b=B(function(xC){Object.defineProperty(xC,"__esModule",{value:!0});xC.validateTuple=void 0;var Zd=$e(),no=Ce(),gC=er(),W8={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:n}=e;if(Array.isArray(t))return yC(e,"additionalItems",t);if(n.items=!0,no.alwaysValidSchema(n,t))return;e.ok(gC.validateArray(e))}};function yC(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=no.mergeEvaluated.items(r,n.length,a.items);let l=r.name("valid"),c=r.const("len",Zd._`${o}.length`);n.forEach((d,p)=>{if(no.alwaysValidSchema(a,d))return;r.if(Zd._`${c} > ${p}`,()=>e.subschema({keyword:i,schemaProp:p,dataProp:p},l)),e.ok(l)});function u(d){let{opts:p,errSchemaPath:m}=a,g=n.length,b=g===d.minItems&&(g===d.maxItems||d[t]===!1);if(p.strictTuples&&!b){let h=`"${i}" is ${g}-tuple, but minItems or maxItems/${t} are not specified or different at path "${m}"`;no.checkStrictMode(a,h,p.strictTuples)}}}xC.validateTuple=yC;xC.default=W8});var wC=B(function(SC){Object.defineProperty(SC,"__esModule",{value:!0});var $C=_b(),U8={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(e)=>$C.validateTuple(e,"items")};SC.default=U8});var kC=B(function(PC){Object.defineProperty(PC,"__esModule",{value:!0});var Qd=$e(),vC=Ce(),EC=er(),jC=kb(),K8={message:({params:{len:e}})=>Qd.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Qd._`{limit: ${e}}`},G8={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:K8,code(e){let{schema:t,parentSchema:n,it:r}=e,{prefixItems:s}=n;if(r.items=!0,vC.alwaysValidSchema(r,t))return;if(s)jC.validateAdditionalItems(e,s);else e.ok(EC.validateArray(e))}};PC.default=G8});var OC=B(function(_C){Object.defineProperty(_C,"__esModule",{value:!0});var dt=$e(),ro=Ce(),Y8={message:({params:{min:e,max:t}})=>t===void 0?dt.str`must contain at least ${e} valid item(s)`:dt.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?dt._`{minContains: ${e}}`:dt._`{minContains: ${e}, maxContains: ${t}}`},Z8={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Y8,code(e){let{gen:t,schema:n,parentSchema:r,data:s,it:o}=e,i,a,{minContains:l,maxContains:c}=r;if(o.opts.next)i=l===void 0?1:l,a=c;else i=1;let u=t.const("len",dt._`${s}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){ro.checkStrictMode(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){ro.checkStrictMode(o,'"minContains" > "maxContains" is always invalid'),e.fail();return}if(ro.alwaysValidSchema(o,n)){let b=dt._`${u} >= ${i}`;if(a!==void 0)b=dt._`${b} && ${u} <= ${a}`;e.pass(b);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(dt._`${s}.length > 0`,p)}else t.let(d,!1),p();e.result(d,()=>e.reset());function p(){let b=t.name("_valid"),h=t.let("count",0);m(b,()=>t.if(b,()=>g(h)))}function m(b,h){t.forRange("i",0,u,(x)=>{e.subschema({keyword:"contains",dataProp:x,dataPropType:ro.Type.Num,compositeRule:!0},b),h()})}function g(b){if(t.code(dt._`${b}++`),a===void 0)t.if(dt._`${b} >= ${i}`,()=>t.assign(d,!0).break());else if(t.if(dt._`${b} > ${a}`,()=>t.assign(d,!1).break()),i===1)t.assign(d,!0);else t.if(dt._`${b} >= ${i}`,()=>t.assign(d,!0))}}};_C.default=Z8});var ep=B(function(TC){Object.defineProperty(TC,"__esModule",{value:!0});TC.validateSchemaDeps=TC.validatePropertyDeps=TC.error=void 0;var Pa=$e(),AC=Ce(),Br=er();TC.error={message:({params:{property:e,depsCount:t,deps:n}})=>Pa.str`must have ${t===1?"property":"properties"} ${n} when property ${e} is present`,params:({params:{property:e,depsCount:t,deps:n,missingProperty:r}})=>Pa._`{property: ${e},
634
637
  missingProperty: ${r},
635
638
  depsCount: ${t},
636
- deps: ${n}}`};var n8={keyword:"dependencies",type:"object",schemaType:"object",error:QA.error,code(e){let[t,n]=r8(e);YA(e,t),ZA(e,n)}};function r8({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 YA(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 l=Br.propertyInData(n,r,i,s.opts.ownProperties);if(e.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),s.allErrors)n.if(l,()=>{for(let c of a)Br.checkReportMissingProp(e,c)});else n.if(ba._`${l} && (${Br.checkMissingProp(e,a,o)})`),Br.reportMissingProp(e,o),n.else()}}QA.validatePropertyDeps=YA;function ZA(e,t=e.schema){let{gen:n,data:r,keyword:s,it:o}=e,i=n.name("valid");for(let a in t){if(XA.alwaysValidSchema(o,t[a]))continue;n.if(Br.propertyInData(n,r,a,o.opts.ownProperties),()=>{let l=e.subschema({keyword:s,schemaProp:a},i);e.mergeValidEvaluated(l,i)},()=>n.var(i,!0)),e.ok(i)}}QA.validateSchemaDeps=ZA;QA.default=n8});var sC=W(function(rC){Object.defineProperty(rC,"__esModule",{value:!0});var qd=$e(),nC=Oe(),i8={message:"property name must be valid",params:({params:e})=>qd._`{propertyName: ${e.propertyName}}`},a8={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:i8,code(e){let{gen:t,schema:n,data:r,it:s}=e;if(nC.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(qd.not(o),()=>{if(e.error(!0),!s.allErrors)t.break()})}),e.ok(o)}};rC.default=a8});var ab=W(function(oC){Object.defineProperty(oC,"__esModule",{value:!0});var to=Xn(),yt=$e(),c8=Kn(),no=Oe(),u8={message:"must NOT have additional properties",params:({params:e})=>yt._`{additionalProperty: ${e.additionalProperty}}`},f8={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:u8,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:l}=i;if(i.props=!0,l.removeAdditional!=="all"&&no.alwaysValidSchema(i,n))return;let c=to.allSchemaProperties(r.properties),u=to.allSchemaProperties(r.patternProperties);d(),e.ok(yt._`${o} === ${c8.default.errors}`);function d(){t.forIn("key",s,(g)=>{if(!c.length&&!u.length)y(g);else t.if(p(g),()=>y(g))})}function p(g){let x;if(c.length>8){let P=no.schemaRefOrVal(i,r.properties,"properties");x=to.isOwnProperty(t,P,g)}else if(c.length)x=yt.or(...c.map((P)=>yt._`${g} === ${P}`));else x=yt.nil;if(u.length)x=yt.or(x,...u.map((P)=>yt._`${to.usePattern(e,P)}.test(${g})`));return yt.not(x)}function m(g){t.code(yt._`delete ${s}[${g}]`)}function y(g){if(l.removeAdditional==="all"||l.removeAdditional&&n===!1){m(g);return}if(n===!1){if(e.setParams({additionalProperty:g}),e.error(),!a)t.break();return}if(typeof n=="object"&&!no.alwaysValidSchema(i,n)){let x=t.name("valid");if(l.removeAdditional==="failing")S(g,x,!1),t.if(yt.not(x),()=>{e.reset(),m(g)});else if(S(g,x),!a)t.if(yt.not(x),()=>t.break())}}function S(g,x,P){let w={keyword:"additionalProperties",dataProp:g,dataPropType:no.Type.Str};if(P===!1)Object.assign(w,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(w,x)}}};oC.default=f8});var cC=W(function(lC){Object.defineProperty(lC,"__esModule",{value:!0});var aC=ua(),Hd=Xn(),$a=Oe(),iC=ab(),p8={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)iC.default.code(new aC.KeywordCxt(o,iC.default,"additionalProperties"));let i=Hd.allSchemaProperties(n);for(let d of i)o.definedProperties.add(d);if(o.opts.unevaluated&&i.length&&o.props!==!0)o.props=$a.mergeEvaluated.props(t,$a.toHash(i),o.props);let a=i.filter((d)=>!$a.alwaysValidSchema(o,n[d]));if(a.length===0)return;let l=t.name("valid");for(let d of a){if(c(d))u(d);else{if(t.if(Hd.propertyInData(t,s,d,o.opts.ownProperties)),u(d),!o.allErrors)t.else().var(l,!0);t.endIf()}e.it.definedProperties.add(d),e.ok(l)}function c(d){return o.opts.useDefaults&&!o.compositeRule&&n[d].default!==void 0}function u(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},l)}}};lC.default=p8});var fC=W(function(uC){Object.defineProperty(uC,"__esModule",{value:!0});var Wd=Xn(),ro=$e(),Bd=Oe(),Ud=Oe(),h8={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:n,data:r,parentSchema:s,it:o}=e,{opts:i}=o,a=Wd.allSchemaProperties(n),l=a.filter((S)=>Bd.alwaysValidSchema(o,n[S]));if(a.length===0||l.length===a.length&&(!o.opts.unevaluated||o.props===!0))return;let c=i.strictSchema&&!i.allowMatchingProperties&&s.properties,u=t.name("valid");if(o.props!==!0&&!(o.props instanceof ro.Name))o.props=Ud.evaluatedPropsToName(t,o.props);let{props:d}=o;p();function p(){for(let S of a){if(c)m(S);if(o.allErrors)y(S);else t.var(u,!0),y(S),t.if(u)}}function m(S){for(let g in c)if(new RegExp(S).test(g))Bd.checkStrictMode(o,`property ${g} matches pattern ${S} (use allowMatchingProperties)`)}function y(S){t.forIn("key",r,(g)=>{t.if(ro._`${Wd.usePattern(e,S)}.test(${g})`,()=>{let x=l.includes(S);if(!x)e.subschema({keyword:"patternProperties",schemaProp:S,dataProp:g,dataPropType:Ud.Type.Str},u);if(o.opts.unevaluated&&d!==!0)t.assign(ro._`${d}[${g}]`,!0);else if(!x&&!o.allErrors)t.if(ro.not(u),()=>t.break())})})}}};uC.default=h8});var mC=W(function(pC){Object.defineProperty(pC,"__esModule",{value:!0});var dC=Oe(),y8={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:n,it:r}=e;if(dC.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"}};pC.default=y8});var yC=W(function(gC){Object.defineProperty(gC,"__esModule",{value:!0});var hC=Xn(),b8={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:hC.validateUnion,error:{message:"must match a schema in anyOf"}};gC.default=b8});var $C=W(function(bC){Object.defineProperty(bC,"__esModule",{value:!0});var so=$e(),xC=Oe(),S8={message:"must match exactly one schema in oneOf",params:({params:e})=>so._`{passingSchemas: ${e.passing}}`},w8={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:S8,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),l=t.name("_valid");e.setParams({passing:a}),t.block(c),e.result(i,()=>e.reset(),()=>e.error(!0));function c(){o.forEach((u,d)=>{let p;if(xC.alwaysValidSchema(s,u))t.var(l,!0);else p=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},l);if(d>0)t.if(so._`${l} && ${i}`).assign(i,!1).assign(a,so._`[${a}, ${d}]`).else();t.if(l,()=>{if(t.assign(i,!0),t.assign(a,d),p)e.mergeEvaluated(p,so.Name)})})}}};bC.default=w8});var vC=W(function(wC){Object.defineProperty(wC,"__esModule",{value:!0});var SC=Oe(),E8={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(SC.alwaysValidSchema(r,o))return;let a=e.subschema({keyword:"allOf",schemaProp:i},s);e.ok(s),e.mergeEvaluated(a)})}};wC.default=E8});var PC=W(function(jC){Object.defineProperty(jC,"__esModule",{value:!0});var oo=$e(),zd=Oe(),P8={message:({params:e})=>oo.str`must match "${e.ifClause}" schema`,params:({params:e})=>oo._`{failingKeyword: ${e.ifClause}}`},_8={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:P8,code(e){let{gen:t,parentSchema:n,it:r}=e;if(n.then===void 0&&n.else===void 0)zd.checkStrictMode(r,'"if" without "then" and "else" is ignored');let s=EC(r,"then"),o=EC(r,"else");if(!s&&!o)return;let i=t.let("valid",!0),a=t.name("_valid");if(l(),e.reset(),s&&o){let u=t.let("ifClause");e.setParams({ifClause:u}),t.if(a,c("then",u),c("else",u))}else if(s)t.if(a,c("then"));else t.if(oo.not(a),c("else"));e.pass(i,()=>e.error(!0));function l(){let u=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(u)}function c(u,d){return()=>{let p=e.subschema({keyword:u},a);if(t.assign(i,a),e.mergeValidEvaluated(p,i),d)t.assign(d,oo._`${u}`);else e.setParams({ifClause:u})}}}};function EC(e,t){let n=e.schema[t];return n!==void 0&&!zd.alwaysValidSchema(e,n)}jC.default=_8});var OC=W(function(kC){Object.defineProperty(kC,"__esModule",{value:!0});var _C=Oe(),O8={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:n}){if(t.if===void 0)_C.checkStrictMode(n,`"${e}" without "if" is ignored`)}};kC.default=O8});var lb=W(function(AC){Object.defineProperty(AC,"__esModule",{value:!0});var C8=ob(),R8=qA(),N8=ib(),T8=zA(),J8=GA(),M8=Vd(),I8=sC(),D8=ab(),L8=cC(),F8=fC(),V8=mC(),q8=yC(),H8=$C(),W8=vC(),B8=PC(),U8=OC();function z8(e=!1){let t=[V8.default,q8.default,H8.default,W8.default,B8.default,U8.default,I8.default,D8.default,M8.default,L8.default,F8.default];if(e)t.push(R8.default,T8.default);else t.push(C8.default,N8.default);return t.push(J8.default),t}AC.default=z8});var cb=W(function(NC){Object.defineProperty(NC,"__esModule",{value:!0});NC.dynamicAnchor=void 0;var Sa=$e(),G8=Kn(),Kd=fc(),CC=Md(),X8={keyword:"$dynamicAnchor",schemaType:"string",code:(e)=>RC(e,e.schema)};function RC(e,t){let{gen:n,it:r}=e;r.schemaEnv.root.dynamicAnchors[t]=!0;let s=Sa._`${G8.default.dynamicAnchors}${Sa.getProperty(t)}`,o=r.errSchemaPath==="#"?r.validateName:Y8(e);n.if(Sa._`!${s}`,()=>n.assign(s,o))}NC.dynamicAnchor=RC;function Y8(e){let{schemaEnv:t,schema:n,self:r}=e.it,{root:s,baseId:o,localRefs:i,meta:a}=t.root,{schemaId:l}=r.opts,c=new Kd.SchemaEnv({schema:n,schemaId:l,root:s,baseId:o,localRefs:i,meta:a});return Kd.compileSchema.call(r,c),CC.getValidate(e,c)}NC.default=X8});var ub=W(function(MC){Object.defineProperty(MC,"__esModule",{value:!0});MC.dynamicRef=void 0;var Gd=$e(),Q8=Kn(),Xd=Md(),eK={keyword:"$dynamicRef",schemaType:"string",code:(e)=>JC(e,e.schema)};function JC(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 l=n.let("valid",!1);i(l),e.ok(l)}function i(l){if(s.schemaEnv.root.dynamicAnchors[o]){let c=n.let("_v",Gd._`${Q8.default.dynamicAnchors}${Gd.getProperty(o)}`);n.if(c,a(c,l),a(s.validateName,l))}else a(s.validateName,l)()}function a(l,c){return c?()=>n.block(()=>{Xd.callRef(e,l),n.let(c,!0)}):()=>Xd.callRef(e,l)}}MC.dynamicRef=JC;MC.default=eK});var VC=W(function(FC){Object.defineProperty(FC,"__esModule",{value:!0});var DC=cb(),LC=Oe(),nK={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){if(e.schema)DC.dynamicAnchor(e,"");else LC.checkStrictMode(e.it,"$recursiveAnchor: false is ignored")}};FC.default=nK});var WC=W(function(HC){Object.defineProperty(HC,"__esModule",{value:!0});var qC=ub(),sK={keyword:"$recursiveRef",schemaType:"string",code:(e)=>qC.dynamicRef(e,e.schema)};HC.default=sK});var UC=W(function(BC){Object.defineProperty(BC,"__esModule",{value:!0});var iK=cb(),aK=ub(),lK=VC(),cK=WC(),uK=[iK.default,aK.default,lK.default,cK.default];BC.default=uK});var KC=W(function(zC){Object.defineProperty(zC,"__esModule",{value:!0});var Yd=Vd(),dK={keyword:"dependentRequired",type:"object",schemaType:"object",error:Yd.error,code:(e)=>Yd.validatePropertyDeps(e)};zC.default=dK});var YC=W(function(XC){Object.defineProperty(XC,"__esModule",{value:!0});var GC=Vd(),mK={keyword:"dependentSchemas",type:"object",schemaType:"object",code:(e)=>GC.validateSchemaDeps(e)};XC.default=mK});var eR=W(function(QC){Object.defineProperty(QC,"__esModule",{value:!0});var ZC=Oe(),gK={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:e,parentSchema:t,it:n}){if(t.contains===void 0)ZC.checkStrictMode(n,`"${e}" without "contains" is ignored`)}};QC.default=gK});var nR=W(function(tR){Object.defineProperty(tR,"__esModule",{value:!0});var xK=KC(),bK=YC(),$K=eR(),SK=[xK.default,bK.default,$K.default];tR.default=SK});var sR=W(function(rR){Object.defineProperty(rR,"__esModule",{value:!0});var Zt=$e(),Zd=Oe(),vK=Kn(),EK={message:"must NOT have unevaluated properties",params:({params:e})=>Zt._`{unevaluatedProperty: ${e.unevaluatedProperty}}`},jK={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:EK,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 Zt.Name)t.if(Zt._`${a} !== true`,()=>t.forIn("key",r,(d)=>t.if(c(a,d),()=>l(d))));else if(a!==!0)t.forIn("key",r,(d)=>a===void 0?l(d):t.if(u(a,d),()=>l(d)));o.props=!0,e.ok(Zt._`${s} === ${vK.default.errors}`);function l(d){if(n===!1){if(e.setParams({unevaluatedProperty:d}),e.error(),!i)t.break();return}if(!Zd.alwaysValidSchema(o,n)){let p=t.name("valid");if(e.subschema({keyword:"unevaluatedProperties",dataProp:d,dataPropType:Zd.Type.Str},p),!i)t.if(Zt.not(p),()=>t.break())}}function c(d,p){return Zt._`!${d} || !${d}[${p}]`}function u(d,p){let m=[];for(let y in d)if(d[y]===!0)m.push(Zt._`${p} !== ${y}`);return Zt.and(...m)}}};rR.default=jK});var iR=W(function(oR){Object.defineProperty(oR,"__esModule",{value:!0});var vn=$e(),Qd=Oe(),_K={message:({params:{len:e}})=>vn.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>vn._`{limit: ${e}}`},kK={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:_K,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",vn._`${r}.length`);if(n===!1)e.setParams({len:o}),e.fail(vn._`${i} > ${o}`);else if(typeof n=="object"&&!Qd.alwaysValidSchema(s,n)){let l=t.var("valid",vn._`${i} <= ${o}`);t.if(vn.not(l),()=>a(l,o)),e.ok(l)}s.items=!0;function a(l,c){t.forRange("i",c,i,(u)=>{if(e.subschema({keyword:"unevaluatedItems",dataProp:u,dataPropType:Qd.Type.Num},l),!s.allErrors)t.if(vn.not(l),()=>t.break())})}}};oR.default=kK});var lR=W(function(aR){Object.defineProperty(aR,"__esModule",{value:!0});var AK=sR(),CK=iR(),RK=[AK.default,CK.default];aR.default=RK});var uR=W(function(cR){Object.defineProperty(cR,"__esModule",{value:!0});var ve=$e(),TK={message:({schemaCode:e})=>ve.str`must match format "${e}"`,params:({schemaCode:e})=>ve._`{format: ${e}}`},JK={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:TK,code(e,t){let{gen:n,data:r,$data:s,schema:o,schemaCode:i,it:a}=e,{opts:l,errSchemaPath:c,schemaEnv:u,self:d}=a;if(!l.validateFormats)return;if(s)p();else m();function p(){let y=n.scopeValue("formats",{ref:d.formats,code:l.code.formats}),S=n.const("fDef",ve._`${y}[${i}]`),g=n.let("fType"),x=n.let("format");n.if(ve._`typeof ${S} == "object" && !(${S} instanceof RegExp)`,()=>n.assign(g,ve._`${S}.type || "string"`).assign(x,ve._`${S}.validate`),()=>n.assign(g,ve._`"string"`).assign(x,S)),e.fail$data(ve.or(P(),w()));function P(){if(l.strictSchema===!1)return ve.nil;return ve._`${i} && !${x}`}function w(){let E=u.$async?ve._`(${S}.async ? await ${x}(${r}) : ${x}(${r}))`:ve._`${x}(${r})`,j=ve._`(typeof ${x} == "function" ? ${E} : ${x}.test(${r}))`;return ve._`${x} && ${x} !== true && ${g} === ${t} && !${j}`}}function m(){let y=d.formats[o];if(!y){P();return}if(y===!0)return;let[S,g,x]=w(y);if(S===t)e.pass(E());function P(){if(l.strictSchema===!1){d.logger.warn(j());return}throw Error(j());function j(){return`unknown format "${o}" ignored in schema at path "${c}"`}}function w(j){let A=j instanceof RegExp?ve.regexpCode(j):l.code.formats?ve._`${l.code.formats}${ve.getProperty(o)}`:void 0,T=n.scopeValue("formats",{key:o,ref:j,code:A});if(typeof j=="object"&&!(j instanceof RegExp))return[j.type||"string",j.validate,ve._`${T}.validate`];return["string",j,T]}function E(){if(typeof y=="object"&&!(y instanceof RegExp)&&y.async){if(!u.$async)throw Error("async format in sync schema");return ve._`await ${x}(${r})`}return typeof g=="function"?ve._`${x}(${r})`:ve._`${x}.test(${r})`}}}};cR.default=JK});var fb=W(function(fR){Object.defineProperty(fR,"__esModule",{value:!0});var IK=uR(),DK=[IK.default];fR.default=DK});var db=W(function(dR){Object.defineProperty(dR,"__esModule",{value:!0});dR.contentVocabulary=dR.metadataVocabulary=void 0;dR.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];dR.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var hR=W(function(mR){Object.defineProperty(mR,"__esModule",{value:!0});var VK=rb(),qK=sb(),HK=lb(),WK=UC(),BK=nR(),UK=lR(),zK=fb(),ep=db(),KK=[WK.default,VK.default,qK.default,(0,HK.default)(!0),zK.default,ep.metadataVocabulary,ep.contentVocabulary,BK.default,UK.default];mR.default=KK});var bR=W(function(yR){Object.defineProperty(yR,"__esModule",{value:!0});yR.DiscrError=void 0;var gR;(function(e){e.Tag="tag",e.Mapping="mapping"})(gR||(yR.DiscrError=gR={}))});var pb=W(function(SR){Object.defineProperty(SR,"__esModule",{value:!0});var Zn=$e(),wa=bR(),tp=fc(),XK=da(),$R=Oe(),YK={message:({params:{discrError:e,tagName:t}})=>e===wa.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:n}})=>Zn._`{error: ${e}, tag: ${n}, tagValue: ${t}}`},ZK={keyword:"discriminator",type:"object",schemaType:"object",error:YK,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 l=t.let("valid",!1),c=t.const("tag",Zn._`${n}${Zn.getProperty(a)}`);t.if(Zn._`typeof ${c} == "string"`,()=>u(),()=>e.error(!1,{discrError:wa.DiscrError.Tag,tag:c,tagName:a})),e.ok(l);function u(){let m=p();t.if(!1);for(let y in m)t.elseIf(Zn._`${c} === ${y}`),t.assign(l,d(m[y]));t.else(),e.error(!1,{discrError:wa.DiscrError.Mapping,tag:c,tagName:a}),t.endIf()}function d(m){let y=t.name("valid"),S=e.subschema({keyword:"oneOf",schemaProp:m},y);return e.mergeEvaluated(S,Zn.Name),y}function p(){var m;let y={},S=x(s),g=!0;for(let E=0;E<i.length;E++){let j=i[E];if((j===null||j===void 0?void 0:j.$ref)&&!$R.schemaHasRulesButRef(j,o.self.RULES)){let T=j.$ref;if(j=tp.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,T),j instanceof tp.SchemaEnv)j=j.schema;if(j===void 0)throw new XK.default(o.opts.uriResolver,o.baseId,T)}let A=(m=j===null||j===void 0?void 0:j.properties)===null||m===void 0?void 0:m[a];if(typeof A!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);g=g&&(S||x(j)),P(A,E)}if(!g)throw Error(`discriminator: "${a}" must be required`);return y;function x({required:E}){return Array.isArray(E)&&E.includes(a)}function P(E,j){if(E.const)w(E.const,j);else if(E.enum)for(let A of E.enum)w(A,j);else throw Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function w(E,j){if(typeof E!="string"||E in y)throw Error(`discriminator: "${a}" values must be unique strings`);y[E]=j}}}};SR.default=ZK});var wR=W(function(Vse,e9){e9.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 vR=W(function(qse,t9){t9.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 ER=W(function(Hse,n9){n9.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 jR=W(function(Wse,r9){r9.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 PR=W(function(Bse,s9){s9.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 _R=W(function(Use,o9){o9.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 kR=W(function(zse,i9){i9.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 OR=W(function(Kse,a9){a9.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 CR=W(function(AR){Object.defineProperty(AR,"__esModule",{value:!0});var l9=wR(),c9=vR(),u9=ER(),f9=jR(),d9=PR(),p9=_R(),m9=kR(),h9=OR(),g9=["/properties"];function y9(e){return[l9,c9,u9,f9,d9,t(this,p9),m9,t(this,h9)].forEach((n)=>this.addMetaSchema(n,void 0,!1)),this;function t(n,r){return e?n.$dataMetaSchema(r,g9):r}}AR.default=y9});var gb=W(function(En,hb){Object.defineProperty(En,"__esModule",{value:!0});En.MissingRefError=En.ValidationError=En.CodeGen=En.Name=En.nil=En.stringify=En.str=En._=En.KeywordCxt=En.Ajv2020=void 0;var b9=nb(),$9=hR(),S9=pb(),w9=CR(),mb="https://json-schema.org/draft/2020-12/schema";class mc extends b9.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){if(super._addVocabularies(),$9.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(S9.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:t}=this.opts;if(!t)return;w9.default.call(this,e),this.refs["http://json-schema.org/schema"]=mb}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(mb)?mb:void 0)}}En.Ajv2020=mc;hb.exports=En=mc;hb.exports.Ajv2020=mc;Object.defineProperty(En,"__esModule",{value:!0});En.default=mc;var v9=ua();Object.defineProperty(En,"KeywordCxt",{enumerable:!0,get:function(){return v9.KeywordCxt}});var va=$e();Object.defineProperty(En,"_",{enumerable:!0,get:function(){return va._}});Object.defineProperty(En,"str",{enumerable:!0,get:function(){return va.str}});Object.defineProperty(En,"stringify",{enumerable:!0,get:function(){return va.stringify}});Object.defineProperty(En,"nil",{enumerable:!0,get:function(){return va.nil}});Object.defineProperty(En,"Name",{enumerable:!0,get:function(){return va.Name}});Object.defineProperty(En,"CodeGen",{enumerable:!0,get:function(){return va.CodeGen}});var E9=cc();Object.defineProperty(En,"ValidationError",{enumerable:!0,get:function(){return E9.default}});var j9=da();Object.defineProperty(En,"MissingRefError",{enumerable:!0,get:function(){return j9.default}})});import{existsSync as rp,readFileSync as TR}from"node:fs";import{createRequire as RR}from"node:module";import{basename as k9,isAbsolute as O9,relative as A9,resolve as yb}from"node:path";import{fileURLToPath as NR,pathToFileURL as C9}from"node:url";function np(e){return JSON.parse(TR(e,"utf8"))}async function JR(e){let t=yb(e),n=qn(t),r=yb(t,"project.schema.json");if(!rp(n))throw Error(`No project.jxn or project.json in ${t}`);if(!rp(r))throw Error(`project.schema.json not found in ${t} — run \`jx schema\` to generate it from `+"the project file's extensions");let s=lu(TR(n,"utf8"),n),o=np(r);o.$id=C9(r).href;let i;try{({default:i}=await Promise.resolve().then(() => Sr(gb(),1)))}catch(d){throw Error("Project validation requires ajv: bun add ajv",{cause:d})}let l=await new i({allErrors:!0,loadSchema:(d)=>T9(d,t),strict:!1}).compileAsync(o),c=l(s),u=l.errors??null;return{errors:u&&rs(n)?N9(u,s):u,file:k9(n),valid:c}}function R9(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 N9(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=R9(t,n.instancePath),s=ft(r,"",n.instancePath),o=n.instancePath.split("/").at(-1)??"";if(s===null||s.includes(`
637
- `)||o==="")return n;return{...n,message:`must be a list, written as ${o} { - ${s} }`}})}async function T9(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=NR(e),r=A9(t,n);if(r.startsWith("..")||O9(r))throw Error(`Schema ref "${e}" escapes the project root ${t}`);if(rp(n))return np(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),l="@jxsuite/schema/",c;try{c=RR(yb(t,"package.json")).resolve(a)}catch(u){if(!a.startsWith(l))throw Error(`Schema ref "${e}" does not exist and "${a}" is not resolvable from the `+"project — is the package installed?",{cause:u});try{c=RR(import.meta.url).resolve(a)}catch(d){let p=NR(new URL(`../${a.slice(l.length)}`,import.meta.url));if(rp(p))return np(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 np(c)}var MR=J(()=>{ce();Qc();iu();cu();Eo()});function zr(e){return L(e.attributes)?e.attributes:{}}function Qt(e,t){let n=zr(e)[t];return k(n)?n:null}function Et(e){return k(e.tagName)?e.tagName.toLowerCase():""}function cn(e,t="the popover"){let n=k(e.id)?e.id:Qt(e,"id");if(n)return`#${n}`;let r=Et(e);return r===""?t:`the <${r}>`}function I9(e){let t=zr(e).popover;return k(t)?t:null}function DR(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(xb(r))t.add(s);let o=r.observedAttributes;if(Array.isArray(o)&&D9.every((i)=>o.includes(i)))n.add(s)}return{invokerTags:n,popoverTags:t}}function xb(e){return"popover"in zr(e)||"popover"in e}function hc(e,t){return xb(e)||(t?.popoverTags?.has(Et(e))??!1)}function io(e){if(k(e.id)&&e.id!=="")return e.id;let t=Qt(e,"id");return t===""?null:t}function*Ur(e,t=[],n=null,r){yield{enclosing:n,node:e,path:t};let s=hc(e,r)?e:n,{children:o}=e;if(Array.isArray(o)){for(let[l,c]of o.entries())if(D(c))yield*Ur(c,[...t,"children",l],s,r)}else if(L(o)&&Ot(o.map))yield*Ur(o.map,[...t,"children","map"],s,r);let i=Ot(e.map)?e.map:null;if(i)yield*Ur(i,[...t,"map"],s,r);let a=L(e.cases)?e.cases:{};for(let[l,c]of Object.entries(a))if(D(c))yield*Ur(c,[...t,"cases",l],s,r)}function bb(e,t){let n=[];for(let{node:r}of Ur(e,[],null,t)){if(!hc(r,t))continue;let s=io(r);if(s!==null&&!n.includes(s))n.push(s)}return n}function sp(e){return e.startsWith("@")}function LR(e){return e.startsWith(":")||e.startsWith("&")||e.startsWith(".")||e.startsWith("[")}function ln(e,t){let n=e?.[t];if(n===void 0||mo(n)||Array.isArray(n))return null;return String(n)}function FR(e){for(let[t,n]of Object.entries(e??{})){if(!mo(n))continue;if(LR(t)&&t.includes(":popover-open")&&ln(n,"display")!==null)return!0;if(sp(t)&&FR(n))return!0}return!1}function VR(e){for(let[t,n]of Object.entries(e??{})){if(!mo(n))continue;if(LR(t)&&t.includes(":popover-open"))return!0;if(sp(t)&&VR(n))return!0}return!1}function F9(e){return L9.some((t)=>ln(e,t)!==null)}function V9(e){if(!e)return[];let t=[];for(let[n,r]of Object.entries(e))if(sp(n)&&mo(r)&&ln(r,"display")!==null)t.push(n);return t}function qR(e){if(!e)return[];let t=[],n=ln(e,"transition");if(n!==null)t.push(n);for(let[r,s]of Object.entries(e))if(sp(r)&&mo(s))t.push(...qR(s));return t}function q9(e){if(!e)return!1;if(ln(e,"positionAnchor")!==null||ln(e,"position-anchor")!==null)return!0;return["top","left","right","bottom","inset","insetBlockStart","insetInlineStart"].some((t)=>(ln(e,t)??"").includes("anchor("))}function H9(e){if(!e)return!1;if(ln(e,"positionArea")!==null||ln(e,"position-area")!==null||ln(e,"positionTryFallbacks")!==null||ln(e,"position-try-fallbacks")!==null)return!0;return Object.keys(e).some((t)=>t.startsWith("@supports"))}function HR(e,t){let n=[...Ur(e,[],null,t)],r=bb(e,t),s=n.some(({node:a})=>hc(a,t)),o=new Set;for(let{node:a}of n)if(IR.has(Et(a))){let l=Qt(a,"popovertarget");if(l!==null)o.add(l)}let i=[];for(let{enclosing:a,node:l,path:c}of n)if(i.push(...W9(l,c,a,r,s,t)),xb(l))i.push(...B9(l,c,o));return i}function W9(e,t,n,r,s,o){let i=[],a=Et(e),l=Qt(e,"popovertarget"),c=IR.has(a)||(o?.invokerTags?.has(a)??!1);if(l!==null&&!c)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. ${st}`,fix:"invoker",message:`<${a||"element"}> carries popovertarget, which only <button> and <input> support.`,path:t,rule:"invoker-not-button",severity:"error"}),i;if(l!==null){if(s&&!r.includes(l)){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 "${l}". ${u}A target that names nothing does nothing, silently. ${st}`,message:`popovertarget="${l}" names no popover in this document.`,path:t,rule:"target-missing",severity:"error"})}else if(n!==null&&io(n)!==null&&io(n)!==l)i.push({detail:`This control is inside ${cn(n)} but targets "${l}". 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. ${st}`,message:`A control inside ${cn(n)} targets "${l}" instead.`,path:t,rule:"target-mismatch",severity:"warn"})}if(a==="a"&&n!==null&&l===null){let u=Qt(e,"href")??(k(e.href)?e.href:null),d=Qt(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. ${st}`,message:`A link inside ${cn(n)} does not dismiss it.`,path:t,rule:"link-does-not-dismiss",severity:"warn"})}}return i}function B9(e,t,n){let r=[],{style:s}=e,o=cn(e),i=I9(e);if(i!==null&&i!==""&&!M9.some((c)=>c===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". ${st}`,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(Ge(zr(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". ${st}`,fix:"mode",message:`${o} writes popover as a boolean.`,path:t,rule:"invalid-mode",severity:"error"});let a=ln(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. ${st}`,fix:"display",message:`${o} sets display in its base rule.`,path:t,rule:"base-display",severity:"error"});for(let c of V9(s))r.push({detail:`The same defect as a base \`display\`, arriving through \`${c}\` 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. ${st}`,fix:"display",message:`${o} sets display inside ${c}.`,path:t,rule:"breakpoint-display",severity:"error"});if(ln(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. ${st}`,fix:"display",message:`${o} also hides itself with visibility.`,path:t,rule:"base-visibility",severity:"warn"});if(!VR(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. ${st}`,message:`${o} has no :popover-open rule.`,path:t,rule:"no-open-rule",severity:"warn"});else if(!FR(s)&&a===null&&F9(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\`. ${st}`,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 c of qR(s))if(c.includes("display")&&!c.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. ${st}`,message:`${o} transitions display but not overlay.`,path:t,rule:"cut-exit",severity:"warn"});break}if(q9(s)&&!H9(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. ${st}`,message:`${o} is anchor-positioned with no fallback.`,path:t,rule:"unsafe-anchor",severity:"warn"});let l=io(e);if(l!==null&&!n.has(l))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. ${st}`,message:`${o} has no invoker in this document.`,path:t,rule:"no-invoker",severity:"warn"});return r}var M9,IR,D9,L9,st="See docs/framework/concepts/overlays.";var op=J(()=>{ce();M9=["auto","manual","hint"],IR=new Set(["button","input"]);D9=["popovertarget","popovertargetaction","command","commandfor"];L9=["flexDirection","flex-direction","alignItems","align-items","justifyContent","justify-content","flexWrap","flex-wrap","gridTemplateColumns","grid-template-columns","gridTemplateRows","grid-template-rows","gap"]});function _a(e,t){let n=zr(e),r=t in n?n[t]:e[t];if(r===void 0||r===null)return{kind:"absent"};if(me(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 ja(e,t){let n=_a(e,t);return n.kind==="text"&&n.text.trim()!==""?n.text:null}function en(e,t){return _a(e,t).kind!=="absent"}function ao(e){let t=_a(e,"role");if(t.kind==="bound")return Pa;return t.kind==="text"?t.text.trim().toLowerCase().split(/\s+/)[0]:null}function ip(e){let t=_a(e,"id");if(t.kind==="bound")return Pa;return t.kind==="text"&&t.text!==""?t.text:null}function Qn(e,t){let n=_a(e,t);return n.kind==="bound"||n.kind==="text"&&n.text.trim()!==""}function ap(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")||en(e,"aria-labelledby"))return!0;if(Et(e)==="img"&&(Qn(e,"alt")||Qn(e,"title")))return!0;if(Et(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)&&ap(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)=>Ot(s)&&ap(s))}function*Ea(e,t=[],n=[],r=[]){yield{node:e,path:t,roles:n,tags:r};let s=[...n,ao(e)],o=[...r,Et(e)],{children:i}=e;if(Array.isArray(i)){for(let[a,l]of i.entries())if(D(l))yield*Ea(l,[...t,"children",a],s,o)}else if(L(i)&&Ot(i.map))yield*Ea(i.map,[...t,"children","map"],s,o);if(Ot(e.map))yield*Ea(e.map,[...t,"map"],s,o);if(L(e.cases)){for(let[a,l]of Object.entries(e.cases))if(D(l))yield*Ea(l,[...t,"cases",a],s,o)}}function Y9(e){return e.some((t)=>t.includes("-"))}function Kr(e,t,n,r,s,o="error"){return{criterion:s,detail:`${r} ${U9}`,message:n,path:t,rule:e,severity:o}}function WR(e,t,n){if(n.includes("label"))return!0;if(e===Pa||t.bound)return!0;return e!==null&&t.ids.has(e)}function Z9(e,t){let{node:n,path:r,tags:s}=e,o=Et(n),i=ao(n);if(i==="bound")return null;if(Qn(n,"aria-label")||en(n,"aria-labelledby")||Qn(n,"title"))return null;let l=cn(n,"the control"),c=(d)=>Kr("interactive-unnamed",r,`${l} 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=Q9(n,o,t,s);if(u==="named"||u==="exempt")return null;if(i!==null&&z9.has(i))return ap(n)?null:c("Give it text content, or an aria-label.");if(i!==null&&K9.has(i))return c("Give it an aria-label, or aria-labelledby naming its visible label.");if(i!==null)return null;if(o==="button"||o==="summary"||o==="a"&&en(n,"href"))return ap(n)?null:c("Give it text content, or an aria-label.");if(u==="unnamed")return c("Give it a <label for> naming its id, or an aria-label.");if(u==="unnamed-value")return c("Give it a value, or an aria-label.");if(u==="unnamed-alt")return c("Give it an alt, or an aria-label.");return null}function Q9(e,t,n,r){if(t==="area"){if(!en(e,"href"))return"none";return Qn(e,"alt")?"named":"unnamed-alt"}if(t==="select"||t==="textarea")return WR(ip(e),n,r)||Qn(e,"placeholder")?"named":"unnamed";if(t!=="input")return"none";let s=(ja(e,"type")??"text").toLowerCase();if(s==="hidden"||en(e,"type")&&ja(e,"type")===null)return"exempt";if(G9.has(s))return Qn(e,"value")?"named":"unnamed-value";if(s==="image")return Qn(e,"alt")?"named":"unnamed-alt";return WR(ip(e),n,r)||Qn(e,"placeholder")?"named":"unnamed"}function t4(e){let{node:t,path:n,tags:r}=e,s=Et(t);if(!s.includes("-")||!r.some((o)=>e4.has(o)))return null;return Kr("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 n4(e){let{node:t,path:n}=e;if(Et(t)!=="img")return null;let r=ao(t);if(r==="bound"||r==="presentation"||r==="none")return null;if(en(t,"alt")||Qn(t,"aria-label")||en(t,"aria-labelledby"))return null;return Kr("img-alt-missing",n,`${cn(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 s4(e,t){let{node:n,path:r}=e,s=[];for(let o of r4){let i=ja(n,o);if(i===null)continue;for(let a of i.split(/\s+/))if(a!==""&&!t.has(a))s.push(Kr("aria-target-missing",r,`${cn(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 o4(e,t,n){for(let r of BR.get(t)??[]){let s=n.get(r);if(s===void 0)continue;if(s.bound)return!0;if(e===Pa&&s.ids.size>0)return!0;if(e!==null&&e!==Pa&&s.ids.has(e))return!0}return!1}function i4(e,t){let{node:n,path:r,roles:s,tags:o}=e,i=ao(n);if(i===null||i==="bound"||r.length===0||Y9(o))return null;if(s.includes("bound")||o4(ip(n),i,t))return null;let a=cn(n,"the element");if(i==="tab"&&!s.includes("tablist"))return Kr("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 Kr("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 Kr("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 a4(e){let t=[];for(let{node:n}of Ea(e)){if(ao(n)!=="tab")continue;let r=_a(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 l4(e){let{node:t,path:n}=e;if(ao(t)!=="tablist")return null;let r=a4(t);if(r===null||r.length===0||r.includes(!0))return null;return Kr("tablist-none-selected",n,`${cn(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 c4(e){let{node:t,path:n}=e,r=ao(t);if(!(Et(t)==="dialog"||r==="dialog"||r==="alertdialog")||r==="bound")return null;if(Qn(t,"aria-label")||en(t,"aria-labelledby"))return null;return Kr("dialog-unnamed",n,`${cn(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 f4(e){let{node:t,path:n}=e;if(!en(t,"aria-activedescendant"))return null;let r=Et(t);if(u4.has(r)||r==="a"&&en(t,"href")||en(t,"tabIndex")||en(t,"tabindex")||en(t,"contenteditable"))return null;return Kr("activedescendant-not-focusable",n,`${cn(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 UR(e){let t=[...Ea(e)],n=new Set,r={bound:!1,ids:new Set},s=new Map,o=!1;for(let{node:a}of t){let l=ao(a);if(l!==null&&X9.has(l)){let u=s.get(l)??{bound:!1,ids:new Set},d=ja(a,"aria-owns");if(d===null)u.bound||=en(a,"aria-owns");else for(let p of d.split(/\s+/))if(p!=="")u.ids.add(p);s.set(l,u)}let c=ip(a);if(c===Pa)o=!0;else if(c!==null)n.add(c);if(Et(a)==="label"){let u=ja(a,"for")??ja(a,"htmlFor");if(u===null)r.bound||=en(a,"for")||en(a,"htmlFor");else r.ids.add(u)}}let i=[];for(let a of t){let l=[Z9(a,r),n4(a),i4(a,s),t4(a),l4(a),c4(a),f4(a)];for(let c of l)if(c)i.push(c);if(!o)i.push(...s4(a,n))}return i}var U9="See docs/framework/concepts/accessibility.",Pa="bound",z9,K9,G9,BR,X9,e4,r4,u4;var zR=J(()=>{ce();op();z9=new Set(["button","checkbox","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","switch","tab","treeitem"]),K9=new Set(["combobox","listbox","searchbox","slider","spinbutton","textbox"]),G9=new Set(["button","reset","submit"]),BR=new Map([["menuitem",["menu","menubar"]],["menuitemcheckbox",["menu","menubar"]],["menuitemradio",["menu","menubar"]],["option",["listbox"]],["tab",["tablist"]]]),X9=new Set([...BR.values()].flat());e4=new Set(["select","jx-select"]);r4=["aria-activedescendant","aria-controls","aria-describedby","aria-details","aria-errormessage","aria-flowto","aria-labelledby","aria-owns"];u4=new Set(["button","input","select","textarea"])});function $b(e){return Et(e)==="dialog"}function KR(e){return e.startsWith("--")}function x4(e){let t=[];for(let{node:n}of Ur(e)){let r=io(n);if($b(n)&&r!==null&&!t.includes(r))t.push(r)}return t}function b4(e){let t=e.oncommand;return t!==void 0&&t!==null}function $4(e,t){for(let{node:n}of Ur(e)){if(n===e)continue;let r=Et(n);if(r==="button"){let s=Qt(n,"command"),o=Qt(n,"commandfor");if(s!==null&&(s==="close"||s==="request-close")&&(o===null||o===t))return!0}if(r==="form"&&Qt(n,"method")?.toLowerCase()==="dialog")return!0}return!1}function XR(e,t){let n=[...Ur(e,[],null,t)],r=x4(e),s=bb(e,t),o=r.length>0||s.length>0,i=new Map,a=new Map;for(let{node:c}of n){let u=io(c);if(u!==null&&!i.has(u))i.set(u,c);if(Et(c)==="button"){let d=Qt(c,"commandfor"),p=Qt(c,"command");if(d!==null){let m=a.get(d)??new Set;m.add(p??""),a.set(d,m)}}}let l=[];for(let{node:c,path:u}of n)if(l.push(...S4(c,u,i,r,s,o,t)),$b(c))l.push(...w4(c,u,a));return l}function S4(e,t,n,r,s,o,i){let a=[],l=Et(e),c=i?.invokerTags?.has(l)??!1,u=Qt(e,"command"),d=Qt(e,"commandfor");if(!(u!==null||d!==null||("command"in zr(e))||("commandfor"in zr(e))))return a;let m=cn(e,"the element");if(!y4.has(l)&&!c)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. ${st}`,fix:"invoker",message:`<${l||"element"}> carries command/commandfor, which only <button> supports.`,path:t,rule:"invoker-not-button",severity:"error"}),a;if(u!==null&&!h4.has(u)&&!KR(u))return a.push({detail:`\`command\` is an enumerated attribute taking ${GR.map((y)=>`\`${y}\``).join(", ")}, or a custom command starting with \`--\`. Anything else is the invalid-value state, and a button in that state does nothing when clicked. ${st}`,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 y=n.get(d),S=r.includes(d),g=s.includes(d);if(!y&&o){let x=[...r,...s].map((P)=>`"${P}"`).join(", ");return a.push({detail:`No element in this document has the id "${d}". The dialogs and popovers here are: ${x}. A commandfor that names nothing does nothing, silently. ${st}`,message:`commandfor="${d}" names nothing in this document.`,path:t,rule:"command-target-missing",severity:"error"}),a}if(u!==null&&y){if(d4.has(u)&&!$b(y))a.push({detail:`\`${u}\` acts on a <dialog>, and "${d}" is ${g?"a popover":`a <${Et(y)||"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."} ${st}`,message:`${m} sends ${u} to "${d}", which is not a dialog.`,path:t,rule:"command-target-mismatch",severity:"error"});else if(p4.has(u)&&!hc(y,i))a.push({detail:`\`${u}\` acts on a popover, and "${d}" is ${S?"a dialog":`a <${Et(y)||"element"}>`} that declares no \`popover\`. The click is ignored. ${S?"Use `show-modal`, `close` or `request-close` for a dialog.":"Give the target a `popover` attribute, or point the button elsewhere."} ${st}`,message:`${m} sends ${u} to "${d}", which is not a popover.`,path:t,rule:"command-target-mismatch",severity:"error"});else if(KR(u)&&!b4(y))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. ${st}`,message:`${m} sends ${u} to "${d}", which handles no command.`,path:t,rule:"custom-command-unhandled",severity:"warn"})}}return a}function w4(e,t,n){let r=[],s=cn(e,"the dialog"),o=io(e),{style:i}=e,a=Qt(e,"closedby");if(a!==null&&!g4.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. ${st}`,message:`${s} declares closedby="${a}", which is not any, closerequest or none.`,path:t,rule:"dialog-closedby-invalid",severity:"error"});if(ln(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. ${st}`,fix:"display",message:`${s} sets display in its base rule.`,path:t,rule:"dialog-display",severity:"error"});let l=o===null?void 0:n.get(o),c=Qt(e,"open")!==null||zr(e).open===!0||e.open===!0;if(o!==null&&!l?.has("show-modal")&&!c)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. ${st}`,message:`${s} has no invoker in this document.`,path:t,rule:"dialog-no-invoker",severity:"warn"});if(l?.has("show-modal")&&a==="none"&&!$4(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"\`. ${st}`,message:`${s} opens modally, closes on nothing, and has no close button.`,path:t,rule:"modal-without-close",severity:"error"});return r}var GR,d4,p4,m4,h4,g4,y4;var YR=J(()=>{ce();op();GR=["toggle-popover","show-popover","hide-popover","show-modal","close","request-close"],d4=new Set(["show-modal","close","request-close"]),p4=new Set(["toggle-popover","show-popover","hide-popover"]),m4=["any","closerequest","none"],h4=new Set(GR),g4=new Set(m4),y4=new Set(["button"])});var aN=W(function(oN){Object.defineProperty(oN,"__esModule",{value:!0});oN.formatNames=oN.fastFormats=oN.fullFormats=void 0;function Gr(e,t){return{validate:e,compare:t}}oN.fullFormats={date:Gr(tN,Eb),time:Gr(wb(!0),jb),"date-time":Gr(ZR(!0),rN),"iso-time":Gr(wb(),nN),"iso-date-time":Gr(ZR(),sN),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:k4,"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:J4,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:O4,int32:{type:"number",validate:R4},int64:{type:"number",validate:N4},float:{type:"number",validate:eN},double:{type:"number",validate:eN},password:!0,binary:!0};oN.fastFormats={...oN.fullFormats,date:Gr(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Eb),time:Gr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,jb),"date-time":Gr(/^\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,rN),"iso-time":Gr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,nN),"iso-date-time":Gr(/^\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,sN),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};oN.formatNames=Object.keys(oN.fullFormats);function v4(e){return e%4===0&&(e%100!==0||e%400===0)}var E4=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,j4=[0,31,28,31,30,31,30,31,31,30,31,30,31];function tN(e){let t=E4.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&&v4(n)?29:j4[r])}function Eb(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var Sb=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function wb(e){return function(n){let r=Sb.exec(n);if(!r)return!1;let s=+r[1],o=+r[2],i=+r[3],a=r[4],l=r[5]==="-"?-1:1,c=+(r[6]||0),u=+(r[7]||0);if(c>23||u>59||e&&!a)return!1;if(s<=23&&o<=59&&i<60)return!0;let d=o-u*l,p=s-c*l-(d<0?1:0);return(p===23||p===-1)&&(d===59||d===-1)&&i<61}}function jb(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 nN(e,t){if(!(e&&t))return;let n=Sb.exec(e),r=Sb.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 vb=/t|\s/i;function ZR(e){let t=wb(e);return function(r){let s=r.split(vb);return s.length===2&&tN(s[0])&&t(s[1])}}function rN(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 sN(e,t){if(!(e&&t))return;let[n,r]=e.split(vb),[s,o]=t.split(vb),i=Eb(n,s);if(i===void 0)return;return i||jb(r,o)}var P4=/\/|:/,_4=/^(?:[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 k4(e){return P4.test(e)&&_4.test(e)}var QR=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function O4(e){return QR.lastIndex=0,QR.test(e)}var A4=-2147483648,C4=2147483647;function R4(e){return Number.isInteger(e)&&e<=C4&&e>=A4}function N4(e){return Number.isInteger(e)}function eN(){return!0}var T4=/[^\\]\\Z/;function J4(e){if(T4.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var cN=W(function(lN){Object.defineProperty(lN,"__esModule",{value:!0});var I4=rb(),D4=sb(),L4=lb(),F4=fb(),lp=db(),V4=[I4.default,D4.default,(0,L4.default)(),F4.default,lp.metadataVocabulary,lp.contentVocabulary];lN.default=V4});var uN=W(function(Eoe,H4){H4.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 dN=W(function(jn,_b){Object.defineProperty(jn,"__esModule",{value:!0});jn.MissingRefError=jn.ValidationError=jn.CodeGen=jn.Name=jn.nil=jn.stringify=jn.str=jn._=jn.KeywordCxt=jn.Ajv=void 0;var W4=nb(),B4=cN(),U4=pb(),fN=uN(),z4=["/properties"],cp="http://json-schema.org/draft-07/schema";class gc extends W4.default{_addVocabularies(){if(super._addVocabularies(),B4.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(U4.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(fN,z4):fN;this.addMetaSchema(e,cp,!1),this.refs["http://json-schema.org/schema"]=cp}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(cp)?cp:void 0)}}jn.Ajv=gc;_b.exports=jn=gc;_b.exports.Ajv=gc;Object.defineProperty(jn,"__esModule",{value:!0});jn.default=gc;var K4=ua();Object.defineProperty(jn,"KeywordCxt",{enumerable:!0,get:function(){return K4.KeywordCxt}});var ka=$e();Object.defineProperty(jn,"_",{enumerable:!0,get:function(){return ka._}});Object.defineProperty(jn,"str",{enumerable:!0,get:function(){return ka.str}});Object.defineProperty(jn,"stringify",{enumerable:!0,get:function(){return ka.stringify}});Object.defineProperty(jn,"nil",{enumerable:!0,get:function(){return ka.nil}});Object.defineProperty(jn,"Name",{enumerable:!0,get:function(){return ka.Name}});Object.defineProperty(jn,"CodeGen",{enumerable:!0,get:function(){return ka.CodeGen}});var G4=cc();Object.defineProperty(jn,"ValidationError",{enumerable:!0,get:function(){return G4.default}});var X4=da();Object.defineProperty(jn,"MissingRefError",{enumerable:!0,get:function(){return X4.default}})});var hN=W(function(mN){Object.defineProperty(mN,"__esModule",{value:!0});mN.formatLimitDefinition=void 0;var pN=dN(),xt=$e(),lo=xt.operators,up={formatMaximum:{okStr:"<=",ok:lo.LTE,fail:lo.GT},formatMinimum:{okStr:">=",ok:lo.GTE,fail:lo.LT},formatExclusiveMaximum:{okStr:"<",ok:lo.LT,fail:lo.GTE},formatExclusiveMinimum:{okStr:">",ok:lo.GT,fail:lo.LTE}},Q4={message:({keyword:e,schemaCode:t})=>xt.str`should be ${up[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>xt._`{comparison: ${up[e].okStr}, limit: ${t}}`};mN.formatLimitDefinition={keyword:Object.keys(up),type:"string",schemaType:"string",$data:!0,error:Q4,code(e){let{gen:t,data:n,schemaCode:r,keyword:s,it:o}=e,{opts:i,self:a}=o;if(!i.validateFormats)return;let l=new pN.KeywordCxt(o,a.RULES.all.format.definition,"format");if(l.$data)c();else u();function c(){let p=t.scopeValue("formats",{ref:a.formats,code:i.code.formats}),m=t.const("fmt",xt._`${p}[${l.schemaCode}]`);e.fail$data(xt.or(xt._`typeof ${m} != "object"`,xt._`${m} instanceof RegExp`,xt._`typeof ${m}.compare != "function"`,d(m)))}function u(){let p=l.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 y=t.scopeValue("formats",{key:p,ref:m,code:i.code.formats?xt._`${i.code.formats}${xt.getProperty(p)}`:void 0});e.fail$data(d(y))}function d(p){return xt._`${p}.compare(${n}, ${r}) ${up[s].fail} 0`}},dependencies:["format"]};var e3=(e)=>(e.addKeyword(mN.formatLimitDefinition),e);mN.default=e3});var bN=W(function(yc,xN){Object.defineProperty(yc,"__esModule",{value:!0});var er=aN(),n3=hN(),Oa=$e(),gN=new Oa.Name("fullFormats"),r3=new Oa.Name("fastFormats"),Ob=(e,t={keywords:!0})=>{if(Array.isArray(t))return yN(e,t,er.fullFormats,gN),e;let[n,r]=t.mode==="fast"?[er.fastFormats,r3]:[er.fullFormats,gN],s=t.formats||er.formatNames;if(yN(e,s,n,r),t.keywords)(0,n3.default)(e);return e};Ob.get=(e,t="full")=>{let r=(t==="fast"?er.fastFormats:er.fullFormats)[e];if(!r)throw Error(`Unknown format "${e}"`);return r};function yN(e,t,n,r){var s,o;(s=(o=e.opts.code).formats)!==null&&s!==void 0||(o.formats=Oa._`require("ajv-formats/dist/formats").${r}`);for(let i of t)e.addFormat(i,n[i])}xN.exports=yc=Ob;Object.defineProperty(yc,"__esModule",{value:!0});yc.default=Ob});import{existsSync as wN,readFileSync as Cb,readdirSync as vN,statSync as EN}from"node:fs";import{createRequire as s3}from"node:module";import{join as jN,relative as Aa,resolve as Ab}from"node:path";async function l3(){try{let{default:e}=await Promise.resolve().then(() => Sr(gb(),1)),{default:t}=await Promise.resolve().then(() => Sr(bN(),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 PN(e,t={}){let n=Ab(e),r=[],s=[],o=0;for(let w of["project.schema.json","document.schema.json"]){let E=Ab(n,w);if(!wN(E))continue;o+=1;let j=xc(E),A=d3(j);if(A.length>0)r.push({errors:A.map(({reason:T,ref:I})=>({message:`$ref "${I}" ${T} — committed entry documents must be self-contained `+"single-resource schemas; regenerate with `jx schema`"})),file:w})}if(r.length>0)return{checked:o,issues:r,lint:s,valid:!1};let i=await JR(n);if(o+=1,!i.valid)r.push({errors:i.errors??[],file:i.file});let{addFormats:a,Ajv:l}=await l3(),{document:c}=await MP(n,{write:!1}),u=new l({allErrors:!0,ownProperties:!0,strict:!1});a(u);let d=u.compile(c),p=DR(SN(n).flatMap((w)=>{try{return[JSON.parse(Cb(w,"utf8"))]}catch{return[]}}));for(let w of o3)for(let E of ON(Ab(n,w))){if(E.endsWith(".class.json"))continue;o+=1;let j=c3(E,Aa(n,E));if(s.push(...j.warnings),j.failure!==null){r.push(j.failure);continue}let A=j.document,T=$N(A,Aa(n,E));if(s.push(...T.warnings),T.failure!==null){r.push(T.failure);continue}if(d(A))s.push(...f3(A,Aa(n,E),p));else r.push({errors:d.errors??[],file:Aa(n,E)})}let m=new l({allErrors:!0,ownProperties:!0,strict:!1});a(m);let y=m.compile(yx());for(let w of SN(n)){o+=1;let E=xc(w),j=$N(E,Aa(n,w));if(s.push(...j.warnings),j.failure!==null)r.push(j.failure);else if(!y(E))r.push({errors:y.errors??[],file:Aa(n,w)})}let{config:S}=As(n),g=await Os(n,S),x=s3(import.meta.url);for(let w of g.extensions)for(let E of["project","document","fields"]){let j=w.schemas[E];if(!j)continue;o+=1;let A=new l({allErrors:!0,ownProperties:!0,strict:!1});a(A);for(let T of a3){let I=x.resolve(T);A.addSchema(xc(I))}try{A.compile(xc(j))}catch(T){r.push({errors:[{message:T instanceof Error?T.message:String(T)}],file:`${w.specifier} (${E} fragment)`})}}let P=t.strict===!0&&s.some((w)=>w.severity==="error");return{checked:o,issues:r,lint:s,valid:r.length===0&&!P}}function c3(e,t){if(!rs(e))return{document:xc(e),failure:null,warnings:[]};let n=Cb(e,"utf8"),r=Bp(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:u3(n),failure:null,warnings:r}}catch(s){return{document:null,failure:{errors:[{message:be(s)}],file:t},warnings:r}}}function $N(e,t){let n=[];try{il(e,t,n)}catch(s){return{failure:{errors:[{message:be(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 u3(e){let t=vo(e);return L(t)?t:null}function xc(e){return JSON.parse(Cb(e,"utf8"))}function f3(e,t,n){let r=[];for(let s of HR(e,n))r.push({...fp(s),file:t,source:"popover"});for(let s of XR(e,n))r.push({...fp(s),file:t,source:"dialog"});for(let s of UR(e))r.push({...fp(s),criterion:s.criterion,file:t,source:"accessibility"});for(let s of wv(e))r.push({...fp({...s,severity:"info"}),file:t,source:"module"});return r}function fp(e){return{detail:e.detail,message:e.message,path:e.path,rule:e.rule,severity:e.severity}}function _N(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 d3(e){let t=[],n=new Set,r=(o)=>{let i=e;for(let a of o.slice(1).split("/")){if(a==="")continue;let l=a.replaceAll("~1","/").replaceAll("~0","~");if(!D(i))return!1;if(i=i[l],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,l]of Object.entries(o)){if(!p3.has(a))continue;if(Array.isArray(l))for(let c of l)s(c);else if(L(l)){if(s(l),kN.has(a))for(let c of Object.values(l))s(c)}}};return s(e),t}function ON(e){if(!wN(e))return[];let t=[];for(let n of vN(e)){let r=jN(e,n);if(EN(r).isDirectory())t.push(...ON(r));else if(Vn(n))t.push(r)}return t.toSorted()}function SN(e){let t=[],n=(r)=>{for(let s of vN(r)){if(i3.has(s))continue;let o=jN(r,s);if(EN(o).isDirectory())n(o);else if(s.endsWith(".class.json"))t.push(o)}};return n(e),t.toSorted()}function AN(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 o3,i3,a3,kN,p3;var CN=J(()=>{os();Lt();Ru();o_();MR();zR();YR();Ti();op();ce();is();bi();hx();o3=["components","pages","layouts"],i3=new Set(["node_modules","dist",".git"]),a3=["@jxsuite/schema/schemas/project.core.schema.json","@jxsuite/schema/schemas/project.fields.schema.json","@jxsuite/schema/schemas/document.paths.schema.json"];kN=new Set(["$defs","definitions","dependencies","dependentSchemas","patternProperties","properties"]),p3=new Set([...kN,"additionalItems","additionalProperties","allOf","anyOf","contains","contentSchema","else","if","items","not","oneOf","prefixItems","propertyNames","then","unevaluatedItems","unevaluatedProperties"])});Lt();import{relative as Rb,resolve as RN}from"node:path";async function m3(){let e=process.argv.slice(2),[t]=e;if(!t||t==="--help"||t==="-h")console.log(`Usage: jx <command> [options]
639
+ deps: ${n}}`};var eK={keyword:"dependencies",type:"object",schemaType:"object",error:TC.error,code(e){let[t,n]=tK(e);CC(e,t),RC(e,n)}};function tK({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 CC(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 l=Br.propertyInData(n,r,i,s.opts.ownProperties);if(e.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),s.allErrors)n.if(l,()=>{for(let c of a)Br.checkReportMissingProp(e,c)});else n.if(Pa._`${l} && (${Br.checkMissingProp(e,a,o)})`),Br.reportMissingProp(e,o),n.else()}}TC.validatePropertyDeps=CC;function RC(e,t=e.schema){let{gen:n,data:r,keyword:s,it:o}=e,i=n.name("valid");for(let a in t){if(AC.alwaysValidSchema(o,t[a]))continue;n.if(Br.propertyInData(n,r,a,o.opts.ownProperties),()=>{let l=e.subschema({keyword:s,schemaProp:a},i);e.mergeValidEvaluated(l,i)},()=>n.var(i,!0)),e.ok(i)}}TC.validateSchemaDeps=RC;TC.default=eK});var DC=B(function(IC){Object.defineProperty(IC,"__esModule",{value:!0});var tp=$e(),MC=Ce(),sK={message:"property name must be valid",params:({params:e})=>tp._`{propertyName: ${e.propertyName}}`},oK={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:sK,code(e){let{gen:t,schema:n,data:r,it:s}=e;if(MC.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(tp.not(o),()=>{if(e.error(!0),!s.allErrors)t.break()})}),e.ok(o)}};IC.default=oK});var Ob=B(function(LC){Object.defineProperty(LC,"__esModule",{value:!0});var so=er(),St=$e(),aK=Zn(),oo=Ce(),lK={message:"must NOT have additional properties",params:({params:e})=>St._`{additionalProperty: ${e.additionalProperty}}`},cK={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:lK,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:l}=i;if(i.props=!0,l.removeAdditional!=="all"&&oo.alwaysValidSchema(i,n))return;let c=so.allSchemaProperties(r.properties),u=so.allSchemaProperties(r.patternProperties);d(),e.ok(St._`${o} === ${aK.default.errors}`);function d(){t.forIn("key",s,(h)=>{if(!c.length&&!u.length)g(h);else t.if(p(h),()=>g(h))})}function p(h){let x;if(c.length>8){let k=oo.schemaRefOrVal(i,r.properties,"properties");x=so.isOwnProperty(t,k,h)}else if(c.length)x=St.or(...c.map((k)=>St._`${h} === ${k}`));else x=St.nil;if(u.length)x=St.or(x,...u.map((k)=>St._`${so.usePattern(e,k)}.test(${h})`));return St.not(x)}function m(h){t.code(St._`delete ${s}[${h}]`)}function g(h){if(l.removeAdditional==="all"||l.removeAdditional&&n===!1){m(h);return}if(n===!1){if(e.setParams({additionalProperty:h}),e.error(),!a)t.break();return}if(typeof n=="object"&&!oo.alwaysValidSchema(i,n)){let x=t.name("valid");if(l.removeAdditional==="failing")b(h,x,!1),t.if(St.not(x),()=>{e.reset(),m(h)});else if(b(h,x),!a)t.if(St.not(x),()=>t.break())}}function b(h,x,k){let w={keyword:"additionalProperties",dataProp:h,dataPropType:oo.Type.Str};if(k===!1)Object.assign(w,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(w,x)}}};LC.default=cK});var HC=B(function(qC){Object.defineProperty(qC,"__esModule",{value:!0});var VC=ya(),np=er(),ka=Ce(),FC=Ob(),fK={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)FC.default.code(new VC.KeywordCxt(o,FC.default,"additionalProperties"));let i=np.allSchemaProperties(n);for(let d of i)o.definedProperties.add(d);if(o.opts.unevaluated&&i.length&&o.props!==!0)o.props=ka.mergeEvaluated.props(t,ka.toHash(i),o.props);let a=i.filter((d)=>!ka.alwaysValidSchema(o,n[d]));if(a.length===0)return;let l=t.name("valid");for(let d of a){if(c(d))u(d);else{if(t.if(np.propertyInData(t,s,d,o.opts.ownProperties)),u(d),!o.allErrors)t.else().var(l,!0);t.endIf()}e.it.definedProperties.add(d),e.ok(l)}function c(d){return o.opts.useDefaults&&!o.compositeRule&&n[d].default!==void 0}function u(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},l)}}};qC.default=fK});var BC=B(function(WC){Object.defineProperty(WC,"__esModule",{value:!0});var rp=er(),io=$e(),sp=Ce(),op=Ce(),pK={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:n,data:r,parentSchema:s,it:o}=e,{opts:i}=o,a=rp.allSchemaProperties(n),l=a.filter((b)=>sp.alwaysValidSchema(o,n[b]));if(a.length===0||l.length===a.length&&(!o.opts.unevaluated||o.props===!0))return;let c=i.strictSchema&&!i.allowMatchingProperties&&s.properties,u=t.name("valid");if(o.props!==!0&&!(o.props instanceof io.Name))o.props=op.evaluatedPropsToName(t,o.props);let{props:d}=o;p();function p(){for(let b of a){if(c)m(b);if(o.allErrors)g(b);else t.var(u,!0),g(b),t.if(u)}}function m(b){for(let h in c)if(new RegExp(b).test(h))sp.checkStrictMode(o,`property ${h} matches pattern ${b} (use allowMatchingProperties)`)}function g(b){t.forIn("key",r,(h)=>{t.if(io._`${rp.usePattern(e,b)}.test(${h})`,()=>{let x=l.includes(b);if(!x)e.subschema({keyword:"patternProperties",schemaProp:b,dataProp:h,dataPropType:op.Type.Str},u);if(o.opts.unevaluated&&d!==!0)t.assign(io._`${d}[${h}]`,!0);else if(!x&&!o.allErrors)t.if(io.not(u),()=>t.break())})})}}};WC.default=pK});var KC=B(function(zC){Object.defineProperty(zC,"__esModule",{value:!0});var UC=Ce(),hK={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:n,it:r}=e;if(UC.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"}};zC.default=hK});var YC=B(function(XC){Object.defineProperty(XC,"__esModule",{value:!0});var GC=er(),yK={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:GC.validateUnion,error:{message:"must match a schema in anyOf"}};XC.default=yK});var eR=B(function(QC){Object.defineProperty(QC,"__esModule",{value:!0});var ao=$e(),ZC=Ce(),bK={message:"must match exactly one schema in oneOf",params:({params:e})=>ao._`{passingSchemas: ${e.passing}}`},$K={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:bK,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),l=t.name("_valid");e.setParams({passing:a}),t.block(c),e.result(i,()=>e.reset(),()=>e.error(!0));function c(){o.forEach((u,d)=>{let p;if(ZC.alwaysValidSchema(s,u))t.var(l,!0);else p=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},l);if(d>0)t.if(ao._`${l} && ${i}`).assign(i,!1).assign(a,ao._`[${a}, ${d}]`).else();t.if(l,()=>{if(t.assign(i,!0),t.assign(a,d),p)e.mergeEvaluated(p,ao.Name)})})}}};QC.default=$K});var rR=B(function(nR){Object.defineProperty(nR,"__esModule",{value:!0});var tR=Ce(),wK={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(tR.alwaysValidSchema(r,o))return;let a=e.subschema({keyword:"allOf",schemaProp:i},s);e.ok(s),e.mergeEvaluated(a)})}};nR.default=wK});var iR=B(function(oR){Object.defineProperty(oR,"__esModule",{value:!0});var lo=$e(),ip=Ce(),EK={message:({params:e})=>lo.str`must match "${e.ifClause}" schema`,params:({params:e})=>lo._`{failingKeyword: ${e.ifClause}}`},jK={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:EK,code(e){let{gen:t,parentSchema:n,it:r}=e;if(n.then===void 0&&n.else===void 0)ip.checkStrictMode(r,'"if" without "then" and "else" is ignored');let s=sR(r,"then"),o=sR(r,"else");if(!s&&!o)return;let i=t.let("valid",!0),a=t.name("_valid");if(l(),e.reset(),s&&o){let u=t.let("ifClause");e.setParams({ifClause:u}),t.if(a,c("then",u),c("else",u))}else if(s)t.if(a,c("then"));else t.if(lo.not(a),c("else"));e.pass(i,()=>e.error(!0));function l(){let u=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(u)}function c(u,d){return()=>{let p=e.subschema({keyword:u},a);if(t.assign(i,a),e.mergeValidEvaluated(p,i),d)t.assign(d,lo._`${u}`);else e.setParams({ifClause:u})}}}};function sR(e,t){let n=e.schema[t];return n!==void 0&&!ip.alwaysValidSchema(e,n)}oR.default=jK});var cR=B(function(lR){Object.defineProperty(lR,"__esModule",{value:!0});var aR=Ce(),kK={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:n}){if(t.if===void 0)aR.checkStrictMode(n,`"${e}" without "if" is ignored`)}};lR.default=kK});var Ab=B(function(uR){Object.defineProperty(uR,"__esModule",{value:!0});var OK=kb(),AK=wC(),CK=_b(),RK=kC(),TK=OC(),NK=ep(),JK=DC(),MK=Ob(),IK=HC(),DK=BC(),LK=KC(),FK=YC(),VK=eR(),qK=rR(),HK=iR(),WK=cR();function BK(e=!1){let t=[LK.default,FK.default,VK.default,qK.default,HK.default,WK.default,JK.default,MK.default,NK.default,IK.default,DK.default];if(e)t.push(AK.default,RK.default);else t.push(OK.default,CK.default);return t.push(TK.default),t}uR.default=BK});var Cb=B(function(pR){Object.defineProperty(pR,"__esModule",{value:!0});pR.dynamicAnchor=void 0;var _a=$e(),zK=Zn(),ap=hc(),fR=Gd(),KK={keyword:"$dynamicAnchor",schemaType:"string",code:(e)=>dR(e,e.schema)};function dR(e,t){let{gen:n,it:r}=e;r.schemaEnv.root.dynamicAnchors[t]=!0;let s=_a._`${zK.default.dynamicAnchors}${_a.getProperty(t)}`,o=r.errSchemaPath==="#"?r.validateName:GK(e);n.if(_a._`!${s}`,()=>n.assign(s,o))}pR.dynamicAnchor=dR;function GK(e){let{schemaEnv:t,schema:n,self:r}=e.it,{root:s,baseId:o,localRefs:i,meta:a}=t.root,{schemaId:l}=r.opts,c=new ap.SchemaEnv({schema:n,schemaId:l,root:s,baseId:o,localRefs:i,meta:a});return ap.compileSchema.call(r,c),fR.getValidate(e,c)}pR.default=KK});var Rb=B(function(gR){Object.defineProperty(gR,"__esModule",{value:!0});gR.dynamicRef=void 0;var lp=$e(),YK=Zn(),cp=Gd(),ZK={keyword:"$dynamicRef",schemaType:"string",code:(e)=>hR(e,e.schema)};function hR(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 l=n.let("valid",!1);i(l),e.ok(l)}function i(l){if(s.schemaEnv.root.dynamicAnchors[o]){let c=n.let("_v",lp._`${YK.default.dynamicAnchors}${lp.getProperty(o)}`);n.if(c,a(c,l),a(s.validateName,l))}else a(s.validateName,l)()}function a(l,c){return c?()=>n.block(()=>{cp.callRef(e,l),n.let(c,!0)}):()=>cp.callRef(e,l)}}gR.dynamicRef=hR;gR.default=ZK});var SR=B(function($R){Object.defineProperty($R,"__esModule",{value:!0});var xR=Cb(),bR=Ce(),e9={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){if(e.schema)xR.dynamicAnchor(e,"");else bR.checkStrictMode(e.it,"$recursiveAnchor: false is ignored")}};$R.default=e9});var ER=B(function(vR){Object.defineProperty(vR,"__esModule",{value:!0});var wR=Rb(),n9={keyword:"$recursiveRef",schemaType:"string",code:(e)=>wR.dynamicRef(e,e.schema)};vR.default=n9});var PR=B(function(jR){Object.defineProperty(jR,"__esModule",{value:!0});var s9=Cb(),o9=Rb(),i9=SR(),a9=ER(),l9=[s9.default,o9.default,i9.default,a9.default];jR.default=l9});var _R=B(function(kR){Object.defineProperty(kR,"__esModule",{value:!0});var up=ep(),u9={keyword:"dependentRequired",type:"object",schemaType:"object",error:up.error,code:(e)=>up.validatePropertyDeps(e)};kR.default=u9});var CR=B(function(AR){Object.defineProperty(AR,"__esModule",{value:!0});var OR=ep(),d9={keyword:"dependentSchemas",type:"object",schemaType:"object",code:(e)=>OR.validateSchemaDeps(e)};AR.default=d9});var NR=B(function(TR){Object.defineProperty(TR,"__esModule",{value:!0});var RR=Ce(),m9={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:e,parentSchema:t,it:n}){if(t.contains===void 0)RR.checkStrictMode(n,`"${e}" without "contains" is ignored`)}};TR.default=m9});var MR=B(function(JR){Object.defineProperty(JR,"__esModule",{value:!0});var g9=_R(),y9=CR(),x9=NR(),b9=[g9.default,y9.default,x9.default];JR.default=b9});var DR=B(function(IR){Object.defineProperty(IR,"__esModule",{value:!0});var tn=$e(),fp=Ce(),S9=Zn(),w9={message:"must NOT have unevaluated properties",params:({params:e})=>tn._`{unevaluatedProperty: ${e.unevaluatedProperty}}`},v9={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:w9,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 tn.Name)t.if(tn._`${a} !== true`,()=>t.forIn("key",r,(d)=>t.if(c(a,d),()=>l(d))));else if(a!==!0)t.forIn("key",r,(d)=>a===void 0?l(d):t.if(u(a,d),()=>l(d)));o.props=!0,e.ok(tn._`${s} === ${S9.default.errors}`);function l(d){if(n===!1){if(e.setParams({unevaluatedProperty:d}),e.error(),!i)t.break();return}if(!fp.alwaysValidSchema(o,n)){let p=t.name("valid");if(e.subschema({keyword:"unevaluatedProperties",dataProp:d,dataPropType:fp.Type.Str},p),!i)t.if(tn.not(p),()=>t.break())}}function c(d,p){return tn._`!${d} || !${d}[${p}]`}function u(d,p){let m=[];for(let g in d)if(d[g]===!0)m.push(tn._`${p} !== ${g}`);return tn.and(...m)}}};IR.default=v9});var FR=B(function(LR){Object.defineProperty(LR,"__esModule",{value:!0});var Pn=$e(),dp=Ce(),j9={message:({params:{len:e}})=>Pn.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Pn._`{limit: ${e}}`},P9={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:j9,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"&&!dp.alwaysValidSchema(s,n)){let l=t.var("valid",Pn._`${i} <= ${o}`);t.if(Pn.not(l),()=>a(l,o)),e.ok(l)}s.items=!0;function a(l,c){t.forRange("i",c,i,(u)=>{if(e.subschema({keyword:"unevaluatedItems",dataProp:u,dataPropType:dp.Type.Num},l),!s.allErrors)t.if(Pn.not(l),()=>t.break())})}}};LR.default=P9});var qR=B(function(VR){Object.defineProperty(VR,"__esModule",{value:!0});var _9=DR(),O9=FR(),A9=[_9.default,O9.default];VR.default=A9});var WR=B(function(HR){Object.defineProperty(HR,"__esModule",{value:!0});var ve=$e(),R9={message:({schemaCode:e})=>ve.str`must match format "${e}"`,params:({schemaCode:e})=>ve._`{format: ${e}}`},T9={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:R9,code(e,t){let{gen:n,data:r,$data:s,schema:o,schemaCode:i,it:a}=e,{opts:l,errSchemaPath:c,schemaEnv:u,self:d}=a;if(!l.validateFormats)return;if(s)p();else m();function p(){let g=n.scopeValue("formats",{ref:d.formats,code:l.code.formats}),b=n.const("fDef",ve._`${g}[${i}]`),h=n.let("fType"),x=n.let("format");n.if(ve._`typeof ${b} == "object" && !(${b} instanceof RegExp)`,()=>n.assign(h,ve._`${b}.type || "string"`).assign(x,ve._`${b}.validate`),()=>n.assign(h,ve._`"string"`).assign(x,b)),e.fail$data(ve.or(k(),w()));function k(){if(l.strictSchema===!1)return ve.nil;return ve._`${i} && !${x}`}function w(){let v=u.$async?ve._`(${b}.async ? await ${x}(${r}) : ${x}(${r}))`:ve._`${x}(${r})`,E=ve._`(typeof ${x} == "function" ? ${v} : ${x}.test(${r}))`;return ve._`${x} && ${x} !== true && ${h} === ${t} && !${E}`}}function m(){let g=d.formats[o];if(!g){k();return}if(g===!0)return;let[b,h,x]=w(g);if(b===t)e.pass(v());function k(){if(l.strictSchema===!1){d.logger.warn(E());return}throw Error(E());function E(){return`unknown format "${o}" ignored in schema at path "${c}"`}}function w(E){let O=E instanceof RegExp?ve.regexpCode(E):l.code.formats?ve._`${l.code.formats}${ve.getProperty(o)}`:void 0,I=n.scopeValue("formats",{key:o,ref:E,code:O});if(typeof E=="object"&&!(E instanceof RegExp))return[E.type||"string",E.validate,ve._`${I}.validate`];return["string",E,I]}function v(){if(typeof g=="object"&&!(g instanceof RegExp)&&g.async){if(!u.$async)throw Error("async format in sync schema");return ve._`await ${x}(${r})`}return typeof h=="function"?ve._`${x}(${r})`:ve._`${x}.test(${r})`}}}};HR.default=T9});var Tb=B(function(BR){Object.defineProperty(BR,"__esModule",{value:!0});var J9=WR(),M9=[J9.default];BR.default=M9});var Nb=B(function(UR){Object.defineProperty(UR,"__esModule",{value:!0});UR.contentVocabulary=UR.metadataVocabulary=void 0;UR.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];UR.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var GR=B(function(KR){Object.defineProperty(KR,"__esModule",{value:!0});var L9=jb(),F9=Pb(),V9=Ab(),q9=PR(),H9=MR(),W9=qR(),B9=Tb(),pp=Nb(),U9=[q9.default,L9.default,F9.default,(0,V9.default)(!0),B9.default,pp.metadataVocabulary,pp.contentVocabulary,H9.default,W9.default];KR.default=U9});var QR=B(function(YR){Object.defineProperty(YR,"__esModule",{value:!0});YR.DiscrError=void 0;var XR;(function(e){e.Tag="tag",e.Mapping="mapping"})(XR||(YR.DiscrError=XR={}))});var Jb=B(function(tT){Object.defineProperty(tT,"__esModule",{value:!0});var nr=$e(),Oa=QR(),mp=hc(),K9=ba(),eT=Ce(),G9={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}})=>nr._`{error: ${e}, tag: ${n}, tagValue: ${t}}`},X9={keyword:"discriminator",type:"object",schemaType:"object",error:G9,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 l=t.let("valid",!1),c=t.const("tag",nr._`${n}${nr.getProperty(a)}`);t.if(nr._`typeof ${c} == "string"`,()=>u(),()=>e.error(!1,{discrError:Oa.DiscrError.Tag,tag:c,tagName:a})),e.ok(l);function u(){let m=p();t.if(!1);for(let g in m)t.elseIf(nr._`${c} === ${g}`),t.assign(l,d(m[g]));t.else(),e.error(!1,{discrError:Oa.DiscrError.Mapping,tag:c,tagName:a}),t.endIf()}function d(m){let g=t.name("valid"),b=e.subschema({keyword:"oneOf",schemaProp:m},g);return e.mergeEvaluated(b,nr.Name),g}function p(){var m;let g={},b=x(s),h=!0;for(let v=0;v<i.length;v++){let E=i[v];if((E===null||E===void 0?void 0:E.$ref)&&!eT.schemaHasRulesButRef(E,o.self.RULES)){let I=E.$ref;if(E=mp.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,I),E instanceof mp.SchemaEnv)E=E.schema;if(E===void 0)throw new K9.default(o.opts.uriResolver,o.baseId,I)}let O=(m=E===null||E===void 0?void 0:E.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}"`);h=h&&(b||x(E)),k(O,v)}if(!h)throw Error(`discriminator: "${a}" must be required`);return g;function x({required:v}){return Array.isArray(v)&&v.includes(a)}function k(v,E){if(v.const)w(v.const,E);else if(v.enum)for(let O of v.enum)w(O,E);else throw Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function w(v,E){if(typeof v!="string"||v in g)throw Error(`discriminator: "${a}" values must be unique strings`);g[v]=E}}}};tT.default=X9});var nT=B(function(uie,Z9){Z9.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 rT=B(function(fie,Q9){Q9.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 sT=B(function(die,e4){e4.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 oT=B(function(pie,t4){t4.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 iT=B(function(mie,n4){n4.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 aT=B(function(hie,r4){r4.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 lT=B(function(gie,s4){s4.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 cT=B(function(yie,o4){o4.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 fT=B(function(uT){Object.defineProperty(uT,"__esModule",{value:!0});var i4=nT(),a4=rT(),l4=sT(),c4=oT(),u4=iT(),f4=aT(),d4=lT(),p4=cT(),m4=["/properties"];function h4(e){return[i4,a4,l4,c4,u4,t(this,f4),d4,t(this,p4)].forEach((n)=>this.addMetaSchema(n,void 0,!1)),this;function t(n,r){return e?n.$dataMetaSchema(r,m4):r}}uT.default=h4});var Db=B(function(kn,Ib){Object.defineProperty(kn,"__esModule",{value:!0});kn.MissingRefError=kn.ValidationError=kn.CodeGen=kn.Name=kn.nil=kn.stringify=kn.str=kn._=kn.KeywordCxt=kn.Ajv2020=void 0;var y4=Eb(),x4=GR(),b4=Jb(),$4=fT(),Mb="https://json-schema.org/draft/2020-12/schema";class xc extends y4.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){if(super._addVocabularies(),x4.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(b4.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:t}=this.opts;if(!t)return;$4.default.call(this,e),this.refs["http://json-schema.org/schema"]=Mb}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Mb)?Mb:void 0)}}kn.Ajv2020=xc;Ib.exports=kn=xc;Ib.exports.Ajv2020=xc;Object.defineProperty(kn,"__esModule",{value:!0});kn.default=xc;var S4=ya();Object.defineProperty(kn,"KeywordCxt",{enumerable:!0,get:function(){return S4.KeywordCxt}});var Aa=$e();Object.defineProperty(kn,"_",{enumerable:!0,get:function(){return Aa._}});Object.defineProperty(kn,"str",{enumerable:!0,get:function(){return Aa.str}});Object.defineProperty(kn,"stringify",{enumerable:!0,get:function(){return Aa.stringify}});Object.defineProperty(kn,"nil",{enumerable:!0,get:function(){return Aa.nil}});Object.defineProperty(kn,"Name",{enumerable:!0,get:function(){return Aa.Name}});Object.defineProperty(kn,"CodeGen",{enumerable:!0,get:function(){return Aa.CodeGen}});var w4=pc();Object.defineProperty(kn,"ValidationError",{enumerable:!0,get:function(){return w4.default}});var v4=ba();Object.defineProperty(kn,"MissingRefError",{enumerable:!0,get:function(){return v4.default}})});import{existsSync as gp,readFileSync as mT}from"node:fs";import{createRequire as dT}from"node:module";import{basename as P4,isAbsolute as k4,relative as _4,resolve as Lb}from"node:path";import{fileURLToPath as pT,pathToFileURL as O4}from"node:url";function hp(e){return JSON.parse(mT(e,"utf8"))}async function hT(e){let t=Lb(e),n=Un(t),r=Lb(t,"project.schema.json");if(!gp(n))throw Error(`No project.jxn or project.json in ${t}`);if(!gp(r))throw Error(`project.schema.json not found in ${t} — run \`jx schema\` to generate it from `+"the project file's extensions");let s=du(mT(n,"utf8"),n),o=hp(r);o.$id=O4(r).href;let i;try{({default:i}=await Promise.resolve().then(() => Sr(Db(),1)))}catch(d){throw Error("Project validation requires ajv: bun add ajv",{cause:d})}let l=await new i({allErrors:!0,loadSchema:(d)=>R4(d,t),strict:!1}).compileAsync(o),c=l(s),u=l.errors??null;return{errors:u&&rs(n)?C4(u,s):u,file:P4(n),valid:c}}function A4(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 C4(e,t){return e.map((n)=>{if(!F(n)||!("keyword"in n)||n.keyword!=="type"||!("params"in n)||!F(n.params)||!("type"in n.params)||n.params.type!=="array"||!("instancePath"in n)||!_(n.instancePath))return n;let r=A4(t,n.instancePath),s=pt(r,"",n.instancePath),o=n.instancePath.split("/").at(-1)??"";if(s===null||s.includes(`
640
+ `)||o==="")return n;return{...n,message:`must be a list, written as ${o} { - ${s} }`}})}async function R4(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=pT(e),r=_4(t,n);if(r.startsWith("..")||k4(r))throw Error(`Schema ref "${e}" escapes the project root ${t}`);if(gp(n))return hp(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),l="@jxsuite/schema/",c;try{c=dT(Lb(t,"package.json")).resolve(a)}catch(u){if(!a.startsWith(l))throw Error(`Schema ref "${e}" does not exist and "${a}" is not resolvable from the `+"project — is the package installed?",{cause:u});try{c=dT(import.meta.url).resolve(a)}catch(d){let p=pT(new URL(`../${a.slice(l.length)}`,import.meta.url));if(gp(p))return hp(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 hp(c)}var gT=M(()=>{ae();ru();uu();pu();ko()});function zr(e){return L(e.attributes)?e.attributes:{}}function nn(e,t){let n=zr(e)[t];return _(n)?n:null}function Pt(e){return _(e.tagName)?e.tagName.toLowerCase():""}function fn(e,t="the popover"){let n=_(e.id)?e.id:nn(e,"id");if(n)return`#${n}`;let r=Pt(e);return r===""?t:`the <${r}>`}function J4(e){let t=zr(e).popover;return _(t)?t:null}function xT(e){let t=new Set,n=new Set;for(let r of e){let s=r!==null&&_(r.tagName)?r.tagName:"";if(r===null||!s.includes("-"))continue;if(Fb(r))t.add(s);let o=r.observedAttributes;if(Array.isArray(o)&&M4.every((i)=>o.includes(i)))n.add(s)}return{invokerTags:n,popoverTags:t}}function Fb(e){return"popover"in zr(e)||"popover"in e}function bc(e,t){return Fb(e)||(t?.popoverTags?.has(Pt(e))??!1)}function co(e){if(_(e.id)&&e.id!=="")return e.id;let t=nn(e,"id");return t===""?null:t}function*Ur(e,t=[],n=null,r){yield{enclosing:n,node:e,path:t};let s=bc(e,r)?e:n,{children:o}=e;if(Array.isArray(o)){for(let[l,c]of o.entries())if(F(c))yield*Ur(c,[...t,"children",l],s,r)}else if(L(o)&&Ct(o.map))yield*Ur(o.map,[...t,"children","map"],s,r);let i=Ct(e.map)?e.map:null;if(i)yield*Ur(i,[...t,"map"],s,r);let a=L(e.cases)?e.cases:{};for(let[l,c]of Object.entries(a))if(F(c))yield*Ur(c,[...t,"cases",l],s,r)}function Vb(e,t){let n=[];for(let{node:r}of Ur(e,[],null,t)){if(!bc(r,t))continue;let s=co(r);if(s!==null&&!n.includes(s))n.push(s)}return n}function yp(e){return e.startsWith("@")}function bT(e){return e.startsWith(":")||e.startsWith("&")||e.startsWith(".")||e.startsWith("[")}function un(e,t){let n=e?.[t];if(n===void 0||yo(n)||Array.isArray(n))return null;return String(n)}function $T(e){for(let[t,n]of Object.entries(e??{})){if(!yo(n))continue;if(bT(t)&&t.includes(":popover-open")&&un(n,"display")!==null)return!0;if(yp(t)&&$T(n))return!0}return!1}function ST(e){for(let[t,n]of Object.entries(e??{})){if(!yo(n))continue;if(bT(t)&&t.includes(":popover-open"))return!0;if(yp(t)&&ST(n))return!0}return!1}function D4(e){return I4.some((t)=>un(e,t)!==null)}function L4(e){if(!e)return[];let t=[];for(let[n,r]of Object.entries(e))if(yp(n)&&yo(r)&&un(r,"display")!==null)t.push(n);return t}function wT(e){if(!e)return[];let t=[],n=un(e,"transition");if(n!==null)t.push(n);for(let[r,s]of Object.entries(e))if(yp(r)&&yo(s))t.push(...wT(s));return t}function F4(e){if(!e)return!1;if(un(e,"positionAnchor")!==null||un(e,"position-anchor")!==null)return!0;return["top","left","right","bottom","inset","insetBlockStart","insetInlineStart"].some((t)=>(un(e,t)??"").includes("anchor("))}function V4(e){if(!e)return!1;if(un(e,"positionArea")!==null||un(e,"position-area")!==null||un(e,"positionTryFallbacks")!==null||un(e,"position-try-fallbacks")!==null)return!0;return Object.keys(e).some((t)=>t.startsWith("@supports"))}function vT(e,t){let n=[...Ur(e,[],null,t)],r=Vb(e,t),s=n.some(({node:a})=>bc(a,t)),o=new Set;for(let{node:a}of n)if(yT.has(Pt(a))){let l=nn(a,"popovertarget");if(l!==null)o.add(l)}let i=[];for(let{enclosing:a,node:l,path:c}of n)if(i.push(...q4(l,c,a,r,s,t)),Fb(l))i.push(...H4(l,c,o));return i}function q4(e,t,n,r,s,o){let i=[],a=Pt(e),l=nn(e,"popovertarget"),c=yT.has(a)||(o?.invokerTags?.has(a)??!1);if(l!==null&&!c)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. ${lt}`,fix:"invoker",message:`<${a||"element"}> carries popovertarget, which only <button> and <input> support.`,path:t,rule:"invoker-not-button",severity:"error"}),i;if(l!==null){if(s&&!r.includes(l)){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 "${l}". ${u}A target that names nothing does nothing, silently. ${lt}`,message:`popovertarget="${l}" names no popover in this document.`,path:t,rule:"target-missing",severity:"error"})}else if(n!==null&&co(n)!==null&&co(n)!==l)i.push({detail:`This control is inside ${fn(n)} but targets "${l}". 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. ${lt}`,message:`A control inside ${fn(n)} targets "${l}" instead.`,path:t,rule:"target-mismatch",severity:"warn"})}if(a==="a"&&n!==null&&l===null){let u=nn(e,"href")??(_(e.href)?e.href:null),d=nn(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. ${lt}`,message:`A link inside ${fn(n)} does not dismiss it.`,path:t,rule:"link-does-not-dismiss",severity:"warn"})}}return i}function H4(e,t,n){let r=[],{style:s}=e,o=fn(e),i=J4(e);if(i!==null&&i!==""&&!N4.some((c)=>c===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". ${lt}`,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(Xe(zr(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". ${lt}`,fix:"mode",message:`${o} writes popover as a boolean.`,path:t,rule:"invalid-mode",severity:"error"});let a=un(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. ${lt}`,fix:"display",message:`${o} sets display in its base rule.`,path:t,rule:"base-display",severity:"error"});for(let c of L4(s))r.push({detail:`The same defect as a base \`display\`, arriving through \`${c}\` 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. ${lt}`,fix:"display",message:`${o} sets display inside ${c}.`,path:t,rule:"breakpoint-display",severity:"error"});if(un(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. ${lt}`,fix:"display",message:`${o} also hides itself with visibility.`,path:t,rule:"base-visibility",severity:"warn"});if(!ST(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. ${lt}`,message:`${o} has no :popover-open rule.`,path:t,rule:"no-open-rule",severity:"warn"});else if(!$T(s)&&a===null&&D4(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\`. ${lt}`,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 c of wT(s))if(c.includes("display")&&!c.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. ${lt}`,message:`${o} transitions display but not overlay.`,path:t,rule:"cut-exit",severity:"warn"});break}if(F4(s)&&!V4(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. ${lt}`,message:`${o} is anchor-positioned with no fallback.`,path:t,rule:"unsafe-anchor",severity:"warn"});let l=co(e);if(l!==null&&!n.has(l))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. ${lt}`,message:`${o} has no invoker in this document.`,path:t,rule:"no-invoker",severity:"warn"});return r}var N4,yT,M4,I4,lt="See docs/framework/concepts/overlays.";var xp=M(()=>{ae();N4=["auto","manual","hint"],yT=new Set(["button","input"]);M4=["popovertarget","popovertargetaction","command","commandfor"];I4=["flexDirection","flex-direction","alignItems","align-items","justifyContent","justify-content","flexWrap","flex-wrap","gridTemplateColumns","grid-template-columns","gridTemplateRows","grid-template-rows","gap"]});function Na(e,t){let n=zr(e),r=t in n?n[t]:e[t];if(r===void 0||r===null)return{kind:"absent"};if(pe(r)||L(r))return{kind:"bound"};if(_(r))return r.includes("${")?{kind:"bound"}:{kind:"text",text:r};return{isTrue:r===!0,kind:"other"}}function Ra(e,t){let n=Na(e,t);return n.kind==="text"&&n.text.trim()!==""?n.text:null}function rn(e,t){return Na(e,t).kind!=="absent"}function uo(e){let t=Na(e,"role");if(t.kind==="bound")return Ta;return t.kind==="text"?t.text.trim().toLowerCase().split(/\s+/)[0]:null}function bp(e){let t=Na(e,"id");if(t.kind==="bound")return Ta;return t.kind==="text"&&t.text!==""?t.text:null}function rr(e,t){let n=Na(e,t);return n.kind==="bound"||n.kind==="text"&&n.text.trim()!==""}function $p(e){let t=e.textContent;if(_(t)){if(t.trim()!=="")return!0}else if(t!==void 0&&t!==null)return!0;if(rr(e,"aria-label")||rn(e,"aria-labelledby"))return!0;if(Pt(e)==="img"&&(rr(e,"alt")||rr(e,"title")))return!0;if(Pt(e)==="slot")return!0;let{children:n}=e;if(Array.isArray(n)){for(let s of n)if(_(s)){if(s.trim()!=="")return!0}else if(F(s)&&$p(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)=>Ct(s)&&$p(s))}function*Ca(e,t=[],n=[],r=[]){yield{node:e,path:t,roles:n,tags:r};let s=[...n,uo(e)],o=[...r,Pt(e)],{children:i}=e;if(Array.isArray(i)){for(let[a,l]of i.entries())if(F(l))yield*Ca(l,[...t,"children",a],s,o)}else if(L(i)&&Ct(i.map))yield*Ca(i.map,[...t,"children","map"],s,o);if(Ct(e.map))yield*Ca(e.map,[...t,"map"],s,o);if(L(e.cases)){for(let[a,l]of Object.entries(e.cases))if(F(l))yield*Ca(l,[...t,"cases",a],s,o)}}function G4(e){return e.some((t)=>t.includes("-"))}function Kr(e,t,n,r,s,o="error"){return{criterion:s,detail:`${r} ${W4}`,message:n,path:t,rule:e,severity:o}}function ET(e,t,n){if(n.includes("label"))return!0;if(e===Ta||t.bound)return!0;return e!==null&&t.ids.has(e)}function X4(e,t){let{node:n,path:r,tags:s}=e,o=Pt(n),i=uo(n);if(i==="bound")return null;if(rr(n,"aria-label")||rn(n,"aria-labelledby")||rr(n,"title"))return null;let l=fn(n,"the control"),c=(d)=>Kr("interactive-unnamed",r,`${l} 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=Y4(n,o,t,s);if(u==="named"||u==="exempt")return null;if(i!==null&&B4.has(i))return $p(n)?null:c("Give it text content, or an aria-label.");if(i!==null&&U4.has(i))return c("Give it an aria-label, or aria-labelledby naming its visible label.");if(i!==null)return null;if(o==="button"||o==="summary"||o==="a"&&rn(n,"href"))return $p(n)?null:c("Give it text content, or an aria-label.");if(u==="unnamed")return c("Give it a <label for> naming its id, or an aria-label.");if(u==="unnamed-value")return c("Give it a value, or an aria-label.");if(u==="unnamed-alt")return c("Give it an alt, or an aria-label.");return null}function Y4(e,t,n,r){if(t==="area"){if(!rn(e,"href"))return"none";return rr(e,"alt")?"named":"unnamed-alt"}if(t==="select"||t==="textarea")return ET(bp(e),n,r)||rr(e,"placeholder")?"named":"unnamed";if(t!=="input")return"none";let s=(Ra(e,"type")??"text").toLowerCase();if(s==="hidden"||rn(e,"type")&&Ra(e,"type")===null)return"exempt";if(z4.has(s))return rr(e,"value")?"named":"unnamed-value";if(s==="image")return rr(e,"alt")?"named":"unnamed-alt";return ET(bp(e),n,r)||rr(e,"placeholder")?"named":"unnamed"}function Q4(e){let{node:t,path:n,tags:r}=e,s=Pt(t);if(!s.includes("-")||!r.some((o)=>Z4.has(o)))return null;return Kr("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 e3(e){let{node:t,path:n}=e;if(Pt(t)!=="img")return null;let r=uo(t);if(r==="bound"||r==="presentation"||r==="none")return null;if(rn(t,"alt")||rr(t,"aria-label")||rn(t,"aria-labelledby"))return null;return Kr("img-alt-missing",n,`${fn(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 n3(e,t){let{node:n,path:r}=e,s=[];for(let o of t3){let i=Ra(n,o);if(i===null)continue;for(let a of i.split(/\s+/))if(a!==""&&!t.has(a))s.push(Kr("aria-target-missing",r,`${fn(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 r3(e,t,n){for(let r of jT.get(t)??[]){let s=n.get(r);if(s===void 0)continue;if(s.bound)return!0;if(e===Ta&&s.ids.size>0)return!0;if(e!==null&&e!==Ta&&s.ids.has(e))return!0}return!1}function s3(e,t){let{node:n,path:r,roles:s,tags:o}=e,i=uo(n);if(i===null||i==="bound"||r.length===0||G4(o))return null;if(s.includes("bound")||r3(bp(n),i,t))return null;let a=fn(n,"the element");if(i==="tab"&&!s.includes("tablist"))return Kr("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 Kr("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 Kr("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 o3(e){let t=[];for(let{node:n}of Ca(e)){if(uo(n)!=="tab")continue;let r=Na(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 i3(e){let{node:t,path:n}=e;if(uo(t)!=="tablist")return null;let r=o3(t);if(r===null||r.length===0||r.includes(!0))return null;return Kr("tablist-none-selected",n,`${fn(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 a3(e){let{node:t,path:n}=e,r=uo(t);if(!(Pt(t)==="dialog"||r==="dialog"||r==="alertdialog")||r==="bound")return null;if(rr(t,"aria-label")||rn(t,"aria-labelledby"))return null;return Kr("dialog-unnamed",n,`${fn(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 c3(e){let{node:t,path:n}=e;if(!rn(t,"aria-activedescendant"))return null;let r=Pt(t);if(l3.has(r)||r==="a"&&rn(t,"href")||rn(t,"tabIndex")||rn(t,"tabindex")||rn(t,"contenteditable"))return null;return Kr("activedescendant-not-focusable",n,`${fn(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 PT(e){let t=[...Ca(e)],n=new Set,r={bound:!1,ids:new Set},s=new Map,o=!1;for(let{node:a}of t){let l=uo(a);if(l!==null&&K4.has(l)){let u=s.get(l)??{bound:!1,ids:new Set},d=Ra(a,"aria-owns");if(d===null)u.bound||=rn(a,"aria-owns");else for(let p of d.split(/\s+/))if(p!=="")u.ids.add(p);s.set(l,u)}let c=bp(a);if(c===Ta)o=!0;else if(c!==null)n.add(c);if(Pt(a)==="label"){let u=Ra(a,"for")??Ra(a,"htmlFor");if(u===null)r.bound||=rn(a,"for")||rn(a,"htmlFor");else r.ids.add(u)}}let i=[];for(let a of t){let l=[X4(a,r),e3(a),s3(a,s),Q4(a),i3(a),a3(a),c3(a)];for(let c of l)if(c)i.push(c);if(!o)i.push(...n3(a,n))}return i}var W4="See docs/framework/concepts/accessibility.",Ta="bound",B4,U4,z4,jT,K4,Z4,t3,l3;var kT=M(()=>{ae();xp();B4=new Set(["button","checkbox","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","switch","tab","treeitem"]),U4=new Set(["combobox","listbox","searchbox","slider","spinbutton","textbox"]),z4=new Set(["button","reset","submit"]),jT=new Map([["menuitem",["menu","menubar"]],["menuitemcheckbox",["menu","menubar"]],["menuitemradio",["menu","menubar"]],["option",["listbox"]],["tab",["tablist"]]]),K4=new Set([...jT.values()].flat());Z4=new Set(["select","jx-select"]);t3=["aria-activedescendant","aria-controls","aria-describedby","aria-details","aria-errormessage","aria-flowto","aria-labelledby","aria-owns"];l3=new Set(["button","input","select","textarea"])});function qb(e){return Pt(e)==="dialog"}function _T(e){return e.startsWith("--")}function g3(e){let t=[];for(let{node:n}of Ur(e)){let r=co(n);if(qb(n)&&r!==null&&!t.includes(r))t.push(r)}return t}function y3(e){let t=e.oncommand;return t!==void 0&&t!==null}function x3(e,t){for(let{node:n}of Ur(e)){if(n===e)continue;let r=Pt(n);if(r==="button"){let s=nn(n,"command"),o=nn(n,"commandfor");if(s!==null&&(s==="close"||s==="request-close")&&(o===null||o===t))return!0}if(r==="form"&&nn(n,"method")?.toLowerCase()==="dialog")return!0}return!1}function AT(e,t){let n=[...Ur(e,[],null,t)],r=g3(e),s=Vb(e,t),o=r.length>0||s.length>0,i=new Map,a=new Map;for(let{node:c}of n){let u=co(c);if(u!==null&&!i.has(u))i.set(u,c);if(Pt(c)==="button"){let d=nn(c,"commandfor"),p=nn(c,"command");if(d!==null){let m=a.get(d)??new Set;m.add(p??""),a.set(d,m)}}}let l=[];for(let{node:c,path:u}of n)if(l.push(...b3(c,u,i,r,s,o,t)),qb(c))l.push(...$3(c,u,a));return l}function b3(e,t,n,r,s,o,i){let a=[],l=Pt(e),c=i?.invokerTags?.has(l)??!1,u=nn(e,"command"),d=nn(e,"commandfor");if(!(u!==null||d!==null||("command"in zr(e))||("commandfor"in zr(e))))return a;let m=fn(e,"the element");if(!h3.has(l)&&!c)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. ${lt}`,fix:"invoker",message:`<${l||"element"}> carries command/commandfor, which only <button> supports.`,path:t,rule:"invoker-not-button",severity:"error"}),a;if(u!==null&&!p3.has(u)&&!_T(u))return a.push({detail:`\`command\` is an enumerated attribute taking ${OT.map((g)=>`\`${g}\``).join(", ")}, or a custom command starting with \`--\`. Anything else is the invalid-value state, and a button in that state does nothing when clicked. ${lt}`,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 g=n.get(d),b=r.includes(d),h=s.includes(d);if(!g&&o){let x=[...r,...s].map((k)=>`"${k}"`).join(", ");return a.push({detail:`No element in this document has the id "${d}". The dialogs and popovers here are: ${x}. A commandfor that names nothing does nothing, silently. ${lt}`,message:`commandfor="${d}" names nothing in this document.`,path:t,rule:"command-target-missing",severity:"error"}),a}if(u!==null&&g){if(u3.has(u)&&!qb(g))a.push({detail:`\`${u}\` acts on a <dialog>, and "${d}" is ${h?"a popover":`a <${Pt(g)||"element"}>`}. The click is ignored. ${h?"Use `toggle-popover`, `show-popover` or `hide-popover` for a popover.":"Point it at a dialog, or make the target one."} ${lt}`,message:`${m} sends ${u} to "${d}", which is not a dialog.`,path:t,rule:"command-target-mismatch",severity:"error"});else if(f3.has(u)&&!bc(g,i))a.push({detail:`\`${u}\` acts on a popover, and "${d}" is ${b?"a dialog":`a <${Pt(g)||"element"}>`} that declares no \`popover\`. The click is ignored. ${b?"Use `show-modal`, `close` or `request-close` for a dialog.":"Give the target a `popover` attribute, or point the button elsewhere."} ${lt}`,message:`${m} sends ${u} to "${d}", which is not a popover.`,path:t,rule:"command-target-mismatch",severity:"error"});else if(_T(u)&&!y3(g))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. ${lt}`,message:`${m} sends ${u} to "${d}", which handles no command.`,path:t,rule:"custom-command-unhandled",severity:"warn"})}}return a}function $3(e,t,n){let r=[],s=fn(e,"the dialog"),o=co(e),{style:i}=e,a=nn(e,"closedby");if(a!==null&&!m3.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. ${lt}`,message:`${s} declares closedby="${a}", which is not any, closerequest or none.`,path:t,rule:"dialog-closedby-invalid",severity:"error"});if(un(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. ${lt}`,fix:"display",message:`${s} sets display in its base rule.`,path:t,rule:"dialog-display",severity:"error"});let l=o===null?void 0:n.get(o),c=nn(e,"open")!==null||zr(e).open===!0||e.open===!0;if(o!==null&&!l?.has("show-modal")&&!c)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. ${lt}`,message:`${s} has no invoker in this document.`,path:t,rule:"dialog-no-invoker",severity:"warn"});if(l?.has("show-modal")&&a==="none"&&!x3(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"\`. ${lt}`,message:`${s} opens modally, closes on nothing, and has no close button.`,path:t,rule:"modal-without-close",severity:"error"});return r}var OT,u3,f3,d3,p3,m3,h3;var CT=M(()=>{ae();xp();OT=["toggle-popover","show-popover","hide-popover","show-modal","close","request-close"],u3=new Set(["show-modal","close","request-close"]),f3=new Set(["toggle-popover","show-popover","hide-popover"]),d3=["any","closerequest","none"],p3=new Set(OT),m3=new Set(d3),h3=new Set(["button"])});var VT=B(function(LT){Object.defineProperty(LT,"__esModule",{value:!0});LT.formatNames=LT.fastFormats=LT.fullFormats=void 0;function Gr(e,t){return{validate:e,compare:t}}LT.fullFormats={date:Gr(JT,Ub),time:Gr(Wb(!0),zb),"date-time":Gr(RT(!0),IT),"iso-time":Gr(Wb(),MT),"iso-date-time":Gr(RT(),DT),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:P3,"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:T3,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:k3,int32:{type:"number",validate:A3},int64:{type:"number",validate:C3},float:{type:"number",validate:NT},double:{type:"number",validate:NT},password:!0,binary:!0};LT.fastFormats={...LT.fullFormats,date:Gr(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Ub),time:Gr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,zb),"date-time":Gr(/^\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,IT),"iso-time":Gr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,MT),"iso-date-time":Gr(/^\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,DT),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};LT.formatNames=Object.keys(LT.fullFormats);function S3(e){return e%4===0&&(e%100!==0||e%400===0)}var w3=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,v3=[0,31,28,31,30,31,30,31,31,30,31,30,31];function JT(e){let t=w3.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&&S3(n)?29:v3[r])}function Ub(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var Hb=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Wb(e){return function(n){let r=Hb.exec(n);if(!r)return!1;let s=+r[1],o=+r[2],i=+r[3],a=r[4],l=r[5]==="-"?-1:1,c=+(r[6]||0),u=+(r[7]||0);if(c>23||u>59||e&&!a)return!1;if(s<=23&&o<=59&&i<60)return!0;let d=o-u*l,p=s-c*l-(d<0?1:0);return(p===23||p===-1)&&(d===59||d===-1)&&i<61}}function zb(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 MT(e,t){if(!(e&&t))return;let n=Hb.exec(e),r=Hb.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 Bb=/t|\s/i;function RT(e){let t=Wb(e);return function(r){let s=r.split(Bb);return s.length===2&&JT(s[0])&&t(s[1])}}function IT(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 DT(e,t){if(!(e&&t))return;let[n,r]=e.split(Bb),[s,o]=t.split(Bb),i=Ub(n,s);if(i===void 0)return;return i||zb(r,o)}var E3=/\/|:/,j3=/^(?:[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 P3(e){return E3.test(e)&&j3.test(e)}var TT=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function k3(e){return TT.lastIndex=0,TT.test(e)}var _3=-2147483648,O3=2147483647;function A3(e){return Number.isInteger(e)&&e<=O3&&e>=_3}function C3(e){return Number.isInteger(e)}function NT(){return!0}var R3=/[^\\]\\Z/;function T3(e){if(R3.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var HT=B(function(qT){Object.defineProperty(qT,"__esModule",{value:!0});var J3=jb(),M3=Pb(),I3=Ab(),D3=Tb(),Sp=Nb(),L3=[J3.default,M3.default,(0,I3.default)(),D3.default,Sp.metadataVocabulary,Sp.contentVocabulary];qT.default=L3});var WT=B(function(zie,V3){V3.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 UT=B(function(_n,Gb){Object.defineProperty(_n,"__esModule",{value:!0});_n.MissingRefError=_n.ValidationError=_n.CodeGen=_n.Name=_n.nil=_n.stringify=_n.str=_n._=_n.KeywordCxt=_n.Ajv=void 0;var q3=Eb(),H3=HT(),W3=Jb(),BT=WT(),B3=["/properties"],wp="http://json-schema.org/draft-07/schema";class $c extends q3.default{_addVocabularies(){if(super._addVocabularies(),H3.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(W3.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(BT,B3):BT;this.addMetaSchema(e,wp,!1),this.refs["http://json-schema.org/schema"]=wp}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(wp)?wp:void 0)}}_n.Ajv=$c;Gb.exports=_n=$c;Gb.exports.Ajv=$c;Object.defineProperty(_n,"__esModule",{value:!0});_n.default=$c;var U3=ya();Object.defineProperty(_n,"KeywordCxt",{enumerable:!0,get:function(){return U3.KeywordCxt}});var Ja=$e();Object.defineProperty(_n,"_",{enumerable:!0,get:function(){return Ja._}});Object.defineProperty(_n,"str",{enumerable:!0,get:function(){return Ja.str}});Object.defineProperty(_n,"stringify",{enumerable:!0,get:function(){return Ja.stringify}});Object.defineProperty(_n,"nil",{enumerable:!0,get:function(){return Ja.nil}});Object.defineProperty(_n,"Name",{enumerable:!0,get:function(){return Ja.Name}});Object.defineProperty(_n,"CodeGen",{enumerable:!0,get:function(){return Ja.CodeGen}});var z3=pc();Object.defineProperty(_n,"ValidationError",{enumerable:!0,get:function(){return z3.default}});var K3=ba();Object.defineProperty(_n,"MissingRefError",{enumerable:!0,get:function(){return K3.default}})});var GT=B(function(KT){Object.defineProperty(KT,"__esModule",{value:!0});KT.formatLimitDefinition=void 0;var zT=UT(),wt=$e(),fo=wt.operators,vp={formatMaximum:{okStr:"<=",ok:fo.LTE,fail:fo.GT},formatMinimum:{okStr:">=",ok:fo.GTE,fail:fo.LT},formatExclusiveMaximum:{okStr:"<",ok:fo.LT,fail:fo.GTE},formatExclusiveMinimum:{okStr:">",ok:fo.GT,fail:fo.LTE}},Y3={message:({keyword:e,schemaCode:t})=>wt.str`should be ${vp[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>wt._`{comparison: ${vp[e].okStr}, limit: ${t}}`};KT.formatLimitDefinition={keyword:Object.keys(vp),type:"string",schemaType:"string",$data:!0,error:Y3,code(e){let{gen:t,data:n,schemaCode:r,keyword:s,it:o}=e,{opts:i,self:a}=o;if(!i.validateFormats)return;let l=new zT.KeywordCxt(o,a.RULES.all.format.definition,"format");if(l.$data)c();else u();function c(){let p=t.scopeValue("formats",{ref:a.formats,code:i.code.formats}),m=t.const("fmt",wt._`${p}[${l.schemaCode}]`);e.fail$data(wt.or(wt._`typeof ${m} != "object"`,wt._`${m} instanceof RegExp`,wt._`typeof ${m}.compare != "function"`,d(m)))}function u(){let p=l.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 g=t.scopeValue("formats",{key:p,ref:m,code:i.code.formats?wt._`${i.code.formats}${wt.getProperty(p)}`:void 0});e.fail$data(d(g))}function d(p){return wt._`${p}.compare(${n}, ${r}) ${vp[s].fail} 0`}},dependencies:["format"]};var Z3=(e)=>(e.addKeyword(KT.formatLimitDefinition),e);KT.default=Z3});var QT=B(function(Sc,ZT){Object.defineProperty(Sc,"__esModule",{value:!0});var sr=VT(),e6=GT(),Ma=$e(),XT=new Ma.Name("fullFormats"),t6=new Ma.Name("fastFormats"),Yb=(e,t={keywords:!0})=>{if(Array.isArray(t))return YT(e,t,sr.fullFormats,XT),e;let[n,r]=t.mode==="fast"?[sr.fastFormats,t6]:[sr.fullFormats,XT],s=t.formats||sr.formatNames;if(YT(e,s,n,r),t.keywords)(0,e6.default)(e);return e};Yb.get=(e,t="full")=>{let r=(t==="fast"?sr.fastFormats:sr.fullFormats)[e];if(!r)throw Error(`Unknown format "${e}"`);return r};function YT(e,t,n,r){var s,o;(s=(o=e.opts.code).formats)!==null&&s!==void 0||(o.formats=Ma._`require("ajv-formats/dist/formats").${r}`);for(let i of t)e.addFormat(i,n[i])}ZT.exports=Sc=Yb;Object.defineProperty(Sc,"__esModule",{value:!0});Sc.default=Yb});import{existsSync as nN,readFileSync as Qb,readdirSync as rN,statSync as sN}from"node:fs";import{createRequire as n6}from"node:module";import{join as oN,relative as Qo,resolve as Zb}from"node:path";async function i6(){try{let{default:e}=await Promise.resolve().then(() => Sr(Db(),1)),{default:t}=await Promise.resolve().then(() => Sr(QT(),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 iN(e,t={}){let n=Zb(e),r=[],s=[],o=0;for(let v of["project.schema.json","document.schema.json"]){let E=Zb(n,v);if(!nN(E))continue;o+=1;let O=wc(E),I=f6(O);if(I.length>0)r.push({errors:I.map(({reason:D,ref:V})=>({message:`$ref "${V}" ${D} — 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 hT(n);if(o+=1,!i.valid)r.push({errors:i.errors??[],file:i.file});let a=a6(n);if(a!==void 0){let v=Lx({$defs:a}).map(({at:E,ref:O})=>({instancePath:E,message:`type reference "${O}" names no definition in project.json's $defs`}));if(v.length>0){let E=r.find((O)=>O.file===i.file);if(E===void 0)r.push({errors:v,file:i.file});else E.errors.push(...v)}}let{addFormats:l,Ajv:c}=await i6(),{document:u}=await pk(n,{write:!1}),d=new c({allErrors:!0,ownProperties:!0,strict:!1});l(d);let p=d.compile(u),m=xT(tN(n).flatMap((v)=>{try{return[JSON.parse(Qb(v,"utf8"))]}catch{return[]}}));for(let v of r6)for(let E of lN(Zb(n,v))){if(E.endsWith(".class.json"))continue;o+=1;let O=l6(E,Qo(n,E));if(s.push(...O.warnings),O.failure!==null){r.push(O.failure);continue}let I=O.document,D=eN(I,Qo(n,E));if(s.push(...D.warnings),D.failure!==null){r.push(D.failure);continue}if(p(I)){let V=I;s.push(...u6(V,Qo(n,E),m));let W=Lx(V,a);if(W.length>0)r.push({errors:W.map(({at:A,ref:J})=>({instancePath:A,message:`type reference "${J}" names no definition in this document's $defs or in project.json's $defs`})),file:Qo(n,E)})}else r.push({errors:p.errors??[],file:Qo(n,E)})}let g=new c({allErrors:!0,ownProperties:!0,strict:!1});l(g);let b=g.compile(Mx());for(let v of tN(n)){o+=1;let E=wc(v),O=eN(E,Qo(n,v));if(s.push(...O.warnings),O.failure!==null)r.push(O.failure);else if(!b(E))r.push({errors:b.errors??[],file:Qo(n,v)})}let{config:h}=as(n),x=await Rs(n,h),k=n6(import.meta.url);for(let v of x.extensions)for(let E of["project","document","fields"]){let O=v.schemas[E];if(!O)continue;o+=1;let I=new c({allErrors:!0,ownProperties:!0,strict:!1});l(I);for(let D of o6){let V=k.resolve(D);I.addSchema(wc(V))}try{I.compile(wc(O))}catch(D){r.push({errors:[{message:D instanceof Error?D.message:String(D)}],file:`${v.specifier} (${E} fragment)`})}}let w=t.strict===!0&&s.some((v)=>v.severity==="error");return{checked:o,issues:r,lint:s,valid:r.length===0&&!w}}function a6(e){try{let t=as(e).config.$defs;return L(t)?t:void 0}catch{return}}function l6(e,t){if(!rs(e))return{document:wc(e),failure:null,warnings:[]};let n=Qb(e,"utf8"),r=rm(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:c6(n),failure:null,warnings:r}}catch(s){return{document:null,failure:{errors:[{message:ye(s)}],file:t},warnings:r}}}function eN(e,t){let n=[];try{yl(e,t,n)}catch(s){return{failure:{errors:[{message:ye(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 c6(e){let t=Po(e);return L(t)?t:null}function wc(e){return JSON.parse(Qb(e,"utf8"))}function u6(e,t,n){let r=[];for(let s of vT(e,n))r.push({...Ep(s),file:t,source:"popover"});for(let s of AT(e,n))r.push({...Ep(s),file:t,source:"dialog"});for(let s of PT(e))r.push({...Ep(s),criterion:s.criterion,file:t,source:"accessibility"});for(let s of Gv(e))r.push({...Ep({...s,severity:"info"}),file:t,source:"module"});return r}function Ep(e){return{detail:e.detail,message:e.message,path:e.path,rule:e.rule,severity:e.severity}}function aN(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 f6(e){let t=[],n=new Set,r=(o)=>{let i=e;for(let a of o.slice(1).split("/")){if(a==="")continue;let l=a.replaceAll("~1","/").replaceAll("~0","~");if(!F(i))return!1;if(i=i[l],i===void 0)return!1}return!0},s=(o)=>{if(!L(o)||n.has(o))return;n.add(o);let i=o.$ref;if(_(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,l]of Object.entries(o)){if(!Dx.has(a))continue;if(Array.isArray(l))for(let c of l)s(c);else if(L(l)){if(s(l),$d.has(a))for(let c of Object.values(l))s(c)}}};return s(e),t}function lN(e){if(!nN(e))return[];let t=[];for(let n of rN(e)){let r=oN(e,n);if(sN(r).isDirectory())t.push(...lN(r));else if(Bn(n))t.push(r)}return t.toSorted()}function tN(e){let t=[],n=(r)=>{for(let s of rN(r)){if(s6.has(s))continue;let o=oN(r,s);if(sN(o).isDirectory())n(o);else if(s.endsWith(".class.json"))t.push(o)}};return n(e),t.toSorted()}function cN(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 r6,s6,o6;var uN=M(()=>{os();Ft();Gu();Mk();Lk();gT();kT();CT();Fi();xp();ae();is();ji();Nx();r6=["components","pages","layouts"],s6=new Set(["node_modules","dist",".git"]),o6=["@jxsuite/schema/schemas/project.core.schema.json","@jxsuite/schema/schemas/project.fields.schema.json","@jxsuite/schema/schemas/document.paths.schema.json"]});Ft();import{relative as e$,resolve as fN}from"node:path";async function d6(){let e=process.argv.slice(2),[t]=e;if(!t||t==="--help"||t==="-h")console.log(`Usage: jx <command> [options]
638
641
 
639
642
  Commands:
640
643
  build [root] Build a Jx site to dist/
@@ -658,8 +661,8 @@ Options:
658
661
  --strict validate: fail on an overlay or accessibility lint error, not only a schema error
659
662
  --to <format> convert: jxn or json
660
663
  --drop-comments convert: convert a .jxn file to .json even though it has comments
661
- --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(() => n$());t$(process.cwd(),e.slice(1))}else{await Promise.resolve().then(() => s$());r$(process.cwd(),e.slice(1))}}catch(d){console.error(be(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,l;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)l=m}else if(p.startsWith("--"))o.add(p);else i.push(p)}let[c]=i,u=RN(c??".");if(n){if(r!=="push")console.error(`Unknown db subcommand: ${r??"(none)"}
662
- Usage: jx db push [root] [--dry-run] [--connection <name>]`),process.exit(1);let d=o.has("--dry-run");try{await Promise.resolve().then(() => MS());let m={dryRun:d};if(a!==void 0)m.connection=a;let{results:y,bindingsPatched:S,wranglerPath:g}=await JS(u,m);for(let x of y){let P=x.applied?"applied":"dry-run";console.log(`${x.connection} (${x.provider}) — ${x.tables.length} table(s), ${x.statements.length} statement(s) [${P}]`);for(let w of x.statements)console.log(` ${w}`);for(let w of x.warnings)console.warn(` warning: ${w}`)}if(S&&g)console.log(`Updated bindings in ${Rb(u,g)}`)}catch(p){console.error(`db push failed: ${be(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(() => xP());await Promise.resolve().then(() => bi());let g=!o.has("--no-optimize-images")&&!RS(process.env.JX_IMAGES_OPTIMIZE),x=await fP(u,{clean:p,includeHeld:m,optimizeImages:g,verbose:d});if(x.errors.length>0){console.error(`
663
- Build completed with ${x.errors.length} error(s):`);for(let P of x.errors)console.error(` - ${P}`);process.exit(1)}console.log(`
664
- Done: ${x.routes} routes → ${x.files} files`)}catch(y){console.error(`Build failed: ${be(y)}`),process.exit(1)}}else if(t==="dev")try{await Promise.resolve().then(() => $P());bP(u,l)}catch(d){console.error(be(d)),process.exit(1)}else if(t==="preview"){let{existsSync:d}=await import("node:fs"),p=RN(u,"dist");if(!d(p))console.error(`No build output at ${p} — run \`jx build\` first.`),process.exit(1);await Promise.resolve().then(() => EP());let y=l??4173;vP(p,y),console.log(`Previewing ${p} at http://localhost:${y}`)}else if(t==="schema")try{await Promise.resolve().then(() => hx());let{projectSchemaPath:p,documentSchemaPath:m}=await JP(u);console.log(`Wrote ${Rb(u,p)}`),console.log(`Wrote ${Rb(u,m)}`)}catch(d){console.error(`Schema generation failed: ${be(d)}`),process.exit(1)}else if(t==="validate")try{await Promise.resolve().then(() => CN());let y=await PN(u,{strict:o.has("--strict")}),S=_N(y);if(y.valid){console.log(`Project is valid (${y.checked} files checked in ${u})`);for(let g of S)console.log(g)}else{console.error(`Project is INVALID (${u}):`);for(let g of[...AN(y),...S])console.error(g);process.exit(1)}}catch(d){console.error(`Validation failed: ${be(d)}`),process.exit(1)}else console.error(`Unknown command: ${t}
665
- Run "jx --help" for usage.`),process.exit(1)}var Qoe=m3();export{Qoe as ready};
664
+ --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(() => E$());v$(process.cwd(),e.slice(1))}else{await Promise.resolve().then(() => P$());j$(process.cwd(),e.slice(1))}}catch(d){console.error(ye(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,l;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)l=m}else if(p.startsWith("--"))o.add(p);else i.push(p)}let[c]=i,u=fN(c??".");if(n){if(r!=="push")console.error(`Unknown db subcommand: ${r??"(none)"}
665
+ Usage: jx db push [root] [--dry-run] [--connection <name>]`),process.exit(1);let d=o.has("--dry-run");try{await Promise.resolve().then(() => uw());let m={dryRun:d};if(a!==void 0)m.connection=a;let{results:g,bindingsPatched:b,wranglerPath:h}=await cw(u,m);for(let x of g){let k=x.applied?"applied":"dry-run";console.log(`${x.connection} (${x.provider}) — ${x.tables.length} table(s), ${x.statements.length} statement(s) [${k}]`);for(let w of x.statements)console.log(` ${w}`);for(let w of x.warnings)console.warn(` warning: ${w}`)}if(b&&h)console.log(`Updated bindings in ${e$(u,h)}`)}catch(p){console.error(`db push failed: ${ye(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(() => GP());await Promise.resolve().then(() => ji());let h=!o.has("--no-optimize-images")&&!iw(process.env.JX_IMAGES_OPTIMIZE),x=await qP(u,{clean:p,includeHeld:m,optimizeImages:h,verbose:d});if(x.errors.length>0){console.error(`
666
+ Build completed with ${x.errors.length} error(s):`);for(let k of x.errors)console.error(` - ${k}`);process.exit(1)}console.log(`
667
+ Done: ${x.routes} routes → ${x.files} files`)}catch(g){console.error(`Build failed: ${ye(g)}`),process.exit(1)}}else if(t==="dev")try{await Promise.resolve().then(() => YP());XP(u,l)}catch(d){console.error(ye(d)),process.exit(1)}else if(t==="preview"){let{existsSync:d}=await import("node:fs"),p=fN(u,"dist");if(!d(p))console.error(`No build output at ${p} — run \`jx build\` first.`),process.exit(1);await Promise.resolve().then(() => tk());let g=l??4173;ek(p,g),console.log(`Previewing ${p} at http://localhost:${g}`)}else if(t==="schema")try{await Promise.resolve().then(() => Nx());let{projectSchemaPath:p,documentSchemaPath:m}=await dk(u);console.log(`Wrote ${e$(u,p)}`),console.log(`Wrote ${e$(u,m)}`)}catch(d){console.error(`Schema generation failed: ${ye(d)}`),process.exit(1)}else if(t==="validate")try{await Promise.resolve().then(() => uN());let g=await iN(u,{strict:o.has("--strict")}),b=aN(g);if(g.valid){console.log(`Project is valid (${g.checked} files checked in ${u})`);for(let h of b)console.log(h)}else{console.error(`Project is INVALID (${u}):`);for(let h of[...cN(g),...b])console.error(h);process.exit(1)}}catch(d){console.error(`Validation failed: ${ye(d)}`),process.exit(1)}else console.error(`Unknown command: ${t}
668
+ Run "jx --help" for usage.`),process.exit(1)}var vae=d6();export{vae as ready};