@jxsuite/compiler 8.5.0 → 8.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -1,69 +1,69 @@
1
1
  #!/usr/bin/env node
2
- import{createRequire as IN}from"node:module";var AN=Object.create;var{getPrototypeOf:RN,defineProperty:Vy,getOwnPropertyNames:ON}=Object;var Wy=Object.prototype.hasOwnProperty;function CN(e){return this[e]}var NN,TN,br=(e,t,r)=>{var n=e!=null&&typeof e==="object";if(n){var s=t?NN??=new WeakMap:TN??=new WeakMap,i=s.get(e);if(i)return i}r=e!=null?AN(RN(e)):{};let o=t||!e||!e.__esModule||!Wy.call(e,"default")?Vy(r,"default",{value:e,enumerable:!0}):r;if(e&&typeof e==="object"||typeof e==="function"){for(let a of ON(e))if(!Wy.call(o,a))Vy(o,a,{get:CN.bind(e,a),enumerable:!0})}if(n)s.set(e,o);return o};var N=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var D=(e,t,r)=>()=>{if(e)try{t=e(e=0)}catch(n){r=[n]}if(r)throw r[0];return t};var He=IN(import.meta.url);function O(e){return typeof e==="string"}function Nt(e){return typeof e==="number"}function Qt(e){return typeof e==="boolean"}function Wt(e){return typeof e==="function"}function V(e){return typeof e==="object"&&e!==null}function W(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Be(e){return W(e)&&typeof e.$ref==="string"}function Mr(e){return W(e)&&e.$prototype==="Function"}function Dr(e){return W(e)&&W(e.$expression)}function Ri(e){return Dr(e)&&Array.isArray(e.parameters)&&e.parameters.length>0}function Is(e){return Mr(e)&&Array.isArray(e.body)}function vn(e){return W(e)&&typeof e.$prototype==="string"&&e.$prototype!=="Function"}function as(e){return W(e)&&e.timing==="server"&&typeof e.$src==="string"&&typeof e.$export==="string"&&!e.$prototype}function By(e){return W(e)&&!e.$prototype&&!e.$expression&&"default"in e}function Js(e){if(!W(e))return!1;for(let t of Object.keys(e))if(!Hy.has(t))return!1;return!0}function dt(e){return W(e)&&e.$prototype==="Array"}function Hd(e){return(Array.isArray(e)?e:[e]).some((r)=>dt(r))}function Uy(e){return W(e)&&e.$prototype==="Class"}function xr(e){return W(e)}function be(e){return typeof e==="string"&&e.includes("${")}function Oi(e){return/\breturn\b[^\S\n]*(?![;}\s]|$)/.test(Ci(e))}function Ci(e){if(!/[/'"`]/u.test(e))return e;let t=Ec.get(e);if(t!==void 0)return t;let r=MN(e);if(Ec.size>=JN)Ec.clear();return Ec.set(e,r),r}function MN(e){let t=e.split(""),r=(o)=>{if(t[o]!==void 0&&t[o]!==`
2
+ import{createRequire as bT}from"node:module";var dT=Object.create;var{getPrototypeOf:pT,defineProperty:ub,getOwnPropertyNames:mT}=Object;var fb=Object.prototype.hasOwnProperty;function hT(e){return this[e]}var gT,yT,xr=(e,t,r)=>{var n=e!=null&&typeof e==="object";if(n){var s=t?gT??=new WeakMap:yT??=new WeakMap,i=s.get(e);if(i)return i}r=e!=null?dT(pT(e)):{};let o=t||!e||!e.__esModule||!fb.call(e,"default")?ub(r,"default",{value:e,enumerable:!0}):r;if(e&&typeof e==="object"||typeof e==="function"){for(let a of mT(e))if(!fb.call(o,a))ub(o,a,{get:hT.bind(e,a),enumerable:!0})}if(n)s.set(e,o);return o};var T=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var M=(e,t,r)=>()=>{if(e)try{t=e(e=0)}catch(n){r=[n]}if(r)throw r[0];return t};var Ue=bT(import.meta.url);function A(e){return typeof e==="string"}function Ct(e){return typeof e==="number"}function Qt(e){return typeof e==="boolean"}function Vt(e){return typeof e==="function"}function V(e){return typeof e==="object"&&e!==null}function B(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function qe(e){return B(e)&&typeof e.$ref==="string"}function Bt(e){return B(e)&&e.$prototype==="Function"}function Dr(e){return B(e)&&B(e.$expression)}function Ci(e){return Dr(e)&&Array.isArray(e.parameters)&&e.parameters.length>0}function Pn(e){return Bt(e)&&Array.isArray(e.body)}function jn(e){return B(e)&&typeof e.$prototype==="string"&&e.$prototype!=="Function"}function ds(e){return B(e)&&e.timing==="server"&&typeof e.$src==="string"&&typeof e.$export==="string"&&!e.$prototype}function db(e){return B(e)&&!e.$prototype&&!e.$expression&&"default"in e}function Ls(e){if(!B(e))return!1;for(let t of Object.keys(e))if(!pb.has(t))return!1;return!0}function dt(e){return B(e)&&e.$prototype==="Array"}function lp(e){return(Array.isArray(e)?e:[e]).some((r)=>dt(r))}function mb(e){return B(e)&&e.$prototype==="Class"}function $r(e){return B(e)}function be(e){return typeof e==="string"&&e.includes("${")}function hb(e){return/\breturn\b[^\S\n]*(?![;}\s]|$)/.test(Ti(e))}function cp(e){return e.$prototype==="Function"||A(e.role)&&e.role!=="field"}function Ti(e){if(!/[/'"`]/u.test(e))return e;let t=Mc.get(e);if(t!==void 0)return t;let r=$T(e);if(Mc.size>=xT)Mc.clear();return Mc.set(e,r),r}function $T(e){let t=e.split(""),r=(o)=>{if(t[o]!==void 0&&t[o]!==`
3
3
  `)t[o]=" "},n=[],s=!1,i=0;while(i<e.length){let o=e.charAt(i);if(s)if(o==="\\")r(i),r(i+1),i+=2;else if(o==="`")s=!1,i+=1;else if(o==="$"&&e.charAt(i+1)==="{")n.push(0),s=!1,i+=2;else r(i),i+=1;else if(o==="/"&&e.charAt(i+1)==="/")while(i<e.length&&e.charAt(i)!==`
4
4
  `)r(i),i+=1;else if(o==="/"&&e.charAt(i+1)==="*"){let a=e.indexOf("*/",i+2),l=a===-1?e.length:a+2;for(;i<l;i+=1)r(i)}else if(o==="'"||o==='"'){i+=1;while(i<e.length&&e.charAt(i)!==o&&e.charAt(i)!==`
5
- `){if(e.charAt(i)==="\\")r(i),i+=1;r(i),i+=1}i+=1}else if(o==="`")s=!0,i+=1;else{let a=n.length-1;if(a>=0&&o==="{")n[a]=(n[a]??0)+1;else if(a>=0&&o==="}")if(n[a]===0)n.pop(),s=!0;else n[a]=(n[a]??1)-1;i+=1}}return t.join("")}function Ni(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function ls(e){if(!e)return[];return e.map((t)=>O(t)?t:t.name)}function DN(e){return typeof e==="string"}function Sn(e){if(typeof e!=="object"||e===null||Array.isArray(e)||!W(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 W(t.cases)&&Object.values(t.cases).every((r)=>O(r))&&typeof t.default==="string";return!1}function wo(e){if(DN(e))return[e];if(!Sn(e))return[];let t=e.$expression;if(t.operator==="?:")return[...new Set([t.value,t.initial])];return[...new Set([...Object.values(t.cases),t.default])]}var Hy,Ec,JN=2048;var ye=D(()=>{Hy=new Set(["type","enum","minimum","maximum","minLength","maxLength","pattern","format","items","properties","required","description","title","$comment"]);Ec=new Map});function Gy(e){let t=[],r=[],n=null,s=0,i=()=>r.at(-1)?.path??"",o=()=>n===null?i():qN(i(),n),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+=LN.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(zy.has(l)||l===","||l===":"){s+=1;continue}if(l==="{"||l==="["){r.push(l==="{"?{keys:new Set,kind:"object",path:o()}:{kind:"array",path:o()}),n=null,s+=1;continue}if(l==="}"||l==="]"){r.pop(),n=null,s+=1;continue}if(l==='"'){let u=a(),p=r.at(-1);if(p?.kind==="object"&&FN(e,s)===":"){if(p.keys.has(u))t.push({detail:u,kind:"duplicate-key",path:p.path});p.keys.add(u),n=u}else n=null;continue}if(l==="-"||l>="0"&&l<="9"){let u=s;while(s<e.length&&/[\d+.eE-]/.test(e[s]))s+=1;let p=e.slice(u,s);if(!VN(p))t.push({detail:p,kind:"unsafe-number",path:o()});n=null;continue}let c=s;while(s<e.length&&/[A-Za-z]/.test(e[s]))s+=1;if(s===c)s+=1;n=null}return t}function FN(e,t){let r=t;while(r<e.length&&zy.has(e[r]))r+=1;return e[r]??""}function qN(e,t){return e===""?t:`${e}.${t}`}function VN(e){if(/[.eE]/.test(e))return!0;let t=Number(e);if(!Number.isFinite(t))return!1;return String(t)===e.replace(/^\+/,"")}function Ky(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 zy,LN;var Yy=D(()=>{zy=new Set([" ","\t",`
6
- `,"\r"]);LN=new Map([["b","\b"],["f","\f"],["n",`
7
- `],["r","\r"],["t","\t"]])});function je(e){return e instanceof Error?e.message:String(e)}function Zy(e){if(O(e))return Xy.test(e)?e.normalize("NFC"):e;if(Array.isArray(e))return e.map((t)=>Zy(t));if(W(e))return vo(e);return e}function vo(e){let t={};for(let[r,n]of Object.entries(e))t[Xy.test(r)?r.normalize("NFC"):r]=Zy(n);return t}function Ud(e,t,r){let n;try{n=JSON.parse(e)}catch(i){throw Error(`Failed to parse ${r} at ${t}: ${je(i)}`,{cause:i})}if(!W(n))throw Error(`Invalid ${r} at ${t}: expected a JSON object`);let s=Gy(e);if(s.length>0){let i=s.map((o)=>Ky(o)).join("; ");throw Error(`Invalid ${r} at ${t}: ${i}`)}return vo(n)}function Qy(e,t){return Ud(e,t,"Jx document")}function eb(e,t){return Ud(e,t,"project config")}function tb(e,t){return Ud(e,t,"class definition")}var Xy;var er=D(()=>{ye();Yy();Xy=/[^\p{ASCII}]/u});import{spawn as WN}from"node:child_process";import{createRequire as BN}from"node:module";import{join as HN}from"node:path";function UN(e){try{return BN(HN(e,"package.json")).resolve("@jxsuite/server/convert")}catch{throw Error(`@jxsuite/server is not installed in ${e}. Add it to devDependencies (e.g. \`bun add -d @jxsuite/server\`) and retry.`)}}function rb(e,t,r=WN,n=process){let s=UN(e),i=r("bun",[s,"--root",e,...t],{stdio:"inherit"});return i.on("error",(o)=>{console.error(o.code==="ENOENT"?"jx convert runs on Bun, which was not found on your PATH. Install it from https://bun.sh and retry.":`Failed to start jx convert: ${o.message}`),n.exitCode=1}),i.on("exit",(o)=>{n.exitCode=o??0}),i}var nb=()=>{};function zN(e){return JSON.parse(e)}function So(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function GN(e){return So(e)&&typeof e.binding==="string"}function KN(e){try{let t=zN(e);return So(t)?t:void 0}catch{return}}function sb(e,t){if(t.length===0)return{content:e??"",patched:!1};let r={};if(e){let n=KN(e);if(n===void 0)return{content:e,patched:!1};r=n}for(let n of t)ib(r,n);return{content:`${JSON.stringify(r,null,"\t")}
8
- `,patched:!0}}function ib(e,t){for(let[r,n]of Object.entries(t)){let s=r in e?e[r]:void 0;if(Array.isArray(n)){e[r]=YN(Array.isArray(s)?s:[],n);continue}if(So(n)){if(So(s))ib(s,n);else if(s===void 0)e[r]=structuredClone(n);continue}if(s===void 0)e[r]=n}}function YN(e,t){let r=[...e];for(let n of t){if(!GN(n)){if(!r.some((a)=>JSON.stringify(a)===JSON.stringify(n)))r.push(structuredClone(n));continue}let s=r.findIndex((o)=>So(o)&&o.binding===n.binding),i=r[s];if(So(i))r[s]={...i,...n};else r.push(structuredClone(n))}return r}var ob=()=>{};function ub(e){if(!O(e))return null;let[t,...r]=e.split(";"),n=(t??"").indexOf("/");if(n===-1)return null;let s=(t??"").slice(0,n).trim().toLowerCase(),i=(t??"").slice(n+1).trim().toLowerCase();if(!ab.test(s)||!ab.test(i))return null;let o=i.lastIndexOf("+"),a=o===-1?null:i.slice(o+1),l=o===-1?i:i.slice(0,o);if(a==="")return null;let c=l.indexOf("."),u=c===-1?null:l.slice(0,c),p=u!==null&&XN.has(u)?u:null,h=p===null?l:l.slice(p.length+1);if(h==="")return null;let m={};for(let b of r){let g=b.indexOf("=");if(g===-1)return null;let y=b.slice(0,g).trim().toLowerCase(),w=b.slice(g+1).trim();if(y==="")return null;if(w.startsWith('"')&&w.endsWith('"')&&w.length>=2)w=w.slice(1,-1);m[y]=w}return{parameters:m,subtype:h,suffix:a,tree:p,type:s}}function fb(e){if(!O(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(ub(e)===null)return`"${e}" is not a well-formed media type (RFC 6838 §4.2)`;return null}function db(e){let t=ub(e);if(t===null)return null;let r=t.tree===null?"":`${t.tree}.`,n=t.suffix===null?"":`+${t.suffix}`;return`${t.type}/${r}${t.subtype}${n}`}var ab,XN,lb="text/markdown; variant=GFM",cb="application/yaml",pb;var zd=D(()=>{ye();ab=/^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}$/,XN=new Set(["vnd","prs","x"]);pb={".jxn":"text/plain; charset=utf-8",".markdown":`${lb}; charset=utf-8`,".md":`${lb}; charset=utf-8`,".yaml":`${cb}; charset=utf-8`,".yml":`${cb}; charset=utf-8`}});class mb{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(`
5
+ `){if(e.charAt(i)==="\\")r(i),i+=1;r(i),i+=1}i+=1}else if(o==="`")s=!0,i+=1;else{let a=n.length-1;if(a>=0&&o==="{")n[a]=(n[a]??0)+1;else if(a>=0&&o==="}")if(n[a]===0)n.pop(),s=!0;else n[a]=(n[a]??1)-1;i+=1}}return t.join("")}function Ii(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Dc(e){if(!e)return[];return e.map((t)=>A(t)?t:t.name)}function wT(e){return typeof e==="string"}function kn(e){if(typeof e!=="object"||e===null||Array.isArray(e)||!B(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 B(t.cases)&&Object.values(t.cases).every((r)=>A(r))&&typeof t.default==="string";return!1}function Po(e){if(wT(e))return[e];if(!kn(e))return[];let t=e.$expression;if(t.operator==="?:")return[...new Set([t.value,t.initial])];return[...new Set([...Object.values(t.cases),t.default])]}var pb,Mc,xT=2048;var ye=M(()=>{pb=new Set(["type","enum","minimum","maximum","minLength","maxLength","pattern","format","items","properties","required","description","title","$comment"]);Mc=new Map});function yb(e){let t=[],r=[],n=null,s=0,i=()=>r.at(-1)?.path??"",o=()=>n===null?i():ET(i(),n),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+=vT.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(gb.has(l)||l===","||l===":"){s+=1;continue}if(l==="{"||l==="["){r.push(l==="{"?{keys:new Set,kind:"object",path:o()}:{kind:"array",path:o()}),n=null,s+=1;continue}if(l==="}"||l==="]"){r.pop(),n=null,s+=1;continue}if(l==='"'){let u=a(),p=r.at(-1);if(p?.kind==="object"&&ST(e,s)===":"){if(p.keys.has(u))t.push({detail:u,kind:"duplicate-key",path:p.path});p.keys.add(u),n=u}else n=null;continue}if(l==="-"||l>="0"&&l<="9"){let u=s;while(s<e.length&&/[\d+.eE-]/.test(e[s]))s+=1;let p=e.slice(u,s);if(!PT(p))t.push({detail:p,kind:"unsafe-number",path:o()});n=null;continue}let c=s;while(s<e.length&&/[A-Za-z]/.test(e[s]))s+=1;if(s===c)s+=1;n=null}return t}function ST(e,t){let r=t;while(r<e.length&&gb.has(e[r]))r+=1;return e[r]??""}function ET(e,t){return e===""?t:`${e}.${t}`}function PT(e){if(/[.eE]/.test(e))return!0;let t=Number(e);if(!Number.isFinite(t))return!1;return String(t)===e.replace(/^\+/,"")}function bb(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 gb,vT;var xb=M(()=>{gb=new Set([" ","\t",`
6
+ `,"\r"]);vT=new Map([["b","\b"],["f","\f"],["n",`
7
+ `],["r","\r"],["t","\t"]])});function Pe(e){return e instanceof Error?e.message:String(e)}function wb(e){if(A(e))return $b.test(e)?e.normalize("NFC"):e;if(Array.isArray(e))return e.map((t)=>wb(t));if(B(e))return jo(e);return e}function jo(e){let t={};for(let[r,n]of Object.entries(e))t[$b.test(r)?r.normalize("NFC"):r]=wb(n);return t}function up(e,t,r){let n;try{n=JSON.parse(e)}catch(i){throw Error(`Failed to parse ${r} at ${t}: ${Pe(i)}`,{cause:i})}if(!B(n))throw Error(`Invalid ${r} at ${t}: expected a JSON object`);let s=yb(e);if(s.length>0){let i=s.map((o)=>bb(o)).join("; ");throw Error(`Invalid ${r} at ${t}: ${i}`)}return jo(n)}function vb(e,t){return up(e,t,"Jx document")}function Sb(e,t){return up(e,t,"project config")}function Eb(e,t){return up(e,t,"class definition")}var $b;var er=M(()=>{ye();xb();$b=/[^\p{ASCII}]/u});import{spawn as jT}from"node:child_process";import{createRequire as kT}from"node:module";import{join as _T}from"node:path";function AT(e){try{return kT(_T(e,"package.json")).resolve("@jxsuite/server/convert")}catch{throw Error(`@jxsuite/server is not installed in ${e}. Add it to devDependencies (e.g. \`bun add -d @jxsuite/server\`) and retry.`)}}function Pb(e,t,r=jT,n=process){let s=AT(e),i=r("bun",[s,"--root",e,...t],{stdio:"inherit"});return i.on("error",(o)=>{console.error(o.code==="ENOENT"?"jx convert runs on Bun, which was not found on your PATH. Install it from https://bun.sh and retry.":`Failed to start jx convert: ${o.message}`),n.exitCode=1}),i.on("exit",(o)=>{n.exitCode=o??0}),i}var jb=()=>{};function RT(e){return JSON.parse(e)}function ko(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function OT(e){return ko(e)&&typeof e.binding==="string"}function NT(e){try{let t=RT(e);return ko(t)?t:void 0}catch{return}}function kb(e,t){if(t.length===0)return{content:e??"",patched:!1};let r={};if(e){let n=NT(e);if(n===void 0)return{content:e,patched:!1};r=n}for(let n of t)_b(r,n);return{content:`${JSON.stringify(r,null,"\t")}
8
+ `,patched:!0}}function _b(e,t){for(let[r,n]of Object.entries(t)){let s=r in e?e[r]:void 0;if(Array.isArray(n)){e[r]=CT(Array.isArray(s)?s:[],n);continue}if(ko(n)){if(ko(s))_b(s,n);else if(s===void 0)e[r]=structuredClone(n);continue}if(s===void 0)e[r]=n}}function CT(e,t){let r=[...e];for(let n of t){if(!OT(n)){if(!r.some((a)=>JSON.stringify(a)===JSON.stringify(n)))r.push(structuredClone(n));continue}let s=r.findIndex((o)=>ko(o)&&o.binding===n.binding),i=r[s];if(ko(i))r[s]={...i,...n};else r.push(structuredClone(n))}return r}var Ab=()=>{};function Cb(e){if(!A(e))return null;let[t,...r]=e.split(";"),n=(t??"").indexOf("/");if(n===-1)return null;let s=(t??"").slice(0,n).trim().toLowerCase(),i=(t??"").slice(n+1).trim().toLowerCase();if(!Rb.test(s)||!Rb.test(i))return null;let o=i.lastIndexOf("+"),a=o===-1?null:i.slice(o+1),l=o===-1?i:i.slice(0,o);if(a==="")return null;let c=l.indexOf("."),u=c===-1?null:l.slice(0,c),p=u!==null&&TT.has(u)?u:null,h=p===null?l:l.slice(p.length+1);if(h==="")return null;let m={};for(let y of r){let g=y.indexOf("=");if(g===-1)return null;let b=y.slice(0,g).trim().toLowerCase(),w=y.slice(g+1).trim();if(b==="")return null;if(w.startsWith('"')&&w.endsWith('"')&&w.length>=2)w=w.slice(1,-1);m[b]=w}return{parameters:m,subtype:h,suffix:a,tree:p,type:s}}function Tb(e){if(!A(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(Cb(e)===null)return`"${e}" is not a well-formed media type (RFC 6838 §4.2)`;return null}function Ib(e){let t=Cb(e);if(t===null)return null;let r=t.tree===null?"":`${t.tree}.`,n=t.suffix===null?"":`+${t.suffix}`;return`${t.type}/${r}${t.subtype}${n}`}var Rb,TT,Ob="text/markdown; variant=GFM",Nb="application/yaml",Jb;var fp=M(()=>{ye();Rb=/^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}$/,TT=new Set(["vnd","prs","x"]);Jb={".jxn":"text/plain; charset=utf-8",".markdown":`${Ob}; charset=utf-8`,".md":`${Ob}; charset=utf-8`,".yaml":`${Nb}; charset=utf-8`,".yml":`${Nb}; charset=utf-8`}});class Mb{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(`
9
9
  `,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 r=this.text.startsWith('"""',t),n=r?'"""':'"',s=n+"#".repeat(e);t+=n.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(!r&&this.text.charAt(t)===`
10
10
  `)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===`
11
- `||t===";")&&e===0)return this.index+=1,!0;else this.index+=1}return e===0}}function Eo(e){if(ZN.test(e))return"unreadable";let t=new mb(e);for(;;){if(t.skipTrivia(),t.done)return"document";if(t.startsWith("(")){let r=e.indexOf(")",t.index);if(r===-1)return"unreadable";t.index=r+1}else{let[r]=QN.exec(e.slice(t.index,t.index+256))??[];if(!r)return t.startsWith('"')||t.startsWith("#")?"document":"unreadable";if(!r.startsWith("$"))return r==="project"?"project":"document";if(t.index+=r.length,!t.skipNode())return"unreadable"}}}var ZN,QN;var tl=D(()=>{ZN=/\0/u,QN=/^[^\s\\/(){};[\]"#=]+/u});function sl(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 Fs(e){return e===13||e===10||e===133||e===11||e===12||e===8232||e===8233||!1}function Ic(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 rt(e){return!isNaN(e)&&!sl(e)&&!Fs(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 hb(e){return e>=65&&e<91||e>=97&&e<123||!1}function Gd(e){return e>=48&&e<64||e>=65&&e<71||e>=97&&e<103||!1}function Kd(e){return Gd(e)||e===95}function us(e){return e>=48&&e<58}function Mi(e){return us(e)||e===95}function Yd(e){return e>=48&&e<56}function gb(e){return Yd(e)||e===95}function Xd(e){return e===48||e===49}function yb(e){return Xd(e)||e===95}function bb(e){return e===45||e===43}var Ms=1,jo=2,Ti=3,jc=4,Pc=5,rl=6,kc=7,_c=8,nl=9,Ds=10,tr=11,Po=12,ko=13,Ac=14,cs=15,Rc=16,Oc=17,Ii=18,Ls=19,Cc=20,Nc=21,Tc=22,_o=23,Ji=24,En=28;function*tT(e){for(let t of(eT??=new Intl.Segmenter("en")).segment(e))yield t.segment}function rT(e){return e[Symbol.iterator]()}function xb(e,{flags:t,graphemeLocations:r=!1}){let n=r?tT(e):rT(e),s=n.next();return{text:e,graphemeLocations:r,line:1,column:1,offset:0,length:e.length,iterator:n,currentIter:s,current:s.done?NaN:s.value.codePointAt(0),start:{line:1,column:1,offset:0},errorsInToken:null,flags:t}}function*$b(e){if(Ie(e,65279))e.column=1,yield ke(e,jo);if(Ic(e.current))throw jn(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(),r=e.current=t.done?NaN:t.value.codePointAt(0);if(Ic(r))if(r>=55296&&r<=57343||r>1114111)il(e,`Invalid character \\u${r.toString(16)}`);else il(e,`Invalid character \\u${r.toString(16)}, this character is not allowed but can be included in strings as \\u{${r.toString(16)}}`);return r}function fn(e,t){if(t(e.current)){let r=e.current;return vt(e),r}}function Ie(e,t){if(e.current===t)return vt(e),t}function Ao(e){if(!Fs(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 Zd(e,t){while(e.current===t)vt(e)}function ze(e,t){while(t(e.current))vt(e)}function ke(e,t,r){let{line:n,column:s,offset:i}=e,o={line:n,column:s,offset:i},a=e.start;e.start=o;let l=e.errorsInToken;e.errorsInToken=null;let c={type:t,text:e.text.slice(a.offset,o.offset),start:a,end:o,errors:l};if(r){if(!c.errors)c.errors=[];c.errors.push(new De(r,{token:c}))}return c}function jn(e,t){if(t instanceof De)return t;let{line:r,column:n,offset:s}=e,i={line:r,column:n,offset:s},o;if(s<e.length)if(Fs(e.current))o={line:r+1,column:1,offset:s+1};else o={line:r,column:n+1,offset:s+1};return new De(`${t}`,{start:i,end:o})}function il(e,t){(e.errorsInToken??=[]).push(jn(e,t))}var eT;var wb=D(()=>{Di()});function Li(e){return(t)=>(vt(t),ke(t,e))}function ol(e){return ze(e,sl),ke(e,Ii)}function Fi(e){return Ao(e),ke(e,Ls)}function nT(e){vt(e);let t=!1,r=!1;if(Ie(e,34)){if(!Ie(e,34))return ke(e,nl);if(r=!0,e.current===34)throw jn(e,"Multiline strings must start with exactly three quotes");while(!t&&e.offset<e.length)if(Ie(e,34)){if(Ie(e,34)&&Ie(e,34))t=!0}else Ie(e,92),Ao(e)||vt(e)}else while(!t&&e.offset<e.length)if(Ie(e,34))t=!0;else Ie(e,92),Ao(e)||vt(e);if(!t)throw jn(e,"Unexpected EOF inside string");return ke(e,r?_o:nl)}function vb(e){if(vt(e),e.current===35||e.current===34){let t=1;while(Ie(e,35))t++;if(!Ie(e,34))throw jn(e,`Expected a quote after ${"#".repeat(t)}`);let r=!1;if(Ie(e,34))if(Ie(e,34)){if(e.current===34)throw jn(e,"Multiline strings must start with exactly three quotes");r=!0}else{let n=0;while(Ie(e,35))n++;if(n===t)return ke(e,Ds)}while(!0){if(e.offset>=e.length)throw jn(e,"Unexpected EOF while parsing raw string");if(Ie(e,34)){if(r){if(!Ie(e,34)||!Ie(e,34))continue}let n=0;while(n<t&&Ie(e,35))n++;if(n===t)return ke(e,r?Ji:Ds)}else Ao(e)||vt(e)}}else{let t;if(e.current<255){let r=Ae[e.current];t=r(e)}else if(sl(e.current))t=ol(e);else if(Fs(e.current))t=Fi(e);else t=ep(e);if(t.type!==tr)(t.errors??=[]).push(new De("Expected a valid identifier",{token:t}));return t.type=ko,t}}function sT(e){if(vt(e),fn(e,us))return ze(e,rt),ke(e,tr,"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 ze(e,rt),ke(e,tr)}function iT(e){if(vt(e),Ie(e,45))return ke(e,Ti);else if(Ie(e,47)){while(e.offset<e.length&&!Fs(e.current))vt(e);return ke(e,Nc)}else if(Ie(e,42)){let t=1;while(e.offset<e.length)if(Ie(e,42)){if(Ie(e,47)){if(t--,t===0)return ke(e,Tc)}}else if(Ie(e,47)){if(Ie(e,42))t++}else Ao(e)||vt(e);throw jn(e,"Unexpected EOF in multiline comment")}else Mc(e)}function Sb(e){return vt(e),oT(e)}function oT(e){if(us(e.current))return dn(e);else if(Ie(e,46)){if(fn(e,us))return ze(e,rt),ke(e,tr,"Invalid identifier or number, surround with quotes to make it an identifier or add a zero between the sign and the decimal point");return ze(e,rt),ke(e,tr)}else return ze(e,rt),ke(e,tr)}function Qd(e,t,r,n){return(s)=>{let i=vt(s);if(fn(s,r))return ze(s,n),ke(s,t);else if(!s.flags.experimentalSuffixedNumbers){if(Ie(s,95)){if(ze(s,n),!rt(s.current))return ke(s,t,`Invalid ${e} number, the first character after 0${String.fromCodePoint(i)} cannot be an underscore`)}return ze(s,rt),ke(s,tr,`Invalid ${e} number`)}else if(Ie(s,95)){if(Zd(s,95),r(s.current)){if(ze(s,n),!rt(s.current))return ke(s,t,`Invalid ${e} number, the first character after 0${String.fromCodePoint(i)} cannot be an underscore`)}return ze(s,rt),ke(s,tr,"Invalid number with suffix, a suffix cannot start with a letter followed by an underscore")}else if(us(s.current))return ke(s,tr,"Invalid number with suffix, a suffix cannot start with a letter followed by a number");else return ze(s,rt),ke(s,En)}}function dn(e){if(Ie(e,48)){let t=Jc[e.current];if(t)return t(e)}if(ze(e,Mi),Ie(e,46)){if(!fn(e,us))if(e.current===95)il(e,"Invalid decimal number, the part after the decimal point mustn't start on an underscore");else il(e,"Invalid decimal number, a decimal point must be followed by a digit");ze(e,Mi)}if(Ie(e,101)||Ie(e,69))if(fn(e,bb),fn(e,us)){if(ze(e,Mi),rt(e.current))return ze(e,rt),ke(e,tr,"Invalid number with suffix, a number with an exponent cannot have a suffix");return ke(e,cs)}else if(!e.flags.experimentalSuffixedNumbers)if(e.current===95)return ze(e,Mi),ke(e,cs,"Invalid decimal number, the number after the exponent mustn't start on an underscore");else return ze(e,rt),ke(e,cs,"Invalid decimal number, missing a number after the exponent");else if(Ie(e,95)){if(Zd(e,95),us(e.current)){if(ze(e,Mi),!rt(e.current))return ke(e,cs,"Invalid decimal number, the number after the exponent mustn't start on an underscore")}return ze(e,rt),ke(e,tr,"Invalid number with suffix, a suffix cannot start with a letter followed by an underscore")}else return ze(e,rt),ke(e,En);else if(e.flags.experimentalSuffixedNumbers)if(e.current===88||e.current===120){vt(e);let t=null;if(fn(e,Kd))t="Invalid number with suffix, a suffix cannot start with an x followed by a hexidecimal number";return ze(e,rt),ke(e,En,t)}else if(fn(e,hb)){let t=null;if(fn(e,Mi))t="Invalid number with suffix, a suffix cannot start with a letter followed by a digit";return ze(e,rt),ke(e,En,t)}else if(Ie(e,44))return ze(e,rt),ke(e,En,"Invalid number with suffix, a suffix cannot start with a comma");else if(Ie(e,46))return ze(e,rt),ke(e,En,"Invalid number with suffix, a suffix cannot start with a dot");else if(fn(e,rt))return ze(e,rt),ke(e,En);else return ke(e,cs);else return ke(e,cs)}function aT(e){if(vt(e),e.current!=35)return ze(e,rt),ke(e,tr);let t=vb(e);t.start.offset--,t.start.column--;let r;switch(t.type){case Ds:case Ji:r='Invalid raw string, the correct syntax is #" "#, not r#" "#';break;default:r="Invalid token, did you forget a whitespace after this r?"}return(t.errors??=[]).push(new De(r,{token:t})),t}function ep(e){return vt(e),ze(e,rt),ke(e,tr)}function Mc(e){throw jn(e,`Unexpected character ${JSON.stringify(String.fromCodePoint(e.current))}, did you forget to quote an identifier?`)}function*al(e,t){let r=xb(e,t);yield*$b(r);while(!r.currentIter.done){if(r.current<255){let n=Ae[r.current];yield n(r);continue}if(sl(r.current)){yield ol(r);continue}if(Fs(r.current)){yield Fi(r);continue}yield ep(r)}yield ke(r,Ms)}var Jc,Ae;var Eb=D(()=>{Di();wb();Jc=Array(256).fill(null);Jc[98]=Qd("binary",Oc,Xd,yb);Jc[111]=Qd("octal",Rc,Yd,gb);Jc[120]=Qd("hexadecimal",Ac,Gd,Kd);Ae=Array(255);Ae.fill(ep);for(let e=0;e<32;e++)Ae[e]=Mc;Ae[9]=ol;Ae[10]=Fi;Ae[11]=Fi;Ae[12]=Fi;Ae[13]=Fi;Ae[32]=ol;Ae[34]=nT;Ae[35]=vb;Ae[40]=Li(jc);Ae[41]=Li(rl);Ae[43]=Sb;Ae[45]=Sb;Ae[46]=sT;Ae[47]=iT;Ae[48]=dn;Ae[49]=dn;Ae[50]=dn;Ae[51]=dn;Ae[52]=dn;Ae[53]=dn;Ae[54]=dn;Ae[55]=dn;Ae[56]=dn;Ae[57]=dn;Ae[59]=Li(_c);Ae[61]=Li(Po);Ae[91]=Mc;Ae[92]=Li(Cc);Ae[93]=Mc;Ae[114]=aT;Ae[123]=Li(Pc);Ae[125]=Li(kc);Ae[133]=Fi;Ae[160]=ol});var Ro=D(()=>{Eb()});var De;var Di=D(()=>{Ro();De=class De extends Error{name="InvalidKdlError";start;end;token;errors;constructor(e,{token:t,start:r=t?.start,end:n=t?.end,errors:s,...i}={}){if(t?.type===Ms)e=`${e} at end of input`;else if(r)e=`${e} at ${r.line}:${r.column}`;super(e,i);this.token=t,this.start=r,this.end=n,this.errors=s}*flat(){if(this.errors==null){yield this;return}for(let e of this.errors)yield*e.flat()}}});function Oo(e){return jb.get(e)}function Pb(e,{start:t},{end:r}){jb.set(e,{start:t,end:r})}var jb;var tp=D(()=>{jb=new WeakMap});function kb({experimentalSuffixedNumbers:e=!1}={}){return{experimentalSuffixedNumbers:e}}class pn{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 pn(this.name);return e.representation=this.representation,e}}class Pn{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 Pn(this.name);return e.representation=this.representation,e.leading=this.leading,e.trailing=this.trailing,e.suffix=this.suffix,e}}class mn{type="value";static type="value";representation;tag=null;betweenTagAndValue;constructor(e){this.value=e}clone(){let e=new mn(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 Pn(e)}}var rp=()=>{};class Lr{static createArgument(e){return new Lr(new mn(e),null)}static createProperty(e,t){return new Lr(new mn(t),new pn(e))}type="entry";static type="entry";name;value;leading;trailing;equals;constructor(e,t){this.value=e,this.name=t}clone(){let e=new Lr(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 pn(e):null}getValue(){return this.value.value}setValue(e){this.value=new mn(e)}isArgument(){return this.name==null}isProperty(){return this.name!=null}}var np=D(()=>{rp()});function*Co(e){for(let t=e.length-1;t>=0;t--)yield e[t]}function sp(e){return e.children??(e.children=new qs)}class No{static create(e){return new No(new pn(e))}type="node";static type="node";name;tag=null;entries;children;leading;trailing;beforeChildren;betweenTagAndName;constructor(e,t=[],r=null){this.name=e,this.entries=t,this.children=r}clone({shallow:e=!1}={}){let t=new No(this.name.clone(),e?[]:this.entries.map((r)=>r.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 Pn(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,r){let n=Lr.createArgument(e);if(n.value.setTag(t),r!=null)for(let[s,i]of this.entries.entries()){if(!i.isArgument())continue;if(r===0){this.entries.splice(s,0,i);return}r--}this.entries.push(n)}removeArgument(e){for(let[t,r]of this.entries.entries()){if(!r.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 Co(this.entries))if(t.getName()===e)return t;return}setProperty(e,t,r){for(let s of Co(this.entries))if(s.getName()===e){s.setValue(t),s.value.setTag(r);return}let n=Lr.createProperty(e,t);n.value.setTag(r),this.entries.push(n)}deleteProperty(e){this.entries=this.entries.filter((t)=>t.getName()!==e)}hasChildren(){return this.children!=null&&!this.children.isEmpty()}appendNode(e){sp(this).appendNode(e)}insertNodeBefore(e,t){sp(this).insertNodeBefore(e,t)}insertNodeAfter(e,t){sp(this).insertNodeAfter(e,t)}removeNode(e){if(this.children==null)throw Error("Node to remove is not in document");this.children.removeNode(e)}replaceNode(e,t){if(this.children==null)throw Error("Node to remove is not in document");this.children.replaceNode(e,t)}findNodesByName(e){return this.children!=null?this.children.findNodesByName(e):[]}findNodeByName(e){return this.children?.findNodeByName(e)}findParameterizedNode(e,t){return this.children?.findParameterizedNode(e,t)}removeNodesByName(e){this.children?.removeNodesByName(e)}}var _b=D(()=>{ip();np()});function*To(e){if(e instanceof qs)yield*e.nodes;else yield e}class qs{type="document";static type="document";nodes;trailing;constructor(e=[]){this.nodes=e}clone({shallow:e}={}){let t=new qs(e?[]:this.nodes.map((r)=>r.clone()));return t.trailing=this.trailing,t}appendNode(e){this.nodes.push(...To(e))}insertNodeBefore(e,t){if(t==null){this.nodes.push(...To(e));return}let r=this.nodes.indexOf(t);if(r===-1)throw Error("Reference node is not in document");this.nodes.splice(r,0,...To(e))}insertNodeAfter(e,t){if(t==null){this.nodes.unshift(...To(e));return}let r=this.nodes.indexOf(t);if(r===-1)throw Error("Reference node is not in document");this.nodes.splice(r+1,0,...To(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 r=this.nodes.indexOf(e);if(r===-1)throw Error("Node to replace is not in document");this.nodes.splice(r,1,...To(t))}findNodesByName(e){return this.nodes.filter((t)=>t.name.name===e)}findNodeByName(e){for(let t of Co(this.nodes))if(t.name.name===e)return t;return}findParameterizedNode(e,t){for(let r of Co(this.nodes)){if(r.name.name!==e)continue;let n=r.getArguments();if(n.length!==1||t!==void 0&&n[0]!==t)continue;return r}return}removeNodesByName(e){this.nodes=this.nodes.filter((t)=>t.name.name!==e)}isEmpty(){return this.nodes.length===0}}var ip=()=>{};var Ab=D(()=>{ip();np();_b();rp()});function Rb(e,t,r){let n;while(n=cT.exec(t)){let s=ll(r,t,n.index);e.push(new De("Raw strings with single quotes cannot contain any unescaped newlines, use triple-quotes for multiline strings",{token:r,start:s,end:{offset:s.offset+n[0].length,line:s.line+1,column:1}}))}return t}function Ob(e,t,r){if(!Io.test(t))return e.push(new De("Raw strings with three quotes must be multiline strings",{token:r})),t;if(!Io.test(t[0]))return e.push(new De("Multi-line strings must start with a newline",{token:r})),t;let n=dT.exec(t)?.[1];if(n==null)return e.push(new De("The final line in a multiline string may only contain whitespace",{token:r})),t;return t.replace(mT,(s,i,o,a,l)=>{if(!a)return`
12
- `;if(!o.startsWith(n)){let c=ll(r,t,l+i.length);return e.push(new De("Every non-blank line of a multi-line string must start with the offset defined by the last line of the string",{token:r,start:c,end:{offset:c.offset+n.length,line:c.line,column:c.column+n.length}})),`
11
+ `||t===";")&&e===0)return this.index+=1,!0;else this.index+=1}return e===0}}function _o(e){if(IT.test(e))return"unreadable";let t=new Mb(e);for(;;){if(t.skipTrivia(),t.done)return"document";if(t.startsWith("(")){let r=e.indexOf(")",t.index);if(r===-1)return"unreadable";t.index=r+1}else{let[r]=JT.exec(e.slice(t.index,t.index+256))??[];if(!r)return t.startsWith('"')||t.startsWith("#")?"document":"unreadable";if(!r.startsWith("$"))return r==="project"?"project":"document";if(t.index+=r.length,!t.skipNode())return"unreadable"}}}var IT,JT;var cl=M(()=>{IT=/\0/u,JT=/^[^\s\\/(){};[\]"#=]+/u});function dl(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 Bs(e){return e===13||e===10||e===133||e===11||e===12||e===8232||e===8233||!1}function Kc(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 rt(e){return!isNaN(e)&&!dl(e)&&!Bs(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 Db(e){return e>=65&&e<91||e>=97&&e<123||!1}function dp(e){return e>=48&&e<64||e>=65&&e<71||e>=97&&e<103||!1}function pp(e){return dp(e)||e===95}function ms(e){return e>=48&&e<58}function Li(e){return ms(e)||e===95}function mp(e){return e>=48&&e<56}function Lb(e){return mp(e)||e===95}function hp(e){return e===48||e===49}function Fb(e){return hp(e)||e===95}function qb(e){return e===45||e===43}var Fs=1,Ao=2,Ji=3,Lc=4,Fc=5,ul=6,qc=7,Vc=8,fl=9,qs=10,tr=11,Ro=12,Oo=13,Bc=14,ps=15,Wc=16,Uc=17,Mi=18,Vs=19,Hc=20,zc=21,Gc=22,No=23,Di=24,_n=28;function*DT(e){for(let t of(MT??=new Intl.Segmenter("en")).segment(e))yield t.segment}function LT(e){return e[Symbol.iterator]()}function Vb(e,{flags:t,graphemeLocations:r=!1}){let n=r?DT(e):LT(e),s=n.next();return{text:e,graphemeLocations:r,line:1,column:1,offset:0,length:e.length,iterator:n,currentIter:s,current:s.done?NaN:s.value.codePointAt(0),start:{line:1,column:1,offset:0},errorsInToken:null,flags:t}}function*Bb(e){if(Ie(e,65279))e.column=1,yield ke(e,Ao);if(Kc(e.current))throw An(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(),r=e.current=t.done?NaN:t.value.codePointAt(0);if(Kc(r))if(r>=55296&&r<=57343||r>1114111)pl(e,`Invalid character \\u${r.toString(16)}`);else pl(e,`Invalid character \\u${r.toString(16)}, this character is not allowed but can be included in strings as \\u{${r.toString(16)}}`);return r}function pn(e,t){if(t(e.current)){let r=e.current;return vt(e),r}}function Ie(e,t){if(e.current===t)return vt(e),t}function Co(e){if(!Bs(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 gp(e,t){while(e.current===t)vt(e)}function ze(e,t){while(t(e.current))vt(e)}function ke(e,t,r){let{line:n,column:s,offset:i}=e,o={line:n,column:s,offset:i},a=e.start;e.start=o;let l=e.errorsInToken;e.errorsInToken=null;let c={type:t,text:e.text.slice(a.offset,o.offset),start:a,end:o,errors:l};if(r){if(!c.errors)c.errors=[];c.errors.push(new Me(r,{token:c}))}return c}function An(e,t){if(t instanceof Me)return t;let{line:r,column:n,offset:s}=e,i={line:r,column:n,offset:s},o;if(s<e.length)if(Bs(e.current))o={line:r+1,column:1,offset:s+1};else o={line:r,column:n+1,offset:s+1};return new Me(`${t}`,{start:i,end:o})}function pl(e,t){(e.errorsInToken??=[]).push(An(e,t))}var MT;var Wb=M(()=>{Fi()});function qi(e){return(t)=>(vt(t),ke(t,e))}function ml(e){return ze(e,dl),ke(e,Mi)}function Vi(e){return Co(e),ke(e,Vs)}function FT(e){vt(e);let t=!1,r=!1;if(Ie(e,34)){if(!Ie(e,34))return ke(e,fl);if(r=!0,e.current===34)throw An(e,"Multiline strings must start with exactly three quotes");while(!t&&e.offset<e.length)if(Ie(e,34)){if(Ie(e,34)&&Ie(e,34))t=!0}else Ie(e,92),Co(e)||vt(e)}else while(!t&&e.offset<e.length)if(Ie(e,34))t=!0;else Ie(e,92),Co(e)||vt(e);if(!t)throw An(e,"Unexpected EOF inside string");return ke(e,r?No:fl)}function Ub(e){if(vt(e),e.current===35||e.current===34){let t=1;while(Ie(e,35))t++;if(!Ie(e,34))throw An(e,`Expected a quote after ${"#".repeat(t)}`);let r=!1;if(Ie(e,34))if(Ie(e,34)){if(e.current===34)throw An(e,"Multiline strings must start with exactly three quotes");r=!0}else{let n=0;while(Ie(e,35))n++;if(n===t)return ke(e,qs)}while(!0){if(e.offset>=e.length)throw An(e,"Unexpected EOF while parsing raw string");if(Ie(e,34)){if(r){if(!Ie(e,34)||!Ie(e,34))continue}let n=0;while(n<t&&Ie(e,35))n++;if(n===t)return ke(e,r?Di:qs)}else Co(e)||vt(e)}}else{let t;if(e.current<255){let r=Ae[e.current];t=r(e)}else if(dl(e.current))t=ml(e);else if(Bs(e.current))t=Vi(e);else t=bp(e);if(t.type!==tr)(t.errors??=[]).push(new Me("Expected a valid identifier",{token:t}));return t.type=Oo,t}}function qT(e){if(vt(e),pn(e,ms))return ze(e,rt),ke(e,tr,"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 ze(e,rt),ke(e,tr)}function VT(e){if(vt(e),Ie(e,45))return ke(e,Ji);else if(Ie(e,47)){while(e.offset<e.length&&!Bs(e.current))vt(e);return ke(e,zc)}else if(Ie(e,42)){let t=1;while(e.offset<e.length)if(Ie(e,42)){if(Ie(e,47)){if(t--,t===0)return ke(e,Gc)}}else if(Ie(e,47)){if(Ie(e,42))t++}else Co(e)||vt(e);throw An(e,"Unexpected EOF in multiline comment")}else Yc(e)}function Hb(e){return vt(e),BT(e)}function BT(e){if(ms(e.current))return mn(e);else if(Ie(e,46)){if(pn(e,ms))return ze(e,rt),ke(e,tr,"Invalid identifier or number, surround with quotes to make it an identifier or add a zero between the sign and the decimal point");return ze(e,rt),ke(e,tr)}else return ze(e,rt),ke(e,tr)}function yp(e,t,r,n){return(s)=>{let i=vt(s);if(pn(s,r))return ze(s,n),ke(s,t);else if(!s.flags.experimentalSuffixedNumbers){if(Ie(s,95)){if(ze(s,n),!rt(s.current))return ke(s,t,`Invalid ${e} number, the first character after 0${String.fromCodePoint(i)} cannot be an underscore`)}return ze(s,rt),ke(s,tr,`Invalid ${e} number`)}else if(Ie(s,95)){if(gp(s,95),r(s.current)){if(ze(s,n),!rt(s.current))return ke(s,t,`Invalid ${e} number, the first character after 0${String.fromCodePoint(i)} cannot be an underscore`)}return ze(s,rt),ke(s,tr,"Invalid number with suffix, a suffix cannot start with a letter followed by an underscore")}else if(ms(s.current))return ke(s,tr,"Invalid number with suffix, a suffix cannot start with a letter followed by a number");else return ze(s,rt),ke(s,_n)}}function mn(e){if(Ie(e,48)){let t=Xc[e.current];if(t)return t(e)}if(ze(e,Li),Ie(e,46)){if(!pn(e,ms))if(e.current===95)pl(e,"Invalid decimal number, the part after the decimal point mustn't start on an underscore");else pl(e,"Invalid decimal number, a decimal point must be followed by a digit");ze(e,Li)}if(Ie(e,101)||Ie(e,69))if(pn(e,qb),pn(e,ms)){if(ze(e,Li),rt(e.current))return ze(e,rt),ke(e,tr,"Invalid number with suffix, a number with an exponent cannot have a suffix");return ke(e,ps)}else if(!e.flags.experimentalSuffixedNumbers)if(e.current===95)return ze(e,Li),ke(e,ps,"Invalid decimal number, the number after the exponent mustn't start on an underscore");else return ze(e,rt),ke(e,ps,"Invalid decimal number, missing a number after the exponent");else if(Ie(e,95)){if(gp(e,95),ms(e.current)){if(ze(e,Li),!rt(e.current))return ke(e,ps,"Invalid decimal number, the number after the exponent mustn't start on an underscore")}return ze(e,rt),ke(e,tr,"Invalid number with suffix, a suffix cannot start with a letter followed by an underscore")}else return ze(e,rt),ke(e,_n);else if(e.flags.experimentalSuffixedNumbers)if(e.current===88||e.current===120){vt(e);let t=null;if(pn(e,pp))t="Invalid number with suffix, a suffix cannot start with an x followed by a hexidecimal number";return ze(e,rt),ke(e,_n,t)}else if(pn(e,Db)){let t=null;if(pn(e,Li))t="Invalid number with suffix, a suffix cannot start with a letter followed by a digit";return ze(e,rt),ke(e,_n,t)}else if(Ie(e,44))return ze(e,rt),ke(e,_n,"Invalid number with suffix, a suffix cannot start with a comma");else if(Ie(e,46))return ze(e,rt),ke(e,_n,"Invalid number with suffix, a suffix cannot start with a dot");else if(pn(e,rt))return ze(e,rt),ke(e,_n);else return ke(e,ps);else return ke(e,ps)}function WT(e){if(vt(e),e.current!=35)return ze(e,rt),ke(e,tr);let t=Ub(e);t.start.offset--,t.start.column--;let r;switch(t.type){case qs:case Di:r='Invalid raw string, the correct syntax is #" "#, not r#" "#';break;default:r="Invalid token, did you forget a whitespace after this r?"}return(t.errors??=[]).push(new Me(r,{token:t})),t}function bp(e){return vt(e),ze(e,rt),ke(e,tr)}function Yc(e){throw An(e,`Unexpected character ${JSON.stringify(String.fromCodePoint(e.current))}, did you forget to quote an identifier?`)}function*hl(e,t){let r=Vb(e,t);yield*Bb(r);while(!r.currentIter.done){if(r.current<255){let n=Ae[r.current];yield n(r);continue}if(dl(r.current)){yield ml(r);continue}if(Bs(r.current)){yield Vi(r);continue}yield bp(r)}yield ke(r,Fs)}var Xc,Ae;var zb=M(()=>{Fi();Wb();Xc=Array(256).fill(null);Xc[98]=yp("binary",Uc,hp,Fb);Xc[111]=yp("octal",Wc,mp,Lb);Xc[120]=yp("hexadecimal",Bc,dp,pp);Ae=Array(255);Ae.fill(bp);for(let e=0;e<32;e++)Ae[e]=Yc;Ae[9]=ml;Ae[10]=Vi;Ae[11]=Vi;Ae[12]=Vi;Ae[13]=Vi;Ae[32]=ml;Ae[34]=FT;Ae[35]=Ub;Ae[40]=qi(Lc);Ae[41]=qi(ul);Ae[43]=Hb;Ae[45]=Hb;Ae[46]=qT;Ae[47]=VT;Ae[48]=mn;Ae[49]=mn;Ae[50]=mn;Ae[51]=mn;Ae[52]=mn;Ae[53]=mn;Ae[54]=mn;Ae[55]=mn;Ae[56]=mn;Ae[57]=mn;Ae[59]=qi(Vc);Ae[61]=qi(Ro);Ae[91]=Yc;Ae[92]=qi(Hc);Ae[93]=Yc;Ae[114]=WT;Ae[123]=qi(Fc);Ae[125]=qi(qc);Ae[133]=Vi;Ae[160]=ml});var To=M(()=>{zb()});var Me;var Fi=M(()=>{To();Me=class Me extends Error{name="InvalidKdlError";start;end;token;errors;constructor(e,{token:t,start:r=t?.start,end:n=t?.end,errors:s,...i}={}){if(t?.type===Fs)e=`${e} at end of input`;else if(r)e=`${e} at ${r.line}:${r.column}`;super(e,i);this.token=t,this.start=r,this.end=n,this.errors=s}*flat(){if(this.errors==null){yield this;return}for(let e of this.errors)yield*e.flat()}}});function Io(e){return Gb.get(e)}function Kb(e,{start:t},{end:r}){Gb.set(e,{start:t,end:r})}var Gb;var xp=M(()=>{Gb=new WeakMap});function Xb({experimentalSuffixedNumbers:e=!1}={}){return{experimentalSuffixedNumbers:e}}class hn{type="identifier";static type="identifier";representation;constructor(e){this.name=e}getName(){return this.name}setName(e){if(e!==this.name)this.name=e,this.representation=void 0}clone(){let e=new hn(this.name);return e.representation=this.representation,e}}class Rn{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 Rn(this.name);return e.representation=this.representation,e.leading=this.leading,e.trailing=this.trailing,e.suffix=this.suffix,e}}class gn{type="value";static type="value";representation;tag=null;betweenTagAndValue;constructor(e){this.value=e}clone(){let e=new gn(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 Rn(e)}}var $p=()=>{};class Lr{static createArgument(e){return new Lr(new gn(e),null)}static createProperty(e,t){return new Lr(new gn(t),new hn(e))}type="entry";static type="entry";name;value;leading;trailing;equals;constructor(e,t){this.value=e,this.name=t}clone(){let e=new Lr(this.value.clone(),this.name?.clone()??null);return e.leading=this.leading,e.trailing=this.trailing,e.equals=this.equals,e}getTag(){return this.value.getTag()}setTag(e){this.value.setTag(e)}getName(){return this.name?this.name.name:null}setName(e){this.name=e!=null?new hn(e):null}getValue(){return this.value.value}setValue(e){this.value=new gn(e)}isArgument(){return this.name==null}isProperty(){return this.name!=null}}var wp=M(()=>{$p()});function*Jo(e){for(let t=e.length-1;t>=0;t--)yield e[t]}function vp(e){return e.children??(e.children=new Ws)}class Mo{static create(e){return new Mo(new hn(e))}type="node";static type="node";name;tag=null;entries;children;leading;trailing;beforeChildren;betweenTagAndName;constructor(e,t=[],r=null){this.name=e,this.entries=t,this.children=r}clone({shallow:e=!1}={}){let t=new Mo(this.name.clone(),e?[]:this.entries.map((r)=>r.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 Rn(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,r){let n=Lr.createArgument(e);if(n.value.setTag(t),r!=null)for(let[s,i]of this.entries.entries()){if(!i.isArgument())continue;if(r===0){this.entries.splice(s,0,i);return}r--}this.entries.push(n)}removeArgument(e){for(let[t,r]of this.entries.entries()){if(!r.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 Jo(this.entries))if(t.getName()===e)return t;return}setProperty(e,t,r){for(let s of Jo(this.entries))if(s.getName()===e){s.setValue(t),s.value.setTag(r);return}let n=Lr.createProperty(e,t);n.value.setTag(r),this.entries.push(n)}deleteProperty(e){this.entries=this.entries.filter((t)=>t.getName()!==e)}hasChildren(){return this.children!=null&&!this.children.isEmpty()}appendNode(e){vp(this).appendNode(e)}insertNodeBefore(e,t){vp(this).insertNodeBefore(e,t)}insertNodeAfter(e,t){vp(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 Yb=M(()=>{Sp();wp()});function*Do(e){if(e instanceof Ws)yield*e.nodes;else yield e}class Ws{type="document";static type="document";nodes;trailing;constructor(e=[]){this.nodes=e}clone({shallow:e}={}){let t=new Ws(e?[]:this.nodes.map((r)=>r.clone()));return t.trailing=this.trailing,t}appendNode(e){this.nodes.push(...Do(e))}insertNodeBefore(e,t){if(t==null){this.nodes.push(...Do(e));return}let r=this.nodes.indexOf(t);if(r===-1)throw Error("Reference node is not in document");this.nodes.splice(r,0,...Do(e))}insertNodeAfter(e,t){if(t==null){this.nodes.unshift(...Do(e));return}let r=this.nodes.indexOf(t);if(r===-1)throw Error("Reference node is not in document");this.nodes.splice(r+1,0,...Do(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 r=this.nodes.indexOf(e);if(r===-1)throw Error("Node to replace is not in document");this.nodes.splice(r,1,...Do(t))}findNodesByName(e){return this.nodes.filter((t)=>t.name.name===e)}findNodeByName(e){for(let t of Jo(this.nodes))if(t.name.name===e)return t;return}findParameterizedNode(e,t){for(let r of Jo(this.nodes)){if(r.name.name!==e)continue;let n=r.getArguments();if(n.length!==1||t!==void 0&&n[0]!==t)continue;return r}return}removeNodesByName(e){this.nodes=this.nodes.filter((t)=>t.name.name!==e)}isEmpty(){return this.nodes.length===0}}var Sp=()=>{};var Zb=M(()=>{Sp();wp();Yb();$p()});function Qb(e,t,r){let n;while(n=HT.exec(t)){let s=gl(r,t,n.index);e.push(new Me("Raw strings with single quotes cannot contain any unescaped newlines, use triple-quotes for multiline strings",{token:r,start:s,end:{offset:s.offset+n[0].length,line:s.line+1,column:1}}))}return t}function ex(e,t,r){if(!Lo.test(t))return e.push(new Me("Raw strings with three quotes must be multiline strings",{token:r})),t;if(!Lo.test(t[0]))return e.push(new Me("Multi-line strings must start with a newline",{token:r})),t;let n=KT.exec(t)?.[1];if(n==null)return e.push(new Me("The final line in a multiline string may only contain whitespace",{token:r})),t;return t.replace(YT,(s,i,o,a,l)=>{if(!a)return`
12
+ `;if(!o.startsWith(n)){let c=gl(r,t,l+i.length);return e.push(new Me("Every non-blank line of a multi-line string must start with the offset defined by the last line of the string",{token:r,start:c,end:{offset:c.offset+n.length,line:c.line,column:c.column+n.length}})),`
13
13
  `}return`
14
- `+o.slice(n.length)+a}).slice(1,-1)}function Cb(e,t,r){let n;while(n=fT.exec(t)){let s=ll(r,t,n.indices[1][0]);e.push(new De("Strings with single quotes cannot contain any unescaped newlines, use triple-quotes for multiline strings",{token:r,start:s,end:{offset:s.offset+n[1].length,line:s.line+1,column:1}}))}return t.replace(gT,(s,i,o,a,l)=>Tb(e,t,r,s,i,o,a,l))}function Nb(e,t,r){if(!uT.test(t))return e.push(new De("Strings with three quotes must be multiline strings",{token:r})),t;if(!Io.test(t[0]))return e.push(new De("Multi-line strings must start with a newline",{token:r})),t;let n=pT.exec(t)?.[1];if(n==null){let s=hT.exec(t),i=s?ll(r,t,s.index):void 0,o="The final line in a multiline string may only contain whitespace";if(s?.[0][0]==="\\")o+=" after removing escaped whitespace";return e.push(new De(o,{token:r,start:i,end:i&&{offset:i.offset,line:i.line,column:i.column+1}})),t}return t.replace(yT,(s,i,o,a,l,c,u)=>{if(!i)return Tb(e,t,r,s,a,l,c,u);let p=t[u+i.length+(o?o.length:0)];if(Io.test(p))return`
15
- `;if(!o.startsWith(n)){let h=ll(r,t,u+i.length);return e.push(new De("Every non-blank line of a multi-line string must start with the offset defined by the last line of the string",{token:r,start:h,end:{offset:h.offset+n.length,line:h.line,column:h.column+n.length}})),`
14
+ `+o.slice(n.length)+a}).slice(1,-1)}function tx(e,t,r){let n;while(n=GT.exec(t)){let s=gl(r,t,n.indices[1][0]);e.push(new Me("Strings with single quotes cannot contain any unescaped newlines, use triple-quotes for multiline strings",{token:r,start:s,end:{offset:s.offset+n[1].length,line:s.line+1,column:1}}))}return t.replace(QT,(s,i,o,a,l)=>nx(e,t,r,s,i,o,a,l))}function rx(e,t,r){if(!zT.test(t))return e.push(new Me("Strings with three quotes must be multiline strings",{token:r})),t;if(!Lo.test(t[0]))return e.push(new Me("Multi-line strings must start with a newline",{token:r})),t;let n=XT.exec(t)?.[1];if(n==null){let s=ZT.exec(t),i=s?gl(r,t,s.index):void 0,o="The final line in a multiline string may only contain whitespace";if(s?.[0][0]==="\\")o+=" after removing escaped whitespace";return e.push(new Me(o,{token:r,start:i,end:i&&{offset:i.offset,line:i.line,column:i.column+1}})),t}return t.replace(eI,(s,i,o,a,l,c,u)=>{if(!i)return nx(e,t,r,s,a,l,c,u);let p=t[u+i.length+(o?o.length:0)];if(Lo.test(p))return`
15
+ `;if(!o.startsWith(n)){let h=gl(r,t,u+i.length);return e.push(new Me("Every non-blank line of a multi-line string must start with the offset defined by the last line of the string",{token:r,start:h,end:{offset:h.offset+n.length,line:h.line,column:h.column+n.length}})),`
16
16
  `}return`
17
- `+o.slice(n.length)}).slice(1,-1)}function Tb(e,t,r,n,s,i,o,a){if(o)return"";if(i){let l=r.text.startsWith('"""'),c=t.slice(0,a).split(Io),u={offset:r.start.offset+(l?3:1)+a,line:r.start.line+(c.length-1),column:c.length===1?r.start.column+(l?3:1)+a:c.at(-1).length},p={offset:u.offset+n.length,line:u.line,column:u.column+n.length};if(!i.startsWith("{"))e.push(new De(String.raw`Invalid unicode escape "\u${i}", did you forget to use {}? "\u{${i}}"`,{token:r,start:u,end:p}));else e.push(new De(String.raw`Invalid unicode escape "\u${i.endsWith("}")?i:`${i}...`}"`,{token:r,start:u,end:p}));return""}else if(s){let l=parseInt(s,16);if(l>=55296&&l<=57343)e.push(new De(String.raw`Invalid unicode escape "\u{${s}}, only scalar values can be added using an escape`,{token:r}));return String.fromCodePoint(l)}else{let l=lT.get(n);if(l==null)return e.push(new De(n.length<2?"Invalid whitespace escape at the end of a string":`Invalid escape "${n}"`,{token:r})),"";return l}}function ll(e,t,r){let n=1;switch(e.type){case _o:n=3;break;case Ds:n=e.text.indexOf('"')+1;break;case Ji:n=e.text.indexOf('"')+3;break}let s=t.slice(0,r).split(Io);return{offset:e.start.offset+n+r,line:e.start.line+(s.length-1),column:s.length===1?e.start.column+n+r:1+s[s.length-1].length}}var oX,lT,Io,cT,uT,fT,dT,pT,mT,hT,gT,yT;var Ib=D(()=>{Di();Ro();oX=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"]]),lT=new Map([["\\n",`
18
- `],["\\r","\r"],["\\t","\t"],["\\\\","\\"],["\\\"",'"'],["\\b","\b"],["\\f","\f"],["\\s"," "]]),Io=/\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029]/,cT=/\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029]/g,uT=/(?:^|[^\\\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,fT=/(?:^|[^\\\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;dT=/[\x0A\x0B\x0C\x0D\x85\u2028\u2029]([\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)$/,pT=/(?:^|[^\\\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]*)*$/,mT=/(\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,hT=/([^\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]*$/;gT=/\\(?:$|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;yT=/(\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 fs(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 Ge(e,t){if(!e.current.done&&e.current.value.type===t){let r=e.current.value;return fs(e),r}}function Re(e,t){let r="current"in e?e.current.value??e.lastToken:e;return new De(t,{token:r})}function $r(e,t,r,n=r){if(e.storeLocations)Pb(t,r,n)}function rr(e="",t="",r=""){return e+t+r||void 0}function Fc(e,t,{storeLocations:r=!1,flags:n}){let s={type:-1,text:"",start:{offset:0,line:1,column:1},end:{offset:0,line:1,column:1},errors:null},i={text:e,tokens:t[Symbol.iterator](),current:{done:!1,value:s},storeLocations:r,lastToken:s,errors:[],flags:n};return fs(i),i}function ap(e,t){if(!t&&!e.current.done&&e.current.value.type!==Ms)t=Re(e,`Unexpected token ${JSON.stringify(e.current.value.text)}, did you forget to quote an identifier?`);let r=e.errors??[];if(t!=null)if(t instanceof De)if(t.errors)r.push(...t.errors);else r.push(t);else r.push(new De(`An unexpected error occurred, ${String(t)}, this is likely a bug in the KDL parser`,{cause:t}));if(r.length)if(r.length===1)throw r[0];else throw new De("Encountered multiple errors",{errors:r})}function Dc(e){switch(e){case"#null":return null;case"#true":return!0;case"#false":return!1;case"#inf":return 1/0;case"#-inf":return-1/0;case"#nan":return NaN}}function Jb(e){return e==="inf"||e==="-inf"||e==="nan"||e==="true"||e==="false"||e==="null"||!1}function lp(e){let{value:t}=e.current,r,n,s,i,o,a=!1;if(t?.text[0]==="-"||t?.text[0]==="+")o=t.text[0];switch(t?.type){case En:{if(!e.flags.experimentalSuffixedNumbers)throw new De("Unreachable code: got a suffixed number from the tokenizer but the suffixed number flag is not set",{token:t});let u=o?t.text.slice(1):t.text,p=u.search(/[^0-9._]/);if(n=(o??"")+u.slice(0,p),r=Number.parseFloat(n.replaceAll("_","")),i=s=u.slice(p),Jb(s))e.errors.push(Re(e,`Invalid suffix ${s}, values that look like keywords cannot be used as suffix`))}break;case Oc:a=!0,r=(o==="-"?-1:1)*Number.parseInt(t.text.slice(o?3:2).replaceAll("_",""),2);break;case Rc:a=!0,r=(o==="-"?-1:1)*Number.parseInt(t.text.slice(o?3:2).replaceAll("_",""),8);break;case cs:a=!0,r=Number.parseFloat(t.text.replaceAll("_",""));break;case Ac:a=!0,r=(o==="-"?-1:1)*Number.parseInt(t.text.slice(o?3:2).replaceAll("_",""),16);break;case ko:if(r=Dc(t.text),r===void 0)if(r=null,Dc(t.text.toLowerCase())!==void 0)e.errors.push(Re(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(Re(e,`Invalid keyword ${t.text}, did you mean #null?`));break;case"#fals":case"#fasle":e.errors.push(Re(e,`Invalid keyword ${t.text}, did you mean #false?`));break;case"#ture":case"#treu":e.errors.push(Re(e,`Invalid keyword ${t.text}, did you mean #true?`));break;case"#ifn":e.errors.push(Re(e,`Invalid keyword ${t.text}, did you mean #inf?`));break;case"#-ifn":e.errors.push(Re(e,`Invalid keyword ${t.text}, did you mean #-inf?`));break;default:e.errors.push(Re(e,`Invalid keyword ${t.text}, surround it with quotes to use a string`))}break;default:return}fs(e);let l=e.flags.experimentalSuffixedNumbers&&Ge(e,ko);if(l)if(a){if(i=l.text,Dc(i)!==void 0)e.errors.push(Re(l,`Invalid number suffix ${i}, did you forget a space between the number and the keyword?`));s=i.slice(1)}else if(s)e.errors.push(Re(l,"Unexpected hashed suffix, a number can only have one suffix"));else if(typeof r==="number")e.errors.push(Re(l,"Unexpected hashed suffix, you cannot place suffixes on number keywords"));else e.errors.push(Re(l,"Unexpected hashed suffix, you can only place suffixes on numbers"));let c=new mn(r);if(c.representation=n??t.text,$r(e,c,t),s){let u=new Pn(s);u.representation=i,u.suffix=!0,$r(e,u,e.lastToken),c.tag=u}return c}function cl(e){if(e.current.done)return;let{value:t}=e.current,r;switch(t.type){case tr:if(fs(e),Jb(t.text))e.errors.push(Re(e,`Invalid keyword "${t.text}", add a leading # to use the keyword or surround with quotes to make it a string`));r=[t.text,t.text,t];break;case nl:fs(e),r=[Cb(e.errors,t.text.slice(1,-1),t),t.text,t];break;case _o:fs(e),r=[Nb(e.errors,t.text.slice(3,-3),t),t.text,t];break;case Ds:{fs(e);let n=t.text,s=n.indexOf('"');r=[Rb(e.errors,n.slice(s+1,-(s+1)),t),n,t];break}case Ji:{fs(e);let n=t.text,s=n.indexOf('"');r=[Ob(e.errors,n.slice(s+3,-(s+3)),t),n,t];break}default:return}if(Ge(e,ko))e.errors.push(Re(e.lastToken,Dc(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 r}function cp(e){let t=cl(e);if(!t)return;let r=new pn(t[0]);return r.representation=t[1],$r(e,r,t[2],e.lastToken),r}function Lc(e){let t=lp(e);if(t)return t;let r=cl(e);if(!r)return;let n=new mn(r[0]);return n.representation=r[1],$r(e,n,r[2],e.lastToken),n}function ul(e){let t=Ge(e,Nc);if(!t)return;let{value:r}=e.current;return fs(e),t.text+(r?.text??"")}function qc(e){return Ge(e,Tc)?.text}function up(e){return Ge(e,Ii)??qc(e)}function Vc(e){let t=Ge(e,Cc);if(!t)return;while(up(e));if(!ul(e)&&!Ge(e,Ls)&&!Ge(e,Ms))e.errors.push(Re(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 Vs(e){let t=e.lastToken.end;while(Ge(e,Ls)?.text??ul(e)??up(e)??Vc(e));if(e.lastToken.end===t)return;return e.text.slice(t.offset,e.lastToken.end.offset)}function _t(e){let t=e.lastToken.end;while(up(e)??Vc(e));if(e.lastToken.end===t)return;return e.text.slice(t.offset,e.lastToken.end.offset)}function op(e){let t=Ge(e,jc);if(!t)return;let r=_t(e),n=cl(e);if(!n&&e.current.value){let a=e.current.value;if(Vs(e))e.errors.push(Re(a,"This type of whitespace is not allowed inside a tag"));n=cl(e)}if(!n){if(lp(e))e.errors.push(Re(e,"Invalid tag, did you forget to quote a string?")),n=["error","error"]}if(!n)throw Re(e,"Invalid tag, did you forget to quote a string?");let s=_t(e),i=Ge(e,rl);if(!i&&e.current.value){let a=e.current.value;if(Vs(e))e.errors.push(Re(a,"This type of whitespace is not allowed inside a tag"));i=Ge(e,rl)}if(!i)throw Re(e,"Invalid tag, did you forget to quote a string?");let o=new Pn(n[0]);return o.representation=n[1],o.leading=r,o.trailing=s,$r(e,o,t,e.lastToken),o}function Wc(e){return ul(e)??Ge(e,Ls)?.text??Ge(e,_c)?.text??Ge(e,Ms)?.text}function fp(e){if(!Ge(e,Pc))return;let t=Fb(e);if(!Ge(e,kc))throw Re(e,"Invalid node children");return t}function Jo(e){let t=e.current.value;{let p=op(e);if(p){let h=_t(e),m=Lc(e);if(!m)throw Re(e,"Invalid argument");if(m.tag)e.errors.push(Re(e.lastToken,"A number suffix cannot be combined with a regular tag"));m.tag=p,m.betweenTagAndValue=h;let b=new Lr(m,null);$r(e,m,t,e.lastToken),$r(e,b,t,e.lastToken);let g=_t(e);if(Ge(e,Po))e.errors.push(Re(e.lastToken,typeof m.value==="string"?"Unexpected equals sign, properties are name=(tag)value not (tag)name=value":"Unexpected equals sign")),g=rr(g,_t(e))||" ";return[b,g]}}{let p=lp(e);if(p){let h=new Lr(p,null);$r(e,h,t,e.lastToken);let m=_t(e);if(Ge(e,Po))e.errors.push(Re(e.lastToken,"Unexpected equals sign, did you forget to quote the property name?")),m=rr(m,_t(e))||" ";return[h,m]}}let r=cl(e);if(!r)return;let n=_t(e),s=Ge(e,Po);if(!s){let p=new mn(r[0]);p.representation=r[1],$r(e,p,r[2]);let h=new Lr(p,null);return $r(e,h,t,e.lastToken),[h,n]}let i=new pn(r[0]);i.representation=r[1],$r(e,i,r[2]);let o=_t(e),a=op(e),l=a&&_t(e),c=Lc(e);if(!c)throw Re(e,"Expected a value");if(a){if(c.tag)e.errors.push(Re(e.lastToken,"A number suffix cannot be combined with a regular tag"));c.tag=a,c.betweenTagAndValue=l}let u=new Lr(c,i);return $r(e,u,t,e.lastToken),u.equals=rr(n,s.text,o),[u,void 0]}function Mb(e){let t=_t(e)??"",r;while(r=qi(e)){let o=e.lastToken.end,a=Jo(e);if(!a)throw Re(e,"Expected a property or argument");if(!(a[1]??_t(e)))throw Re(e,"Expected space after slashdashed property or argument");t=t+r+e.text.slice(o.offset,e.lastToken.end.offset)}let n=Jo(e);if(!n)return;let s=n[1]??_t(e)??"";while(r=qi(e)){let o=e.lastToken.end,a=Jo(e);if(!a)throw Re(e,"Expected a property or argument");if(!(a[1]??_t(e)))break;s=s+r+e.text.slice(o.offset,e.lastToken.end.offset)}let i=n[0];return i.leading=t,i.trailing=s,i}function qi(e){let t=Ge(e,Ti)?.text;if(!t)return;return rr(t,Vs(e))}function Bc(e){let t=e.current.value,r=op(e),n=r&&_t(e),s=cp(e);if(!s)if(r)throw Re(e,"Couldn't find node name");else return;let i=_t(e),o=i!=null,a=qi(e),l=[];while(o||a){let h=e.lastToken.end,m=Jo(e);if(!m)break;if(a)o=(m[1]||_t(e))!=null,i=rr(i,a,e.text.slice(h.offset,e.lastToken.end.offset)),a=qi(e);else{let b=m[0];b.leading=i,l.push(b),i=m[1]||_t(e),o=i!=null,a=qi(e)}}let c,u;while(!0){a??=qi(e);let h=e.lastToken.end,m=fp(e);if(!m){if(a)throw Re(e,"Unexpected slashdash");break}if(a)i=rr(i,a,e.text.slice(h.offset,e.lastToken.end.offset)),a=void 0;else{if(c)e.errors.push(Re(e,"A node can only have one children block"));c=m,u=i??"",i=void 0}i=rr(i,_t(e))}let p=new No(s,l,c);return p.tag=r??null,p.betweenTagAndName=n,p.beforeChildren=u,p.trailing=i??"",$r(e,p,t,e.lastToken),p}function Db(e){let t=Vs(e),r=Bc(e);if(!r)return;let n=rr(Wc(e),Vs(e));return r.leading=rr(t,r.leading),r.trailing=rr(r.trailing,n),r}function Lb(e){let t=Ge(e,jo)?.text,r=Fb(e);if(!t)return r;if(r.nodes[0])r.nodes[0].leading=rr(t,r.nodes[0].leading);else r.trailing=rr(t,r.trailing);return r}function Fb(e){let t=e.current.value,r=[],n=!0,s=Vs(e);while(n){let o=e.lastToken.end,a=qi(e),l=Bc(e);if(!l){if(a)throw Re(e,"Unexpected slashdash");break}let c=_t(e),u=Wc(e);if(a)s=rr(s,e.text.slice(o.offset,e.lastToken.end.offset),Vs(e));else l.trailing=rr(l.trailing,c,u)??"",r.push(l),l.leading=s??"",s=Vs(e);n=u!=null}let i=new qs(r);return $r(e,i,t,e.lastToken),i.trailing=s??"",i}var dp=D(()=>{Di();tp();Ab();Ib();Ro()});function qb(e,t){let r=[],n;while(n=t(e))r.push(n);return r.length>0?r:void 0}function bT(e){{let t=Ge(e,jo);if(t)return{type:"bom",text:t.text}}{let t=Ge(e,Ls);if(t)return{type:"newline",text:t.text}}{let t=Ge(e,Ii);if(t)return{type:"space",text:t.text}}{let t=ul(e);if(t)return{type:"singleline",text:t}}{let t=qc(e);if(t)return{type:"multiline",text:t}}return}function Hc(e){{let t=Vc(e);if(t)return{type:"line-escape",text:t}}{let t=Ge(e,Ii);if(t)return{type:"space",text:t.text}}{let t=qc(e);if(t)return{type:"multiline",text:t}}return}function Vb(e){let t=[];while(!0){{let r=bT(e);if(r){t.push(r);continue}}if(Ge(e,Ti)?.text){let n,s=qb(e,Hc)??[],i=Bc(e);if(!i)throw Re(e,"Invalid slashdash, expected a commented node");i.trailing=rr(i.trailing,qb(e,Hc)?.map((o)=>o.text).join(""),Wc(e)),t.push({type:"slashdash",preface:s,value:i});continue}break}return t}function xT(e){let t=Ge(e,Ti);if(t==null)return;let r,n=[];while(r=Hc(e))n.push(r);let s,i,o="";if(i=Jo(e)){if(s=i[0],i[1])o=i[1]}else if(i=fp(e))s=i;else throw Re(t,"Couldn't find argument, property, or children that were commented by slashdash");return[{type:"slashdash",preface:n,value:s},o]}function pp(e){let t=[];while(!0){let r=Hc(e);if(!r)break;let n=!0;t.push(r);while(n){let s=xT(e);if(!s)break;if(t.push(s[0]),s[1][0])t.push(...pp(Fc(s[1][0],al(s[1][0],{flags:e.flags}),{flags:e.flags})));n=!!s[1][0]}}return t}var Wb=D(()=>{Ro();dp()});function Ws(e,{as:t="document",flags:r,...n}={}){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 i=kb(r),o=al(e,{...n,flags:i}),a=Fc(e,o,{...n,flags:i}),l;try{l=s(a)}catch(c){ap(a,c)}if(ap(a),!l)throw new De(`Expected ${/^[aeiouy]/.exec(t)?"an":"a"} ${t}`);return l}var $T;var Bb=D(()=>{Di();Ro();dp();Wb();$T={value:Lc,identifier:cp,node:Db,entry:Mb,document:Lb,"whitespace in document":Vb,"whitespace in node":pp}});var Uc=D(()=>{Di();tp();Bb()});function Mo(e,t){let r=e.slice(0,t),n=r.split(`
17
+ `+o.slice(n.length)}).slice(1,-1)}function nx(e,t,r,n,s,i,o,a){if(o)return"";if(i){let l=r.text.startsWith('"""'),c=t.slice(0,a).split(Lo),u={offset:r.start.offset+(l?3:1)+a,line:r.start.line+(c.length-1),column:c.length===1?r.start.column+(l?3:1)+a:c.at(-1).length},p={offset:u.offset+n.length,line:u.line,column:u.column+n.length};if(!i.startsWith("{"))e.push(new Me(String.raw`Invalid unicode escape "\u${i}", did you forget to use {}? "\u{${i}}"`,{token:r,start:u,end:p}));else e.push(new Me(String.raw`Invalid unicode escape "\u${i.endsWith("}")?i:`${i}...`}"`,{token:r,start:u,end:p}));return""}else if(s){let l=parseInt(s,16);if(l>=55296&&l<=57343)e.push(new Me(String.raw`Invalid unicode escape "\u{${s}}, only scalar values can be added using an escape`,{token:r}));return String.fromCodePoint(l)}else{let l=UT.get(n);if(l==null)return e.push(new Me(n.length<2?"Invalid whitespace escape at the end of a string":`Invalid escape "${n}"`,{token:r})),"";return l}}function gl(e,t,r){let n=1;switch(e.type){case No:n=3;break;case qs:n=e.text.indexOf('"')+1;break;case Di:n=e.text.indexOf('"')+3;break}let s=t.slice(0,r).split(Lo);return{offset:e.start.offset+n+r,line:e.start.line+(s.length-1),column:s.length===1?e.start.column+n+r:1+s[s.length-1].length}}var $Z,UT,Lo,HT,zT,GT,KT,XT,YT,ZT,QT,eI;var sx=M(()=>{Fi();To();$Z=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"]]),UT=new Map([["\\n",`
18
+ `],["\\r","\r"],["\\t","\t"],["\\\\","\\"],["\\\"",'"'],["\\b","\b"],["\\f","\f"],["\\s"," "]]),Lo=/\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029]/,HT=/\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029]/g,zT=/(?:^|[^\\\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,GT=/(?:^|[^\\\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;KT=/[\x0A\x0B\x0C\x0D\x85\u2028\u2029]([\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)$/,XT=/(?:^|[^\\\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]*)*$/,YT=/(\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,ZT=/([^\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]*$/;QT=/\\(?:$|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;eI=/(\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 hs(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 Ge(e,t){if(!e.current.done&&e.current.value.type===t){let r=e.current.value;return hs(e),r}}function Re(e,t){let r="current"in e?e.current.value??e.lastToken:e;return new Me(t,{token:r})}function wr(e,t,r,n=r){if(e.storeLocations)Kb(t,r,n)}function rr(e="",t="",r=""){return e+t+r||void 0}function eu(e,t,{storeLocations:r=!1,flags:n}){let s={type:-1,text:"",start:{offset:0,line:1,column:1},end:{offset:0,line:1,column:1},errors:null},i={text:e,tokens:t[Symbol.iterator](),current:{done:!1,value:s},storeLocations:r,lastToken:s,errors:[],flags:n};return hs(i),i}function Pp(e,t){if(!t&&!e.current.done&&e.current.value.type!==Fs)t=Re(e,`Unexpected token ${JSON.stringify(e.current.value.text)}, did you forget to quote an identifier?`);let r=e.errors??[];if(t!=null)if(t instanceof Me)if(t.errors)r.push(...t.errors);else r.push(t);else r.push(new Me(`An unexpected error occurred, ${String(t)}, this is likely a bug in the KDL parser`,{cause:t}));if(r.length)if(r.length===1)throw r[0];else throw new Me("Encountered multiple errors",{errors:r})}function Zc(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 ix(e){return e==="inf"||e==="-inf"||e==="nan"||e==="true"||e==="false"||e==="null"||!1}function jp(e){let{value:t}=e.current,r,n,s,i,o,a=!1;if(t?.text[0]==="-"||t?.text[0]==="+")o=t.text[0];switch(t?.type){case _n:{if(!e.flags.experimentalSuffixedNumbers)throw new Me("Unreachable code: got a suffixed number from the tokenizer but the suffixed number flag is not set",{token:t});let u=o?t.text.slice(1):t.text,p=u.search(/[^0-9._]/);if(n=(o??"")+u.slice(0,p),r=Number.parseFloat(n.replaceAll("_","")),i=s=u.slice(p),ix(s))e.errors.push(Re(e,`Invalid suffix ${s}, values that look like keywords cannot be used as suffix`))}break;case Uc:a=!0,r=(o==="-"?-1:1)*Number.parseInt(t.text.slice(o?3:2).replaceAll("_",""),2);break;case Wc:a=!0,r=(o==="-"?-1:1)*Number.parseInt(t.text.slice(o?3:2).replaceAll("_",""),8);break;case ps:a=!0,r=Number.parseFloat(t.text.replaceAll("_",""));break;case Bc:a=!0,r=(o==="-"?-1:1)*Number.parseInt(t.text.slice(o?3:2).replaceAll("_",""),16);break;case Oo:if(r=Zc(t.text),r===void 0)if(r=null,Zc(t.text.toLowerCase())!==void 0)e.errors.push(Re(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(Re(e,`Invalid keyword ${t.text}, did you mean #null?`));break;case"#fals":case"#fasle":e.errors.push(Re(e,`Invalid keyword ${t.text}, did you mean #false?`));break;case"#ture":case"#treu":e.errors.push(Re(e,`Invalid keyword ${t.text}, did you mean #true?`));break;case"#ifn":e.errors.push(Re(e,`Invalid keyword ${t.text}, did you mean #inf?`));break;case"#-ifn":e.errors.push(Re(e,`Invalid keyword ${t.text}, did you mean #-inf?`));break;default:e.errors.push(Re(e,`Invalid keyword ${t.text}, surround it with quotes to use a string`))}break;default:return}hs(e);let l=e.flags.experimentalSuffixedNumbers&&Ge(e,Oo);if(l)if(a){if(i=l.text,Zc(i)!==void 0)e.errors.push(Re(l,`Invalid number suffix ${i}, did you forget a space between the number and the keyword?`));s=i.slice(1)}else if(s)e.errors.push(Re(l,"Unexpected hashed suffix, a number can only have one suffix"));else if(typeof r==="number")e.errors.push(Re(l,"Unexpected hashed suffix, you cannot place suffixes on number keywords"));else e.errors.push(Re(l,"Unexpected hashed suffix, you can only place suffixes on numbers"));let c=new gn(r);if(c.representation=n??t.text,wr(e,c,t),s){let u=new Rn(s);u.representation=i,u.suffix=!0,wr(e,u,e.lastToken),c.tag=u}return c}function yl(e){if(e.current.done)return;let{value:t}=e.current,r;switch(t.type){case tr:if(hs(e),ix(t.text))e.errors.push(Re(e,`Invalid keyword "${t.text}", add a leading # to use the keyword or surround with quotes to make it a string`));r=[t.text,t.text,t];break;case fl:hs(e),r=[tx(e.errors,t.text.slice(1,-1),t),t.text,t];break;case No:hs(e),r=[rx(e.errors,t.text.slice(3,-3),t),t.text,t];break;case qs:{hs(e);let n=t.text,s=n.indexOf('"');r=[Qb(e.errors,n.slice(s+1,-(s+1)),t),n,t];break}case Di:{hs(e);let n=t.text,s=n.indexOf('"');r=[ex(e.errors,n.slice(s+3,-(s+3)),t),n,t];break}default:return}if(Ge(e,Oo))e.errors.push(Re(e.lastToken,Zc(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 r}function kp(e){let t=yl(e);if(!t)return;let r=new hn(t[0]);return r.representation=t[1],wr(e,r,t[2],e.lastToken),r}function Qc(e){let t=jp(e);if(t)return t;let r=yl(e);if(!r)return;let n=new gn(r[0]);return n.representation=r[1],wr(e,n,r[2],e.lastToken),n}function bl(e){let t=Ge(e,zc);if(!t)return;let{value:r}=e.current;return hs(e),t.text+(r?.text??"")}function tu(e){return Ge(e,Gc)?.text}function _p(e){return Ge(e,Mi)??tu(e)}function ru(e){let t=Ge(e,Hc);if(!t)return;while(_p(e));if(!bl(e)&&!Ge(e,Vs)&&!Ge(e,Fs))e.errors.push(Re(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 Us(e){let t=e.lastToken.end;while(Ge(e,Vs)?.text??bl(e)??_p(e)??ru(e));if(e.lastToken.end===t)return;return e.text.slice(t.offset,e.lastToken.end.offset)}function _t(e){let t=e.lastToken.end;while(_p(e)??ru(e));if(e.lastToken.end===t)return;return e.text.slice(t.offset,e.lastToken.end.offset)}function Ep(e){let t=Ge(e,Lc);if(!t)return;let r=_t(e),n=yl(e);if(!n&&e.current.value){let a=e.current.value;if(Us(e))e.errors.push(Re(a,"This type of whitespace is not allowed inside a tag"));n=yl(e)}if(!n){if(jp(e))e.errors.push(Re(e,"Invalid tag, did you forget to quote a string?")),n=["error","error"]}if(!n)throw Re(e,"Invalid tag, did you forget to quote a string?");let s=_t(e),i=Ge(e,ul);if(!i&&e.current.value){let a=e.current.value;if(Us(e))e.errors.push(Re(a,"This type of whitespace is not allowed inside a tag"));i=Ge(e,ul)}if(!i)throw Re(e,"Invalid tag, did you forget to quote a string?");let o=new Rn(n[0]);return o.representation=n[1],o.leading=r,o.trailing=s,wr(e,o,t,e.lastToken),o}function nu(e){return bl(e)??Ge(e,Vs)?.text??Ge(e,Vc)?.text??Ge(e,Fs)?.text}function Ap(e){if(!Ge(e,Fc))return;let t=cx(e);if(!Ge(e,qc))throw Re(e,"Invalid node children");return t}function Fo(e){let t=e.current.value;{let p=Ep(e);if(p){let h=_t(e),m=Qc(e);if(!m)throw Re(e,"Invalid argument");if(m.tag)e.errors.push(Re(e.lastToken,"A number suffix cannot be combined with a regular tag"));m.tag=p,m.betweenTagAndValue=h;let y=new Lr(m,null);wr(e,m,t,e.lastToken),wr(e,y,t,e.lastToken);let g=_t(e);if(Ge(e,Ro))e.errors.push(Re(e.lastToken,typeof m.value==="string"?"Unexpected equals sign, properties are name=(tag)value not (tag)name=value":"Unexpected equals sign")),g=rr(g,_t(e))||" ";return[y,g]}}{let p=jp(e);if(p){let h=new Lr(p,null);wr(e,h,t,e.lastToken);let m=_t(e);if(Ge(e,Ro))e.errors.push(Re(e.lastToken,"Unexpected equals sign, did you forget to quote the property name?")),m=rr(m,_t(e))||" ";return[h,m]}}let r=yl(e);if(!r)return;let n=_t(e),s=Ge(e,Ro);if(!s){let p=new gn(r[0]);p.representation=r[1],wr(e,p,r[2]);let h=new Lr(p,null);return wr(e,h,t,e.lastToken),[h,n]}let i=new hn(r[0]);i.representation=r[1],wr(e,i,r[2]);let o=_t(e),a=Ep(e),l=a&&_t(e),c=Qc(e);if(!c)throw Re(e,"Expected a value");if(a){if(c.tag)e.errors.push(Re(e.lastToken,"A number suffix cannot be combined with a regular tag"));c.tag=a,c.betweenTagAndValue=l}let u=new Lr(c,i);return wr(e,u,t,e.lastToken),u.equals=rr(n,s.text,o),[u,void 0]}function ox(e){let t=_t(e)??"",r;while(r=Bi(e)){let o=e.lastToken.end,a=Fo(e);if(!a)throw Re(e,"Expected a property or argument");if(!(a[1]??_t(e)))throw Re(e,"Expected space after slashdashed property or argument");t=t+r+e.text.slice(o.offset,e.lastToken.end.offset)}let n=Fo(e);if(!n)return;let s=n[1]??_t(e)??"";while(r=Bi(e)){let o=e.lastToken.end,a=Fo(e);if(!a)throw Re(e,"Expected a property or argument");if(!(a[1]??_t(e)))break;s=s+r+e.text.slice(o.offset,e.lastToken.end.offset)}let i=n[0];return i.leading=t,i.trailing=s,i}function Bi(e){let t=Ge(e,Ji)?.text;if(!t)return;return rr(t,Us(e))}function su(e){let t=e.current.value,r=Ep(e),n=r&&_t(e),s=kp(e);if(!s)if(r)throw Re(e,"Couldn't find node name");else return;let i=_t(e),o=i!=null,a=Bi(e),l=[];while(o||a){let h=e.lastToken.end,m=Fo(e);if(!m)break;if(a)o=(m[1]||_t(e))!=null,i=rr(i,a,e.text.slice(h.offset,e.lastToken.end.offset)),a=Bi(e);else{let y=m[0];y.leading=i,l.push(y),i=m[1]||_t(e),o=i!=null,a=Bi(e)}}let c,u;while(!0){a??=Bi(e);let h=e.lastToken.end,m=Ap(e);if(!m){if(a)throw Re(e,"Unexpected slashdash");break}if(a)i=rr(i,a,e.text.slice(h.offset,e.lastToken.end.offset)),a=void 0;else{if(c)e.errors.push(Re(e,"A node can only have one children block"));c=m,u=i??"",i=void 0}i=rr(i,_t(e))}let p=new Mo(s,l,c);return p.tag=r??null,p.betweenTagAndName=n,p.beforeChildren=u,p.trailing=i??"",wr(e,p,t,e.lastToken),p}function ax(e){let t=Us(e),r=su(e);if(!r)return;let n=rr(nu(e),Us(e));return r.leading=rr(t,r.leading),r.trailing=rr(r.trailing,n),r}function lx(e){let t=Ge(e,Ao)?.text,r=cx(e);if(!t)return r;if(r.nodes[0])r.nodes[0].leading=rr(t,r.nodes[0].leading);else r.trailing=rr(t,r.trailing);return r}function cx(e){let t=e.current.value,r=[],n=!0,s=Us(e);while(n){let o=e.lastToken.end,a=Bi(e),l=su(e);if(!l){if(a)throw Re(e,"Unexpected slashdash");break}let c=_t(e),u=nu(e);if(a)s=rr(s,e.text.slice(o.offset,e.lastToken.end.offset),Us(e));else l.trailing=rr(l.trailing,c,u)??"",r.push(l),l.leading=s??"",s=Us(e);n=u!=null}let i=new Ws(r);return wr(e,i,t,e.lastToken),i.trailing=s??"",i}var Rp=M(()=>{Fi();xp();Zb();sx();To()});function ux(e,t){let r=[],n;while(n=t(e))r.push(n);return r.length>0?r:void 0}function tI(e){{let t=Ge(e,Ao);if(t)return{type:"bom",text:t.text}}{let t=Ge(e,Vs);if(t)return{type:"newline",text:t.text}}{let t=Ge(e,Mi);if(t)return{type:"space",text:t.text}}{let t=bl(e);if(t)return{type:"singleline",text:t}}{let t=tu(e);if(t)return{type:"multiline",text:t}}return}function iu(e){{let t=ru(e);if(t)return{type:"line-escape",text:t}}{let t=Ge(e,Mi);if(t)return{type:"space",text:t.text}}{let t=tu(e);if(t)return{type:"multiline",text:t}}return}function fx(e){let t=[];while(!0){{let r=tI(e);if(r){t.push(r);continue}}if(Ge(e,Ji)?.text){let n,s=ux(e,iu)??[],i=su(e);if(!i)throw Re(e,"Invalid slashdash, expected a commented node");i.trailing=rr(i.trailing,ux(e,iu)?.map((o)=>o.text).join(""),nu(e)),t.push({type:"slashdash",preface:s,value:i});continue}break}return t}function rI(e){let t=Ge(e,Ji);if(t==null)return;let r,n=[];while(r=iu(e))n.push(r);let s,i,o="";if(i=Fo(e)){if(s=i[0],i[1])o=i[1]}else if(i=Ap(e))s=i;else throw Re(t,"Couldn't find argument, property, or children that were commented by slashdash");return[{type:"slashdash",preface:n,value:s},o]}function Op(e){let t=[];while(!0){let r=iu(e);if(!r)break;let n=!0;t.push(r);while(n){let s=rI(e);if(!s)break;if(t.push(s[0]),s[1][0])t.push(...Op(eu(s[1][0],hl(s[1][0],{flags:e.flags}),{flags:e.flags})));n=!!s[1][0]}}return t}var dx=M(()=>{To();Rp()});function Hs(e,{as:t="document",flags:r,...n}={}){let s=nI[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 i=Xb(r),o=hl(e,{...n,flags:i}),a=eu(e,o,{...n,flags:i}),l;try{l=s(a)}catch(c){Pp(a,c)}if(Pp(a),!l)throw new Me(`Expected ${/^[aeiouy]/.exec(t)?"an":"a"} ${t}`);return l}var nI;var px=M(()=>{Fi();To();Rp();dx();nI={value:Qc,identifier:kp,node:ax,entry:ox,document:lx,"whitespace in document":fx,"whitespace in node":Op}});var ou=M(()=>{Fi();xp();px()});function qo(e,t){let r=e.slice(0,t),n=r.split(`
19
19
  `).length;return{column:t-r.lastIndexOf(`
20
- `),line:n,offset:t}}var Bt;var Do=D(()=>{Bt=class Bt 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 Bt(`${e}: ${this.reason}`,t)}}});var Hb;var Ub=D(()=>{Hb=new Set(["onabort","onactivate","onaddsourcebuffer","onaddtrack","onadvertisementreceived","onafterprint","onanimationcancel","onanimationend","onanimationiteration","onanimationstart","onappinstalled","onaudioend","onaudioprocess","onaudiostart","onauxclick","onavailabilitychanged","onbackgroundfetchabort","onbackgroundfetchclick","onbackgroundfetchfail","onbackgroundfetchsuccess","onbeforeinput","onbeforeinstallprompt","onbeforematch","onbeforeprint","onbeforetoggle","onbeforexrselect","onbegin","onblocked","onblur","onboundary","onbufferedamountlow","onbufferedchange","oncancel","oncanmakepayment","oncanplay","oncanplaythrough","oncaptureaction","oncapturedmousechange","oncapturehandlechange","onchange","oncharacterboundsupdate","oncharacteristicvaluechanged","onchargingchange","onchargingtimechange","onclick","onclose","onclosing","oncommand","oncomplete","oncompositionend","oncompositionstart","onconfigurationchange","onconnect","onconnecting","onconnectionavailable","onconnectionstatechange","oncontentdelete","oncontextlost","oncontextmenu","oncontextoverflow","oncontextrestored","oncontrollerchange","oncookiechange","oncopy","oncuechange","oncurrententrychange","oncurrentscreenchange","oncut","ondataavailable","ondatachannel","ondblclick","ondequeue","ondevicechange","ondevicemotion","ondeviceorientation","ondeviceorientationabsolute","ondischargingtimechange","ondisconnect","ondispose","ondownloadprogress","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onencrypted","onend","onended","onendstreaming","onenter","onenterpictureinpicture","onerror","onexit","onfencedtreeclick","onfetch","onfinish","onfocus","onformdata","onframeratechange","onfreeze","onfullscreenchange","onfullscreenerror","ongamepadconnected","ongamepaddisconnected","ongatheringstatechange","ongattserverdisconnected","ongeometrychange","ongotpointercapture","onhashchange","onicecandidate","onicecandidateerror","oniceconnectionstatechange","onicegatheringstatechange","oninput","oninputreport","oninputsourceschange","oninstall","oninstallresult","oninvalid","onisolationchange","onkeydown","onkeyframerequest","onkeypress","onkeystatuseschange","onkeyup","onlanguagechange","onlayoutchange","onleavepictureinpicture","onlevelchange","onload","onloadeddata","onloadedmetadata","onloadend","onloading","onloadingdone","onloadingerror","onloadstart","onlocation","onlostpointercapture","onmanagedconfigurationchange","onmark","onmessage","onmessageerror","onmidimessage","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onmute","onnavigate","onnavigateerror","onnavigatesuccess","onnegotiationneeded","onnomatch","onnotificationclick","onnotificationclose","onoffline","ononline","onopen","onorientationchange","onpagehide","onpagereveal","onpageshow","onpageswap","onpaste","onpause","onpayerdetailchange","onpaymentmethodchange","onpaymentrequest","onperiodicsync","onplay","onplaying","onpointercancel","onpointerdown","onpointerenter","onpointerleave","onpointerlockchange","onpointerlockerror","onpointermove","onpointerout","onpointerover","onpointerrawupdate","onpointerup","onpopstate","onportalactivate","onprerenderingchange","onprioritychange","onprocessorerror","onprogress","onpromptaction","onpromptdismiss","onpush","onpushsubscriptionchange","onquotaoverflow","onratechange","onreading","onreadingerror","onreadystatechange","onredraw","onreflectionchange","onrejectionhandled","onrelease","onremove","onremovesourcebuffer","onremovetrack","onrepeat","onreset","onresize","onresourcetimingbufferfull","onresult","onresume","onrtctransform","onscreenschange","onscroll","onscrollend","onsecuritypolicyviolation","onseeked","onseeking","onselect","onselectedcandidatepairchange","onselectend","onselectionchange","onselectstart","onserviceadded","onservicechanged","onserviceremoved","onshippingaddresschange","onshippingoptionchange","onshow","onsignalingstatechange","onsinkchange","onslotchange","onsnapchanged","onsnapchanging","onsoundend","onsoundstart","onsourceclose","onsourceended","onsourceopen","onspeechend","onspeechstart","onsqueeze","onsqueezeend","onsqueezestart","onstalled","onstart","onstartstreaming","onstatechange","onstop","onstorage","onstream","onsubmit","onsuccess","onsuspend","onsync","onterminate","ontextformatupdate","ontextupdate","ontimeout","ontimeupdate","ontoggle","ontonechange","ontoolactivated","ontoolcancel","ontoolchange","ontouchcancel","ontouchend","ontouchmove","ontouchstart","ontrack","ontransitioncancel","ontransitionend","ontransitionrun","ontransitionstart","onuncapturederror","onunhandledrejection","onunload","onunmute","onupdate","onupdateend","onupdatefound","onupdatestart","onupgradeneeded","onvalidationstatuschange","onversionchange","onvisibilitychange","onvoiceschanged","onvolumechange","onwaiting","onwaitingforkey","onwebkitanimationend","onwebkitanimationiteration","onwebkitanimationstart","onwebkittransitionend","onwheel","onzoomlevelchange"])});function Je(e,t,r,n,s){let i=t.normalize("NFC");if(i==="__proto__")throw Fe(n,s,'"__proto__" cannot be a key: it would not be data');if(Object.hasOwn(e,i))throw Fe(n,s,`"${i}" is written twice, and one of them would be lost`);e[i]=r}function Fe(e,t,r){let n=zb(t)?.start;return new Bt(r,n===void 0?null:Mo(e.text,n))}function zb(e){let t=Oo(e);return t?{end:t.end.offset,start:t.start.offset}:null}function Ht(e,t,r){let n=e.spans?zb(r):null;if(n)e.spans?.set(t,n)}function Fr(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function Lo(e,t){let r=t.getTag();if(r!==null&&!vT.has(r))throw Fe(e,t,`(${r}) is not an annotation Jx Notation has`);if(r==="ref")throw Fe(e,t,"(ref) annotates a value, and this is a name");return r}function Fo(e,t){let r=t.getTag(),n=t.getValue();if(r!==null&&r!=="ref")throw Fe(e,t,`(${r}) cannot annotate a value here; only (ref) can`);if(Nt(n)){if(!Number.isFinite(n))throw Fe(e,t,"JSON has no way to hold #inf or #nan");if(Number.isInteger(n)&&!Number.isSafeInteger(n))throw Fe(e,t,"This number is too large to survive being read as JSON")}if(r==="ref"){if(!O(n))throw Fe(e,t,"(ref) needs a string");return{$ref:n}}return n}function ds(e,t){return t.entries.filter((r)=>!r.name).map((r)=>Fo(e,r))}function ps(e){return e.entries.filter((t)=>t.name)}function wr(e){return e.children?.nodes??[]}function fl(e){return e.getName()??""}function ET(e,t,r){let n={$prototype:"Function"},s=ds(e,t),i=wr(t);for(let o of ps(t))Je(n,fl(o),Fo(e,o),e,o);if(i.length>0){if(s.length>0)Je(n,"parameters",s,e,t);Je(n,"body",mp(e,i,`${r}/body`),e,t)}else if(s.length>0){let o=s.at(-1)??null,a=s.slice(0,-1);if(a.length>0)Je(n,"parameters",a,e,t);Je(n,"body",o,e,t)}return Ht(e,r,t),n}function mp(e,t,r){return t.map((n,s)=>{if(n.getName()!=="-")throw Fe(e,n,`A list holds only "-" items, and this is "${n.getName()}"`);return zr(e,n,`${r}/${s}`)})}function zr(e,t,r){let n=Lo(e,t);if(Ht(e,r,t),n==="fn")return ET(e,t,r);let s=ds(e,t),i=ps(t),o=wr(t);if(n==="array"){if(i.length>0)throw Fe(e,t,"(array) holds items, and these are named");return[...s,...mp(e,o,r)]}if(n!=="object"){if(s.length>1){if(i.length>0||o.length>0)throw Fe(e,t,"A list of values cannot also have names or a block");return s}if(s.length===1){if(i.length>0||o.length>0)throw Fe(e,t,"A value cannot also have names or a block");return s[0]??null}if(o.length>0&&i.length===0&&o.every((l)=>l.getName()==="-"))return mp(e,o,r)}else if(s.length>0)throw Fe(e,t,"(object) holds names, and this is a value");let a={};for(let l of i){let c=fl(l);Je(a,c,Fo(e,l),e,l),Ht(e,`${r}/${Fr(c)}`,l)}for(let l of o){let c=l.getName();Je(a,c,zr(e,l,`${r}/${Fr(c)}`),e,l)}return a}function Gc(e,t,r){let n={};if(Ht(e,r,t),ds(e,t).length>0)throw Fe(e,t,"A style block holds declarations, and this is a value");for(let s of ps(t)){let i=fl(s);Je(n,i,Fo(e,s),e,s),Ht(e,`${r}/${Fr(i)}`,s)}for(let s of wr(t)){let i=s.getName(),o=`${r}/${Fr(i)}`,a=wr(s);if(s.getTag()==="array"||a.length>0&&a.every((c)=>c.getName()==="-")){Je(n,i,zr(e,s,o),e,s);continue}let l=ds(e,s);if(l.length>1)throw Fe(e,s,`"${i}" has more than one value. A selector with a space in it needs quotes`);if(l.length===1){if(ps(s).length>0||wr(s).length>0)throw Fe(e,s,`"${i}" has a value and names. A selector with a space in it needs quotes`);Je(n,i,l[0]??null,e,s),Ht(e,o,s)}else Je(n,i,Gc(e,s,o),e,s)}return n}function zc(e,t,r){let n=wr(t);if(n.length!==1||!n[0])throw Fe(e,t,`"${t.getName()}" holds one element`);return Kb(e,n[0],r)}function Gb(e,t,r){let n={$prototype:"Array"};if(Ht(e,r,t),ds(e,t).length>0)throw Fe(e,t,"$array holds names and one element, and this is a value");for(let s of ps(t)){let i=fl(s);Je(n,i.startsWith(".")?i.slice(1):i,Fo(e,s),e,s)}if(wr(t).length>0)Je(n,"map",zc(e,t,`${r}/map`),e,t);return n}function Kb(e,t,r){let n=t.getName();if(n==="-"){let s=ds(e,t);if(s.length!==1||ps(t).length>0||wr(t).length>0)throw Fe(e,t,'"-" is one piece of text or one (ref)');return Ht(e,r,t),s[0]??null}if(n==="$array")return Gb(e,t,r);return hp(e,t,r)}function jT(e,t,r,n){let s=Lo(e,r);if(t==="map")return zc(e,r,n);if(t==="cases"){let i={};for(let o of wr(r)){let a=o.getName();Je(i,a,zc(e,o,`${n}/${Fr(a)}`),e,o)}return i}if(t==="children"&&s!=="array"&&wr(r).length>0)return zc(e,r,n);return zr(e,r,n)}function hp(e,t,r){let n={},s=t.getName(),i=Lo(e,t);if(Ht(e,r,t),i!==null)throw Fe(e,t,`(${i}) cannot annotate an element`);let o=ds(e,t);if(s==="$element"){let[l,c,...u]=o;if(u.length>0)throw Fe(e,t,"$element takes at most a tag and a text value");if(l!==void 0)Je(n,"tagName",l,e,t);if(c!==void 0)Je(n,"textContent",c,e,t)}else{if(s.startsWith("$"))throw Fe(e,t,`"${s}" is not a kind of element`);if(Je(n,"tagName",s,e,t),o.length>1)throw Fe(e,t,"An element has one text value. A list of them needs a block");if(o[0]!==void 0)Je(n,"textContent",o[0],e,t),Ht(e,`${r}/textContent`,t)}PT(e,t,n,r);let a=[];for(let l of wr(t))kT(e,l,n,a,r);if(a.length>0)Je(n,"children",a,e,t);return n}function Yb(e){let{attributes:t}=e;if(W(t))return t;let r={};return e.attributes=r,r}function PT(e,t,r,n){for(let s of ps(t)){let i=fl(s),o=s.getTag();if(o==="fn")throw Fe(e,s,"A function has a block form: (fn)name, on a line of its own");let a=Fo(e,s);if(i.startsWith(".")||i.startsWith("$")){let l=i.startsWith(".")?i.slice(1):i;Je(r,l,a,e,s),Ht(e,`${n}/${Fr(l)}`,s)}else if(i.startsWith("on")&&o==="ref")Je(r,i,a,e,s),Ht(e,`${n}/${Fr(i)}`,s);else if(i.startsWith("on")&&Hb.has(i))throw Fe(e,s,`${i} needs (ref)"pointer", or a function on a line of its own: (fn)${i} "…"`);else Je(Yb(r),i,a,e,s),Ht(e,`${n}/attributes/${Fr(i)}`,s)}}function kT(e,t,r,n,s){let i=t.getName(),o=Lo(e,t),a=(l)=>`${s}/${Fr(l)}`;if(o==="fn"||o==="on"){if(!i.startsWith("on"))throw Fe(e,t,`(${o}) in an element marks a handler, and "${i}" is not one`);Je(r,i,zr(e,t,a(i)),e,t)}else if(i==="script")throw Fe(e,t,'"script" is reserved. A <script> element is $element "script"');else if(i==="state")Je(r,"state",zr(e,t,a("state")),e,t);else if(i==="style")Je(r,"style",Gc(e,t,a("style")),e,t);else if(i==="attributes"){let l=zr(e,t,a("attributes"));if(W(l))for(let[c,u]of Object.entries(l))Je(Yb(r),c,u,e,t);else Je(r,"attributes",l,e,t)}else if(i.startsWith(".")){let l=i.slice(1);Je(r,l,jT(e,l,t,a(l)),e,t)}else if(i.startsWith("$")&&i!=="$array"&&i!=="$element")Je(r,i,zr(e,t,a(i)),e,t);else{if(ST.has(i))throw Fe(e,t,`"${i}" is reserved here`);n.push(Kb(e,t,`${s}/children/${n.length}`))}}function gp(e,t){return wr(t).map((r,n)=>{let s=`/$head/${n}`;return r.getName()==="-"?zr(e,r,s):hp(e,r,s)})}function yp(e){let t=wT.exec(e);if(t)throw new Bt(`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}`,Mo(e,t.index));try{return Ws(e,{storeLocations:!0})}catch(r){let s=(r instanceof De?r.errors?.[0]??r:null)?.start,i=r instanceof Error?r.message:String(r);throw new Bt(i.split(`
21
- `)[0]??i,s?Mo(e,s.offset):null)}}function Xb(e){if(Eo(e.text)==="project")throw new Bt('This is a project file: its first node is "project". A document has an element there, and a <project> element is $element "project"');let r=yp(e.text),n={},s=null;for(let i of r.nodes){let o=i.getName();if(o==="$head"&&i.getTag()===null)Je(n,o,gp(e,i),e,i);else if(o.startsWith("$")&&o!=="$array"&&o!=="$element")Je(n,o,zr(e,i,`/${Fr(o)}`),e,i),Ht(e,`/${Fr(o)}`,i);else if(s)throw Fe(e,i,"A document has one root element, and this is a second");else s=i}if(s){let i=s.getName()==="$array"?Gb(e,s,""):hp(e,s,"");for(let[o,a]of Object.entries(i))Je(n,o,a,e,s)}return vo(n)}function Vi(e,t){try{return Xb({spans:null,text:e})}catch(r){throw t!==void 0&&r instanceof Bt?r.inFile(t):r}}function bp(e){let t=new Map;return{document:Xb({spans:t,text:e}),spans:t}}var wT,vT,ST;var dl=D(()=>{Uc();ye();er();tl();Do();Ub();wT=/(?![\t\n\v\f\r])\p{Cc}/u,vT=new Set(["array","fn","object","on","ref"]),ST=new Set(["attributes","script","state","style"])});function ms(e){return e.toLowerCase().endsWith(".jxn")}function hs(e){return e.endsWith(".json")||ms(e)}function gs(e,t){return ms(t)?Vi(e,t):Qy(e,t)}var Kc=D(()=>{er();dl()});function RT(e){let t={comments:0,escapes:[]},r=AT.exec(e)?.[0].length??0;while(r<e.length)if(e.startsWith("//",r)){t.comments+=1;let n=e.indexOf(`
22
- `,r);r=n===-1?e.length:n}else if(e.startsWith("/*",r)){t.comments+=1;let n=e.indexOf("*/",r+2);r=n===-1?e.length:n+2}else if(e.startsWith("/-",r))t.comments+=1,r+=2;else if(e.charAt(r)==="#"&&/^#+"/u.test(e.slice(r,r+16))){let[n=""]=/^#+/u.exec(e.slice(r))??[],s=r+n.length,i=e.startsWith('"""',s)?'"""':'"',o=e.indexOf(i+n,s+i.length);r=o===-1?e.length:o+i.length+n.length}else if(e.charAt(r)==='"'){let n=e.startsWith('"""',r)?'"""':'"';r+=n.length;while(r<e.length&&!e.startsWith(n,r))if(e.charAt(r)==="\\")t.escapes.push(r),r+=2;else r+=1;r+=n.length}else r+=1;return t}function xp(e){return RT(e).escapes.flatMap((t)=>{let r=_T.get(e.charAt(t+1));return r?[{...Mo(e,t),message:r}]:[]})}var _T,AT;var Zb=D(()=>{Do();_T=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.`]]),AT=/^\uFEFF?\s*\/-[^\S\n]*kdl-version[^\S\n]+\d+[^\S\n]*(?:\n|$)/u});function qo(e,t=!1){if(Array.isArray(e))return`[${e.map((s)=>qo(s,t)).join(",")}]`;if(!W(e))return e===void 0?"null":JSON.stringify(e);return`{${(t?Object.keys(e):Object.keys(e).toSorted()).map((s)=>`${JSON.stringify(s)}:${qo(e[s],t||s==="style")}`).join(",")}}`}function OT(e,t){let r=e;for(let n of t.split("/").slice(1)){let s=n.replaceAll("~1","/").replaceAll("~0","~");if(Array.isArray(r))r=r[Number(s)];else r=W(r)?r[s]:void 0}return r}function CT({spans:e}){let t=new Map;for(let[r,n]of e){let s=t.get(n.start);if(s===void 0||r.length<s.length)t.set(n.start,r)}return t}function Qb(e,t){let r=CT(e),n=new Map;for(let[s,i]of r)n.set(s,qo(OT(e.document,i)));return{meanings:n,pointers:r,text:t}}function ys(e){let t=Oo(e);return{end:t?.end.offset??0,start:t?.start.offset??0}}function Xc(e,t){let{end:r,start:n}=ys(e);return t.slice(n,r).trimEnd()}function Yc(e,t){let{end:r,start:n}=ys(e);return`${e.leading??" "}${t.slice(n,r).trimEnd()}`}function Sp(e){return e.children?.nodes??[]}function $p(e){let t=e.entries.map((i)=>`${i.getName()??""}=(${i.getTag()??""})${JSON.stringify(i.getValue())}`),r=t.filter((i)=>!i.startsWith("=")).toSorted(),n=t.filter((i)=>i.startsWith("=")),s=Sp(e).map((i)=>$p(i));return`(${e.getTag()??""})${e.getName()} ${[...r,...n].join(" ")} {${s.join(";")}}`}function wp(e,t,r){if($p(t)===$p(r))return!0;let n=e.previous.meanings.get(ys(t).start);return n!==void 0&&n===e.next.meanings.get(ys(r).start)}function ex(e){let r=e.entries.filter((n)=>["$id","key"].includes(n.getName()??"")).map((n)=>JSON.stringify(n.getValue()));return`(${e.getTag()??""})${e.getName()} ${r.join(" ")}`}function tx(e,t,r){let n=e.length+1,s=t.length+1,i=new Int32Array(n*s);for(let c=e.length-1;c>=0;c-=1)for(let u=t.length-1;u>=0;u-=1){let p=e[c],h=t[u];i[c*s+u]=p!==void 0&&h!==void 0&&r(p,h)?(i[(c+1)*s+u+1]??0)+1:Math.max(i[(c+1)*s+u]??0,i[c*s+u+1]??0)}let o=[],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&&r(c,u))o.push([a,l]),a+=1,l+=1;else if((i[(a+1)*s+l]??0)>=(i[a*s+l+1]??0))a+=1;else l+=1}return o}function NT(e,t,r){let n=new Map,s=new Set,i=(c,u)=>{let p=t[c];if(p)n.set(u,p),s.add(c)},o=tx(t,r,(c,u)=>wp(e,c,u)),a=0,l=0;for(let[c,u]of[...o,[t.length,r.length]]){let p=tx(t.slice(a,c),r.slice(l,u),(h,m)=>ex(h)===ex(m));for(let[h,m]of p)i(a+h,l+m);if(c<t.length)i(c,u);a=c+1,l=u+1}for(let[c,u]of r.entries())if(!n.has(c)){let p=t.findIndex((h,m)=>!s.has(m)&&wp(e,h,u));if(p!==-1)i(p,c)}return n}function Ep(e){let t=e.leading??"";return t.slice(t.lastIndexOf(`
23
- `)+1)}function TT(e,t,r){return e.split(`
20
+ `),line:n,offset:t}}var Wt;var Vo=M(()=>{Wt=class Wt 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 Wt(`${e}: ${this.reason}`,t)}}});var mx;var hx=M(()=>{mx=new Set(["onabort","onactivate","onaddsourcebuffer","onaddtrack","onadvertisementreceived","onafterprint","onanimationcancel","onanimationend","onanimationiteration","onanimationstart","onappinstalled","onaudioend","onaudioprocess","onaudiostart","onauxclick","onavailabilitychanged","onbackgroundfetchabort","onbackgroundfetchclick","onbackgroundfetchfail","onbackgroundfetchsuccess","onbeforeinput","onbeforeinstallprompt","onbeforematch","onbeforeprint","onbeforetoggle","onbeforexrselect","onbegin","onblocked","onblur","onboundary","onbufferedamountlow","onbufferedchange","oncancel","oncanmakepayment","oncanplay","oncanplaythrough","oncaptureaction","oncapturedmousechange","oncapturehandlechange","onchange","oncharacterboundsupdate","oncharacteristicvaluechanged","onchargingchange","onchargingtimechange","onclick","onclose","onclosing","oncommand","oncomplete","oncompositionend","oncompositionstart","onconfigurationchange","onconnect","onconnecting","onconnectionavailable","onconnectionstatechange","oncontentdelete","oncontextlost","oncontextmenu","oncontextoverflow","oncontextrestored","oncontrollerchange","oncookiechange","oncopy","oncuechange","oncurrententrychange","oncurrentscreenchange","oncut","ondataavailable","ondatachannel","ondblclick","ondequeue","ondevicechange","ondevicemotion","ondeviceorientation","ondeviceorientationabsolute","ondischargingtimechange","ondisconnect","ondispose","ondownloadprogress","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onencrypted","onend","onended","onendstreaming","onenter","onenterpictureinpicture","onerror","onexit","onfencedtreeclick","onfetch","onfinish","onfocus","onformdata","onframeratechange","onfreeze","onfullscreenchange","onfullscreenerror","ongamepadconnected","ongamepaddisconnected","ongatheringstatechange","ongattserverdisconnected","ongeometrychange","ongotpointercapture","onhashchange","onicecandidate","onicecandidateerror","oniceconnectionstatechange","onicegatheringstatechange","oninput","oninputreport","oninputsourceschange","oninstall","oninstallresult","oninvalid","onisolationchange","onkeydown","onkeyframerequest","onkeypress","onkeystatuseschange","onkeyup","onlanguagechange","onlayoutchange","onleavepictureinpicture","onlevelchange","onload","onloadeddata","onloadedmetadata","onloadend","onloading","onloadingdone","onloadingerror","onloadstart","onlocation","onlostpointercapture","onmanagedconfigurationchange","onmark","onmessage","onmessageerror","onmidimessage","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onmute","onnavigate","onnavigateerror","onnavigatesuccess","onnegotiationneeded","onnomatch","onnotificationclick","onnotificationclose","onoffline","ononline","onopen","onorientationchange","onpagehide","onpagereveal","onpageshow","onpageswap","onpaste","onpause","onpayerdetailchange","onpaymentmethodchange","onpaymentrequest","onperiodicsync","onplay","onplaying","onpointercancel","onpointerdown","onpointerenter","onpointerleave","onpointerlockchange","onpointerlockerror","onpointermove","onpointerout","onpointerover","onpointerrawupdate","onpointerup","onpopstate","onportalactivate","onprerenderingchange","onprioritychange","onprocessorerror","onprogress","onpromptaction","onpromptdismiss","onpush","onpushsubscriptionchange","onquotaoverflow","onratechange","onreading","onreadingerror","onreadystatechange","onredraw","onreflectionchange","onrejectionhandled","onrelease","onremove","onremovesourcebuffer","onremovetrack","onrepeat","onreset","onresize","onresourcetimingbufferfull","onresult","onresume","onrtctransform","onscreenschange","onscroll","onscrollend","onsecuritypolicyviolation","onseeked","onseeking","onselect","onselectedcandidatepairchange","onselectend","onselectionchange","onselectstart","onserviceadded","onservicechanged","onserviceremoved","onshippingaddresschange","onshippingoptionchange","onshow","onsignalingstatechange","onsinkchange","onslotchange","onsnapchanged","onsnapchanging","onsoundend","onsoundstart","onsourceclose","onsourceended","onsourceopen","onspeechend","onspeechstart","onsqueeze","onsqueezeend","onsqueezestart","onstalled","onstart","onstartstreaming","onstatechange","onstop","onstorage","onstream","onsubmit","onsuccess","onsuspend","onsync","onterminate","ontextformatupdate","ontextupdate","ontimeout","ontimeupdate","ontoggle","ontonechange","ontoolactivated","ontoolcancel","ontoolchange","ontouchcancel","ontouchend","ontouchmove","ontouchstart","ontrack","ontransitioncancel","ontransitionend","ontransitionrun","ontransitionstart","onuncapturederror","onunhandledrejection","onunload","onunmute","onupdate","onupdateend","onupdatefound","onupdatestart","onupgradeneeded","onvalidationstatuschange","onversionchange","onvisibilitychange","onvoiceschanged","onvolumechange","onwaiting","onwaitingforkey","onwebkitanimationend","onwebkitanimationiteration","onwebkitanimationstart","onwebkittransitionend","onwheel","onzoomlevelchange"])});function Je(e,t,r,n,s){let i=t.normalize("NFC");if(i==="__proto__")throw Le(n,s,'"__proto__" cannot be a key: it would not be data');if(Object.hasOwn(e,i))throw Le(n,s,`"${i}" is written twice, and one of them would be lost`);e[i]=r}function Le(e,t,r){let n=gx(t)?.start;return new Wt(r,n===void 0?null:qo(e.text,n))}function gx(e){let t=Io(e);return t?{end:t.end.offset,start:t.start.offset}:null}function Ut(e,t,r){let n=e.spans?gx(r):null;if(n)e.spans?.set(t,n)}function Fr(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function Bo(e,t){let r=t.getTag();if(r!==null&&!iI.has(r))throw Le(e,t,`(${r}) is not an annotation Jx Notation has`);if(r==="ref")throw Le(e,t,"(ref) annotates a value, and this is a name");return r}function Wo(e,t){let r=t.getTag(),n=t.getValue();if(r!==null&&r!=="ref")throw Le(e,t,`(${r}) cannot annotate a value here; only (ref) can`);if(Ct(n)){if(!Number.isFinite(n))throw Le(e,t,"JSON has no way to hold #inf or #nan");if(Number.isInteger(n)&&!Number.isSafeInteger(n))throw Le(e,t,"This number is too large to survive being read as JSON")}if(r==="ref"){if(!A(n))throw Le(e,t,"(ref) needs a string");return{$ref:n}}return n}function gs(e,t){return t.entries.filter((r)=>!r.name).map((r)=>Wo(e,r))}function ys(e){return e.entries.filter((t)=>t.name)}function vr(e){return e.children?.nodes??[]}function xl(e){return e.getName()??""}function aI(e,t,r){let n={$prototype:"Function"},s=gs(e,t),i=vr(t);for(let o of ys(t))Je(n,xl(o),Wo(e,o),e,o);if(i.length>0){if(s.length>0)Je(n,"parameters",s,e,t);Je(n,"body",Np(e,i,`${r}/body`),e,t)}else if(s.length>0){let o=s.at(-1)??null,a=s.slice(0,-1);if(a.length>0)Je(n,"parameters",a,e,t);Je(n,"body",o,e,t)}return Ut(e,r,t),n}function Np(e,t,r){return t.map((n,s)=>{if(n.getName()!=="-")throw Le(e,n,`A list holds only "-" items, and this is "${n.getName()}"`);return Kr(e,n,`${r}/${s}`)})}function Kr(e,t,r){let n=Bo(e,t);if(Ut(e,r,t),n==="fn")return aI(e,t,r);let s=gs(e,t),i=ys(t),o=vr(t);if(n==="array"){if(i.length>0)throw Le(e,t,"(array) holds items, and these are named");return[...s,...Np(e,o,r)]}if(n!=="object"){if(s.length>1){if(i.length>0||o.length>0)throw Le(e,t,"A list of values cannot also have names or a block");return s}if(s.length===1){if(i.length>0||o.length>0)throw Le(e,t,"A value cannot also have names or a block");return s[0]??null}if(o.length>0&&i.length===0&&o.every((l)=>l.getName()==="-"))return Np(e,o,r)}else if(s.length>0)throw Le(e,t,"(object) holds names, and this is a value");let a={};for(let l of i){let c=xl(l);Je(a,c,Wo(e,l),e,l),Ut(e,`${r}/${Fr(c)}`,l)}for(let l of o){let c=l.getName();Je(a,c,Kr(e,l,`${r}/${Fr(c)}`),e,l)}return a}function lu(e,t,r){let n={};if(Ut(e,r,t),gs(e,t).length>0)throw Le(e,t,"A style block holds declarations, and this is a value");for(let s of ys(t)){let i=xl(s);Je(n,i,Wo(e,s),e,s),Ut(e,`${r}/${Fr(i)}`,s)}for(let s of vr(t)){let i=s.getName(),o=`${r}/${Fr(i)}`,a=vr(s);if(s.getTag()==="array"||a.length>0&&a.every((c)=>c.getName()==="-")){Je(n,i,Kr(e,s,o),e,s);continue}let l=gs(e,s);if(l.length>1)throw Le(e,s,`"${i}" has more than one value. A selector with a space in it needs quotes`);if(l.length===1){if(ys(s).length>0||vr(s).length>0)throw Le(e,s,`"${i}" has a value and names. A selector with a space in it needs quotes`);Je(n,i,l[0]??null,e,s),Ut(e,o,s)}else Je(n,i,lu(e,s,o),e,s)}return n}function au(e,t,r){let n=vr(t);if(n.length!==1||!n[0])throw Le(e,t,`"${t.getName()}" holds one element`);return bx(e,n[0],r)}function yx(e,t,r){let n={$prototype:"Array"};if(Ut(e,r,t),gs(e,t).length>0)throw Le(e,t,"$array holds names and one element, and this is a value");for(let s of ys(t)){let i=xl(s);Je(n,i.startsWith(".")?i.slice(1):i,Wo(e,s),e,s)}if(vr(t).length>0)Je(n,"map",au(e,t,`${r}/map`),e,t);return n}function bx(e,t,r){let n=t.getName();if(n==="-"){let s=gs(e,t);if(s.length!==1||ys(t).length>0||vr(t).length>0)throw Le(e,t,'"-" is one piece of text or one (ref)');return Ut(e,r,t),s[0]??null}if(n==="$array")return yx(e,t,r);return Cp(e,t,r)}function lI(e,t,r,n){let s=Bo(e,r);if(t==="map")return au(e,r,n);if(t==="cases"){let i={};for(let o of vr(r)){let a=o.getName();Je(i,a,au(e,o,`${n}/${Fr(a)}`),e,o)}return i}if(t==="children"&&s!=="array"&&vr(r).length>0)return au(e,r,n);return Kr(e,r,n)}function Cp(e,t,r){let n={},s=t.getName(),i=Bo(e,t);if(Ut(e,r,t),i!==null)throw Le(e,t,`(${i}) cannot annotate an element`);let o=gs(e,t);if(s==="$element"){let[l,c,...u]=o;if(u.length>0)throw Le(e,t,"$element takes at most a tag and a text value");if(l!==void 0)Je(n,"tagName",l,e,t);if(c!==void 0)Je(n,"textContent",c,e,t)}else{if(s.startsWith("$"))throw Le(e,t,`"${s}" is not a kind of element`);if(Je(n,"tagName",s,e,t),o.length>1)throw Le(e,t,"An element has one text value. A list of them needs a block");if(o[0]!==void 0)Je(n,"textContent",o[0],e,t),Ut(e,`${r}/textContent`,t)}cI(e,t,n,r);let a=[];for(let l of vr(t))uI(e,l,n,a,r);if(a.length>0)Je(n,"children",a,e,t);return n}function xx(e){let{attributes:t}=e;if(B(t))return t;let r={};return e.attributes=r,r}function cI(e,t,r,n){for(let s of ys(t)){let i=xl(s),o=s.getTag();if(o==="fn")throw Le(e,s,"A function has a block form: (fn)name, on a line of its own");let a=Wo(e,s);if(i.startsWith(".")||i.startsWith("$")){let l=i.startsWith(".")?i.slice(1):i;Je(r,l,a,e,s),Ut(e,`${n}/${Fr(l)}`,s)}else if(i.startsWith("on")&&o==="ref")Je(r,i,a,e,s),Ut(e,`${n}/${Fr(i)}`,s);else if(i.startsWith("on")&&mx.has(i))throw Le(e,s,`${i} needs (ref)"pointer", or a function on a line of its own: (fn)${i} "…"`);else Je(xx(r),i,a,e,s),Ut(e,`${n}/attributes/${Fr(i)}`,s)}}function uI(e,t,r,n,s){let i=t.getName(),o=Bo(e,t),a=(l)=>`${s}/${Fr(l)}`;if(o==="fn"||o==="on"){if(!i.startsWith("on"))throw Le(e,t,`(${o}) in an element marks a handler, and "${i}" is not one`);Je(r,i,Kr(e,t,a(i)),e,t)}else if(i==="script")throw Le(e,t,'"script" is reserved. A <script> element is $element "script"');else if(i==="state")Je(r,"state",Kr(e,t,a("state")),e,t);else if(i==="style")Je(r,"style",lu(e,t,a("style")),e,t);else if(i==="attributes"){let l=Kr(e,t,a("attributes"));if(B(l))for(let[c,u]of Object.entries(l))Je(xx(r),c,u,e,t);else Je(r,"attributes",l,e,t)}else if(i.startsWith(".")){let l=i.slice(1);Je(r,l,lI(e,l,t,a(l)),e,t)}else if(i.startsWith("$")&&i!=="$array"&&i!=="$element")Je(r,i,Kr(e,t,a(i)),e,t);else{if(oI.has(i))throw Le(e,t,`"${i}" is reserved here`);n.push(bx(e,t,`${s}/children/${n.length}`))}}function Tp(e,t){return vr(t).map((r,n)=>{let s=`/$head/${n}`;return r.getName()==="-"?Kr(e,r,s):Cp(e,r,s)})}function Ip(e){let t=sI.exec(e);if(t)throw new Wt(`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}`,qo(e,t.index));try{return Hs(e,{storeLocations:!0})}catch(r){let s=(r instanceof Me?r.errors?.[0]??r:null)?.start,i=r instanceof Error?r.message:String(r);throw new Wt(i.split(`
21
+ `)[0]??i,s?qo(e,s.offset):null)}}function $x(e){if(_o(e.text)==="project")throw new Wt('This is a project file: its first node is "project". A document has an element there, and a <project> element is $element "project"');let r=Ip(e.text),n={},s=null;for(let i of r.nodes){let o=i.getName();if(o==="$head"&&i.getTag()===null)Je(n,o,Tp(e,i),e,i);else if(o.startsWith("$")&&o!=="$array"&&o!=="$element")Je(n,o,Kr(e,i,`/${Fr(o)}`),e,i),Ut(e,`/${Fr(o)}`,i);else if(s)throw Le(e,i,"A document has one root element, and this is a second");else s=i}if(s){let i=s.getName()==="$array"?yx(e,s,""):Cp(e,s,"");for(let[o,a]of Object.entries(i))Je(n,o,a,e,s)}return jo(n)}function Wi(e,t){try{return $x({spans:null,text:e})}catch(r){throw t!==void 0&&r instanceof Wt?r.inFile(t):r}}function Jp(e){let t=new Map;return{document:$x({spans:t,text:e}),spans:t}}var sI,iI,oI;var $l=M(()=>{ou();ye();er();cl();Vo();hx();sI=/(?![\t\n\v\f\r])\p{Cc}/u,iI=new Set(["array","fn","object","on","ref"]),oI=new Set(["attributes","script","state","style"])});function bs(e){return e.toLowerCase().endsWith(".jxn")}function xs(e){return e.endsWith(".json")||bs(e)}function $s(e,t){return bs(t)?Wi(e,t):vb(e,t)}var cu=M(()=>{er();$l()});function pI(e){let t={comments:0,escapes:[]},r=dI.exec(e)?.[0].length??0;while(r<e.length)if(e.startsWith("//",r)){t.comments+=1;let n=e.indexOf(`
22
+ `,r);r=n===-1?e.length:n}else if(e.startsWith("/*",r)){t.comments+=1;let n=e.indexOf("*/",r+2);r=n===-1?e.length:n+2}else if(e.startsWith("/-",r))t.comments+=1,r+=2;else if(e.charAt(r)==="#"&&/^#+"/u.test(e.slice(r,r+16))){let[n=""]=/^#+/u.exec(e.slice(r))??[],s=r+n.length,i=e.startsWith('"""',s)?'"""':'"',o=e.indexOf(i+n,s+i.length);r=o===-1?e.length:o+i.length+n.length}else if(e.charAt(r)==='"'){let n=e.startsWith('"""',r)?'"""':'"';r+=n.length;while(r<e.length&&!e.startsWith(n,r))if(e.charAt(r)==="\\")t.escapes.push(r),r+=2;else r+=1;r+=n.length}else r+=1;return t}function Mp(e){return pI(e).escapes.flatMap((t)=>{let r=fI.get(e.charAt(t+1));return r?[{...qo(e,t),message:r}]:[]})}var fI,dI;var wx=M(()=>{Vo();fI=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.`]]),dI=/^\uFEFF?\s*\/-[^\S\n]*kdl-version[^\S\n]+\d+[^\S\n]*(?:\n|$)/u});function Uo(e,t=!1){if(Array.isArray(e))return`[${e.map((s)=>Uo(s,t)).join(",")}]`;if(!B(e))return e===void 0?"null":JSON.stringify(e);return`{${(t?Object.keys(e):Object.keys(e).toSorted()).map((s)=>`${JSON.stringify(s)}:${Uo(e[s],t||s==="style")}`).join(",")}}`}function mI(e,t){let r=e;for(let n of t.split("/").slice(1)){let s=n.replaceAll("~1","/").replaceAll("~0","~");if(Array.isArray(r))r=r[Number(s)];else r=B(r)?r[s]:void 0}return r}function hI({spans:e}){let t=new Map;for(let[r,n]of e){let s=t.get(n.start);if(s===void 0||r.length<s.length)t.set(n.start,r)}return t}function vx(e,t){let r=hI(e),n=new Map;for(let[s,i]of r)n.set(s,Uo(mI(e.document,i)));return{meanings:n,pointers:r,text:t}}function ws(e){let t=Io(e);return{end:t?.end.offset??0,start:t?.start.offset??0}}function fu(e,t){let{end:r,start:n}=ws(e);return t.slice(n,r).trimEnd()}function uu(e,t){let{end:r,start:n}=ws(e);return`${e.leading??" "}${t.slice(n,r).trimEnd()}`}function qp(e){return e.children?.nodes??[]}function Dp(e){let t=e.entries.map((i)=>`${i.getName()??""}=(${i.getTag()??""})${JSON.stringify(i.getValue())}`),r=t.filter((i)=>!i.startsWith("=")).toSorted(),n=t.filter((i)=>i.startsWith("=")),s=qp(e).map((i)=>Dp(i));return`(${e.getTag()??""})${e.getName()} ${[...r,...n].join(" ")} {${s.join(";")}}`}function Lp(e,t,r){if(Dp(t)===Dp(r))return!0;let n=e.previous.meanings.get(ws(t).start);return n!==void 0&&n===e.next.meanings.get(ws(r).start)}function Sx(e){let r=e.entries.filter((n)=>["$id","key"].includes(n.getName()??"")).map((n)=>JSON.stringify(n.getValue()));return`(${e.getTag()??""})${e.getName()} ${r.join(" ")}`}function Ex(e,t,r){let n=e.length+1,s=t.length+1,i=new Int32Array(n*s);for(let c=e.length-1;c>=0;c-=1)for(let u=t.length-1;u>=0;u-=1){let p=e[c],h=t[u];i[c*s+u]=p!==void 0&&h!==void 0&&r(p,h)?(i[(c+1)*s+u+1]??0)+1:Math.max(i[(c+1)*s+u]??0,i[c*s+u+1]??0)}let o=[],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&&r(c,u))o.push([a,l]),a+=1,l+=1;else if((i[(a+1)*s+l]??0)>=(i[a*s+l+1]??0))a+=1;else l+=1}return o}function gI(e,t,r){let n=new Map,s=new Set,i=(c,u)=>{let p=t[c];if(p)n.set(u,p),s.add(c)},o=Ex(t,r,(c,u)=>Lp(e,c,u)),a=0,l=0;for(let[c,u]of[...o,[t.length,r.length]]){let p=Ex(t.slice(a,c),r.slice(l,u),(h,m)=>Sx(h)===Sx(m));for(let[h,m]of p)i(a+h,l+m);if(c<t.length)i(c,u);a=c+1,l=u+1}for(let[c,u]of r.entries())if(!n.has(c)){let p=t.findIndex((h,m)=>!s.has(m)&&Lp(e,h,u));if(p!==-1)i(p,c)}return n}function Vp(e){let t=e.leading??"";return t.slice(t.lastIndexOf(`
23
+ `)+1)}function yI(e,t,r){return e.split(`
24
24
  `).map((n,s)=>s>0&&n.startsWith(t)?r+n.slice(t.length):n).join(`
25
- `)}function IT(e,t,r){let n=[...r],s=(o)=>{let a=o.getName(),l=n.findIndex((c)=>c.getName()===a);return l===-1?void 0:n.splice(l,1)[0]},i="";for(let o of t.entries){let a=s(o);if(a){let l=a.getTag()===o.getTag()&&a.getValue()===o.getValue();i+=l?Yc(o,e.previous.text):`${o.leading??" "}${Yc(a,e.next.text).trimStart()}`}}for(let o of n)i+=` ${Yc(o,e.next.text).trimStart()}`;return i}function JT(e,t,r){let n=new Map;for(let i of Sp(t)){let o=e.previous.pointers.get(ys(i).start);if(o!==void 0)n.set(o,i)}let s=new Map;for(let i of r.entries){let o=e.next.pointers.get(ys(i).start),a=o===void 0?void 0:n.get(o);if(a&&i.getName()!==null)s.set(a,i)}return s}function MT(e,t,r){let{text:n}=e.previous,s=Yc(r,e.next.text).trimStart().slice(`${r.getName()}=`.length),[i]=t.entries;if(i?.getName()===null&&t.entries.length===1&&!t.children){if(i.getValue()===r.getValue()&&i.getTag()===r.getTag())return Xc(t,n);return`${vp(t,n)}${i.leading??" "}${s}`}return`${vp(t,n)} ${s}`}function vp(e,t){let{start:r}=ys(e),[n]=e.entries;if(n)return t.slice(r,ys(n).start-(n.leading??"").length);let s=e.children&&Oo(e.children);if(s)return t.slice(r,s.start.offset-1).trimEnd();return Xc(e,t)}function DT(e,t,r,n){let s=JT(e,t,r),i=new Set(s.values()),o=r.entries.filter((m)=>!i.has(m)),a=`${vp(t,e.previous.text)}${IT(e,t,o)}`,l=Sp(r);if(l.length===0&&s.size===0)return a;let c=l[0]?Ep(l[0]):`${n} `,u=t.children,p=t.beforeChildren===""?" ":t.beforeChildren??" ";if(u&&u.nodes.length>0&&FT(u,e.previous.text,t)){let m=`${n}${LT(u,n)}`;return`${a}${p}{${nx(e,u,l,m,c,s)}}`}let h=l.map((m)=>rx(e,m,c,`${n} `));return`${a}${p}{
26
- ${h.join("")}${n}}`}function LT(e,t){let[r]=e.nodes,n=r?Ep(r):"";return n.startsWith(t)?n.slice(t.length):" "}function FT(e,t,r){let{end:n,start:s}=ys(r),[i]=e.nodes;return i!==void 0&&(i.leading??"").includes(`
25
+ `)}function bI(e,t,r){let n=[...r],s=(o)=>{let a=o.getName(),l=n.findIndex((c)=>c.getName()===a);return l===-1?void 0:n.splice(l,1)[0]},i="";for(let o of t.entries){let a=s(o);if(a){let l=a.getTag()===o.getTag()&&a.getValue()===o.getValue();i+=l?uu(o,e.previous.text):`${o.leading??" "}${uu(a,e.next.text).trimStart()}`}}for(let o of n)i+=` ${uu(o,e.next.text).trimStart()}`;return i}function xI(e,t,r){let n=new Map;for(let i of qp(t)){let o=e.previous.pointers.get(ws(i).start);if(o!==void 0)n.set(o,i)}let s=new Map;for(let i of r.entries){let o=e.next.pointers.get(ws(i).start),a=o===void 0?void 0:n.get(o);if(a&&i.getName()!==null)s.set(a,i)}return s}function $I(e,t,r){let{text:n}=e.previous,s=uu(r,e.next.text).trimStart().slice(`${r.getName()}=`.length),[i]=t.entries;if(i?.getName()===null&&t.entries.length===1&&!t.children){if(i.getValue()===r.getValue()&&i.getTag()===r.getTag())return fu(t,n);return`${Fp(t,n)}${i.leading??" "}${s}`}return`${Fp(t,n)} ${s}`}function Fp(e,t){let{start:r}=ws(e),[n]=e.entries;if(n)return t.slice(r,ws(n).start-(n.leading??"").length);let s=e.children&&Io(e.children);if(s)return t.slice(r,s.start.offset-1).trimEnd();return fu(e,t)}function wI(e,t,r,n){let s=xI(e,t,r),i=new Set(s.values()),o=r.entries.filter((m)=>!i.has(m)),a=`${Fp(t,e.previous.text)}${bI(e,t,o)}`,l=qp(r);if(l.length===0&&s.size===0)return a;let c=l[0]?Vp(l[0]):`${n} `,u=t.children,p=t.beforeChildren===""?" ":t.beforeChildren??" ";if(u&&u.nodes.length>0&&SI(u,e.previous.text,t)){let m=`${n}${vI(u,n)}`;return`${a}${p}{${jx(e,u,l,m,c,s)}}`}let h=l.map((m)=>Px(e,m,c,`${n} `));return`${a}${p}{
26
+ ${h.join("")}${n}}`}function vI(e,t){let[r]=e.nodes,n=r?Vp(r):"";return n.startsWith(t)?n.slice(t.length):" "}function SI(e,t,r){let{end:n,start:s}=ws(r),[i]=e.nodes;return i!==void 0&&(i.leading??"").includes(`
27
27
  `)&&t.slice(s,n).includes(`
28
- `)}function rx(e,t,r,n){return`${n}${TT(Xc(t,e.next.text),r,n)}
29
- `}function nx(e,t,r,n,s,i){let o=t.nodes.filter((y)=>!i.has(y)),a=NT(e,o,r),l=t.nodes[0]?.leading??"",c=l.indexOf(`
28
+ `)}function Px(e,t,r,n){return`${n}${yI(fu(t,e.next.text),r,n)}
29
+ `}function jx(e,t,r,n,s,i){let o=t.nodes.filter((b)=>!i.has(b)),a=gI(e,o,r),l=t.nodes[0]?.leading??"",c=l.indexOf(`
30
30
  `),u=c===-1?"":l.slice(0,c+1),p=u,h=-1,m=()=>{if(p!==""&&!p.endsWith(`
31
31
  `)&&!p.endsWith(";"))p+=`
32
- `},b=(y,w)=>{let j=t.nodes.indexOf(y),S=j===h+1||j>h;h=Math.max(h,j);let E=y===t.nodes[0]?l.slice(u.length):y.leading??"";if(S&&(E.includes(`
33
- `)||p===u||p.endsWith(";"))){p+=`${E}${w}${y.trailing??""}`;return}if(!p.endsWith(`
32
+ `},y=(b,w)=>{let j=t.nodes.indexOf(b),S=j===h+1||j>h;h=Math.max(h,j);let E=b===t.nodes[0]?l.slice(u.length):b.leading??"";if(S&&(E.includes(`
33
+ `)||p===u||p.endsWith(";"))){p+=`${E}${w}${b.trailing??""}`;return}if(!p.endsWith(`
34
34
  `))p+=`
35
- `;let P=(y.trailing??"").replace(/^;/u,"");p+=`${E.includes(`
36
- `)?E:n}${w}${P}`},g=(y)=>{for(let[w,j]of t.nodes.entries()){let S=i.get(j);if(S&&w<y&&w>h)m(),b(j,MT(e,j,S))}};for(let[y,w]of r.entries()){let j=a.get(y);if(j){g(t.nodes.indexOf(j)),m();let S=wp(e,j,w)?Xc(j,e.previous.text):DT(e,j,w,Ep(j));b(j,S)}else m(),p+=rx(e,w,s,n)}return g(t.nodes.length),`${p}${t.trailing??""}`}function Zc(e,t,r){let n;try{n=r(e)}catch{return t}let s=r(t),i=qo(s.document);if(qo(n.document)===i)return e;let o={next:Qb(s,t),previous:Qb(n,e)},a=nx(o,Ws(e,{storeLocations:!0}),Ws(t,{storeLocations:!0}).nodes,"","",new Map);try{return qo(r(a).document)===i?a:t}catch{return t}}var Qc=D(()=>{Uc();ye()});function ax(e){return!/\p{Cs}/u.test(e)}function lx(e,t){try{return Ws(`x ${e}`).nodes[0]?.entries[0]?.getValue()===t}catch{return!1}}function eu(e){let t='"';for(let r of e)if(r==='"')t+=String.raw`\"`;else if(r==="\\")t+=String.raw`\\`;else if(r===`
37
- `)t+=String.raw`\n`;else if(r==="\t")t+=String.raw`\t`;else if(r==="\r")t+=String.raw`\r`;else if(ox.test(r))t+=`\\u{${r.codePointAt(0)?.toString(16)}}`;else t+=r;return`${t}"`}function cx(e,t){let r="#";while(e.includes(t+r))r+="#";return r}function WT(e,t){if(qT.test(e))return null;let r=cx(e,'"""'),n=`${t}${nr}`,s=e.split(`
35
+ `;let P=(b.trailing??"").replace(/^;/u,"");p+=`${E.includes(`
36
+ `)?E:n}${w}${P}`},g=(b)=>{for(let[w,j]of t.nodes.entries()){let S=i.get(j);if(S&&w<b&&w>h)m(),y(j,$I(e,j,S))}};for(let[b,w]of r.entries()){let j=a.get(b);if(j){g(t.nodes.indexOf(j)),m();let S=Lp(e,j,w)?fu(j,e.previous.text):wI(e,j,w,Vp(j));y(j,S)}else m(),p+=Px(e,w,s,n)}return g(t.nodes.length),`${p}${t.trailing??""}`}function du(e,t,r){let n;try{n=r(e)}catch{return t}let s=r(t),i=Uo(s.document);if(Uo(n.document)===i)return e;let o={next:vx(s,t),previous:vx(n,e)},a=jx(o,Hs(e,{storeLocations:!0}),Hs(t,{storeLocations:!0}).nodes,"","",new Map);try{return Uo(r(a).document)===i?a:t}catch{return t}}var pu=M(()=>{ou();ye()});function Rx(e){return!/\p{Cs}/u.test(e)}function Ox(e,t){try{return Hs(`x ${e}`).nodes[0]?.entries[0]?.getValue()===t}catch{return!1}}function mu(e){let t='"';for(let r of e)if(r==='"')t+=String.raw`\"`;else if(r==="\\")t+=String.raw`\\`;else if(r===`
37
+ `)t+=String.raw`\n`;else if(r==="\t")t+=String.raw`\t`;else if(r==="\r")t+=String.raw`\r`;else if(Ax.test(r))t+=`\\u{${r.codePointAt(0)?.toString(16)}}`;else t+=r;return`${t}"`}function Nx(e,t){let r="#";while(e.includes(t+r))r+="#";return r}function jI(e,t){if(EI.test(e))return null;let r=Nx(e,'"""'),n=`${t}${nr}`,s=e.split(`
38
38
  `).map((o)=>o===""?"":n+o),i=`${r}"""
39
39
  ${s.join(`
40
40
  `)}
41
- ${n}"""${r}`;return lx(i,e)?i:null}function Pp(e,t,r){if(!ax(e))throw new Bt(`${r} holds a lone surrogate, which Jx Notation has no way to spell`);if(ix.test(e))return e;if(e.includes(`
42
- `)){let n=WT(e,t);if(n)return n}else if((e.includes("\\")||e.includes('"'))&&!ox.test(e)){let n=cx(e,'"'),s=`${n}"${e}"${n}`;if(lx(s,e))return s}return eu(e)}function vr(e,t){if(!ax(e))throw new Bt(`${t} is a key with a lone surrogate, which Jx Notation cannot spell`);return ix.test(e)?e:eu(e)}function Dt(e,t,r){if(e===null)return"#null";if(e===!0)return"#true";if(e===!1)return"#false";if(Nt(e))return Object.is(e,-0)?"-0":String(e);if(O(e))return Pp(e,t,r);return ml(e)?`(ref)${eu(e.$ref)}`:null}function ux(e){if(!Gr(e)||e.$prototype!=="Function")return!1;let{$prototype:t,body:r,parameters:n,...s}=e,i=Object.values(s).every((c)=>Dt(c,"","")!==null),o=n===void 0||Array.isArray(n)&&n.length>0&&n.every((c)=>O(c))&&r!==void 0,a=r===void 0||O(r)||Array.isArray(r),l=Array.isArray(r)&&r.length===0;return i&&o&&a&&!l}function fx(e,t,r,n){let{$prototype:s,body:i,parameters:o,...a}=t,l=[`${r}(fn)${vr(e,n)}`];for(let[c,u]of Object.entries(a))l.push(`${vr(c,n)}=${Dt(u,r,pt(n,c))}`);if(Array.isArray(o))for(let c of o)l.push(Pp(String(c),r,pt(n,"parameters")));if(O(i))l.push(Pp(i,r,pt(n,"body")));else if(Array.isArray(i))return[`${l.join(" ")} {`,...i.flatMap((c,u)=>qr("-",c,r+nr,pt(pt(n,"body"),u))),`${r}}`];return[l.join(" ")]}function qr(e,t,r,n){let s=vr(e,n),i=r+s,o=Dt(t,r,n);if(o!==null)return[`${i} ${o}`];if(ux(t))return fx(e,t,r,n);if(Array.isArray(t)){if(t.length===0)return[`${r}(array)${s}`];let u=t.map((h,m)=>Dt(h,r,pt(n,m)));if(t.length>1&&u.every((h)=>h!==null&&!h.includes(`
43
- `))){let h=`${i} ${u.join(" ")}`;if(h.length<=jp)return[h]}return[`${i} {`,...t.flatMap((h,m)=>qr("-",h,r+nr,pt(n,m))),`${r}}`]}let a=Gr(t)?Object.entries(t):[];if(a.length===0)return[`${i} {}`];let l=a.every(([u])=>u==="-")?`${r}(object)${s}`:i,c=a.map(([u,p])=>{let h=Dt(p,r,pt(n,u));return h===null||h.includes(`
44
- `)?null:`${vr(u,n)}=${h}`});if(c.every((u)=>u!==null)){let u=`${l} ${c.join(" ")}`;if(u.length<=jp)return[u]}return[`${l} {`,...a.flatMap(([u,p])=>qr(u,p,r+nr,pt(n,u))),`${r}}`]}function dx(e,t,r,n){let s=Object.entries(t),i=r+vr(e,n);if(s.length===0)return[`${i} {}`];let o=[],a=0;for(let[h,m]of s){let b=Dt(m,r,pt(n,h));if(b===null||b.includes(`
45
- `))break;o.push(`${vr(h,n)}=${b}`),a+=1}let l=`${i} ${o.join(" ")}`,c=o.length>0&&l.length<=jp,u=c?a:0,p=s.slice(u).flatMap(([h,m])=>{if(Gr(m)&&!ml(m))return dx(h,m,r+nr,pt(n,h));return qr(h,m,r+nr,pt(n,h))});if(c&&p.length===0)return[l];return[`${c?l:i} {`,...p,`${r}}`]}function BT(e){if(!Gr(e)||e.$prototype!=="Array"||!Gr(e.map))return!1;let{$prototype:t,map:r,...n}=e;return Object.values(n).every((s)=>{let i=Dt(s,"","");return i!==null&&!i.includes(`
46
- `)})}function HT(e,t,r){let{$prototype:n,map:s,...i}=e,o=[`${t}$array`];for(let[a,l]of Object.entries(i))o.push(`${vr(a,r)}=${Dt(l,t,pt(r,a))}`);return[`${o.join(" ")} {`,...pl(s??null,t+nr,pt(r,"map")),`${t}}`]}function pl(e,t,r){let n=Dt(e,t,r);if(n!==null)return[`${t}- ${n}`];if(BT(e))return HT(e,t,r);if(Gr(e))return kp(e,t,r);throw new Bt(`${r} is a list inside a list of children, which has no spelling`)}function UT(e,t,r){let{tagName:n}=e;if(!O(n))return`${t}$element`;if(VT.has(n)||n.startsWith("$")||n.startsWith("."))return`${t}$element ${eu(n)}`;return t+vr(n,r)}function zT(e,t){return t!==null&&!t.includes(`
47
- `)&&!e.startsWith("on")&&!e.startsWith("$")&&!e.startsWith(".")}function kp(e,t,r){let n=[UT(e,t,r)],s=t+nr,i=[],o={},a=null;for(let[l,c]of Object.entries(e)){let u=pt(r,l);if(l==="tagName"&&O(c))continue;if(l==="children")continue;if(l==="textContent"){let p=Dt(c,t,u);if(p===null||!O(e.tagName))sx(n,i,l,c,s,t,u);else a=p}else if(l==="attributes"&&Gr(c))for(let[p,h]of Object.entries(c)){let m=Dt(h,t,pt(u,p));if(zT(p,m))n.push(`${vr(p,u)}=${m}`);else o[p]=h}else if(l==="state")i.push(...qr("state",c,s,u));else if(l==="style"&&Gr(c))i.push(...dx("style",c,s,u));else if(l.startsWith("on")&&ml(c))n.push(`${vr(l,u)}=${Dt(c,t,u)}`);else if(l.startsWith("on"))i.push(...ux(c)?fx(l,c,s,u):qr(l,c,s,u).map((p,h)=>h===0?p.replace(s,`${s}(on)`):p));else if(l.startsWith("$")){let p=Dt(c,t,u);if(p===null||p.includes(`
48
- `))i.push(...qr(l,c,s,u));else n.push(`${vr(l,u)}=${p}`)}else sx(n,i,l,c,s,t,u)}if(Object.keys(o).length>0)i.push(...qr("attributes",o,s,pt(r,"attributes")));if(i.push(...GT(e.children,s,pt(r,"children"))),a!==null)n.push(a);return i.length===0?[n.join(" ")]:[`${n.join(" ")} {`,...i,`${t}}`]}function GT(e,t,r){if(e===void 0)return[];if(Array.isArray(e)){if(e.length===0)return[`${t}(array).children`];return e.flatMap((s,i)=>pl(s,t,pt(r,i)))}let n=Dt(e,t,r);if(n!==null)return[`${t}.children ${n}`];return[`${t}.children {`,...pl(e,t+nr,r),`${t}}`]}function sx(e,t,r,n,s,i,o){let a=vr(`.${r}`,o);if(r==="map"&&Gr(n)){t.push(`${s}${a} {`,...pl(n,s+nr,o),`${s}}`);return}if(r==="cases"&&Gr(n)){t.push(`${s}${a} {`);for(let[c,u]of Object.entries(n))t.push(`${s}${nr}${vr(c,o)} {`,...pl(u,s+nr+nr,pt(o,c)),`${s}${nr}}`);t.push(`${s}}`);return}let l=Dt(n,i,o);if(l===null||l.includes(`
49
- `))t.push(...qr(`.${r}`,n,s,o));else e.push(`${a}=${l}`)}function px(e,t){return["$head {",...e.flatMap((r,n)=>Gr(r)&&!ml(r)&&O(r.tagName)&&!r.$ref?kp(r,t,`/$head/${n}`):qr("-",r,t,`/$head/${n}`)),"}"]}function KT(e){let{document:t,spans:r}=bp(e);return{document:W(t)?t:null,spans:r}}function _p(e,t){let r=YT(e);return t===void 0?r:Zc(t,r,KT)}function YT(e){if(!W(e))throw new Bt("A document is an object");let t=e,r=["/- kdl-version 2"],n={};for(let[s,i]of Object.entries(t))if(s==="$head"&&Array.isArray(i))r.push(...px(i,nr));else if(s==="$head")r.push(`(object)${qr(s,i,"","/$head").join(`
50
- `)}`);else if(s.startsWith("$"))r.push(...qr(s,i,"",pt("",s)));else n[s]=i;if(Object.keys(n).length>0)r.push("",...kp(n,"",""));return`${r.join(`
41
+ ${n}"""${r}`;return Ox(i,e)?i:null}function Wp(e,t,r){if(!Rx(e))throw new Wt(`${r} holds a lone surrogate, which Jx Notation has no way to spell`);if(_x.test(e))return e;if(e.includes(`
42
+ `)){let n=jI(e,t);if(n)return n}else if((e.includes("\\")||e.includes('"'))&&!Ax.test(e)){let n=Nx(e,'"'),s=`${n}"${e}"${n}`;if(Ox(s,e))return s}return mu(e)}function Sr(e,t){if(!Rx(e))throw new Wt(`${t} is a key with a lone surrogate, which Jx Notation cannot spell`);return _x.test(e)?e:mu(e)}function Dt(e,t,r){if(e===null)return"#null";if(e===!0)return"#true";if(e===!1)return"#false";if(Ct(e))return Object.is(e,-0)?"-0":String(e);if(A(e))return Wp(e,t,r);return vl(e)?`(ref)${mu(e.$ref)}`:null}function Cx(e){if(!Xr(e)||e.$prototype!=="Function")return!1;let{$prototype:t,body:r,parameters:n,...s}=e,i=Object.values(s).every((c)=>Dt(c,"","")!==null),o=n===void 0||Array.isArray(n)&&n.length>0&&n.every((c)=>A(c))&&r!==void 0,a=r===void 0||A(r)||Array.isArray(r),l=Array.isArray(r)&&r.length===0;return i&&o&&a&&!l}function Tx(e,t,r,n){let{$prototype:s,body:i,parameters:o,...a}=t,l=[`${r}(fn)${Sr(e,n)}`];for(let[c,u]of Object.entries(a))l.push(`${Sr(c,n)}=${Dt(u,r,pt(n,c))}`);if(Array.isArray(o))for(let c of o)l.push(Wp(String(c),r,pt(n,"parameters")));if(A(i))l.push(Wp(i,r,pt(n,"body")));else if(Array.isArray(i))return[`${l.join(" ")} {`,...i.flatMap((c,u)=>qr("-",c,r+nr,pt(pt(n,"body"),u))),`${r}}`];return[l.join(" ")]}function qr(e,t,r,n){let s=Sr(e,n),i=r+s,o=Dt(t,r,n);if(o!==null)return[`${i} ${o}`];if(Cx(t))return Tx(e,t,r,n);if(Array.isArray(t)){if(t.length===0)return[`${r}(array)${s}`];let u=t.map((h,m)=>Dt(h,r,pt(n,m)));if(t.length>1&&u.every((h)=>h!==null&&!h.includes(`
43
+ `))){let h=`${i} ${u.join(" ")}`;if(h.length<=Bp)return[h]}return[`${i} {`,...t.flatMap((h,m)=>qr("-",h,r+nr,pt(n,m))),`${r}}`]}let a=Xr(t)?Object.entries(t):[];if(a.length===0)return[`${i} {}`];let l=a.every(([u])=>u==="-")?`${r}(object)${s}`:i,c=a.map(([u,p])=>{let h=Dt(p,r,pt(n,u));return h===null||h.includes(`
44
+ `)?null:`${Sr(u,n)}=${h}`});if(c.every((u)=>u!==null)){let u=`${l} ${c.join(" ")}`;if(u.length<=Bp)return[u]}return[`${l} {`,...a.flatMap(([u,p])=>qr(u,p,r+nr,pt(n,u))),`${r}}`]}function Ix(e,t,r,n){let s=Object.entries(t),i=r+Sr(e,n);if(s.length===0)return[`${i} {}`];let o=[],a=0;for(let[h,m]of s){let y=Dt(m,r,pt(n,h));if(y===null||y.includes(`
45
+ `))break;o.push(`${Sr(h,n)}=${y}`),a+=1}let l=`${i} ${o.join(" ")}`,c=o.length>0&&l.length<=Bp,u=c?a:0,p=s.slice(u).flatMap(([h,m])=>{if(Xr(m)&&!vl(m))return Ix(h,m,r+nr,pt(n,h));return qr(h,m,r+nr,pt(n,h))});if(c&&p.length===0)return[l];return[`${c?l:i} {`,...p,`${r}}`]}function kI(e){if(!Xr(e)||e.$prototype!=="Array"||!Xr(e.map))return!1;let{$prototype:t,map:r,...n}=e;return Object.values(n).every((s)=>{let i=Dt(s,"","");return i!==null&&!i.includes(`
46
+ `)})}function _I(e,t,r){let{$prototype:n,map:s,...i}=e,o=[`${t}$array`];for(let[a,l]of Object.entries(i))o.push(`${Sr(a,r)}=${Dt(l,t,pt(r,a))}`);return[`${o.join(" ")} {`,...wl(s??null,t+nr,pt(r,"map")),`${t}}`]}function wl(e,t,r){let n=Dt(e,t,r);if(n!==null)return[`${t}- ${n}`];if(kI(e))return _I(e,t,r);if(Xr(e))return Up(e,t,r);throw new Wt(`${r} is a list inside a list of children, which has no spelling`)}function AI(e,t,r){let{tagName:n}=e;if(!A(n))return`${t}$element`;if(PI.has(n)||n.startsWith("$")||n.startsWith("."))return`${t}$element ${mu(n)}`;return t+Sr(n,r)}function RI(e,t){return t!==null&&!t.includes(`
47
+ `)&&!e.startsWith("on")&&!e.startsWith("$")&&!e.startsWith(".")}function Up(e,t,r){let n=[AI(e,t,r)],s=t+nr,i=[],o={},a=null;for(let[l,c]of Object.entries(e)){let u=pt(r,l);if(l==="tagName"&&A(c))continue;if(l==="children")continue;if(l==="textContent"){let p=Dt(c,t,u);if(p===null||!A(e.tagName))kx(n,i,l,c,s,t,u);else a=p}else if(l==="attributes"&&Xr(c))for(let[p,h]of Object.entries(c)){let m=Dt(h,t,pt(u,p));if(RI(p,m))n.push(`${Sr(p,u)}=${m}`);else o[p]=h}else if(l==="state")i.push(...qr("state",c,s,u));else if(l==="style"&&Xr(c))i.push(...Ix("style",c,s,u));else if(l.startsWith("on")&&vl(c))n.push(`${Sr(l,u)}=${Dt(c,t,u)}`);else if(l.startsWith("on"))i.push(...Cx(c)?Tx(l,c,s,u):qr(l,c,s,u).map((p,h)=>h===0?p.replace(s,`${s}(on)`):p));else if(l.startsWith("$")){let p=Dt(c,t,u);if(p===null||p.includes(`
48
+ `))i.push(...qr(l,c,s,u));else n.push(`${Sr(l,u)}=${p}`)}else kx(n,i,l,c,s,t,u)}if(Object.keys(o).length>0)i.push(...qr("attributes",o,s,pt(r,"attributes")));if(i.push(...OI(e.children,s,pt(r,"children"))),a!==null)n.push(a);return i.length===0?[n.join(" ")]:[`${n.join(" ")} {`,...i,`${t}}`]}function OI(e,t,r){if(e===void 0)return[];if(Array.isArray(e)){if(e.length===0)return[`${t}(array).children`];return e.flatMap((s,i)=>wl(s,t,pt(r,i)))}let n=Dt(e,t,r);if(n!==null)return[`${t}.children ${n}`];return[`${t}.children {`,...wl(e,t+nr,r),`${t}}`]}function kx(e,t,r,n,s,i,o){let a=Sr(`.${r}`,o);if(r==="map"&&Xr(n)){t.push(`${s}${a} {`,...wl(n,s+nr,o),`${s}}`);return}if(r==="cases"&&Xr(n)){t.push(`${s}${a} {`);for(let[c,u]of Object.entries(n))t.push(`${s}${nr}${Sr(c,o)} {`,...wl(u,s+nr+nr,pt(o,c)),`${s}${nr}}`);t.push(`${s}}`);return}let l=Dt(n,i,o);if(l===null||l.includes(`
49
+ `))t.push(...qr(`.${r}`,n,s,o));else e.push(`${a}=${l}`)}function Jx(e,t){return["$head {",...e.flatMap((r,n)=>Xr(r)&&!vl(r)&&A(r.tagName)&&!r.$ref?Up(r,t,`/$head/${n}`):qr("-",r,t,`/$head/${n}`)),"}"]}function NI(e){let{document:t,spans:r}=Jp(e);return{document:B(t)?t:null,spans:r}}function Hp(e,t){let r=CI(e);return t===void 0?r:du(t,r,NI)}function CI(e){if(!B(e))throw new Wt("A document is an object");let t=e,r=["/- kdl-version 2"],n={};for(let[s,i]of Object.entries(t))if(s==="$head"&&Array.isArray(i))r.push(...Jx(i,nr));else if(s==="$head")r.push(`(object)${qr(s,i,"","/$head").join(`
50
+ `)}`);else if(s.startsWith("$"))r.push(...qr(s,i,"",pt("",s)));else n[s]=i;if(Object.keys(n).length>0)r.push("",...Up(n,"",""));return`${r.join(`
51
51
  `)}
52
- `}var nr=" ",jp=100,ix,ox,qT,VT,Gr=(e)=>W(e),ml=(e)=>Gr(e)&&O(e.$ref)&&Object.keys(e).length===1,pt=(e,t)=>`${e}/${String(t).replaceAll("~","~0").replaceAll("/","~1")}`;var tu=D(()=>{Uc();ye();Do();dl();Qc();ix=/^(?![-+]?\.?\d)(?!(?:true|false|null|inf|-inf|nan)$)[^\s\\/(){};[\]"#=,\p{Cc}\p{Cf}\p{Zl}\p{Zp}]+$/u,ox=/[\p{Cc}\p{Zl}\p{Zp}‎‏‪-‮⁦-⁩]/u,qT=/(?!\n)\p{Cc}|[\p{Zl}\p{Zp}‎‏‪-‮⁦-⁩]/u,VT=new Set(["-","attributes","script","state","style"])});function QT(e,t,r){if(Lo(e,t)!==null)throw Fe(e,t,`"project" names the file's kind, and takes no annotation`);let n=ds(e,t);if(n.length>1||ps(t).length>0||wr(t).length>0)throw Fe(e,t,`"project" holds one value, the project's name, and nothing else`);if(n[0]!==void 0)Je(r,"name",n[0],e,t),Ht(e,"/name",t)}function eI(e,t,r){let n=t.getName(),s=`/${Fr(n)}`,i=t.getTag()===null,o;if(n==="$head"&&i)o=gp(e,t),Ht(e,s,t);else if(ZT.has(n)&&i)o=Gc(e,t,s);else o=zr(e,t,s);Je(r,n,o,e,t)}function tI(e){if(Eo(e.text)==="document")throw new Bt('A project file declares itself: its first node, after any $ metadata, is project "<name>"');let t=yp(e.text),r={},n=!1;for(let s of t.nodes)if(s.getName()===XT){if(n)throw Fe(e,s,'"project" is written twice, and a file declares one project');QT(e,s,r),n=!0}else eI(e,s,r);return vo(r)}function Ap(e,t){try{return tI({spans:null,text:e})}catch(r){throw t!==void 0&&r instanceof Bt?r.inFile(t):r}}var XT="project",ZT;var Rp=D(()=>{ye();er();tl();Do();dl();Qc();tu();ZT=new Set(["$media","style"])});var Wi=D(()=>{tl();Kc();Do();Zb();dl();Qc();tu();Rp()});function yx(e){if(e===null)throw TypeError("A class descriptor cannot be null");return W(e)?e:{}}class hl{name;classPath;classDef;extensions;mediaType;mediaTypeEssence;documentKinds;exportTarget;remote;studio;project;server;connector;capabilities;#t;#e=null;constructor(e,t,r,n){this.name=e,this.classPath=t,this.classDef=r,this.#t=n;let{format:s}=r;this.extensions=(s?.extensions??[]).map((i)=>i.toLowerCase()),this.mediaType=s?.mediaType??null,this.mediaTypeEssence=db(this.mediaType),this.documentKinds=s?.documentKinds??[],this.exportTarget=s?.exportTarget===!0,this.remote=s?.remote===!0,this.studio=r.$studio??null,this.project=r.project??null,this.server=r.server??null,this.connector=r.connector??null,this.capabilities=sI(r)}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.#r(await this.implementation())}#r(e){let t=this.classDef.title??this.name;return e[t]??e.default?.[t]??e.default}async call(e,...t){let r=this.capabilities[e];if(!r)throw Error(`Format class "${this.name}" does not declare a "${e}" capability`);let n=this.#r(await this.implementation()),s=n?.[r.identifier];if(!Wt(s)){let o=this.classDef.title??this.name;throw TypeError(`Format class "${this.name}": implementation export "${o}" has no static "${r.identifier}" method`)}return await s.call(n,...t)}async parseDocument(e,t){return await this.call("parse",e,t)}}class ru{#t;get#e(){return[...this.#t,lI]}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 r=fb(t.mediaType);if(r!==null)throw Error(`Format "${t.name}" declares an invalid mediaType: ${r}`)}for(let t of hx){let r=new Map;for(let n of e){if(!n.capabilities[t])continue;for(let s of n.extensions){let i=r.get(s);if(i)throw Error(`Format conflict: "${i.name}" and "${n.name}" both claim "${s}" with the "${t}" capability`);r.set(s,n)}}}}get entries(){return this.#t}byExtension(e,t){let r=mx(e);return this.#e.find((n)=>n.extensions.includes(r)&&(!t||n.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 r of this.#e){if(e&&!r.documentKinds.includes(e))continue;for(let n of r.extensions)t.add(n)}return t.delete(".json"),[...t]}has(e){let t=mx(e);return this.#e.some((r)=>r.extensions.includes(t))}}function sI(e){let t={},r=e.$defs?.methods??{};for(let[n,s]of Object.entries(r)){let{role:i}=s;if(!oI(i))continue;let o={identifier:s.identifier??n,timing:s.timing??nI};if(O(s.discriminator))o.discriminator=s.discriminator;t[i]=o}return t}function oI(e){return e!==void 0&&iI.has(e)}function mx(e){let t=e.toLowerCase();return t.startsWith(".")?t:`.${t}`}var hx,gx,nI,iI,aI,lI;var Op=D(()=>{ye();zd();hx=["parse","serialize","rewrite","discover","load"],gx=[...hx,"projectData","resolvePaths","lower","emit","head","assets","mount","dialect","deploySchema","bindings","testConnection"];nI=["compiler","server"];iI=new Set(gx);aI={importModule:async()=>{await Promise.resolve().then(() => Wi());return{JxNotation:{parse:(r)=>Vi(r),serialize:(r)=>_p(r)}}},loadJson:()=>Promise.reject(Error("Jx Notation reads no file of its own")),resolvePath:(e,t)=>t},lI=new hl("jxn","",{$defs:{methods:{parse:{role:"parse"},serialize:{role:"serialize"}}},$implementation:"jxn",format:{documentKinds:["page","component"],extensions:[".jxn"]},title:"JxNotation"},aI)});class bx{#t;#e;#r;constructor(e){this.#t=e,this.#e=e.flatMap((s)=>s.classes);let t=new Map;for(let s of e)for(let i of s.classes){let o=t.get(i.name);if(o&&o!==s.specifier)throw Error(`Extension conflict: "${o}" and "${s.specifier}" both provide a class named "${i.name}"`);t.set(i.name,s.specifier)}let r=new Map;for(let s of this.#e){if(!s.project)continue;let i=r.get(s.project.key);if(i)throw Error(`Extension conflict: "${i.name}" and "${s.name}" both claim the project section "${s.project.key}"`);r.set(s.project.key,s)}let n=new Map;for(let s of this.#e){if(!s.server)continue;let{basePath:i}=s.server;if(!i.startsWith("/_jx/"))throw Error(`Extension "${s.name}": server basePath "${i}" must be under /_jx/`);let o=n.get(i);if(o)throw Error(`Extension conflict: "${o.name}" and "${s.name}" both mount "${i}"`);n.set(i,s)}this.#r=new ru(this.#e.filter((s)=>s.extensions.length>0))}get extensions(){return this.#t}get classes(){return this.#e}get formats(){return this.#r}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 xx(e,t,r){let n=[];for(let s of e??[])n.push(await cI(s,t,r));return new bx(n)}async function cI(e,t,r){let n;if(e.startsWith("./")||e.startsWith("../")){let l=t.resolvePath(r,e);n=t.resolvePath(`${l}/package.json`,`./${gl}`)}else try{n=t.resolvePath(r,`${e}/${gl}`)}catch(l){throw Error(`Extension "${e}" is not resolvable: it must export ${gl} (is the package installed, and does its exports map include it?): ${Cp(l)}`,{cause:l})}let s;try{s=await t.loadJson(n)}catch(l){throw Error(`Extension "${e}": cannot read manifest ${n}: ${Cp(l)}`,{cause:l})}if(!W(s)||!O(s.name))throw Error(`Extension "${e}": ${gl} must declare a "name"`);let i=s;if(!e.startsWith(".")&&i.name!==e)throw Error(`Extension "${e}": manifest name "${i.name}" does not match the specifier`);let o=[];for(let[l,c]of Object.entries(i.classes??{})){let u=t.resolvePath(n,c),p;try{p=await t.loadJson(u)}catch(h){throw Error(`Extension "${e}": cannot read class "${l}" at ${u}: ${Cp(h)}`,{cause:h})}o.push(new hl(l,u,yx(p),t))}let a={};if(i.schemas?.project)a.project=t.resolvePath(n,i.schemas.project);if(i.schemas?.document)a.document=t.resolvePath(n,i.schemas.document);if(i.schemas?.fields)a.fields=t.resolvePath(n,i.schemas.fields);return{specifier:e,manifestPath:n,manifest:i,classes:o,schemas:a}}function Cp(e){return e instanceof Error?e.message:String(e)}var gl="jx-extension.json";var $x=D(()=>{Op();ye();Op()});var wx=D(()=>{ye()});function fI(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 Sx(e){let t=uI.filter((r)=>e(r));if(t.length>1)return"conflict";return t[0]??null}function nu(e,t){return ms(t)?Ap(e,t):eb(e,t)}var uI,vx="project.jxn",Np;var su=D(()=>{ye();wx();tl();Kc();Rp();er();uI=["project.jxn","project.json"];Np=class Np extends Error{constructor(e){super(fI(e));this.name="ProjectFileConflictError"}}});import{accessSync as GZ,closeSync as KZ,constants as YZ,existsSync as dI,fstatSync as XZ,lstatSync as ZZ,openSync as QZ,readFileSync as eQ,statSync as tQ}from"node:fs";import{dirname as nQ,join as Ex}from"node:path";function pI(e){return Sx((t)=>dI(Ex(e,t)))}function kn(e){let t=pI(e);if(t==="conflict")throw new Np(e);return Ex(e,t??vx)}var Vo=D(()=>{su()});import{readFileSync as mI}from"node:fs";import{dirname as hI,isAbsolute as gI,resolve as jx,sep as iu}from"node:path";import{pathToFileURL as yI}from"node:url";import{createRequire as bI}from"node:module";async function Tp(e){let t=[e],r=`${iu}src${iu}`,n=`${iu}dist${iu}`;if(e.includes(r)){let i=e.replace(r,n);if(t.push(i),i.endsWith(".ts"))t.push(`${i.slice(0,-3)}.js`)}if(e.endsWith(".js"))t.push(`${e.slice(0,-3)}.ts`);let s;for(let i of t)try{return await import(yI(i).href)}catch(o){s=o}throw s instanceof Error?s:Error(String(s))}function Ip(e,t){return bI(jx(e,"package.json")).resolve(t)}function Jp(e){return{importModule:(t)=>Tp(t),loadJson:async(t)=>JSON.parse(mI(t,"utf8")),resolvePath:(t,r)=>{if(r.startsWith("./")||r.startsWith("../"))return jx(hI(t),r);if(gI(r))return r;return Ip(e,r)}}}async function Bs(e,t){return xx(t?.extensions,Jp(e),kn(e))}function ou(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 bs=D(()=>{$x();ye();Vo()});import{existsSync as xI,readFileSync as $I}from"node:fs";import{basename as wI,resolve as vI}from"node:path";function Hs(e){let t=kn(e);if(!xI(t))throw Error(`No project.jxn or project.json in ${e}`);let r;try{r=nu($I(t,"utf8"),t)}catch(o){throw Error(`Invalid ${wI(t)}: ${je(o)}`,{cause:o})}let n={...yl,...r,build:{...yl.build,...r.build},defaults:{...yl.defaults,...r.defaults},images:{...yl.images,...r.images},url:r.url??yl.url};if(r.$head)n.$head=r.$head;if(r.$media)n.$media=r.$media;if(r.style)n.style=r.style;if(r.state)n.state=r.state;if(r.redirects)n.redirects=r.redirects;if(r.imports)n.imports=r.imports;let s=["cloudflare-workers","cloudflare-pages","node","bun"];if(n.build.adapter==="static")delete n.build.adapter;if(n.build.adapter&&!s.includes(n.build.adapter))throw Error(`Unknown build adapter "${n.build.adapter}" in project.json. Valid adapters: ${s.join(", ")}`);let i=["build","cloudflare"];if(!i.includes(n.images.service))throw Error(`Unknown images.service "${n.images.service}" in project.json. Valid services: ${i.join(", ")}`);return{config:n,configPath:t,projectRoot:vI(e)}}var yl;var bl=D(()=>{er();su();Vo();yl={$head:[],$media:{},build:{format:"directory",outDir:"./dist",provider:null,trailingSlash:"always"},defaults:{charset:"utf8",lang:"en",layout:null},images:{formats:["webp","avif"],lazyLoad:!0,optimize:!0,picture:!0,quality:{avif:65,jpeg:80,png:80,webp: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 Mp,readFileSync as Px,writeFileSync as SI}from"node:fs";import{resolve as kx}from"node:path";async function _x(e,t={}){let{dryRun:r=!1,connection:n}=t,{config:s}=Hs(e),i=await Bs(e,s),o=W(s.connections)?s.connections:{},a=W(s.data)?s.data:{},l=Object.keys(o).filter((b)=>!n||b===n);if(n&&l.length===0)throw Error(`Unknown connection "${n}" (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,...jI(e),JX_PROJECT_ROOT:e},u=[],p=[];for(let b of l){let g=o[b],y=W(g)?{...g,$name:b}:{$name:b},w=String(y.provider??""),j=EI(i.connectors(),w);if(!j)throw Error(`Connection "${b}" names provider "${w}", but no enabled extension provides it (enable the extension in project.json "extensions")`);let S={};for(let[P,A]of Object.entries(a))if(W(A)&&A.connection===b)S[P]=A;let E=await j.call("deploySchema",S,y,{dryRun:r,env:c});if(u.push({applied:E.applied??!r,connection:b,provider:w,statements:E.statements??[],tables:Object.keys(S),warnings:E.warnings??[]}),j.capabilities.bindings){let P=await j.call("bindings",y);if(W(P)&&Object.keys(P).length>0)p.push(P)}}let h=kx(e,"wrangler.jsonc"),m=!1;if(!r&&p.length>0&&Mp(h)){let b=Px(h,"utf8"),{content:g,patched:y}=sb(b,p);if(y&&g!==b)SI(h,g,"utf8"),m=!0}return{bindingsPatched:m,results:u,wranglerPath:Mp(h)?h:null}}function EI(e,t){return e.find((r)=>r.connector?.provider===t)}function jI(e){let t=kx(e,".dev.vars");if(!Mp(t))return{};let r=new Map;for(let n of Px(t,"utf8").split(`
53
- `)){let s=n.trim();if(s===""||s.startsWith("#"))continue;let i=s.indexOf("=");if(i===-1)continue;let o=s.slice(0,i).trim(),a=s.slice(i+1).trim();if(a.startsWith('"')&&a.endsWith('"')||a.startsWith("'")&&a.endsWith("'"))a=a.slice(1,-1);if(o!=="")r.set(o,a)}return Object.fromEntries(r)}var Ax=D(()=>{ob();bs();bl();ye()});function Bi(e){return e.startsWith(au)}function Rx(e){let t=e;if(Bi(t))t=t.slice(au.length);return t=t.replace(/^\.\//,"").replace(/\.(js|ts|mjs|mts)$/,"").replaceAll("@","").replaceAll(/[/\\]+/g,"-").replaceAll(/[^\w.-]/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,""),`${Dp}${t}.js`}function Ox(e){let t=/\.(\w+)$/.exec(e)?.[1]??"",r=e.replace(/\.\w+$/,"").replaceAll("@","").replaceAll(/[/\\]+/g,"-").replaceAll(/[^\w.-]/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,"");return t===""?`${Dp}${r}`:`${Dp}${r}.${t}`}function Cx(e){let t=e.replaceAll("\\","/");return t.length>1&&t.endsWith("/")?t.slice(0,-1):t}function lu(e){let t=Cx(e);return t.startsWith("/")?t:`/${t}`}function PI(e,t){return[...e].toSorted((r,n)=>n[t].length-r[t].length)}function cu(e,t){let r=t.split("#")[0].split("?")[0];if(!r.startsWith("/"))return null;let n;try{n=decodeURIComponent(r)}catch{return null}if(/%2e|%2f/i.test(n))return null;for(let s of PI(e,"urlPrefix")){let i=lu(s.urlPrefix);if(!n.startsWith(`${i}/`))continue;let a=n.slice(i.length+1).split("/");if(a.some((c)=>c===""||c==="."||c===".."))return null;let{filter:l}=s;if(l&&!l(a.join("/")))return null;return`${Cx(s.dir)}/${a.join("/")}`}return null}function Nx(e,t){let r=new Set;for(let n of t){let s=lu(n.urlPrefix),i=new RegExp(`${s.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}/[^${kI}]+`,"g");for(let o of e.matchAll(i)){let a=o[0].split("#")[0].split("?")[0];if(!a.endsWith("/"))r.add(a)}}return[...r].filter(Boolean)}function Lp(e){let t=[],r=0;while(r<e.length){while(r<e.length&&(/\s/.test(e[r])||e[r]===","))r+=1;if(r>=e.length)break;let n=r;while(r<e.length&&!/\s/.test(e[r]))r+=1;let s=e.slice(n,r);if(s.endsWith(",")){t.push({descriptor:"",url:s.replace(/,+$/,"")});continue}while(r<e.length&&/\s/.test(e[r]))r+=1;let i=r;while(r<e.length&&e[r]!==",")r+=1;let o=e.slice(i,r).trim();if(r+=1,s=s.replace(/,+$/,""),s!=="")t.push({descriptor:o,url:s})}return t}function Fp(e){return e.map(({url:t,descriptor:r})=>r?`${t} ${r}`:t).join(", ")}function Hi(e){if(!O(e)||e==="")return"";let t;try{({pathname:t}=new URL(e))}catch{return""}let r=t.replace(/\/+$/,"");if(r===""||r==="/")return"";return r.startsWith("/")?r:`/${r}`}function Xe(e,t){if(e===""||!t.startsWith("/")||t.startsWith("//"))return t;if(t===e||t.startsWith(`${e}/`))return t;return e+t}function Us(e,t){let r=new URL(t);if(!r.pathname.endsWith("/"))r.pathname+="/";return new URL(e.replace(/^\/+/,""),r).href}var au="npm:",Dp="/assets/",kI;var Vr=D(()=>{ye();kI=String.raw`"'\s<>()\\`});function Tx(e,t){return e.replaceAll(CI,(r,n,s)=>{let i=s.trim(),o=MI.exec(i),a=o?o[2]:i,l=Xe(t,a);if(l===a)return r;return`url(${n}${o?`${o[1]}${l}${o[1]}`:l}${n})`})}function DI(e,t,r,n,s){let i=r.toLowerCase();if(_I.has(i))return Xe(s,n);if(AI.has(i)){let o=Lp(n);return o.length===0?n:Fp(o.map((a)=>({descriptor:a.descriptor,url:Xe(s,a.url)})))}if(i==="style")return Tx(n,s);if(i==="content"&&e==="meta"&&JI.test(t))return Xe(s,n);return n}function Ix(e,t){if(t==="")return e;let r=e.replaceAll(TI,(n,s,i,o)=>{let a=i.replaceAll(NI,(l,c)=>`"${Xe(t,c)}"`);return s+a+o});return r=r.replaceAll(II,(n,s,i,o)=>s+Tx(i,t)+o),r.replaceAll(RI,(n,s,i)=>{if(i==="")return n;let o=s.toLowerCase(),a=i.replaceAll(OI,(l,c,u,p,h)=>{let m=p===void 0?"'":'"',b=p??h??"",g=DI(o,i,c,b,t);return g===b?l:`${c}=${m}${g}${m}`});return a===i?n:`<${s}${a}>`})}var _I,AI,RI,OI,CI,NI,TI,II,JI,MI;var Jx=D(()=>{Vr();_I=new Set(["href","src","poster","action","formaction","data"]),AI=new Set(["srcset","imagesrcset"]),RI=/<([a-zA-Z][a-zA-Z0-9-]*)((?:"[^"]*"|'[^']*'|[^>"'])*)>/g,OI=/([a-zA-Z_:][\w:.-]*)\s*=\s*("([^"]*)"|'([^']*)')/g,CI=/url\(\s*(['"]?)([^'")]+)\1\s*\)/g,NI=/"(\/[^"/][^"]*)"/g,TI=/(<script\b[^>]*\btype\s*=\s*["']importmap["'][^>]*>)([\s\S]*?)(<\/script>)/gi,II=/(<style\b[^>]*>)([\s\S]*?)(<\/style>)/gi,JI=/\b(?:property|name)\s*=\s*["'](?:og:|twitter:)[\w:.-]*(?:image|url|video|audio|player)[\w:.-]*["']/i,MI=/^(&quot;|&#34;|&apos;|&#39;)([\s\S]*)\1$/});var wu=N(function(OQ,a0){var __dirname="/home/runner/work/jx/jx/node_modules/esbuild/lib",__filename="/home/runner/work/jx/jx/node_modules/esbuild/lib/main.js",{defineProperty:Hp,getOwnPropertyDescriptor:LI,getOwnPropertyNames:FI}=Object,qI=Object.prototype.hasOwnProperty,VI=(e,t)=>{for(var r in t)Hp(e,r,{get:t[r],enumerable:!0})},WI=(e,t,r,n)=>{if(t&&typeof t==="object"||typeof t==="function"){for(let s of FI(t))if(!qI.call(e,s)&&s!==r)Hp(e,s,{get:()=>t[s],enumerable:!(n=LI(t,s))||n.enumerable})}return e},BI=(e)=>WI(Hp({},"__esModule",{value:!0}),e),vl={};VI(vl,{analyzeMetafile:()=>w2,analyzeMetafileSync:()=>j2,build:()=>y2,buildSync:()=>v2,context:()=>b2,default:()=>A2,formatMessages:()=>$2,formatMessagesSync:()=>E2,initialize:()=>k2,stop:()=>P2,transform:()=>x2,transformSync:()=>S2,version:()=>g2});a0.exports=BI(vl);function Mx(e){let t=(n)=>{if(n===null)r.write8(0);else if(typeof n==="boolean")r.write8(1),r.write8(+n);else if(typeof n==="number")r.write8(2),r.write32(n|0);else if(typeof n==="string")r.write8(3),r.write(hn(n));else if(n instanceof Uint8Array)r.write8(4),r.write(n);else if(n instanceof Array){r.write8(5),r.write32(n.length);for(let s of n)t(s)}else{let s=Object.keys(n);r.write8(6),r.write32(s.length);for(let i of s)r.write(hn(i)),t(n[i])}},r=new zx;return r.write32(0),r.write32(e.id<<1|+!e.isRequest),t(e.value),Vp(r.buf,r.len-4,0),r.buf.subarray(0,r.len)}function HI(e){let t=()=>{switch(r.read8()){case 0:return null;case 1:return!!r.read8();case 2:return r.read32();case 3:return Yi(r.read());case 4:return r.read();case 5:{let o=r.read32(),a=[];for(let l=0;l<o;l++)a.push(t());return a}case 6:{let o=r.read32(),a={};for(let l=0;l<o;l++)a[Yi(r.read())]=t();return a}default:throw Error("Invalid packet")}},r=new zx(e),n=r.read32(),s=(n&1)===0;n>>>=1;let i=t();if(r.ptr!==e.length)throw Error("Invalid packet");return{id:n,isRequest:s,value:i}}var zx=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);Vp(this.buf,e,t)}write(e){let t=this._write(4+e.length);Vp(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 Gx(this.buf,this._read(4))}read(){let e=this.read32(),t=new Uint8Array(e),r=this._read(t.length);return t.set(this.buf.subarray(r,r+e)),t}},hn,Yi,qp;if(typeof TextEncoder<"u"&&typeof TextDecoder<"u"){let e=new TextEncoder,t=new TextDecoder;hn=(r)=>e.encode(r),Yi=(r)=>t.decode(r),qp='new TextEncoder().encode("")'}else if(typeof Buffer<"u")hn=(e)=>Buffer.from(e),Yi=(e)=>{let{buffer:t,byteOffset:r,byteLength:n}=e;return Buffer.from(t,r,n).toString()},qp='Buffer.from("")';else throw Error("No UTF-8 codec found");if(!(hn("")instanceof Uint8Array))throw Error(`Invariant violation: "${qp} instanceof Uint8Array" is incorrectly false
52
+ `}var nr=" ",Bp=100,_x,Ax,EI,PI,Xr=(e)=>B(e),vl=(e)=>Xr(e)&&A(e.$ref)&&Object.keys(e).length===1,pt=(e,t)=>`${e}/${String(t).replaceAll("~","~0").replaceAll("/","~1")}`;var hu=M(()=>{ou();ye();Vo();$l();pu();_x=/^(?![-+]?\.?\d)(?!(?:true|false|null|inf|-inf|nan)$)[^\s\\/(){};[\]"#=,\p{Cc}\p{Cf}\p{Zl}\p{Zp}]+$/u,Ax=/[\p{Cc}\p{Zl}\p{Zp}‎‏‪-‮⁦-⁩]/u,EI=/(?!\n)\p{Cc}|[\p{Zl}\p{Zp}‎‏‪-‮⁦-⁩]/u,PI=new Set(["-","attributes","script","state","style"])});function JI(e,t,r){if(Bo(e,t)!==null)throw Le(e,t,`"project" names the file's kind, and takes no annotation`);let n=gs(e,t);if(n.length>1||ys(t).length>0||vr(t).length>0)throw Le(e,t,`"project" holds one value, the project's name, and nothing else`);if(n[0]!==void 0)Je(r,"name",n[0],e,t),Ut(e,"/name",t)}function MI(e,t,r){let n=t.getName(),s=`/${Fr(n)}`,i=t.getTag()===null,o;if(n==="$head"&&i)o=Tp(e,t),Ut(e,s,t);else if(II.has(n)&&i)o=lu(e,t,s);else o=Kr(e,t,s);Je(r,n,o,e,t)}function DI(e){if(_o(e.text)==="document")throw new Wt('A project file declares itself: its first node, after any $ metadata, is project "<name>"');let t=Ip(e.text),r={},n=!1;for(let s of t.nodes)if(s.getName()===TI){if(n)throw Le(e,s,'"project" is written twice, and a file declares one project');JI(e,s,r),n=!0}else MI(e,s,r);return jo(r)}function zp(e,t){try{return DI({spans:null,text:e})}catch(r){throw t!==void 0&&r instanceof Wt?r.inFile(t):r}}var TI="project",II;var Gp=M(()=>{ye();er();cl();Vo();$l();pu();hu();II=new Set(["$media","style"])});var Ui=M(()=>{cl();cu();Vo();wx();$l();pu();hu();Gp()});function Fx(e){if(e===null)throw TypeError("A class descriptor cannot be null");return B(e)?e:{}}class Sl{name;classPath;classDef;extensions;mediaType;mediaTypeEssence;documentKinds;exportTarget;remote;studio;project;server;connector;capabilities;#t;#e=null;constructor(e,t,r,n){this.name=e,this.classPath=t,this.classDef=r,this.#t=n;let{format:s}=r;this.extensions=(s?.extensions??[]).map((i)=>i.toLowerCase()),this.mediaType=s?.mediaType??null,this.mediaTypeEssence=Ib(this.mediaType),this.documentKinds=s?.documentKinds??[],this.exportTarget=s?.exportTarget===!0,this.remote=s?.remote===!0,this.studio=r.$studio??null,this.project=r.project??null,this.server=r.server??null,this.connector=r.connector??null,this.capabilities=qI(r)}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.#r(await this.implementation())}#r(e){let t=this.classDef.title??this.name;return e[t]??e.default?.[t]??e.default}async call(e,...t){let r=this.capabilities[e];if(!r)throw Error(`Format class "${this.name}" does not declare a "${e}" capability`);let n=this.#r(await this.implementation()),s=n?.[r.identifier];if(!Vt(s)){let o=this.classDef.title??this.name;throw TypeError(`Format class "${this.name}": implementation export "${o}" has no static "${r.identifier}" method`)}return await s.call(n,...t)}async parseDocument(e,t){return await this.call("parse",e,t)}}class gu{#t;get#e(){return[...this.#t,UI]}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 r=Tb(t.mediaType);if(r!==null)throw Error(`Format "${t.name}" declares an invalid mediaType: ${r}`)}for(let t of Dx){let r=new Map;for(let n of e){if(!n.capabilities[t])continue;for(let s of n.extensions){let i=r.get(s);if(i)throw Error(`Format conflict: "${i.name}" and "${n.name}" both claim "${s}" with the "${t}" capability`);r.set(s,n)}}}}get entries(){return this.#t}byExtension(e,t){let r=Mx(e);return this.#e.find((n)=>n.extensions.includes(r)&&(!t||n.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 r of this.#e){if(e&&!r.documentKinds.includes(e))continue;for(let n of r.extensions)t.add(n)}return t.delete(".json"),[...t]}has(e){let t=Mx(e);return this.#e.some((r)=>r.extensions.includes(t))}}function qI(e){let t={},r=e.$defs?.methods??{};for(let[n,s]of Object.entries(r)){let{role:i}=s;if(!BI(i))continue;let o={identifier:s.identifier??n,timing:s.timing??FI};if(A(s.discriminator))o.discriminator=s.discriminator;t[i]=o}return t}function BI(e){return e!==void 0&&VI.has(e)}function Mx(e){let t=e.toLowerCase();return t.startsWith(".")?t:`.${t}`}var Dx,Lx,FI,VI,WI,UI;var Kp=M(()=>{ye();fp();Dx=["parse","serialize","rewrite","discover","load"],Lx=[...Dx,"projectData","resolvePaths","lower","emit","head","assets","mount","dialect","deploySchema","bindings","testConnection"];FI=["compiler","server"];VI=new Set(Lx);WI={importModule:async()=>{await Promise.resolve().then(() => Ui());return{JxNotation:{parse:(r)=>Wi(r),serialize:(r)=>Hp(r)}}},loadJson:()=>Promise.reject(Error("Jx Notation reads no file of its own")),resolvePath:(e,t)=>t},UI=new Sl("jxn","",{$defs:{methods:{parse:{role:"parse"},serialize:{role:"serialize"}}},$implementation:"jxn",format:{documentKinds:["page","component"],extensions:[".jxn"]},title:"JxNotation"},WI)});class qx{#t;#e;#r;constructor(e){this.#t=e,this.#e=e.flatMap((s)=>s.classes);let t=new Map;for(let s of e)for(let i of s.classes){let o=t.get(i.name);if(o&&o!==s.specifier)throw Error(`Extension conflict: "${o}" and "${s.specifier}" both provide a class named "${i.name}"`);t.set(i.name,s.specifier)}let r=new Map;for(let s of this.#e){if(!s.project)continue;let i=r.get(s.project.key);if(i)throw Error(`Extension conflict: "${i.name}" and "${s.name}" both claim the project section "${s.project.key}"`);r.set(s.project.key,s)}let n=new Map;for(let s of this.#e){if(!s.server)continue;let{basePath:i}=s.server;if(!i.startsWith("/_jx/"))throw Error(`Extension "${s.name}": server basePath "${i}" must be under /_jx/`);let o=n.get(i);if(o)throw Error(`Extension conflict: "${o.name}" and "${s.name}" both mount "${i}"`);n.set(i,s)}this.#r=new gu(this.#e.filter((s)=>s.extensions.length>0))}get extensions(){return this.#t}get classes(){return this.#e}get formats(){return this.#r}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 Vx(e,t,r){let n=[];for(let s of e??[])n.push(await HI(s,t,r));return new qx(n)}async function HI(e,t,r){let n;if(e.startsWith("./")||e.startsWith("../")){let l=t.resolvePath(r,e);n=t.resolvePath(`${l}/package.json`,`./${El}`)}else try{n=t.resolvePath(r,`${e}/${El}`)}catch(l){throw Error(`Extension "${e}" is not resolvable: it must export ${El} (is the package installed, and does its exports map include it?): ${Xp(l)}`,{cause:l})}let s;try{s=await t.loadJson(n)}catch(l){throw Error(`Extension "${e}": cannot read manifest ${n}: ${Xp(l)}`,{cause:l})}if(!B(s)||!A(s.name))throw Error(`Extension "${e}": ${El} must declare a "name"`);let i=s;if(!e.startsWith(".")&&i.name!==e)throw Error(`Extension "${e}": manifest name "${i.name}" does not match the specifier`);let o=[];for(let[l,c]of Object.entries(i.classes??{})){let u=t.resolvePath(n,c),p;try{p=await t.loadJson(u)}catch(h){throw Error(`Extension "${e}": cannot read class "${l}" at ${u}: ${Xp(h)}`,{cause:h})}o.push(new Sl(l,u,Fx(p),t))}let a={};if(i.schemas?.project)a.project=t.resolvePath(n,i.schemas.project);if(i.schemas?.document)a.document=t.resolvePath(n,i.schemas.document);if(i.schemas?.fields)a.fields=t.resolvePath(n,i.schemas.fields);return{specifier:e,manifestPath:n,manifest:i,classes:o,schemas:a}}function Xp(e){return e instanceof Error?e.message:String(e)}var El="jx-extension.json";var Bx=M(()=>{Kp();ye();Kp()});var Wx=M(()=>{ye()});function GI(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 Hx(e){let t=zI.filter((r)=>e(r));if(t.length>1)return"conflict";return t[0]??null}function yu(e,t){return bs(t)?zp(e,t):Sb(e,t)}var zI,Ux="project.jxn",Yp;var bu=M(()=>{ye();Wx();cl();cu();Gp();er();zI=["project.jxn","project.json"];Yp=class Yp extends Error{constructor(e){super(GI(e));this.name="ProjectFileConflictError"}}});import{accessSync as lee,closeSync as cee,constants as uee,existsSync as KI,fstatSync as fee,lstatSync as dee,openSync as pee,readFileSync as mee,statSync as hee}from"node:fs";import{dirname as yee,join as zx}from"node:path";function XI(e){return Hx((t)=>KI(zx(e,t)))}function On(e){let t=XI(e);if(t==="conflict")throw new Yp(e);return zx(e,t??Ux)}var Ho=M(()=>{bu()});import{readFileSync as YI}from"node:fs";import{dirname as ZI,isAbsolute as QI,resolve as Gx,sep as xu}from"node:path";import{pathToFileURL as e2}from"node:url";import{createRequire as t2}from"node:module";async function Zp(e){let t=[e],r=`${xu}src${xu}`,n=`${xu}dist${xu}`;if(e.includes(r)){let i=e.replace(r,n);if(t.push(i),i.endsWith(".ts"))t.push(`${i.slice(0,-3)}.js`)}if(e.endsWith(".js"))t.push(`${e.slice(0,-3)}.ts`);let s;for(let i of t)try{return await import(e2(i).href)}catch(o){s=o}throw s instanceof Error?s:Error(String(s))}function Qp(e,t){return t2(Gx(e,"package.json")).resolve(t)}function em(e){return{importModule:(t)=>Zp(t),loadJson:async(t)=>JSON.parse(YI(t,"utf8")),resolvePath:(t,r)=>{if(r.startsWith("./")||r.startsWith("../"))return Gx(ZI(t),r);if(QI(r))return r;return Qp(e,r)}}}async function zs(e,t){return Vx(t?.extensions,em(e),On(e))}function $u(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 vs=M(()=>{Bx();ye();Ho()});import{existsSync as r2,readFileSync as n2}from"node:fs";import{basename as s2,resolve as i2}from"node:path";function Gs(e){let t=On(e);if(!r2(t))throw Error(`No project.jxn or project.json in ${e}`);let r;try{r=yu(n2(t,"utf8"),t)}catch(o){throw Error(`Invalid ${s2(t)}: ${Pe(o)}`,{cause:o})}let n={...Pl,...r,build:{...Pl.build,...r.build},defaults:{...Pl.defaults,...r.defaults},images:{...Pl.images,...r.images},url:r.url??Pl.url};if(r.$head)n.$head=r.$head;if(r.$media)n.$media=r.$media;if(r.style)n.style=r.style;if(r.state)n.state=r.state;if(r.redirects)n.redirects=r.redirects;if(r.imports)n.imports=r.imports;let s=["cloudflare-workers","cloudflare-pages","node","bun"];if(n.build.adapter==="static")delete n.build.adapter;if(n.build.adapter&&!s.includes(n.build.adapter))throw Error(`Unknown build adapter "${n.build.adapter}" in project.json. Valid adapters: ${s.join(", ")}`);let i=["build","cloudflare"];if(!i.includes(n.images.service))throw Error(`Unknown images.service "${n.images.service}" in project.json. Valid services: ${i.join(", ")}`);return{config:n,configPath:t,projectRoot:i2(e)}}var Pl;var jl=M(()=>{er();bu();Ho();Pl={$head:[],$media:{},build:{format:"directory",outDir:"./dist",provider:null,trailingSlash:"always"},defaults:{charset:"utf8",lang:"en",layout:null},images:{formats:["webp","avif"],lazyLoad:!0,optimize:!0,picture:!0,quality:{avif:65,jpeg:80,png:80,webp: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 tm,readFileSync as Kx,writeFileSync as o2}from"node:fs";import{resolve as Xx}from"node:path";async function Yx(e,t={}){let{dryRun:r=!1,connection:n}=t,{config:s}=Gs(e),i=await zs(e,s),o=B(s.connections)?s.connections:{},a=B(s.data)?s.data:{},l=Object.keys(o).filter((y)=>!n||y===n);if(n&&l.length===0)throw Error(`Unknown connection "${n}" (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,...l2(e),JX_PROJECT_ROOT:e},u=[],p=[];for(let y of l){let g=o[y],b=B(g)?{...g,$name:y}:{$name:y},w=String(b.provider??""),j=a2(i.connectors(),w);if(!j)throw Error(`Connection "${y}" names provider "${w}", but no enabled extension provides it (enable the extension in project.json "extensions")`);let S={};for(let[P,R]of Object.entries(a))if(B(R)&&R.connection===y)S[P]=R;let E=await j.call("deploySchema",S,b,{dryRun:r,env:c});if(u.push({applied:E.applied??!r,connection:y,provider:w,statements:E.statements??[],tables:Object.keys(S),warnings:E.warnings??[]}),j.capabilities.bindings){let P=await j.call("bindings",b);if(B(P)&&Object.keys(P).length>0)p.push(P)}}let h=Xx(e,"wrangler.jsonc"),m=!1;if(!r&&p.length>0&&tm(h)){let y=Kx(h,"utf8"),{content:g,patched:b}=kb(y,p);if(b&&g!==y)o2(h,g,"utf8"),m=!0}return{bindingsPatched:m,results:u,wranglerPath:tm(h)?h:null}}function a2(e,t){return e.find((r)=>r.connector?.provider===t)}function l2(e){let t=Xx(e,".dev.vars");if(!tm(t))return{};let r=new Map;for(let n of Kx(t,"utf8").split(`
53
+ `)){let s=n.trim();if(s===""||s.startsWith("#"))continue;let i=s.indexOf("=");if(i===-1)continue;let o=s.slice(0,i).trim(),a=s.slice(i+1).trim();if(a.startsWith('"')&&a.endsWith('"')||a.startsWith("'")&&a.endsWith("'"))a=a.slice(1,-1);if(o!=="")r.set(o,a)}return Object.fromEntries(r)}var Zx=M(()=>{Ab();vs();jl();ye()});function Hi(e){return e.startsWith(wu)}function Qx(e){let t=e;if(Hi(t))t=t.slice(wu.length);return t=t.replace(/^\.\//,"").replace(/\.(js|ts|mjs|mts)$/,"").replaceAll("@","").replaceAll(/[/\\]+/g,"-").replaceAll(/[^\w.-]/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,""),`${rm}${t}.js`}function e0(e){let t=/\.(\w+)$/.exec(e)?.[1]??"",r=e.replace(/\.\w+$/,"").replaceAll("@","").replaceAll(/[/\\]+/g,"-").replaceAll(/[^\w.-]/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,"");return t===""?`${rm}${r}`:`${rm}${r}.${t}`}function t0(e){let t=e.replaceAll("\\","/");return t.length>1&&t.endsWith("/")?t.slice(0,-1):t}function vu(e){let t=t0(e);return t.startsWith("/")?t:`/${t}`}function c2(e,t){return[...e].toSorted((r,n)=>n[t].length-r[t].length)}function Su(e,t){let r=t.split("#")[0].split("?")[0];if(!r.startsWith("/"))return null;let n;try{n=decodeURIComponent(r)}catch{return null}if(/%2e|%2f/i.test(n))return null;for(let s of c2(e,"urlPrefix")){let i=vu(s.urlPrefix);if(!n.startsWith(`${i}/`))continue;let a=n.slice(i.length+1).split("/");if(a.some((c)=>c===""||c==="."||c===".."))return null;let{filter:l}=s;if(l&&!l(a.join("/")))return null;return`${t0(s.dir)}/${a.join("/")}`}return null}function r0(e,t){let r=new Set;for(let n of t){let s=vu(n.urlPrefix),i=new RegExp(`${s.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}/[^${u2}]+`,"g");for(let o of e.matchAll(i)){let a=o[0].split("#")[0].split("?")[0];if(!a.endsWith("/"))r.add(a)}}return[...r].filter(Boolean)}function nm(e){let t=[],r=0;while(r<e.length){while(r<e.length&&(/\s/.test(e[r])||e[r]===","))r+=1;if(r>=e.length)break;let n=r;while(r<e.length&&!/\s/.test(e[r]))r+=1;let s=e.slice(n,r);if(s.endsWith(",")){t.push({descriptor:"",url:s.replace(/,+$/,"")});continue}while(r<e.length&&/\s/.test(e[r]))r+=1;let i=r;while(r<e.length&&e[r]!==",")r+=1;let o=e.slice(i,r).trim();if(r+=1,s=s.replace(/,+$/,""),s!=="")t.push({descriptor:o,url:s})}return t}function sm(e){return e.map(({url:t,descriptor:r})=>r?`${t} ${r}`:t).join(", ")}function zi(e){if(!A(e)||e==="")return"";let t;try{({pathname:t}=new URL(e))}catch{return""}let r=t.replace(/\/+$/,"");if(r===""||r==="/")return"";return r.startsWith("/")?r:`/${r}`}function Ye(e,t){if(e===""||!t.startsWith("/")||t.startsWith("//"))return t;if(t===e||t.startsWith(`${e}/`))return t;return e+t}function Ks(e,t){let r=new URL(t);if(!r.pathname.endsWith("/"))r.pathname+="/";return new URL(e.replace(/^\/+/,""),r).href}var wu="npm:",rm="/assets/",u2;var Vr=M(()=>{ye();u2=String.raw`"'\s<>()\\`});function n0(e,t){return e.replaceAll(h2,(r,n,s)=>{let i=s.trim(),o=$2.exec(i),a=o?o[2]:i,l=Ye(t,a);if(l===a)return r;return`url(${n}${o?`${o[1]}${l}${o[1]}`:l}${n})`})}function w2(e,t,r,n,s){let i=r.toLowerCase();if(f2.has(i))return Ye(s,n);if(d2.has(i)){let o=nm(n);return o.length===0?n:sm(o.map((a)=>({descriptor:a.descriptor,url:Ye(s,a.url)})))}if(i==="style")return n0(n,s);if(i==="content"&&e==="meta"&&x2.test(t))return Ye(s,n);return n}function s0(e,t){if(t==="")return e;let r=e.replaceAll(y2,(n,s,i,o)=>{let a=i.replaceAll(g2,(l,c)=>`"${Ye(t,c)}"`);return s+a+o});return r=r.replaceAll(b2,(n,s,i,o)=>s+n0(i,t)+o),r.replaceAll(p2,(n,s,i)=>{if(i==="")return n;let o=s.toLowerCase(),a=i.replaceAll(m2,(l,c,u,p,h)=>{let m=p===void 0?"'":'"',y=p??h??"",g=w2(o,i,c,y,t);return g===y?l:`${c}=${m}${g}${m}`});return a===i?n:`<${s}${a}>`})}var f2,d2,p2,m2,h2,g2,y2,b2,x2,$2;var i0=M(()=>{Vr();f2=new Set(["href","src","poster","action","formaction","data"]),d2=new Set(["srcset","imagesrcset"]),p2=/<([a-zA-Z][a-zA-Z0-9-]*)((?:"[^"]*"|'[^']*'|[^>"'])*)>/g,m2=/([a-zA-Z_:][\w:.-]*)\s*=\s*("([^"]*)"|'([^']*)')/g,h2=/url\(\s*(['"]?)([^'")]+)\1\s*\)/g,g2=/"(\/[^"/][^"]*)"/g,y2=/(<script\b[^>]*\btype\s*=\s*["']importmap["'][^>]*>)([\s\S]*?)(<\/script>)/gi,b2=/(<style\b[^>]*>)([\s\S]*?)(<\/style>)/gi,x2=/\b(?:property|name)\s*=\s*["'](?:og:|twitter:)[\w:.-]*(?:image|url|video|audio|player)[\w:.-]*["']/i,$2=/^(&quot;|&#34;|&apos;|&#39;)([\s\S]*)\1$/});var Iu=T(function(Uee,R0){var __dirname="/home/runner/work/jx/jx/node_modules/esbuild/lib",__filename="/home/runner/work/jx/jx/node_modules/esbuild/lib/main.js",{defineProperty:cm,getOwnPropertyDescriptor:v2,getOwnPropertyNames:S2}=Object,E2=Object.prototype.hasOwnProperty,P2=(e,t)=>{for(var r in t)cm(e,r,{get:t[r],enumerable:!0})},j2=(e,t,r,n)=>{if(t&&typeof t==="object"||typeof t==="function"){for(let s of S2(t))if(!E2.call(e,s)&&s!==r)cm(e,s,{get:()=>t[s],enumerable:!(n=v2(t,s))||n.enumerable})}return e},k2=(e)=>j2(cm({},"__esModule",{value:!0}),e),Rl={};P2(Rl,{analyzeMetafile:()=>sJ,analyzeMetafileSync:()=>lJ,build:()=>eJ,buildSync:()=>iJ,context:()=>tJ,default:()=>dJ,formatMessages:()=>nJ,formatMessagesSync:()=>aJ,initialize:()=>uJ,stop:()=>cJ,transform:()=>rJ,transformSync:()=>oJ,version:()=>Q2});R0.exports=k2(Rl);function o0(e){let t=(n)=>{if(n===null)r.write8(0);else if(typeof n==="boolean")r.write8(1),r.write8(+n);else if(typeof n==="number")r.write8(2),r.write32(n|0);else if(typeof n==="string")r.write8(3),r.write(yn(n));else if(n instanceof Uint8Array)r.write8(4),r.write(n);else if(n instanceof Array){r.write8(5),r.write32(n.length);for(let s of n)t(s)}else{let s=Object.keys(n);r.write8(6),r.write32(s.length);for(let i of s)r.write(yn(i)),t(n[i])}},r=new g0;return r.write32(0),r.write32(e.id<<1|+!e.isRequest),t(e.value),om(r.buf,r.len-4,0),r.buf.subarray(0,r.len)}function _2(e){let t=()=>{switch(r.read8()){case 0:return null;case 1:return!!r.read8();case 2:return r.read32();case 3:return Zi(r.read());case 4:return r.read();case 5:{let o=r.read32(),a=[];for(let l=0;l<o;l++)a.push(t());return a}case 6:{let o=r.read32(),a={};for(let l=0;l<o;l++)a[Zi(r.read())]=t();return a}default:throw Error("Invalid packet")}},r=new g0(e),n=r.read32(),s=(n&1)===0;n>>>=1;let i=t();if(r.ptr!==e.length)throw Error("Invalid packet");return{id:n,isRequest:s,value:i}}var g0=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);om(this.buf,e,t)}write(e){let t=this._write(4+e.length);om(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 y0(this.buf,this._read(4))}read(){let e=this.read32(),t=new Uint8Array(e),r=this._read(t.length);return t.set(this.buf.subarray(r,r+e)),t}},yn,Zi,im;if(typeof TextEncoder<"u"&&typeof TextDecoder<"u"){let e=new TextEncoder,t=new TextDecoder;yn=(r)=>e.encode(r),Zi=(r)=>t.decode(r),im='new TextEncoder().encode("")'}else if(typeof Buffer<"u")yn=(e)=>Buffer.from(e),Zi=(e)=>{let{buffer:t,byteOffset:r,byteLength:n}=e;return Buffer.from(t,r,n).toString()},im='Buffer.from("")';else throw Error("No UTF-8 codec found");if(!(yn("")instanceof Uint8Array))throw Error(`Invariant violation: "${im} instanceof Uint8Array" is incorrectly false
54
54
 
55
55
  This indicates that your JavaScript environment is broken. You cannot use
56
56
  esbuild in this environment because esbuild relies on this invariant. This
57
57
  is not a problem with esbuild. You need to fix your environment instead.
58
- `);function Gx(e,t){return(e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)>>>0}function Vp(e,t,r){e[r++]=t,e[r++]=t>>8,e[r++]=t>>16,e[r++]=t>>24}var xs=String.fromCharCode;function Kr(e,t,r){let n=e[t],s=1,i=0;for(let o=0;o<t;o++)if(e[o]===10)s++,i=0;else i++;throw SyntaxError(r?r:t===e.length?"Unexpected end of input while parsing JSON":n>=32&&n<=126?`Unexpected character ${xs(n)} in JSON at position ${t} (line ${s}, column ${i})`:`Unexpected byte 0x${n.toString(16)} in JSON at position ${t} (line ${s}, column ${i})`)}function UI(e){if(!(e instanceof Uint8Array))throw Error("JSON input must be a Uint8Array");let t=[],r=[],n=[],s=e.length,i=null,o=0,a,l=0;while(l<s){let c=e[l++];if(c<=32)continue;let u;if(o===2&&i===null&&c!==34&&c!==125)Kr(e,--l);switch(c){case 116:{if(e[l++]!==114||e[l++]!==117||e[l++]!==101)Kr(e,--l);u=!0;break}case 102:{if(e[l++]!==97||e[l++]!==108||e[l++]!==115||e[l++]!==101)Kr(e,--l);u=!1;break}case 110:{if(e[l++]!==117||e[l++]!==108||e[l++]!==108)Kr(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 p=l;u=xs(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+=xs(c),c=e[++l];continue}}break}if(u=+u,isNaN(u))Kr(e,--p,"Invalid number");break}case 34:{u="";while(!0){if(l>=s)Kr(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+=`
59
- `;break;case 114:u+="\r";break;case 116:u+="\t";break;case 117:{let p=0;for(let h=0;h<4;h++)if(c=e[l++],p<<=4,c>=48&&c<=57)p|=c-48;else if(c>=97&&c<=102)p|=c+-87;else if(c>=65&&c<=70)p|=c+-55;else Kr(e,--l);u+=xs(p);break}default:Kr(e,--l);break}else if(c<=127)u+=xs(c);else if((c&224)===192)u+=xs((c&31)<<6|e[l++]&63);else if((c&240)===224)u+=xs((c&15)<<12|(e[l++]&63)<<6|e[l++]&63);else if((c&248)==240){let p=(c&7)<<18|(e[l++]&63)<<12|(e[l++]&63)<<6|e[l++]&63;if(p>65535)p-=65536,u+=xs(p>>10&1023|55296),p=56320|p&1023;u+=xs(p)}}u[0];break}case 91:{u=[],t.push(i),r.push(a),n.push(o),i=null,a=u,o=1;continue}case 123:{u={},t.push(i),r.push(a),n.push(o),i=null,a=u,o=2;continue}case 93:{if(o!==1)Kr(e,--l);u=a,i=t.pop(),a=r.pop(),o=n.pop();break}case 125:{if(o!==2)Kr(e,--l);u=a,i=t.pop(),a=r.pop(),o=n.pop();break}default:Kr(e,--l)}c=e[l];while(c<=32)c=e[++l];switch(o){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(i===null){if(i=u,c===58){l++;continue}}else{if(a[i]=u,i=null,c===44){l++;continue}if(c===125)continue}break}}break}Kr(e,l)}var At=JSON.stringify,Dx="warning",Lx="silent";function Bo(e,t){let r=[];for(let n of e){if(Sr(n,t),n.indexOf(",")>=0)throw Error(`Invalid ${t}: ${n}`);r.push(n)}return r.join(",")}var du=()=>null,at=(e)=>typeof e==="boolean"?null:"a boolean",ie=(e)=>typeof e==="string"?null:"a string",pu=(e)=>e instanceof RegExp?null:"a RegExp object",zi=(e)=>typeof e==="number"&&e===(e|0)?null:"an integer",zI=(e)=>typeof e==="number"&&e===(e|0)&&e>=0&&e<=65535?null:"a valid port number",Kx=(e)=>typeof e==="function"?null:"a function",$s=(e)=>Array.isArray(e)?null:"an array",Er=(e)=>Array.isArray(e)&&e.every((t)=>typeof t==="string")?null:"an array of strings",Wr=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)?null:"an object",GI=(e)=>typeof e==="object"&&e!==null?null:"an array or an object",KI=(e)=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",Fx=(e)=>typeof e==="object"&&!Array.isArray(e)?null:"an object or null",Yx=(e)=>typeof e==="string"||typeof e==="boolean"?null:"a string or a boolean",YI=(e)=>typeof e==="string"||typeof e==="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",Xx=(e)=>typeof e==="string"||Array.isArray(e)&&e.every((t)=>typeof t==="string")?null:"a string or an array of strings",Zx=(e)=>typeof e==="string"||e instanceof Uint8Array?null:"a string or a Uint8Array",XI=(e)=>typeof e==="string"||e instanceof URL?null:"a string or a URL";function T(e,t,r,n){let s=e[r];if(t[r+""]=!0,s===void 0)return;let i=n(s);if(i!==null)throw Error(`${At(r)} must be ${i}`);return s}function St(e,t,r){for(let n in e)if(!(n in t))throw Error(`Invalid option ${r}: ${At(n)}`)}function ZI(e){let t=Object.create(null),r=T(e,t,"wasmURL",XI),n=T(e,t,"wasmModule",KI),s=T(e,t,"worker",at);return St(e,t,"in initialize() call"),{wasmURL:r,wasmModule:n,worker:s}}function Qx(e){let t;if(e!==void 0){t=Object.create(null);for(let r in e){let n=e[r];if(typeof n==="string"||n===!1)t[r]=n;else throw Error(`Expected ${At(r)} in mangle cache to map to either a string or false`)}}return t}function bu(e,t,r,n,s){let i=T(t,r,"color",at),o=T(t,r,"logLevel",ie),a=T(t,r,"logLimit",zi),l=T(t,r,"logStyle",ie);if(i!==void 0)e.push(`--color=${i}`);else if(n)e.push("--color=true");if(e.push(`--log-level=${o||s}`),e.push(`--log-limit=${a||0}`),l)e.push(`--log-style=${l}`)}function Sr(e,t,r){if(typeof e!=="string")throw Error(`Expected value for ${t}${r!==void 0?" "+At(r):""} to be a string, got ${typeof e} instead`);return e}function e0(e,t,r){let n=T(t,r,"legalComments",ie),s=T(t,r,"sourceRoot",ie),i=T(t,r,"sourcesContent",at),o=T(t,r,"target",Xx),a=T(t,r,"format",ie),l=T(t,r,"globalName",ie),c=T(t,r,"mangleProps",pu),u=T(t,r,"reserveProps",pu),p=T(t,r,"mangleQuoted",at),h=T(t,r,"minify",at),m=T(t,r,"minifySyntax",at),b=T(t,r,"minifyWhitespace",at),g=T(t,r,"minifyIdentifiers",at),y=T(t,r,"lineLimit",zi),w=T(t,r,"drop",Er),j=T(t,r,"dropLabels",Er),S=T(t,r,"charset",ie),E=T(t,r,"treeShaking",at),P=T(t,r,"ignoreAnnotations",at),A=T(t,r,"jsx",ie),R=T(t,r,"jsxFactory",ie),_=T(t,r,"jsxFragment",ie),I=T(t,r,"jsxImportSource",ie),L=T(t,r,"jsxDev",at),J=T(t,r,"jsxSideEffects",at),F=T(t,r,"define",Wr),K=T(t,r,"logOverride",Wr),ae=T(t,r,"supported",Wr),me=T(t,r,"pure",Er),ce=T(t,r,"keepNames",at),se=T(t,r,"platform",ie),ue=T(t,r,"tsconfigRaw",YI),Ce=T(t,r,"absPaths",Er);if(n)e.push(`--legal-comments=${n}`);if(s!==void 0)e.push(`--source-root=${s}`);if(i!==void 0)e.push(`--sources-content=${i}`);if(o)e.push(`--target=${Bo(Array.isArray(o)?o:[o],"target")}`);if(a)e.push(`--format=${a}`);if(l)e.push(`--global-name=${l}`);if(se)e.push(`--platform=${se}`);if(ue)e.push(`--tsconfig-raw=${typeof ue==="string"?ue:JSON.stringify(ue)}`);if(h)e.push("--minify");if(m)e.push("--minify-syntax");if(b)e.push("--minify-whitespace");if(g)e.push("--minify-identifiers");if(y)e.push(`--line-limit=${y}`);if(S)e.push(`--charset=${S}`);if(E!==void 0)e.push(`--tree-shaking=${E}`);if(P)e.push("--ignore-annotations");if(w)for(let Y of w)e.push(`--drop:${Sr(Y,"drop")}`);if(j)e.push(`--drop-labels=${Bo(j,"drop label")}`);if(Ce)e.push(`--abs-paths=${Bo(Ce,"abs paths")}`);if(c)e.push(`--mangle-props=${mu(c)}`);if(u)e.push(`--reserve-props=${mu(u)}`);if(p!==void 0)e.push(`--mangle-quoted=${p}`);if(A)e.push(`--jsx=${A}`);if(R)e.push(`--jsx-factory=${R}`);if(_)e.push(`--jsx-fragment=${_}`);if(I)e.push(`--jsx-import-source=${I}`);if(L)e.push("--jsx-dev");if(J)e.push("--jsx-side-effects");if(F)for(let Y in F){if(Y.indexOf("=")>=0)throw Error(`Invalid define: ${Y}`);e.push(`--define:${Y}=${Sr(F[Y],"define",Y)}`)}if(K)for(let Y in K){if(Y.indexOf("=")>=0)throw Error(`Invalid log override: ${Y}`);e.push(`--log-override:${Y}=${Sr(K[Y],"log override",Y)}`)}if(ae)for(let Y in ae){if(Y.indexOf("=")>=0)throw Error(`Invalid supported: ${Y}`);let Ee=ae[Y];if(typeof Ee!=="boolean")throw Error(`Expected value for supported ${At(Y)} to be a boolean, got ${typeof Ee} instead`);e.push(`--supported:${Y}=${Ee}`)}if(me)for(let Y of me)e.push(`--pure:${Sr(Y,"pure")}`);if(ce)e.push("--keep-names")}function QI(e,t,r,n,s){var i;let o=[],a=[],l=Object.create(null),c=null,u=null;bu(o,t,l,r,n),e0(o,t,l);let p=T(t,l,"sourcemap",Yx),h=T(t,l,"bundle",at),m=T(t,l,"splitting",at),b=T(t,l,"preserveSymlinks",at),g=T(t,l,"metafile",at),y=T(t,l,"outfile",ie),w=T(t,l,"outdir",ie),j=T(t,l,"outbase",ie),S=T(t,l,"tsconfig",ie),E=T(t,l,"resolveExtensions",Er),P=T(t,l,"nodePaths",Er),A=T(t,l,"mainFields",Er),R=T(t,l,"conditions",Er),_=T(t,l,"external",Er),I=T(t,l,"packages",ie),L=T(t,l,"alias",Wr),J=T(t,l,"loader",Wr),F=T(t,l,"outExtension",Wr),K=T(t,l,"publicPath",ie),ae=T(t,l,"entryNames",ie),me=T(t,l,"chunkNames",ie),ce=T(t,l,"assetNames",ie),se=T(t,l,"inject",Er),ue=T(t,l,"banner",Wr),Ce=T(t,l,"footer",Wr),Y=T(t,l,"entryPoints",GI),Ee=T(t,l,"absWorkingDir",ie),oe=T(t,l,"stdin",Wr),B=(i=T(t,l,"write",at))!=null?i:s,ot=T(t,l,"allowOverwrite",at),de=T(t,l,"mangleCache",Wr);if(l.plugins=!0,St(t,l,`in ${e}() call`),p)o.push(`--sourcemap${p===!0?"":`=${p}`}`);if(h)o.push("--bundle");if(ot)o.push("--allow-overwrite");if(m)o.push("--splitting");if(b)o.push("--preserve-symlinks");if(g)o.push("--metafile");if(y)o.push(`--outfile=${y}`);if(w)o.push(`--outdir=${w}`);if(j)o.push(`--outbase=${j}`);if(S)o.push(`--tsconfig=${S}`);if(I)o.push(`--packages=${I}`);if(E)o.push(`--resolve-extensions=${Bo(E,"resolve extension")}`);if(K)o.push(`--public-path=${K}`);if(ae)o.push(`--entry-names=${ae}`);if(me)o.push(`--chunk-names=${me}`);if(ce)o.push(`--asset-names=${ce}`);if(A)o.push(`--main-fields=${Bo(A,"main field")}`);if(R)o.push(`--conditions=${Bo(R,"condition")}`);if(_)for(let X of _)o.push(`--external:${Sr(X,"external")}`);if(L)for(let X in L){if(X.indexOf("=")>=0)throw Error(`Invalid package name in alias: ${X}`);o.push(`--alias:${X}=${Sr(L[X],"alias",X)}`)}if(ue)for(let X in ue){if(X.indexOf("=")>=0)throw Error(`Invalid banner file type: ${X}`);o.push(`--banner:${X}=${Sr(ue[X],"banner",X)}`)}if(Ce)for(let X in Ce){if(X.indexOf("=")>=0)throw Error(`Invalid footer file type: ${X}`);o.push(`--footer:${X}=${Sr(Ce[X],"footer",X)}`)}if(se)for(let X of se)o.push(`--inject:${Sr(X,"inject")}`);if(J)for(let X in J){if(X.indexOf("=")>=0)throw Error(`Invalid loader extension: ${X}`);o.push(`--loader:${X}=${Sr(J[X],"loader",X)}`)}if(F)for(let X in F){if(X.indexOf("=")>=0)throw Error(`Invalid out extension: ${X}`);o.push(`--out-extension:${X}=${Sr(F[X],"out extension",X)}`)}if(Y)if(Array.isArray(Y))for(let X=0,jt=Y.length;X<jt;X++){let et=Y[X];if(typeof et==="object"&&et!==null){let Kt=Object.create(null),wt=T(et,Kt,"in",ie),Ot=T(et,Kt,"out",ie);if(St(et,Kt,"in entry point at index "+X),wt===void 0)throw Error('Missing property "in" for entry point at index '+X);if(Ot===void 0)throw Error('Missing property "out" for entry point at index '+X);a.push([Ot,wt])}else a.push(["",Sr(et,"entry point at index "+X)])}else for(let X in Y)a.push([X,Sr(Y[X],"entry point",X)]);if(oe){let X=Object.create(null),jt=T(oe,X,"contents",Zx),et=T(oe,X,"resolveDir",ie),Kt=T(oe,X,"sourcefile",ie),wt=T(oe,X,"loader",ie);if(St(oe,X,'in "stdin" object'),Kt)o.push(`--sourcefile=${Kt}`);if(wt)o.push(`--loader=${wt}`);if(et)u=et;if(typeof jt==="string")c=hn(jt);else if(jt instanceof Uint8Array)c=jt}let $t=[];if(P)for(let X of P)X+="",$t.push(X);return{entries:a,flags:o,write:B,stdinContents:c,stdinResolveDir:u,absWorkingDir:Ee,nodePaths:$t,mangleCache:Qx(de)}}function e2(e,t,r,n){let s=[],i=Object.create(null);bu(s,t,i,r,n),e0(s,t,i);let o=T(t,i,"sourcemap",Yx),a=T(t,i,"sourcefile",ie),l=T(t,i,"loader",ie),c=T(t,i,"banner",ie),u=T(t,i,"footer",ie),p=T(t,i,"mangleCache",Wr);if(St(t,i,`in ${e}() call`),o)s.push(`--sourcemap=${o===!0?"external":o}`);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:Qx(p)}}function t0(e){let t={},r={didClose:!1,reason:""},n={},s=0,i=0,o=new Uint8Array(16384),a=0,l=(S)=>{let E=a+S.length;if(E>o.length){let A=new Uint8Array(E*2);A.set(o),o=A}o.set(S,a),a+=S.length;let P=0;while(P+4<=a){let A=Gx(o,P);if(P+4+A>a)break;P+=4,b(o.subarray(P,P+A)),P+=A}if(P>0)o.copyWithin(0,P,a),a-=P},c=(S)=>{if(r.didClose=!0,S)r.reason=": "+(S.message||S);let E="The service was stopped"+r.reason;for(let P in n)n[P](E,null);n={}},u=(S,E,P)=>{if(r.didClose)return P("The service is no longer running"+r.reason,null);let A=s++;if(n[A]=(R,_)=>{try{P(R,_)}finally{if(S)S.unref()}},S)S.ref();e.writeToStdin(Mx({id:A,isRequest:!0,value:E}))},p=(S,E)=>{if(r.didClose)throw Error("The service is no longer running"+r.reason);e.writeToStdin(Mx({id:S,isRequest:!1,value:E}))},h=async(S,E)=>{try{if(E.command==="ping"){p(S,{});return}if(typeof E.key==="number"){let P=t[E.key];if(!P)return;let A=P[E.command];if(A){await A(S,E);return}}throw Error("Invalid command: "+E.command)}catch(P){let A=[Ui(P,e,null,void 0,"")];try{p(S,{errors:A})}catch{}}},m=!0,b=(S)=>{if(m){m=!1;let P=String.fromCharCode(...S);if(P!=="0.28.2")throw Error(`Cannot start service: Host version "0.28.2" does not match binary version ${At(P)}`);return}let E=HI(S);if(E.isRequest)h(E.id,E.value);else{let P=n[E.id];if(delete n[E.id],E.value.error)P(E.value.error,{});else P(null,E.value)}};return{readFromStdout:l,afterClose:c,service:{buildOrContext:({callName:S,refs:E,options:P,isTTY:A,defaultWD:R,callback:_})=>{let I=0,L=i++,J={},F={ref(){if(++I===1){if(E)E.ref()}},unref(){if(--I===0){if(delete t[L],E)E.unref()}}};t[L]=J,F.ref(),t2(S,L,u,p,F,e,J,P,A,R,(K,ae)=>{try{_(K,ae)}finally{F.unref()}})},transform:({callName:S,refs:E,input:P,options:A,isTTY:R,fs:_,callback:I})=>{let L=r0(),J=(F)=>{try{if(typeof P!=="string"&&!(P instanceof Uint8Array))throw Error('The input to "transform" must be a string or a Uint8Array');let{flags:K,mangleCache:ae}=e2(S,A,R,Lx),me={command:"transform",flags:K,inputFS:F!==null,input:F!==null?hn(F):typeof P==="string"?hn(P):P};if(ae)me.mangleCache=ae;u(E,me,(ce,se)=>{if(ce)return I(Error(ce),null);let ue=Ho(se.errors,L),Ce=Ho(se.warnings,L),Y=1,Ee=()=>{if(--Y===0){let oe={warnings:Ce,code:se.code,map:se.map,mangleCache:void 0,legalComments:void 0};if("legalComments"in se)oe.legalComments=se==null?void 0:se.legalComments;if(se.mangleCache)oe.mangleCache=se==null?void 0:se.mangleCache;I(null,oe)}};if(ue.length>0)return I($l("Transform failed",ue,Ce),null);if(se.codeFS)Y++,_.readFile(se.code,(oe,B)=>{if(oe!==null)I(oe,null);else se.code=B,Ee()});if(se.mapFS)Y++,_.readFile(se.map,(oe,B)=>{if(oe!==null)I(oe,null);else se.map=B,Ee()});Ee()})}catch(K){let ae=[];try{bu(ae,A,{},R,Lx)}catch{}let me=Ui(K,e,L,void 0,"");u(E,{command:"error",flags:ae,error:me},()=>{me.detail=L.load(me.detail),I($l("Transform failed",[me],[]),null)})}};if((typeof P==="string"||P instanceof Uint8Array)&&P.length>1048576){let F=J;J=()=>_.writeFile(P,F)}J(null)},formatMessages:({callName:S,refs:E,messages:P,options:A,callback:R})=>{if(!A)throw Error(`Missing second argument in ${S}() call`);let _={},I=T(A,_,"kind",ie),L=T(A,_,"color",at),J=T(A,_,"terminalWidth",zi),F=T(A,_,"logStyle",ie);if(St(A,_,`in ${S}() call`),I===void 0)throw Error(`Missing "kind" in ${S}() call`);if(I!=="error"&&I!=="warning")throw Error(`Expected "kind" to be "error" or "warning" in ${S}() call`);let K={command:"format-msgs",messages:ws(P,"messages",null,"",J),isWarning:I==="warning"};if(L!==void 0)K.color=L;if(J!==void 0)K.terminalWidth=J;if(F!==void 0)K.logStyle=F;u(E,K,(ae,me)=>{if(ae)return R(Error(ae),null);R(null,me.messages)})},analyzeMetafile:({callName:S,refs:E,metafile:P,options:A,callback:R})=>{if(A===void 0)A={};let _={},I=T(A,_,"color",at),L=T(A,_,"verbose",at);St(A,_,`in ${S}() call`);let J={command:"analyze-metafile",metafile:P};if(I!==void 0)J.color=I;if(L!==void 0)J.verbose=L;u(E,J,(F,K)=>{if(F)return R(Error(F),null);R(null,K.result)})}}}}function t2(e,t,r,n,s,i,o,a,l,c,u){let p=r0(),h=e==="context",m=(y,w)=>{let j=[];try{bu(j,a,{},l,Dx)}catch{}let S=Ui(y,i,p,void 0,w);r(s,{command:"error",flags:j,error:S},()=>{S.detail=p.load(S.detail),u($l(h?"Context failed":"Build failed",[S],[]),null)})},b;if(typeof a==="object"){let y=a.plugins;if(y!==void 0){if(!Array.isArray(y))return m(Error('"plugins" must be an array'),"");b=y}}if(b&&b.length>0){if(i.isSync)return m(Error("Cannot use plugins in synchronous API calls"),"");r2(t,r,n,s,i,o,a,b,p).then((y)=>{if(!y.ok)return m(y.error,y.pluginName);try{g(y.requestPlugins,y.runOnEndCallbacks,y.scheduleOnDisposeCallbacks)}catch(w){m(w,"")}},(y)=>m(y,""));return}try{g(null,(y,w)=>w([],[]),()=>{})}catch(y){m(y,"")}function g(y,w,j){let S=i.hasFS,{entries:E,flags:P,write:A,stdinContents:R,stdinResolveDir:_,absWorkingDir:I,nodePaths:L,mangleCache:J}=QI(e,a,l,Dx,S);if(A&&!i.hasFS)throw Error('The "write" option is unavailable in this environment');let F={command:"build",key:t,entries:E,flags:P,write:A,stdinContents:R,stdinResolveDir:_,absWorkingDir:I||c,nodePaths:L,context:h};if(y)F.plugins=y;if(J)F.mangleCache=J;let K=(ce,se)=>{let ue={errors:Ho(ce.errors,p),warnings:Ho(ce.warnings,p),outputFiles:void 0,metafile:void 0,mangleCache:void 0},Ce=ue.errors.slice(),Y=ue.warnings.slice();if(ce.outputFiles)ue.outputFiles=ce.outputFiles.map(s2);if(ce.metafile&&ce.metafile.length)ue.metafile=i2(ce.metafile);if(ce.mangleCache)ue.mangleCache=ce.mangleCache;if(ce.writeToStdout!==void 0)console.log(Yi(ce.writeToStdout).replace(/\n$/,""));w(ue,(Ee,oe)=>{if(Ce.length>0||Ee.length>0){let B=$l("Build failed",Ce.concat(Ee),Y.concat(oe));return se(B,null,Ee,oe)}se(null,ue,Ee,oe)})},ae,me;if(h)o["on-end"]=(ce,se)=>new Promise((ue)=>{K(se,(Ce,Y,Ee,oe)=>{let B={errors:Ee,warnings:oe};if(me)me(Ce,Y);ae=void 0,me=void 0,n(ce,B),ue()})});r(s,F,(ce,se)=>{if(ce)return u(Error(ce),null);if(!h)return K(se,(Y,Ee)=>(j(),u(Y,Ee)));if(se.errors.length>0)return u($l("Context failed",se.errors,se.warnings),null);let ue=!1,Ce={rebuild:()=>{if(!ae)ae=new Promise((Y,Ee)=>{let oe;me=(ot,de)=>{if(!oe)oe=()=>ot?Ee(ot):Y(de)};let B=()=>{r(s,{command:"rebuild",key:t},(de,$t)=>{if(de)Ee(Error(de));else if(oe)oe();else B()})};B()});return ae},watch:(Y={})=>new Promise((Ee,oe)=>{if(!i.hasFS)throw Error('Cannot use the "watch" API in this environment');let B={},ot=T(Y,B,"delay",zi);St(Y,B,"in watch() call");let de={command:"watch",key:t};if(ot)de.delay=ot;r(s,de,($t)=>{if($t)oe(Error($t));else Ee(void 0)})}),serve:(Y={})=>new Promise((Ee,oe)=>{if(!i.hasFS)throw Error('Cannot use the "serve" API in this environment');let B={},ot=T(Y,B,"port",zI),de=T(Y,B,"host",ie),$t=T(Y,B,"servedir",ie),X=T(Y,B,"keyfile",ie),jt=T(Y,B,"certfile",ie),et=T(Y,B,"fallback",ie),Kt=T(Y,B,"cors",Wr),wt=T(Y,B,"onRequest",Kx);St(Y,B,"in serve() call");let Ot={command:"serve",key:t,onRequest:!!wt};if(ot!==void 0)Ot.port=ot;if(de!==void 0)Ot.host=de;if($t!==void 0)Ot.servedir=$t;if(X!==void 0)Ot.keyfile=X;if(jt!==void 0)Ot.certfile=jt;if(et!==void 0)Ot.fallback=et;if(Kt){let Yt={},Vt=T(Kt,Yt,"origin",Xx);if(St(Kt,Yt,'on "cors" object'),Array.isArray(Vt))Ot.corsOrigin=Vt;else if(Vt!==void 0)Ot.corsOrigin=[Vt]}r(s,Ot,(Yt,Vt)=>{if(Yt)return oe(Error(Yt));if(wt)o["serve-request"]=(ts,rs)=>{wt(rs.args),n(ts,{})};Ee(Vt)})}),cancel:()=>new Promise((Y)=>{if(ue)return Y();r(s,{command:"cancel",key:t},()=>{Y()})}),dispose:()=>new Promise((Y)=>{if(ue)return Y();ue=!0,r(s,{command:"dispose",key:t},()=>{Y(),j(),s.unref()})})};s.ref(),u(null,Ce)})}}var r2=async(e,t,r,n,s,i,o,a,l)=>{let c=[],u=[],p={},h={},m=[],b=0,g=0,y=[],w=!1;a=[...a];for(let E of a){let P={};if(typeof E!=="object")throw Error(`Plugin at index ${g} must be an object`);let A=T(E,P,"name",ie);if(typeof A!=="string"||A==="")throw Error(`Plugin at index ${g} is missing a name`);try{let R=T(E,P,"setup",Kx);if(typeof R!=="function")throw Error("Plugin is missing a setup function");St(E,P,`on plugin ${At(A)}`);let _={name:A,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};g++;let L=R({initialOptions:o,resolve:(J,F={})=>{if(!w)throw Error('Cannot call "resolve" before plugin setup has completed');if(typeof J!=="string")throw Error("The path to resolve must be a string");let K=Object.create(null),ae=T(F,K,"pluginName",ie),me=T(F,K,"importer",ie),ce=T(F,K,"namespace",ie),se=T(F,K,"resolveDir",ie),ue=T(F,K,"kind",ie),Ce=T(F,K,"pluginData",du),Y=T(F,K,"with",Wr);return St(F,K,"in resolve() call"),new Promise((Ee,oe)=>{let B={command:"resolve",path:J,key:e,pluginName:A};if(ae!=null)B.pluginName=ae;if(me!=null)B.importer=me;if(ce!=null)B.namespace=ce;if(se!=null)B.resolveDir=se;if(ue!=null)B.kind=ue;else throw Error('Must specify "kind" when calling "resolve"');if(Ce!=null)B.pluginData=l.store(Ce);if(Y!=null)B.with=n2(Y,"with");t(n,B,(ot,de)=>{if(ot!==null)oe(Error(ot));else Ee({errors:Ho(de.errors,l),warnings:Ho(de.warnings,l),path:de.path,external:de.external,sideEffects:de.sideEffects,namespace:de.namespace,suffix:de.suffix,pluginData:l.load(de.pluginData)})})})},onStart(J){let K=uu(Error('This error came from the "onStart" callback registered here:'),s,"onStart");c.push({name:A,callback:J,note:K}),_.onStart=!0},onEnd(J){let K=uu(Error('This error came from the "onEnd" callback registered here:'),s,"onEnd");u.push({name:A,callback:J,note:K}),_.onEnd=!0},onResolve(J,F){let ae=uu(Error('This error came from the "onResolve" callback registered here:'),s,"onResolve"),me={},ce=T(J,me,"filter",pu),se=T(J,me,"namespace",ie);if(St(J,me,`in onResolve() call for plugin ${At(A)}`),ce==null)throw Error("onResolve() call is missing a filter");let ue=b++;p[ue]={name:A,callback:F,note:ae},_.onResolve.push({id:ue,filter:mu(ce),namespace:se||""})},onLoad(J,F){let ae=uu(Error('This error came from the "onLoad" callback registered here:'),s,"onLoad"),me={},ce=T(J,me,"filter",pu),se=T(J,me,"namespace",ie);if(St(J,me,`in onLoad() call for plugin ${At(A)}`),ce==null)throw Error("onLoad() call is missing a filter");let ue=b++;h[ue]={name:A,callback:F,note:ae},_.onLoad.push({id:ue,filter:mu(ce),namespace:se||""})},onDispose(J){m.push(J)},esbuild:s.esbuild});if(L)await L;y.push(_)}catch(R){return{ok:!1,error:R,pluginName:A}}}i["on-start"]=async(E,P)=>{l.clear();let A={errors:[],warnings:[]};await Promise.all(c.map(async({name:R,callback:_,note:I})=>{try{let L=await _();if(L!=null){if(typeof L!=="object")throw Error(`Expected onStart() callback in plugin ${At(R)} to return an object`);let J={},F=T(L,J,"errors",$s),K=T(L,J,"warnings",$s);if(St(L,J,`from onStart() callback in plugin ${At(R)}`),F!=null)A.errors.push(...ws(F,"errors",l,R,void 0));if(K!=null)A.warnings.push(...ws(K,"warnings",l,R,void 0))}}catch(L){A.errors.push(Ui(L,s,l,I&&I(),R))}})),r(E,A)},i["on-resolve"]=async(E,P)=>{let A={},R="",_,I;for(let L of P.ids)try{({name:R,callback:_,note:I}=p[L]);let J=await _({path:P.path,importer:P.importer,namespace:P.namespace,resolveDir:P.resolveDir,kind:P.kind,pluginData:l.load(P.pluginData),with:P.with});if(J!=null){if(typeof J!=="object")throw Error(`Expected onResolve() callback in plugin ${At(R)} to return an object`);let F={},K=T(J,F,"pluginName",ie),ae=T(J,F,"path",ie),me=T(J,F,"namespace",ie),ce=T(J,F,"suffix",ie),se=T(J,F,"external",at),ue=T(J,F,"sideEffects",at),Ce=T(J,F,"pluginData",du),Y=T(J,F,"errors",$s),Ee=T(J,F,"warnings",$s),oe=T(J,F,"watchFiles",Er),B=T(J,F,"watchDirs",Er);if(St(J,F,`from onResolve() callback in plugin ${At(R)}`),A.id=L,K!=null)A.pluginName=K;if(ae!=null)A.path=ae;if(me!=null)A.namespace=me;if(ce!=null)A.suffix=ce;if(se!=null)A.external=se;if(ue!=null)A.sideEffects=ue;if(Ce!=null)A.pluginData=l.store(Ce);if(Y!=null)A.errors=ws(Y,"errors",l,R,void 0);if(Ee!=null)A.warnings=ws(Ee,"warnings",l,R,void 0);if(oe!=null)A.watchFiles=fu(oe,"watchFiles");if(B!=null)A.watchDirs=fu(B,"watchDirs");break}}catch(J){A={id:L,errors:[Ui(J,s,l,I&&I(),R)]};break}r(E,A)},i["on-load"]=async(E,P)=>{let A={},R="",_,I;for(let L of P.ids)try{({name:R,callback:_,note:I}=h[L]);let J=await _({path:P.path,namespace:P.namespace,suffix:P.suffix,pluginData:l.load(P.pluginData),with:P.with});if(J!=null){if(typeof J!=="object")throw Error(`Expected onLoad() callback in plugin ${At(R)} to return an object`);let F={},K=T(J,F,"pluginName",ie),ae=T(J,F,"contents",Zx),me=T(J,F,"resolveDir",ie),ce=T(J,F,"pluginData",du),se=T(J,F,"loader",ie),ue=T(J,F,"errors",$s),Ce=T(J,F,"warnings",$s),Y=T(J,F,"watchFiles",Er),Ee=T(J,F,"watchDirs",Er);if(St(J,F,`from onLoad() callback in plugin ${At(R)}`),A.id=L,K!=null)A.pluginName=K;if(ae instanceof Uint8Array)A.contents=ae;else if(ae!=null)A.contents=hn(ae);if(me!=null)A.resolveDir=me;if(ce!=null)A.pluginData=l.store(ce);if(se!=null)A.loader=se;if(ue!=null)A.errors=ws(ue,"errors",l,R,void 0);if(Ce!=null)A.warnings=ws(Ce,"warnings",l,R,void 0);if(Y!=null)A.watchFiles=fu(Y,"watchFiles");if(Ee!=null)A.watchDirs=fu(Ee,"watchDirs");break}}catch(J){A={id:L,errors:[Ui(J,s,l,I&&I(),R)]};break}r(E,A)};let j=(E,P)=>P([],[]);if(u.length>0)j=(E,P)=>{(async()=>{let A=[],R=[];for(let{name:_,callback:I,note:L}of u){let J,F;try{let K=await I(E);if(K!=null){if(typeof K!=="object")throw Error(`Expected onEnd() callback in plugin ${At(_)} to return an object`);let ae={},me=T(K,ae,"errors",$s),ce=T(K,ae,"warnings",$s);if(St(K,ae,`from onEnd() callback in plugin ${At(_)}`),me!=null)J=ws(me,"errors",l,_,void 0);if(ce!=null)F=ws(ce,"warnings",l,_,void 0)}}catch(K){J=[Ui(K,s,l,L&&L(),_)]}if(J){A.push(...J);try{E.errors.push(...J)}catch{}}if(F){R.push(...F);try{E.warnings.push(...F)}catch{}}}P(A,R)})()};let S=()=>{for(let E of m)setTimeout(()=>E(),0)};return w=!0,{ok:!0,requestPlugins:y,runOnEndCallbacks:j,scheduleOnDisposeCallbacks:S}};function r0(){let e=new Map,t=0;return{clear(){e.clear()},load(r){return e.get(r)},store(r){if(r===void 0)return-1;let n=t++;return e.set(n,r),n}}}function uu(e,t,r){let n,s=!1;return()=>{if(s)return n;s=!0;try{let i=(e.stack+"").split(`
60
- `);i.splice(1,1);let o=n0(t,i,r);if(o)return n={text:e.message,location:o},n}catch{}}}function Ui(e,t,r,n,s){let i="Internal error",o=null;try{i=(e&&e.message||e)+""}catch{}try{o=n0(t,(e.stack+"").split(`
61
- `),"")}catch{}return{id:"",pluginName:s,text:i,location:o,notes:n?[n]:[],detail:r?r.store(e):-1}}function n0(e,t,r){let n=" at ";if(e.readFileSync&&!t[0].startsWith(n)&&t[1].startsWith(n))for(let s=1;s<t.length;s++){let i=t[s];if(!i.startsWith(n))continue;i=i.slice(n.length);while(!0){let o=/^(?:new |async )?\S+ \((.*)\)$/.exec(i);if(o){i=o[1];continue}if(o=/^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec(i),o){i=o[1];continue}if(o=/^(\S+):(\d+):(\d+)$/.exec(i),o){let a;try{a=e.readFileSync(o[1],"utf8")}catch{break}let l=a.split(/\r\n|\r|\n|\u2028|\u2029/)[+o[2]-1]||"",c=+o[3]-1,u=l.slice(c,c+r.length)===r?r.length:0;return{file:o[1],namespace:"file",line:+o[2],column:hn(l.slice(0,c)).length,length:hn(l.slice(c,c+u)).length,lineText:l+`
58
+ `);function y0(e,t){return(e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)>>>0}function om(e,t,r){e[r++]=t,e[r++]=t>>8,e[r++]=t>>16,e[r++]=t>>24}var Ss=String.fromCharCode;function Yr(e,t,r){let n=e[t],s=1,i=0;for(let o=0;o<t;o++)if(e[o]===10)s++,i=0;else i++;throw SyntaxError(r?r:t===e.length?"Unexpected end of input while parsing JSON":n>=32&&n<=126?`Unexpected character ${Ss(n)} in JSON at position ${t} (line ${s}, column ${i})`:`Unexpected byte 0x${n.toString(16)} in JSON at position ${t} (line ${s}, column ${i})`)}function A2(e){if(!(e instanceof Uint8Array))throw Error("JSON input must be a Uint8Array");let t=[],r=[],n=[],s=e.length,i=null,o=0,a,l=0;while(l<s){let c=e[l++];if(c<=32)continue;let u;if(o===2&&i===null&&c!==34&&c!==125)Yr(e,--l);switch(c){case 116:{if(e[l++]!==114||e[l++]!==117||e[l++]!==101)Yr(e,--l);u=!0;break}case 102:{if(e[l++]!==97||e[l++]!==108||e[l++]!==115||e[l++]!==101)Yr(e,--l);u=!1;break}case 110:{if(e[l++]!==117||e[l++]!==108||e[l++]!==108)Yr(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 p=l;u=Ss(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+=Ss(c),c=e[++l];continue}}break}if(u=+u,isNaN(u))Yr(e,--p,"Invalid number");break}case 34:{u="";while(!0){if(l>=s)Yr(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+=`
59
+ `;break;case 114:u+="\r";break;case 116:u+="\t";break;case 117:{let p=0;for(let h=0;h<4;h++)if(c=e[l++],p<<=4,c>=48&&c<=57)p|=c-48;else if(c>=97&&c<=102)p|=c+-87;else if(c>=65&&c<=70)p|=c+-55;else Yr(e,--l);u+=Ss(p);break}default:Yr(e,--l);break}else if(c<=127)u+=Ss(c);else if((c&224)===192)u+=Ss((c&31)<<6|e[l++]&63);else if((c&240)===224)u+=Ss((c&15)<<12|(e[l++]&63)<<6|e[l++]&63);else if((c&248)==240){let p=(c&7)<<18|(e[l++]&63)<<12|(e[l++]&63)<<6|e[l++]&63;if(p>65535)p-=65536,u+=Ss(p>>10&1023|55296),p=56320|p&1023;u+=Ss(p)}}u[0];break}case 91:{u=[],t.push(i),r.push(a),n.push(o),i=null,a=u,o=1;continue}case 123:{u={},t.push(i),r.push(a),n.push(o),i=null,a=u,o=2;continue}case 93:{if(o!==1)Yr(e,--l);u=a,i=t.pop(),a=r.pop(),o=n.pop();break}case 125:{if(o!==2)Yr(e,--l);u=a,i=t.pop(),a=r.pop(),o=n.pop();break}default:Yr(e,--l)}c=e[l];while(c<=32)c=e[++l];switch(o){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(i===null){if(i=u,c===58){l++;continue}}else{if(a[i]=u,i=null,c===44){l++;continue}if(c===125)continue}break}}break}Yr(e,l)}var At=JSON.stringify,a0="warning",l0="silent";function Go(e,t){let r=[];for(let n of e){if(Er(n,t),n.indexOf(",")>=0)throw Error(`Invalid ${t}: ${n}`);r.push(n)}return r.join(",")}var ju=()=>null,at=(e)=>typeof e==="boolean"?null:"a boolean",ie=(e)=>typeof e==="string"?null:"a string",ku=(e)=>e instanceof RegExp?null:"a RegExp object",Ki=(e)=>typeof e==="number"&&e===(e|0)?null:"an integer",R2=(e)=>typeof e==="number"&&e===(e|0)&&e>=0&&e<=65535?null:"a valid port number",b0=(e)=>typeof e==="function"?null:"a function",Es=(e)=>Array.isArray(e)?null:"an array",Pr=(e)=>Array.isArray(e)&&e.every((t)=>typeof t==="string")?null:"an array of strings",Br=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)?null:"an object",O2=(e)=>typeof e==="object"&&e!==null?null:"an array or an object",N2=(e)=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",c0=(e)=>typeof e==="object"&&!Array.isArray(e)?null:"an object or null",x0=(e)=>typeof e==="string"||typeof e==="boolean"?null:"a string or a boolean",C2=(e)=>typeof e==="string"||typeof e==="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",$0=(e)=>typeof e==="string"||Array.isArray(e)&&e.every((t)=>typeof t==="string")?null:"a string or an array of strings",w0=(e)=>typeof e==="string"||e instanceof Uint8Array?null:"a string or a Uint8Array",T2=(e)=>typeof e==="string"||e instanceof URL?null:"a string or a URL";function I(e,t,r,n){let s=e[r];if(t[r+""]=!0,s===void 0)return;let i=n(s);if(i!==null)throw Error(`${At(r)} must be ${i}`);return s}function St(e,t,r){for(let n in e)if(!(n in t))throw Error(`Invalid option ${r}: ${At(n)}`)}function I2(e){let t=Object.create(null),r=I(e,t,"wasmURL",T2),n=I(e,t,"wasmModule",N2),s=I(e,t,"worker",at);return St(e,t,"in initialize() call"),{wasmURL:r,wasmModule:n,worker:s}}function v0(e){let t;if(e!==void 0){t=Object.create(null);for(let r in e){let n=e[r];if(typeof n==="string"||n===!1)t[r]=n;else throw Error(`Expected ${At(r)} in mangle cache to map to either a string or false`)}}return t}function Nu(e,t,r,n,s){let i=I(t,r,"color",at),o=I(t,r,"logLevel",ie),a=I(t,r,"logLimit",Ki),l=I(t,r,"logStyle",ie);if(i!==void 0)e.push(`--color=${i}`);else if(n)e.push("--color=true");if(e.push(`--log-level=${o||s}`),e.push(`--log-limit=${a||0}`),l)e.push(`--log-style=${l}`)}function Er(e,t,r){if(typeof e!=="string")throw Error(`Expected value for ${t}${r!==void 0?" "+At(r):""} to be a string, got ${typeof e} instead`);return e}function S0(e,t,r){let n=I(t,r,"legalComments",ie),s=I(t,r,"sourceRoot",ie),i=I(t,r,"sourcesContent",at),o=I(t,r,"target",$0),a=I(t,r,"format",ie),l=I(t,r,"globalName",ie),c=I(t,r,"mangleProps",ku),u=I(t,r,"reserveProps",ku),p=I(t,r,"mangleQuoted",at),h=I(t,r,"minify",at),m=I(t,r,"minifySyntax",at),y=I(t,r,"minifyWhitespace",at),g=I(t,r,"minifyIdentifiers",at),b=I(t,r,"lineLimit",Ki),w=I(t,r,"drop",Pr),j=I(t,r,"dropLabels",Pr),S=I(t,r,"charset",ie),E=I(t,r,"treeShaking",at),P=I(t,r,"ignoreAnnotations",at),R=I(t,r,"jsx",ie),N=I(t,r,"jsxFactory",ie),_=I(t,r,"jsxFragment",ie),q=I(t,r,"jsxImportSource",ie),D=I(t,r,"jsxDev",at),O=I(t,r,"jsxSideEffects",at),L=I(t,r,"define",Br),K=I(t,r,"logOverride",Br),ae=I(t,r,"supported",Br),me=I(t,r,"pure",Pr),ce=I(t,r,"keepNames",at),se=I(t,r,"platform",ie),ue=I(t,r,"tsconfigRaw",C2),Ne=I(t,r,"absPaths",Pr);if(n)e.push(`--legal-comments=${n}`);if(s!==void 0)e.push(`--source-root=${s}`);if(i!==void 0)e.push(`--sources-content=${i}`);if(o)e.push(`--target=${Go(Array.isArray(o)?o:[o],"target")}`);if(a)e.push(`--format=${a}`);if(l)e.push(`--global-name=${l}`);if(se)e.push(`--platform=${se}`);if(ue)e.push(`--tsconfig-raw=${typeof ue==="string"?ue:JSON.stringify(ue)}`);if(h)e.push("--minify");if(m)e.push("--minify-syntax");if(y)e.push("--minify-whitespace");if(g)e.push("--minify-identifiers");if(b)e.push(`--line-limit=${b}`);if(S)e.push(`--charset=${S}`);if(E!==void 0)e.push(`--tree-shaking=${E}`);if(P)e.push("--ignore-annotations");if(w)for(let X of w)e.push(`--drop:${Er(X,"drop")}`);if(j)e.push(`--drop-labels=${Go(j,"drop label")}`);if(Ne)e.push(`--abs-paths=${Go(Ne,"abs paths")}`);if(c)e.push(`--mangle-props=${_u(c)}`);if(u)e.push(`--reserve-props=${_u(u)}`);if(p!==void 0)e.push(`--mangle-quoted=${p}`);if(R)e.push(`--jsx=${R}`);if(N)e.push(`--jsx-factory=${N}`);if(_)e.push(`--jsx-fragment=${_}`);if(q)e.push(`--jsx-import-source=${q}`);if(D)e.push("--jsx-dev");if(O)e.push("--jsx-side-effects");if(L)for(let X in L){if(X.indexOf("=")>=0)throw Error(`Invalid define: ${X}`);e.push(`--define:${X}=${Er(L[X],"define",X)}`)}if(K)for(let X in K){if(X.indexOf("=")>=0)throw Error(`Invalid log override: ${X}`);e.push(`--log-override:${X}=${Er(K[X],"log override",X)}`)}if(ae)for(let X in ae){if(X.indexOf("=")>=0)throw Error(`Invalid supported: ${X}`);let Ee=ae[X];if(typeof Ee!=="boolean")throw Error(`Expected value for supported ${At(X)} to be a boolean, got ${typeof Ee} instead`);e.push(`--supported:${X}=${Ee}`)}if(me)for(let X of me)e.push(`--pure:${Er(X,"pure")}`);if(ce)e.push("--keep-names")}function J2(e,t,r,n,s){var i;let o=[],a=[],l=Object.create(null),c=null,u=null;Nu(o,t,l,r,n),S0(o,t,l);let p=I(t,l,"sourcemap",x0),h=I(t,l,"bundle",at),m=I(t,l,"splitting",at),y=I(t,l,"preserveSymlinks",at),g=I(t,l,"metafile",at),b=I(t,l,"outfile",ie),w=I(t,l,"outdir",ie),j=I(t,l,"outbase",ie),S=I(t,l,"tsconfig",ie),E=I(t,l,"resolveExtensions",Pr),P=I(t,l,"nodePaths",Pr),R=I(t,l,"mainFields",Pr),N=I(t,l,"conditions",Pr),_=I(t,l,"external",Pr),q=I(t,l,"packages",ie),D=I(t,l,"alias",Br),O=I(t,l,"loader",Br),L=I(t,l,"outExtension",Br),K=I(t,l,"publicPath",ie),ae=I(t,l,"entryNames",ie),me=I(t,l,"chunkNames",ie),ce=I(t,l,"assetNames",ie),se=I(t,l,"inject",Pr),ue=I(t,l,"banner",Br),Ne=I(t,l,"footer",Br),X=I(t,l,"entryPoints",O2),Ee=I(t,l,"absWorkingDir",ie),oe=I(t,l,"stdin",Br),W=(i=I(t,l,"write",at))!=null?i:s,ot=I(t,l,"allowOverwrite",at),de=I(t,l,"mangleCache",Br);if(l.plugins=!0,St(t,l,`in ${e}() call`),p)o.push(`--sourcemap${p===!0?"":`=${p}`}`);if(h)o.push("--bundle");if(ot)o.push("--allow-overwrite");if(m)o.push("--splitting");if(y)o.push("--preserve-symlinks");if(g)o.push("--metafile");if(b)o.push(`--outfile=${b}`);if(w)o.push(`--outdir=${w}`);if(j)o.push(`--outbase=${j}`);if(S)o.push(`--tsconfig=${S}`);if(q)o.push(`--packages=${q}`);if(E)o.push(`--resolve-extensions=${Go(E,"resolve extension")}`);if(K)o.push(`--public-path=${K}`);if(ae)o.push(`--entry-names=${ae}`);if(me)o.push(`--chunk-names=${me}`);if(ce)o.push(`--asset-names=${ce}`);if(R)o.push(`--main-fields=${Go(R,"main field")}`);if(N)o.push(`--conditions=${Go(N,"condition")}`);if(_)for(let Y of _)o.push(`--external:${Er(Y,"external")}`);if(D)for(let Y in D){if(Y.indexOf("=")>=0)throw Error(`Invalid package name in alias: ${Y}`);o.push(`--alias:${Y}=${Er(D[Y],"alias",Y)}`)}if(ue)for(let Y in ue){if(Y.indexOf("=")>=0)throw Error(`Invalid banner file type: ${Y}`);o.push(`--banner:${Y}=${Er(ue[Y],"banner",Y)}`)}if(Ne)for(let Y in Ne){if(Y.indexOf("=")>=0)throw Error(`Invalid footer file type: ${Y}`);o.push(`--footer:${Y}=${Er(Ne[Y],"footer",Y)}`)}if(se)for(let Y of se)o.push(`--inject:${Er(Y,"inject")}`);if(O)for(let Y in O){if(Y.indexOf("=")>=0)throw Error(`Invalid loader extension: ${Y}`);o.push(`--loader:${Y}=${Er(O[Y],"loader",Y)}`)}if(L)for(let Y in L){if(Y.indexOf("=")>=0)throw Error(`Invalid out extension: ${Y}`);o.push(`--out-extension:${Y}=${Er(L[Y],"out extension",Y)}`)}if(X)if(Array.isArray(X))for(let Y=0,Pt=X.length;Y<Pt;Y++){let et=X[Y];if(typeof et==="object"&&et!==null){let Kt=Object.create(null),wt=I(et,Kt,"in",ie),Ot=I(et,Kt,"out",ie);if(St(et,Kt,"in entry point at index "+Y),wt===void 0)throw Error('Missing property "in" for entry point at index '+Y);if(Ot===void 0)throw Error('Missing property "out" for entry point at index '+Y);a.push([Ot,wt])}else a.push(["",Er(et,"entry point at index "+Y)])}else for(let Y in X)a.push([Y,Er(X[Y],"entry point",Y)]);if(oe){let Y=Object.create(null),Pt=I(oe,Y,"contents",w0),et=I(oe,Y,"resolveDir",ie),Kt=I(oe,Y,"sourcefile",ie),wt=I(oe,Y,"loader",ie);if(St(oe,Y,'in "stdin" object'),Kt)o.push(`--sourcefile=${Kt}`);if(wt)o.push(`--loader=${wt}`);if(et)u=et;if(typeof Pt==="string")c=yn(Pt);else if(Pt instanceof Uint8Array)c=Pt}let $t=[];if(P)for(let Y of P)Y+="",$t.push(Y);return{entries:a,flags:o,write:W,stdinContents:c,stdinResolveDir:u,absWorkingDir:Ee,nodePaths:$t,mangleCache:v0(de)}}function M2(e,t,r,n){let s=[],i=Object.create(null);Nu(s,t,i,r,n),S0(s,t,i);let o=I(t,i,"sourcemap",x0),a=I(t,i,"sourcefile",ie),l=I(t,i,"loader",ie),c=I(t,i,"banner",ie),u=I(t,i,"footer",ie),p=I(t,i,"mangleCache",Br);if(St(t,i,`in ${e}() call`),o)s.push(`--sourcemap=${o===!0?"external":o}`);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:v0(p)}}function E0(e){let t={},r={didClose:!1,reason:""},n={},s=0,i=0,o=new Uint8Array(16384),a=0,l=(S)=>{let E=a+S.length;if(E>o.length){let R=new Uint8Array(E*2);R.set(o),o=R}o.set(S,a),a+=S.length;let P=0;while(P+4<=a){let R=y0(o,P);if(P+4+R>a)break;P+=4,y(o.subarray(P,P+R)),P+=R}if(P>0)o.copyWithin(0,P,a),a-=P},c=(S)=>{if(r.didClose=!0,S)r.reason=": "+(S.message||S);let E="The service was stopped"+r.reason;for(let P in n)n[P](E,null);n={}},u=(S,E,P)=>{if(r.didClose)return P("The service is no longer running"+r.reason,null);let R=s++;if(n[R]=(N,_)=>{try{P(N,_)}finally{if(S)S.unref()}},S)S.ref();e.writeToStdin(o0({id:R,isRequest:!0,value:E}))},p=(S,E)=>{if(r.didClose)throw Error("The service is no longer running"+r.reason);e.writeToStdin(o0({id:S,isRequest:!1,value:E}))},h=async(S,E)=>{try{if(E.command==="ping"){p(S,{});return}if(typeof E.key==="number"){let P=t[E.key];if(!P)return;let R=P[E.command];if(R){await R(S,E);return}}throw Error("Invalid command: "+E.command)}catch(P){let R=[Gi(P,e,null,void 0,"")];try{p(S,{errors:R})}catch{}}},m=!0,y=(S)=>{if(m){m=!1;let P=String.fromCharCode(...S);if(P!=="0.28.2")throw Error(`Cannot start service: Host version "0.28.2" does not match binary version ${At(P)}`);return}let E=_2(S);if(E.isRequest)h(E.id,E.value);else{let P=n[E.id];if(delete n[E.id],E.value.error)P(E.value.error,{});else P(null,E.value)}};return{readFromStdout:l,afterClose:c,service:{buildOrContext:({callName:S,refs:E,options:P,isTTY:R,defaultWD:N,callback:_})=>{let q=0,D=i++,O={},L={ref(){if(++q===1){if(E)E.ref()}},unref(){if(--q===0){if(delete t[D],E)E.unref()}}};t[D]=O,L.ref(),D2(S,D,u,p,L,e,O,P,R,N,(K,ae)=>{try{_(K,ae)}finally{L.unref()}})},transform:({callName:S,refs:E,input:P,options:R,isTTY:N,fs:_,callback:q})=>{let D=P0(),O=(L)=>{try{if(typeof P!=="string"&&!(P instanceof Uint8Array))throw Error('The input to "transform" must be a string or a Uint8Array');let{flags:K,mangleCache:ae}=M2(S,R,N,l0),me={command:"transform",flags:K,inputFS:L!==null,input:L!==null?yn(L):typeof P==="string"?yn(P):P};if(ae)me.mangleCache=ae;u(E,me,(ce,se)=>{if(ce)return q(Error(ce),null);let ue=Ko(se.errors,D),Ne=Ko(se.warnings,D),X=1,Ee=()=>{if(--X===0){let oe={warnings:Ne,code:se.code,map:se.map,mangleCache:void 0,legalComments:void 0};if("legalComments"in se)oe.legalComments=se==null?void 0:se.legalComments;if(se.mangleCache)oe.mangleCache=se==null?void 0:se.mangleCache;q(null,oe)}};if(ue.length>0)return q(_l("Transform failed",ue,Ne),null);if(se.codeFS)X++,_.readFile(se.code,(oe,W)=>{if(oe!==null)q(oe,null);else se.code=W,Ee()});if(se.mapFS)X++,_.readFile(se.map,(oe,W)=>{if(oe!==null)q(oe,null);else se.map=W,Ee()});Ee()})}catch(K){let ae=[];try{Nu(ae,R,{},N,l0)}catch{}let me=Gi(K,e,D,void 0,"");u(E,{command:"error",flags:ae,error:me},()=>{me.detail=D.load(me.detail),q(_l("Transform failed",[me],[]),null)})}};if((typeof P==="string"||P instanceof Uint8Array)&&P.length>1048576){let L=O;O=()=>_.writeFile(P,L)}O(null)},formatMessages:({callName:S,refs:E,messages:P,options:R,callback:N})=>{if(!R)throw Error(`Missing second argument in ${S}() call`);let _={},q=I(R,_,"kind",ie),D=I(R,_,"color",at),O=I(R,_,"terminalWidth",Ki),L=I(R,_,"logStyle",ie);if(St(R,_,`in ${S}() call`),q===void 0)throw Error(`Missing "kind" in ${S}() call`);if(q!=="error"&&q!=="warning")throw Error(`Expected "kind" to be "error" or "warning" in ${S}() call`);let K={command:"format-msgs",messages:Ps(P,"messages",null,"",O),isWarning:q==="warning"};if(D!==void 0)K.color=D;if(O!==void 0)K.terminalWidth=O;if(L!==void 0)K.logStyle=L;u(E,K,(ae,me)=>{if(ae)return N(Error(ae),null);N(null,me.messages)})},analyzeMetafile:({callName:S,refs:E,metafile:P,options:R,callback:N})=>{if(R===void 0)R={};let _={},q=I(R,_,"color",at),D=I(R,_,"verbose",at);St(R,_,`in ${S}() call`);let O={command:"analyze-metafile",metafile:P};if(q!==void 0)O.color=q;if(D!==void 0)O.verbose=D;u(E,O,(L,K)=>{if(L)return N(Error(L),null);N(null,K.result)})}}}}function D2(e,t,r,n,s,i,o,a,l,c,u){let p=P0(),h=e==="context",m=(b,w)=>{let j=[];try{Nu(j,a,{},l,a0)}catch{}let S=Gi(b,i,p,void 0,w);r(s,{command:"error",flags:j,error:S},()=>{S.detail=p.load(S.detail),u(_l(h?"Context failed":"Build failed",[S],[]),null)})},y;if(typeof a==="object"){let b=a.plugins;if(b!==void 0){if(!Array.isArray(b))return m(Error('"plugins" must be an array'),"");y=b}}if(y&&y.length>0){if(i.isSync)return m(Error("Cannot use plugins in synchronous API calls"),"");L2(t,r,n,s,i,o,a,y,p).then((b)=>{if(!b.ok)return m(b.error,b.pluginName);try{g(b.requestPlugins,b.runOnEndCallbacks,b.scheduleOnDisposeCallbacks)}catch(w){m(w,"")}},(b)=>m(b,""));return}try{g(null,(b,w)=>w([],[]),()=>{})}catch(b){m(b,"")}function g(b,w,j){let S=i.hasFS,{entries:E,flags:P,write:R,stdinContents:N,stdinResolveDir:_,absWorkingDir:q,nodePaths:D,mangleCache:O}=J2(e,a,l,a0,S);if(R&&!i.hasFS)throw Error('The "write" option is unavailable in this environment');let L={command:"build",key:t,entries:E,flags:P,write:R,stdinContents:N,stdinResolveDir:_,absWorkingDir:q||c,nodePaths:D,context:h};if(b)L.plugins=b;if(O)L.mangleCache=O;let K=(ce,se)=>{let ue={errors:Ko(ce.errors,p),warnings:Ko(ce.warnings,p),outputFiles:void 0,metafile:void 0,mangleCache:void 0},Ne=ue.errors.slice(),X=ue.warnings.slice();if(ce.outputFiles)ue.outputFiles=ce.outputFiles.map(q2);if(ce.metafile&&ce.metafile.length)ue.metafile=V2(ce.metafile);if(ce.mangleCache)ue.mangleCache=ce.mangleCache;if(ce.writeToStdout!==void 0)console.log(Zi(ce.writeToStdout).replace(/\n$/,""));w(ue,(Ee,oe)=>{if(Ne.length>0||Ee.length>0){let W=_l("Build failed",Ne.concat(Ee),X.concat(oe));return se(W,null,Ee,oe)}se(null,ue,Ee,oe)})},ae,me;if(h)o["on-end"]=(ce,se)=>new Promise((ue)=>{K(se,(Ne,X,Ee,oe)=>{let W={errors:Ee,warnings:oe};if(me)me(Ne,X);ae=void 0,me=void 0,n(ce,W),ue()})});r(s,L,(ce,se)=>{if(ce)return u(Error(ce),null);if(!h)return K(se,(X,Ee)=>(j(),u(X,Ee)));if(se.errors.length>0)return u(_l("Context failed",se.errors,se.warnings),null);let ue=!1,Ne={rebuild:()=>{if(!ae)ae=new Promise((X,Ee)=>{let oe;me=(ot,de)=>{if(!oe)oe=()=>ot?Ee(ot):X(de)};let W=()=>{r(s,{command:"rebuild",key:t},(de,$t)=>{if(de)Ee(Error(de));else if(oe)oe();else W()})};W()});return ae},watch:(X={})=>new Promise((Ee,oe)=>{if(!i.hasFS)throw Error('Cannot use the "watch" API in this environment');let W={},ot=I(X,W,"delay",Ki);St(X,W,"in watch() call");let de={command:"watch",key:t};if(ot)de.delay=ot;r(s,de,($t)=>{if($t)oe(Error($t));else Ee(void 0)})}),serve:(X={})=>new Promise((Ee,oe)=>{if(!i.hasFS)throw Error('Cannot use the "serve" API in this environment');let W={},ot=I(X,W,"port",R2),de=I(X,W,"host",ie),$t=I(X,W,"servedir",ie),Y=I(X,W,"keyfile",ie),Pt=I(X,W,"certfile",ie),et=I(X,W,"fallback",ie),Kt=I(X,W,"cors",Br),wt=I(X,W,"onRequest",b0);St(X,W,"in serve() call");let Ot={command:"serve",key:t,onRequest:!!wt};if(ot!==void 0)Ot.port=ot;if(de!==void 0)Ot.host=de;if($t!==void 0)Ot.servedir=$t;if(Y!==void 0)Ot.keyfile=Y;if(Pt!==void 0)Ot.certfile=Pt;if(et!==void 0)Ot.fallback=et;if(Kt){let Xt={},qt=I(Kt,Xt,"origin",$0);if(St(Kt,Xt,'on "cors" object'),Array.isArray(qt))Ot.corsOrigin=qt;else if(qt!==void 0)Ot.corsOrigin=[qt]}r(s,Ot,(Xt,qt)=>{if(Xt)return oe(Error(Xt));if(wt)o["serve-request"]=(os,as)=>{wt(as.args),n(os,{})};Ee(qt)})}),cancel:()=>new Promise((X)=>{if(ue)return X();r(s,{command:"cancel",key:t},()=>{X()})}),dispose:()=>new Promise((X)=>{if(ue)return X();ue=!0,r(s,{command:"dispose",key:t},()=>{X(),j(),s.unref()})})};s.ref(),u(null,Ne)})}}var L2=async(e,t,r,n,s,i,o,a,l)=>{let c=[],u=[],p={},h={},m=[],y=0,g=0,b=[],w=!1;a=[...a];for(let E of a){let P={};if(typeof E!=="object")throw Error(`Plugin at index ${g} must be an object`);let R=I(E,P,"name",ie);if(typeof R!=="string"||R==="")throw Error(`Plugin at index ${g} is missing a name`);try{let N=I(E,P,"setup",b0);if(typeof N!=="function")throw Error("Plugin is missing a setup function");St(E,P,`on plugin ${At(R)}`);let _={name:R,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};g++;let D=N({initialOptions:o,resolve:(O,L={})=>{if(!w)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 K=Object.create(null),ae=I(L,K,"pluginName",ie),me=I(L,K,"importer",ie),ce=I(L,K,"namespace",ie),se=I(L,K,"resolveDir",ie),ue=I(L,K,"kind",ie),Ne=I(L,K,"pluginData",ju),X=I(L,K,"with",Br);return St(L,K,"in resolve() call"),new Promise((Ee,oe)=>{let W={command:"resolve",path:O,key:e,pluginName:R};if(ae!=null)W.pluginName=ae;if(me!=null)W.importer=me;if(ce!=null)W.namespace=ce;if(se!=null)W.resolveDir=se;if(ue!=null)W.kind=ue;else throw Error('Must specify "kind" when calling "resolve"');if(Ne!=null)W.pluginData=l.store(Ne);if(X!=null)W.with=F2(X,"with");t(n,W,(ot,de)=>{if(ot!==null)oe(Error(ot));else Ee({errors:Ko(de.errors,l),warnings:Ko(de.warnings,l),path:de.path,external:de.external,sideEffects:de.sideEffects,namespace:de.namespace,suffix:de.suffix,pluginData:l.load(de.pluginData)})})})},onStart(O){let K=Eu(Error('This error came from the "onStart" callback registered here:'),s,"onStart");c.push({name:R,callback:O,note:K}),_.onStart=!0},onEnd(O){let K=Eu(Error('This error came from the "onEnd" callback registered here:'),s,"onEnd");u.push({name:R,callback:O,note:K}),_.onEnd=!0},onResolve(O,L){let ae=Eu(Error('This error came from the "onResolve" callback registered here:'),s,"onResolve"),me={},ce=I(O,me,"filter",ku),se=I(O,me,"namespace",ie);if(St(O,me,`in onResolve() call for plugin ${At(R)}`),ce==null)throw Error("onResolve() call is missing a filter");let ue=y++;p[ue]={name:R,callback:L,note:ae},_.onResolve.push({id:ue,filter:_u(ce),namespace:se||""})},onLoad(O,L){let ae=Eu(Error('This error came from the "onLoad" callback registered here:'),s,"onLoad"),me={},ce=I(O,me,"filter",ku),se=I(O,me,"namespace",ie);if(St(O,me,`in onLoad() call for plugin ${At(R)}`),ce==null)throw Error("onLoad() call is missing a filter");let ue=y++;h[ue]={name:R,callback:L,note:ae},_.onLoad.push({id:ue,filter:_u(ce),namespace:se||""})},onDispose(O){m.push(O)},esbuild:s.esbuild});if(D)await D;b.push(_)}catch(N){return{ok:!1,error:N,pluginName:R}}}i["on-start"]=async(E,P)=>{l.clear();let R={errors:[],warnings:[]};await Promise.all(c.map(async({name:N,callback:_,note:q})=>{try{let D=await _();if(D!=null){if(typeof D!=="object")throw Error(`Expected onStart() callback in plugin ${At(N)} to return an object`);let O={},L=I(D,O,"errors",Es),K=I(D,O,"warnings",Es);if(St(D,O,`from onStart() callback in plugin ${At(N)}`),L!=null)R.errors.push(...Ps(L,"errors",l,N,void 0));if(K!=null)R.warnings.push(...Ps(K,"warnings",l,N,void 0))}}catch(D){R.errors.push(Gi(D,s,l,q&&q(),N))}})),r(E,R)},i["on-resolve"]=async(E,P)=>{let R={},N="",_,q;for(let D of P.ids)try{({name:N,callback:_,note:q}=p[D]);let O=await _({path:P.path,importer:P.importer,namespace:P.namespace,resolveDir:P.resolveDir,kind:P.kind,pluginData:l.load(P.pluginData),with:P.with});if(O!=null){if(typeof O!=="object")throw Error(`Expected onResolve() callback in plugin ${At(N)} to return an object`);let L={},K=I(O,L,"pluginName",ie),ae=I(O,L,"path",ie),me=I(O,L,"namespace",ie),ce=I(O,L,"suffix",ie),se=I(O,L,"external",at),ue=I(O,L,"sideEffects",at),Ne=I(O,L,"pluginData",ju),X=I(O,L,"errors",Es),Ee=I(O,L,"warnings",Es),oe=I(O,L,"watchFiles",Pr),W=I(O,L,"watchDirs",Pr);if(St(O,L,`from onResolve() callback in plugin ${At(N)}`),R.id=D,K!=null)R.pluginName=K;if(ae!=null)R.path=ae;if(me!=null)R.namespace=me;if(ce!=null)R.suffix=ce;if(se!=null)R.external=se;if(ue!=null)R.sideEffects=ue;if(Ne!=null)R.pluginData=l.store(Ne);if(X!=null)R.errors=Ps(X,"errors",l,N,void 0);if(Ee!=null)R.warnings=Ps(Ee,"warnings",l,N,void 0);if(oe!=null)R.watchFiles=Pu(oe,"watchFiles");if(W!=null)R.watchDirs=Pu(W,"watchDirs");break}}catch(O){R={id:D,errors:[Gi(O,s,l,q&&q(),N)]};break}r(E,R)},i["on-load"]=async(E,P)=>{let R={},N="",_,q;for(let D of P.ids)try{({name:N,callback:_,note:q}=h[D]);let O=await _({path:P.path,namespace:P.namespace,suffix:P.suffix,pluginData:l.load(P.pluginData),with:P.with});if(O!=null){if(typeof O!=="object")throw Error(`Expected onLoad() callback in plugin ${At(N)} to return an object`);let L={},K=I(O,L,"pluginName",ie),ae=I(O,L,"contents",w0),me=I(O,L,"resolveDir",ie),ce=I(O,L,"pluginData",ju),se=I(O,L,"loader",ie),ue=I(O,L,"errors",Es),Ne=I(O,L,"warnings",Es),X=I(O,L,"watchFiles",Pr),Ee=I(O,L,"watchDirs",Pr);if(St(O,L,`from onLoad() callback in plugin ${At(N)}`),R.id=D,K!=null)R.pluginName=K;if(ae instanceof Uint8Array)R.contents=ae;else if(ae!=null)R.contents=yn(ae);if(me!=null)R.resolveDir=me;if(ce!=null)R.pluginData=l.store(ce);if(se!=null)R.loader=se;if(ue!=null)R.errors=Ps(ue,"errors",l,N,void 0);if(Ne!=null)R.warnings=Ps(Ne,"warnings",l,N,void 0);if(X!=null)R.watchFiles=Pu(X,"watchFiles");if(Ee!=null)R.watchDirs=Pu(Ee,"watchDirs");break}}catch(O){R={id:D,errors:[Gi(O,s,l,q&&q(),N)]};break}r(E,R)};let j=(E,P)=>P([],[]);if(u.length>0)j=(E,P)=>{(async()=>{let R=[],N=[];for(let{name:_,callback:q,note:D}of u){let O,L;try{let K=await q(E);if(K!=null){if(typeof K!=="object")throw Error(`Expected onEnd() callback in plugin ${At(_)} to return an object`);let ae={},me=I(K,ae,"errors",Es),ce=I(K,ae,"warnings",Es);if(St(K,ae,`from onEnd() callback in plugin ${At(_)}`),me!=null)O=Ps(me,"errors",l,_,void 0);if(ce!=null)L=Ps(ce,"warnings",l,_,void 0)}}catch(K){O=[Gi(K,s,l,D&&D(),_)]}if(O){R.push(...O);try{E.errors.push(...O)}catch{}}if(L){N.push(...L);try{E.warnings.push(...L)}catch{}}}P(R,N)})()};let S=()=>{for(let E of m)setTimeout(()=>E(),0)};return w=!0,{ok:!0,requestPlugins:b,runOnEndCallbacks:j,scheduleOnDisposeCallbacks:S}};function P0(){let e=new Map,t=0;return{clear(){e.clear()},load(r){return e.get(r)},store(r){if(r===void 0)return-1;let n=t++;return e.set(n,r),n}}}function Eu(e,t,r){let n,s=!1;return()=>{if(s)return n;s=!0;try{let i=(e.stack+"").split(`
60
+ `);i.splice(1,1);let o=j0(t,i,r);if(o)return n={text:e.message,location:o},n}catch{}}}function Gi(e,t,r,n,s){let i="Internal error",o=null;try{i=(e&&e.message||e)+""}catch{}try{o=j0(t,(e.stack+"").split(`
61
+ `),"")}catch{}return{id:"",pluginName:s,text:i,location:o,notes:n?[n]:[],detail:r?r.store(e):-1}}function j0(e,t,r){let n=" at ";if(e.readFileSync&&!t[0].startsWith(n)&&t[1].startsWith(n))for(let s=1;s<t.length;s++){let i=t[s];if(!i.startsWith(n))continue;i=i.slice(n.length);while(!0){let o=/^(?:new |async )?\S+ \((.*)\)$/.exec(i);if(o){i=o[1];continue}if(o=/^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec(i),o){i=o[1];continue}if(o=/^(\S+):(\d+):(\d+)$/.exec(i),o){let a;try{a=e.readFileSync(o[1],"utf8")}catch{break}let l=a.split(/\r\n|\r|\n|\u2028|\u2029/)[+o[2]-1]||"",c=+o[3]-1,u=l.slice(c,c+r.length)===r?r.length:0;return{file:o[1],namespace:"file",line:+o[2],column:yn(l.slice(0,c)).length,length:yn(l.slice(c,c+u)).length,lineText:l+`
62
62
  `+t.slice(1).join(`
63
- `),suggestion:""}}break}}return null}function $l(e,t,r){let n=5;e+=t.length<1?"":` with ${t.length} error${t.length<2?"":"s"}:`+t.slice(0,n+1).map((i,o)=>{if(o===n)return`
63
+ `),suggestion:""}}break}}return null}function _l(e,t,r){let n=5;e+=t.length<1?"":` with ${t.length} error${t.length<2?"":"s"}:`+t.slice(0,n+1).map((i,o)=>{if(o===n)return`
64
64
  ...`;if(!i.location)return`
65
65
  error: ${i.text}`;let{file:a,line:l,column:c}=i.location,u=i.pluginName?`[plugin: ${i.pluginName}] `:"";return`
66
- ${a}:${l}:${c}: ERROR: ${u}${i.text}`}).join("");let s=Error(e);for(let[i,o]of[["errors",t],["warnings",r]])Object.defineProperty(s,i,{configurable:!0,enumerable:!0,get:()=>o,set:(a)=>Object.defineProperty(s,i,{configurable:!0,enumerable:!0,value:a})});return s}function Ho(e,t){for(let r of e)r.detail=t.load(r.detail);return e}function qx(e,t,r){if(e==null)return null;let n={},s=T(e,n,"file",ie),i=T(e,n,"namespace",ie),o=T(e,n,"line",zi),a=T(e,n,"column",zi),l=T(e,n,"length",zi),c=T(e,n,"lineText",ie),u=T(e,n,"suggestion",ie);if(St(e,n,t),c){let p=c.slice(0,(a&&a>0?a:0)+(l&&l>0?l:0)+(r&&r>0?r:80));if(!/[\x7F-\uFFFF]/.test(p)&&!/\n/.test(c))c=p}return{file:s||"",namespace:i||"",line:o||0,column:a||0,length:l||0,lineText:c||"",suggestion:u||""}}function ws(e,t,r,n,s){let i=[],o=0;for(let a of e){let l={},c=T(a,l,"id",ie),u=T(a,l,"pluginName",ie),p=T(a,l,"text",ie),h=T(a,l,"location",Fx),m=T(a,l,"notes",$s),b=T(a,l,"detail",du),g=`in element ${o} of "${t}"`;St(a,l,g);let y=[];if(m)for(let w of m){let j={},S=T(w,j,"text",ie),E=T(w,j,"location",Fx);St(w,j,g),y.push({text:S||"",location:qx(E,g,s)})}i.push({id:c||"",pluginName:u||n,text:p||"",location:qx(h,g,s),notes:y,detail:r?r.store(b):-1}),o++}return i}function fu(e,t){let r=[];for(let n of e){if(typeof n!=="string")throw Error(`${At(t)} must be an array of strings`);r.push(n)}return r}function n2(e,t){let r=Object.create(null);for(let n in e){let s=e[n];if(typeof s!=="string")throw Error(`key ${At(n)} in object ${At(t)} must be a string`);r[n]=s}return r}function s2({path:e,contents:t,hash:r}){let n=null;return{path:e,contents:t,hash:r,get text(){let s=this.contents;if(n===null||s!==t)t=s,n=Yi(s);return n}}}function mu(e){let t=e.source;if(e.flags)t=`(?${e.flags})${t}`;return t}function i2(e){let t;try{t=Yi(e)}catch{return UI(e)}return JSON.parse(t)}var zs=He("fs"),Vx=He("os"),Yr=He("path"),Wo=process.env.ESBUILD_BINARY_PATH||Wo,o2=(e)=>!!e&&e!=="/usr/bin/esbuild",Wx="@esbuild/darwin-arm64",Bx="@esbuild/darwin-x64",hu={"win32 arm64 LE":"@esbuild/win32-arm64","win32 ia32 LE":"@esbuild/win32-ia32","win32 x64 LE":"@esbuild/win32-x64"},gu={"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"},Hx={"android arm LE":"@esbuild/android-arm","android x64 LE":"@esbuild/android-x64","openharmony arm64 LE":"@esbuild/openharmony-arm64"};function a2(){let e,t,r=!1,n=`${process.platform} ${Vx.arch()} ${Vx.endianness()}`;if(n in hu)e=hu[n],t="esbuild.exe";else if(n in gu)e=gu[n],t="bin/esbuild";else if(n in Hx)e=Hx[n],t="bin/esbuild",r=!0;else throw Error(`Unsupported platform: ${n}`);return{pkg:e,subpath:t,isWASM:r}}function l2(){let e=He.resolve("esbuild"),t=Yr.dirname(Yr.dirname(Yr.dirname(e)));if(Yr.basename(t)==="node_modules"){for(let r in gu)try{let n=gu[r];if(zs.existsSync(Yr.join(t,n)))return n}catch{}for(let r in hu)try{let n=hu[r];if(zs.existsSync(Yr.join(t,n)))return n}catch{}}return null}function c2(e,t){let r=Yr.dirname(He.resolve("esbuild"));return Yr.join(r,`downloaded-${e.replace("/","-")}-${Yr.basename(t)}`)}function u2(){if(o2(Wo))if(!zs.existsSync(Wo))console.warn(`[esbuild] Ignoring bad configuration: ESBUILD_BINARY_PATH=${Wo}`);else return{binPath:Wo,isWASM:!1};let{pkg:e,subpath:t,isWASM:r}=a2(),n;try{n=He.resolve(`${e}/${t}`)}catch(s){if(n=c2(e,t),!zs.existsSync(n)){try{He.resolve(e)}catch{let i=l2();if(i){let o=`
66
+ ${a}:${l}:${c}: ERROR: ${u}${i.text}`}).join("");let s=Error(e);for(let[i,o]of[["errors",t],["warnings",r]])Object.defineProperty(s,i,{configurable:!0,enumerable:!0,get:()=>o,set:(a)=>Object.defineProperty(s,i,{configurable:!0,enumerable:!0,value:a})});return s}function Ko(e,t){for(let r of e)r.detail=t.load(r.detail);return e}function u0(e,t,r){if(e==null)return null;let n={},s=I(e,n,"file",ie),i=I(e,n,"namespace",ie),o=I(e,n,"line",Ki),a=I(e,n,"column",Ki),l=I(e,n,"length",Ki),c=I(e,n,"lineText",ie),u=I(e,n,"suggestion",ie);if(St(e,n,t),c){let p=c.slice(0,(a&&a>0?a:0)+(l&&l>0?l:0)+(r&&r>0?r:80));if(!/[\x7F-\uFFFF]/.test(p)&&!/\n/.test(c))c=p}return{file:s||"",namespace:i||"",line:o||0,column:a||0,length:l||0,lineText:c||"",suggestion:u||""}}function Ps(e,t,r,n,s){let i=[],o=0;for(let a of e){let l={},c=I(a,l,"id",ie),u=I(a,l,"pluginName",ie),p=I(a,l,"text",ie),h=I(a,l,"location",c0),m=I(a,l,"notes",Es),y=I(a,l,"detail",ju),g=`in element ${o} of "${t}"`;St(a,l,g);let b=[];if(m)for(let w of m){let j={},S=I(w,j,"text",ie),E=I(w,j,"location",c0);St(w,j,g),b.push({text:S||"",location:u0(E,g,s)})}i.push({id:c||"",pluginName:u||n,text:p||"",location:u0(h,g,s),notes:b,detail:r?r.store(y):-1}),o++}return i}function Pu(e,t){let r=[];for(let n of e){if(typeof n!=="string")throw Error(`${At(t)} must be an array of strings`);r.push(n)}return r}function F2(e,t){let r=Object.create(null);for(let n in e){let s=e[n];if(typeof s!=="string")throw Error(`key ${At(n)} in object ${At(t)} must be a string`);r[n]=s}return r}function q2({path:e,contents:t,hash:r}){let n=null;return{path:e,contents:t,hash:r,get text(){let s=this.contents;if(n===null||s!==t)t=s,n=Zi(s);return n}}}function _u(e){let t=e.source;if(e.flags)t=`(?${e.flags})${t}`;return t}function V2(e){let t;try{t=Zi(e)}catch{return A2(e)}return JSON.parse(t)}var Xs=Ue("fs"),f0=Ue("os"),Zr=Ue("path"),zo=process.env.ESBUILD_BINARY_PATH||zo,B2=(e)=>!!e&&e!=="/usr/bin/esbuild",d0="@esbuild/darwin-arm64",p0="@esbuild/darwin-x64",Au={"win32 arm64 LE":"@esbuild/win32-arm64","win32 ia32 LE":"@esbuild/win32-ia32","win32 x64 LE":"@esbuild/win32-x64"},Ru={"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"},m0={"android arm LE":"@esbuild/android-arm","android x64 LE":"@esbuild/android-x64","openharmony arm64 LE":"@esbuild/openharmony-arm64"};function W2(){let e,t,r=!1,n=`${process.platform} ${f0.arch()} ${f0.endianness()}`;if(n in Au)e=Au[n],t="esbuild.exe";else if(n in Ru)e=Ru[n],t="bin/esbuild";else if(n in m0)e=m0[n],t="bin/esbuild",r=!0;else throw Error(`Unsupported platform: ${n}`);return{pkg:e,subpath:t,isWASM:r}}function U2(){let e=Ue.resolve("esbuild"),t=Zr.dirname(Zr.dirname(Zr.dirname(e)));if(Zr.basename(t)==="node_modules"){for(let r in Ru)try{let n=Ru[r];if(Xs.existsSync(Zr.join(t,n)))return n}catch{}for(let r in Au)try{let n=Au[r];if(Xs.existsSync(Zr.join(t,n)))return n}catch{}}return null}function H2(e,t){let r=Zr.dirname(Ue.resolve("esbuild"));return Zr.join(r,`downloaded-${e.replace("/","-")}-${Zr.basename(t)}`)}function z2(){if(B2(zo))if(!Xs.existsSync(zo))console.warn(`[esbuild] Ignoring bad configuration: ESBUILD_BINARY_PATH=${zo}`);else return{binPath:zo,isWASM:!1};let{pkg:e,subpath:t,isWASM:r}=W2(),n;try{n=Ue.resolve(`${e}/${t}`)}catch(s){if(n=H2(e,t),!Xs.existsSync(n)){try{Ue.resolve(e)}catch{let i=U2();if(i){let o=`
67
67
  Specifically the "${i}" package is present but this platform
68
68
  needs the "${e}" package instead. People often get into this
69
69
  situation by installing esbuild on Windows or macOS and copying "node_modules"
@@ -80,7 +80,7 @@ If you are installing with yarn, you can try listing both this platform and the
80
80
  other platform in your ".yarnrc.yml" file using the "supportedArchitectures"
81
81
  feature: https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
82
82
  Keep in mind that this means multiple copies of esbuild will be present.
83
- `;if(e===Bx&&i===Wx||e===Wx&&i===Bx)o=`
83
+ `;if(e===p0&&i===d0||e===d0&&i===p0)o=`
84
84
  Specifically the "${i}" package is present but this platform
85
85
  needs the "${e}" package instead. People often get into this
86
86
  situation by installing esbuild with npm running inside of Rosetta 2 and then
@@ -112,48 +112,48 @@ want to do that.
112
112
  If you are installing esbuild with npm, make sure that you don't specify the
113
113
  "--no-optional" or "--omit=optional" flags. The "optionalDependencies" feature
114
114
  of "package.json" is used by esbuild to install the correct binary executable
115
- for your current platform.`)}throw s}}if(/\.zip\//.test(n)){let s;try{s=(()=>{throw new Error("Cannot require module "+"pnpapi");})()}catch(i){}if(s){let i=s.getPackageInformation(s.topLevel).packageLocation,o=Yr.join(i,"node_modules",".cache","esbuild",`pnpapi-${e.replace("/","-")}-0.28.2-${Yr.basename(t)}`);if(!zs.existsSync(o))zs.mkdirSync(Yr.dirname(o),{recursive:!0}),zs.copyFileSync(n,o),zs.chmodSync(o,493);return{binPath:o,isWASM:r}}}return{binPath:n,isWASM:r}}var s0=He("child_process"),f2=He("crypto"),Wp=He("path"),Gi=He("fs"),d2=He("os"),p2=He("tty"),ur;if(process.env.ESBUILD_WORKER_THREADS!=="0"){try{ur=He("worker_threads")}catch{}let[e,t]=process.versions.node.split(".");if(+e<12||+e===12&&+t<17||+e===13&&+t<13)ur=void 0}var Ux,Sl=((Ux=ur==null?void 0:ur.workerData)==null?void 0:Ux.esbuildVersion)==="0.28.2",i0=()=>{if((!Wo||!1)&&(Wp.basename(__filename)!=="main.js"||Wp.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.
115
+ for your current platform.`)}throw s}}if(/\.zip\//.test(n)){let s;try{s=(()=>{throw new Error("Cannot require module "+"pnpapi");})()}catch(i){}if(s){let i=s.getPackageInformation(s.topLevel).packageLocation,o=Zr.join(i,"node_modules",".cache","esbuild",`pnpapi-${e.replace("/","-")}-0.28.2-${Zr.basename(t)}`);if(!Xs.existsSync(o))Xs.mkdirSync(Zr.dirname(o),{recursive:!0}),Xs.copyFileSync(n,o),Xs.chmodSync(o,493);return{binPath:o,isWASM:r}}}return{binPath:n,isWASM:r}}var k0=Ue("child_process"),G2=Ue("crypto"),am=Ue("path"),Xi=Ue("fs"),K2=Ue("os"),X2=Ue("tty"),ur;if(process.env.ESBUILD_WORKER_THREADS!=="0"){try{ur=Ue("worker_threads")}catch{}let[e,t]=process.versions.node.split(".");if(+e<12||+e===12&&+t<17||+e===13&&+t<13)ur=void 0}var h0,Ol=((h0=ur==null?void 0:ur.workerData)==null?void 0:h0.esbuildVersion)==="0.28.2",_0=()=>{if((!zo||!1)&&(am.basename(__filename)!=="main.js"||am.basename(__dirname)!=="lib"))throw Error(`The esbuild JavaScript API cannot be bundled. Please mark the "esbuild" package as external so it's not included in the bundle.
116
116
 
117
- 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}=u2();if(t)return["node",[e]];else return[e,[]]}},wl=()=>p2.isatty(2),m2={readFile(e,t){try{let r=Gi.readFileSync(e,"utf8");try{Gi.unlinkSync(e)}catch{}t(null,r)}catch(r){t(r,null)}},writeFile(e,t){try{let r=o0();Gi.writeFileSync(r,e),t(r)}catch{t(null)}}},h2={readFile(e,t){try{Gi.readFile(e,"utf8",(r,n)=>{try{Gi.unlink(e,()=>t(r,n))}catch{t(r,n)}})}catch(r){t(r,null)}},writeFile(e,t){try{let r=o0();Gi.writeFile(r,e,(n)=>n!==null?t(null):t(r))}catch{t(null)}}},g2="0.28.2",y2=(e)=>Xi().build(e),b2=(e)=>Xi().context(e),x2=(e,t)=>Xi().transform(e,t),$2=(e,t)=>Xi().formatMessages(e,t),w2=(e,t)=>Xi().analyzeMetafile(e,t),v2=(e)=>{if(ur&&!Sl){if(!fr)fr=$u(ur);return fr.buildSync(e)}let t;return xu((r)=>r.buildOrContext({callName:"buildSync",refs:null,options:e,isTTY:wl(),defaultWD:Ki,callback:(n,s)=>{if(n)throw n;t=s}})),t},S2=(e,t)=>{if(ur&&!Sl){if(!fr)fr=$u(ur);return fr.transformSync(e,t)}let r;return xu((n)=>n.transform({callName:"transformSync",refs:null,input:e,options:t||{},isTTY:wl(),fs:m2,callback:(s,i)=>{if(s)throw s;r=i}})),r},E2=(e,t)=>{if(ur&&!Sl){if(!fr)fr=$u(ur);return fr.formatMessagesSync(e,t)}let r;return xu((n)=>n.formatMessages({callName:"formatMessagesSync",refs:null,messages:e,options:t,callback:(s,i)=>{if(s)throw s;r=i}})),r},j2=(e,t)=>{if(ur&&!Sl){if(!fr)fr=$u(ur);return fr.analyzeMetafileSync(e,t)}let r;return xu((n)=>n.analyzeMetafile({callName:"analyzeMetafileSync",refs:null,metafile:typeof e==="string"?e:JSON.stringify(e),options:t,callback:(s,i)=>{if(s)throw s;r=i}})),r},P2=()=>{if(yu)yu();if(fr)fr.stop();return Promise.resolve()},Bp=!1,k2=(e)=>{if(e=ZI(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(Bp)throw Error('Cannot call "initialize" more than once');return Xi(),Bp=!0,Promise.resolve()},Ki=process.cwd(),xl,yu,Xi=()=>{if(xl)return xl;let[e,t]=i0(),r=s0.spawn(e,t.concat("--service=0.28.2","--ping"),{windowsHide:!0,stdio:["pipe","pipe","inherit"],cwd:Ki}),{readFromStdout:n,afterClose:s,service:i}=t0({writeToStdin(u){r.stdin.write(u,(p)=>{if(p)s(p)})},readFileSync:Gi.readFileSync,isSync:!1,hasFS:!0,esbuild:vl});r.stdin.on("error",s),r.on("error",s);let{stdin:o,stdout:a}=r;a.on("data",n),a.on("end",s),yu=()=>{o.destroy(),a.destroy(),r.kill(),Bp=!1,xl=void 0,yu=void 0};let l=0;if(r.unref(),o.unref)o.unref();if(a.unref)a.unref();let c={ref(){if(++l===1)r.ref()},unref(){if(--l===0)r.unref()}};return xl={build:(u)=>new Promise((p,h)=>{i.buildOrContext({callName:"build",refs:c,options:u,isTTY:wl(),defaultWD:Ki,callback:(m,b)=>m?h(m):p(b)})}),context:(u)=>new Promise((p,h)=>i.buildOrContext({callName:"context",refs:c,options:u,isTTY:wl(),defaultWD:Ki,callback:(m,b)=>m?h(m):p(b)})),transform:(u,p)=>new Promise((h,m)=>i.transform({callName:"transform",refs:c,input:u,options:p||{},isTTY:wl(),fs:h2,callback:(b,g)=>b?m(b):h(g)})),formatMessages:(u,p)=>new Promise((h,m)=>i.formatMessages({callName:"formatMessages",refs:c,messages:u,options:p,callback:(b,g)=>b?m(b):h(g)})),analyzeMetafile:(u,p)=>new Promise((h,m)=>i.analyzeMetafile({callName:"analyzeMetafile",refs:c,metafile:typeof u==="string"?u:JSON.stringify(u),options:p,callback:(b,g)=>b?m(b):h(g)}))},xl},xu=(e)=>{let[t,r]=i0(),n=new Uint8Array,{readFromStdout:s,afterClose:i,service:o}=t0({writeToStdin(l){if(n.length!==0)throw Error("Must run at most one command");n=l},isSync:!0,hasFS:!0,esbuild:vl});e(o);let a=s0.execFileSync(t,r.concat("--service=0.28.2"),{cwd:Ki,windowsHide:!0,input:n,maxBuffer:+process.env.ESBUILD_MAX_BUFFER||16777216});s(a),i(null)},o0=()=>Wp.join(d2.tmpdir(),`esbuild-${f2.randomBytes(32).toString("hex")}`),fr=null,$u=(e)=>{let{port1:t,port2:r}=new e.MessageChannel,n=new e.Worker(__filename,{workerData:{workerPort:r,defaultWD:Ki,esbuildVersion:"0.28.2"},transferList:[r],execArgv:[]}),s=0,i=(c)=>{let u=Error(`Build failed with 1 error:
118
- error: ${c}`),p=[{id:"",pluginName:"",text:c,location:null,notes:[],detail:void 0}];return u.errors=p,u.warnings=[],u},o=(c)=>{if(!c)return;let u=c.plugins;if(u&&u.length>0)throw i("Cannot use plugins in synchronous API calls")},a=(c,u)=>{for(let p in u)c[p]=u[p]},l=(c,u)=>{let p=s++,h=new SharedArrayBuffer(8),m=new Int32Array(h),b={sharedBuffer:h,id:p,command:c,args:u};n.postMessage(b);let g=Atomics.wait(m,0,0);if(g!=="ok"&&g!=="not-equal")throw Error("Internal error: Atomics.wait() failed: "+g);let{message:{id:y,resolve:w,reject:j,properties:S}}=e.receiveMessageOnPort(t);if(p!==y)throw Error(`Internal error: Expected id ${p} but got id ${y}`);if(j)throw a(j,S),j;return w};return n.unref(),{buildSync(c){return o(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(){n.terminate(),fr=null}}},_2=()=>{let e=ur.workerData.workerPort,t=ur.parentPort,r=(n)=>{let s={};if(n&&typeof n==="object")for(let i in n)s[i]=n[i];return s};try{let n=Xi();Ki=ur.workerData.defaultWD,t.on("message",(s)=>{(async()=>{let{sharedBuffer:i,id:o,command:a,args:l}=s,c=new Int32Array(i);try{switch(a){case"build":e.postMessage({id:o,resolve:await n.build(l[0])});break;case"transform":e.postMessage({id:o,resolve:await n.transform(l[0],l[1])});break;case"formatMessages":e.postMessage({id:o,resolve:await n.formatMessages(l[0],l[1])});break;case"analyzeMetafile":e.postMessage({id:o,resolve:await n.analyzeMetafile(l[0],l[1])});break;default:throw Error(`Invalid command: ${a}`)}}catch(u){e.postMessage({id:o,reject:u,properties:r(u)})}Atomics.add(c,0,1),Atomics.notify(c,0,1/0)})()})}catch(n){t.on("message",(s)=>{let{sharedBuffer:i,id:o}=s,a=new Int32Array(i);e.postMessage({id:o,reject:n,properties:r(n)}),Atomics.add(a,0,1),Atomics.notify(a,0,1/0)})}};if(Sl)_2();var A2=vl});import{createRequire as R2}from"node:module";import{join as O2}from"node:path";function Up(e,t){return R2(O2(t,"package.json")).resolve(e)}function C2(e){return e==="node"||e==="bun"?"node":"browser"}async function zp(e){let t=await Promise.resolve().then(() => br(wu(),1)),{entry:r}=e,n={bundle:!0,external:e.external,format:"esm",logLevel:"silent",minify:e.minify,platform:C2(e.target),plugins:e.plugins,write:!1};if(e.conditions)n.conditions=e.conditions;if(e.define)n.define=e.define;if("path"in r)n.entryPoints=[r.path];else n.stdin={contents:r.source,loader:"js",resolveDir:r.resolveDir,sourcefile:"jx-entry.js"};return(await t.build({...n,write:!1})).outputFiles[0].text}var l0=()=>{};var c0=".jx-entry-";import{rmSync as T2,writeFileSync as u0}from"node:fs";import{tmpdir as I2}from"node:os";import{basename as J2,join as M2,resolve as D2}from"node:path";function d0(e){return Bi(e)||e.startsWith("./")||e.startsWith("../")}function Gp(e,t,r){if(Bi(e))return Up(e.slice(au.length),r);return D2(t,e)}function p0(e,t){return Up(e,t)}function L2(e){let{onFileLoaded:t,resolver:r}=e;if(r===void 0&&t===void 0)return[];return[{name:"jx-bundle-hooks",setup:(s)=>{if(r!==void 0)s.onResolve({filter:r.filter},(i)=>r.resolve(i));if(t!==void 0)s.onLoad({filter:/.*/},(i)=>{t(i.path)})}}]}function F2(e){if(e==="cloudflare-workers"||e==="cloudflare-pages")return{conditions:["workerd","worker"],external:["cloudflare:*","node:*"],target:"workerd"};return{target:e==="bun"?"bun":"node"}}function V2(e){return e.minify??e.target==="browser"}function W2(e){let t={};if(e.conditions)t.conditions=e.conditions;if(e.target==="browser")t.define={...q2};return t}function m0(e){return{...W2(e),external:e.external??[],minify:V2(e),plugins:L2(e),target:e.target}}async function h0(e,t){let r=await zp({entry:{path:e.entryPath},...m0(t)});u0(e.outfile,r,"utf8")}function Kp(e){return e==="<stdin>"||J2(e).startsWith(c0)}async function g0(e,t,r){let n=[],s=M2(I2(),`jx-resolve-${process.pid}.js`);try{await Zi(`export * from ${JSON.stringify(e)};
119
- `,{outfile:s,resolveDir:t},{...r,minify:!1,onFileLoaded:(i)=>n.push(i)})}catch{return}finally{T2(s,{force:!0})}return n.find((i)=>!Kp(i))}async function Zi(e,{resolveDir:t,outfile:r},n){let s=await zp({entry:{resolveDir:t,source:e},...m0(n)});u0(r,s,"utf8")}async function y0(e,{projectRoot:t,outfile:r,adapter:n}){await Zi(e,{outfile:r,resolveDir:t},F2(n))}var f0,q2;var Yp=D(()=>{Vr();l0();f0=["@vue/reactivity","lit-html"];q2={"process.env.NODE_ENV":'"production"'}});function B2(e,t){let r=e.slice(0,t),n=r.split(`
117
+ 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}=z2();if(t)return["node",[e]];else return[e,[]]}},Al=()=>X2.isatty(2),Y2={readFile(e,t){try{let r=Xi.readFileSync(e,"utf8");try{Xi.unlinkSync(e)}catch{}t(null,r)}catch(r){t(r,null)}},writeFile(e,t){try{let r=A0();Xi.writeFileSync(r,e),t(r)}catch{t(null)}}},Z2={readFile(e,t){try{Xi.readFile(e,"utf8",(r,n)=>{try{Xi.unlink(e,()=>t(r,n))}catch{t(r,n)}})}catch(r){t(r,null)}},writeFile(e,t){try{let r=A0();Xi.writeFile(r,e,(n)=>n!==null?t(null):t(r))}catch{t(null)}}},Q2="0.28.2",eJ=(e)=>Qi().build(e),tJ=(e)=>Qi().context(e),rJ=(e,t)=>Qi().transform(e,t),nJ=(e,t)=>Qi().formatMessages(e,t),sJ=(e,t)=>Qi().analyzeMetafile(e,t),iJ=(e)=>{if(ur&&!Ol){if(!fr)fr=Tu(ur);return fr.buildSync(e)}let t;return Cu((r)=>r.buildOrContext({callName:"buildSync",refs:null,options:e,isTTY:Al(),defaultWD:Yi,callback:(n,s)=>{if(n)throw n;t=s}})),t},oJ=(e,t)=>{if(ur&&!Ol){if(!fr)fr=Tu(ur);return fr.transformSync(e,t)}let r;return Cu((n)=>n.transform({callName:"transformSync",refs:null,input:e,options:t||{},isTTY:Al(),fs:Y2,callback:(s,i)=>{if(s)throw s;r=i}})),r},aJ=(e,t)=>{if(ur&&!Ol){if(!fr)fr=Tu(ur);return fr.formatMessagesSync(e,t)}let r;return Cu((n)=>n.formatMessages({callName:"formatMessagesSync",refs:null,messages:e,options:t,callback:(s,i)=>{if(s)throw s;r=i}})),r},lJ=(e,t)=>{if(ur&&!Ol){if(!fr)fr=Tu(ur);return fr.analyzeMetafileSync(e,t)}let r;return Cu((n)=>n.analyzeMetafile({callName:"analyzeMetafileSync",refs:null,metafile:typeof e==="string"?e:JSON.stringify(e),options:t,callback:(s,i)=>{if(s)throw s;r=i}})),r},cJ=()=>{if(Ou)Ou();if(fr)fr.stop();return Promise.resolve()},lm=!1,uJ=(e)=>{if(e=I2(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(lm)throw Error('Cannot call "initialize" more than once');return Qi(),lm=!0,Promise.resolve()},Yi=process.cwd(),kl,Ou,Qi=()=>{if(kl)return kl;let[e,t]=_0(),r=k0.spawn(e,t.concat("--service=0.28.2","--ping"),{windowsHide:!0,stdio:["pipe","pipe","inherit"],cwd:Yi}),{readFromStdout:n,afterClose:s,service:i}=E0({writeToStdin(u){r.stdin.write(u,(p)=>{if(p)s(p)})},readFileSync:Xi.readFileSync,isSync:!1,hasFS:!0,esbuild:Rl});r.stdin.on("error",s),r.on("error",s);let{stdin:o,stdout:a}=r;a.on("data",n),a.on("end",s),Ou=()=>{o.destroy(),a.destroy(),r.kill(),lm=!1,kl=void 0,Ou=void 0};let l=0;if(r.unref(),o.unref)o.unref();if(a.unref)a.unref();let c={ref(){if(++l===1)r.ref()},unref(){if(--l===0)r.unref()}};return kl={build:(u)=>new Promise((p,h)=>{i.buildOrContext({callName:"build",refs:c,options:u,isTTY:Al(),defaultWD:Yi,callback:(m,y)=>m?h(m):p(y)})}),context:(u)=>new Promise((p,h)=>i.buildOrContext({callName:"context",refs:c,options:u,isTTY:Al(),defaultWD:Yi,callback:(m,y)=>m?h(m):p(y)})),transform:(u,p)=>new Promise((h,m)=>i.transform({callName:"transform",refs:c,input:u,options:p||{},isTTY:Al(),fs:Z2,callback:(y,g)=>y?m(y):h(g)})),formatMessages:(u,p)=>new Promise((h,m)=>i.formatMessages({callName:"formatMessages",refs:c,messages:u,options:p,callback:(y,g)=>y?m(y):h(g)})),analyzeMetafile:(u,p)=>new Promise((h,m)=>i.analyzeMetafile({callName:"analyzeMetafile",refs:c,metafile:typeof u==="string"?u:JSON.stringify(u),options:p,callback:(y,g)=>y?m(y):h(g)}))},kl},Cu=(e)=>{let[t,r]=_0(),n=new Uint8Array,{readFromStdout:s,afterClose:i,service:o}=E0({writeToStdin(l){if(n.length!==0)throw Error("Must run at most one command");n=l},isSync:!0,hasFS:!0,esbuild:Rl});e(o);let a=k0.execFileSync(t,r.concat("--service=0.28.2"),{cwd:Yi,windowsHide:!0,input:n,maxBuffer:+process.env.ESBUILD_MAX_BUFFER||16777216});s(a),i(null)},A0=()=>am.join(K2.tmpdir(),`esbuild-${G2.randomBytes(32).toString("hex")}`),fr=null,Tu=(e)=>{let{port1:t,port2:r}=new e.MessageChannel,n=new e.Worker(__filename,{workerData:{workerPort:r,defaultWD:Yi,esbuildVersion:"0.28.2"},transferList:[r],execArgv:[]}),s=0,i=(c)=>{let u=Error(`Build failed with 1 error:
118
+ error: ${c}`),p=[{id:"",pluginName:"",text:c,location:null,notes:[],detail:void 0}];return u.errors=p,u.warnings=[],u},o=(c)=>{if(!c)return;let u=c.plugins;if(u&&u.length>0)throw i("Cannot use plugins in synchronous API calls")},a=(c,u)=>{for(let p in u)c[p]=u[p]},l=(c,u)=>{let p=s++,h=new SharedArrayBuffer(8),m=new Int32Array(h),y={sharedBuffer:h,id:p,command:c,args:u};n.postMessage(y);let g=Atomics.wait(m,0,0);if(g!=="ok"&&g!=="not-equal")throw Error("Internal error: Atomics.wait() failed: "+g);let{message:{id:b,resolve:w,reject:j,properties:S}}=e.receiveMessageOnPort(t);if(p!==b)throw Error(`Internal error: Expected id ${p} but got id ${b}`);if(j)throw a(j,S),j;return w};return n.unref(),{buildSync(c){return o(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(){n.terminate(),fr=null}}},fJ=()=>{let e=ur.workerData.workerPort,t=ur.parentPort,r=(n)=>{let s={};if(n&&typeof n==="object")for(let i in n)s[i]=n[i];return s};try{let n=Qi();Yi=ur.workerData.defaultWD,t.on("message",(s)=>{(async()=>{let{sharedBuffer:i,id:o,command:a,args:l}=s,c=new Int32Array(i);try{switch(a){case"build":e.postMessage({id:o,resolve:await n.build(l[0])});break;case"transform":e.postMessage({id:o,resolve:await n.transform(l[0],l[1])});break;case"formatMessages":e.postMessage({id:o,resolve:await n.formatMessages(l[0],l[1])});break;case"analyzeMetafile":e.postMessage({id:o,resolve:await n.analyzeMetafile(l[0],l[1])});break;default:throw Error(`Invalid command: ${a}`)}}catch(u){e.postMessage({id:o,reject:u,properties:r(u)})}Atomics.add(c,0,1),Atomics.notify(c,0,1/0)})()})}catch(n){t.on("message",(s)=>{let{sharedBuffer:i,id:o}=s,a=new Int32Array(i);e.postMessage({id:o,reject:n,properties:r(n)}),Atomics.add(a,0,1),Atomics.notify(a,0,1/0)})}};if(Ol)fJ();var dJ=Rl});import{createRequire as pJ}from"node:module";import{join as mJ}from"node:path";function um(e,t){return pJ(mJ(t,"package.json")).resolve(e)}function hJ(e){return e==="node"||e==="bun"?"node":"browser"}async function fm(e){let t=await Promise.resolve().then(() => xr(Iu(),1)),{entry:r}=e,n={bundle:!0,external:e.external,format:"esm",logLevel:"silent",minify:e.minify,platform:hJ(e.target),plugins:e.plugins,write:!1};if(e.conditions)n.conditions=e.conditions;if(e.define)n.define=e.define;if("path"in r)n.entryPoints=[r.path];else n.stdin={contents:r.source,loader:"js",resolveDir:r.resolveDir,sourcefile:"jx-entry.js"};return(await t.build({...n,write:!1})).outputFiles[0].text}var O0=()=>{};var N0=".jx-entry-";import{rmSync as yJ,writeFileSync as C0}from"node:fs";import{tmpdir as bJ}from"node:os";import{basename as xJ,join as $J,resolve as wJ}from"node:path";function I0(e){return Hi(e)||e.startsWith("./")||e.startsWith("../")}function dm(e,t,r){if(Hi(e))return um(e.slice(wu.length),r);return wJ(t,e)}function J0(e,t){return um(e,t)}function vJ(e){let{onFileLoaded:t,resolver:r}=e;if(r===void 0&&t===void 0)return[];return[{name:"jx-bundle-hooks",setup:(s)=>{if(r!==void 0)s.onResolve({filter:r.filter},(i)=>r.resolve(i));if(t!==void 0)s.onLoad({filter:/.*/},(i)=>{t(i.path)})}}]}function SJ(e){if(e==="cloudflare-workers"||e==="cloudflare-pages")return{conditions:["workerd","worker"],external:["cloudflare:*","node:*"],target:"workerd"};return{target:e==="bun"?"bun":"node"}}function PJ(e){return e.minify??e.target==="browser"}function jJ(e){let t={};if(e.conditions)t.conditions=e.conditions;if(e.target==="browser")t.define={...EJ};return t}function M0(e){return{...jJ(e),external:e.external??[],minify:PJ(e),plugins:vJ(e),target:e.target}}async function D0(e,t){let r=await fm({entry:{path:e.entryPath},...M0(t)});C0(e.outfile,r,"utf8")}function pm(e){return e==="<stdin>"||xJ(e).startsWith(N0)}async function L0(e,t,r){let n=[],s=$J(bJ(),`jx-resolve-${process.pid}.js`);try{await eo(`export * from ${JSON.stringify(e)};
119
+ `,{outfile:s,resolveDir:t},{...r,minify:!1,onFileLoaded:(i)=>n.push(i)})}catch{return}finally{yJ(s,{force:!0})}return n.find((i)=>!pm(i))}async function eo(e,{resolveDir:t,outfile:r},n){let s=await fm({entry:{resolveDir:t,source:e},...M0(n)});C0(r,s,"utf8")}async function F0(e,{projectRoot:t,outfile:r,adapter:n}){await eo(e,{outfile:r,resolveDir:t},SJ(n))}var T0,EJ;var mm=M(()=>{Vr();O0();T0=["@vue/reactivity","lit-html"];EJ={"process.env.NODE_ENV":'"production"'}});function kJ(e,t){let r=e.slice(0,t),n=r.split(`
120
120
  `).length;return{column:t-r.lastIndexOf(`
121
- `),line:n}}function Xp(e,t,r,n){return{...B2(e,t),kind:r,message:n,offset:t}}function H2(e,t){let r=t;while(r<e.length&&/\s/u.test(e.charAt(r)))r+=1;return r}function $0(e){for(let t of[e,`return async function () {
121
+ `),line:n}}function hm(e,t,r,n){return{...kJ(e,t),kind:r,message:n,offset:t}}function _J(e,t){let r=t;while(r<e.length&&/\s/u.test(e.charAt(r)))r+=1;return r}function B0(e){for(let t of[e,`return async function () {
122
122
  ${e}
123
- }`])try{return Reflect.construct(Function,[t])!==null}catch{}return!1}function w0(e){Qp=e,vu=null}function z2(e,t){if(!vu){if(!Qp)throw Error("@jxsuite/erase was imported without an entry that loads its stripper");vu=Qp()}return vu(e,t)}function G2(e){return Ci(e).includes("<")||!$0(e)}function K2(e){let t=Zp.get(e);if(t)return t;if(!G2(e)){let o={code:e,problems:[]};return Zp.set(e,o),o}let r=[],n=z2(e,(o)=>{let a=H2(e,o.pos),[l="this"]=/^[\w$]+/u.exec(e.slice(a))??[];r.push(Xp(e,a,"unsupported",`\`${l}\` is TypeScript that has to be compiled rather than erased. A function body may use only types that can be removed: no enum, value namespace or parameter property`))}),s=Ci(n);for(let o of s.matchAll(U2)){let a=o.index+(o[1]?.length??0)+(o[2]?.length??0);r.push(Xp(e,a,"unsupported",`A function body cannot ${o[3]??"import"}. Move code that needs a module into one of its own, named by $src`))}if(n!==e&&r.length===0&&$0(e)){let o=[...e].findIndex((a,l)=>a!==n[l]);r.push(Xp(e,Math.max(o,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 i={code:n,problems:r};return Zp.set(e,i),i}function Y2(e){return String(e).replaceAll("~","~0").replaceAll("/","~1")}function b0(e,t,r){if(O(e))return x0(e,t,r);if(Array.isArray(e)&&e.length>0&&e.every((n)=>O(n)))return x0(e.join(`
123
+ }`])try{return Reflect.construct(Function,[t])!==null}catch{}return!1}function W0(e){ym=e,Ju=null}function RJ(e,t){if(!Ju){if(!ym)throw Error("@jxsuite/erase was imported without an entry that loads its stripper");Ju=ym()}return Ju(e,t)}function OJ(e){return Ti(e).includes("<")||!B0(e)}function NJ(e){let t=gm.get(e);if(t)return t;if(!OJ(e)){let o={code:e,problems:[]};return gm.set(e,o),o}let r=[],n=RJ(e,(o)=>{let a=_J(e,o.pos),[l="this"]=/^[\w$]+/u.exec(e.slice(a))??[];r.push(hm(e,a,"unsupported",`\`${l}\` is TypeScript that has to be compiled rather than erased. A function body may use only types that can be removed: no enum, value namespace or parameter property`))}),s=Ti(n);for(let o of s.matchAll(AJ)){let a=o.index+(o[1]?.length??0)+(o[2]?.length??0);r.push(hm(e,a,"unsupported",`A function body cannot ${o[3]??"import"}. Move code that needs a module into one of its own, named by $src`))}if(n!==e&&r.length===0&&B0(e)){let o=[...e].findIndex((a,l)=>a!==n[l]);r.push(hm(e,Math.max(o,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 i={code:n,problems:r};return gm.set(e,i),i}function CJ(e){return String(e).replaceAll("~","~0").replaceAll("/","~1")}function q0(e,t,r){if(A(e))return V0(e,t,r);if(Array.isArray(e)&&e.length>0&&e.every((n)=>A(n)))return V0(e.join(`
124
124
  `),t,r).split(`
125
- `);return e}function x0(e,t,r){let{code:n,problems:s}=K2(e),[i,...o]=s.filter((a)=>a.kind==="unsupported");if(i)throw new v0(t,[i,...o]);for(let a of s)r.push({...t,problem:a});return n}function em(e,t,r){if(Array.isArray(e))return e.map((o,a)=>em(o,{...t,pointer:`${t.pointer}/${a}`},r));if(!W(e))return e;let n=e.$prototype==="Function",s=[],i={set:(o,a)=>{s.push([o,a])}};for(let[o,a]of Object.entries(e)){let l={...t,pointer:`${t.pointer}/${Y2(o)}`};if(n&&o==="body")i.set(o,b0(a,l,r));else if(n&&(o==="getter"||o==="setter")&&W(a)){let c={...a};if(a.body!==void 0)c.body=b0(a.body,{...l,pointer:`${l.pointer}/body`},r);i.set(o,c)}else i.set(o,em(a,l,r))}return Object.fromEntries(s)}function El(e,t,r=[]){return em(e,{path:t,pointer:""},r)}function S0(e,t,r=[]){return El(e,t,r)}var U2,Zp,vu=null,Qp=null,v0;var tm=D(()=>{ye();U2=/(^|[\n;{}])(\s*)(import|export)(?=[\s{*"'])/gu;Zp=new Map;v0=class v0 extends Error{problems;site;constructor(e,t){let[r]=t;super(`${e.path}${e.pointer}: ${r.message} (line ${r.line}, column ${r.column})`);this.name="EraseError",this.problems=t,this.site=e}}});import{createRequire as X2}from"node:module";var rm=D(()=>{tm();tm();w0(()=>X2(import.meta.url)("ts-blank-space").default)});function j0(e){for(let{path:t,pointer:r,problem:n}of e){let s=`${t}${r} (line ${n.line}, column ${n.column}): ${n.message}`;if(!E0.has(s))E0.add(s),console.warn(`Warning: ${s}`)}}function _n(e,t){let r=[],n=El(e,t,r);return j0(r),n}function P0(e,t){let r=[],n=S0(e,t,r);return j0(r),n}var E0;var Uo=D(()=>{rm();E0=new Set});function Q2(e){return e.split("\\").join("/").replace(/^\.\//,"").replace(/^\//,"").replace(/^pages\//,"")}function k0(e){let t=Q2(e),r=t.slice(t.lastIndexOf("/")+1),n=r.lastIndexOf(".");if(n>0)t=t.slice(0,t.length-(r.length-n));if(t.endsWith("/index"))t=t.slice(0,-6)||"/";else if(t==="index")t="/";if(!t.startsWith("/"))t=`/${t}`;let s=[],i=!1,o=!1,a=t.replaceAll(Z2,(l,c,u)=>{if(i=!0,c)return o=!0,s.push(c),"*";return s.push(u),`:${u}`});return{isCatchAll:o,isDynamic:i,params:s,urlPattern:a}}function _0(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 Z2;var A0=D(()=>{Z2=/\[\.\.\.(\w+)\]|\[(\w+)\]/g});function tJ(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function R0(e){if(!W(e)||!("paginate"in e))return null;let{each:t,pageSize:r,paginate:n}=e,s=W(n)?n.$ref:void 0,i=O(s)?eJ.exec(s)?.[1]:void 0;if(i===void 0)throw TypeError('$paths.paginate must be { "$ref": "#/state/<key>" }');if(!Nt(r)||!Number.isInteger(r)||r<1)throw TypeError("$paths.pageSize must be a positive integer");let o={key:tJ(i),pageSize:r};if(t!==void 0){if(!W(t)&&!Array.isArray(t))throw TypeError("$paths.each must be a $paths source");if(W(t)&&"paginate"in t)throw TypeError("$paths.each cannot itself be paged");o.each=t}return o}function nm(e,t){return Math.max(1,Math.ceil(e/t))}function O0(e,t,r){let n=(t-1)*r;return e.slice(n,n+r)}function Qi(e,t){if(e.endsWith("*")){if(t===1){let r=e.slice(0,-1).replace(/\/$/,"");return r===""?"/":r}return`${e.slice(0,-1)}${t}`}return e.replace(/:[^/]+/,String(t))}function C0(e,t,r,n){let s=nm(n,r),i=[];for(let o=1;o<=s;o++)i.push({current:o===t,number:o,url:Qi(e,o)});return{first:Qi(e,1),itemCount:n,last:Qi(e,s),next:t<s?Qi(e,t+1):null,number:t,pageCount:s,pageSize:r,pages:i,prev:t>1?Qi(e,t-1):null}}var eJ;var N0=D(()=>{ye();eJ=/^#\/state\/([^/]+)$/});function Xr(e){if(!O(e)||e.trim()==="")return null;try{return new Intl.Locale(e.trim()).toString()}catch{return null}}function jl(e){let t=Xr(e);if(t===null)return"ltr";let r=new Intl.Locale(t),n=r.script??r.maximize().script;return n!==void 0&&rJ.has(n)?"rtl":"ltr"}function T0(e){let t=Xr(e);if(t===null)return O(e)?e:"";return new Intl.DisplayNames([t],{type:"language"}).of(t)??t}function sm(e){let t=e.i18n,r=[];if(!V(t))return{errors:r,i18n:null};let n=Array.isArray(t.locales)?t.locales:[],s=[];for(let a of n){let l=Xr(a);if(l===null){r.push(`i18n.locales: "${String(a)}" is not a well-formed BCP 47 language tag.`);continue}if(!s.includes(l))s.push(l)}let i=Xr(t.defaultLocale)??s[0]??null;if(t.defaultLocale!==void 0&&Xr(t.defaultLocale)===null)r.push(`i18n.defaultLocale: "${String(t.defaultLocale)}" is not a well-formed BCP 47 language tag.`);if(i===null)return r.push("i18n is declared with no usable locale — set `defaultLocale` or `locales`."),{errors:r,i18n:null};if(!s.includes(i))s.unshift(i);let o=t.routing==="prefix-always"||t.routing==="prefix-except-default"?t.routing:nJ;return{errors:r,i18n:{defaultLocale:i,locales:s,routing:o}}}function gn(e,t){if(t===null)return null;let r=e.split("/").find(Boolean);if(r===void 0)return t.defaultLocale;let n=Xr(r);return n!==null&&t.locales.includes(n)?n:t.defaultLocale}var rJ,Su="^[A-Za-z]{2,8}(-[A-Za-z0-9]{1,8})*$",nJ="prefix-except-default";var eo=D(()=>{ye();rJ=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 jr(e){return e.replaceAll(/[A-Z]/g,(t)=>`-${t.toLowerCase()}`)}function I0(e,t){if(e.startsWith("@--"))return t[e.slice(1)]??e.slice(1);if(e.startsWith("@(")){let r=e.slice(2,-1).trim();return sJ.has(r.toLowerCase())?r:e.slice(1)}return null}function Pl(e){return e.startsWith("@position-try")||e.startsWith("@property")||e.startsWith("@font-face")||e.startsWith("@counter-style")}function _l(e){return e.startsWith("@keyframes")}function J0(e,t){let r=[];for(let n of kl(e))for(let s of kl(t))r.push(iJ(n,s));return r.join(", ")}function iJ(e,t){let r=ju(t,e);if(r!==null)return r;if(t.startsWith("[")||t.startsWith(":")||t.startsWith("."))return`${e}${t}`;return`${e} ${t}`}function im(e){let t=[],r=null,n=0;for(let s=0;s<e.length;s+=1){let i=e[s];if(r){if(i==="\\")s+=1;else if(i===r)r=null;continue}if(i==="\\")s+=1;else if(i==='"'||i==="'")r=i;else if(i==="[")n+=1;else if(i==="]")n=Math.max(0,n-1);else if(i==="&"&&n===0)t.push(s)}return t}function ju(e,t){return im(e).length>0?oJ(e,t):null}function oJ(e,t){let r="",n=0;for(let s of im(e))r+=e.slice(n,s)+t,n=s+1;return r+e.slice(n)}function kl(e){let t=[],r=0,n=null,s=0;for(let o=0;o<e.length;o+=1){let a=e[o];if(n){if(a==="\\")o+=1;else if(a===n)n=null;continue}if(a==='"'||a==="'")n=a;else if(a==="("||a==="[")r+=1;else if(a===")"||a==="]")r=Math.max(0,r-1);else if(a===","&&r===0)t.push(e.slice(s,o)),s=o+1}t.push(e.slice(s));let i=t.flatMap((o)=>{let a=o.trim();return a===""?[]:[a]});return i.length>0?i:[e]}function bn(e){let t=/^\(\s*prefers-color-scheme\s*:\s*(light|dark)\s*\)$/.exec(e.trim())?.[1];return t==="light"||t==="dark"?t:null}function om(e,t){if(e===":root"||e==="html")return{auto:`${e}:where(:not([${yn}]))`,forced:`${e}:where([${yn}="${t}"])`};return{auto:`:where(:root:not([${yn}])) ${e}`,forced:`:where(:root[${yn}="${t}"]) ${e}`}}function Gs(e){return e.startsWith(":")||e.startsWith(".")||e.startsWith("&")||e.startsWith("[")}function am(e){return e.startsWith("--")?e:jr(e)}function Eu(e){let t=2166136261;for(let r=0;r<e.length;r+=1)t^=e.charCodeAt(r),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function M0(e,t,r){let n=r.map(([i,o])=>`${i}: ${o}`).join("; "),s=t===null?n:`${t} { ${n} }`;for(let i=e.length-1;i>=0;i-=1)s=`${e[i]} { ${s} }`;return s}function aJ(e,t,r){let n=r.map(({selector:i,declarations:o})=>`${i} { ${o.map(([a,l])=>`${a}: ${l}`).join("; ")} }`).join(" "),s=`@keyframes ${t} { ${n} }`;for(let i=e.length-1;i>=0;i-=1)s=`${e[i]} { ${s} }`;return s}function lJ(e){let t=Object.keys(e).filter((n)=>_l(n));if(t.length===0)return e;let r={...e};for(let n of t)delete r[n];return r}function cJ(e){let r=im(e).at(-1),n=r===void 0?e:e.slice(r+1);return n===""||n.startsWith(":")||n.startsWith(".")||n.startsWith("[")}function zo(e,t={}){let{scope:r=null,mediaQueries:n={},transposeValue:s=(y)=>y,transposeSelector:i=(y)=>y,resolveValue:o}=t,a=[],l=(y)=>y!==null&&typeof y==="object"&&!Array.isArray(y)&&!Be(y),c=(y,w)=>{if(l(w))return[w];if(!Pl(y)||!Array.isArray(w)||w.length===0)return[];return w.every((j)=>l(j))?w:[]},u=(y,w,j,S)=>{if(w===void 0||w===null)return null;if(Be(w))return j?o?.(y,w,S)??null:null;if(V(w))return null;let E=String(w);if(be(E))return j?o?.(y,E,S)??null:null;return s(E)},p=(y,w,j=!0,S="self")=>{let E=[];for(let[P,A]of Object.entries(y)){if(c(P,A).length>0)continue;if(w&&(P.startsWith("@")||Gs(P)))continue;if(P.startsWith("$"))continue;let R=u(P,A,j,S);if(R!==null)E.push([am(P),R])}return E},h=(y,w,j,S,E)=>{if(j.length===0)return;let P=w;if(P!==null){let _=i(P);if(_===null)return;P=_}let A=M0(y,P,j),R={text:A,conditions:[...y],selector:P,declarations:j,target:S,key:Eu(A)};if(O(E)&&E!=="")R.description=E;a.push(R)},m=(y,w,j)=>{let S=y.slice(10).trim();if(S==="")return;let E=[];for(let[A,R]of Object.entries(w)){if(!l(R))continue;let _=p(R,!0,!1,"unscoped");if(_.length>0)E.push({declarations:_,selector:A.trim()})}if(E.length===0)return;let P=aJ(j,S,E);a.push({blocks:E,conditions:[...j],declarations:[],key:Eu(P),selector:null,target:"unscoped",text:P})},b=(y,w,j,S,E)=>{if(y==="@--")return;if(Pl(y)){h([...S,y],null,p(w,!1,!0,"unscoped"),"unscoped",w.$description);return}if(_l(y)){m(y,w,S);return}let P=I0(y,n),A=P===null?y:`@media ${P}`,R=P===null?null:bn(P);if(R!==null&&j!==null){let{auto:_,forced:I}=om(j,R);g(w,_,[...S,A],E),g(lJ(w),I,S,E);return}g(w,j,[...S,A],E)};function g(y,w,j,S){h(j,w,p(y,!0,!0,S),S,y.$description);for(let[E,P]of Object.entries(y))for(let A of c(E,P))if(E.startsWith("@"))b(E,A,w,j,S);else if(w!==null)g(A,J0(w,E),j,cJ(E)?S:"descendant")}return g(e,r,[],"self"),a}var sJ,yn="data-color-scheme",Pu="jx-color-scheme";var Al=D(()=>{ye();sJ=new Set(["all","print","screen","speech"])});function F0(){return`the Intl helpers ${cm.join(", ")}`}var An="en-US",lm="UTC",D0,cm,L0;var um=D(()=>{D0=[{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."}],cm=D0.map((e)=>e.path),L0=Object.fromEntries(D0.map((e)=>[e.path,e.params.indexOf("locale")]))});function uJ(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function Lt(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function vs(e){if(e==="")return[];return e.split("/").map((t)=>uJ(t))}function Ut(e,t){let r=e;for(let n of vs(t))r=r?.[n];return r}function Me(e,t){let r=e;for(let n of vs(t))r+=fm.test(n)?`.${n}`:`[${JSON.stringify(n)}]`;return r}function q0(e,t){let r=e;for(let[n,s]of vs(t).entries()){let i=n===0?"":"?.";r+=fm.test(s)?`${n===0?".":i}${s}`:`${i}[${JSON.stringify(s)}]`}return r}function Ss(e){return fm.test(e)?e:JSON.stringify(e)}function V0(e){let t=e.replaceAll(/[^A-Za-z0-9_$]/g,"_");if(t==="")return"ref";return/^\d/.test(t)?`_${t}`:t}var fm;var Go=D(()=>{fm=/^[A-Za-z_$][A-Za-z0-9_$]*$/});function dm(e){let t=e.$map;return V(t)?t:void 0}function U0(e){return V(e)&&!Array.isArray(e)&&"operator"in e}function Rl(e){return V(e)&&!Array.isArray(e)&&"$ref"in e}function mJ(e,t,r){let n=L0[e];if(n===void 0||n<0||t[n]!=null)return t;let s=Ut(r.$page,"locale");if(!O(s)||s==="")return t;let i=[...t];return i[n]=s,i}function Y0(e){return e.startsWith("window#/")&&dJ.has(e.slice(8))}function Es(e){return z0.has(e)}function lt(e,t){if(!e)return;let r=(e.depth??0)+1;if(r>hJ)return;return{depth:r,path:[...e.path??[],...Array.isArray(t)?t:[t]],report:e.report}}function nt(e,t,r,n,s){if(e===null||e===void 0)return e;if(U0(e))return Br(e,t,r,n,s);if(Rl(e)){let i=ku(e.$ref,t,r,n);return s?.report(s.path??[],i),i}if(Array.isArray(e))return X0(e,t,r,n,s);return s?.report(s.path??[],e),e}function X0(e,t,r,n,s){return e.map((i,o)=>nt(i,t,r,n,lt(s,o)))}function gJ(e,t,r,n){let s=(i)=>{if(!e.slice(i.length).includes("/"))return t;return ku(e.slice(0,e.lastIndexOf("/")),t,r,n)};if(e.startsWith("#/state/"))return s("#/state/");if(e.startsWith("parent#/"))return s("parent#/");if(e.startsWith("$map/")||e.startsWith("$args/"))return e.split("/").length>2?ku(e.slice(0,e.lastIndexOf("/")),t,r,n):void 0;return}function ku(e,t,r,n){if(e==="$reduce/acc")return n?.acc;if(e.startsWith("$reduce/"))return n?.acc;if(e.startsWith("$args/")){let s=e.slice(6).split("/"),i=n?.args?.[s[0]];return s.length>1?Ut(i,s.slice(1).join("/")):i}if(e.startsWith("event#/")){let s=e.slice(7);return Ut(r,s)}if(e.startsWith("$map/")){let s=e.split("/"),[,i]=s,o,a=dm(t);if(i==="item")o=n?.item??a?.item??t["$map/item"];else if(i==="index")o=n?.index??a?.index??t["$map/index"];else o=a?.[i]??t[`$map/${i}`];return s.length>2?Ut(o,s.slice(2).join("/")):o}if(e.startsWith("#/state/"))return Ut(t,e.slice(8));if(e.startsWith("parent#/"))return Ut(t,e.slice(8));if(e.startsWith("window#/"))return Ut(globalThis.window,e.slice(8));if(e.startsWith("document#/"))return Ut(globalThis.document,e.slice(10));return Ut(t,e)??null}function yJ(e,t,r,n){if(e.startsWith("$map/")){let s=e.split("/"),[,i]=s,o,a=dm(t);if(i==="item")o=n?.item??a?.item??t["$map/item"];else if(i==="index")o=n?.index??a?.index??t["$map/index"];else o=a?.[i]??t[`$map/${i}`];if(s.length>2){let l=s.slice(2),c=l.pop(),u=l.length>0?Ut(o,l.join("/")):o;return{key:c,obj:u}}return{key:i==="item"?"$map/item":"$map/index",obj:dm(t)??t}}if(e.startsWith("#/state/")){let s=e.slice(8);if(s.indexOf("/")===-1)return{key:s,obj:t};let o=vs(s),a=o.pop(),l=t;for(let c of o)l=l[c];return{key:a,obj:l}}return{key:e,obj:t}}function Br(e,t,r,n,s){let i=bJ(e,t,r,n,s);return s?.report(s.path??[],i),i}function B0(e,t,r){switch(e){case"+":return t+r;case"-":return t-r;case"*":return t*r;case"/":return t/r;case"%":return t%r;case"<":return t<r;case"<=":return t<=r;case">":return t>r;default:return t>=r}}function bJ(e,t,r,n,s){let{operator:i,target:o,value:a,initial:l}=e;if(!fJ.has(i))throw Error(`$expression: unknown operator "${i}"`);if(pm.has(i)&&!("value"in e)){let c=nt(o,t,r,n,lt(s,"target"));if(i==="!")return!c;if(i==="-")return-c}if(i==="call"){let c=Rl(o)?o.$ref:void 0;if(!O(c))throw TypeError("$expression: call target must be a $ref pointer");let u=(n?.callDepth??0)+1;if(u>W0)throw Error(`$expression: call depth exceeded (${W0})`);let p=Array.isArray(a)?a.map((m,b)=>nt(m,t,r,n,lt(s,["value",b]))):[];if(c.startsWith("window#/")){if(!Y0(c))throw Error(`$expression: "${c}" is not a blessed pure global`);let m=c.slice(8),b=pJ.get(m);if(b)return b(...mJ(m,p,t));let g=Ut(globalThis.window,m),y=m.lastIndexOf("/"),w=y===-1?globalThis.window:Ut(globalThis.window,m.slice(0,y));return g.apply(w,p)}let h=ku(c,t,r,n);if(Wt(h))return h.apply(gJ(c,t,r,n),p);if(V(h)&&"$expression"in h){let m=h,b={};for(let[g,y]of(m.parameters??[]).entries()){let w=O(y)?y:y?.name??"";if(!w)continue;b[w]=p[g]===void 0&&V(y)&&"default"in y?y.default:p[g]}return Br(m.$expression,t,r,{args:b,callDepth:u})}throw TypeError(`$expression: call target "${c}" is not callable`)}if(gm.has(i)){if(i==="?:"){let m=nt(o,t,r,n,lt(s,"target"));if(s){let b=nt(a,t,r,n,lt(s,"value")),g=nt(l,t,r,n,lt(s,"initial"));return m?b:g}return m?nt(a,t,r,n):nt(l,t,r,n)}let c=nt(o,t,r,n,lt(s,"target")),u=String(c),p=e.cases??{},h=Object.hasOwn(p,u);if(s){let m;for(let[g,y]of Object.entries(p)){let w=nt(y,t,r,n,lt(s,["cases",g]));if(g===u)m=w}let b=nt(e.default,t,r,n,lt(s,"default"));return h?m:b}return h?nt(p[u],t,r,n):nt(e.default,t,r,n)}if(mm.has(i)){let c=nt(o,t,r,n,lt(s,"target")),u=nt(a,t,r,n,lt(s,"value"));switch(i){case"===":return c===u;case"!==":return c!==u;case"&&":return c&&u;case"||":return c||u;case"??":return c??u;default:return B0(i,c,u)}}if(G0.has(i)){let c=nt(a,t,r,n,lt(s,"value")),{obj:u,key:p}=yJ(o.$ref,t,r,n);u[p]=i==="="?c:B0(i.slice(0,-1),u[p],c);return}if(K0.has(i)){let c=nt(o,t,r,n,lt(s,"target"));switch(i){case"push":return c.push(nt(a,t,r,n,lt(s,"value")));case"unshift":return c.unshift(nt(a,t,r,n,lt(s,"value")));case"pop":return c.pop();case"shift":return c.shift();case"splice":{let u=nt(a,t,r,n,lt(s,"value"));return c.splice(...u)}default:break}}if(ym.has(i)){let c=nt(o,t,r,n,lt(s,"target")),u=a===void 0?[]:Array.isArray(a)?X0(a,t,r,n,lt(s,"value")):[nt(a,t,r,n,lt(s,"value"))],p=Ut(c,i);if(!Wt(p))return;return p.apply(c,u)}if(hm.has(i)){let c=nt(o,t,r,n,lt(s,"target")),u=a;if(i==="reduce"){let p=nt(l,t,r,n,lt(s,"initial"));for(let[h,m]of c.entries())p=Br(u,t,r,{acc:p,index:h,item:m},h===0?lt(s,"value"):void 0);return p}if(i==="map")return c.map((p,h)=>Br(u,t,r,{...n,index:h,item:p},h===0?lt(s,"value"):void 0));if(i==="filter")return c.filter((p,h)=>Br(u,t,r,{...n,index:h,item:p},h===0?lt(s,"value"):void 0))}return}function ut(e,t){if(e===null)return"null";if(e===void 0)return"undefined";if(U0(e))return dr(e,t);if(Rl(e))return bm(e.$ref,t);if(Array.isArray(e))return e.map((r)=>ut(r,t)).join(", ");return JSON.stringify(e)}function xJ(e){return`_fx_${e.replaceAll(/[^A-Za-z0-9_$]/g,"_")}`}function bm(e,t){let r=t.statePrefix??"state",n=t.eventParam??"event";if(e==="$reduce/acc")return"_acc";if(e.startsWith("$reduce/"))return"_acc";if(e.startsWith("$args/"))return Me("_args",e.slice(6));if(e.startsWith("event#/"))return Me(n,e.slice(7));if(e.startsWith("$map/")){let s=e.split("/"),[,i]=s;if(i==="item")return s.length>2?Me("_item",s.slice(2).join("/")):"_item";if(i==="index")return"_index";return`_${i}`}if(e.startsWith("#/state/"))return Me(r,e.slice(8));if(e.startsWith("parent#/"))return Me(r,e.slice(8));if(e.startsWith("window#/"))return Me("window",e.slice(8));if(e.startsWith("document#/"))return Me("document",e.slice(10));return Me(r,e)}function H0(e,t){if(Rl(e))return bm(e.$ref,t);return ut(e,t)}function $J(e,t,r){let n=(o)=>t[o]??"undefined",s=`(${r.statePrefix??"state"}?.$page?.locale ?? ${JSON.stringify(An)})`,i=JSON.stringify(lm);switch(e){case"Intl/formatNumber":return`new Intl.NumberFormat(${n(1)} ?? ${s}, ${n(2)}).format(${n(0)})`;case"Intl/formatDate":return`new Intl.DateTimeFormat(${n(1)} ?? ${s}, {timeZone: ${i}, ...${n(2)}}).format(new Date(${n(0)}))`;case"Intl/formatRelativeTime":return`new Intl.RelativeTimeFormat(${n(2)} ?? ${s}, ${n(3)}).format(${n(0)}, ${n(1)})`;case"Intl/formatList":return`new Intl.ListFormat(${n(1)} ?? ${s}, ${n(2)}).format(${n(0)})`;case"Intl/plural":return`new Intl.PluralRules(${n(1)} ?? ${s}, ${n(2)}).select(${n(0)})`;case"Intl/compare":return`new Intl.Collator(${n(2)} ?? ${s}, ${n(3)}).compare(${n(0)}, ${n(1)})`;case"Intl/displayName":return`new Intl.DisplayNames(${n(2)} ?? ${s}, {...${n(3)}, type: ${n(1)} ?? 'language'}).of(${n(0)})`;case"Intl/segment":return`[...new Intl.Segmenter(${n(2)} ?? ${s}, {granularity: ${n(1)} ?? 'grapheme'}).segment(${n(0)})].map((p) => p.segment)`;default:return null}}function dr(e,t={}){let{operator:r,target:n,value:s,initial:i}=e;if(pm.has(r)&&!("value"in e)){let o=ut(n,t);if(r==="!")return`!(${o})`;if(r==="-")return`-(${o})`}if(r==="call"){let o=(Rl(n)?n.$ref:void 0)??"",a=Array.isArray(s)?s.map((l)=>ut(l,t)):[];if(o.startsWith("window#/")){if(!Y0(o))throw Error(`$expression: "${o}" is not a blessed pure global`);let l=$J(o.slice(8),a,t);if(l)return l;return`window.${o.slice(8).replaceAll("/",".")}(${a.join(", ")})`}if(o.startsWith("#/state/")){let l=o.slice(8),c=t.formulaParams?.[l];if(c){let u=c.map((p,h)=>`${JSON.stringify(p)}: ${a[h]??"undefined"}`).join(", ");return`${xJ(l)}(${t.statePrefix??"state"}, { ${u} })`}}return`${bm(o,t)}(${a.join(", ")})`}if(gm.has(r)){if(r==="?:"){let c=ut(n,t),u=ut(s,t),p=ut(i,t);return`(${c} ? ${u} : ${p})`}let o=ut(n,t),a=Object.entries(e.cases??{}).map(([c,u])=>`_d === ${JSON.stringify(c)} ? ${ut(u,t)} : `).join(""),l="default"in e?ut(e.default,t):"undefined";return`((_d) => ${a}${l})(String(${o}))`}if(mm.has(r)){let o=ut(n,t),a=ut(s,t);return`(${o} ${r} ${a})`}if(G0.has(r)){let o=H0(n,t),a=ut(s,t);return`${o} ${r} ${a}`}if(K0.has(r)){let o=H0(n,t);switch(r){case"push":return`${o}.push(${ut(s,t)})`;case"unshift":return`${o}.unshift(${ut(s,t)})`;case"pop":return`${o}.pop()`;case"shift":return`${o}.shift()`;case"splice":{let a=Array.isArray(s)?s.map((l)=>ut(l,t)).join(", "):ut(s,t);return`${o}.splice(${a})`}default:break}}if(ym.has(r)){let o=ut(n,t),a=s===void 0?"":Array.isArray(s)?s.map((l)=>ut(l,t)).join(", "):ut(s,t);return`(${o})?.${r}?.(${a})`}if(hm.has(r)){let o=ut(n,t),a=dr(s,t);if(r==="reduce"){let l=ut(i,t);return`${o}.reduce((_acc, _item, _index) => ${a}, ${l})`}if(r==="map")return`${o}.map((_item, _index) => ${a})`;if(r==="filter")return`${o}.filter((_item, _index) => ${a})`}return"undefined"}function Ko(e,t,r,n){return nt(e,t,r,n)}function js(e,t={}){return ut(e,t)}var z0,pm,mm,G0,K0,hm,gm,ym,fJ,dJ,pJ,W0=64,hJ=64;var Ol=D(()=>{um();ye();Go();z0=new Set(["=","+=","-=","*=","/=","push","pop","shift","unshift","splice"]),pm=new Set(["!","-"]),mm=new Set(["+","-","*","/","%","===","!==","<","<=",">",">=","&&","||","??"]),G0=new Set(["=","+=","-=","*=","/="]),K0=new Set(["push","pop","shift","unshift","splice"]),hm=new Set(["reduce","map","filter"]),gm=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"]),fJ=new Set([...z0,...pm,...mm,...hm,...gm,...ym,"call"]),dJ=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",...cm]),pJ=new Map([["Intl/compare",(e,t,r,n)=>new Intl.Collator(r??An,n).compare(e,t)],["Intl/displayName",(e,t,r,n)=>new Intl.DisplayNames(r??An,{...n,type:t??"language"}).of(e)],["Intl/formatDate",(e,t,r)=>new Intl.DateTimeFormat(t??An,{timeZone:lm,...r}).format(new Date(e))],["Intl/formatList",(e,t,r)=>new Intl.ListFormat(t??An,r).format(e)],["Intl/formatNumber",(e,t,r)=>new Intl.NumberFormat(t??An,r).format(e)],["Intl/formatRelativeTime",(e,t,r,n)=>new Intl.RelativeTimeFormat(r??An,n).format(e,t)],["Intl/plural",(e,t,r)=>new Intl.PluralRules(t??An,r).select(e)],["Intl/segment",(e,t,r)=>[...new Intl.Segmenter(r??An,{granularity:t??"grapheme"}).segment(e)].map((n)=>n.segment)]])});function Z0(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 wJ(e){return(V(e)||Wt(e))&&"then"in e&&Wt(e.then)}async function Yo(e,t,r,n={}){let s=n.args?{args:n.args}:void 0;for(let i of e){let o=Z0(i);switch(o.kind){case"expression":{let a=Br(o.node,t,r,s);if(wJ(a))await a;break}case"if":{let a=o.node,l=Ko(a.if,t,r,s)?a.then:a.else;if(Array.isArray(l))await Yo(l,t,r,n);break}case"switch":{let a=o.node,l=String(Ko(a.$switch,t,r,s)),c=a.cases??{},u=Object.hasOwn(c,l)?c[l]:a.default;if(Array.isArray(u))await Yo(u,t,r,n);break}case"dispatch":{let a=o.node,l=Wt(n.target)?n.target():n.target,c=r?.currentTarget??l;if(!c)break;let u={};if("detail"in a)u.detail=Ko(a.detail,t,r,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":{r?.stopPropagation();break}case"preventDefault":{r?.preventDefault();break}default:break}}}function Zr(e,t={}){let r=t.indent??"",n=[];for(let s of e){let i=Z0(s);switch(i.kind){case"expression":{n.push(`${r}${dr(i.node,t)};`);break}case"if":{let o=i.node,a=js(o.if,t),l={...t,indent:`${r} `};if(n.push(`${r}if (${a}) {`,Zr(o.then??[],l)),o.else)n.push(`${r}} else {`,Zr(o.else,l));n.push(`${r}}`);break}case"switch":{let o=i.node,a=js(o.$switch,t),l={...t,indent:`${r} `};n.push(`${r}switch (String(${a})) {`);for(let[c,u]of Object.entries(o.cases??{}))n.push(`${r} case ${JSON.stringify(c)}: {`,Zr(u,l),`${r} break;`,`${r} }`);if(o.default)n.push(`${r} default: {`,Zr(o.default,l),`${r} }`);n.push(`${r}}`);break}case"dispatch":{let o=i.node,a=t.eventParam??"event",l=t.dispatchTarget??`(${a} && ${a}.currentTarget)`,c=[];if("detail"in o)c.push(`detail: ${js(o.detail,t)}`);if(o.bubbles!==void 0)c.push(`bubbles: ${JSON.stringify(o.bubbles)}`);if(o.composed!==void 0)c.push(`composed: ${JSON.stringify(o.composed)}`);let u=c.length>0?`, { ${c.join(", ")} }`:"";n.push(`${r}${l}?.dispatchEvent(new CustomEvent(${JSON.stringify(o.dispatchEvent)}${u}));`);break}case"stopPropagation":{n.push(`${r}${t.eventParam??"event"}?.stopPropagation();`);break}case"preventDefault":{n.push(`${r}${t.eventParam??"event"}?.preventDefault();`);break}default:break}}return n.join(`
126
- `)}var _u=D(()=>{ye();Ol()});function Xo(e){if(!e.startsWith("${")||!e.endsWith("}"))return!1;let t=0;for(let r=1;r<e.length;r+=1){let n=e[r];if(n==="{")t+=1;else if(n==="}"){if(t-=1,t===0)return r===e.length-1}}return!1}function e$(){return[...Q0].toSorted()}function to(e,t){let r=e.toLowerCase();if(r.startsWith("aria-")||Q0.has(r))return String(t);return t?"":null}var Ps,Q0,xm=32,Au,Ru="jx-slot",Cl="data-jx-slots",$m="jx.slot.group",Pee;var Zo=D(()=>{Al();Ol();Go();ye();Vr();_u();Al();Ps=new Set(["$schema","$id","$defs","state","$ref","$props","$elements","$title","$description","$switch","$prototype","$src","$export","$media","$map","timing","default","description","body","parameters","arguments","name","tagName","children","style","attributes","items","map","filter","sort","cases","observedAttributes"]),Q0=new Set(["contenteditable","draggable","spellcheck"]);Au=/^[\t\n\f\r ]+$/u,Pee=(()=>{let e=Symbol.for($m),t=globalThis;return t[e]??=new WeakMap,t[e]})()});function t$(e,t,r,n,s=SJ){let i=[],o=(p,h)=>{let m={mediaQueries:t,scope:h,transposeValue:r};if(n)m.resolveValue=(b,g)=>n(b,g,h);for(let b of zo(p,m))i.push(b.text)},a={},l={},c=[],u=[];for(let[p,h]of Object.entries(e)){if(V(h)&&!Array.isArray(h)){if(p.startsWith("@"))c.push([p,h]);else if(!p.startsWith("--"))u.push([p,h]);continue}if(Gs(p)||p.startsWith("@"))continue;if(p.startsWith("--")||p==="colorScheme"||p==="color-scheme")a[p]=h;else l[p]=h}o(a,s.root),o(l,s.body);for(let[p,h]of u)if(p.startsWith("&"))o({[p]:h},s.root);else o(h,p);for(let[p,h]of c){if(Pl(p)||_l(p)){o({[p]:h},null);continue}let m={},b={},g=[];for(let[y,w]of Object.entries(h)){if(V(w)&&!Array.isArray(w)){if(!y.startsWith("@"))g.push([y,w]);continue}if(y.startsWith("--"))m[y]=w;else b[y]=w}o({[p]:m},s.root),o({[p]:b},s.body);for(let[y,w]of g)o({[p]:w},y)}if(Object.values(t).some((p)=>bn(p)!==null)&&!("colorScheme"in e))i.push(`${s.root} { color-scheme: light dark }`,`${s.root}:where([${yn}="light"]) { color-scheme: light }`,`${s.root}:where([${yn}="dark"]) { color-scheme: dark }`);return i.join(`
127
- `)}var SJ;var r$=D(()=>{Al();ye();SJ={body:"body",root:":root"}});function n$(e){return e===!1||e==="open"||e==="closed"}function ro(e,t){let r=e?.$shadow;if(n$(r))return r===!1?null:r;let n=t?.shadow;return n$(n)&&n!==!1?n:null}function s$(e,t){return t===null?e:":host"}function Tl(e,t){let r=[];for(let[n,s]of(e.parameters??[]).entries()){let i=i$(s);if(!i)continue;let o=o$(s)?`_a[${n}] === undefined ? ${JSON.stringify(s.default)} : _a[${n}]`:`_a[${n}]`;r.push(`${JSON.stringify(i)}: ${o}`)}return`(..._a) => { const _args = { ${r.join(", ")} }; return ${t}; }`}function i$(e){return O(e)?e:e?.name??""}function o$(e){return V(e)&&"default"in e}function Nu(e,t){let r=jm(e,t);return r===e?e:`${r} as ${e}`}function jm(e,t){let r=t?.$export;return O(r)&&r!==""?r:e}function Tu(e,t,r={}){let{statePrefix:n="state",indent:s="",collect:i}=r,{url:o}=t,a=be(o),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)":o}`,i?`${i}.push(effect(() => {`:"effect(() => {"];if(a)c.push(` const url = \`${jJ(o,n)}\`;`,' if (!url || url === "undefined" || url.includes("undefined")) return;');else c.push(` const url = ${JSON.stringify(o)};`);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 h=V(t.body)?JSON.stringify(JSON.stringify(t.body)):JSON.stringify(t.body);u.push(`body: ${h}`)}let p=u.length>0?`, { ${u.join(", ")} }`:"";return c.push(` fetch(url${p})`," .then(r => r.ok ? r.json() : Promise.reject(r.statusText))",` .then(d => { ${n}.${e} = d; })`,` .catch(e => { ${n}.${e} = { error: String(e) }; });`,i?"}));":"});"),c.map((h)=>`${s}${h}`).join(`
128
- `)}function Iu(e,t,r={}){let{statePrefix:n="state",indent:s="",collect:i,serverBaseUrl:o="/_jx/server"}=r,a=JSON.stringify(`${o}/${t.$export}`),l=Object.entries(t.arguments??{}),c=l.map(([g,y])=>{if(!Be(y))return`${Ss(g)}: ${JSON.stringify(y)}`;if(EJ.some((w)=>y.$ref.startsWith(w)))throw Error(`Server function "${e}": argument "${g}" references "${y.$ref}", which a state entry cannot read. Use a #/state/, parent#/, window#/ or document#/ reference.`);return`${Ss(g)}: ${js({$ref:y.$ref},{statePrefix:n})}`}),u=l.some(([,g])=>Be(g)),p=`${p$}(${a}, ${c.length>0?`{ ${c.join(", ")} }`:"{}"})`,h=Me(n,Lt(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;",i?` ${i}.push(effect(() => {`:" effect(() => {"," const _seq = ++_jxSeq;",` ${p}`,` .then((d) => { if (_seq === _jxSeq) ${h} = d; })`,` .catch((e) => { if (_seq === _jxSeq) ${m}; });`,i?" }));":" });","}"]:[`// ${e}: server function ${t.$export}, called once`,p,` .then((d) => { ${h} = d; })`,` .catch((e) => { ${m}; });`]).map((g)=>`${s}${g}`).join(`
129
- `)}function jJ(e,t){if(t==="state")return e;return e.replaceAll(/\$\{([^}]*)\}/g,(r,n)=>`\${${n.replaceAll(/(?<!this\.)\bstate\./g,`${t}.`)}}`)}function Ju(e){if(!V(e))return!1;if(e.state)for(let[t,r]of Object.entries(e.state)){if(t==="$site"||t==="$page")continue;if(!V(r)||Array.isArray(r))return!0;if(r.timing==="compiler")continue;if(r.$prototype)return!0;if("default"in r)return!0;if(Js(r))continue;return!0}if(e.$switch)return!0;if(dt(e)||Hd(e.children))return!0;if(Array.isArray(e.children)&&e.children.some((t)=>Ju(t)))return!0;for(let[t,r]of Object.entries(e)){if(Ps.has(t))continue;if(Be(r))return!0;if(be(r))return!0}if(V(e.style)){for(let t of Object.values(e.style))if(be(t))return!0}if(V(e.attributes)){for(let t of Object.values(e.attributes))if(be(t))return!0}return!1}function l$(e){if(!V(e))return!1;if(e.$switch)return!0;if(dt(e)||Hd(e.children))return!0;for(let[t,r]of Object.entries(e)){if(Ps.has(t))continue;if(Be(r))return!0;if(be(r))return!0}if(V(e.style)){for(let t of Object.values(e.style))if(be(t))return!0}if(V(e.attributes)){for(let t of Object.values(e.attributes))if(be(t))return!0}return!1}function na(e,t=null,r={},n={}){let s=e?.state?Qo(e.state,t):t??c$();return{media:n,scope:s,scopeDefs:r}}function c$(e=null){return Object.create(e)}function u$(e){return e[a$]}function RJ(e,t,r){if(t>0&&_J.test(e.charAt(t-1)))return!1;let n=t+5;if(r)return!AJ.test(e.charAt(n));while(/\s/u.test(e.charAt(n)))n+=1;return e.charAt(n)==="."}function sa(e,t,r={}){if(!e.includes("state"))return e;let n=r.bare===!0,s=r.code===!1?e:Ci(e),i="",o=0;for(let a=s.indexOf("state");a!==-1;a=s.indexOf("state",a+1))if(RJ(s,a,n))i+=e.slice(o,a)+t,o=a+5;return i+e.slice(o)}function Sm(e,t){if(O(e)){if(!e.includes("state."))return;let i=Ci(e);for(let o of i.matchAll(PJ))t.add(o[1]);for(let o of i.matchAll(kJ))t.add(o[1]);return}if(Array.isArray(e)){for(let i of e)Sm(i,t);return}if(!V(e))return;let r=e,{operator:n,target:s}=r;if(O(n)&&Es(n)&&Be(s)&&s.$ref.startsWith("#/state/"))t.add(s.$ref.slice(8).split("/")[0]);for(let i of Object.values(r))Sm(i,t)}function Qo(e={},t=null){let r=c$(t),n=t?u$(t):void 0,s=new Set(n);Object.defineProperty(r,a$,{configurable:!0,enumerable:!1,value:s,writable:!0});let i=new Set;for(let c of Object.values(e))if(Mr(c)||Dr(c))Sm(c.body??c.$expression,i);for(let c of i)if(c in e)s.add(c);for(let[c,u]of Object.entries(e)){if(!V(u)||Array.isArray(u)){ks(r,c,Ou(u));continue}if("default"in u){ks(r,c,Ou(u.default));continue}if(as(u)){s.add(c);continue}if(!u.$prototype&&!("$expression"in u)&&!Js(u))ks(r,c,Ou(u))}let o=[],a=[];for(let[c,u]of Object.entries(e)){if(be(u)){o.push([c,u]);continue}if(!V(u))continue;if(Dr(u)){let p=u.$expression;if(Ri(u)){let h=u.parameters;ks(r,c,(...m)=>{let b={};for(let[g,y]of h.entries()){let w=i$(y);if(!w)continue;b[w]=m[g]===void 0&&o$(y)?y.default:m[g]}return Br(p,r,null,{args:b})})}else if(Es(p.operator))ks(r,c,(h,m)=>Br(p,h,m));else wm(r,c,()=>Br(p,r,null));continue}if(Mr(u)){if(Is(u)){let{body:p}=u;ks(r,c,(h,m)=>{Yo(p,h??r,m??null)})}else if(O(u.body)){let p=u.parameters?ls(u.parameters):u.arguments??[],{body:h}=u,m=p.includes("state")?p:["state",...p],b=Function(...m,h),g=(y,w)=>b(...m.map((j)=>j==="state"?y:w));if(Oi(h))wm(r,c,()=>g(r)),a.push([c,h]);else ks(r,c,g)}else ks(r,c,()=>{}),s.add(c);continue}if(vn(u)&&(u.$prototype==="LocalStorage"||u.$prototype==="SessionStorage")){ks(r,c,Ou(u.default??null));continue}if(vn(u)&&u.$prototype==="Request")s.add(c)}let l=!0;while(l){l=!1;for(let[c,u]of[...a,...o])if(!s.has(c)&&f$(u,r))s.add(c),l=!0}for(let[c,u]of o)wm(r,c,()=>sr(u,r));return r}function ks(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0})}function wm(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:r})}function Ze(e,t){if(Be(e))return Pm(e.$ref,t);if(be(e))return sr(e,t);return e}function Pr(e){return Be(e)}function Pm(e,t){if(!O(e))return e;if(e.startsWith("$map/")){let r=e.split("/"),n=r[1],i=t.$map?.[n]??t[`$map/${n}`];return r.length>2?vm(i,r.slice(2).join("/")):i}if(e.startsWith("#/state/"))return vm(t,e.slice(8));return vm(t,e)??null}function f$(e,t){if(!t)return!1;let r=u$(t);for(let n of e.matchAll(/\bstate\.([A-Za-z_$][\w$]*)\s*(\()?/g)){if(n[2])continue;let s=n[1];if(r?.has(s))return!0;let i;try{i=t[s]}catch{continue}if(Wt(i))return!0}return!1}function Mu(e){return Xo(e)?`(${e.slice(2,-1)})`:`\`${e}\``}function sr(e,t){if(f$(e,t))return null;let r=["state","$map","$site","$page"],n=[t,t?.$map,t?.$site,t?.$page];try{let s=Xo(e)?`return (${e.slice(2,-1)})`:`return \`${e}\``;return Function(...r,s)(...n)}catch{return null}}function vm(e,t){return Ut(e,t)}function Ou(e){if(!V(e))return e;return structuredClone(e)}function OJ(e,t){if(!e||!t)return"";return Object.entries(e).filter(([r,n])=>!r.startsWith(":")&&!r.startsWith(".")&&!r.startsWith("&")&&!r.startsWith("[")&&!r.startsWith("@")&&be(n)).map(([r,n])=>{let s=Ze(n,t);return s==null?null:`${jr(r)}: ${s}`}).filter(Boolean).join("; ")}function no(e,t,r=""){let n="",s=Ze(e.id,t),i=Ze(e.className,t),o=Ze(e.hidden,t),a=Ze(e.tabIndex,t),l=Ze(e.title,t),c=Ze(e.lang,t),u=Ze(e.dir,t);if(s)n+=` id="${_e(String(s))}"`;if(i)n+=` class="${_e(String(i))}"`;if(o)n+=" hidden";if(a!==void 0&&a!==null)n+=` tabindex="${_e(String(a))}"`;if(l)n+=` title="${_e(String(l))}"`;if(c)n+=` lang="${_e(String(c))}"`;if(u)n+=` dir="${_e(String(u))}"`;let p=[OJ(e.style,t),r].filter(Boolean).join("; ");if(p)n+=` style="${_e(p)}"`;if(e.attributes)for(let[h,m]of Object.entries(e.attributes)){let b=Ze(m,t);if(Qt(b)){let g=to(h,b);if(g!==null)n+=g===""?` ${h}`:` ${h}="${_e(g)}"`;continue}if(O(b)||Nt(b))n+=` ${h}="${_e(String(b))}"`}if(e.$static)n+=" data-jx-static";else if(e.$prerendered)n+=" data-jx-prerendered";return n}function Il(e,t=" "){return e?"":`
130
- ${t}`}function ia(){let e=JSON.stringify(Pu),t=JSON.stringify(yn);return`(function(){try{var s=localStorage.getItem(${e});if(s==="light"||s==="dark"){document.documentElement.setAttribute(${t},s)}}catch(e){}})()`}function Cu(e,t,r,n){for(let s of zo(t,{mediaQueries:n,resolveValue:(i,o)=>d$(i,o,r),scope:r}))e.push(s.text)}function d$(e,t,r){let n=O(t)?t:t.$ref;return CJ.push({property:e,selector:r,source:n}),null}function Du(){return`const __jxEnumAttrs = new Set(${JSON.stringify(e$())});
131
- function ${oa}(n, v) {
125
+ `);return e}function V0(e,t,r){let{code:n,problems:s}=NJ(e),[i,...o]=s.filter((a)=>a.kind==="unsupported");if(i)throw new U0(t,[i,...o]);for(let a of s)r.push({...t,problem:a});return n}function bm(e,t,r){if(Array.isArray(e))return e.map((o,a)=>bm(o,{...t,pointer:`${t.pointer}/${a}`},r));if(!B(e))return e;let n=cp(e),s=[],i={set:(o,a)=>{s.push([o,a])}};for(let[o,a]of Object.entries(e)){let l={...t,pointer:`${t.pointer}/${CJ(o)}`};if(n&&o==="body")i.set(o,q0(a,l,r));else if(n&&(o==="getter"||o==="setter")&&B(a)){let c={...a};if(a.body!==void 0)c.body=q0(a.body,{...l,pointer:`${l.pointer}/body`},r);i.set(o,c)}else i.set(o,bm(a,l,r))}return Object.fromEntries(s)}function Nl(e,t,r=[]){return bm(e,{path:t,pointer:""},r)}function H0(e,t,r=[]){return Nl(e,t,r)}var AJ,gm,Ju=null,ym=null,U0;var xm=M(()=>{ye();AJ=/(^|[\n;{}])(\s*)(import|export)(?=[\s{*"'])/gu;gm=new Map;U0=class U0 extends Error{problems;site;constructor(e,t){let[r]=t;super(`${e.path}${e.pointer}: ${r.message} (line ${r.line}, column ${r.column})`);this.name="EraseError",this.problems=t,this.site=e}}});import{createRequire as TJ}from"node:module";var $m=M(()=>{xm();xm();W0(()=>TJ(import.meta.url)("ts-blank-space").default)});function G0(e){for(let{path:t,pointer:r,problem:n}of e){let s=`${t}${r} (line ${n.line}, column ${n.column}): ${n.message}`;if(!z0.has(s))z0.add(s),console.warn(`Warning: ${s}`)}}function Nn(e,t){let r=[],n=Nl(e,t,r);return G0(r),n}function K0(e,t){let r=[],n=H0(e,t,r);return G0(r),n}var z0;var Xo=M(()=>{$m();z0=new Set});function JJ(e){return e.split("\\").join("/").replace(/^\.\//,"").replace(/^\//,"").replace(/^pages\//,"")}function X0(e){let t=JJ(e),r=t.slice(t.lastIndexOf("/")+1),n=r.lastIndexOf(".");if(n>0)t=t.slice(0,t.length-(r.length-n));if(t.endsWith("/index"))t=t.slice(0,-6)||"/";else if(t==="index")t="/";if(!t.startsWith("/"))t=`/${t}`;let s=[],i=!1,o=!1,a=t.replaceAll(IJ,(l,c,u)=>{if(i=!0,c)return o=!0,s.push(c),"*";return s.push(u),`:${u}`});return{isCatchAll:o,isDynamic:i,params:s,urlPattern:a}}function Y0(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 IJ;var Z0=M(()=>{IJ=/\[\.\.\.(\w+)\]|\[(\w+)\]/g});function DJ(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function Q0(e){if(!B(e)||!("paginate"in e))return null;let{each:t,pageSize:r,paginate:n}=e,s=B(n)?n.$ref:void 0,i=A(s)?MJ.exec(s)?.[1]:void 0;if(i===void 0)throw TypeError('$paths.paginate must be { "$ref": "#/state/<key>" }');if(!Ct(r)||!Number.isInteger(r)||r<1)throw TypeError("$paths.pageSize must be a positive integer");let o={key:DJ(i),pageSize:r};if(t!==void 0){if(!B(t)&&!Array.isArray(t))throw TypeError("$paths.each must be a $paths source");if(B(t)&&"paginate"in t)throw TypeError("$paths.each cannot itself be paged");o.each=t}return o}function wm(e,t){return Math.max(1,Math.ceil(e/t))}function e$(e,t,r){let n=(t-1)*r;return e.slice(n,n+r)}function to(e,t){if(e.endsWith("*")){if(t===1){let r=e.slice(0,-1).replace(/\/$/,"");return r===""?"/":r}return`${e.slice(0,-1)}${t}`}return e.replace(/:[^/]+/,String(t))}function t$(e,t,r,n){let s=wm(n,r),i=[];for(let o=1;o<=s;o++)i.push({current:o===t,number:o,url:to(e,o)});return{first:to(e,1),itemCount:n,last:to(e,s),next:t<s?to(e,t+1):null,number:t,pageCount:s,pageSize:r,pages:i,prev:t>1?to(e,t-1):null}}var MJ;var r$=M(()=>{ye();MJ=/^#\/state\/([^/]+)$/});function Qr(e){if(!A(e)||e.trim()==="")return null;try{return new Intl.Locale(e.trim()).toString()}catch{return null}}function Cl(e){let t=Qr(e);if(t===null)return"ltr";let r=new Intl.Locale(t),n=r.script??r.maximize().script;return n!==void 0&&LJ.has(n)?"rtl":"ltr"}function n$(e){let t=Qr(e);if(t===null)return A(e)?e:"";return new Intl.DisplayNames([t],{type:"language"}).of(t)??t}function vm(e){let t=e.i18n,r=[];if(!V(t))return{errors:r,i18n:null};let n=Array.isArray(t.locales)?t.locales:[],s=[];for(let a of n){let l=Qr(a);if(l===null){r.push(`i18n.locales: "${String(a)}" is not a well-formed BCP 47 language tag.`);continue}if(!s.includes(l))s.push(l)}let i=Qr(t.defaultLocale)??s[0]??null;if(t.defaultLocale!==void 0&&Qr(t.defaultLocale)===null)r.push(`i18n.defaultLocale: "${String(t.defaultLocale)}" is not a well-formed BCP 47 language tag.`);if(i===null)return r.push("i18n is declared with no usable locale — set `defaultLocale` or `locales`."),{errors:r,i18n:null};if(!s.includes(i))s.unshift(i);let o=t.routing==="prefix-always"||t.routing==="prefix-except-default"?t.routing:FJ;return{errors:r,i18n:{defaultLocale:i,locales:s,routing:o}}}function bn(e,t){if(t===null)return null;let r=e.split("/").find(Boolean);if(r===void 0)return t.defaultLocale;let n=Qr(r);return n!==null&&t.locales.includes(n)?n:t.defaultLocale}var LJ,Mu="^[A-Za-z]{2,8}(-[A-Za-z0-9]{1,8})*$",FJ="prefix-except-default";var ro=M(()=>{ye();LJ=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 VJ(e){let t=new Set,r=new Set,n=(i)=>{if(i.startsWith("#/state/"))t.add(i.slice(8).split("/")[0])},s=(i)=>{if(A(i)){for(let o of i.matchAll(/\bstate\.([A-Za-z_$][\w$]*)\s*\(/gu))t.add(o[1]);return}if(Array.isArray(i)){if(!r.has(i)){r.add(i);for(let o of i)s(o)}return}if(!B(i)||r.has(i))return;if(r.add(i),i.operator==="call"&&qe(i.target))n(i.target.$ref);for(let[o,a]of Object.entries(i)){if(o==="$defs")continue;if(o.startsWith("on")&&qe(a))n(a.$ref);s(a)}};s(e);for(let i of qJ)if(B(e.state)&&i in e.state)t.add(i);return t}function Sm(e){return"body"in e&&"$src"in e}function Tl(e){return Dc(e.parameters??e.arguments).length>0}function Cn(e){let t=["state"];for(let r of Dc(e.parameters??e.arguments))if(r!=="state")t.push(r);return t}function BJ(e,t,r){if(Pn(t))return"callable";if(Dc(t.parameters??t.arguments).length>0)return"callable";if(A(t.body))return hb(t.body)?"computed":"callable";if(t.$src)return r().has(e)?"callable":"computed";return"callable"}function no(e){let t=new Map,r=null,n=()=>r??=VJ(e);for(let[s,i]of Object.entries(e.state??{}))if(Bt(i))t.set(s,BJ(s,i,n));return t}var qJ;var Il=M(()=>{ye();qJ=new Set(["onMount","onUnmount","onAdopted"])});function jr(e){return e.replaceAll(/[A-Z]/g,(t)=>`-${t.toLowerCase()}`)}function s$(e,t){if(e.startsWith("@--"))return t[e.slice(1)]??e.slice(1);if(e.startsWith("@(")){let r=e.slice(2,-1).trim();return WJ.has(r.toLowerCase())?r:e.slice(1)}return null}function Jl(e){return e.startsWith("@position-try")||e.startsWith("@property")||e.startsWith("@font-face")||e.startsWith("@counter-style")}function Dl(e){return e.startsWith("@keyframes")}function i$(e,t){let r=[];for(let n of Ml(e))for(let s of Ml(t))r.push(UJ(n,s));return r.join(", ")}function UJ(e,t){let r=Lu(t,e);if(r!==null)return r;if(t.startsWith("[")||t.startsWith(":")||t.startsWith("."))return`${e}${t}`;return`${e} ${t}`}function Em(e){let t=[],r=null,n=0;for(let s=0;s<e.length;s+=1){let i=e[s];if(r){if(i==="\\")s+=1;else if(i===r)r=null;continue}if(i==="\\")s+=1;else if(i==='"'||i==="'")r=i;else if(i==="[")n+=1;else if(i==="]")n=Math.max(0,n-1);else if(i==="&"&&n===0)t.push(s)}return t}function Lu(e,t){return Em(e).length>0?HJ(e,t):null}function HJ(e,t){let r="",n=0;for(let s of Em(e))r+=e.slice(n,s)+t,n=s+1;return r+e.slice(n)}function Ml(e){let t=[],r=0,n=null,s=0;for(let o=0;o<e.length;o+=1){let a=e[o];if(n){if(a==="\\")o+=1;else if(a===n)n=null;continue}if(a==='"'||a==="'")n=a;else if(a==="("||a==="[")r+=1;else if(a===")"||a==="]")r=Math.max(0,r-1);else if(a===","&&r===0)t.push(e.slice(s,o)),s=o+1}t.push(e.slice(s));let i=t.flatMap((o)=>{let a=o.trim();return a===""?[]:[a]});return i.length>0?i:[e]}function $n(e){let t=/^\(\s*prefers-color-scheme\s*:\s*(light|dark)\s*\)$/.exec(e.trim())?.[1];return t==="light"||t==="dark"?t:null}function Pm(e,t){if(e===":root"||e==="html")return{auto:`${e}:where(:not([${xn}]))`,forced:`${e}:where([${xn}="${t}"])`};return{auto:`:where(:root:not([${xn}])) ${e}`,forced:`:where(:root[${xn}="${t}"]) ${e}`}}function Ys(e){return e.startsWith(":")||e.startsWith(".")||e.startsWith("&")||e.startsWith("[")}function jm(e){return e.startsWith("--")?e:jr(e)}function Du(e){let t=2166136261;for(let r=0;r<e.length;r+=1)t^=e.charCodeAt(r),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function o$(e,t,r){let n=r.map(([i,o])=>`${i}: ${o}`).join("; "),s=t===null?n:`${t} { ${n} }`;for(let i=e.length-1;i>=0;i-=1)s=`${e[i]} { ${s} }`;return s}function zJ(e,t,r){let n=r.map(({selector:i,declarations:o})=>`${i} { ${o.map(([a,l])=>`${a}: ${l}`).join("; ")} }`).join(" "),s=`@keyframes ${t} { ${n} }`;for(let i=e.length-1;i>=0;i-=1)s=`${e[i]} { ${s} }`;return s}function GJ(e){let t=Object.keys(e).filter((n)=>Dl(n));if(t.length===0)return e;let r={...e};for(let n of t)delete r[n];return r}function KJ(e){let r=Em(e).at(-1),n=r===void 0?e:e.slice(r+1);return n===""||n.startsWith(":")||n.startsWith(".")||n.startsWith("[")}function Yo(e,t={}){let{scope:r=null,mediaQueries:n={},transposeValue:s=(b)=>b,transposeSelector:i=(b)=>b,resolveValue:o}=t,a=[],l=(b)=>b!==null&&typeof b==="object"&&!Array.isArray(b)&&!qe(b),c=(b,w)=>{if(l(w))return[w];if(!Jl(b)||!Array.isArray(w)||w.length===0)return[];return w.every((j)=>l(j))?w:[]},u=(b,w,j,S)=>{if(w===void 0||w===null)return null;if(qe(w))return j?o?.(b,w,S)??null:null;if(V(w))return null;let E=String(w);if(be(E))return j?o?.(b,E,S)??null:null;return s(E)},p=(b,w,j=!0,S="self")=>{let E=[];for(let[P,R]of Object.entries(b)){if(c(P,R).length>0)continue;if(w&&(P.startsWith("@")||Ys(P)))continue;if(P.startsWith("$"))continue;let N=u(P,R,j,S);if(N!==null)E.push([jm(P),N])}return E},h=(b,w,j,S,E)=>{if(j.length===0)return;let P=w;if(P!==null){let _=i(P);if(_===null)return;P=_}let R=o$(b,P,j),N={text:R,conditions:[...b],selector:P,declarations:j,target:S,key:Du(R)};if(A(E)&&E!=="")N.description=E;a.push(N)},m=(b,w,j)=>{let S=b.slice(10).trim();if(S==="")return;let E=[];for(let[R,N]of Object.entries(w)){if(!l(N))continue;let _=p(N,!0,!1,"unscoped");if(_.length>0)E.push({declarations:_,selector:R.trim()})}if(E.length===0)return;let P=zJ(j,S,E);a.push({blocks:E,conditions:[...j],declarations:[],key:Du(P),selector:null,target:"unscoped",text:P})},y=(b,w,j,S,E)=>{if(b==="@--")return;if(Jl(b)){h([...S,b],null,p(w,!1,!0,"unscoped"),"unscoped",w.$description);return}if(Dl(b)){m(b,w,S);return}let P=s$(b,n),R=P===null?b:`@media ${P}`,N=P===null?null:$n(P);if(N!==null&&j!==null){let{auto:_,forced:q}=Pm(j,N);g(w,_,[...S,R],E),g(GJ(w),q,S,E);return}g(w,j,[...S,R],E)};function g(b,w,j,S){h(j,w,p(b,!0,!0,S),S,b.$description);for(let[E,P]of Object.entries(b))for(let R of c(E,P))if(E.startsWith("@"))y(E,R,w,j,S);else if(w!==null)g(R,i$(w,E),j,KJ(E)?S:"descendant")}return g(e,r,[],"self"),a}var WJ,xn="data-color-scheme",Fu="jx-color-scheme";var Ll=M(()=>{ye();WJ=new Set(["all","print","screen","speech"])});function c$(){return`the Intl helpers ${_m.join(", ")}`}var Tn="en-US",km="UTC",a$,_m,l$;var Am=M(()=>{a$=[{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."}],_m=a$.map((e)=>e.path),l$=Object.fromEntries(a$.map((e)=>[e.path,e.params.indexOf("locale")]))});function XJ(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function dr(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function js(e){if(e==="")return[];return e.split("/").map((t)=>XJ(t))}function Ht(e,t){let r=e;for(let n of js(t))r=r?.[n];return r}function Ve(e,t){let r=e;for(let n of js(t))r+=Rm.test(n)?`.${n}`:`[${JSON.stringify(n)}]`;return r}function u$(e,t){let r=e;for(let[n,s]of js(t).entries()){let i=n===0?"":"?.";r+=Rm.test(s)?`${n===0?".":i}${s}`:`${i}[${JSON.stringify(s)}]`}return r}function ks(e){return Rm.test(e)?e:JSON.stringify(e)}function f$(e){let t=e.replaceAll(/[^A-Za-z0-9_$]/g,"_");if(t==="")return"ref";return/^\d/.test(t)?`_${t}`:t}var Rm;var Zo=M(()=>{Rm=/^[A-Za-z_$][A-Za-z0-9_$]*$/});function Om(e){let t=e.$map;return V(t)?t:void 0}function h$(e){return V(e)&&!Array.isArray(e)&&"operator"in e}function Fl(e){return V(e)&&!Array.isArray(e)&&"$ref"in e}function eM(e,t,r){let n=l$[e];if(n===void 0||n<0||t[n]!=null)return t;let s=Ht(r.$page,"locale");if(!A(s)||s==="")return t;let i=[...t];return i[n]=s,i}function x$(e){return e.startsWith("window#/")&&ZJ.has(e.slice(8))}function _s(e){return g$.has(e)}function lt(e,t){if(!e)return;let r=(e.depth??0)+1;if(r>tM)return;return{depth:r,path:[...e.path??[],...Array.isArray(t)?t:[t]],report:e.report}}function nt(e,t,r,n,s){if(e===null||e===void 0)return e;if(h$(e))return Wr(e,t,r,n,s);if(Fl(e)){let i=qu(e.$ref,t,r,n);return s?.report(s.path??[],i),i}if(Array.isArray(e))return $$(e,t,r,n,s);return s?.report(s.path??[],e),e}function $$(e,t,r,n,s){return e.map((i,o)=>nt(i,t,r,n,lt(s,o)))}function rM(e,t,r,n){let s=(i)=>{if(!e.slice(i.length).includes("/"))return t;return qu(e.slice(0,e.lastIndexOf("/")),t,r,n)};if(e.startsWith("#/state/"))return s("#/state/");if(e.startsWith("parent#/"))return s("parent#/");if(e.startsWith("$map/")||e.startsWith("$args/"))return e.split("/").length>2?qu(e.slice(0,e.lastIndexOf("/")),t,r,n):void 0;return}function qu(e,t,r,n){if(e==="$reduce/acc")return n?.acc;if(e.startsWith("$reduce/"))return n?.acc;if(e.startsWith("$args/")){let s=e.slice(6).split("/"),i=n?.args?.[s[0]];return s.length>1?Ht(i,s.slice(1).join("/")):i}if(e.startsWith("event#/")){let s=e.slice(7);return Ht(r,s)}if(e.startsWith("$map/")){let s=e.split("/"),[,i]=s,o,a=Om(t);if(i==="item")o=n?.item??a?.item??t["$map/item"];else if(i==="index")o=n?.index??a?.index??t["$map/index"];else o=a?.[i]??t[`$map/${i}`];return s.length>2?Ht(o,s.slice(2).join("/")):o}if(e.startsWith("#/state/"))return Ht(t,e.slice(8));if(e.startsWith("parent#/"))return Ht(t,e.slice(8));if(e.startsWith("window#/"))return Ht(globalThis.window,e.slice(8));if(e.startsWith("document#/"))return Ht(globalThis.document,e.slice(10));return Ht(t,e)??null}function nM(e,t,r,n){if(e.startsWith("$map/")){let s=e.split("/"),[,i]=s,o,a=Om(t);if(i==="item")o=n?.item??a?.item??t["$map/item"];else if(i==="index")o=n?.index??a?.index??t["$map/index"];else o=a?.[i]??t[`$map/${i}`];if(s.length>2){let l=s.slice(2),c=l.pop(),u=l.length>0?Ht(o,l.join("/")):o;return{key:c,obj:u}}return{key:i==="item"?"$map/item":"$map/index",obj:Om(t)??t}}if(e.startsWith("#/state/")){let s=e.slice(8);if(s.indexOf("/")===-1)return{key:s,obj:t};let o=js(s),a=o.pop(),l=t;for(let c of o)l=l[c];return{key:a,obj:l}}return{key:e,obj:t}}function Wr(e,t,r,n,s){let i=sM(e,t,r,n,s);return s?.report(s.path??[],i),i}function p$(e,t,r){switch(e){case"+":return t+r;case"-":return t-r;case"*":return t*r;case"/":return t/r;case"%":return t%r;case"<":return t<r;case"<=":return t<=r;case">":return t>r;default:return t>=r}}function sM(e,t,r,n,s){let{operator:i,target:o,value:a,initial:l}=e;if(!YJ.has(i))throw Error(`$expression: unknown operator "${i}"`);if(Nm.has(i)&&!("value"in e)){let c=nt(o,t,r,n,lt(s,"target"));if(i==="!")return!c;if(i==="-")return-c}if(i==="call"){let c=Fl(o)?o.$ref:void 0;if(!A(c))throw TypeError("$expression: call target must be a $ref pointer");let u=(n?.callDepth??0)+1;if(u>d$)throw Error(`$expression: call depth exceeded (${d$})`);let p=Array.isArray(a)?a.map((m,y)=>nt(m,t,r,n,lt(s,["value",y]))):[];if(c.startsWith("window#/")){if(!x$(c))throw Error(`$expression: "${c}" is not a blessed pure global`);let m=c.slice(8),y=QJ.get(m);if(y)return y(...eM(m,p,t));let g=Ht(globalThis.window,m),b=m.lastIndexOf("/"),w=b===-1?globalThis.window:Ht(globalThis.window,m.slice(0,b));return g.apply(w,p)}let h=qu(c,t,r,n);if(Vt(h))return h.apply(rM(c,t,r,n),p);if(V(h)&&"$expression"in h){let m=h,y={};for(let[g,b]of(m.parameters??[]).entries()){let w=A(b)?b:b?.name??"";if(!w)continue;y[w]=p[g]===void 0&&V(b)&&"default"in b?b.default:p[g]}return Wr(m.$expression,t,r,{args:y,callDepth:u})}throw TypeError(`$expression: call target "${c}" is not callable`)}if(Im.has(i)){if(i==="?:"){let m=nt(o,t,r,n,lt(s,"target"));if(s){let y=nt(a,t,r,n,lt(s,"value")),g=nt(l,t,r,n,lt(s,"initial"));return m?y:g}return m?nt(a,t,r,n):nt(l,t,r,n)}let c=nt(o,t,r,n,lt(s,"target")),u=String(c),p=e.cases??{},h=Object.hasOwn(p,u);if(s){let m;for(let[g,b]of Object.entries(p)){let w=nt(b,t,r,n,lt(s,["cases",g]));if(g===u)m=w}let y=nt(e.default,t,r,n,lt(s,"default"));return h?m:y}return h?nt(p[u],t,r,n):nt(e.default,t,r,n)}if(Cm.has(i)){let c=nt(o,t,r,n,lt(s,"target")),u=nt(a,t,r,n,lt(s,"value"));switch(i){case"===":return c===u;case"!==":return c!==u;case"&&":return c&&u;case"||":return c||u;case"??":return c??u;default:return p$(i,c,u)}}if(y$.has(i)){let c=nt(a,t,r,n,lt(s,"value")),{obj:u,key:p}=nM(o.$ref,t,r,n);u[p]=i==="="?c:p$(i.slice(0,-1),u[p],c);return}if(b$.has(i)){let c=nt(o,t,r,n,lt(s,"target"));switch(i){case"push":return c.push(nt(a,t,r,n,lt(s,"value")));case"unshift":return c.unshift(nt(a,t,r,n,lt(s,"value")));case"pop":return c.pop();case"shift":return c.shift();case"splice":{let u=nt(a,t,r,n,lt(s,"value"));return c.splice(...u)}default:break}}if(Jm.has(i)){let c=nt(o,t,r,n,lt(s,"target")),u=a===void 0?[]:Array.isArray(a)?$$(a,t,r,n,lt(s,"value")):[nt(a,t,r,n,lt(s,"value"))],p=Ht(c,i);if(!Vt(p))return;return p.apply(c,u)}if(Tm.has(i)){let c=nt(o,t,r,n,lt(s,"target")),u=a;if(i==="reduce"){let p=nt(l,t,r,n,lt(s,"initial"));for(let[h,m]of c.entries())p=Wr(u,t,r,{acc:p,index:h,item:m},h===0?lt(s,"value"):void 0);return p}if(i==="map")return c.map((p,h)=>Wr(u,t,r,{...n,index:h,item:p},h===0?lt(s,"value"):void 0));if(i==="filter")return c.filter((p,h)=>Wr(u,t,r,{...n,index:h,item:p},h===0?lt(s,"value"):void 0))}return}function ut(e,t){if(e===null)return"null";if(e===void 0)return"undefined";if(h$(e))return pr(e,t);if(Fl(e))return Mm(e.$ref,t);if(Array.isArray(e))return e.map((r)=>ut(r,t)).join(", ");return JSON.stringify(e)}function iM(e){return`_fx_${e.replaceAll(/[^A-Za-z0-9_$]/g,"_")}`}function Mm(e,t){let r=t.statePrefix??"state",n=t.eventParam??"event";if(e==="$reduce/acc")return"_acc";if(e.startsWith("$reduce/"))return"_acc";if(e.startsWith("$args/"))return Ve("_args",e.slice(6));if(e.startsWith("event#/"))return Ve(n,e.slice(7));if(e.startsWith("$map/")){let s=e.split("/"),[,i]=s;if(i==="item")return s.length>2?Ve("_item",s.slice(2).join("/")):"_item";if(i==="index")return"_index";return`_${i}`}if(e.startsWith("#/state/"))return Ve(r,e.slice(8));if(e.startsWith("parent#/"))return Ve(r,e.slice(8));if(e.startsWith("window#/"))return Ve("window",e.slice(8));if(e.startsWith("document#/"))return Ve("document",e.slice(10));return Ve(r,e)}function m$(e,t){if(Fl(e))return Mm(e.$ref,t);return ut(e,t)}function oM(e,t,r){let n=(o)=>t[o]??"undefined",s=`(${r.statePrefix??"state"}?.$page?.locale ?? ${JSON.stringify(Tn)})`,i=JSON.stringify(km);switch(e){case"Intl/formatNumber":return`new Intl.NumberFormat(${n(1)} ?? ${s}, ${n(2)}).format(${n(0)})`;case"Intl/formatDate":return`new Intl.DateTimeFormat(${n(1)} ?? ${s}, {timeZone: ${i}, ...${n(2)}}).format(new Date(${n(0)}))`;case"Intl/formatRelativeTime":return`new Intl.RelativeTimeFormat(${n(2)} ?? ${s}, ${n(3)}).format(${n(0)}, ${n(1)})`;case"Intl/formatList":return`new Intl.ListFormat(${n(1)} ?? ${s}, ${n(2)}).format(${n(0)})`;case"Intl/plural":return`new Intl.PluralRules(${n(1)} ?? ${s}, ${n(2)}).select(${n(0)})`;case"Intl/compare":return`new Intl.Collator(${n(2)} ?? ${s}, ${n(3)}).compare(${n(0)}, ${n(1)})`;case"Intl/displayName":return`new Intl.DisplayNames(${n(2)} ?? ${s}, {...${n(3)}, type: ${n(1)} ?? 'language'}).of(${n(0)})`;case"Intl/segment":return`[...new Intl.Segmenter(${n(2)} ?? ${s}, {granularity: ${n(1)} ?? 'grapheme'}).segment(${n(0)})].map((p) => p.segment)`;default:return null}}function pr(e,t={}){let{operator:r,target:n,value:s,initial:i}=e;if(Nm.has(r)&&!("value"in e)){let o=ut(n,t);if(r==="!")return`!(${o})`;if(r==="-")return`-(${o})`}if(r==="call"){let o=(Fl(n)?n.$ref:void 0)??"",a=Array.isArray(s)?s.map((l)=>ut(l,t)):[];if(o.startsWith("window#/")){if(!x$(o))throw Error(`$expression: "${o}" is not a blessed pure global`);let l=oM(o.slice(8),a,t);if(l)return l;return`window.${o.slice(8).replaceAll("/",".")}(${a.join(", ")})`}if(o.startsWith("#/state/")){let l=o.slice(8),c=t.formulaParams?.[l];if(c){let u=c.map((p,h)=>`${JSON.stringify(p)}: ${a[h]??"undefined"}`).join(", ");return`${iM(l)}(${t.statePrefix??"state"}, { ${u} })`}}return`${Mm(o,t)}(${a.join(", ")})`}if(Im.has(r)){if(r==="?:"){let c=ut(n,t),u=ut(s,t),p=ut(i,t);return`(${c} ? ${u} : ${p})`}let o=ut(n,t),a=Object.entries(e.cases??{}).map(([c,u])=>`_d === ${JSON.stringify(c)} ? ${ut(u,t)} : `).join(""),l="default"in e?ut(e.default,t):"undefined";return`((_d) => ${a}${l})(String(${o}))`}if(Cm.has(r)){let o=ut(n,t),a=ut(s,t);return`(${o} ${r} ${a})`}if(y$.has(r)){let o=m$(n,t),a=ut(s,t);return`${o} ${r} ${a}`}if(b$.has(r)){let o=m$(n,t);switch(r){case"push":return`${o}.push(${ut(s,t)})`;case"unshift":return`${o}.unshift(${ut(s,t)})`;case"pop":return`${o}.pop()`;case"shift":return`${o}.shift()`;case"splice":{let a=Array.isArray(s)?s.map((l)=>ut(l,t)).join(", "):ut(s,t);return`${o}.splice(${a})`}default:break}}if(Jm.has(r)){let o=ut(n,t),a=s===void 0?"":Array.isArray(s)?s.map((l)=>ut(l,t)).join(", "):ut(s,t);return`(${o})?.${r}?.(${a})`}if(Tm.has(r)){let o=ut(n,t),a=pr(s,t);if(r==="reduce"){let l=ut(i,t);return`${o}.reduce((_acc, _item, _index) => ${a}, ${l})`}if(r==="map")return`${o}.map((_item, _index) => ${a})`;if(r==="filter")return`${o}.filter((_item, _index) => ${a})`}return"undefined"}function Qo(e,t,r,n){return nt(e,t,r,n)}function As(e,t={}){return ut(e,t)}var g$,Nm,Cm,y$,b$,Tm,Im,Jm,YJ,ZJ,QJ,d$=64,tM=64;var ql=M(()=>{Am();ye();Zo();g$=new Set(["=","+=","-=","*=","/=","push","pop","shift","unshift","splice"]),Nm=new Set(["!","-"]),Cm=new Set(["+","-","*","/","%","===","!==","<","<=",">",">=","&&","||","??"]),y$=new Set(["=","+=","-=","*=","/="]),b$=new Set(["push","pop","shift","unshift","splice"]),Tm=new Set(["reduce","map","filter"]),Im=new Set(["?:","switch"]),Jm=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"]),YJ=new Set([...g$,...Nm,...Cm,...Tm,...Im,...Jm,"call"]),ZJ=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",..._m]),QJ=new Map([["Intl/compare",(e,t,r,n)=>new Intl.Collator(r??Tn,n).compare(e,t)],["Intl/displayName",(e,t,r,n)=>new Intl.DisplayNames(r??Tn,{...n,type:t??"language"}).of(e)],["Intl/formatDate",(e,t,r)=>new Intl.DateTimeFormat(t??Tn,{timeZone:km,...r}).format(new Date(e))],["Intl/formatList",(e,t,r)=>new Intl.ListFormat(t??Tn,r).format(e)],["Intl/formatNumber",(e,t,r)=>new Intl.NumberFormat(t??Tn,r).format(e)],["Intl/formatRelativeTime",(e,t,r,n)=>new Intl.RelativeTimeFormat(r??Tn,n).format(e,t)],["Intl/plural",(e,t,r)=>new Intl.PluralRules(t??Tn,r).select(e)],["Intl/segment",(e,t,r)=>[...new Intl.Segmenter(r??Tn,{granularity:t??"grapheme"}).segment(e)].map((n)=>n.segment)]])});function w$(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 aM(e){return(V(e)||Vt(e))&&"then"in e&&Vt(e.then)}async function ea(e,t,r,n={}){let s=n.args?{args:n.args}:void 0;for(let i of e){let o=w$(i);switch(o.kind){case"expression":{let a=Wr(o.node,t,r,s);if(aM(a))await a;break}case"if":{let a=o.node,l=Qo(a.if,t,r,s)?a.then:a.else;if(Array.isArray(l))await ea(l,t,r,n);break}case"switch":{let a=o.node,l=String(Qo(a.$switch,t,r,s)),c=a.cases??{},u=Object.hasOwn(c,l)?c[l]:a.default;if(Array.isArray(u))await ea(u,t,r,n);break}case"dispatch":{let a=o.node,l=Vt(n.target)?n.target():n.target,c=r?.currentTarget??l;if(!c)break;let u={};if("detail"in a)u.detail=Qo(a.detail,t,r,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":{r?.stopPropagation();break}case"preventDefault":{r?.preventDefault();break}default:break}}}function en(e,t={}){let r=t.indent??"",n=[];for(let s of e){let i=w$(s);switch(i.kind){case"expression":{n.push(`${r}${pr(i.node,t)};`);break}case"if":{let o=i.node,a=As(o.if,t),l={...t,indent:`${r} `};if(n.push(`${r}if (${a}) {`,en(o.then??[],l)),o.else)n.push(`${r}} else {`,en(o.else,l));n.push(`${r}}`);break}case"switch":{let o=i.node,a=As(o.$switch,t),l={...t,indent:`${r} `};n.push(`${r}switch (String(${a})) {`);for(let[c,u]of Object.entries(o.cases??{}))n.push(`${r} case ${JSON.stringify(c)}: {`,en(u,l),`${r} break;`,`${r} }`);if(o.default)n.push(`${r} default: {`,en(o.default,l),`${r} }`);n.push(`${r}}`);break}case"dispatch":{let o=i.node,a=t.eventParam??"event",l=t.dispatchTarget??`(${a} && ${a}.currentTarget)`,c=[];if("detail"in o)c.push(`detail: ${As(o.detail,t)}`);if(o.bubbles!==void 0)c.push(`bubbles: ${JSON.stringify(o.bubbles)}`);if(o.composed!==void 0)c.push(`composed: ${JSON.stringify(o.composed)}`);let u=c.length>0?`, { ${c.join(", ")} }`:"";n.push(`${r}${l}?.dispatchEvent(new CustomEvent(${JSON.stringify(o.dispatchEvent)}${u}));`);break}case"stopPropagation":{n.push(`${r}${t.eventParam??"event"}?.stopPropagation();`);break}case"preventDefault":{n.push(`${r}${t.eventParam??"event"}?.preventDefault();`);break}default:break}}return n.join(`
126
+ `)}var Vu=M(()=>{ye();ql()});var Dm=M(()=>{ye()});function ta(e){if(!e.startsWith("${")||!e.endsWith("}"))return!1;let t=0;for(let r=1;r<e.length;r+=1){let n=e[r];if(n==="{")t+=1;else if(n==="}"){if(t-=1,t===0)return r===e.length-1}}return!1}function S$(){return[...v$].toSorted()}function so(e,t){let r=e.toLowerCase();if(r.startsWith("aria-")||v$.has(r))return String(t);return t?"":null}var Rs,v$,Lm=32,Bu,Wu="jx-slot",Vl="data-jx-slots",Fm="jx.slot.group",Xte;var ra=M(()=>{Ll();ql();Zo();ye();Il();Vr();Vu();Dm();Dm();Ll();Rs=new Set(["$schema","$id","$defs","state","$ref","$props","$elements","$title","$description","$switch","$prototype","$src","$export","$media","$map","timing","default","description","body","parameters","arguments","name","tagName","children","style","attributes","items","map","filter","sort","cases","observedAttributes"]),v$=new Set(["contenteditable","draggable","spellcheck"]);Bu=/^[\t\n\f\r ]+$/u,Xte=(()=>{let e=Symbol.for(Fm),t=globalThis;return t[e]??=new WeakMap,t[e]})()});function E$(e,t,r,n,s=uM){let i=[],o=(p,h)=>{let m={mediaQueries:t,scope:h,transposeValue:r};if(n)m.resolveValue=(y,g)=>n(y,g,h);for(let y of Yo(p,m))i.push(y.text)},a={},l={},c=[],u=[];for(let[p,h]of Object.entries(e)){if(V(h)&&!Array.isArray(h)){if(p.startsWith("@"))c.push([p,h]);else if(!p.startsWith("--"))u.push([p,h]);continue}if(Ys(p)||p.startsWith("@"))continue;if(p.startsWith("--")||p==="colorScheme"||p==="color-scheme")a[p]=h;else l[p]=h}o(a,s.root),o(l,s.body);for(let[p,h]of u)if(p.startsWith("&"))o({[p]:h},s.root);else o(h,p);for(let[p,h]of c){if(Jl(p)||Dl(p)){o({[p]:h},null);continue}let m={},y={},g=[];for(let[b,w]of Object.entries(h)){if(V(w)&&!Array.isArray(w)){if(!b.startsWith("@"))g.push([b,w]);continue}if(b.startsWith("--"))m[b]=w;else y[b]=w}o({[p]:m},s.root),o({[p]:y},s.body);for(let[b,w]of g)o({[p]:w},b)}if(Object.values(t).some((p)=>$n(p)!==null)&&!("colorScheme"in e))i.push(`${s.root} { color-scheme: light dark }`,`${s.root}:where([${xn}="light"]) { color-scheme: light }`,`${s.root}:where([${xn}="dark"]) { color-scheme: dark }`);return i.join(`
127
+ `)}var uM;var P$=M(()=>{Ll();ye();uM={body:"body",root:":root"}});function j$(e){return e===!1||e==="open"||e==="closed"}function io(e,t){let r=e?.$shadow;if(j$(r))return r===!1?null:r;let n=t?.shadow;return j$(n)&&n!==!1?n:null}function k$(e,t){return t===null?e:":host"}function Wl(e,t){let r=[];for(let[n,s]of(e.parameters??[]).entries()){let i=_$(s);if(!i)continue;let o=A$(s)?`_a[${n}] === undefined ? ${JSON.stringify(s.default)} : _a[${n}]`:`_a[${n}]`;r.push(`${JSON.stringify(i)}: ${o}`)}return`(..._a) => { const _args = { ${r.join(", ")} }; return ${t}; }`}function _$(e){return A(e)?e:e?.name??""}function A$(e){return V(e)&&"default"in e}function zu(e,t){let r=Um(e,t);return r===e?e:`${r} as ${e}`}function Um(e,t){let r=t?.$export;return A(r)&&r!==""?r:e}function Gu(e,t,r={}){let{statePrefix:n="state",indent:s="",collect:i}=r,{url:o}=t,a=be(o),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)":o}`,i?`${i}.push(effect(() => {`:"effect(() => {"];if(a)c.push(` const url = \`${dM(o,n)}\`;`,' if (!url || url === "undefined" || url.includes("undefined")) return;');else c.push(` const url = ${JSON.stringify(o)};`);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 h=V(t.body)?JSON.stringify(JSON.stringify(t.body)):JSON.stringify(t.body);u.push(`body: ${h}`)}let p=u.length>0?`, { ${u.join(", ")} }`:"";return c.push(` fetch(url${p})`," .then(r => r.ok ? r.json() : Promise.reject(r.statusText))",` .then(d => { ${n}.${e} = d; })`,` .catch(e => { ${n}.${e} = { error: String(e) }; });`,i?"}));":"});"),c.map((h)=>`${s}${h}`).join(`
128
+ `)}function Ku(e,t,r={}){let{statePrefix:n="state",indent:s="",collect:i,serverBaseUrl:o="/_jx/server"}=r,a=JSON.stringify(`${o}/${t.$export}`),l=Object.entries(t.arguments??{}),c=l.map(([g,b])=>{if(!qe(b))return`${ks(g)}: ${JSON.stringify(b)}`;if(fM.some((w)=>b.$ref.startsWith(w)))throw Error(`Server function "${e}": argument "${g}" references "${b.$ref}", which a state entry cannot read. Use a #/state/, parent#/, window#/ or document#/ reference.`);return`${ks(g)}: ${As({$ref:b.$ref},{statePrefix:n})}`}),u=l.some(([,g])=>qe(g)),p=`${J$}(${a}, ${c.length>0?`{ ${c.join(", ")} }`:"{}"})`,h=Ve(n,dr(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;",i?` ${i}.push(effect(() => {`:" effect(() => {"," const _seq = ++_jxSeq;",` ${p}`,` .then((d) => { if (_seq === _jxSeq) ${h} = d; })`,` .catch((e) => { if (_seq === _jxSeq) ${m}; });`,i?" }));":" });","}"]:[`// ${e}: server function ${t.$export}, called once`,p,` .then((d) => { ${h} = d; })`,` .catch((e) => { ${m}; });`]).map((g)=>`${s}${g}`).join(`
129
+ `)}function dM(e,t){if(t==="state")return e;return e.replaceAll(/\$\{([^}]*)\}/g,(r,n)=>`\${${n.replaceAll(/(?<!this\.)\bstate\./g,`${t}.`)}}`)}function Xu(e){if(!V(e))return!1;if(e.state)for(let[t,r]of Object.entries(e.state)){if(t==="$site"||t==="$page")continue;if(!V(r)||Array.isArray(r))return!0;if(r.timing==="compiler")continue;if(r.$prototype)return!0;if("default"in r)return!0;if(Ls(r))continue;return!0}if(e.$switch)return!0;if(dt(e)||lp(e.children))return!0;if(Array.isArray(e.children)&&e.children.some((t)=>Xu(t)))return!0;for(let[t,r]of Object.entries(e)){if(Rs.has(t))continue;if(qe(r))return!0;if(be(r))return!0}if(V(e.style)){for(let t of Object.values(e.style))if(be(t))return!0}if(V(e.attributes)){for(let t of Object.values(e.attributes))if(be(t))return!0}return!1}function O$(e){if(!V(e))return!1;if(e.$switch)return!0;if(dt(e)||lp(e.children))return!0;for(let[t,r]of Object.entries(e)){if(Rs.has(t))continue;if(qe(r))return!0;if(be(r))return!0}if(V(e.style)){for(let t of Object.values(e.style))if(be(t))return!0}if(V(e.attributes)){for(let t of Object.values(e.attributes))if(be(t))return!0}return!1}function aa(e,t=null,r={},n={}){let s=e?.state?na(e.state,t):t??N$();return{media:n,scope:s,scopeDefs:r}}function N$(e=null){return Object.create(e)}function C$(e){return e[R$]}function yM(e,t,r){if(t>0&&hM.test(e.charAt(t-1)))return!1;let n=t+5;if(r)return!gM.test(e.charAt(n));while(/\s/u.test(e.charAt(n)))n+=1;return e.charAt(n)==="."}function la(e,t,r={}){if(!e.includes("state"))return e;let n=r.bare===!0,s=r.code===!1?e:Ti(e),i="",o=0;for(let a=s.indexOf("state");a!==-1;a=s.indexOf("state",a+1))if(yM(s,a,n))i+=e.slice(o,a)+t,o=a+5;return i+e.slice(o)}function Bm(e,t){if(A(e)){if(!e.includes("state."))return;let i=Ti(e);for(let o of i.matchAll(pM))t.add(o[1]);for(let o of i.matchAll(mM))t.add(o[1]);return}if(Array.isArray(e)){for(let i of e)Bm(i,t);return}if(!V(e))return;let r=e,{operator:n,target:s}=r;if(A(n)&&_s(n)&&qe(s)&&s.$ref.startsWith("#/state/"))t.add(s.$ref.slice(8).split("/")[0]);for(let i of Object.values(r))Bm(i,t)}function ei(e,t){if(Bt(t)&&Sm(t))throw Error(`${e} declares both "body" and "$src"; they are mutually exclusive (spec.md §5.3 4d). Keep one.`)}function na(e={},t=null){let r=N$(t),n=t?C$(t):void 0,s=new Set(n);Object.defineProperty(r,R$,{configurable:!0,enumerable:!1,value:s,writable:!0});let i=new Set;for(let u of Object.values(e))if(Bt(u)||Dr(u))Bm(u.body??u.$expression,i);for(let u of i)if(u in e)s.add(u);let o=no({state:e});for(let[u,p]of Object.entries(e)){if(!V(p)||Array.isArray(p)){Os(r,u,Uu(p));continue}if("default"in p){Os(r,u,Uu(p.default));continue}if(ds(p)){s.add(u);continue}if(!p.$prototype&&!("$expression"in p)&&!Ls(p))Os(r,u,Uu(p))}let a=[],l=[];for(let[u,p]of Object.entries(e)){if(be(p)){a.push([u,p]);continue}if(!V(p))continue;if(Dr(p)){let h=p.$expression;if(Ci(p)){let m=p.parameters;Os(r,u,(...y)=>{let g={};for(let[b,w]of m.entries()){let j=_$(w);if(!j)continue;g[j]=y[b]===void 0&&A$(w)?w.default:y[b]}return Wr(h,r,null,{args:g})})}else if(_s(h.operator))Os(r,u,(m,y)=>Wr(h,m,y));else qm(r,u,()=>Wr(h,r,null));continue}if(Bt(p)){if(ei(`state entry "${u}"`,p),Pn(p)){let{body:h}=p;Os(r,u,(m,y)=>{ea(h,m??r,y??null)})}else if(A(p.body)){let{body:h}=p,m=Function(...Cn(p),h);if(o.get(u)==="computed")qm(r,u,()=>m(r)),l.push([u,h]);else Os(r,u,m)}else Os(r,u,()=>{}),s.add(u);continue}if(jn(p)&&(p.$prototype==="LocalStorage"||p.$prototype==="SessionStorage")){Os(r,u,Uu(p.default??null));continue}if(jn(p)&&p.$prototype==="Request")s.add(u)}let c=!0;while(c){c=!1;for(let[u,p]of[...l,...a])if(!s.has(u)&&T$(p,r))s.add(u),c=!0}for(let[u,p]of a)qm(r,u,()=>sr(p,r));return r}function Os(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0})}function qm(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:r})}function Ze(e,t){if(qe(e))return Hm(e.$ref,t);if(be(e))return sr(e,t);return e}function kr(e){return qe(e)}function Hm(e,t){if(!A(e))return e;if(e.startsWith("$map/")){let r=e.split("/"),n=r[1],i=t.$map?.[n]??t[`$map/${n}`];return r.length>2?Vm(i,r.slice(2).join("/")):i}if(e.startsWith("#/state/"))return Vm(t,e.slice(8));return Vm(t,e)??null}function T$(e,t){if(!t)return!1;let r=C$(t);for(let n of e.matchAll(/\bstate\.([A-Za-z_$][\w$]*)\s*(\()?/g)){if(n[2])continue;let s=n[1];if(r?.has(s))return!0;let i;try{i=t[s]}catch{continue}if(Vt(i))return!0}return!1}function Yu(e){return ta(e)?`(${e.slice(2,-1)})`:`\`${e}\``}function sr(e,t){if(T$(e,t))return null;let r=["state","$map","$site","$page"],n=[t,t?.$map,t?.$site,t?.$page];try{let s=ta(e)?`return (${e.slice(2,-1)})`:`return \`${e}\``;return Function(...r,s)(...n)}catch{return null}}function Vm(e,t){return Ht(e,t)}function Uu(e){if(!V(e))return e;return structuredClone(e)}function bM(e,t){if(!e||!t)return"";return Object.entries(e).filter(([r,n])=>!r.startsWith(":")&&!r.startsWith(".")&&!r.startsWith("&")&&!r.startsWith("[")&&!r.startsWith("@")&&be(n)).map(([r,n])=>{let s=Ze(n,t);return s==null?null:`${jr(r)}: ${s}`}).filter(Boolean).join("; ")}function oo(e,t,r=""){let n="",s=Ze(e.id,t),i=Ze(e.className,t),o=Ze(e.hidden,t),a=Ze(e.tabIndex,t),l=Ze(e.title,t),c=Ze(e.lang,t),u=Ze(e.dir,t);if(s)n+=` id="${_e(String(s))}"`;if(i)n+=` class="${_e(String(i))}"`;if(o)n+=" hidden";if(a!==void 0&&a!==null)n+=` tabindex="${_e(String(a))}"`;if(l)n+=` title="${_e(String(l))}"`;if(c)n+=` lang="${_e(String(c))}"`;if(u)n+=` dir="${_e(String(u))}"`;let p=[bM(e.style,t),r].filter(Boolean).join("; ");if(p)n+=` style="${_e(p)}"`;if(e.attributes)for(let[h,m]of Object.entries(e.attributes)){let y=Ze(m,t);if(Qt(y)){let g=so(h,y);if(g!==null)n+=g===""?` ${h}`:` ${h}="${_e(g)}"`;continue}if(A(y)||Ct(y))n+=` ${h}="${_e(String(y))}"`}if(e.$static)n+=" data-jx-static";else if(e.$prerendered)n+=" data-jx-prerendered";return n}function Ul(e,t=" "){return e?"":`
130
+ ${t}`}function ca(){let e=JSON.stringify(Fu),t=JSON.stringify(xn);return`(function(){try{var s=localStorage.getItem(${e});if(s==="light"||s==="dark"){document.documentElement.setAttribute(${t},s)}}catch(e){}})()`}function Hu(e,t,r,n){for(let s of Yo(t,{mediaQueries:n,resolveValue:(i,o)=>I$(i,o,r),scope:r}))e.push(s.text)}function I$(e,t,r){let n=A(t)?t:t.$ref;return xM.push({property:e,selector:r,source:n}),null}function Zu(){return`const __jxEnumAttrs = new Set(${JSON.stringify(S$())});
131
+ function ${ua}(n, v) {
132
132
  if (typeof v !== 'boolean') return v;
133
133
  const l = n.toLowerCase();
134
134
  if (l.startsWith('aria-') || __jxEnumAttrs.has(l)) return String(v);
135
135
  return v ? '' : null;
136
- }`}function Lu(){return[`async function ${p$}(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(`
137
- `)}function m$(){let e=`new RegExp(${JSON.stringify(Au.source)}, ${JSON.stringify(Au.flags)})`,t=`Symbol.for(${JSON.stringify($m)})`,r=JSON.stringify(Cl),n=JSON.stringify(Ru);return[`const __jxSlotWs = ${e};`,`const __jxSlotRec = globalThis[${t}] || (globalThis[${t}] = new WeakMap());`,`function ${km}(host) {`,` const id = host.getAttribute(${r});`," if (id === null) return Array.from(host.childNodes);",` host.removeAttribute(${r});`,` const open = ${n} + ' ' + id + ' ';`,` const close = '/' + ${n} + ' ' + 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 ${_m}(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(`
138
- `)}function Ks(e){for(let t of Am(e)){if(dt(t)){if(t.map&&Ks([t.map]))return!0;continue}if(!xr(t))continue;if(t.tagName==="slot")return!0;let r=Object.values(t.cases??{}).filter((n)=>xr(n)&&!Pr(n));if(Ks(r)||Ks(t.children))return!0}return!1}function Am(e){if(dt(e))return[e];if(!Array.isArray(e))return[];return e}function la(e,t={},r=null){let n=[],s=t$(V(r)?r:{},t,(o)=>o,d$);if(s!=="")n.push(s);if(Ys(e,n,t,"",{n:0}),n.length===0)return"";return`<style>
139
- ${Fu(n.join(`
136
+ }`}function Qu(){return[`async function ${J$}(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(`
137
+ `)}function M$(){let e=`new RegExp(${JSON.stringify(Bu.source)}, ${JSON.stringify(Bu.flags)})`,t=`Symbol.for(${JSON.stringify(Fm)})`,r=JSON.stringify(Vl),n=JSON.stringify(Wu);return[`const __jxSlotWs = ${e};`,`const __jxSlotRec = globalThis[${t}] || (globalThis[${t}] = new WeakMap());`,`function ${zm}(host) {`,` const id = host.getAttribute(${r});`," if (id === null) return Array.from(host.childNodes);",` host.removeAttribute(${r});`,` const open = ${n} + ' ' + id + ' ';`,` const close = '/' + ${n} + ' ' + 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 ${Gm}(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(`
138
+ `)}function Zs(e){for(let t of Km(e)){if(dt(t)){if(t.map&&Zs([t.map]))return!0;continue}if(!$r(t))continue;if(t.tagName==="slot")return!0;let r=Object.values(t.cases??{}).filter((n)=>$r(n)&&!kr(n));if(Zs(r)||Zs(t.children))return!0}return!1}function Km(e){if(dt(e))return[e];if(!Array.isArray(e))return[];return e}function da(e,t={},r=null){let n=[],s=E$(V(r)?r:{},t,(o)=>o,I$);if(s!=="")n.push(s);if(Qs(e,n,t,"",{n:0}),n.length===0)return"";return`<style>
139
+ ${ef(n.join(`
140
140
  `))}
141
- </style>`}function Fu(e){return e.replaceAll(/<\/(?=style)/gi,String.raw`<\/`)}function Ys(e,t,r,n="",s,i="jx"){let o=s??{n:0};if(!V(e))return;if(e.style&&!e.id&&!e.className)e.className=`${i}-${o.n}`,o.n+=1;let a=wo(e.tagName).join(", ")||"*",l=e.id?`#${e.id}`:e.className?`.${e.className.split(" ")[0]}`:a;if(e.style)Cu(t,e.style,l,r);if(Array.isArray(e.children))for(let c of e.children)Ys(c,t,r,l,o,i);if(V(e.cases))for(let c of Object.values(e.cases))Ys(c,t,r,l,o,i)}function _e(e){return String(e).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#39;")}function qu(e){return e.split("-").map((t)=>t.charAt(0).toUpperCase()+t.slice(1)).join("")}function h$(e){let t=[];return g$(e,t),t}function g$(e,t){if(!V(e))return;if(e.state){for(let[r,n]of Object.entries(e.state))if(as(n))t.push({exportName:n.$export,key:r,src:n.$src})}if(Array.isArray(e.children))for(let r of e.children)g$(r,t)}function Om(e,t){if(O(e))return e;let r=wo(e);if(r.length===0)return"div";if(!Sn(e))return r[0];let n=e.$expression,s=n.target;if(n.operator==="?:")return Ze(s,t)?n.value:n.initial;let i=Ze(s,t);return n.cases[String(i)]??n.default}function Cm(e){if(!e?.slotIds)return null;return e.slotIds.n+=1,e.slotIds.n}function Nm(e,t,r,n=null){let s=new Map;for(let i of Am(e)){let o="",a=!0,l;if(O(i)||Nt(i)||Qt(i)){if(l=r(i),Au.test(l))continue;a=l!==""}else if(dt(i))l="";else if(!xr(i))l=r(i),a=l!=="";else{let u=Ze(i.attributes?.slot,t),p=O(i.slot)?Ze(i.slot,t):null;if(O(u)&&u!=="")o=u,l=r(i);else if(O(p)&&p!==""){o=p;let{slot:h,...m}=i;l=r({...m,attributes:{...m.attributes,slot:p}})}else l=r(i)}let c=s.get(o);if(c)c.html=c.html===""?l:`${c.html}
142
- ${l}`,c.content||=a;else s.set(o,{content:a,html:l})}return{groups:s,id:n,taken:new Set}}function y$(e,t,r){for(let n of Am(e)){if(dt(n)||!xr(n))continue;if(n.tagName==="slot"){let s=Ze(n.attributes?.name,t);r.taken.add(O(s)?s:"")}y$(n.children,t,r)}}function Tm(e){let t=null,r={};for(let[n,s]of Object.entries(e??{}))if(n.startsWith("props.")&&n.length>6)t??={},t[n.slice(6)]=s;else r[n]=s;return{lifted:t,rest:r}}function Vu(e,t){if(!t)return Qo(e.state??{},null);let r={...e.state};for(let[n,s]of Object.entries(t)){let i=r[n];r[n]=V(i)&&!Array.isArray(i)&&"default"in i?{...i,default:s}:s}return Qo(r,null)}function Im(e,t){return Object.fromEntries(Object.entries(e??{}).flatMap(([r,n])=>{if(!be(n))return[];let s=Ze(n,t);return s==null?[]:[[r,s]]}))}function Nl(e,t,r,n){if(e.textContent!==void 0){let s=Ze(e.textContent,t);return s!=null?_e(String(s)):""}if(e.innerHTML){let s=Ze(e.innerHTML,t);return s!=null?String(s):e.innerHTML}if(Array.isArray(e.children))return e.children.map((s)=>ea(s,t,r,n)).join(`
143
- `);return""}function ea(e,t,r=null,n=null){if(O(e)){if(be(e)&&t){let a=sr(e,t);return a!=null?_e(String(a)):_e(e)}return _e(e)}if(Nt(e)||Qt(e))return _e(String(e));if(Array.isArray(e))return e.map((a)=>ea(a,t,r,n)).join(`
144
- `);if(!V(e))return"";if(e.$prototype==="Array")return"";if(e.$switch){let a=e.tagName??"div",l=no(e,t),c=Ze(e.$switch,t),u=c==null?void 0:e.cases?.[String(c)],p=u!==void 0&&!Pr(u)?ea(u,t,r,n):"";return`<${a}${l}>${p}</${a}>`}let s=Om(e.tagName,t);if(s==="slot"&&r){let a=Ze(e.attributes?.name,t),l=O(a)?a:"",c;if(!r.taken.has(l))r.taken.add(l),c=r.groups.get(l);let u=c?.html??"";if(u!==""&&r.id!==null)u=`<!--${Ru} ${r.id} ${encodeURIComponent(l)}-->${u}<!--/${Ru} ${r.id}-->`;if(c?.content)return y$(e.children,t,r),u;let p=Nl(e,t,r,n);return u===""?p:p===""?u:`${u}
145
- ${p}`}let i=n?.componentDefs.get(s);if(i&&n)return NJ(e,i,t,r,n);let o=no(e,t);if(Rm.has(s))return`<${s}${o}>`;return`<${s}${o}>${Nl(e,t,r,n)}</${s}>`}function NJ(e,t,r,n,s){let i=t.tagName,{lifted:o,rest:a}=Tm(e.attributes),l={...o,...e.$props},c={};for(let[_,I]of Object.entries(l))c[_]=Ze(I,r)??I;let u=Object.keys(c).length>0,p=s.path??[],h={key:JSON.stringify(c),tag:i},m=[...p.map((_)=>_.tag),i].join(" → ");if(p.some((_)=>_.tag===h.tag&&_.key===h.key))throw Error(`Component <${i}> renders itself: ${m}. A component cannot appear inside its own `+"definition with the same props — the expansion would never end.");if(p.length>=xm)throw Error(`Component nesting exceeds ${xm} levels: ${m}. A component that renders itself with changing props needs a case that stops.`);let b={...s,path:[...p,h]},{children:g}=e,y=(_)=>ea(_,r,n,s),w=ro(t,s.defaults),j=Wu(t),S=Vu(t,u?c:null),E,P=null;if(w){let _=Array.isArray(g)?g.map((I)=>y(I)).join(`
146
- `):"";E=`<template shadowrootmode="${w}"><link rel="stylesheet" href="/components/${i}.css">${Nl(t,S,null,b)}</template>${_}`}else{P=!j&&Ks(t.children)?Cm(s):null;let _=Nm(g,r,y,P);E=Nl(t,S,_,b)}let A=Object.entries(Im(t.style,S)).map(([_,I])=>`${jr(_)}: ${I}`).join("; "),R={...e};if(delete R.$props,delete R.children,R.attributes=!j&&u?{...a,"data-jx-props":JSON.stringify(c)}:a,P!==null)R.attributes={...R.attributes,[Cl]:String(P)};if(j)R.$static=!0;else R.$prerendered=!0;return`<${i}${no(R,r,A)}>${E}</${i}>`}function b$(e,t=null,r=null,n=null){return Nl(e,Vu(e,t),r,n)}function Wu(e){return Em(e)}function Em(e){if(!V(e))return!0;if(Array.isArray(e))return e.every((t)=>Em(t));if(e.$prototype)return!1;if(e.$ref)return!1;if(e.state)for(let t of Object.values(e.state)){if(!V(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)=>Em(t));if(dt(e.children))return!1;return!0}function IJ(e,t){return kl(e).map((r)=>JJ(r,t)).join(", ")}function JJ(e,t){let r=ju(e,t);if(r!==null)return r;if(e.startsWith(":host")){let n=/^:host\((.*)\)$/.exec(e)?.[1];if(t===":host")return e;return n===void 0?t:`${t}${n}`}if(t===":host"&&TJ.test(e))return e;return`${t}${e}`}function x$(e,t,r=null,n={},s=null){let i=[],o=s$(e,s);if(V(t)){let a={},l=[];for(let[c,u]of Object.entries(t))if(Be(u))a[c]=u;else if(V(u)&&!Array.isArray(u))l.push([c,u]);else if(!c.startsWith("@")&&!Gs(c))a[c]=u;Cu(i,a,o,n);for(let[c,u]of l)if(c.startsWith("@"))Cu(i,{[c]:u},o,n);else if(Gs(c))Cu(i,u,IJ(c,o),n)}if(r&&Array.isArray(r.children)){let a={n:0};for(let l of r.children)Ys(l,i,n,"",a,e)}return i.length>0?`${i.join(`
141
+ </style>`}function ef(e){return e.replaceAll(/<\/(?=style)/gi,String.raw`<\/`)}function Qs(e,t,r,n="",s,i="jx"){let o=s??{n:0};if(!V(e))return;if(e.style&&!e.id&&!e.className)e.className=`${i}-${o.n}`,o.n+=1;let a=Po(e.tagName).join(", ")||"*",l=e.id?`#${e.id}`:e.className?`.${e.className.split(" ")[0]}`:a;if(e.style)Hu(t,e.style,l,r);if(Array.isArray(e.children))for(let c of e.children)Qs(c,t,r,l,o,i);if(V(e.cases))for(let c of Object.values(e.cases))Qs(c,t,r,l,o,i)}function _e(e){return String(e).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#39;")}function tf(e){return e.split("-").map((t)=>t.charAt(0).toUpperCase()+t.slice(1)).join("")}function D$(e){let t=[];return L$(e,t),t}function L$(e,t){if(!V(e))return;if(e.state){for(let[r,n]of Object.entries(e.state))if(ds(n))t.push({exportName:n.$export,key:r,src:n.$src})}if(Array.isArray(e.children))for(let r of e.children)L$(r,t)}function Ym(e,t){if(A(e))return e;let r=Po(e);if(r.length===0)return"div";if(!kn(e))return r[0];let n=e.$expression,s=n.target;if(n.operator==="?:")return Ze(s,t)?n.value:n.initial;let i=Ze(s,t);return n.cases[String(i)]??n.default}function Zm(e){if(!e?.slotIds)return null;return e.slotIds.n+=1,e.slotIds.n}function Qm(e,t,r,n=null){let s=new Map;for(let i of Km(e)){let o="",a=!0,l;if(A(i)||Ct(i)||Qt(i)){if(l=r(i),Bu.test(l))continue;a=l!==""}else if(dt(i))l="";else if(!$r(i))l=r(i),a=l!=="";else{let u=Ze(i.attributes?.slot,t),p=A(i.slot)?Ze(i.slot,t):null;if(A(u)&&u!=="")o=u,l=r(i);else if(A(p)&&p!==""){o=p;let{slot:h,...m}=i;l=r({...m,attributes:{...m.attributes,slot:p}})}else l=r(i)}let c=s.get(o);if(c)c.html=c.html===""?l:`${c.html}
142
+ ${l}`,c.content||=a;else s.set(o,{content:a,html:l})}return{groups:s,id:n,taken:new Set}}function F$(e,t,r){for(let n of Km(e)){if(dt(n)||!$r(n))continue;if(n.tagName==="slot"){let s=Ze(n.attributes?.name,t);r.taken.add(A(s)?s:"")}F$(n.children,t,r)}}function eh(e){let t=null,r={};for(let[n,s]of Object.entries(e??{}))if(n.startsWith("props.")&&n.length>6)t??={},t[n.slice(6)]=s;else r[n]=s;return{lifted:t,rest:r}}function rf(e,t){if(!t)return na(e.state??{},null);let r={...e.state};for(let[n,s]of Object.entries(t)){let i=r[n];r[n]=V(i)&&!Array.isArray(i)&&"default"in i?{...i,default:s}:s}return na(r,null)}function th(e,t){return Object.fromEntries(Object.entries(e??{}).flatMap(([r,n])=>{if(!be(n))return[];let s=Ze(n,t);return s==null?[]:[[r,s]]}))}function Bl(e,t,r,n){if(e.textContent!==void 0){let s=Ze(e.textContent,t);return s!=null?_e(String(s)):""}if(e.innerHTML){let s=Ze(e.innerHTML,t);return s!=null?String(s):e.innerHTML}if(Array.isArray(e.children))return e.children.map((s)=>sa(s,t,r,n)).join(`
143
+ `);return""}function sa(e,t,r=null,n=null){if(A(e)){if(be(e)&&t){let a=sr(e,t);return a!=null?_e(String(a)):_e(e)}return _e(e)}if(Ct(e)||Qt(e))return _e(String(e));if(Array.isArray(e))return e.map((a)=>sa(a,t,r,n)).join(`
144
+ `);if(!V(e))return"";if(e.$prototype==="Array")return"";if(e.$switch){let a=e.tagName??"div",l=oo(e,t),c=Ze(e.$switch,t),u=c==null?void 0:e.cases?.[String(c)],p=u!==void 0&&!kr(u)?sa(u,t,r,n):"";return`<${a}${l}>${p}</${a}>`}let s=Ym(e.tagName,t);if(s==="slot"&&r){let a=Ze(e.attributes?.name,t),l=A(a)?a:"",c;if(!r.taken.has(l))r.taken.add(l),c=r.groups.get(l);let u=c?.html??"";if(u!==""&&r.id!==null)u=`<!--${Wu} ${r.id} ${encodeURIComponent(l)}-->${u}<!--/${Wu} ${r.id}-->`;if(c?.content)return F$(e.children,t,r),u;let p=Bl(e,t,r,n);return u===""?p:p===""?u:`${u}
145
+ ${p}`}let i=n?.componentDefs.get(s);if(i&&n)return $M(e,i,t,r,n);let o=oo(e,t);if(Xm.has(s))return`<${s}${o}>`;return`<${s}${o}>${Bl(e,t,r,n)}</${s}>`}function $M(e,t,r,n,s){let i=t.tagName,{lifted:o,rest:a}=eh(e.attributes),l={...o,...e.$props},c={};for(let[_,q]of Object.entries(l))c[_]=Ze(q,r)??q;let u=Object.keys(c).length>0,p=s.path??[],h={key:JSON.stringify(c),tag:i},m=[...p.map((_)=>_.tag),i].join(" → ");if(p.some((_)=>_.tag===h.tag&&_.key===h.key))throw Error(`Component <${i}> renders itself: ${m}. A component cannot appear inside its own `+"definition with the same props — the expansion would never end.");if(p.length>=Lm)throw Error(`Component nesting exceeds ${Lm} levels: ${m}. A component that renders itself with changing props needs a case that stops.`);let y={...s,path:[...p,h]},{children:g}=e,b=(_)=>sa(_,r,n,s),w=io(t,s.defaults),j=nf(t),S=rf(t,u?c:null),E,P=null;if(w){let _=Array.isArray(g)?g.map((q)=>b(q)).join(`
146
+ `):"";E=`<template shadowrootmode="${w}"><link rel="stylesheet" href="/components/${i}.css">${Bl(t,S,null,y)}</template>${_}`}else{P=!j&&Zs(t.children)?Zm(s):null;let _=Qm(g,r,b,P);E=Bl(t,S,_,y)}let R=Object.entries(th(t.style,S)).map(([_,q])=>`${jr(_)}: ${q}`).join("; "),N={...e};if(delete N.$props,delete N.children,N.attributes=!j&&u?{...a,"data-jx-props":JSON.stringify(c)}:a,P!==null)N.attributes={...N.attributes,[Vl]:String(P)};if(j)N.$static=!0;else N.$prerendered=!0;return`<${i}${oo(N,r,R)}>${E}</${i}>`}function q$(e,t=null,r=null,n=null){return Bl(e,rf(e,t),r,n)}function nf(e){return Wm(e)}function Wm(e){if(!V(e))return!0;if(Array.isArray(e))return e.every((t)=>Wm(t));if(e.$prototype)return!1;if(e.$ref)return!1;if(e.state)for(let t of Object.values(e.state)){if(!V(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)=>Wm(t));if(dt(e.children))return!1;return!0}function vM(e,t){return Ml(e).map((r)=>SM(r,t)).join(", ")}function SM(e,t){let r=Lu(e,t);if(r!==null)return r;if(e.startsWith(":host")){let n=/^:host\((.*)\)$/.exec(e)?.[1];if(t===":host")return e;return n===void 0?t:`${t}${n}`}if(t===":host"&&wM.test(e))return e;return`${t}${e}`}function V$(e,t,r=null,n={},s=null){let i=[],o=k$(e,s);if(V(t)){let a={},l=[];for(let[c,u]of Object.entries(t))if(qe(u))a[c]=u;else if(V(u)&&!Array.isArray(u))l.push([c,u]);else if(!c.startsWith("@")&&!Ys(c))a[c]=u;Hu(i,a,o,n);for(let[c,u]of l)if(c.startsWith("@"))Hu(i,{[c]:u},o,n);else if(Ys(c))Hu(i,u,vM(c,o),n)}if(r&&Array.isArray(r.children)){let a={n:0};for(let l of r.children)Qs(l,i,n,"",a,e)}return i.length>0?`${i.join(`
147
147
  `)}
148
- `:""}var EJ,a$,ta="https://esm.sh/@vue/reactivity@3.5.40",ra="https://esm.sh/lit-html@3.3.0",PJ,kJ,_J,AJ,Xs,CJ,oa="__jxAttrText",p$="__jxServerCall",km="__jxCaptureSlotted",_m="__jxDistributeSlots",aa="<!---->",Rm,TJ;var Rn=D(()=>{Zo();Al();Ol();_u();r$();ye();Go();Zo();Ol();_u();ye();EJ=["$map/","event#/","$args/","$reduce/"];a$=Symbol("jx.runtimeOnlyStateKeys");PJ=/\bstate\.([A-Za-z_$][\w$]*)\s*(?:\+\+|--|(?:\*\*|\|\||&&|\?\?|<<|>>>|>>|[-+*/%&|^])?=(?!=))/g,kJ=/\bstate\.([A-Za-z_$][\w$]*)\s*\.\s*(?:push|pop|shift|unshift|splice|sort|reverse|fill|copyWithin)\s*\(/g,_J=/[\w$.]/u,AJ=/[\w$]/u;Xs=new Set(["pre","textarea","listing","plaintext","xmp"]);CJ=[];Rm=new Set(["input","br","hr","img","meta","link","area","col","source"]);TJ=/^(?:::slotted\(|::part\()/});import{relative as MJ,sep as DJ}from"node:path";function Jl(e){return e===LJ}function ca(e,t){if(e==="/")return"/";if(t==="always")return e.endsWith("/")?e:`${e}/`;if(t==="never")return e.replace(/\/+$/,"")||"/";return e}function Bu(e,t){let r=new RegExp(`\\s${t}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s"'>]+))`,"i").exec(e);return r===null?null:r[1]??r[2]??r[3]??""}function $$(e){let t=e.search(/<\/head\s*>/i),r=t===-1?e:e.slice(0,t);for(let[n]of r.matchAll(/<meta\b[^>]*>/gi)){if(Bu(n,"name")?.trim().toLowerCase()!=="robots")continue;let s=new Set((Bu(n,"content")??"").toLowerCase().split(",").map((i)=>i.trim()));if(s.has("noindex")||s.has("none"))return!0}return!1}function w$(e){let t=e.search(/<\/head\s*>/i);return{end:t,head:t===-1?e:e.slice(0,t)}}function FJ(e,t){let r=t.trim().toLowerCase();for(let[n]of w$(e).head.matchAll(/<link\b[^>]*>/gi)){let s=(Bu(n,"rel")??"").toLowerCase().split(/\s+/),i=(Bu(n,"type")??"").split(";")[0]?.trim().toLowerCase();if(s.includes("alternate")&&i===r)return!0}return!1}function v$(e,t){let{end:r}=w$(e);if(r===-1||FJ(e,t.type))return e;let n=`<link href="${_e(t.href)}" rel="alternate" type="${_e(t.type)}">`;return`${e.slice(0,r)}${n}
149
- ${e.slice(r)}`}function S$(e,t){return new URL(`/${MJ(e,t).split(DJ).join("/")}`,"http://localhost").pathname}var LJ="/404";var Jm=D(()=>{Rn()});function E$(e,t){if(t===null||t.routing!=="prefix-always")return[];let r=[];for(let n of e){if(n.urlPattern==="/")continue;let s=n.urlPattern.split("/").find(Boolean),i=Xr(s);if(i===null||!t.locales.includes(i))r.push(n.urlPattern)}return r}function j$(e,t){if(t===null)return null;let r=e.split("/").find(Boolean),n=Xr(r);if(r===void 0||n===null||t.locales.includes(n))return null;let s=t.locales.find((i)=>i!==n&&i.split("-")[0]===n.split("-")[0]);return s===void 0?null:{meant:s,segment:r}}function qJ(e,t){let r=e.split("/").filter(Boolean),n=Xr(r[0]);if(t!==null&&n!==null&&t.locales.includes(n))return r.slice(1).join("/");return r.join("/")}function Mm(e,t){let r=new Map,n=[];if(t===null)return{conflicts:n,sets:r};let s=new Map,i=new Set;for(let o of e){let a=o.translationKey===void 0?qJ(o.urlPattern,t):o.translationKey.replaceAll(/^\/+|\/+$/g,"");if(o.translationKey!==void 0)i.add(o.urlPattern);let l=gn(o.urlPattern,t);if(l===null)continue;let c=s.get(a)??[],u=c.find((p)=>p.locale===l);if(u===void 0)c.push({locale:l,urlPattern:o.urlPattern});else n.push({declared:i.has(u.urlPattern)||o.translationKey!==void 0,key:a,locale:l,urlPatterns:[u.urlPattern,o.urlPattern]});s.set(a,c)}for(let o of s.values()){let a=o.toSorted((l,c)=>l.locale===c.locale?0:l.locale<c.locale?-1:1);for(let l of o)r.set(l.urlPattern,a)}return{conflicts:n,sets:r}}function P$(e,t,r,n){let s=new Map;if(t===null||r==="")return s;let i=new Map;for(let[o,a]of Mm(e,t).sets){if(a.length<2)continue;let l=i.get(a);if(l===void 0){l=a.map((u)=>({href:Us(ca(u.urlPattern,n),r),hreflang:u.locale}));let c=a.find((u)=>u.locale===t.defaultLocale);if(c!==void 0)l.push({href:Us(ca(c.urlPattern,n),r),hreflang:"x-default"});i.set(a,l)}s.set(o,l)}return s}function k$({pageLang:e,pageDir:t,routeLocale:r,defaults:n}){let s=e??r??n?.lang??"en",i=t??n?.dir;if(i!==void 0)return{dir:i,lang:s};return jl(s)==="rtl"?{dir:"rtl",lang:s}:{lang:s}}var Dm=D(()=>{Vr();eo();Jm();eo();eo()});function _$(e,t,r,n=null,s=null,i=[]){if(!e.state)e.state={};let o={};if(s!==null)o.defaultLocale=s.defaultLocale,o.locales=s.locales;e.state.$site={name:t.name??"Jx Site",url:t.url??"",...o,...t.state};let a=(O(e.$lang)?e.$lang:void 0)??gn(r.urlPattern,s)??t.defaults?.lang,l=i.map((u)=>({code:u.locale,current:u.urlPattern===r.urlPattern,dir:jl(u.locale),label:T0(u.locale),url:u.urlPattern})),c={params:r._pathParams??{},title:e.title??e._pageTitle??t.name??"",url:r.urlPattern};if(l.length>0)c.alternates=l;if(r.pagination){let{first:u,itemCount:p,last:h,next:m,number:b,pageCount:g,pageSize:y,pages:w,prev:j}=r.pagination;c.pagination={first:u,itemCount:p,last:h,next:m,number:b,pageCount:g,pageSize:y,pages:w.map(({current:S,number:E,url:P})=>({current:S,number:E,url:P})),prev:j}}if(a!==void 0)c.dir=jl(a),c.locale=a;if(e.state.$page=c,t.state){for(let[u,p]of Object.entries(t.state))if(u!=="$site"&&u!=="$page"&&!(u in e.state))e.state[u]=p}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,p]of Object.entries(t.imports))if(!(u in e.imports))e.imports[u]=n&&(p.startsWith("./")||p.startsWith("../"))?n(p,r):p}if(t.$elements?.length)if(!e.$elements?.length)e.$elements=[...t.$elements];else{let u=new Set,p=[];for(let h of[...t.$elements,...e.$elements]){let m=O(h)?h:V(h)?h.$ref:void 0;if(m&&!u.has(m))u.add(m),p.push(h)}e.$elements=p}return e}var A$=D(()=>{ye();eo()});import{dirname as VJ,relative as WJ,resolve as BJ}from"node:path";function Lm(e){return(t,r)=>{if(!r.sourcePath)return t;return`./${WJ(VJ(r.sourcePath),BJ(e,t))}`}}function R$(e,t,r,n=null,s=null,i=[]){return _$(e,t,r,n===null?null:Lm(n),s,i)}var Fm=D(()=>{A$()});import{readFileSync as HJ}from"node:fs";import{dirname as qm,resolve as Hu}from"node:path";import{createRequire as UJ}from"node:module";function KJ(e){return Wt(e.resolve)}async function Uu(e,t,r,n={}){let s=e.imports??{},{state:i}=e;if(!i)return;for(let[o,a]of Object.entries(i)){if(!vn(a))continue;if(zJ.has(a.$prototype))continue;if(a.timing&&a.timing!=="compiler"){let l=n.registry?.byName(a.$prototype);if(l?.capabilities.lower)try{let c=await l.call("lower",a,{projectConfig:n.config,root:r,route:t});if(W(c)){let u=c.$bundle;if(Array.isArray(u)){for(let p of u)if(O(p))n.registerBundle?.(p)}delete c.$bundle}i[o]=c}catch(c){console.warn(`prototype-resolver: failed to lower "${o}" ($prototype: "${a.$prototype}"):`,je(c))}continue}if(!a.$src){let l=s[a.$prototype]??YJ(n,a.$prototype);if(!l)continue;a.$src=l}try{let l=await XJ(a,t,r,i,n);if(a.timing&&W(l))l.timing=a.timing;i[o]=l}catch(l){console.warn(`prototype-resolver: failed to resolve "${o}" ($prototype: "${a.$prototype}"):`,je(l))}}}function YJ(e,t){return e.registry?.byName(t)?.classPath}async function XJ(e,t,r,n,s){let i=e.$src;if(!i)throw Error(`$prototype "${e.$prototype}" has no $src to resolve`);let o;if(i.startsWith("./")||i.startsWith("../"))o=t.sourcePath?Hu(qm(t.sourcePath),i):Hu(r,i);else o=UJ(Hu(r,"package.json")).resolve(i);let a=HJ(o,"utf8"),l=tb(a,o);if(!l.$implementation)throw Error(`${i} has no $implementation field`);let c=Hu(qm(o),l.$implementation),u=await Tp(c),p=e.$export??l.title??e.$prototype,h=u[p]??u.default?.[p];if(!h)throw Error(`Module ${l.$implementation} does not export "${p}"`);let m={};for(let[g,y]of Object.entries(e))if(!GJ.has(g))m[g]=y;if(m.src&&!m.basePath&&t.sourcePath)m.basePath=qm(t.sourcePath);m._project={config:s.config??null,root:r,...s.sections},m._document={route:t,state:n};let b=new h(m);if(KJ(b))return await b.resolve();return b}var zJ,GJ;var Vm=D(()=>{bs();ye();er();zJ=new Set(["Function","LocalStorage","SessionStorage","Array"]),GJ=new Set(["$prototype","$src","$export","timing","default","description"])});import{readFileSync as Wm,readdirSync as ZJ,statSync as QJ}from"node:fs";import{extname as C$,join as eM,relative as tM,resolve as rM}from"node:path";async function so(e,t){let r=Wm(e,"utf8");if(hs(e))return _n(gs(r,e),e);let n=C$(e).toLowerCase(),s=t?.byExtension(n,"parse");if(!s)throw Error(`No format class registered for "${n}" (${e}). Enable an extension providing this format in project.json "extensions", e.g. "@jxsuite/parser".`);return _n(await s.parseDocument(r),e)}async function N$(e,t){let r=new Map,n=new Map;for(let s of e){if(!n.has(s.sourcePath))n.set(s.sourcePath,await sM(s.sourcePath,t));let i=n.get(s.sourcePath);if(i!==null&&i!==void 0)r.set(s.urlPattern,nM(i,s._pathParams))}return r}function nM(e,t){if(!e.includes("${"))return e;return e.replaceAll(/\$\{(\w+)\}/g,(r,n)=>t?.[n]??r)}async function sM(e,t){if(!Wm(e,"utf8").includes("$translationKey"))return null;let r;try{r=await so(e,t)}catch{return null}return O(r.$translationKey)&&r.$translationKey!==""?r.$translationKey:null}async function T$(e,t){let r=[],n=new Set([".json",".jxn",...t?.documentExtensions("page")??[]]);return await I$(e,e,r,n,t),r.sort(_0),r}async function I$(e,t,r,n,s){let i=ZJ(e,{withFileTypes:!0});for(let o of i){let a=eM(e,o.name);if(o.isDirectory()){if(o.name.startsWith("_"))continue;await I$(a,t,r,n,s);continue}let l=C$(o.name).toLowerCase();if(!n.has(l))continue;if(o.name.startsWith("_"))continue;let c=tM(t,a);r.push(await iM(c,a,s))}}async function iM(e,t,r){let{isCatchAll:n,isDynamic:s,params:i,urlPattern:o}=k0(e),a=null;try{let c=(await so(t,r)).$layout;if(O(c))a=c}catch{}return{$layout:a,isCatchAll:n,isDynamic:s,params:i,relativePath:e,sourcePath:t,urlPattern:o}}function oM(e){let t=e[zu];if(!W(t))return null;let{mtime:r}=t;return O(r)&&r!==""?r:null}function J$(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 M$(e,t,r={},n,s,i,o={}){let a=[],l=(u,p)=>{let h=`Dynamic route ${u.urlPattern}: ${p}`;if(o.errors===void 0)throw Error(h);o.errors.push(h)},c=e.flatMap((u)=>u.isDynamic?[u.urlPattern]:[]);for(let u of e){if(!u.isDynamic){a.push(u);continue}let p;try{p=await so(u.sourcePath,n?.formats)}catch{a.push(u);continue}if(!p.$paths){console.warn(`Warning: dynamic route ${u.urlPattern} has no $paths — skipping`);continue}let h;try{h=R0(p.$paths)}catch(b){l(u,je(b));continue}if(h!==null){let b=gn(u.urlPattern,i??null),g=h.each===void 0?[{}]:await O$(h.each,t,r,n,s,b,u,c);for(let y of g){let w=await aM(u,p,h,y,{locale:b,projectConfig:s,projectRoot:t,registry:n,report:l,sections:r});a.push(...w)}continue}let m=await O$(p.$paths,t,r,n,s,gn(u.urlPattern,i??null),u,c);for(let b of m){let g=u.urlPattern,y={};for(let[E,P]of Object.entries(b)){if(E===zu)continue;y[E]=String(P),g=g.replace(`:${E}`,y[E]),g=g.replace("*",y[E])}let w=J$(g);if(w!==null){console.warn(`Warning: $paths for ${u.urlPattern} produced "${g}", which ${w}; skipping it`);continue}let j=oM(b),S={...u,_pathParams:y,isCatchAll:!1,isDynamic:!1,params:[],urlPattern:g};if(j!==null)S.sourceMtime=j;a.push(S)}}return a}function D$(e,t){let r=e;for(let[n,s]of Object.entries(t)){let i=new RegExp(`:${n.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}(?=/|$)`);r=i.test(r)?r.replace(i,()=>s):r.replace("*",()=>s)}return r}async function aM(e,t,r,n,s){let i={};for(let[b,g]of Object.entries(n))if(b!==zu)i[b]=String(g);let o=e.params.filter((b)=>!(b in i));if(o.length!==1)return s.report(e,`a paged route takes exactly one parameter besides those its each source fills; this one has ${o.length}`),[];let a=o[0];if(t.state?.[r.key]===void 0)return s.report(e,`$paths.paginate names state entry "${r.key}", which this page does not declare`),[];let l=D$(e.urlPattern,i),c=J$(l);if(c!==null)return console.warn(`Warning: $paths for ${e.urlPattern} produced "${l}", which ${c}; skipping it`),[];let u=await cM(t,r.key,e,i,s);if(!Array.isArray(u))return s.report(e,`state entry "${r.key}" did not resolve to an array at build time`),[];let p=lM(u,e.sourcePath),h=nm(u.length,r.pageSize),m=[];for(let b=1;b<=h;b++){let g={...e,_pathParams:{...i,[a]:String(b)},isCatchAll:!1,isDynamic:!1,pagedState:{items:O0(u,b,r.pageSize),key:r.key},pagination:C0(l,b,r.pageSize,u.length),params:[],urlPattern:Qi(l,b)};if(p!==null)g.sourceMtime=p;m.push(g)}return m}function lM(e,t){let r=null,n=QJ(t).mtime.getTime();for(let s of e){let i=W(s)?s[zu]:void 0,o=W(i)?i.mtime:void 0;if(O(o)&&Date.parse(o)>n)n=Date.parse(o),r=o}return r}async function cM(e,t,r,n,s){let i=e.state?.[t];if(i===void 0||Array.isArray(i))return i;let o={},a=Lm(s.projectRoot);for(let[u,p]of Object.entries(s.projectConfig?.imports??{}))o[u]=p.startsWith("./")||p.startsWith("../")?a(p,r):p;Object.assign(o,e.imports);let l={imports:o,state:{[t]:structuredClone(i)}},c={_pathParams:n,locale:s.locale,sourcePath:r.sourcePath,urlPattern:D$(r.urlPattern,n)};return await Uu(l,c,s.projectRoot,{...s.projectConfig&&{config:s.projectConfig},...s.registry&&{registry:s.registry},sections:s.sections}),l.state?.[t]}async function O$(e,t,r,n,s,i,o,a){if(Array.isArray(e))return e;if("values"in e&&Array.isArray(e.values)){let l=O(e.param)?e.param:"value";return e.values.map((c)=>({[l]:c}))}if("$ref"in e&&O(e.$ref)&&e.$ref){let l=e.$ref,c=rM(t,l),u;try{u=JSON.parse(Wm(c,"utf8"))}catch(m){return console.warn(`Warning: $paths.$ref could not load "${l}": ${je(m)}`),[]}if(!Array.isArray(u))return console.warn(`Warning: $paths.$ref "${l}" must be a JSON array`),[];let p=O(e.param)?e.param:"id",h=O(e.field)?e.field:"id";return u.map((m)=>{if(m===null)throw TypeError(`$paths.$ref "${l}" contains a null entry`);return{[p]:(W(m)?m[h]??m.id:void 0)??String(m)}})}for(let l of Object.keys(e)){let c=n?.byPathsDiscriminator(l);if(!c?.project)continue;let u={data:r[c.project.key],locale:i,projectConfig:s,root:t};if(o!==void 0)u.params=o.params,u.urlPattern=o.urlPattern;if(a!==void 0)u.patterns=a;return await c.call("resolvePaths",e,u)}return console.warn("Warning: unrecognized $paths shape — skipping"),[]}var zu="_meta";var L$=D(()=>{Uo();ye();Wi();er();A0();N0();Dm();Fm();Vm()});import{createHash as uM}from"node:crypto";function F$(){return{fontOrigins:new Set,frameOrigins:new Set,imgOrigins:new Set,scriptHashes:new Set,scriptOrigins:new Set,styleOrigins:new Set}}function io(e,t){let r=new RegExp(`\\b${t}\\s*=\\s*("([^"]*)"|'([^']*)')`,"i").exec(e);return r?.[2]??r?.[3]}function Bm(e){if(e===void 0||!/^https?:\/\//i.test(e))return null;try{return new URL(e).origin}catch{return null}}function bM(e){return`'sha256-${uM("sha256").update(e,"utf8").digest("base64")}'`}function q$(e,t){for(let r of e.matchAll(dM)){let n=r[1]??"",s=io(n,"src"),i=(io(n,"type")??"").trim().toLowerCase();if(s!==void 0){let o=Bm(s);if(o)t.scriptOrigins.add(o);continue}if(fM.has(i))t.scriptHashes.add(bM(r[2]??""))}for(let r of e.matchAll(pM)){let n=r[1]??"",s=(io(n,"rel")??"").toLowerCase(),i=io(n,"href"),o=Bm(i);if(!o)continue;if(s.includes("stylesheet"))t.styleOrigins.add(o);if(yM.test(i??"")||(io(n,"as")??"")==="font")t.fontOrigins.add(o)}for(let[r,n]of[[mM,t.imgOrigins],[hM,t.imgOrigins],[gM,t.frameOrigins]])for(let s of e.matchAll(r)){let i=s[1]??"";for(let o of[io(i,"src"),...xM(io(i,"srcset"))]){let a=Bm(o);if(a)n.add(a)}}}function xM(e){return e===void 0?[]:e.split(",").map((t)=>t.trim().split(/\s+/)[0]??"").filter(Boolean)}function V$(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 W$(e,t){let r=(o,a)=>[...o,...a].join(" "),n={"base-uri":"'self'","default-src":"'self'","font-src":r(["'self'"],e.fontOrigins),"form-action":"'self'","frame-ancestors":"'self'","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!=="")n["report-to"]="csp-endpoint",n["report-uri"]=t.reportUri;for(let[o,a]of Object.entries(t.directives??{}))n[o]=a;let s=Object.entries(n).filter(([,o])=>o!==!1&&o!=="").toSorted(([o],[a])=>o<a?-1:1).map(([o,a])=>`${o} ${String(a)}`).join("; "),i=t.mode==="report-only"?{"Content-Security-Policy-Report-Only":s}:{"Content-Security-Policy":s};if(t.reportUri!==void 0&&t.reportUri!=="")i["Reporting-Endpoints"]=`csp-endpoint="${t.reportUri}"`;return i}var fM,dM,pM,mM,hM,gM,yM;var Hm=D(()=>{fM=new Set(["","module","importmap","text/javascript","module-shim"]),dM=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,pM=/<link\b([^>]*)>/gi,mM=/<img\b([^>]*)>/gi,hM=/<source\b([^>]*)>/gi,gM=/<iframe\b([^>]*)>/gi,yM=/\.(woff2?|ttf|otf|eot)(\?|#|$)/i});import{existsSync as Gu,readFileSync as $M,writeFileSync as H$}from"node:fs";import{join as Ku}from"node:path";function U$(e,t){let r=e?.headers??{},n=[];if(r.enabled===!1)return{errors:n,rules:[]};let s=r.security??{},i={};if(s.contentTypeOptions!==!1)i["X-Content-Type-Options"]="nosniff";if(s.referrerPolicy!==!1)i["Referrer-Policy"]=s.referrerPolicy??"strict-origin-when-cross-origin";if(s.permissionsPolicy!==!1)i["Permissions-Policy"]=s.permissionsPolicy??"camera=(), microphone=(), geolocation=()";if(s.frameOptions!==!1)i["X-Frame-Options"]=s.frameOptions??"SAMEORIGIN";let{hsts:o}=s;if(o){let u=o===!0?{}:o,p=u.maxAge??B$,h=u.includeSubDomains??!0,m=u.preload??!1;if(m&&!h)n.push("build.headers.security.hsts: `preload` requires `includeSubDomains` — the preload list "+"will not accept the header without it.");else i["Strict-Transport-Security"]=[`max-age=${p}`,h?"includeSubDomains":null,m?"preload":null].filter(Boolean).join("; ")}let a=V$(s);if(a)if(t===void 0)n.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(i,W$(t,a));let l=r.cache??"auto";if(l==="auto")i["Cache-Control"]="public, max-age=0, must-revalidate";let c=[];if(Object.keys(i).length>0)c.push({headers:i,pattern:"/*"});if(l==="auto")c.push({headers:{"Cache-Control":`public, max-age=${B$}, immutable`},pattern:wM});for(let[u,p]of Object.entries(r.rules??{}))c.push({headers:p,pattern:u});return{errors:n,rules:c}}function z$(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"]],r=[];for(let[n,s]of t)if(Gu(Ku(e,n)))r.push({headers:{"Content-Type":s},pattern:`/${n}`});if(Gu(Ku(e,"feed","archive")))r.push({headers:{"Content-Type":"application/atom+xml; charset=utf-8"},pattern:"/feed/archive/*"});return r}function G$(e,t){if(t==="")return[...e];return e.map((r)=>({headers:r.headers,pattern:Xe(t,r.pattern)}))}function EM(e){let t=e.map((r)=>{let n=Object.entries(r.headers).map(([s,i])=>` ${s}: ${i}`);return[r.pattern,...n].join(`
150
- `)});return`${[vM,"",...t].join(`
148
+ `:""}var fM,R$,ia="https://esm.sh/@vue/reactivity@3.5.40",oa="https://esm.sh/lit-html@3.3.0",pM,mM,hM,gM,ti,xM,ua="__jxAttrText",J$="__jxServerCall",zm="__jxCaptureSlotted",Gm="__jxDistributeSlots",fa="<!---->",Xm,wM;var In=M(()=>{Il();ra();Ll();ql();Vu();P$();ye();Zo();ra();ql();Vu();ye();fM=["$map/","event#/","$args/","$reduce/"];R$=Symbol("jx.runtimeOnlyStateKeys");pM=/\bstate\.([A-Za-z_$][\w$]*)\s*(?:\+\+|--|(?:\*\*|\|\||&&|\?\?|<<|>>>|>>|[-+*/%&|^])?=(?!=))/g,mM=/\bstate\.([A-Za-z_$][\w$]*)\s*\.\s*(?:push|pop|shift|unshift|splice|sort|reverse|fill|copyWithin)\s*\(/g,hM=/[\w$.]/u,gM=/[\w$]/u;ti=new Set(["pre","textarea","listing","plaintext","xmp"]);xM=[];Xm=new Set(["input","br","hr","img","meta","link","area","col","source"]);wM=/^(?:::slotted\(|::part\()/});import{relative as EM,sep as PM}from"node:path";function Hl(e){return e===jM}function pa(e,t){if(e==="/")return"/";if(t==="always")return e.endsWith("/")?e:`${e}/`;if(t==="never")return e.replace(/\/+$/,"")||"/";return e}function sf(e,t){let r=new RegExp(`\\s${t}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s"'>]+))`,"i").exec(e);return r===null?null:r[1]??r[2]??r[3]??""}function B$(e){let t=e.search(/<\/head\s*>/i),r=t===-1?e:e.slice(0,t);for(let[n]of r.matchAll(/<meta\b[^>]*>/gi)){if(sf(n,"name")?.trim().toLowerCase()!=="robots")continue;let s=new Set((sf(n,"content")??"").toLowerCase().split(",").map((i)=>i.trim()));if(s.has("noindex")||s.has("none"))return!0}return!1}function W$(e){let t=e.search(/<\/head\s*>/i);return{end:t,head:t===-1?e:e.slice(0,t)}}function kM(e,t){let r=t.trim().toLowerCase();for(let[n]of W$(e).head.matchAll(/<link\b[^>]*>/gi)){let s=(sf(n,"rel")??"").toLowerCase().split(/\s+/),i=(sf(n,"type")??"").split(";")[0]?.trim().toLowerCase();if(s.includes("alternate")&&i===r)return!0}return!1}function U$(e,t){let{end:r}=W$(e);if(r===-1||kM(e,t.type))return e;let n=`<link href="${_e(t.href)}" rel="alternate" type="${_e(t.type)}">`;return`${e.slice(0,r)}${n}
149
+ ${e.slice(r)}`}function H$(e,t){return new URL(`/${EM(e,t).split(PM).join("/")}`,"http://localhost").pathname}var jM="/404";var rh=M(()=>{In()});function z$(e,t){if(t===null||t.routing!=="prefix-always")return[];let r=[];for(let n of e){if(n.urlPattern==="/")continue;let s=n.urlPattern.split("/").find(Boolean),i=Qr(s);if(i===null||!t.locales.includes(i))r.push(n.urlPattern)}return r}function G$(e,t){if(t===null)return null;let r=e.split("/").find(Boolean),n=Qr(r);if(r===void 0||n===null||t.locales.includes(n))return null;let s=t.locales.find((i)=>i!==n&&i.split("-")[0]===n.split("-")[0]);return s===void 0?null:{meant:s,segment:r}}function _M(e,t){let r=e.split("/").filter(Boolean),n=Qr(r[0]);if(t!==null&&n!==null&&t.locales.includes(n))return r.slice(1).join("/");return r.join("/")}function nh(e,t){let r=new Map,n=[];if(t===null)return{conflicts:n,sets:r};let s=new Map,i=new Set;for(let o of e){let a=o.translationKey===void 0?_M(o.urlPattern,t):o.translationKey.replaceAll(/^\/+|\/+$/g,"");if(o.translationKey!==void 0)i.add(o.urlPattern);let l=bn(o.urlPattern,t);if(l===null)continue;let c=s.get(a)??[],u=c.find((p)=>p.locale===l);if(u===void 0)c.push({locale:l,urlPattern:o.urlPattern});else n.push({declared:i.has(u.urlPattern)||o.translationKey!==void 0,key:a,locale:l,urlPatterns:[u.urlPattern,o.urlPattern]});s.set(a,c)}for(let o of s.values()){let a=o.toSorted((l,c)=>l.locale===c.locale?0:l.locale<c.locale?-1:1);for(let l of o)r.set(l.urlPattern,a)}return{conflicts:n,sets:r}}function K$(e,t,r,n){let s=new Map;if(t===null||r==="")return s;let i=new Map;for(let[o,a]of nh(e,t).sets){if(a.length<2)continue;let l=i.get(a);if(l===void 0){l=a.map((u)=>({href:Ks(pa(u.urlPattern,n),r),hreflang:u.locale}));let c=a.find((u)=>u.locale===t.defaultLocale);if(c!==void 0)l.push({href:Ks(pa(c.urlPattern,n),r),hreflang:"x-default"});i.set(a,l)}s.set(o,l)}return s}function X$({pageLang:e,pageDir:t,routeLocale:r,defaults:n}){let s=e??r??n?.lang??"en",i=t??n?.dir;if(i!==void 0)return{dir:i,lang:s};return Cl(s)==="rtl"?{dir:"rtl",lang:s}:{lang:s}}var sh=M(()=>{Vr();ro();rh();ro();ro()});function Y$(e,t,r,n=null,s=null,i=[]){if(!e.state)e.state={};let o={};if(s!==null)o.defaultLocale=s.defaultLocale,o.locales=s.locales;e.state.$site={name:t.name??"Jx Site",url:t.url??"",...o,...t.state};let a=(A(e.$lang)?e.$lang:void 0)??bn(r.urlPattern,s)??t.defaults?.lang,l=i.map((u)=>({code:u.locale,current:u.urlPattern===r.urlPattern,dir:Cl(u.locale),label:n$(u.locale),url:u.urlPattern})),c={params:r._pathParams??{},title:e.title??e._pageTitle??t.name??"",url:r.urlPattern};if(l.length>0)c.alternates=l;if(r.pagination){let{first:u,itemCount:p,last:h,next:m,number:y,pageCount:g,pageSize:b,pages:w,prev:j}=r.pagination;c.pagination={first:u,itemCount:p,last:h,next:m,number:y,pageCount:g,pageSize:b,pages:w.map(({current:S,number:E,url:P})=>({current:S,number:E,url:P})),prev:j}}if(a!==void 0)c.dir=Cl(a),c.locale=a;if(e.state.$page=c,t.state){for(let[u,p]of Object.entries(t.state))if(u!=="$site"&&u!=="$page"&&!(u in e.state))e.state[u]=p}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,p]of Object.entries(t.imports))if(!(u in e.imports))e.imports[u]=n&&(p.startsWith("./")||p.startsWith("../"))?n(p,r):p}if(t.$elements?.length)if(!e.$elements?.length)e.$elements=[...t.$elements];else{let u=new Set,p=[];for(let h of[...t.$elements,...e.$elements]){let m=A(h)?h:V(h)?h.$ref:void 0;if(m&&!u.has(m))u.add(m),p.push(h)}e.$elements=p}return e}var Z$=M(()=>{ye();ro()});import{dirname as AM,relative as RM,resolve as OM}from"node:path";function ih(e){return(t,r)=>{if(!r.sourcePath)return t;return`./${RM(AM(r.sourcePath),OM(e,t))}`}}function Q$(e,t,r,n=null,s=null,i=[]){return Y$(e,t,r,n===null?null:ih(n),s,i)}var oh=M(()=>{Z$()});import{readFileSync as NM}from"node:fs";import{dirname as ah,resolve as of}from"node:path";import{createRequire as CM}from"node:module";function JM(e){return Vt(e.resolve)}async function af(e,t,r,n={}){let s=e.imports??{},{state:i}=e;if(!i)return;for(let[o,a]of Object.entries(i)){if(!jn(a))continue;if(TM.has(a.$prototype))continue;if(a.timing&&a.timing!=="compiler"){let l=n.registry?.byName(a.$prototype);if(l?.capabilities.lower)try{let c=await l.call("lower",a,{projectConfig:n.config,root:r,route:t});if(B(c)){let u=c.$bundle;if(Array.isArray(u)){for(let p of u)if(A(p))n.registerBundle?.(p)}delete c.$bundle}i[o]=c}catch(c){console.warn(`prototype-resolver: failed to lower "${o}" ($prototype: "${a.$prototype}"):`,Pe(c))}continue}if(!a.$src){let l=s[a.$prototype]??MM(n,a.$prototype);if(!l)continue;a.$src=l}try{let l=await DM(a,t,r,i,n);if(a.timing&&B(l))l.timing=a.timing;i[o]=l}catch(l){console.warn(`prototype-resolver: failed to resolve "${o}" ($prototype: "${a.$prototype}"):`,Pe(l))}}}function MM(e,t){return e.registry?.byName(t)?.classPath}async function DM(e,t,r,n,s){let i=e.$src;if(!i)throw Error(`$prototype "${e.$prototype}" has no $src to resolve`);let o;if(i.startsWith("./")||i.startsWith("../"))o=t.sourcePath?of(ah(t.sourcePath),i):of(r,i);else o=CM(of(r,"package.json")).resolve(i);let a=NM(o,"utf8"),l=Eb(a,o);if(!l.$implementation)throw Error(`${i} has no $implementation field`);let c=of(ah(o),l.$implementation),u=await Zp(c),p=e.$export??l.title??e.$prototype,h=u[p]??u.default?.[p];if(!h)throw Error(`Module ${l.$implementation} does not export "${p}"`);let m={};for(let[g,b]of Object.entries(e))if(!IM.has(g))m[g]=b;if(m.src&&!m.basePath&&t.sourcePath)m.basePath=ah(t.sourcePath);m._project={config:s.config??null,root:r,...s.sections},m._document={route:t,state:n};let y=new h(m);if(JM(y))return await y.resolve();return y}var TM,IM;var lh=M(()=>{vs();ye();er();TM=new Set(["Function","LocalStorage","SessionStorage","Array"]),IM=new Set(["$prototype","$src","$export","timing","default","description"])});import{readFileSync as ch,readdirSync as LM,statSync as FM}from"node:fs";import{extname as tw,join as qM,relative as VM,resolve as BM}from"node:path";async function ao(e,t){let r=ch(e,"utf8");if(xs(e))return Nn($s(r,e),e);let n=tw(e).toLowerCase(),s=t?.byExtension(n,"parse");if(!s)throw Error(`No format class registered for "${n}" (${e}). Enable an extension providing this format in project.json "extensions", e.g. "@jxsuite/parser".`);return Nn(await s.parseDocument(r),e)}async function rw(e,t){let r=new Map,n=new Map;for(let s of e){if(!n.has(s.sourcePath))n.set(s.sourcePath,await UM(s.sourcePath,t));let i=n.get(s.sourcePath);if(i!==null&&i!==void 0)r.set(s.urlPattern,WM(i,s._pathParams))}return r}function WM(e,t){if(!e.includes("${"))return e;return e.replaceAll(/\$\{(\w+)\}/g,(r,n)=>t?.[n]??r)}async function UM(e,t){if(!ch(e,"utf8").includes("$translationKey"))return null;let r;try{r=await ao(e,t)}catch{return null}return A(r.$translationKey)&&r.$translationKey!==""?r.$translationKey:null}async function nw(e,t){let r=[],n=new Set([".json",".jxn",...t?.documentExtensions("page")??[]]);return await sw(e,e,r,n,t),r.sort(Y0),r}async function sw(e,t,r,n,s){let i=LM(e,{withFileTypes:!0});for(let o of i){let a=qM(e,o.name);if(o.isDirectory()){if(o.name.startsWith("_"))continue;await sw(a,t,r,n,s);continue}let l=tw(o.name).toLowerCase();if(!n.has(l))continue;if(o.name.startsWith("_"))continue;let c=VM(t,a);r.push(await HM(c,a,s))}}async function HM(e,t,r){let{isCatchAll:n,isDynamic:s,params:i,urlPattern:o}=X0(e),a=null;try{let c=(await ao(t,r)).$layout;if(A(c))a=c}catch{}return{$layout:a,isCatchAll:n,isDynamic:s,params:i,relativePath:e,sourcePath:t,urlPattern:o}}function zM(e){let t=e[lf];if(!B(t))return null;let{mtime:r}=t;return A(r)&&r!==""?r:null}function iw(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 ow(e,t,r={},n,s,i,o={}){let a=[],l=(u,p)=>{let h=`Dynamic route ${u.urlPattern}: ${p}`;if(o.errors===void 0)throw Error(h);o.errors.push(h)},c=e.flatMap((u)=>u.isDynamic?[u.urlPattern]:[]);for(let u of e){if(!u.isDynamic){a.push(u);continue}let p;try{p=await ao(u.sourcePath,n?.formats)}catch{a.push(u);continue}if(!p.$paths){console.warn(`Warning: dynamic route ${u.urlPattern} has no $paths — skipping`);continue}let h;try{h=Q0(p.$paths)}catch(y){l(u,Pe(y));continue}if(h!==null){let y=bn(u.urlPattern,i??null),g=h.each===void 0?[{}]:await ew(h.each,t,r,n,s,y,u,c);for(let b of g){let w=await GM(u,p,h,b,{locale:y,projectConfig:s,projectRoot:t,registry:n,report:l,sections:r});a.push(...w)}continue}let m=await ew(p.$paths,t,r,n,s,bn(u.urlPattern,i??null),u,c);for(let y of m){let g=u.urlPattern,b={};for(let[E,P]of Object.entries(y)){if(E===lf)continue;b[E]=String(P),g=g.replace(`:${E}`,b[E]),g=g.replace("*",b[E])}let w=iw(g);if(w!==null){console.warn(`Warning: $paths for ${u.urlPattern} produced "${g}", which ${w}; skipping it`);continue}let j=zM(y),S={...u,_pathParams:b,isCatchAll:!1,isDynamic:!1,params:[],urlPattern:g};if(j!==null)S.sourceMtime=j;a.push(S)}}return a}function aw(e,t){let r=e;for(let[n,s]of Object.entries(t)){let i=new RegExp(`:${n.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}(?=/|$)`);r=i.test(r)?r.replace(i,()=>s):r.replace("*",()=>s)}return r}async function GM(e,t,r,n,s){let i={};for(let[y,g]of Object.entries(n))if(y!==lf)i[y]=String(g);let o=e.params.filter((y)=>!(y in i));if(o.length!==1)return s.report(e,`a paged route takes exactly one parameter besides those its each source fills; this one has ${o.length}`),[];let a=o[0];if(t.state?.[r.key]===void 0)return s.report(e,`$paths.paginate names state entry "${r.key}", which this page does not declare`),[];let l=aw(e.urlPattern,i),c=iw(l);if(c!==null)return console.warn(`Warning: $paths for ${e.urlPattern} produced "${l}", which ${c}; skipping it`),[];let u=await XM(t,r.key,e,i,s);if(!Array.isArray(u))return s.report(e,`state entry "${r.key}" did not resolve to an array at build time`),[];let p=KM(u,e.sourcePath),h=wm(u.length,r.pageSize),m=[];for(let y=1;y<=h;y++){let g={...e,_pathParams:{...i,[a]:String(y)},isCatchAll:!1,isDynamic:!1,pagedState:{items:e$(u,y,r.pageSize),key:r.key},pagination:t$(l,y,r.pageSize,u.length),params:[],urlPattern:to(l,y)};if(p!==null)g.sourceMtime=p;m.push(g)}return m}function KM(e,t){let r=null,n=FM(t).mtime.getTime();for(let s of e){let i=B(s)?s[lf]:void 0,o=B(i)?i.mtime:void 0;if(A(o)&&Date.parse(o)>n)n=Date.parse(o),r=o}return r}async function XM(e,t,r,n,s){let i=e.state?.[t];if(i===void 0||Array.isArray(i))return i;let o={},a=ih(s.projectRoot);for(let[u,p]of Object.entries(s.projectConfig?.imports??{}))o[u]=p.startsWith("./")||p.startsWith("../")?a(p,r):p;Object.assign(o,e.imports);let l={imports:o,state:{[t]:structuredClone(i)}},c={_pathParams:n,locale:s.locale,sourcePath:r.sourcePath,urlPattern:aw(r.urlPattern,n)};return await af(l,c,s.projectRoot,{...s.projectConfig&&{config:s.projectConfig},...s.registry&&{registry:s.registry},sections:s.sections}),l.state?.[t]}async function ew(e,t,r,n,s,i,o,a){if(Array.isArray(e))return e;if("values"in e&&Array.isArray(e.values)){let l=A(e.param)?e.param:"value";return e.values.map((c)=>({[l]:c}))}if("$ref"in e&&A(e.$ref)&&e.$ref){let l=e.$ref,c=BM(t,l),u;try{u=JSON.parse(ch(c,"utf8"))}catch(m){return console.warn(`Warning: $paths.$ref could not load "${l}": ${Pe(m)}`),[]}if(!Array.isArray(u))return console.warn(`Warning: $paths.$ref "${l}" must be a JSON array`),[];let p=A(e.param)?e.param:"id",h=A(e.field)?e.field:"id";return u.map((m)=>{if(m===null)throw TypeError(`$paths.$ref "${l}" contains a null entry`);return{[p]:(B(m)?m[h]??m.id:void 0)??String(m)}})}for(let l of Object.keys(e)){let c=n?.byPathsDiscriminator(l);if(!c?.project)continue;let u={data:r[c.project.key],locale:i,projectConfig:s,root:t};if(o!==void 0)u.params=o.params,u.urlPattern=o.urlPattern;if(a!==void 0)u.patterns=a;return await c.call("resolvePaths",e,u)}return console.warn("Warning: unrecognized $paths shape — skipping"),[]}var lf="_meta";var lw=M(()=>{Xo();ye();Ui();er();Z0();r$();sh();oh();lh()});import{createHash as YM}from"node:crypto";function cw(){return{fontOrigins:new Set,frameOrigins:new Set,imgOrigins:new Set,scriptHashes:new Set,scriptOrigins:new Set,styleOrigins:new Set}}function lo(e,t){let r=new RegExp(`\\b${t}\\s*=\\s*("([^"]*)"|'([^']*)')`,"i").exec(e);return r?.[2]??r?.[3]}function uh(e){if(e===void 0||!/^https?:\/\//i.test(e))return null;try{return new URL(e).origin}catch{return null}}function iD(e){return`'sha256-${YM("sha256").update(e,"utf8").digest("base64")}'`}function uw(e,t){for(let r of e.matchAll(QM)){let n=r[1]??"",s=lo(n,"src"),i=(lo(n,"type")??"").trim().toLowerCase();if(s!==void 0){let o=uh(s);if(o)t.scriptOrigins.add(o);continue}if(ZM.has(i))t.scriptHashes.add(iD(r[2]??""))}for(let r of e.matchAll(eD)){let n=r[1]??"",s=(lo(n,"rel")??"").toLowerCase(),i=lo(n,"href"),o=uh(i);if(!o)continue;if(s.includes("stylesheet"))t.styleOrigins.add(o);if(sD.test(i??"")||(lo(n,"as")??"")==="font")t.fontOrigins.add(o)}for(let[r,n]of[[tD,t.imgOrigins],[rD,t.imgOrigins],[nD,t.frameOrigins]])for(let s of e.matchAll(r)){let i=s[1]??"";for(let o of[lo(i,"src"),...oD(lo(i,"srcset"))]){let a=uh(o);if(a)n.add(a)}}}function oD(e){return e===void 0?[]:e.split(",").map((t)=>t.trim().split(/\s+/)[0]??"").filter(Boolean)}function fw(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 dw(e,t){let r=(o,a)=>[...o,...a].join(" "),n={"base-uri":"'self'","default-src":"'self'","font-src":r(["'self'"],e.fontOrigins),"form-action":"'self'","frame-ancestors":"'self'","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!=="")n["report-to"]="csp-endpoint",n["report-uri"]=t.reportUri;for(let[o,a]of Object.entries(t.directives??{}))n[o]=a;let s=Object.entries(n).filter(([,o])=>o!==!1&&o!=="").toSorted(([o],[a])=>o<a?-1:1).map(([o,a])=>`${o} ${String(a)}`).join("; "),i=t.mode==="report-only"?{"Content-Security-Policy-Report-Only":s}:{"Content-Security-Policy":s};if(t.reportUri!==void 0&&t.reportUri!=="")i["Reporting-Endpoints"]=`csp-endpoint="${t.reportUri}"`;return i}var ZM,QM,eD,tD,rD,nD,sD;var fh=M(()=>{ZM=new Set(["","module","importmap","text/javascript","module-shim"]),QM=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,eD=/<link\b([^>]*)>/gi,tD=/<img\b([^>]*)>/gi,rD=/<source\b([^>]*)>/gi,nD=/<iframe\b([^>]*)>/gi,sD=/\.(woff2?|ttf|otf|eot)(\?|#|$)/i});import{existsSync as cf,readFileSync as aD,writeFileSync as mw}from"node:fs";import{join as uf}from"node:path";function hw(e,t){let r=e?.headers??{},n=[];if(r.enabled===!1)return{errors:n,rules:[]};let s=r.security??{},i={};if(s.contentTypeOptions!==!1)i["X-Content-Type-Options"]="nosniff";if(s.referrerPolicy!==!1)i["Referrer-Policy"]=s.referrerPolicy??"strict-origin-when-cross-origin";if(s.permissionsPolicy!==!1)i["Permissions-Policy"]=s.permissionsPolicy??"camera=(), microphone=(), geolocation=()";if(s.frameOptions!==!1)i["X-Frame-Options"]=s.frameOptions??"SAMEORIGIN";let{hsts:o}=s;if(o){let u=o===!0?{}:o,p=u.maxAge??pw,h=u.includeSubDomains??!0,m=u.preload??!1;if(m&&!h)n.push("build.headers.security.hsts: `preload` requires `includeSubDomains` — the preload list "+"will not accept the header without it.");else i["Strict-Transport-Security"]=[`max-age=${p}`,h?"includeSubDomains":null,m?"preload":null].filter(Boolean).join("; ")}let a=fw(s);if(a)if(t===void 0)n.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(i,dw(t,a));let l=r.cache??"auto";if(l==="auto")i["Cache-Control"]="public, max-age=0, must-revalidate";let c=[];if(Object.keys(i).length>0)c.push({headers:i,pattern:"/*"});if(l==="auto")c.push({headers:{"Cache-Control":`public, max-age=${pw}, immutable`},pattern:lD});for(let[u,p]of Object.entries(r.rules??{}))c.push({headers:p,pattern:u});return{errors:n,rules:c}}function gw(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"]],r=[];for(let[n,s]of t)if(cf(uf(e,n)))r.push({headers:{"Content-Type":s},pattern:`/${n}`});if(cf(uf(e,"feed","archive")))r.push({headers:{"Content-Type":"application/atom+xml; charset=utf-8"},pattern:"/feed/archive/*"});return r}function yw(e,t){if(t==="")return[...e];return e.map((r)=>({headers:r.headers,pattern:Ye(t,r.pattern)}))}function fD(e){let t=e.map((r)=>{let n=Object.entries(r.headers).map(([s,i])=>` ${s}: ${i}`);return[r.pattern,...n].join(`
150
+ `)});return`${[cD,"",...t].join(`
151
151
  `)}
152
- `}function K$(e,t){if(t.length===0)return 0;let r=Ku(e,"_headers"),n=Gu(r)?$M(r,"utf8").trim():"",s=EM(t),i=n===""?s:`${s}
153
- ${SM}
152
+ `}function bw(e,t){if(t.length===0)return 0;let r=uf(e,"_headers"),n=cf(r)?aD(r,"utf8").trim():"",s=fD(t),i=n===""?s:`${s}
153
+ ${uD}
154
154
  ${n}
155
- `;return H$(r,i,"utf8"),1}function Y$(e){let t=Ku(e,".nojekyll");if(Gu(t))return 0;return H$(t,"","utf8"),1}var wM="/images/_optimized/*",B$=31536000,vM="# Generated by @jxsuite/compiler — configure via build.headers in project.json.",SM="# ─── public/_headers (hand-authored; these rules override the block above) ───";var X$=D(()=>{Vr();Hm()});async function Z$(e,t,r,n={}){let s={},i=Jp(e);for(let o of r.projectContributions()){let a=o.project?.key;if(!a||!o.capabilities.projectData)continue;if(!t||!(a in t))continue;s[a]=await o.call("projectData",t[a],{io:i,projectConfig:t,registry:r,root:e,...n.lazy===!0&&{lazy:!0},...n.includeHeld===!0&&{includeHeld:!0}})}return s}var Q$=D(()=>{bs()});import{cpSync as jM,existsSync as PM,mkdirSync as kM}from"node:fs";import{dirname as _M,resolve as AM}from"node:path";async function ew(e,t,r){let n=[],s=[],i=new Map;for(let o of e.assetProviders()){let a=o.project?.key,l=a?t[a]:void 0;if(a&&(l==null||V(l)&&Object.keys(l).length===0))continue;try{let c=await o.call("assets",l??null,{projectConfig:t,root:r});for(let u of c??[]){if(!V(u)||!u.urlPrefix||!u.dir)continue;let p={dir:u.dir,urlPrefix:lu(u.urlPrefix)};if(Wt(u.filter))p.filter=u.filter;let h=i.get(p.urlPrefix);if(h){if(h.dir!==p.dir)s.push(`Asset mount conflict: "${p.urlPrefix}" is claimed by both "${h.dir}" and "${p.dir}"`);continue}i.set(p.urlPrefix,p),n.push(p)}}catch(c){s.push(`Error in ${o.name}.assets: ${je(c)}`)}}return{errors:s,mounts:n}}function Um(e,t,r){if(t.length===0||!e)return;for(let n of Nx(e,t))r.add(n)}function tw(e,t,r){let n=0,s=[];for(let i of e){let o=cu(t,i);if(!o||!PM(o)){s.push(i);continue}let a=AM(r,decodeURIComponent(i).replace(/^\//,""));kM(_M(a),{recursive:!0}),jM(o,a),n+=1}return{copied:n,missing:s}}var rw=D(()=>{Vr();ye();er()});async function zm(e,t,r){let n=e.$layout??t.defaults?.layout??null;if(!n)return e;let s=await r(n);if(s.$layout)s=await zm(s,t,r);let i=e.children??[],o=O(i)?[i]:Array.isArray(i)?i:[],a=OM(s);if(RM(a,o),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 RM(e,t){let r=new Map,n=[];for(let s of t){let i=V(s)?s.attributes?.slot:void 0;if(i){let o=r.get(i);if(!o)o=[],r.set(i,o);o.push(s)}else n.push(s)}nw(e,r,n)}function nw(e,t,r){if(!V(e))return;if(!Array.isArray(e.children))return;let n=[];for(let s of e.children)if(V(s)&&s.tagName==="slot"){let i=s.attributes?.name,o=i?t.get(i):void 0;if(i&&o)n.push(...o),t.delete(i);else if(!i&&r.length>0)n.push(...r);else if(Array.isArray(s.children))n.push(...s.children)}else nw(s,t,r),n.push(s);e.children=n}function OM(e){return structuredClone(e)}var sw=D(()=>{ye()});import{existsSync as CM,readFileSync as NM}from"node:fs";import{resolve as iw}from"node:path";function ow(e){return(t)=>{let r=iw(e,t);if(!CM(r))throw Error(`Layout not found: ${t} (resolved to ${r})`);try{return _n(gs(NM(r,"utf8"),r),r)}catch(n){throw Error(`Invalid layout at ${r}: ${je(n)}`,{cause:n})}}}function aw(e,t,r){return zm(e,t,ow(r))}function lw(e,t,r){let n=ow(r),s=[],i=e.$layout??t.defaults?.layout;while(i){let o=iw(r,i);if(s.some((l)=>l.path===o))break;let a=n(i);s.push({doc:a,path:o}),i=a.$layout}return s}var cw=D(()=>{Uo();Wi();er();sw()});import{dirname as TM,relative as IM,resolve as JM,sep as MM}from"node:path";function uw(e,t){return IM(t,e).split(MM).join("/")}function DM(e,t,r){if(!e.startsWith("./")&&!e.startsWith("../"))return e;return`./${uw(JM(t,e),r)}`}function Ml(e,t,r){let n=TM(t),s=uw(t,r);return h$(e).map((i)=>({exportName:i.exportName,src:DM(i.src,n,r),declaredIn:s}))}function fw(e){let t=new Map;for(let{exportName:s,src:i,declaredIn:o}of e){let a=t.get(s)??new Map;if(t.set(s,a),!a.has(i))a.set(i,o)}let r=[],n=[];for(let[s,i]of t){let o=[...i];if(r.push({exportName:s,src:o[0][0]}),o.length>1){let a=o.map(([l,c])=>`${l} (declared in ${c})`);n.push(`Server function "${s}" is exported by ${o.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:r,errors:n}}var dw=D(()=>{Rn()});function pw(e,t){if(!O(t)||t.trim()==="")return[...e];return[{attributes:{content:t,name:"description"},tagName:"meta"},...e]}function mw(e=[],t=[],r=[],n={}){let s=[{attributes:{charset:n.charset??"utf8"},tagName:"meta"},{attributes:{content:"width=device-width, initial-scale=1",name:"viewport"},tagName:"meta"}],i=new Map;for(let a of[...s,...e,...t,...r]){let l=Gm(a);i.set(l,a)}let o=n.title??n.siteName??"Jx Site";if(i.set("title",{children:[o],tagName:"title"}),n.pageUrl&&n.siteUrl){let a=Us(n.pageUrl,n.siteUrl);if(![...i.values()].some((c)=>V(c)&&c.tagName==="link"&&c.attributes?.rel==="canonical")){let c={attributes:{href:a,rel:"canonical"},tagName:"link"};i.set(Gm(c),c)}if(!i.has("meta:og:url"))i.set("meta:og:url",{attributes:{content:a,property:"og:url"},tagName:"meta"})}if(n.siteName&&!i.has("meta:og:site_name"))i.set("meta:og:site_name",{attributes:{content:n.siteName,property:"og:site_name"},tagName:"meta"});for(let a of n.alternates??[]){let l={attributes:{href:a.href,hreflang:a.hreflang,rel:"alternate"},tagName:"link"},c=Gm(l);if(!i.has(c))i.set(c,l)}return[...i.values()]}function Gm(e){if(!V(e))return String(e);let t=e.tagName??"unknown",r=e.attributes??{};if(t==="title")return"title";if(r.charset)return"meta:charset";if(t==="meta"&&r.name)return`meta:${r.name}`;if(t==="meta"&&r.property)return`meta:${r.property}`;if(t==="link"&&r.rel){let n=r.hreflang??r.type??r.media??r.sizes??"";return`link:${r.rel}:${r.href??""}:${String(n)}`}if(t==="script"&&r.src)return`script:${r.src}`;if(t==="style"){let n=Array.isArray(e.children)?e.children.join(""):e.textContent,s=V(n)?JSON.stringify(n):n??"";return`style:${LM(s)}`}return`${t}:${JSON.stringify(e)}`}function LM(e){let t=0;for(let r=0;r<e.length;r++)t=Math.trunc((t<<5)-t+(e.codePointAt(r)??0));return t.toString(36)}function hw(e){return e.map((t)=>FM(t)).join(`
156
- `)}function FM(e){if(O(e))return e;if(!V(e))return"";let t=e.tagName,r=e.attributes??{},n=Object.entries(r).map(([l,c])=>c===!0?l:`${l}="${qM(c)}"`).join(" "),s=n?`<${t} ${n}>`:`<${t}>`;if(t!==void 0&&new Set(["meta","link","base","br","hr","img","input"]).has(t))return s;let o=Array.isArray(e.children)?e.children.join(""):e.textContent,a=V(o)?JSON.stringify(o,null,2):o??"";return`${s}${a}</${t}>`}function qM(e){return String(e).replaceAll("&","&amp;").replaceAll('"',"&quot;").replaceAll("<","&lt;")}var gw=D(()=>{Vr();ye()});function BM(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 HM(e){if(!O(e))return[];return e.split(/\s+/).filter((t)=>{if(t==="")return!1;let r=t.toLowerCase();return!VM.has(r)&&!WM.has(r)&&!BM(t)})}function yw(e){let t=new Set;for(let r of e){if(!V(r)||r.tagName!=="link")continue;for(let n of HM(r.attributes?.rel))t.add(n)}return[...t]}var VM,WM;var bw=D(()=>{ye();VM=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"]),WM=new Set(["shortcut"])});async function Zu(e,t={}){let{resolveElementPath:r,$media:n,formats:s}=t,i=[],o=new Set;async function a(l,c){let u,p;if(O(l)){let{readFileSync:E}=await import("node:fs"),{resolve:P}=await import("node:path");if(p=c?P(c,l):P(l),o.has(p))return;if(o.add(p),hs(p))u=gs(E(p,"utf8"),p);else{let{extname:A}=await import("node:path"),R=A(p).toLowerCase(),_=s?.byExtension(R,"parse");if(!_){await Promise.resolve().then(() => bs());throw ou(p,R)}u=await _.parseDocument(E(p,"utf8"))}u=_n(u,p)}else{if(u=_n(l,l.tagName??"a component"),p=null,u.tagName&&o.has(u.tagName))return;if(u.tagName)o.add(u.tagName)}let{tagName:h}=u;if(!h||!h.includes("-"))throw Error(`compileElement: tagName "${h}" must contain a hyphen`);let{dirname:m}=await import("node:path"),b=p?m(p):null,g=[];if(Array.isArray(u.$elements))for(let E of u.$elements){let P=Be(E)?E.$ref:E;if(!O(P))continue;if(b)await a(P,b);let A=r?r(P,b):P.replace(/\.(?:json|jxn)$/i,".js");g.push(A)}let y=qu(h);if(n)u.$media={...n,...u.$media};let{rewriteSrc:w}=t,j=Dl(u,y,g,w?(E)=>w(E,b):void 0,ro(u,t.defaults),t.serverBaseUrl),S=p?p.replace(/\.(?:json|jxn)$/i,".js"):`${h}.js`;i.push({content:j,path:S,tagName:h})}return await a(e,t.basePath??null),{files:i}}async function UM(e,t={}){let{title:r="Jx App",reactivitySrc:n="https://esm.sh/@vue/reactivity@3.5.13",litHtmlSrc:s="https://esm.sh/lit-html@3.3.0"}=t,i=await Zu(e,t),o=i.files.at(-1);if(!o)throw Error("compileElementPage: no element modules were produced");let{basename:a}=await import("node:path"),l=a(o.path),c=`<!DOCTYPE html>
155
+ `;return mw(r,i,"utf8"),1}function xw(e){let t=uf(e,".nojekyll");if(cf(t))return 0;return mw(t,"","utf8"),1}var lD="/images/_optimized/*",pw=31536000,cD="# Generated by @jxsuite/compiler — configure via build.headers in project.json.",uD="# ─── public/_headers (hand-authored; these rules override the block above) ───";var $w=M(()=>{Vr();fh()});async function ww(e,t,r,n={}){let s={},i=em(e);for(let o of r.projectContributions()){let a=o.project?.key;if(!a||!o.capabilities.projectData)continue;if(!t||!(a in t))continue;s[a]=await o.call("projectData",t[a],{io:i,projectConfig:t,registry:r,root:e,...n.lazy===!0&&{lazy:!0},...n.includeHeld===!0&&{includeHeld:!0}})}return s}var vw=M(()=>{vs()});import{cpSync as dD,existsSync as pD,mkdirSync as mD}from"node:fs";import{dirname as hD,resolve as gD}from"node:path";async function Sw(e,t,r){let n=[],s=[],i=new Map;for(let o of e.assetProviders()){let a=o.project?.key,l=a?t[a]:void 0;if(a&&(l==null||V(l)&&Object.keys(l).length===0))continue;try{let c=await o.call("assets",l??null,{projectConfig:t,root:r});for(let u of c??[]){if(!V(u)||!u.urlPrefix||!u.dir)continue;let p={dir:u.dir,urlPrefix:vu(u.urlPrefix)};if(Vt(u.filter))p.filter=u.filter;let h=i.get(p.urlPrefix);if(h){if(h.dir!==p.dir)s.push(`Asset mount conflict: "${p.urlPrefix}" is claimed by both "${h.dir}" and "${p.dir}"`);continue}i.set(p.urlPrefix,p),n.push(p)}}catch(c){s.push(`Error in ${o.name}.assets: ${Pe(c)}`)}}return{errors:s,mounts:n}}function dh(e,t,r){if(t.length===0||!e)return;for(let n of r0(e,t))r.add(n)}function Ew(e,t,r){let n=0,s=[];for(let i of e){let o=Su(t,i);if(!o||!pD(o)){s.push(i);continue}let a=gD(r,decodeURIComponent(i).replace(/^\//,""));mD(hD(a),{recursive:!0}),dD(o,a),n+=1}return{copied:n,missing:s}}var Pw=M(()=>{Vr();ye();er()});async function ph(e,t,r){let n=e.$layout??t.defaults?.layout??null;if(!n)return e;let s=await r(n);if(s.$layout)s=await ph(s,t,r);let i=e.children??[],o=A(i)?[i]:Array.isArray(i)?i:[],a=bD(s);if(yD(a,o),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 r=new Map,n=[];for(let s of t){let i=V(s)?s.attributes?.slot:void 0;if(i){let o=r.get(i);if(!o)o=[],r.set(i,o);o.push(s)}else n.push(s)}jw(e,r,n)}function jw(e,t,r){if(!V(e))return;if(!Array.isArray(e.children))return;let n=[];for(let s of e.children)if(V(s)&&s.tagName==="slot"){let i=s.attributes?.name,o=i?t.get(i):void 0;if(i&&o)n.push(...o),t.delete(i);else if(!i&&r.length>0)n.push(...r);else if(Array.isArray(s.children))n.push(...s.children)}else jw(s,t,r),n.push(s);e.children=n}function bD(e){return structuredClone(e)}var kw=M(()=>{ye()});import{existsSync as xD,readFileSync as $D}from"node:fs";import{resolve as _w}from"node:path";function Aw(e){return(t)=>{let r=_w(e,t);if(!xD(r))throw Error(`Layout not found: ${t} (resolved to ${r})`);try{return Nn($s($D(r,"utf8"),r),r)}catch(n){throw Error(`Invalid layout at ${r}: ${Pe(n)}`,{cause:n})}}}function Rw(e,t,r){return ph(e,t,Aw(r))}function Ow(e,t,r){let n=Aw(r),s=[],i=e.$layout??t.defaults?.layout;while(i){let o=_w(r,i);if(s.some((l)=>l.path===o))break;let a=n(i);s.push({doc:a,path:o}),i=a.$layout}return s}var Nw=M(()=>{Xo();Ui();er();kw()});import{dirname as wD,relative as vD,resolve as SD,sep as ED}from"node:path";function Cw(e,t){return vD(t,e).split(ED).join("/")}function PD(e,t,r){if(!e.startsWith("./")&&!e.startsWith("../"))return e;return`./${Cw(SD(t,e),r)}`}function zl(e,t,r){let n=wD(t),s=Cw(t,r);return D$(e).map((i)=>({exportName:i.exportName,src:PD(i.src,n,r),declaredIn:s}))}function Tw(e){let t=new Map;for(let{exportName:s,src:i,declaredIn:o}of e){let a=t.get(s)??new Map;if(t.set(s,a),!a.has(i))a.set(i,o)}let r=[],n=[];for(let[s,i]of t){let o=[...i];if(r.push({exportName:s,src:o[0][0]}),o.length>1){let a=o.map(([l,c])=>`${l} (declared in ${c})`);n.push(`Server function "${s}" is exported by ${o.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:r,errors:n}}var Iw=M(()=>{In()});function Jw(e,t){if(!A(t)||t.trim()==="")return[...e];return[{attributes:{content:t,name:"description"},tagName:"meta"},...e]}function Mw(e=[],t=[],r=[],n={}){let s=[{attributes:{charset:n.charset??"utf8"},tagName:"meta"},{attributes:{content:"width=device-width, initial-scale=1",name:"viewport"},tagName:"meta"}],i=new Map;for(let a of[...s,...e,...t,...r]){let l=mh(a);i.set(l,a)}let o=n.title??n.siteName??"Jx Site";if(i.set("title",{children:[o],tagName:"title"}),n.pageUrl&&n.siteUrl){let a=Ks(n.pageUrl,n.siteUrl);if(![...i.values()].some((c)=>V(c)&&c.tagName==="link"&&c.attributes?.rel==="canonical")){let c={attributes:{href:a,rel:"canonical"},tagName:"link"};i.set(mh(c),c)}if(!i.has("meta:og:url"))i.set("meta:og:url",{attributes:{content:a,property:"og:url"},tagName:"meta"})}if(n.siteName&&!i.has("meta:og:site_name"))i.set("meta:og:site_name",{attributes:{content:n.siteName,property:"og:site_name"},tagName:"meta"});for(let a of n.alternates??[]){let l={attributes:{href:a.href,hreflang:a.hreflang,rel:"alternate"},tagName:"link"},c=mh(l);if(!i.has(c))i.set(c,l)}return[...i.values()]}function mh(e){if(!V(e))return String(e);let t=e.tagName??"unknown",r=e.attributes??{};if(t==="title")return"title";if(r.charset)return"meta:charset";if(t==="meta"&&r.name)return`meta:${r.name}`;if(t==="meta"&&r.property)return`meta:${r.property}`;if(t==="link"&&r.rel){let n=r.hreflang??r.type??r.media??r.sizes??"";return`link:${r.rel}:${r.href??""}:${String(n)}`}if(t==="script"&&r.src)return`script:${r.src}`;if(t==="style"){let n=Array.isArray(e.children)?e.children.join(""):e.textContent,s=V(n)?JSON.stringify(n):n??"";return`style:${jD(s)}`}return`${t}:${JSON.stringify(e)}`}function jD(e){let t=0;for(let r=0;r<e.length;r++)t=Math.trunc((t<<5)-t+(e.codePointAt(r)??0));return t.toString(36)}function Dw(e){return e.map((t)=>kD(t)).join(`
156
+ `)}function kD(e){if(A(e))return e;if(!V(e))return"";let t=e.tagName,r=e.attributes??{},n=Object.entries(r).map(([l,c])=>c===!0?l:`${l}="${_D(c)}"`).join(" "),s=n?`<${t} ${n}>`:`<${t}>`;if(t!==void 0&&new Set(["meta","link","base","br","hr","img","input"]).has(t))return s;let o=Array.isArray(e.children)?e.children.join(""):e.textContent,a=V(o)?JSON.stringify(o,null,2):o??"";return`${s}${a}</${t}>`}function _D(e){return String(e).replaceAll("&","&amp;").replaceAll('"',"&quot;").replaceAll("<","&lt;")}var Lw=M(()=>{Vr();ye()});function OD(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 ND(e){if(!A(e))return[];return e.split(/\s+/).filter((t)=>{if(t==="")return!1;let r=t.toLowerCase();return!AD.has(r)&&!RD.has(r)&&!OD(t)})}function Fw(e){let t=new Set;for(let r of e){if(!V(r)||r.tagName!=="link")continue;for(let n of ND(r.attributes?.rel))t.add(n)}return[...t]}var AD,RD;var qw=M(()=>{ye();AD=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"]),RD=new Set(["shortcut"])});async function pf(e,t={}){let{resolveElementPath:r,$media:n,formats:s}=t,i=[],o=new Set;async function a(l,c){let u,p;if(A(l)){let{readFileSync:E}=await import("node:fs"),{resolve:P}=await import("node:path");if(p=c?P(c,l):P(l),o.has(p))return;if(o.add(p),xs(p))u=$s(E(p,"utf8"),p);else{let{extname:R}=await import("node:path"),N=R(p).toLowerCase(),_=s?.byExtension(N,"parse");if(!_){await Promise.resolve().then(() => vs());throw $u(p,N)}u=await _.parseDocument(E(p,"utf8"))}u=Nn(u,p)}else{if(u=Nn(l,l.tagName??"a component"),p=null,u.tagName&&o.has(u.tagName))return;if(u.tagName)o.add(u.tagName)}let{tagName:h}=u;if(!h||!h.includes("-"))throw Error(`compileElement: tagName "${h}" must contain a hyphen`);let{dirname:m}=await import("node:path"),y=p?m(p):null,g=[];if(Array.isArray(u.$elements))for(let E of u.$elements){let P=qe(E)?E.$ref:E;if(!A(P))continue;if(y)await a(P,y);let R=r?r(P,y):P.replace(/\.(?:json|jxn)$/i,".js");g.push(R)}let b=tf(h);if(n)u.$media={...n,...u.$media};let{rewriteSrc:w}=t,j=Gl(u,b,g,w?(E)=>w(E,y):void 0,io(u,t.defaults),t.serverBaseUrl),S=p?p.replace(/\.(?:json|jxn)$/i,".js"):`${h}.js`;i.push({content:j,path:S,tagName:h})}return await a(e,t.basePath??null),{files:i}}async function CD(e,t={}){let{title:r="Jx App",reactivitySrc:n="https://esm.sh/@vue/reactivity@3.5.13",litHtmlSrc:s="https://esm.sh/lit-html@3.3.0"}=t,i=await pf(e,t),o=i.files.at(-1);if(!o)throw Error("compileElementPage: no element modules were produced");let{basename:a}=await import("node:path"),l=a(o.path),c=`<!DOCTYPE html>
157
157
  <html lang="en">
158
158
  <head>
159
159
  <meta charset="utf-8">
@@ -172,52 +172,52 @@ ${n}
172
172
  <${o.tagName}></${o.tagName}>
173
173
  <script type="module" src="./${l}"></script>
174
174
  </body>
175
- </html>`;return{files:i.files,html:c}}function zM(e){if(!V(e)||Array.isArray(e))return JSON.stringify(e);if("default"in e)return JSON.stringify(e.default);if(Js(e))return;if(e.$prototype==="LocalStorage"||e.$prototype==="SessionStorage")return JSON.stringify(e.default??null);if(e.$prototype==="Request")return"null";if(as(e))return"null";return JSON.stringify(e)}function GM(e){let t=new Set,r=new Set,n=(i)=>{if(i.startsWith("#/state/"))t.add(i.slice(8).split("/")[0])},s=(i)=>{if(O(i)){for(let a of i.matchAll(/\bstate\.([A-Za-z_$][\w$]*)\s*\(/g))t.add(a[1]);return}if(!V(i)||r.has(i))return;if(r.add(i),Array.isArray(i)){for(let a of i)s(a);return}let o=i;if(o.operator==="call"&&Be(o.target))n(o.target.$ref);for(let[a,l]of Object.entries(o)){if(a.startsWith("on")&&a!=="observedAttributes"&&Be(l))n(l.$ref);s(l)}};return s(e.children),s(e.state),t}function Dl(e,t,r,n,s=null,i="/_jx/server"){let o=["// Generated by @jxsuite/compiler — do not edit manually"];if(e.$id)o.push(`// Source: ${e.$id}`);for(let R of r)o.push(`import '${R}';`);let a=new Map,l=new Map,c=e.state??{},u=GM(e);for(let[R,_]of Object.entries(c))if(Mr(_)&&_.$src){let I=_.$src;if(_.$lazy===!0){if(!u.has(R)&&!xw.has(R))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 J=l.get(I);if(!J)J=[],l.set(I,J);J.push({binding:R,exportName:jm(R,_)});continue}let L=a.get(I);if(!L)L=[],a.set(I,L);L.push(Nu(R,_))}for(let[R,_]of a){let I=n?n(R):R;o.push(`import { ${_.join(", ")} } from '${I}';`)}let p=Object.entries(c).flatMap(([R,_])=>vn(_)&&_.$prototype==="Request"?[[R,_]]:[]),h=Object.entries(c).flatMap(([R,_])=>as(_)?[[R,_]]:[]);if(o.push("import { reactive, computed, effect, stop } from '@vue/reactivity';","import { render, html, nothing } from 'lit-html';",Du()),h.length>0)o.push(Lu());let m=s===null&&Ks(e.children);if(m)o.push(m$());let b=0;for(let[R,_]of l){let I=n?n(R):R,L=`_jxLazy${b}`;b+=1,o.push(`let ${L};`,`const ${L}Load = () => (${L} ??= import('${I}'));`,..._.map(({binding:J,exportName:F})=>`const ${J} = (...args) => ${L}Load().then((m) => m.${F}(...args));`))}o.push("",`class ${t} extends HTMLElement {`," #effects = [];",...s===null?[]:[" #root = null;"],""," constructor() {"," super();");let g=[],y=[],w=[],j=[],S=[];for(let[R,_]of Object.entries(c))if(Dr(_))if(Ri(_))j.push([R,_]);else if(Es(_.$expression.operator))w.push([R,_]);else y.push([R,_]);else if(Mr(_))if(_.$src&&!O(_.body))if(u.has(R)||xw.has(R))w.push([R,_]);else y.push([R,_]);else if(O(_.body)&&Oi(_.body))y.push([R,_]);else w.push([R,_]);else if(O(_)&&_.includes("${"))S.push([R,_]);else{let I=zM(_);if(I!==void 0)g.push([R,I])}o.push(" this.state = reactive({");for(let[R,_]of g)o.push(` ${Ss(R)}: ${_},`);o.push(" });");for(let[R,_]of w)if(o.push(""),Dr(_)){let I=dr(_.$expression,{eventParam:"e",statePrefix:"s"});o.push(` ${Me("this.state",Lt(R))} = (s, e) => { ${I}; };`)}else if(Is(_)){let I=Zr(_.body,{dispatchTarget:"this",eventParam:"e",indent:" ",statePrefix:"this.state"});o.push(` ${Me("this.state",Lt(R))} = (s, e) => {`,I," };")}else{let I=_.parameters?ls(_.parameters):_.arguments??["state"],L=I.join(", "),J=O(_.body)?_.body:"";if(I[0]==="state")if(_.$src)o.push(` ${Me("this.state",Lt(R))} = (${L}) => ${R}(${L});`);else o.push(` ${Me("this.state",Lt(R))} = (${L}) => {`,` ${J}`," };");else{let F=I.map((K)=>K==="state"?"state":"e").join(", ");if(_.$src)o.push(` ${Me("this.state",Lt(R))} = (state, e) => ${R}(${F});`);else o.push(` ${Me("this.state",Lt(R))} = (state, e) => {`,` const _fn = (${L}) => {`,` ${J}`," };",` return _fn(${F});`," };")}}for(let[R,_]of j){o.push("");let I=dr(_.$expression,{eventParam:"e",statePrefix:"this.state"});o.push(` ${Me("this.state",Lt(R))} = ${Tl(_,I)};`)}for(let[R,_]of S)o.push("",` ${Me("this.state",Lt(R))} = computed(() => ${Mu(sa(_,"this.state",{code:!1}))});`);for(let[R,_]of y)if(o.push(""),Dr(_)){let I=dr(_.$expression,{eventParam:"e",statePrefix:"this.state"});o.push(` ${Me("this.state",Lt(R))} = computed(() => ${I});`)}else if(_.$src)o.push(` ${Me("this.state",Lt(R))} = computed(() => ${R}(this.state));`);else{o.push(` ${Me("this.state",Lt(R))} = computed(() => {`);let I=sa(O(_.body)?_.body:"","this.state");o.push(` ${I}`," });")}o.push(" }","");let E=[];if(Array.isArray(e.children)){let R={n:0};for(let _ of e.children)Ys(_,E,e.$media??{},"",R,e.tagName)}let P=vw(),A=!Array.isArray(e.children)&&e.textContent!==void 0?` ${Qu(e.textContent)}`:Xu(e.children,e.style," ",!1,!1,P);o.push(" template() {"," const s = this.state;",...P.decls," return html`",A," `;"," }","",...s===null?[]:[" #renderRoot() {"," if (this.#root) return this.#root;",s==="closed"?" this.#root = this.attachInternals().shadowRoot ?? this.attachShadow({ mode: 'closed' });":" this.#root = this.shadowRoot ?? this.attachShadow({ mode: 'open' });"," return this.#root;"," }",""]," connectedCallback() {"," const _pa = this.getAttribute('data-jx-props');"," if (_pa) {"," try {"," const _p = JSON.parse(_pa);"," for (const [k, v] of Object.entries(_p)) {"," if (k.startsWith('#')) continue;"," if (k in this.state) this.state[k] = v;"," }"," } catch {}"," this.removeAttribute('data-jx-props');"," }"," const _pn = this.getAttributeNames().filter(n => n.startsWith('props.') && n.length > 6);"," for (const _n of _pn) {"," const _k = _n.slice(6);"," if (_k.startsWith('#')) { this.removeAttribute(_n); continue; }"," if (_k in this.state) {"," this.state[_k] = this.getAttribute(_n);"," this.removeAttribute(_n);"," }"," }"," for (const key of Object.keys(this.state)) {"," if (key.startsWith('#')) continue;"," if (this.hasOwnProperty(key) && this[key] !== undefined) {"," this.state[key] = this[key];"," }"," }");for(let[R,_]of p)o.push(Tu(R,_,{collect:"this.#effects",indent:" ",statePrefix:"this.state"}));for(let[R,_]of h)o.push(Iu(R,_,{collect:"this.#effects",indent:" ",serverBaseUrl:i,statePrefix:"this.state"}));if(V(e.style)){let R=[];for(let[_,I]of Object.entries(e.style)){if(_.startsWith(":")||_.startsWith(".")||_.startsWith("&")||_.startsWith("[")||_.startsWith("@"))continue;if(O(I)&&I.includes("${"))R.push([jr(_),I])}if(R.length>0){o.push(" this.#effects.push(effect(() => {");for(let[_,I]of R){let L=I.replaceAll(/\$\{([^}]+)\}/g,(J,F)=>`\${${sa(F,"this.state")}}`);o.push(` this.style['${_}'] = \`${L}\`;`)}o.push(" }));")}}if(m)o.push(` const _slotted = ${km}(this);`);if(o.push(" if (this.hasAttribute('data-jx-prerendered')) {"," this.removeAttribute('data-jx-prerendered');"," }"),s===null)o.push(" this.replaceChildren();"," this.#effects.push(effect(() => render(this.template(), this)));");else o.push(" const _root = this.#renderRoot();"," for (const _n of [..._root.childNodes]) {"," if (!(_n.nodeType === 1 && _n.tagName === 'LINK')) _n.remove();"," }"," this.#effects.push(effect(() => render(this.template(), _root)));");if(m)o.push(` ${_m}(this, _slotted);`);return o.push(" if (typeof this.state.onMount === 'function') {"," queueMicrotask(() => this.state.onMount(this.state));"," }"," }",""," disconnectedCallback() {"," for (const _e of this.#effects) { stop(_e); }"," this.#effects.length = 0;"," if (typeof this.state.onUnmount === 'function') { this.state.onUnmount(this.state); }"," }","}","",`customElements.define('${e.tagName}', ${t});`,""),o.join(`
176
- `)}function vw(){return{byText:new Map,decls:[]}}function Sw(e,t){let r=e.byText.get(t);if(r)return r;let n=`_c${e.decls.length}`;e.decls.push(` const ${n} = html\`
175
+ </html>`;return{files:i.files,html:c}}function TD(e){if(!V(e)||Array.isArray(e))return JSON.stringify(e);if("default"in e)return JSON.stringify(e.default);if(Ls(e))return;if(e.$prototype==="LocalStorage"||e.$prototype==="SessionStorage")return JSON.stringify(e.default??null);if(e.$prototype==="Request")return"null";if(ds(e))return"null";return JSON.stringify(e)}function Gl(e,t,r,n,s=null,i="/_jx/server"){let o=["// Generated by @jxsuite/compiler — do not edit manually"];if(e.$id)o.push(`// Source: ${e.$id}`);for(let N of r)o.push(`import '${N}';`);let a=new Map,l=new Map,c=e.state??{},u=no(e);for(let[N,_]of Object.entries(c))if(ei(`state entry "${N}"`,_),Bt(_)&&_.$src){let q=_.$src;if(_.$lazy===!0){if(u.get(N)==="computed")throw Error(`"${N}" 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 ${N}() from a handler instead of binding its value.`);let O=l.get(q);if(!O)O=[],l.set(q,O);O.push({binding:N,exportName:Um(N,_)});continue}let D=a.get(q);if(!D)D=[],a.set(q,D);D.push(zu(N,_))}for(let[N,_]of a){let q=n?n(N):N;o.push(`import { ${_.join(", ")} } from '${q}';`)}let p=Object.entries(c).flatMap(([N,_])=>jn(_)&&_.$prototype==="Request"?[[N,_]]:[]),h=Object.entries(c).flatMap(([N,_])=>ds(_)?[[N,_]]:[]);if(o.push("import { reactive, computed, effect, stop } from '@vue/reactivity';","import { render, html, nothing } from 'lit-html';",Zu()),h.length>0)o.push(Qu());let m=s===null&&Zs(e.children);if(m)o.push(M$());let y=0;for(let[N,_]of l){let q=n?n(N):N,D=`_jxLazy${y}`;y+=1,o.push(`let ${D};`,`const ${D}Load = () => (${D} ??= import('${q}'));`,..._.map(({binding:O,exportName:L})=>`const ${O} = (...args) => ${D}Load().then((m) => m.${L}(...args));`))}o.push("",`class ${t} extends HTMLElement {`," #effects = [];",...s===null?[]:[" #root = null;"],""," constructor() {"," super();");let g=[],b=[],w=[],j=[],S=[];for(let[N,_]of Object.entries(c))if(Dr(_))if(Ci(_))j.push([N,_]);else if(_s(_.$expression.operator))w.push([N,_]);else b.push([N,_]);else if(Bt(_))(u.get(N)==="computed"?b:w).push([N,_]);else if(A(_)&&_.includes("${"))S.push([N,_]);else{let q=TD(_);if(q!==void 0)g.push([N,q])}o.push(" this.state = reactive({");for(let[N,_]of g)o.push(` ${ks(N)}: ${_},`);o.push(" });");for(let[N,_]of w)if(o.push(""),Dr(_)){let q=pr(_.$expression,{eventParam:"e",statePrefix:"s"});o.push(` ${Ve("this.state",dr(N))} = (s, e) => { ${q}; };`)}else if(Pn(_)){let q=en(_.body,{dispatchTarget:"this",eventParam:"e",indent:" ",statePrefix:"this.state"});o.push(` ${Ve("this.state",dr(N))} = (s, e) => {`,q," };")}else{let q=Ve("this.state",dr(N));if(_.$src)o.push(` ${q} = ${N};`);else{let D=A(_.body)?_.body:"";o.push(` ${q} = (${Cn(_).join(", ")}) => {`,` ${D}`," };")}}for(let[N,_]of j){o.push("");let q=pr(_.$expression,{eventParam:"e",statePrefix:"this.state"});o.push(` ${Ve("this.state",dr(N))} = ${Wl(_,q)};`)}for(let[N,_]of S)o.push("",` ${Ve("this.state",dr(N))} = computed(() => ${Yu(la(_,"this.state",{code:!1}))});`);for(let[N,_]of b)if(o.push(""),Dr(_)){let q=pr(_.$expression,{eventParam:"e",statePrefix:"this.state"});o.push(` ${Ve("this.state",dr(N))} = computed(() => ${q});`)}else if(_.$src)o.push(` ${Ve("this.state",dr(N))} = computed(() => ${N}(this.state));`);else{o.push(` ${Ve("this.state",dr(N))} = computed(() => {`);let q=la(A(_.body)?_.body:"","this.state");o.push(` ${q}`," });")}o.push(" }","");let E=[];if(Array.isArray(e.children)){let N={n:0};for(let _ of e.children)Qs(_,E,e.$media??{},"",N,e.tagName)}let P=Ww(),R=!Array.isArray(e.children)&&e.textContent!==void 0?` ${mf(e.textContent)}`:df(e.children,e.style," ",!1,!1,P);o.push(" template() {"," const s = this.state;",...P.decls," return html`",R," `;"," }","",...s===null?[]:[" #renderRoot() {"," if (this.#root) return this.#root;",s==="closed"?" this.#root = this.attachInternals().shadowRoot ?? this.attachShadow({ mode: 'closed' });":" this.#root = this.shadowRoot ?? this.attachShadow({ mode: 'open' });"," return this.#root;"," }",""]," connectedCallback() {"," const _pa = this.getAttribute('data-jx-props');"," if (_pa) {"," try {"," const _p = JSON.parse(_pa);"," for (const [k, v] of Object.entries(_p)) {"," if (k.startsWith('#')) continue;"," if (k in this.state) this.state[k] = v;"," }"," } catch {}"," this.removeAttribute('data-jx-props');"," }"," const _pn = this.getAttributeNames().filter(n => n.startsWith('props.') && n.length > 6);"," for (const _n of _pn) {"," const _k = _n.slice(6);"," if (_k.startsWith('#')) { this.removeAttribute(_n); continue; }"," if (_k in this.state) {"," this.state[_k] = this.getAttribute(_n);"," this.removeAttribute(_n);"," }"," }"," for (const key of Object.keys(this.state)) {"," if (key.startsWith('#')) continue;"," if (this.hasOwnProperty(key) && this[key] !== undefined) {"," this.state[key] = this[key];"," }"," }");for(let[N,_]of p)o.push(Gu(N,_,{collect:"this.#effects",indent:" ",statePrefix:"this.state"}));for(let[N,_]of h)o.push(Ku(N,_,{collect:"this.#effects",indent:" ",serverBaseUrl:i,statePrefix:"this.state"}));if(V(e.style)){let N=[];for(let[_,q]of Object.entries(e.style)){if(_.startsWith(":")||_.startsWith(".")||_.startsWith("&")||_.startsWith("[")||_.startsWith("@"))continue;if(A(q)&&q.includes("${"))N.push([jr(_),q])}if(N.length>0){o.push(" this.#effects.push(effect(() => {");for(let[_,q]of N){let D=q.replaceAll(/\$\{([^}]+)\}/g,(O,L)=>`\${${la(L,"this.state")}}`);o.push(` this.style['${_}'] = \`${D}\`;`)}o.push(" }));")}}if(m)o.push(` const _slotted = ${zm}(this);`);if(o.push(" if (this.hasAttribute('data-jx-prerendered')) {"," this.removeAttribute('data-jx-prerendered');"," }"),s===null)o.push(" this.replaceChildren();"," this.#effects.push(effect(() => render(this.template(), this)));");else o.push(" const _root = this.#renderRoot();"," for (const _n of [..._root.childNodes]) {"," if (!(_n.nodeType === 1 && _n.tagName === 'LINK')) _n.remove();"," }"," this.#effects.push(effect(() => render(this.template(), _root)));");if(m)o.push(` ${Gm}(this, _slotted);`);return o.push(" if (typeof this.state.onMount === 'function') {"," queueMicrotask(() => this.state.onMount(this.state));"," }"," }",""," disconnectedCallback() {"," for (const _e of this.#effects) { stop(_e); }"," this.#effects.length = 0;"," if (typeof this.state.onUnmount === 'function') { this.state.onUnmount(this.state); }"," }","}","",`customElements.define('${e.tagName}', ${t});`,""),o.join(`
176
+ `)}function Ww(){return{byText:new Map,decls:[]}}function Uw(e,t){let r=e.byText.get(t);if(r)return r;let n=`_c${e.decls.length}`;e.decls.push(` const ${n} = html\`
177
177
  ${t}
178
- \`;`);let s=`\${${n}}`;return e.byText.set(t,s),s}function Xu(e,t,r,n=!1,s=!1,i=null,o=!1){if(!e)return"";let a=o?aa:"";if(dt(e))return`${ww(e,r)}${a}`;if(!Array.isArray(e))return"";return e.map((l)=>{if(dt(l))return`${ww(l,r)}${a}`;let c=Ym(l,n?"":r,n,s,i);return O(l)&&l.includes("${")||V(l)&&Sn(l.tagName)?`${c}${a}`:c}).join(n?"":`
179
- `)}function Ym(e,t,r=!1,n=!1,s=null,i=null){if(O(e)){if(e.includes("${"))return`${t}${Qu(e)}`;return`${t}${_e(e)}`}if(Nt(e)||Qt(e))return`${t}${_e(String(e))}`;if(!V(e))return"";if(Sn(e.tagName)){let g=e.tagName.$expression,y=js(g.target,{eventParam:"e",statePrefix:"s"}),w=g.operator==="?:"?[[!0,g.value],[!1,g.initial]]:[...Object.entries(g.cases),["__default__",g.default]],j=w.map(([,_])=>_),S=j.map((_)=>r||Xs.has(_)),E=null;if(s&&S.every((_)=>_===S[0])){let _=$w(e,`${t} `,S[0]===!0,n,s,j.some((I)=>I.includes("-")));if(_.trim()!=="")E=Sw(s,_)}let P=w.map(([_,I])=>{let L={...e,tagName:I};return[_,Ym(L,`${t} `,r,n,s,E)]});if(g.operator==="?:"){let[,_]=P[0],[,I]=P[1];return`${t}\${${y}
178
+ \`;`);let s=`\${${n}}`;return e.byText.set(t,s),s}function df(e,t,r,n=!1,s=!1,i=null,o=!1){if(!e)return"";let a=o?fa:"";if(dt(e))return`${Bw(e,r)}${a}`;if(!Array.isArray(e))return"";return e.map((l)=>{if(dt(l))return`${Bw(l,r)}${a}`;let c=gh(l,n?"":r,n,s,i);return A(l)&&l.includes("${")||V(l)&&kn(l.tagName)?`${c}${a}`:c}).join(n?"":`
179
+ `)}function gh(e,t,r=!1,n=!1,s=null,i=null){if(A(e)){if(e.includes("${"))return`${t}${mf(e)}`;return`${t}${_e(e)}`}if(Ct(e)||Qt(e))return`${t}${_e(String(e))}`;if(!V(e))return"";if(kn(e.tagName)){let g=e.tagName.$expression,b=As(g.target,{eventParam:"e",statePrefix:"s"}),w=g.operator==="?:"?[[!0,g.value],[!1,g.initial]]:[...Object.entries(g.cases),["__default__",g.default]],j=w.map(([,_])=>_),S=j.map((_)=>r||ti.has(_)),E=null;if(s&&S.every((_)=>_===S[0])){let _=Vw(e,`${t} `,S[0]===!0,n,s,j.some((q)=>q.includes("-")));if(_.trim()!=="")E=Uw(s,_)}let P=w.map(([_,q])=>{let D={...e,tagName:q};return[_,gh(D,`${t} `,r,n,s,E)]});if(g.operator==="?:"){let[,_]=P[0],[,q]=P[1];return`${t}\${${b}
180
180
  ? html\`
181
181
  ${_}
182
182
  \`
183
183
  : html\`
184
- ${I}
185
- \`}`}let A=P.flatMap(([_,I])=>_==="__default__"?[]:[` ${JSON.stringify(_)}: html\`
186
- ${I}
187
- \``]),[,R]=P.at(-1);return`${t}\${{
188
- ${A.join(`,
184
+ ${q}
185
+ \`}`}let R=P.flatMap(([_,q])=>_==="__default__"?[]:[` ${JSON.stringify(_)}: html\`
186
+ ${q}
187
+ \``]),[,N]=P.at(-1);return`${t}\${{
188
+ ${R.join(`,
189
189
  `)}
190
- }[String(${y})] ?? html\`
191
- ${R}
192
- \`}`}let o=e.tagName??"div",a=r||Xs.has(o),l=[];if(e.attributes)for(let[g,y]of Object.entries(e.attributes))if(Be(y))l.push(`${g}="\${${oa}('${g}', ${On(y.$ref)}) ?? nothing}"`);else if(O(y)&&KM(y))l.push(`${g}="\${${oa}('${g}', ${Hr(y).slice(2,-1)}) ?? nothing}"`);else if(O(y)&&y.includes("${"))l.push(`${g}="${Hr(y)}"`);else if(Qt(y)){let w=to(g,y);if(w!==null)l.push(w===""?g:`${g}="${w}"`)}else l.push(`${g}="${y}"`);if(e.id)l.push(`id="${Hr(String(e.id))}"`);if(e.className)l.push(`class="${Hr(String(e.className))}"`);for(let[g,y]of Object.entries(e)){if(Ps.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(Yu(y))l.push(`.${g}="\${${On(y.$ref)}}"`);else if(O(y)&&y.includes("${"))l.push(`.${g}="${Hr(y)}"`);else l.push(`.${g}="\${${JSON.stringify(y)}}"`)}if(e.$props)for(let[g,y]of Object.entries(e.$props))if(Yu(y))l.push(`.${g}="\${${On(y.$ref)}}"`);else if(O(y)&&y.includes("${"))l.push(`.${g}="${Hr(y)}"`);else l.push(`.${g}="\${${JSON.stringify(y)}}"`);let c=n?"s.$map = $map; ":"";for(let[g,y]of Object.entries(e)){if(!g.startsWith("on")||g==="observedAttributes")continue;let w=g.slice(2).toLowerCase();if(Yu(y))l.push(c?`@${w}="\${(e) => { ${c}${On(y.$ref)}(s, e); }}"`:`@${w}="\${(e) => ${On(y.$ref)}(s, e)}"`);else if(V(y)&&"$expression"in y){let j=dr(y.$expression,{eventParam:"e",statePrefix:"s"});l.push(`@${w}="\${(e) => { ${c}${j}; }}"`)}else if(Mr(y))l.push(`@${w}="\${(e) => { ${c}${YM(y)} }}"`)}let u=jw(e.style);if(u)l.push(`style="${u}"`);let p=l.length>0?`
190
+ }[String(${b})] ?? html\`
191
+ ${N}
192
+ \`}`}let o=e.tagName??"div",a=r||ti.has(o),l=[];if(e.attributes)for(let[g,b]of Object.entries(e.attributes))if(qe(b))l.push(`${g}="\${${ua}('${g}', ${Jn(b.$ref)}) ?? nothing}"`);else if(A(b)&&ID(b))l.push(`${g}="\${${ua}('${g}', ${Ur(b).slice(2,-1)}) ?? nothing}"`);else if(A(b)&&b.includes("${"))l.push(`${g}="${Ur(b)}"`);else if(Qt(b)){let w=so(g,b);if(w!==null)l.push(w===""?g:`${g}="${w}"`)}else l.push(`${g}="${b}"`);if(e.id)l.push(`id="${Ur(String(e.id))}"`);if(e.className)l.push(`class="${Ur(String(e.className))}"`);for(let[g,b]of Object.entries(e)){if(Rs.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(ff(b))l.push(`.${g}="\${${Jn(b.$ref)}}"`);else if(A(b)&&b.includes("${"))l.push(`.${g}="${Ur(b)}"`);else l.push(`.${g}="\${${JSON.stringify(b)}}"`)}if(e.$props)for(let[g,b]of Object.entries(e.$props))if(ff(b))l.push(`.${g}="\${${Jn(b.$ref)}}"`);else if(A(b)&&b.includes("${"))l.push(`.${g}="${Ur(b)}"`);else l.push(`.${g}="\${${JSON.stringify(b)}}"`);let c=n?"s.$map = $map; ":"";for(let[g,b]of Object.entries(e)){if(!g.startsWith("on")||g==="observedAttributes")continue;ei(`inline "${g}" handler`,b);let w=g.slice(2).toLowerCase();if(ff(b))l.push(c?`@${w}="\${(e) => { ${c}${Jn(b.$ref)}(s, e); }}"`:`@${w}="\${(e) => ${Jn(b.$ref)}(s, e)}"`);else if(V(b)&&"$expression"in b){let j=pr(b.$expression,{eventParam:"e",statePrefix:"s"});l.push(`@${w}="\${(e) => { ${c}${j}; }}"`)}else if(Bt(b))l.push(`@${w}="\${(e) => { ${c}${zw(b)} }}"`)}let u=Gw(e.style);if(u)l.push(`style="${u}"`);let p=l.length>0?`
193
193
  ${t} ${l.join(`
194
194
  ${t} `)}`:"";if(new Set(["input","br","hr","img","meta","link"]).has(o))return`${t}<${o}${p}
195
- ${t}>`;let m=i??$w(e,t,a,n,s,o.includes("-")),b=o==="slot"?aa:"";return a?`${b}<${o}${p}>${m}${b}</${o}>`:`${t}${b}<${o}${p}
196
- ${t}>${m}${b}</${o}>`}function $w(e,t,r,n,s,i=!1){if(e.$switch){let o=Be(e.$switch)?e.$switch.$ref:e.$switch,a=On(o),l=[];for(let[h,m]of Object.entries(e.cases??{})){if(!m||Be(m))continue;l.push([h,Ym(m,`${t} `,!1,n,s)])}let c=l.map(([,h])=>h),u=new Set(c.filter((h,m)=>c.indexOf(h)!==m&&h.trim()!==""));return`\${{
197
- ${l.map(([h,m])=>{let b=s&&u.has(m)?Sw(s,m):m;return` ${JSON.stringify(h)}: html\`
198
- ${b}
195
+ ${t}>`;let m=i??Vw(e,t,a,n,s,o.includes("-")),y=o==="slot"?fa:"";return a?`${y}<${o}${p}>${m}${y}</${o}>`:`${t}${y}<${o}${p}
196
+ ${t}>${m}${y}</${o}>`}function Vw(e,t,r,n,s,i=!1){if(e.$switch){let o=qe(e.$switch)?e.$switch.$ref:e.$switch,a=Jn(o),l=[];for(let[h,m]of Object.entries(e.cases??{})){if(!m||qe(m))continue;l.push([h,gh(m,`${t} `,!1,n,s)])}let c=l.map(([,h])=>h),u=new Set(c.filter((h,m)=>c.indexOf(h)!==m&&h.trim()!==""));return`\${{
197
+ ${l.map(([h,m])=>{let y=s&&u.has(m)?Uw(s,m):m;return` ${JSON.stringify(h)}: html\`
198
+ ${y}
199
199
  \``}).join(`,
200
200
  `)}
201
- }[${a}]}`}if(e.textContent!==void 0){let o=Qu(e.textContent),a=Be(e.textContent)||O(e.textContent)&&e.textContent.includes("${");return i&&a?`${o}${aa}`:o}if(e.innerHTML!==void 0)return e.innerHTML;if(e.children)return r?Xu(e.children,e.style,"",!0,n,s,i):`
202
- ${Xu(e.children,e.style,`${t} `,!1,n,s,i)}
203
- ${t}`;return""}function ww(e,t){let r=Be(e.items)?On(e.items.$ref):"ITEMS",n=e.map;if(!n)return"";let s=n.tagName??"div",i=[];if(n.attributes)for(let[m,b]of Object.entries(n.attributes))if(Be(b))i.push(`${m}="\${${Km(b.$ref)}}"`);else if(O(b)&&b.includes("${"))i.push(`${m}="${Hr(b)}"`);else i.push(`${m}="${b}"`);if(n.id)i.push(`id="${Hr(String(n.id))}"`);if(n.className)i.push(`class="${Hr(String(n.className))}"`);for(let[m,b]of Object.entries(n)){if(Ps.has(m)||m.startsWith("$")||m.startsWith("on")||m==="tagName"||m==="id"||m==="className"||m==="style"||m==="children"||m==="textContent"||m==="innerHTML"||m==="attributes")continue;if(Yu(b))i.push(`.${m}="\${${Km(b.$ref)}}"`);else if(O(b)&&b.includes("${"))i.push(`.${m}="${Hr(b)}"`);else i.push(`.${m}="\${${JSON.stringify(b)}}"`)}if(n.$props)for(let[m,b]of Object.entries(n.$props))if(Be(b))i.push(`.${m}="\${${Km(b.$ref)}}"`);else if(O(b)&&b.includes("${"))i.push(`.${m}="${Hr(b)}"`);else i.push(`.${m}="\${${JSON.stringify(b)}}"`);let o=jw(n.style);if(o)i.push(`style="${o}"`);for(let[m,b]of Object.entries(n)){if(!m.startsWith("on"))continue;let g=m.slice(2).toLowerCase();if(Be(b))i.push(`@${g}="\${(e) => { s.$map = $map; ${On(b.$ref)}(s, e); }}"`);else if(Dr(b)){let y=dr(b.$expression,{eventParam:"e",statePrefix:"s"});i.push(`@${g}="\${(e) => { s.$map = $map; ${y}; }}"`)}}let a=i.length>0?`
201
+ }[${a}]}`}if(e.textContent!==void 0){let o=mf(e.textContent),a=qe(e.textContent)||A(e.textContent)&&e.textContent.includes("${");return i&&a?`${o}${fa}`:o}if(e.innerHTML!==void 0)return e.innerHTML;if(e.children)return r?df(e.children,e.style,"",!0,n,s,i):`
202
+ ${df(e.children,e.style,`${t} `,!1,n,s,i)}
203
+ ${t}`;return""}function Bw(e,t){let r=qe(e.items)?Jn(e.items.$ref):"ITEMS",n=e.map;if(!n)return"";let s=n.tagName??"div",i=[];if(n.attributes)for(let[m,y]of Object.entries(n.attributes))if(qe(y))i.push(`${m}="\${${hh(y.$ref)}}"`);else if(A(y)&&y.includes("${"))i.push(`${m}="${Ur(y)}"`);else i.push(`${m}="${y}"`);if(n.id)i.push(`id="${Ur(String(n.id))}"`);if(n.className)i.push(`class="${Ur(String(n.className))}"`);for(let[m,y]of Object.entries(n)){if(Rs.has(m)||m.startsWith("$")||m.startsWith("on")||m==="tagName"||m==="id"||m==="className"||m==="style"||m==="children"||m==="textContent"||m==="innerHTML"||m==="attributes")continue;if(ff(y))i.push(`.${m}="\${${hh(y.$ref)}}"`);else if(A(y)&&y.includes("${"))i.push(`.${m}="${Ur(y)}"`);else i.push(`.${m}="\${${JSON.stringify(y)}}"`)}if(n.$props)for(let[m,y]of Object.entries(n.$props))if(qe(y))i.push(`.${m}="\${${hh(y.$ref)}}"`);else if(A(y)&&y.includes("${"))i.push(`.${m}="${Ur(y)}"`);else i.push(`.${m}="\${${JSON.stringify(y)}}"`);let o=Gw(n.style);if(o)i.push(`style="${o}"`);for(let[m,y]of Object.entries(n)){if(!m.startsWith("on"))continue;ei(`inline "${m}" handler`,y);let g=m.slice(2).toLowerCase();if(qe(y))i.push(`@${g}="\${(e) => { s.$map = $map; ${Jn(y.$ref)}(s, e); }}"`);else if(Dr(y)){let b=pr(y.$expression,{eventParam:"e",statePrefix:"s"});i.push(`@${g}="\${(e) => { s.$map = $map; ${b}; }}"`)}else if(Bt(y))i.push(`@${g}="\${(e) => { s.$map = $map; ${zw(y)} }}"`)}let a=i.length>0?`
204
204
  ${t} ${i.join(`
205
- ${t} `)}`:"",l=vw(),c="";if(n.textContent!==void 0)c=Qu(n.textContent);else if(n.children)c=`
206
- ${Xu(n.children,null,`${t} `,!1,!0,l)}
205
+ ${t} `)}`:"",l=Ww(),c="";if(n.textContent!==void 0)c=mf(n.textContent);else if(n.children)c=`
206
+ ${df(n.children,null,`${t} `,!1,!0,l)}
207
207
  ${t} `;let u=`html\`
208
208
  ${t} <${s}${a}
209
209
  ${t} >${c}</${s}>
210
- ${t}\``,p=(u.includes("$map")?"const $map = { item, index }; ":"")+l.decls.map((m)=>`${m.trim()} `).join(""),h=p?`(item, index) => { ${p}return ${u}; }`:`(item, index) => ${u}`;return`${t}\${${r}.map(${h})}`}function Yu(e){return Be(e)&&e.$ref!==""}function On(e){if(e.startsWith("#/state/"))return Me("s",e.slice(8));if(e.startsWith("$map/"))return Ew(e.slice(5));if(e.startsWith("parent#/"))return Me("s",e.slice(8));if(e.startsWith("window#/"))return Me("window",e.slice(8));if(e.startsWith("document#/"))return Me("document",e.slice(10));return Me("s",e)}function Ew(e){let[t,...r]=vs(e);return Me(t??"",r.map((n)=>Lt(n)).join("/"))}function Km(e){if(e.startsWith("$map/"))return Ew(e.slice(5));return On(e)}function Hr(e){return sa(e,"s",{code:!1})}function KM(e){return e.startsWith("${")&&e.endsWith("}")&&!e.slice(2).includes("${")}function Qu(e){if(Be(e))return`\${${On(e.$ref)}}`;if(O(e)&&e.includes("${"))return Hr(e);return String(e)}function YM(e){if(Is(e))return Zr(e.body,{dispatchTarget:"e.currentTarget",eventParam:"e",statePrefix:"s"});let t=O(e.body)?e.body:"",r=e.parameters?ls(e.parameters):e.arguments??[];if(r.length>0){let n=r.map((s)=>s==="state"?"s":"e").join(", ");return`((${r.join(", ")}) => { ${t}
211
- })(${n});`}return`${sa(t,"s",{bare:!0})}
212
- `}function jw(e){if(!V(e))return"";let t=[];for(let[r,n]of Object.entries(e)){if(r.startsWith(":")||r.startsWith(".")||r.startsWith("&")||r.startsWith("[")||r.startsWith("@"))continue;if(O(n)&&n.includes("${")){let s=jr(r);t.push(`${s}: ${Hr(n)}`)}}return t.join("; ")}var xw;var Ll=D(()=>{Uo();Zo();Rn();ye();Wi();Go();xw=new Set(["onMount","onUnmount","onAdopted"])});function Pw(e,t){let{title:r="Jx App",reactivitySrc:n,litHtmlSrc:s}=t,i=na(e,null,e.state??{},e.$media??{}),o=la(e,e.$media??{},t.projectStyle??null),a=[],l=kw(e,!1,i,a),c=[],u="",p="";if(a.length>0){for(let b of a){let g=Dl(b.def,b.className,[],t.rewriteSrc);c.push({content:g,path:`_islands/${b.tagName}.js`,tagName:b.tagName})}u=`<script type="importmap">
210
+ ${t}\``,p=(u.includes("$map")?"const $map = { item, index }; ":"")+l.decls.map((m)=>`${m.trim()} `).join(""),h=p?`(item, index) => { ${p}return ${u}; }`:`(item, index) => ${u}`;return`${t}\${${r}.map(${h})}`}function ff(e){return qe(e)&&e.$ref!==""}function Jn(e){if(e.startsWith("#/state/"))return Ve("s",e.slice(8));if(e.startsWith("$map/"))return Hw(e.slice(5));if(e.startsWith("parent#/"))return Ve("s",e.slice(8));if(e.startsWith("window#/"))return Ve("window",e.slice(8));if(e.startsWith("document#/"))return Ve("document",e.slice(10));return Ve("s",e)}function Hw(e){let[t,...r]=js(e);return Ve(t??"",r.map((n)=>dr(n)).join("/"))}function hh(e){if(e.startsWith("$map/"))return Hw(e.slice(5));return Jn(e)}function Ur(e){return la(e,"s",{code:!1})}function ID(e){return e.startsWith("${")&&e.endsWith("}")&&!e.slice(2).includes("${")}function mf(e){if(qe(e))return`\${${Jn(e.$ref)}}`;if(A(e)&&e.includes("${"))return Ur(e);return String(e)}function zw(e){if(Pn(e))return en(e.body,{dispatchTarget:"e.currentTarget",eventParam:"e",statePrefix:"s"});let t=A(e.body)?e.body:"";if(Tl(e))return`((${Cn(e).join(", ")}) => { ${t}
211
+ })(s, e);`;return`${la(t,"s",{bare:!0})}
212
+ `}function Gw(e){if(!V(e))return"";let t=[];for(let[r,n]of Object.entries(e)){if(r.startsWith(":")||r.startsWith(".")||r.startsWith("&")||r.startsWith("[")||r.startsWith("@"))continue;if(A(n)&&n.includes("${")){let s=jr(r);t.push(`${s}: ${Ur(n)}`)}}return t.join("; ")}var Kl=M(()=>{Xo();Il();ra();In();ye();Ui();Zo()});function Kw(e,t){let{title:r="Jx App",reactivitySrc:n,litHtmlSrc:s}=t,i=aa(e,null,e.state??{},e.$media??{}),o=da(e,e.$media??{},t.projectStyle??null),a=[],l=Xw(e,!1,i,a),c=[],u="",p="";if(a.length>0){for(let y of a){let g=Gl(y.def,y.className,[],t.rewriteSrc);c.push({content:g,path:`_islands/${y.tagName}.js`,tagName:y.tagName})}u=`<script type="importmap">
213
213
  {
214
214
  "imports": {
215
215
  "@vue/reactivity": "${n}",
216
216
  "lit-html": "${s}"
217
217
  }
218
218
  }
219
- </script>`,p=c.map((b)=>`<script type="module" src="./${b.path}"></script>`).join(`
220
- `)}let h=t.prePaintScheme!==!1&&Object.values(e.$media??{}).some((b)=>bn(String(b))!==null)?`<script>${ia()}</script>
219
+ </script>`,p=c.map((y)=>`<script type="module" src="./${y.path}"></script>`).join(`
220
+ `)}let h=t.prePaintScheme!==!1&&Object.values(e.$media??{}).some((y)=>$n(String(y))!==null)?`<script>${ca()}</script>
221
221
  `:"",m=`<!DOCTYPE html>
222
222
  <html lang="en">
223
223
  <head>
@@ -231,42 +231,43 @@ ${t}\``,p=(u.includes("$map")?"const $map = { item, index }; ":"")+l.decls.map((
231
231
  ${l}
232
232
  ${p}
233
233
  </body>
234
- </html>`;return{files:c,html:m}}function kw(e,t,r,n){if(O(e))return _e(e);if(Nt(e)||Qt(e))return _e(String(e));if(!V(e))return"";let s=na(e,r.scope,e.state??r.scopeDefs,e.$media??r.media);if(t){let c=n.length,u=`jx-island-${c}`,p=`JxIsland${c}`,h={...e,tagName:u};return n.push({className:p,def:h,tagName:u}),`<${u}></${u}>`}let i=Om(e.tagName,s.scope),o=no(e,s.scope);if(Rm.has(i))return`<${i}${o}>`;let a=r.preformatted===!0||Xs.has(i),l=XM(e,{...s,preformatted:a},n);return`<${i}${o}>${l}</${i}>`}function XM(e,t,r){if(e.textContent!==void 0){let n=Ze(e.textContent,t.scope);return n==null?"":_e(String(n))}if(e.innerHTML){let n=Ze(e.innerHTML,t.scope);return n==null?e.innerHTML:String(n)}if(Array.isArray(e.children))return e.children.map((n)=>kw(n,l$(n),t,r)).join(Il(t.preformatted));return""}var _w=D(()=>{Rn();Ll();ye()});function eh(e,t){let{title:r="Jx App",reactivitySrc:n=ta,litHtmlSrc:s=ra,modulePath:i="app.js",serverBaseUrl:o="/_jx/server"}=t,a=na(e,null,e.state??{},e.$media??{}),l=la(e,e.$media??{},t.projectStyle??null),c={h:0,l:0,m:0,needsLit:!1,s:0,sw:0,t:0},u=new Map,p=new Map,h=[],m=[],b=[],g=[],y=[],w=[],j=new Map,S=e.state??{};for(let[I,L]of Object.entries(S)){if(!V(L)||Array.isArray(L)){if(be(L))m.push([I,`() => ${Mu(L)}`]);else h.push([I,L]);continue}if(Dr(L)){let J=L.$expression,F=dr(J,{eventParam:"e",statePrefix:"state"});if(Ri(L))y.push(`state[${JSON.stringify(I)}] = ${Tl(L,F)};`);else if(Es(J.operator))g.push([I,{args:["state","e"],body:F}]);else m.push([I,`() => ${F}`]);continue}if(Mr(L)){let J=L.parameters?ls(L.parameters):L.arguments,{body:F}=L;if(Array.isArray(F)){let K=Zr(F,{eventParam:"e",statePrefix:"state"});if(L.parameters&&L.parameters.length>0)y.push(`state[${JSON.stringify(I)}] = ${Tl(L,`(() => {
234
+ </html>`;return{files:c,html:m}}function Xw(e,t,r,n){if(A(e))return _e(e);if(Ct(e)||Qt(e))return _e(String(e));if(!V(e))return"";let s=aa(e,r.scope,e.state??r.scopeDefs,e.$media??r.media);if(t){let c=n.length,u=`jx-island-${c}`,p=`JxIsland${c}`,h={...e,tagName:u};return n.push({className:p,def:h,tagName:u}),`<${u}></${u}>`}let i=Ym(e.tagName,s.scope),o=oo(e,s.scope);if(Xm.has(i))return`<${i}${o}>`;let a=r.preformatted===!0||ti.has(i),l=JD(e,{...s,preformatted:a},n);return`<${i}${o}>${l}</${i}>`}function JD(e,t,r){if(e.textContent!==void 0){let n=Ze(e.textContent,t.scope);return n==null?"":_e(String(n))}if(e.innerHTML){let n=Ze(e.innerHTML,t.scope);return n==null?e.innerHTML:String(n)}if(Array.isArray(e.children))return e.children.map((n)=>Xw(n,O$(n),t,r)).join(Ul(t.preformatted));return""}var Yw=M(()=>{In();Kl();ye()});function $h(e,t){let{title:r="Jx App",reactivitySrc:n=ia,litHtmlSrc:s=oa,modulePath:i="app.js",serverBaseUrl:o="/_jx/server"}=t,a=aa(e,null,e.state??{},e.$media??{}),l=no(e),c=da(e,e.$media??{},t.projectStyle??null),u={h:0,l:0,m:0,needsLit:!1,s:0,sw:0,t:0},p=new Map,h=new Map,m=[],y=[],g=[],b=[],w=[],j=[],S=new Map,E=e.state??{};for(let[D,O]of Object.entries(E)){if(!V(O)||Array.isArray(O)){if(be(O))y.push([D,`() => ${Yu(O)}`]);else m.push([D,O]);continue}if(Dr(O)){let L=O.$expression,K=pr(L,{eventParam:"e",statePrefix:"state"});if(Ci(O))w.push(`state[${JSON.stringify(D)}] = ${Wl(O,K)};`);else if(_s(L.operator))b.push([D,{args:["state","e"],body:K}]);else y.push([D,`() => ${K}`]);continue}if(Bt(O)){let{body:L}=O;if(Array.isArray(L)){let K=en(L,{eventParam:"e",statePrefix:"state"});if(O.parameters&&O.parameters.length>0)w.push(`state[${JSON.stringify(D)}] = ${Wl(O,`(() => {
235
235
  ${K}
236
- })()`)};`);else g.push([I,{args:["state","e"],body:K}])}else if(L.$src){let K=j.get(L.$src);if(!K)K=new Set,j.set(L.$src,K);K.add(Nu(I,L)),m.push([I,`() => { return ${I}(state); }`])}else if(O(F)&&Oi(F))m.push([I,`() => { ${F} }`]);else g.push([I,{args:J??["state"],body:F}]);continue}if(Js(L))continue;if(By(L)){h.push([I,L.default]);continue}if(vn(L)){if(L.$prototype==="LocalStorage"||L.$prototype==="SessionStorage"){let J=L.$prototype==="LocalStorage"?"localStorage":"sessionStorage",F=L.key??I,K=L.default??null;h.push([I,null]),y.push(QM(I,J,F,K));continue}if(L.$prototype==="Request"){h.push([I,null]),y.push(Tu(I,L));continue}if(L.$prototype==="Cookie"){h.push([I,null]),y.push(eD(I,L.name??I,L.default??null));continue}}if(as(L)){h.push([I,null]),w.push(Iu(I,L,{serverBaseUrl:o}));continue}h.push([I,L])}let E=Aw(e,a,u,p,c);for(let[I,L]of u)if(!b.some(([J])=>J===I))b.push([I,L]);for(let[I,L]of p)if(!g.some(([J])=>J===I))g.push([I,L]);let P=ZM(h,m,b,g,y,w,j,c,n,t.rewriteSrc),A=[` "@vue/reactivity": "${n}"`,` "lit-html": "${s}"`],R=t.prePaintScheme!==!1&&Object.values(e.$media??{}).some((I)=>bn(String(I))!==null)?`<script>${ia()}</script>
237
- `:"",_=`<!DOCTYPE html>
236
+ })()`)};`);else b.push([D,{args:["state","e"],body:K}])}else if(O.$src){let K=S.get(O.$src);if(!K)K=new Set,S.set(O.$src,K);if(K.add(zu(D,O)),l.get(D)==="computed")y.push([D,`() => { return ${D}(state); }`]);else w.push(`state[${JSON.stringify(D)}] = ${D};`),b.push([D,{args:["state","event"],body:`return ${D}(state, event);`}])}else if(A(L)&&l.get(D)==="computed")y.push([D,`() => { ${L} }`]);else b.push([D,{args:Cn(O),body:L}]);continue}if(Ls(O))continue;if(db(O)){m.push([D,O.default]);continue}if(jn(O)){if(O.$prototype==="LocalStorage"||O.$prototype==="SessionStorage"){let L=O.$prototype==="LocalStorage"?"localStorage":"sessionStorage",K=O.key??D,ae=O.default??null;m.push([D,null]),w.push(LD(D,L,K,ae));continue}if(O.$prototype==="Request"){m.push([D,null]),w.push(Gu(D,O));continue}if(O.$prototype==="Cookie"){m.push([D,null]),w.push(FD(D,O.name??D,O.default??null));continue}}if(ds(O)){m.push([D,null]),j.push(Ku(D,O,{serverBaseUrl:o}));continue}m.push([D,O])}let P=Zw(e,a,p,h,u);for(let[D,O]of p)if(!g.some(([L])=>L===D))g.push([D,O]);for(let[D,O]of h)if(!b.some(([L])=>L===D))b.push([D,O]);let R=DD(m,y,g,b,w,j,S,u,n,t.rewriteSrc),N=[` "@vue/reactivity": "${n}"`,` "lit-html": "${s}"`],_=t.prePaintScheme!==!1&&Object.values(e.$media??{}).some((D)=>$n(String(D))!==null)?`<script>${ca()}</script>
237
+ `:"",q=`<!DOCTYPE html>
238
238
  <html lang="en">
239
239
  <head>
240
240
  <meta charset="utf-8">
241
241
  <meta name="viewport" content="width=device-width, initial-scale=1">
242
242
  <title>${_e(r)}</title>
243
- ${R}<script type="importmap">
243
+ ${_}<script type="importmap">
244
244
  {
245
245
  "imports": {
246
- ${A.join(`,
246
+ ${N.join(`,
247
247
  `)}
248
248
  }
249
249
  }
250
250
  </script>
251
- ${l}
251
+ ${c}
252
252
  <script type="module" src="./${i}"></script>
253
253
  </head>
254
254
  <body>
255
- ${E}
255
+ ${P}
256
256
  </body>
257
- </html>`;return{files:[{content:P,path:i}],html:_}}function Aw(e,t,r,n,s){if(O(e))return _e(e);if(Nt(e)||Qt(e))return _e(String(e));if(!V(e))return"";let i=na(e,t.scope,e.state??t.scopeDefs,e.$media??t.media);if(Sn(e.tagName))throw Error(`A tag chosen at creation is not supported on a dynamic page yet (candidates: ${wo(e.tagName).join(", ")}). Move the element into a component, or give it a literal tagName.`);let o=e.tagName??"div";i.preformatted=t.preformatted===!0||Xs.has(o);let a=[],l=!1;if(e.textContent!==void 0){let g=e.textContent;if(Pr(g)){let y=ua(g.$ref);a.push(`:text-content="${y}"`),Xm(r,y,g.$ref),l=!0}else if(be(g)){let y=`_t${s.t}`;s.t+=1,a.push(`:text-content="${y}"`),r.set(y,`() => \`${g}\``),l=!0}}for(let[g,y]of Object.entries(e)){if(!g.startsWith("on")||g==="observedAttributes")continue;let w=g.slice(2).toLowerCase();if(Pr(y)){let j=ua(y.$ref);a.push(`@${w}="${j}"`),l=!0}else if(Mr(y)){let j=`_h${s.h}`;s.h+=1,a.push(`@${w}="${j}"`);let{body:S}=y;n.set(j,Array.isArray(S)?{args:["state","e"],body:Zr(S,{eventParam:"e",statePrefix:"state"})}:{args:y.parameters?ls(y.parameters):y.arguments??["state","event"],body:S}),l=!0}else if(Dr(y)){let j=`_h${s.h}`;s.h+=1,a.push(`@${w}="${j}"`);let S=dr(y.$expression,{eventParam:"e",statePrefix:"state"});n.set(j,{args:["state","e"],body:S}),l=!0}}if(V(e.style))for(let[g,y]of Object.entries(e.style)){if(g.startsWith(":")||g.startsWith(".")||g.startsWith("&")||g.startsWith("[")||g.startsWith("@"))continue;if(Ow(y))continue;if(be(y)){let w=`_s${s.s}`;s.s+=1,a.push(`:style.${jr(g)}="${w}"`),r.set(w,`() => \`${y}\``),l=!0}}if(V(e.attributes)){for(let[g,y]of Object.entries(e.attributes))if(Pr(y)){let w=ua(y.$ref);a.push(`:attr.${g}="${w}"`),Xm(r,w,y.$ref),l=!0}else if(be(y)){let w=`_t${s.t}`;s.t+=1,a.push(`:attr.${g}="${w}"`),r.set(w,`() => \`${y}\``),l=!0}}for(let[g,y]of Object.entries(e)){if(Ps.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(Pr(y)){let w=ua(y.$ref);a.push(`:${jr(g)}="${w}"`),Xm(r,w,y.$ref),l=!0}else if(be(y)){let w=`_t${s.t}`;s.t+=1,a.push(`:${jr(g)}="${w}"`),r.set(w,`() => \`${y}\``),l=!0}}let c=no(e,i.scope),u=l?" data-bind":"",p=a.length>0?` ${a.join(" ")}`:"",h="",m=e;if(m.$switch){s.needsLit=!0;let g=`_sw${s.sw}`;s.sw+=1;let y=Pr(m.$switch)?Qm(m.$switch.$ref):`\`${String(m.$switch)}\``,w=m.cases??{},j=Object.entries(w).filter(([,E])=>E&&!Pr(E)).map(([E,P])=>`${JSON.stringify(E)}: html\`${Zm(P,i.preformatted)}\``);r.set(g,`() => ({${j.join(", ")}})[String(${y})] ?? html\`\``),a.push(`:render="${g}"`);let S=` ${a.join(" ")}`;return`<${o}${c} data-bind${S}></${o}>`}if(m.textContent!==void 0&&!l){let g=Ze(m.textContent,i.scope);h=g==null?"":_e(String(g))}else if(m.textContent!==void 0&&l){let g=Ze(m.textContent,i.scope);h=g==null?"":_e(String(g))}else if(m.innerHTML){let g=Ze(m.innerHTML,i.scope);h=g==null?m.innerHTML:String(g)}else if(dt(m.children)){s.needsLit=!0;let g=`_list${s.l}`;s.l+=1;let y=m.children,w=Pr(y.items)?Qm(y.items.$ref):JSON.stringify(y.items),j=th(y.map);r.set(g,`() => (${w} ?? []).map((item, index) => html\`${j}\`)`),a.push(`:render="${g}"`),l=!0;let S=" data-bind",E=` ${a.join(" ")}`;if(new Set(["input","br","hr","img","meta","link"]).has(o))return`<${o}${c}${S}${E}>`;return`<${o}${c}${S}${E}></${o}>`}else if(Array.isArray(m.children)&&m.children.some((g)=>dt(g))){s.needsLit=!0;let g=`_children${s.l}`;s.l+=1;let y=m.children.map((j)=>Zm(j,i.preformatted)).join(Il(i.preformatted," "));r.set(g,i.preformatted?`() => html\`${y}\``:`() => html\`
258
- ${y}
259
- \``),a.push(`:render="${g}"`),l=!0;let w=` ${a.join(" ")}`;return`<${o}${c} data-bind${w}></${o}>`}else if(Array.isArray(m.children))h=m.children.map((g)=>Aw(g,i,r,n,s)).join(Il(i.preformatted));if(new Set(["input","br","hr","img","meta","link"]).has(o))return`<${o}${c}${u}${p}>`;return`<${o}${c}${u}${p}>${h}</${o}>`}function th(e,t=!1){if(!e)return"";if(Sn(e.tagName))throw Error(`A tag chosen at creation is not supported inside a dynamic page's repeater yet (candidates: ${wo(e.tagName).join(", ")}). Move the item into a component, or give it a literal tagName.`);let r=e.tagName??"div",n=t||Xs.has(r),s="";if(e.id)s+=` id="${e.id}"`;if(e.className)s+=` class="${Zs(e.className)}"`;if(V(e.$props))for(let[l,c]of Object.entries(e.$props))if(Pr(c))s+=` .${l}="\${${tD(c.$ref)}}"`;else if(be(c))s+=` .${l}="${Zs(c)}"`;else s+=` .${l}="\${${JSON.stringify(c)}}"`;if(V(e.attributes))for(let[l,c]of Object.entries(e.attributes)){if(be(c)){s+=` ${l}="${Zs(c)}"`;continue}if(Qt(c)){let u=to(l,c);if(u!==null)s+=u===""?` ${l}`:` ${l}="${_e(u)}"`;continue}s+=` ${l}="${_e(String(c))}"`}if(V(e.style)){let l=[];for(let[c,u]of Object.entries(e.style)){if(c.startsWith(":")||c.startsWith(".")||c.startsWith("&")||c.startsWith("[")||c.startsWith("@"))continue;if(Ow(u))continue;let p=jr(c);if(be(String(u)))l.push(`${p}: ${Zs(String(u))}`);else l.push(`${p}: ${u}`)}if(l.length>0)s+=` style="${l.join("; ")}"`}for(let[l,c]of Object.entries(e)){if(!l.startsWith("on")||l==="observedAttributes")continue;let u=l.slice(2).toLowerCase();if(Pr(c)){let p=ua(c.$ref);s+=` @${u}=\${(e) => { state.$map = { item, index }; on.${p}(e); }}`}else if(Is(c)){let p=Zr(c.body,{eventParam:"e",statePrefix:"state"});s+=` @${u}=\${(e) => { state.$map = { item, index }; ${p} }}`}else if(Mr(c)){let p=Zs(c.body);s+=` @${u}=\${(e) => { ${p}
260
- }}`}else if(V(c)&&"$expression"in c){let p=dr(c.$expression,{eventParam:"e",statePrefix:"state"});s+=` @${u}=\${(e) => { state.$map = { item, index }; ${p}; }}`}}if(e.contentEditable)s+=` contenteditable="${e.contentEditable}"`;let i=r.includes("-")?aa:"",o="";if(e.textContent!==void 0){let l=String(e.textContent);if(be(l))o=`${Zs(l)}${i}`;else if(Pr(e.textContent))o=`\${state.${ua(e.textContent.$ref)}}${i}`;else o=_e(l)}else if(e.innerHTML)o=Zs(String(e.innerHTML));else if(dt(e.children))o=`
261
- ${Rw(e.children)}${i}
262
- `;else if(Array.isArray(e.children)){let l=e.children.map((c)=>{let u=Zm(c,n);return dt(c)||O(c)&&be(c)?`${u}${i}`:u});o=n?l.join(""):`
257
+ </html>`;return{files:[{content:R,path:i}],html:q}}function Zw(e,t,r,n,s){if(A(e))return _e(e);if(Ct(e)||Qt(e))return _e(String(e));if(!V(e))return"";let i=aa(e,t.scope,e.state??t.scopeDefs,e.$media??t.media);if(kn(e.tagName))throw Error(`A tag chosen at creation is not supported on a dynamic page yet (candidates: ${Po(e.tagName).join(", ")}). Move the element into a component, or give it a literal tagName.`);let o=e.tagName??"div";i.preformatted=t.preformatted===!0||ti.has(o);let a=[],l=!1;if(e.textContent!==void 0){let g=e.textContent;if(kr(g)){let b=ma(g.$ref);a.push(`:text-content="${b}"`),yh(r,b,g.$ref),l=!0}else if(be(g)){let b=`_t${s.t}`;s.t+=1,a.push(`:text-content="${b}"`),r.set(b,`() => \`${g}\``),l=!0}}for(let[g,b]of Object.entries(e)){if(!g.startsWith("on")||g==="observedAttributes")continue;ei(`inline "${g}" handler`,b);let w=g.slice(2).toLowerCase();if(kr(b)){let j=ma(b.$ref);a.push(`@${w}="${j}"`),l=!0}else if(Bt(b)){let j=`_h${s.h}`;s.h+=1,a.push(`@${w}="${j}"`);let{body:S}=b;n.set(j,Array.isArray(S)?{args:["state","e"],body:en(S,{eventParam:"e",statePrefix:"state"})}:{args:Tl(b)?Cn(b):["state","event"],body:S}),l=!0}else if(Dr(b)){let j=`_h${s.h}`;s.h+=1,a.push(`@${w}="${j}"`);let S=pr(b.$expression,{eventParam:"e",statePrefix:"state"});n.set(j,{args:["state","e"],body:S}),l=!0}}if(V(e.style))for(let[g,b]of Object.entries(e.style)){if(g.startsWith(":")||g.startsWith(".")||g.startsWith("&")||g.startsWith("[")||g.startsWith("@"))continue;if(ev(b))continue;if(be(b)){let w=`_s${s.s}`;s.s+=1,a.push(`:style.${jr(g)}="${w}"`),r.set(w,`() => \`${b}\``),l=!0}}if(V(e.attributes)){for(let[g,b]of Object.entries(e.attributes))if(kr(b)){let w=ma(b.$ref);a.push(`:attr.${g}="${w}"`),yh(r,w,b.$ref),l=!0}else if(be(b)){let w=`_t${s.t}`;s.t+=1,a.push(`:attr.${g}="${w}"`),r.set(w,`() => \`${b}\``),l=!0}}for(let[g,b]of Object.entries(e)){if(Rs.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(kr(b)){let w=ma(b.$ref);a.push(`:${jr(g)}="${w}"`),yh(r,w,b.$ref),l=!0}else if(be(b)){let w=`_t${s.t}`;s.t+=1,a.push(`:${jr(g)}="${w}"`),r.set(w,`() => \`${b}\``),l=!0}}let c=oo(e,i.scope),u=l?" data-bind":"",p=a.length>0?` ${a.join(" ")}`:"",h="",m=e;if(m.$switch){s.needsLit=!0;let g=`_sw${s.sw}`;s.sw+=1;let b=kr(m.$switch)?xh(m.$switch.$ref):`\`${String(m.$switch)}\``,w=m.cases??{},j=Object.entries(w).filter(([,E])=>E&&!kr(E)).map(([E,P])=>`${JSON.stringify(E)}: html\`${bh(P,i.preformatted)}\``);r.set(g,`() => ({${j.join(", ")}})[String(${b})] ?? html\`\``),a.push(`:render="${g}"`);let S=` ${a.join(" ")}`;return`<${o}${c} data-bind${S}></${o}>`}if(m.textContent!==void 0&&!l){let g=Ze(m.textContent,i.scope);h=g==null?"":_e(String(g))}else if(m.textContent!==void 0&&l){let g=Ze(m.textContent,i.scope);h=g==null?"":_e(String(g))}else if(m.innerHTML){let g=Ze(m.innerHTML,i.scope);h=g==null?m.innerHTML:String(g)}else if(dt(m.children)){s.needsLit=!0;let g=`_list${s.l}`;s.l+=1;let b=m.children,w=kr(b.items)?xh(b.items.$ref):JSON.stringify(b.items),j=wh(b.map);r.set(g,`() => (${w} ?? []).map((item, index) => html\`${j}\`)`),a.push(`:render="${g}"`),l=!0;let S=" data-bind",E=` ${a.join(" ")}`;if(new Set(["input","br","hr","img","meta","link"]).has(o))return`<${o}${c}${S}${E}>`;return`<${o}${c}${S}${E}></${o}>`}else if(Array.isArray(m.children)&&m.children.some((g)=>dt(g))){s.needsLit=!0;let g=`_children${s.l}`;s.l+=1;let b=m.children.map((j)=>bh(j,i.preformatted)).join(Ul(i.preformatted," "));r.set(g,i.preformatted?`() => html\`${b}\``:`() => html\`
258
+ ${b}
259
+ \``),a.push(`:render="${g}"`),l=!0;let w=` ${a.join(" ")}`;return`<${o}${c} data-bind${w}></${o}>`}else if(Array.isArray(m.children))h=m.children.map((g)=>Zw(g,i,r,n,s)).join(Ul(i.preformatted));if(new Set(["input","br","hr","img","meta","link"]).has(o))return`<${o}${c}${u}${p}>`;return`<${o}${c}${u}${p}>${h}</${o}>`}function wh(e,t=!1){if(!e)return"";if(kn(e.tagName))throw Error(`A tag chosen at creation is not supported inside a dynamic page's repeater yet (candidates: ${Po(e.tagName).join(", ")}). Move the item into a component, or give it a literal tagName.`);let r=e.tagName??"div",n=t||ti.has(r),s="";if(e.id)s+=` id="${e.id}"`;if(e.className)s+=` class="${co(e.className)}"`;if(V(e.$props))for(let[l,c]of Object.entries(e.$props))if(kr(c))s+=` .${l}="\${${qD(c.$ref)}}"`;else if(be(c))s+=` .${l}="${co(c)}"`;else s+=` .${l}="\${${JSON.stringify(c)}}"`;if(V(e.attributes))for(let[l,c]of Object.entries(e.attributes)){if(be(c)){s+=` ${l}="${co(c)}"`;continue}if(Qt(c)){let u=so(l,c);if(u!==null)s+=u===""?` ${l}`:` ${l}="${_e(u)}"`;continue}s+=` ${l}="${_e(String(c))}"`}if(V(e.style)){let l=[];for(let[c,u]of Object.entries(e.style)){if(c.startsWith(":")||c.startsWith(".")||c.startsWith("&")||c.startsWith("[")||c.startsWith("@"))continue;if(ev(u))continue;let p=jr(c);if(be(String(u)))l.push(`${p}: ${co(String(u))}`);else l.push(`${p}: ${u}`)}if(l.length>0)s+=` style="${l.join("; ")}"`}for(let[l,c]of Object.entries(e)){if(!l.startsWith("on")||l==="observedAttributes")continue;ei(`inline "${l}" handler`,c);let u=l.slice(2).toLowerCase();if(kr(c)){let p=ma(c.$ref);s+=` @${u}=\${(e) => { state.$map = { item, index }; on.${p}(e); }}`}else if(Pn(c)){let p=en(c.body,{eventParam:"e",statePrefix:"state"});s+=` @${u}=\${(e) => { state.$map = { item, index }; ${p} }}`}else if(Bt(c)){let p=MD(c.body),h=Tl(c)?`((${Cn(c).join(", ")}) => { ${p}
260
+ })(state, e);`:`${p}
261
+ `;s+=` @${u}=\${(e) => { state.$map = { item, index }; ${h}}}`}else if(V(c)&&"$expression"in c){let p=pr(c.$expression,{eventParam:"e",statePrefix:"state"});s+=` @${u}=\${(e) => { state.$map = { item, index }; ${p}; }}`}}if(e.contentEditable)s+=` contenteditable="${e.contentEditable}"`;let i=r.includes("-")?fa:"",o="";if(e.textContent!==void 0){let l=String(e.textContent);if(be(l))o=`${co(l)}${i}`;else if(kr(e.textContent))o=`\${state.${ma(e.textContent.$ref)}}${i}`;else o=_e(l)}else if(e.innerHTML)o=co(String(e.innerHTML));else if(dt(e.children))o=`
262
+ ${Qw(e.children)}${i}
263
+ `;else if(Array.isArray(e.children)){let l=e.children.map((c)=>{let u=bh(c,n);return dt(c)||A(c)&&be(c)?`${u}${i}`:u});o=n?l.join(""):`
263
264
  ${l.join(`
264
265
  `)}
265
- `}if(new Set(["input","br","hr","img","meta","link"]).has(r))return`<${r}${s}>`;return`<${r}${s}>${o}</${r}>`}function Zm(e,t=!1){if(O(e))return be(e)?Zs(e):_e(e);if(Nt(e)||Qt(e))return _e(String(e));if(dt(e))return Rw(e);return th(e,t)}function Rw(e){let{items:t}=e,r=Pr(t)?Qm(t.$ref):JSON.stringify(t??[]),n=th(e.map);return`\${(${r} ?? []).map((item, index) => html\`${n}\`)}`}function Zs(e){return e.replaceAll("$map.","")}function ZM(e,t,r,n,s,i,o,a,l,c){let u=[],{needsLit:p}=a,h=t.length>0;u.push("// Generated by @jxsuite/compiler — do not edit manually");let m=["reactive","effect"];if(h)m.push("computed");if(u.push(`import { ${m.join(", ")} } from '@vue/reactivity';`),p)u.push("import { html, render } from 'lit-html';");for(let[b,g]of o){let y=c?c(b):b;u.push(`import { ${[...g].join(", ")} } from '${y}';`)}if(u.push("",Du()),i.length>0)u.push("",Lu());u.push("","const state = reactive({");for(let[b,g]of e)u.push(` ${Ss(b)}: ${JSON.stringify(g)},`);if(u.push("});",""),s.length>0){for(let b of s)u.push(b);u.push("")}if(t.length>0){for(let[b,g]of t)u.push(`${Me("state",Lt(b))} = computed(${g});`);u.push("")}if(i.length>0){for(let b of i)u.push(b);u.push("")}if(r.length>0){u.push("const bind = {");for(let[b,g]of r)u.push(` ${Ss(b)}: ${g},`);u.push("};")}else u.push("const bind = {};");if(u.push(""),n.length>0){u.push("const on = {");for(let[b,g]of n){let y=g.args??["state"],w=y.map((j)=>j==="state"?"state":"e").join(", ");u.push(` ${Ss(b)}: (e) => { const fn = (${y.join(", ")}) => { ${g.body}
266
- }; fn(${w}); },`)}u.push("};")}else u.push("const on = {};");if(u.push("","function hydrate(root) {"," root.querySelectorAll('[data-bind]').forEach(el => {"," [...el.attributes].forEach(a => {"," if (a.name.startsWith(':')) {"," const parts = a.name.slice(1).split('.');"," const key = a.value;"),p)u.push(" if (parts[0] === 'render') {"," effect(() => { render(bind[key](), el); });"," } else if (parts[0] === 'style' && parts.length > 1) {");else u.push(" if (parts[0] === 'style' && parts.length > 1) {");return u.push(" effect(() => { el.style[parts[1]] = bind[key](); });"," } else if (parts[0] === 'attr' && parts.length > 1) {"," effect(() => {",` const _t = ${oa}(parts[1], bind[key]());`," if (_t === null) { el.removeAttribute(parts[1]); }"," else { el.setAttribute(parts[1], _t); }"," });"," } else {"," const prop = parts[0].replace(/-([a-z])/g, (_, c) => c.toUpperCase());"," effect(() => { el[prop] = bind[key](); });"," }"," } else if (a.name.startsWith('@')) {"," el.addEventListener(a.name.slice(1), on[a.value]);"," }"," });"," });","}","","hydrate(document);",""),u.join(`
267
- `)}function QM(e,t,r,n){return[`// ${e}: ${t} (key: "${r}")`,"try {",` const _s = ${t}.getItem(${JSON.stringify(r)});`,` state.${e} = _s !== null ? JSON.parse(_s) : ${JSON.stringify(n)};`,`} catch { state.${e} = ${JSON.stringify(n)}; }`,"effect(() => {",` const v = state.${e};`," try {",` if (v === null) ${t}.removeItem(${JSON.stringify(r)});`,` else ${t}.setItem(${JSON.stringify(r)}, JSON.stringify(v));`," } catch {}","});"].join(`
268
- `)}function eD(e,t,r){return[`// ${e}: Cookie (name: "${t}")`,"{",` const _m = document.cookie.match(new RegExp("(?:^|; )${t}=([^;]*)"));`,` try { state.${e} = _m ? JSON.parse(decodeURIComponent(_m[1])) : ${JSON.stringify(r)}; }`,` catch { state.${e} = _m ? _m[1] : ${JSON.stringify(r)}; }`,"}"].join(`
269
- `)}function Ow(e){return e===null||V(e)}function tD(e){if(e.startsWith("$map/")){let[t,...r]=vs(e.slice(5));return Me(t??"",r.map((n)=>Lt(n)).join("/"))}if(e.startsWith("#/state/"))return Me("state",e.slice(8));return Me("state",e)}function Qm(e){return q0("state",e.startsWith("#/state/")?e.slice(8):e)}function ua(e){return V0(e.startsWith("#/state/")?e.slice(8):e)}function Xm(e,t,r){if(e.has(t))return;e.set(t,`() => ${Me("state",r.startsWith("#/state/")?r.slice(8):r)}`)}var rh=D(()=>{Zo();Rn();ye();Go()});function rD(e,t){if(t.routing==="prefix-except-default"&&e===t.defaultLocale)return"/";return`/${e.toLowerCase()}/`}function Cw(e){if(e===null||e.locales.length<2)return"";let t=JSON.stringify(e.locales),r=JSON.stringify(e.defaultLocale),n=JSON.stringify(Object.fromEntries(e.locales.map((s)=>[s,rD(s,e)])));return`
266
+ `}if(new Set(["input","br","hr","img","meta","link"]).has(r))return`<${r}${s}>`;return`<${r}${s}>${o}</${r}>`}function bh(e,t=!1){if(A(e))return be(e)?co(e):_e(e);if(Ct(e)||Qt(e))return _e(String(e));if(dt(e))return Qw(e);return wh(e,t)}function Qw(e){let{items:t}=e,r=kr(t)?xh(t.$ref):JSON.stringify(t??[]),n=wh(e.map);return`\${(${r} ?? []).map((item, index) => html\`${n}\`)}`}function co(e){return e.replaceAll("$map.","")}function MD(e){return e.replaceAll(/(?<![\w$.])\$map\./gu,"")}function DD(e,t,r,n,s,i,o,a,l,c){let u=[],{needsLit:p}=a,h=t.length>0;u.push("// Generated by @jxsuite/compiler — do not edit manually");let m=["reactive","effect"];if(h)m.push("computed");if(u.push(`import { ${m.join(", ")} } from '@vue/reactivity';`),p)u.push("import { html, render } from 'lit-html';");for(let[y,g]of o){let b=c?c(y):y;u.push(`import { ${[...g].join(", ")} } from '${b}';`)}if(u.push("",Zu()),i.length>0)u.push("",Qu());u.push("","const state = reactive({");for(let[y,g]of e)u.push(` ${ks(y)}: ${JSON.stringify(g)},`);if(u.push("});",""),s.length>0){for(let y of s)u.push(y);u.push("")}if(t.length>0){for(let[y,g]of t)u.push(`${Ve("state",dr(y))} = computed(${g});`);u.push("")}if(i.length>0){for(let y of i)u.push(y);u.push("")}if(r.length>0){u.push("const bind = {");for(let[y,g]of r)u.push(` ${ks(y)}: ${g},`);u.push("};")}else u.push("const bind = {};");if(u.push(""),n.length>0){u.push("const on = {");for(let[y,g]of n)u.push(` ${ks(y)}: (e) => { const fn = (${g.args.join(", ")}) => { ${g.body}
267
+ }; fn(state, e); },`);u.push("};")}else u.push("const on = {};");if(u.push("","function hydrate(root) {"," root.querySelectorAll('[data-bind]').forEach(el => {"," [...el.attributes].forEach(a => {"," if (a.name.startsWith(':')) {"," const parts = a.name.slice(1).split('.');"," const key = a.value;"),p)u.push(" if (parts[0] === 'render') {"," effect(() => { render(bind[key](), el); });"," } else if (parts[0] === 'style' && parts.length > 1) {");else u.push(" if (parts[0] === 'style' && parts.length > 1) {");return u.push(" effect(() => { el.style[parts[1]] = bind[key](); });"," } else if (parts[0] === 'attr' && parts.length > 1) {"," effect(() => {",` const _t = ${ua}(parts[1], bind[key]());`," if (_t === null) { el.removeAttribute(parts[1]); }"," else { el.setAttribute(parts[1], _t); }"," });"," } else {"," const prop = parts[0].replace(/-([a-z])/g, (_, c) => c.toUpperCase());"," effect(() => { el[prop] = bind[key](); });"," }"," } else if (a.name.startsWith('@')) {"," el.addEventListener(a.name.slice(1), on[a.value]);"," }"," });"," });","}","","hydrate(document);",""),u.join(`
268
+ `)}function LD(e,t,r,n){return[`// ${e}: ${t} (key: "${r}")`,"try {",` const _s = ${t}.getItem(${JSON.stringify(r)});`,` state.${e} = _s !== null ? JSON.parse(_s) : ${JSON.stringify(n)};`,`} catch { state.${e} = ${JSON.stringify(n)}; }`,"effect(() => {",` const v = state.${e};`," try {",` if (v === null) ${t}.removeItem(${JSON.stringify(r)});`,` else ${t}.setItem(${JSON.stringify(r)}, JSON.stringify(v));`," } catch {}","});"].join(`
269
+ `)}function FD(e,t,r){return[`// ${e}: Cookie (name: "${t}")`,"{",` const _m = document.cookie.match(new RegExp("(?:^|; )${t}=([^;]*)"));`,` try { state.${e} = _m ? JSON.parse(decodeURIComponent(_m[1])) : ${JSON.stringify(r)}; }`,` catch { state.${e} = _m ? _m[1] : ${JSON.stringify(r)}; }`,"}"].join(`
270
+ `)}function ev(e){return e===null||V(e)}function qD(e){if(e.startsWith("$map/")){let[t,...r]=js(e.slice(5));return Ve(t??"",r.map((n)=>dr(n)).join("/"))}if(e.startsWith("#/state/"))return Ve("state",e.slice(8));return Ve("state",e)}function xh(e){return u$("state",e.startsWith("#/state/")?e.slice(8):e)}function ma(e){return f$(e.startsWith("#/state/")?e.slice(8):e)}function yh(e,t,r){if(e.has(t))return;e.set(t,`() => ${Ve("state",r.startsWith("#/state/")?r.slice(8):r)}`)}var vh=M(()=>{Il();ra();In();ye();Zo()});function VD(e,t){if(t.routing==="prefix-except-default"&&e===t.defaultLocale)return"/";return`/${e.toLowerCase()}/`}function tv(e){if(e===null||e.locales.length<2)return"";let t=JSON.stringify(e.locales),r=JSON.stringify(e.defaultLocale),n=JSON.stringify(Object.fromEntries(e.locales.map((s)=>[s,VD(s,e)])));return`
270
271
  // ─── Locale negotiation (RFC 4647 Lookup over Accept-Language) ───────────────
271
272
  const JX_LOCALES = ${t}
272
273
  const JX_DEFAULT_LOCALE = ${r}
@@ -335,12 +336,12 @@ app.use('/', async (c, next) => {
335
336
  res.headers.set('Content-Language', locale)
336
337
  c.res = res
337
338
  })
338
- `}function ef(e,t="/_jx/server"){return Xe(e,t)}function nh(e,t={}){let{adapter:r=null,mounts:n=[],connectors:s=[],i18n:i=null,base:o=""}=t,a=ef(o,t.baseUrl);if(e.length===0&&n.length===0&&!r)return null;let l=e.map(({exportName:m,src:b})=>`import { ${m} } from '${b}'`).join(`
339
- `),c=nD(n,s),u=e.map(({exportName:m})=>sD(m,a)).join(`
339
+ `}function hf(e,t="/_jx/server"){return Ye(e,t)}function Sh(e,t={}){let{adapter:r=null,mounts:n=[],connectors:s=[],i18n:i=null,base:o=""}=t,a=hf(o,t.baseUrl);if(e.length===0&&n.length===0&&!r)return null;let l=e.map(({exportName:m,src:y})=>`import { ${m} } from '${y}'`).join(`
340
+ `),c=BD(n,s),u=e.map(({exportName:m})=>WD(m,a)).join(`
340
341
  `),p=r==="cloudflare-workers"||r==="cloudflare-pages"?`
341
342
  app.all('*', (c) => c.env.ASSETS.fetch(c.req.raw))
342
343
  `:`
343
- `,h=Cw(i);return`// Generated by @jxsuite/compiler — do not edit manually
344
+ `,h=tv(i);return`// Generated by @jxsuite/compiler — do not edit manually
344
345
  import { Hono } from 'hono'
345
346
  ${l}${c.imports}
346
347
 
@@ -348,11 +349,11 @@ const app = new Hono()
348
349
  ${h}${c.routes}${u}
349
350
  ${p}
350
351
  export default app
351
- `}function nD(e,t){if(e.length===0)return{imports:"",routes:""};let r=e.toSorted((i,o)=>i.order-o.order),n=[];for(let i of r)n.push(`import { ${i.className} } from '${i.module}'`);for(let i of t)n.push(`import { ${i.className} } from '${i.module}'`);let s=["// Extension server mounts (specs/extensions.md §11): one shared ctx, mounted in order.","const jxCtx = {}",`const jxConnectors = { ${t.map((i)=>`${JSON.stringify(i.provider)}: ${i.className}`).join(", ")} }`];for(let[i,o]of r.entries()){let a=JSON.stringify(o.options);s.push(`const jxMount${i} = await ${o.className}.mount({ ...${a}, connectors: jxConnectors }, jxCtx)`,`app.all('${o.basePath}/*', (c) => jxMount${i}(c.req.raw, c.env))`,`app.all('${o.basePath}', (c) => jxMount${i}(c.req.raw, c.env))`)}return{imports:`
352
+ `}function BD(e,t){if(e.length===0)return{imports:"",routes:""};let r=e.toSorted((i,o)=>i.order-o.order),n=[];for(let i of r)n.push(`import { ${i.className} } from '${i.module}'`);for(let i of t)n.push(`import { ${i.className} } from '${i.module}'`);let s=["// Extension server mounts (specs/extensions.md §11): one shared ctx, mounted in order.","const jxCtx = {}",`const jxConnectors = { ${t.map((i)=>`${JSON.stringify(i.provider)}: ${i.className}`).join(", ")} }`];for(let[i,o]of r.entries()){let a=JSON.stringify(o.options);s.push(`const jxMount${i} = await ${o.className}.mount({ ...${a}, connectors: jxConnectors }, jxCtx)`,`app.all('${o.basePath}/*', (c) => jxMount${i}(c.req.raw, c.env))`,`app.all('${o.basePath}', (c) => jxMount${i}(c.req.raw, c.env))`)}return{imports:`
352
353
  ${n.join(`
353
354
  `)}`,routes:`${s.join(`
354
355
  `)}
355
- `}}function sD(e,t){return`
356
+ `}}function WD(e,t){return`
356
357
  app.post('${t}/${e}', async (c) => {
357
358
  const args = await c.req.json().catch(() => ({}))
358
359
  try {
@@ -360,9 +361,9 @@ app.post('${t}/${e}', async (c) => {
360
361
  } catch (e) {
361
362
  return c.json({ ok: false, error: e?.message ?? 'Server error' }, 500)
362
363
  }
363
- })`}var sh=D(()=>{Vr()});function Tw(e){let t=P0(e,e.title??"a class"),r=t.title;if(!r)throw Error("compileClassJson: missing title (class name)");let n=oD(t.extends),s=t.$defs,i=s?.fields??{},o=s?.constructor,a=iD(o)?o: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=n!=="Object"?` extends ${n}`:"";c.push(`class ${r}${u} {`);for(let[p,h]of Object.entries(i)){if(h.scope!=="static")continue;let m=h.identifier??p,b=h.access==="private"?"#":"",g=h.initializer!==void 0?JSON.stringify(h.initializer):h.default!==void 0?JSON.stringify(h.default):"null";c.push(` static ${b}${m} = ${g};`)}for(let[p,h]of Object.entries(i)){if(h.scope==="static")continue;if(h.access!=="private")continue;let m=h.identifier??p;c.push(` #${m};`)}if(Object.keys(i).length>0)c.push("");if(c.push(" constructor(config = {}) {"),a?.superCall||n!=="Object"){let p=a?.superCall?.arguments?a.superCall.arguments.join(", "):"";c.push(` super(${p});`)}for(let[p,h]of Object.entries(i)){if(h.scope==="static")continue;let m=h.identifier??p,b=h.access==="private"?"#":"",g=h.initializer!==void 0?JSON.stringify(h.initializer):h.default!==void 0?JSON.stringify(h.default):"null";c.push(` this.${b}${m} = config.${m} !== undefined ? config.${m} : ${g};`)}if(a?.body){let p=Array.isArray(a.body)?a.body:[a.body];for(let h of p)c.push(` ${h}`)}c.push(" }");for(let[p,h]of Object.entries(l)){let m=h.identifier??p,b=h.scope==="static",y=h.access==="private"?"#":"",w=b?"static ":"",j=h.returnType?.$ref?.includes("Promise")||lD(h)?"async ":"",S=Nw(h.parameters??[]),E=aD(h.body);if(c.push(""),h.role==="accessor"){if(h.getter)c.push(` ${w}get ${y}${m}() {`,` ${h.getter.body}`," }");if(h.setter){let P=Nw(h.setter.parameters??[]);c.push(` ${w}set ${y}${m}(${P}) {`,` ${h.setter.body}`," }")}}else{c.push(` ${w}${j}${y}${m}(${S}) {`);for(let P of E)c.push(` ${P}`);c.push(" }")}}return c.push("}","",`export { ${r} };`,`export default ${r};`,""),c.join(`
364
- `)}function iD(e){return typeof e==="object"}function oD(e){if(!e)return"Object";if(O(e))return e;if(e.$ref){let t=e.$ref.match(/([A-Za-z0-9_]+)\.class\.json/);return t?t[1]:"Object"}return"Object"}function Nw(e){return e.map((t)=>{if(t.$ref)return t.$ref.split("/").pop();let r=t.identifier??t.name;return O(r)?r:"arg"}).join(", ")}function aD(e){if(!e)return[""];return Array.isArray(e)?e:[e]}function lD(e){return(Array.isArray(e.body)?e.body.join(`
365
- `):e.body??"").includes("await ")}var Iw=D(()=>{Uo();ye()});import{readFileSync as cD}from"node:fs";async function ih(e,t={}){let{title:r="Jx App",reactivitySrc:n=ta,litHtmlSrc:s=ra,projectStyle:i=null}=t,o;if(O(e)){let l=cD(e,"utf8");if(hs(e))o=gs(l,e);else{let{extname:c}=await import("node:path"),u=c(e).toLowerCase(),p=t.formats?.byExtension(u,"parse");if(!p){await Promise.resolve().then(() => bs());throw ou(e,u)}o=await p.parseDocument(l)}}else o=e;if(o=_n(o,O(e)?e:"the document"),Uy(o)){await Promise.resolve().then(() => Iw());let c=Tw(o),u=O(e)?e.replace(/\.class\.json$/,".js"):`${o.title}.js`;return{files:[{content:c,path:u}],html:""}}if(!Ju(o))return Pw(o,{litHtmlSrc:s,projectStyle:i,reactivitySrc:n,...Jw(t),title:r});if(o.tagName&&o.tagName.includes("-")){let{tagName:l}=o,c=qu(l),p={content:Dl(o,c,[],t.rewriteSrc,null,t.serverBaseUrl),path:`${l}.js`,tagName:l},h=la(o,o.$media??{},i),m=`<!DOCTYPE html>
364
+ })`}var Eh=M(()=>{Vr()});function nv(e){let t=K0(e,e.title??"a class"),r=t.title;if(!r)throw Error("compileClassJson: missing title (class name)");let n=HD(t.extends),s=t.$defs,i=s?.fields??{},o=s?.constructor,a=UD(o)?o: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=n!=="Object"?` extends ${n}`:"";c.push(`class ${r}${u} {`);for(let[p,h]of Object.entries(i)){if(h.scope!=="static")continue;let m=h.identifier??p,y=h.access==="private"?"#":"",g=h.initializer!==void 0?JSON.stringify(h.initializer):h.default!==void 0?JSON.stringify(h.default):"null";c.push(` static ${y}${m} = ${g};`)}for(let[p,h]of Object.entries(i)){if(h.scope==="static")continue;if(h.access!=="private")continue;let m=h.identifier??p;c.push(` #${m};`)}if(Object.keys(i).length>0)c.push("");if(c.push(" constructor(config = {}) {"),a?.superCall||n!=="Object"){let p=a?.superCall?.arguments?a.superCall.arguments.join(", "):"";c.push(` super(${p});`)}for(let[p,h]of Object.entries(i)){if(h.scope==="static")continue;let m=h.identifier??p,y=h.access==="private"?"#":"",g=h.initializer!==void 0?JSON.stringify(h.initializer):h.default!==void 0?JSON.stringify(h.default):"null";c.push(` this.${y}${m} = config.${m} !== undefined ? config.${m} : ${g};`)}if(a?.body){let p=Array.isArray(a.body)?a.body:[a.body];for(let h of p)c.push(` ${h}`)}c.push(" }");for(let[p,h]of Object.entries(l)){let m=h.identifier??p,y=h.scope==="static",b=h.access==="private"?"#":"",w=y?"static ":"",j=h.returnType?.$ref?.includes("Promise")||GD(h)?"async ":"",S=rv(h.parameters??[]),E=zD(h.body);if(c.push(""),h.role==="accessor"){if(h.getter)c.push(` ${w}get ${b}${m}() {`,` ${h.getter.body}`," }");if(h.setter){let P=rv(h.setter.parameters??[]);c.push(` ${w}set ${b}${m}(${P}) {`,` ${h.setter.body}`," }")}}else{c.push(` ${w}${j}${b}${m}(${S}) {`);for(let P of E)c.push(` ${P}`);c.push(" }")}}return c.push("}","",`export { ${r} };`,`export default ${r};`,""),c.join(`
365
+ `)}function UD(e){return typeof e==="object"}function HD(e){if(!e)return"Object";if(A(e))return e;if(e.$ref){let t=e.$ref.match(/([A-Za-z0-9_]+)\.class\.json/);return t?t[1]:"Object"}return"Object"}function rv(e){return e.map((t)=>{if(t.$ref)return t.$ref.split("/").pop();let r=t.identifier??t.name;return A(r)?r:"arg"}).join(", ")}function zD(e){if(!e)return[""];return Array.isArray(e)?e:[e]}function GD(e){return(Array.isArray(e.body)?e.body.join(`
366
+ `):e.body??"").includes("await ")}var sv=M(()=>{Xo();ye()});import{readFileSync as KD}from"node:fs";async function Ph(e,t={}){let{title:r="Jx App",reactivitySrc:n=ia,litHtmlSrc:s=oa,projectStyle:i=null}=t,o;if(A(e)){let l=KD(e,"utf8");if(xs(e))o=$s(l,e);else{let{extname:c}=await import("node:path"),u=c(e).toLowerCase(),p=t.formats?.byExtension(u,"parse");if(!p){await Promise.resolve().then(() => vs());throw $u(e,u)}o=await p.parseDocument(l)}}else o=e;if(o=Nn(o,A(e)?e:"the document"),mb(o)){await Promise.resolve().then(() => sv());let c=nv(o),u=A(e)?e.replace(/\.class\.json$/,".js"):`${o.title}.js`;return{files:[{content:c,path:u}],html:""}}if(!Xu(o))return Kw(o,{litHtmlSrc:s,projectStyle:i,reactivitySrc:n,...iv(t),title:r});if(o.tagName&&o.tagName.includes("-")){let{tagName:l}=o,c=tf(l),p={content:Gl(o,c,[],t.rewriteSrc,null,t.serverBaseUrl),path:`${l}.js`,tagName:l},h=da(o,o.$media??{},i),m=`<!DOCTYPE html>
366
367
  <html lang="en">
367
368
  <head>
368
369
  <meta charset="utf-8">
@@ -382,47 +383,47 @@ app.post('${t}/${e}', async (c) => {
382
383
  <${l}></${l}>
383
384
  <script type="module" src="./${l}.js"></script>
384
385
  </body>
385
- </html>`;return{files:[p],html:m}}let a={litHtmlSrc:s,projectStyle:i,reactivitySrc:n,...Jw(t),title:r};if(t.serverBaseUrl!==void 0)a.serverBaseUrl=t.serverBaseUrl;return eh(o,a)}function Jw(e){let t={};if(e.prePaintScheme===!1)t.prePaintScheme=!1;if(e.rewriteSrc)t.rewriteSrc=e.rewriteSrc;return t}async function Mre(e,t){let r=await ih(e),{writeFileSync:n,mkdirSync:s}=await import("node:fs"),{dirname:i,join:o}=await import("node:path");if(t){n(t,r.html,"utf8"),console.error(`Written to ${t}`);let a=i(t);for(let l of r.files){let c=o(a,l.path);s(i(c),{recursive:!0}),n(c,l.content,"utf8"),console.error(`Written to ${c}`)}}else process.stdout.write(r.html)}var Mw=D(()=>{Uo();Rn();Ll();_w();rh();ye();Wi();Rn();sh();Ll();rh()});var Dw=(e)=>typeof e<"u"&&e!==null,uD=(e)=>typeof e==="object",fD=(e)=>Object.prototype.toString.call(e)==="[object Object]",dD=(e)=>typeof e==="function",pD=(e)=>typeof e==="boolean",mD=(e)=>e instanceof Buffer,hD=(e)=>{if(Dw(e))switch(e.constructor){case Uint8Array:case Uint8ClampedArray:case Int8Array:case Uint16Array:case Int16Array:case Uint32Array:case Int32Array:case Float32Array:case Float64Array:return!0}return!1},gD=(e)=>e instanceof ArrayBuffer,yD=(e)=>typeof e==="string"&&e.length>0,bD=(e)=>typeof e==="number"&&Number.isFinite(e),xD=(e)=>Number.isInteger(e),$D=(e,t,r)=>e>=t&&e<=r,wD=(e,t)=>t.includes(e),vD=(e,t,r)=>{let n;try{n=String(r).slice(0,100)}catch{}return Error(`Expected ${t} for ${e} but received ${n} of type ${typeof r}`)},SD=(e,t)=>(t.message=e.message,t),f;var Cn=D(()=>{/*!
386
+ </html>`;return{files:[p],html:m}}let a={litHtmlSrc:s,projectStyle:i,reactivitySrc:n,...iv(t),title:r};if(t.serverBaseUrl!==void 0)a.serverBaseUrl=t.serverBaseUrl;return $h(o,a)}function iv(e){let t={};if(e.prePaintScheme===!1)t.prePaintScheme=!1;if(e.rewriteSrc)t.rewriteSrc=e.rewriteSrc;return t}async function fse(e,t){let r=await Ph(e),{writeFileSync:n,mkdirSync:s}=await import("node:fs"),{dirname:i,join:o}=await import("node:path");if(t){n(t,r.html,"utf8"),console.error(`Written to ${t}`);let a=i(t);for(let l of r.files){let c=o(a,l.path);s(i(c),{recursive:!0}),n(c,l.content,"utf8"),console.error(`Written to ${c}`)}}else process.stdout.write(r.html)}var ov=M(()=>{Xo();In();Kl();Yw();vh();ye();Ui();In();Eh();Kl();vh()});var av=(e)=>typeof e<"u"&&e!==null,XD=(e)=>typeof e==="object",YD=(e)=>Object.prototype.toString.call(e)==="[object Object]",ZD=(e)=>typeof e==="function",QD=(e)=>typeof e==="boolean",eL=(e)=>e instanceof Buffer,tL=(e)=>{if(av(e))switch(e.constructor){case Uint8Array:case Uint8ClampedArray:case Int8Array:case Uint16Array:case Int16Array:case Uint32Array:case Int32Array:case Float32Array:case Float64Array:return!0}return!1},rL=(e)=>e instanceof ArrayBuffer,nL=(e)=>typeof e==="string"&&e.length>0,sL=(e)=>typeof e==="number"&&Number.isFinite(e),iL=(e)=>Number.isInteger(e),oL=(e,t,r)=>e>=t&&e<=r,aL=(e,t)=>t.includes(e),lL=(e,t,r)=>{let n;try{n=String(r).slice(0,100)}catch{}return Error(`Expected ${t} for ${e} but received ${n} of type ${typeof r}`)},cL=(e,t)=>(t.message=e.message,t),f;var Mn=M(()=>{/*!
386
387
  Copyright 2013 Lovell Fuller and others.
387
388
  SPDX-License-Identifier: Apache-2.0
388
- */f={defined:Dw,object:uD,plainObject:fD,fn:dD,bool:pD,buffer:mD,typedArray:hD,arrayBuffer:gD,string:yD,number:bD,integer:xD,inRange:$D,inArray:wD,invalidParameterError:vD,nativeError:SD}});var qw=N(function(Bre,Fw){var Lw=()=>process.platform==="linux",tf=null,ED=()=>{if(!tf)if(Lw()&&process.report){let e=process.report.excludeNetwork;process.report.excludeNetwork=!0,tf=process.report.getReport(),process.report.excludeNetwork=e}else tf={};return tf};Fw.exports={isLinux:Lw,getReport:ED}});var Ww=N(function(Hre,Vw){var Qr=He("fs"),jD=(e)=>{let t=Qr.openSync(e,"r"),r=Buffer.alloc(2048),n=Qr.readSync(t,r,0,2048,0);return Qr.close(t,()=>{}),r.subarray(0,n)},PD=(e)=>new Promise((t,r)=>{Qr.open(e,"r",(n,s)=>{if(n)r(n);else{let i=Buffer.alloc(2048);Qr.read(s,i,0,2048,0,(o,a)=>{t(i.subarray(0,a)),Qr.close(s,()=>{})})}})});Vw.exports={LDD_PATH:"/usr/bin/ldd",SELF_PATH:"/proc/self/exe",readFileSync:jD,readFile:PD}});var Hw=N(function(Ure,Bw){var kD=(e)=>{if(e.length<64)return null;if(e.readUInt32BE(0)!==2135247942)return null;if(e.readUInt8(4)!==2)return null;if(e.readUInt8(5)!==1)return null;let t=e.readUInt32LE(32),r=e.readUInt16LE(54),n=e.readUInt16LE(56);for(let s=0;s<n;s++){let i=t+s*r;if(e.readUInt32LE(i)===3){let a=e.readUInt32LE(i+8),l=e.readUInt32LE(i+32);return e.subarray(a,a+l).toString().replace(/\0.*$/g,"")}}return null};Bw.exports={interpreterPath:kD}});var sf=N(function(zre,av){var rf=He("child_process"),{isLinux:fa,getReport:zw}=qw(),{LDD_PATH:nf,SELF_PATH:Gw,readFile:oh,readFileSync:ah}=Ww(),{interpreterPath:Kw}=Hw(),Nn,Tn,In,Qs="",Yw=()=>{if(!Qs)return new Promise((e)=>{rf.exec("getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true",(t,r)=>{Qs=t?" ":r,e(Qs)})});return Qs},Xw=()=>{if(!Qs)try{Qs=rf.execSync("getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true",{encoding:"utf8"})}catch(e){Qs=" "}return Qs},_s="glibc",Zw=/LIBC[a-z0-9 \-).]*?(\d+\.\d+)/i,oo="musl",_D=(e)=>e.includes("libc.musl-")||e.includes("ld-musl-"),Qw=()=>{let e=zw();if(e.header&&e.header.glibcVersionRuntime)return _s;if(Array.isArray(e.sharedObjects)){if(e.sharedObjects.some(_D))return oo}return null},ev=(e)=>{let[t,r]=e.split(/[\r\n]+/);if(t&&t.includes(_s))return _s;if(r&&r.includes(oo))return oo;return null},tv=(e)=>{if(e){if(e.includes("/ld-musl-"))return oo;else if(e.includes("/ld-linux-"))return _s}return null},rv=(e)=>{if(e=e.toString(),e.includes("musl"))return oo;if(e.includes("GNU C Library"))return _s;return null},AD=async()=>{if(Tn!==void 0)return Tn;Tn=null;try{let e=await oh(nf);Tn=rv(e)}catch(e){}return Tn},RD=()=>{if(Tn!==void 0)return Tn;Tn=null;try{let e=ah(nf);Tn=rv(e)}catch(e){}return Tn},OD=async()=>{if(Nn!==void 0)return Nn;Nn=null;try{let e=await oh(Gw),t=Kw(e);Nn=tv(t)}catch(e){}return Nn},CD=()=>{if(Nn!==void 0)return Nn;Nn=null;try{let e=ah(Gw),t=Kw(e);Nn=tv(t)}catch(e){}return Nn},nv=async()=>{let e=null;if(fa()){if(e=await OD(),!e){if(e=await AD(),!e)e=Qw();if(!e){let t=await Yw();e=ev(t)}}}return e},sv=()=>{let e=null;if(fa()){if(e=CD(),!e){if(e=RD(),!e)e=Qw();if(!e){let t=Xw();e=ev(t)}}}return e},ND=async()=>fa()&&await nv()!==_s,TD=()=>fa()&&sv()!==_s,ID=async()=>{if(In!==void 0)return In;In=null;try{let t=(await oh(nf)).match(Zw);if(t)In=t[1]}catch(e){}return In},JD=()=>{if(In!==void 0)return In;In=null;try{let t=ah(nf).match(Zw);if(t)In=t[1]}catch(e){}return In},iv=()=>{let e=zw();if(e.header&&e.header.glibcVersionRuntime)return e.header.glibcVersionRuntime;return null},Uw=(e)=>e.trim().split(/\s+/)[1],ov=(e)=>{let[t,r,n]=e.split(/[\r\n]+/);if(t&&t.includes(_s))return Uw(t);if(r&&n&&r.includes(oo))return Uw(n);return null},MD=async()=>{let e=null;if(fa()){if(e=await ID(),!e)e=iv();if(!e){let t=await Yw();e=ov(t)}}return e},DD=()=>{let e=null;if(fa()){if(e=JD(),!e)e=iv();if(!e){let t=Xw();e=ov(t)}}return e};av.exports={GLIBC:_s,MUSL:oo,family:nv,familySync:sv,isNonGlibcLinux:ND,isNonGlibcLinuxSync:TD,version:MD,versionSync:DD}});var da=N(function(Gre,lv){var LD=Number.MAX_SAFE_INTEGER||9007199254740991,FD=["major","premajor","minor","preminor","patch","prepatch","prerelease"];lv.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:LD,RELEASE_TYPES:FD,SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var Fl=N(function(Kre,cv){var qD=typeof process==="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};cv.exports=qD});var pa=N(function(Jn,uv){var{MAX_SAFE_COMPONENT_LENGTH:lh,MAX_SAFE_BUILD_LENGTH:VD,MAX_LENGTH:WD}=da(),BD=Fl();Jn=uv.exports={};var HD=Jn.re=[],UD=Jn.safeRe=[],te=Jn.src=[],zD=Jn.safeSrc=[],re=Jn.t={},GD=0,ch="[a-zA-Z0-9-]",KD=[["\\s",1],["\\d",WD],[ch,VD]],YD=(e)=>{for(let[t,r]of KD)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},Se=(e,t,r)=>{let n=YD(t),s=GD++;BD(e,s,t),re[e]=s,te[s]=t,zD[s]=n,HD[s]=new RegExp(t,r?"g":void 0),UD[s]=new RegExp(n,r?"g":void 0)};Se("NUMERICIDENTIFIER","0|[1-9]\\d*");Se("NUMERICIDENTIFIERLOOSE","\\d+");Se("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${ch}*`);Se("MAINVERSION",`(${te[re.NUMERICIDENTIFIER]})\\.(${te[re.NUMERICIDENTIFIER]})\\.(${te[re.NUMERICIDENTIFIER]})`);Se("MAINVERSIONLOOSE",`(${te[re.NUMERICIDENTIFIERLOOSE]})\\.(${te[re.NUMERICIDENTIFIERLOOSE]})\\.(${te[re.NUMERICIDENTIFIERLOOSE]})`);Se("PRERELEASEIDENTIFIER",`(?:${te[re.NONNUMERICIDENTIFIER]}|${te[re.NUMERICIDENTIFIER]})`);Se("PRERELEASEIDENTIFIERLOOSE",`(?:${te[re.NONNUMERICIDENTIFIER]}|${te[re.NUMERICIDENTIFIERLOOSE]})`);Se("PRERELEASE",`(?:-(${te[re.PRERELEASEIDENTIFIER]}(?:\\.${te[re.PRERELEASEIDENTIFIER]})*))`);Se("PRERELEASELOOSE",`(?:-?(${te[re.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${te[re.PRERELEASEIDENTIFIERLOOSE]})*))`);Se("BUILDIDENTIFIER",`${ch}+`);Se("BUILD",`(?:\\+(${te[re.BUILDIDENTIFIER]}(?:\\.${te[re.BUILDIDENTIFIER]})*))`);Se("FULLPLAIN",`v?${te[re.MAINVERSION]}${te[re.PRERELEASE]}?${te[re.BUILD]}?`);Se("FULL",`^${te[re.FULLPLAIN]}$`);Se("LOOSEPLAIN",`[v=\\s]*${te[re.MAINVERSIONLOOSE]}${te[re.PRERELEASELOOSE]}?${te[re.BUILD]}?`);Se("LOOSE",`^${te[re.LOOSEPLAIN]}$`);Se("GTLT","((?:<|>)?=?)");Se("XRANGEIDENTIFIERLOOSE",`${te[re.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);Se("XRANGEIDENTIFIER",`${te[re.NUMERICIDENTIFIER]}|x|X|\\*`);Se("XRANGEPLAIN",`[v=\\s]*(${te[re.XRANGEIDENTIFIER]})(?:\\.(${te[re.XRANGEIDENTIFIER]})(?:\\.(${te[re.XRANGEIDENTIFIER]})(?:${te[re.PRERELEASE]})?${te[re.BUILD]}?)?)?`);Se("XRANGEPLAINLOOSE",`[v=\\s]*(${te[re.XRANGEIDENTIFIERLOOSE]})(?:\\.(${te[re.XRANGEIDENTIFIERLOOSE]})(?:\\.(${te[re.XRANGEIDENTIFIERLOOSE]})(?:${te[re.PRERELEASELOOSE]})?${te[re.BUILD]}?)?)?`);Se("XRANGE",`^${te[re.GTLT]}\\s*${te[re.XRANGEPLAIN]}$`);Se("XRANGELOOSE",`^${te[re.GTLT]}\\s*${te[re.XRANGEPLAINLOOSE]}$`);Se("COERCEPLAIN",`(^|[^\\d])(\\d{1,${lh}})(?:\\.(\\d{1,${lh}}))?(?:\\.(\\d{1,${lh}}))?`);Se("COERCE",`${te[re.COERCEPLAIN]}(?:$|[^\\d])`);Se("COERCEFULL",te[re.COERCEPLAIN]+`(?:${te[re.PRERELEASE]})?(?:${te[re.BUILD]})?(?:$|[^\\d])`);Se("COERCERTL",te[re.COERCE],!0);Se("COERCERTLFULL",te[re.COERCEFULL],!0);Se("LONETILDE","(?:~>?)");Se("TILDETRIM",`(\\s*)${te[re.LONETILDE]}\\s+`,!0);Jn.tildeTrimReplace="$1~";Se("TILDE",`^${te[re.LONETILDE]}${te[re.XRANGEPLAIN]}$`);Se("TILDELOOSE",`^${te[re.LONETILDE]}${te[re.XRANGEPLAINLOOSE]}$`);Se("LONECARET","(?:\\^)");Se("CARETTRIM",`(\\s*)${te[re.LONECARET]}\\s+`,!0);Jn.caretTrimReplace="$1^";Se("CARET",`^${te[re.LONECARET]}${te[re.XRANGEPLAIN]}$`);Se("CARETLOOSE",`^${te[re.LONECARET]}${te[re.XRANGEPLAINLOOSE]}$`);Se("COMPARATORLOOSE",`^${te[re.GTLT]}\\s*(${te[re.LOOSEPLAIN]})$|^$`);Se("COMPARATOR",`^${te[re.GTLT]}\\s*(${te[re.FULLPLAIN]})$|^$`);Se("COMPARATORTRIM",`(\\s*)${te[re.GTLT]}\\s*(${te[re.LOOSEPLAIN]}|${te[re.XRANGEPLAIN]})`,!0);Jn.comparatorTrimReplace="$1$2$3";Se("HYPHENRANGE",`^\\s*(${te[re.XRANGEPLAIN]})\\s+-\\s+(${te[re.XRANGEPLAIN]})\\s*$`);Se("HYPHENRANGELOOSE",`^\\s*(${te[re.XRANGEPLAINLOOSE]})\\s+-\\s+(${te[re.XRANGEPLAINLOOSE]})\\s*$`);Se("STAR","(<|>)?=?\\s*\\*");Se("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");Se("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var of=N(function(Yre,fv){var XD=Object.freeze({loose:!0}),ZD=Object.freeze({}),QD=(e)=>{if(!e)return ZD;if(typeof e!=="object")return XD;return e};fv.exports=QD});var uh=N(function(Xre,mv){var dv=/^[0-9]+$/,pv=(e,t)=>{if(typeof e==="number"&&typeof t==="number")return e===t?0:e<t?-1:1;let r=dv.test(e),n=dv.test(t);if(r&&n)e=+e,t=+t;return e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1},eL=(e,t)=>pv(t,e);mv.exports={compareIdentifiers:pv,rcompareIdentifiers:eL}});var zt=N(function(Zre,gv){var af=Fl(),{MAX_LENGTH:hv,MAX_SAFE_INTEGER:lf}=da(),{safeRe:cf,t:uf}=pa(),tL=of(),{compareIdentifiers:fh}=uh(),rL=(e,t)=>{let r=t.split(".");if(r.length>e.length)return!1;for(let n=0;n<r.length;n++)if(fh(e[n],r[n])!==0)return!1;return!0};class xn{constructor(e,t){if(t=tL(t),e instanceof xn)if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;else e=e.version;else if(typeof e!=="string")throw TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>hv)throw TypeError(`version is longer than ${hv} characters`);af("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let r=e.trim().match(t.loose?cf[uf.LOOSE]:cf[uf.FULL]);if(!r)throw TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>lf||this.major<0)throw TypeError("Invalid major version");if(this.minor>lf||this.minor<0)throw TypeError("Invalid minor version");if(this.patch>lf||this.patch<0)throw TypeError("Invalid patch version");if(!r[4])this.prerelease=[];else this.prerelease=r[4].split(".").map((n)=>{if(/^[0-9]+$/.test(n)){let s=+n;if(s>=0&&s<lf)return s}return n});this.build=r[5]?r[5].split("."):[],this.format()}format(){if(this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length)this.version+=`-${this.prerelease.join(".")}`;return this.version}toString(){return this.version}compare(e){if(af("SemVer.compare",this.version,this.options,e),!(e instanceof xn)){if(typeof e==="string"&&e===this.version)return 0;e=new xn(e,this.options)}if(e.version===this.version)return 0;return this.compareMain(e)||this.comparePre(e)}compareMain(e){if(!(e instanceof xn))e=new xn(e,this.options);if(this.major<e.major)return-1;if(this.major>e.major)return 1;if(this.minor<e.minor)return-1;if(this.minor>e.minor)return 1;if(this.patch<e.patch)return-1;if(this.patch>e.patch)return 1;return 0}comparePre(e){if(!(e instanceof xn))e=new xn(e,this.options);if(this.prerelease.length&&!e.prerelease.length)return-1;else if(!this.prerelease.length&&e.prerelease.length)return 1;else if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{let r=this.prerelease[t],n=e.prerelease[t];if(af("prerelease compare",t,r,n),r===void 0&&n===void 0)return 0;else if(n===void 0)return 1;else if(r===void 0)return-1;else if(r===n)continue;else return fh(r,n)}while(++t)}compareBuild(e){if(!(e instanceof xn))e=new xn(e,this.options);let t=0;do{let r=this.build[t],n=e.build[t];if(af("build compare",t,r,n),r===void 0&&n===void 0)return 0;else if(n===void 0)return 1;else if(r===void 0)return-1;else if(r===n)continue;else return fh(r,n)}while(++t)}inc(e,t,r){if(e.startsWith("pre")){if(!t&&r===!1)throw Error("invalid increment argument: identifier is empty");if(t){let n=`-${t}`.match(this.options.loose?cf[uf.PRERELEASELOOSE]:cf[uf.PRERELEASE]);if(!n||n[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,r),this.inc("pre",t,r);break;case"prerelease":if(this.prerelease.length===0)this.inc("patch",t,r);this.inc("pre",t,r);break;case"release":if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":if(this.minor!==0||this.patch!==0||this.prerelease.length===0)this.major++;this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":if(this.patch!==0||this.prerelease.length===0)this.minor++;this.patch=0,this.prerelease=[];break;case"patch":if(this.prerelease.length===0)this.patch++;this.prerelease=[];break;case"pre":{let n=Number(r)?1:0;if(this.prerelease.length===0)this.prerelease=[n];else{let s=this.prerelease.length;while(--s>=0)if(typeof this.prerelease[s]==="number")this.prerelease[s]++,s=-2;if(s===-1){if(t===this.prerelease.join(".")&&r===!1)throw Error("invalid increment argument: identifier already exists");this.prerelease.push(n)}}if(t){let s=[t,n];if(r===!1)s=[t];if(rL(this.prerelease,t)){let i=this.prerelease[t.split(".").length];if(isNaN(i))this.prerelease=s}else this.prerelease=s}break}default:throw Error(`invalid increment argument: ${e}`)}if(this.raw=this.format(),this.build.length)this.raw+=`+${this.build.join(".")}`;return this}}gv.exports=xn});var ei=N(function(Qre,bv){var yv=zt(),nL=(e,t,r=!1)=>{if(e instanceof yv)return e;try{return new yv(e,t)}catch(n){if(!r)return null;throw n}};bv.exports=nL});var $v=N(function(ene,xv){var sL=ei(),iL=(e,t)=>{let r=sL(e,t);return r?r.version:null};xv.exports=iL});var vv=N(function(tne,wv){var oL=ei(),aL=(e,t)=>{let r=oL(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};wv.exports=aL});var jv=N(function(rne,Ev){var Sv=zt(),lL=(e,t,r,n,s)=>{if(typeof r==="string")s=n,n=r,r=void 0;try{return new Sv(e instanceof Sv?e.version:e,r).inc(t,n,s).version}catch(i){return null}};Ev.exports=lL});var _v=N(function(nne,kv){var Pv=ei(),cL=(e,t)=>{let r=Pv(e,null,!0),n=Pv(t,null,!0),s=r.compare(n);if(s===0)return null;let i=s>0,o=i?r:n,a=i?n:r,l=!!o.prerelease.length;if(!!a.prerelease.length&&!l){if(!a.patch&&!a.minor)return"major";if(a.compareMain(o)===0){if(a.minor&&!a.patch)return"minor";return"patch"}}let u=l?"pre":"";if(r.major!==n.major)return u+"major";if(r.minor!==n.minor)return u+"minor";if(r.patch!==n.patch)return u+"patch";return"prerelease"};kv.exports=cL});var Rv=N(function(sne,Av){var uL=zt(),fL=(e,t)=>new uL(e,t).major;Av.exports=fL});var Cv=N(function(ine,Ov){var dL=zt(),pL=(e,t)=>new dL(e,t).minor;Ov.exports=pL});var Tv=N(function(one,Nv){var mL=zt(),hL=(e,t)=>new mL(e,t).patch;Nv.exports=hL});var Jv=N(function(ane,Iv){var gL=ei(),yL=(e,t)=>{let r=gL(e,t);return r&&r.prerelease.length?r.prerelease:null};Iv.exports=yL});var en=N(function(lne,Dv){var Mv=zt(),bL=(e,t,r)=>new Mv(e,r).compare(new Mv(t,r));Dv.exports=bL});var Fv=N(function(cne,Lv){var xL=en(),$L=(e,t,r)=>xL(t,e,r);Lv.exports=$L});var Vv=N(function(une,qv){var wL=en(),vL=(e,t)=>wL(e,t,!0);qv.exports=vL});var ff=N(function(fne,Bv){var Wv=zt(),SL=(e,t,r)=>{let n=new Wv(e,r),s=new Wv(t,r);return n.compare(s)||n.compareBuild(s)};Bv.exports=SL});var Uv=N(function(dne,Hv){var EL=ff(),jL=(e,t)=>e.sort((r,n)=>EL(r,n,t));Hv.exports=jL});var Gv=N(function(pne,zv){var PL=ff(),kL=(e,t)=>e.sort((r,n)=>PL(n,r,t));zv.exports=kL});var ql=N(function(mne,Kv){var _L=en(),AL=(e,t,r)=>_L(e,t,r)>0;Kv.exports=AL});var df=N(function(hne,Yv){var RL=en(),OL=(e,t,r)=>RL(e,t,r)<0;Yv.exports=OL});var dh=N(function(gne,Xv){var CL=en(),NL=(e,t,r)=>CL(e,t,r)===0;Xv.exports=NL});var ph=N(function(yne,Zv){var TL=en(),IL=(e,t,r)=>TL(e,t,r)!==0;Zv.exports=IL});var pf=N(function(bne,Qv){var JL=en(),ML=(e,t,r)=>JL(e,t,r)>=0;Qv.exports=ML});var mf=N(function(xne,eS){var DL=en(),LL=(e,t,r)=>DL(e,t,r)<=0;eS.exports=LL});var mh=N(function($ne,tS){var FL=dh(),qL=ph(),VL=ql(),WL=pf(),BL=df(),HL=mf(),UL=(e,t,r,n)=>{switch(t){case"===":if(typeof e==="object")e=e.version;if(typeof r==="object")r=r.version;return e===r;case"!==":if(typeof e==="object")e=e.version;if(typeof r==="object")r=r.version;return e!==r;case"":case"=":case"==":return FL(e,r,n);case"!=":return qL(e,r,n);case">":return VL(e,r,n);case">=":return WL(e,r,n);case"<":return BL(e,r,n);case"<=":return HL(e,r,n);default:throw TypeError(`Invalid operator: ${t}`)}};tS.exports=UL});var nS=N(function(wne,rS){var zL=zt(),GL=ei(),{safeRe:hf,t:gf}=pa(),KL=(e,t)=>{if(e instanceof zL)return e;if(typeof e==="number")e=String(e);if(typeof e!=="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?hf[gf.COERCEFULL]:hf[gf.COERCE]);else{let l=t.includePrerelease?hf[gf.COERCERTLFULL]:hf[gf.COERCERTL],c;while((c=l.exec(e))&&(!r||r.index+r[0].length!==e.length)){if(!r||c.index+c[0].length!==r.index+r[0].length)r=c;l.lastIndex=c.index+c[1].length+c[2].length}l.lastIndex=-1}if(r===null)return null;let n=r[2],s=r[3]||"0",i=r[4]||"0",o=t.includePrerelease&&r[5]?`-${r[5]}`:"",a=t.includePrerelease&&r[6]?`+${r[6]}`:"";return GL(`${n}.${s}.${i}${o}${a}`,t)};rS.exports=KL});var oS=N(function(vne,iS){var YL=ei(),sS=da(),XL=zt(),ZL=(e,t,r)=>{if(!sS.RELEASE_TYPES.includes(t))return null;let n=QL(e,r);return n&&eF(n,t)},QL=(e,t)=>{let r=e instanceof XL?e.version:e;return YL(r,t)},eF=(e,t)=>{if(tF(t))return e.version;switch(e.prerelease=[],t){case"major":e.minor=0,e.patch=0;break;case"minor":e.patch=0;break}return e.format()},tF=(e)=>e.startsWith("pre");iS.exports=ZL});var cS=N(function(Sne,lS){class aS{constructor(){this.max=1000,this.map=new Map}get(e){let t=this.map.get(e);if(t===void 0)return;else return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&t!==void 0){if(this.map.size>=this.max){let n=this.map.keys().next().value;this.delete(n)}this.map.set(e,t)}return this}}lS.exports=aS});var tn=N(function(Ene,pS){var rF=/\s+/g;class Vl{constructor(e,t){if(t=sF(t),e instanceof Vl)if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;else return new Vl(e.raw,t);if(e instanceof yf)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().replace(rF," "),this.set=this.raw.split("||").map((r)=>this.parseRange(r.trim())).filter((r)=>r.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let r=this.set[0];if(this.set=this.set.filter((n)=>!fS(n[0])),this.set.length===0)this.set=[r];else if(this.set.length>1){for(let n of this.set)if(n.length===1&&pF(n[0])){this.set=[n];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){if(e>0)this.formatted+="||";let t=this.set[e];for(let r=0;r<t.length;r++){if(r>0)this.formatted+=" ";this.formatted+=t[r].toString().trim()}}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){e=e.replace(dF,"");let r=((this.options.includePrerelease&&uF)|(this.options.loose&&fF))+":"+e,n=uS.get(r);if(n)return n;let s=this.options.loose,i=s?pr[Gt.HYPHENRANGELOOSE]:pr[Gt.HYPHENRANGE];e=e.replace(i,EF(this.options.includePrerelease)),st("hyphen replace",e),e=e.replace(pr[Gt.COMPARATORTRIM],aF),st("comparator trim",e),e=e.replace(pr[Gt.TILDETRIM],lF),st("tilde trim",e),e=e.replace(pr[Gt.CARETTRIM],cF),st("caret trim",e);let o=e.split(" ").map((u)=>mF(u,this.options)).join(" ").split(/\s+/).map((u)=>SF(u,this.options));if(s)o=o.filter((u)=>(st("loose invalid filter",u,this.options),!!u.match(pr[Gt.COMPARATORLOOSE])));st("range list",o);let a=new Map,l=o.map((u)=>new yf(u,this.options));for(let u of l){if(fS(u))return[u];a.set(u.value,u)}if(a.size>1&&a.has(""))a.delete("");let c=[...a.values()];return uS.set(r,c),c}intersects(e,t){if(!(e instanceof Vl))throw TypeError("a Range is required");return this.set.some((r)=>dS(r,t)&&e.set.some((n)=>dS(n,t)&&r.every((s)=>n.every((i)=>s.intersects(i,t)))))}test(e){if(!e)return!1;if(typeof e==="string")try{e=new iF(e,this.options)}catch(t){return!1}for(let t=0;t<this.set.length;t++)if(jF(this.set[t],e,this.options))return!0;return!1}}pS.exports=Vl;var nF=cS(),uS=new nF,sF=of(),yf=Wl(),st=Fl(),iF=zt(),{safeRe:pr,src:oF,t:Gt,comparatorTrimReplace:aF,tildeTrimReplace:lF,caretTrimReplace:cF}=pa(),{FLAG_INCLUDE_PRERELEASE:uF,FLAG_LOOSE:fF}=da(),dF=new RegExp(oF[Gt.BUILD],"g"),fS=(e)=>e.value==="<0.0.0-0",pF=(e)=>e.value==="",dS=(e,t)=>{let r=!0,n=e.slice(),s=n.pop();while(r&&n.length)r=n.every((i)=>s.intersects(i,t)),s=n.pop();return r},mF=(e,t)=>(e=e.replace(pr[Gt.BUILD],""),st("comp",e,t),e=bF(e,t),st("caret",e),e=gF(e,t),st("tildes",e),e=$F(e,t),st("xrange",e),e=vF(e,t),st("stars",e),e),It=(e)=>!e||e.toLowerCase()==="x"||e==="*",hF=(e,t,r)=>It(e)&&!It(t)||It(t)&&r&&!It(r),gF=(e,t)=>e.trim().split(/\s+/).map((r)=>yF(r,t)).join(" "),yF=(e,t)=>{let r=t.loose?pr[Gt.TILDELOOSE]:pr[Gt.TILDE],n=t.includePrerelease?"-0":"";return e.replace(r,(s,i,o,a,l)=>{st("tilde",e,s,i,o,a,l);let c;if(It(i))c="";else if(It(o))c=`>=${i}.0.0${n} <${+i+1}.0.0-0`;else if(It(a))c=`>=${i}.${o}.0${n} <${i}.${+o+1}.0-0`;else if(l)st("replaceTilde pr",l),c=`>=${i}.${o}.${a}-${l} <${i}.${+o+1}.0-0`;else c=`>=${i}.${o}.${a} <${i}.${+o+1}.0-0`;return st("tilde return",c),c})},bF=(e,t)=>e.trim().split(/\s+/).map((r)=>xF(r,t)).join(" "),xF=(e,t)=>{st("caret",e,t);let r=t.loose?pr[Gt.CARETLOOSE]:pr[Gt.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(s,i,o,a,l)=>{st("caret",e,s,i,o,a,l);let c;if(It(i))c="";else if(It(o))c=`>=${i}.0.0${n} <${+i+1}.0.0-0`;else if(It(a))if(i==="0")c=`>=${i}.${o}.0${n} <${i}.${+o+1}.0-0`;else c=`>=${i}.${o}.0${n} <${+i+1}.0.0-0`;else if(l)if(st("replaceCaret pr",l),i==="0")if(o==="0")c=`>=${i}.${o}.${a}-${l} <${i}.${o}.${+a+1}-0`;else c=`>=${i}.${o}.${a}-${l} <${i}.${+o+1}.0-0`;else c=`>=${i}.${o}.${a}-${l} <${+i+1}.0.0-0`;else if(st("no pr"),i==="0")if(o==="0")c=`>=${i}.${o}.${a} <${i}.${o}.${+a+1}-0`;else c=`>=${i}.${o}.${a} <${i}.${+o+1}.0-0`;else c=`>=${i}.${o}.${a} <${+i+1}.0.0-0`;return st("caret return",c),c})},$F=(e,t)=>(st("replaceXRanges",e,t),e.split(/\s+/).map((r)=>wF(r,t)).join(" ")),wF=(e,t)=>{e=e.trim();let r=t.loose?pr[Gt.XRANGELOOSE]:pr[Gt.XRANGE];return e.replace(r,(n,s,i,o,a,l)=>{if(st("xRange",e,n,s,i,o,a,l),hF(i,o,a))return e;let c=It(i),u=c||It(o),p=u||It(a),h=p;if(s==="="&&h)s="";if(l=t.includePrerelease?"-0":"",c)if(s===">"||s==="<")n="<0.0.0-0";else n="*";else if(s&&h){if(u)o=0;if(a=0,s===">")if(s=">=",u)i=+i+1,o=0,a=0;else o=+o+1,a=0;else if(s==="<=")if(s="<",u)i=+i+1;else o=+o+1;if(s==="<")l="-0";n=`${s+i}.${o}.${a}${l}`}else if(u)n=`>=${i}.0.0${l} <${+i+1}.0.0-0`;else if(p)n=`>=${i}.${o}.0${l} <${i}.${+o+1}.0-0`;return st("xRange return",n),n})},vF=(e,t)=>(st("replaceStars",e,t),e.trim().replace(pr[Gt.STAR],"")),SF=(e,t)=>(st("replaceGTE0",e,t),e.trim().replace(pr[t.includePrerelease?Gt.GTE0PRE:Gt.GTE0],"")),EF=(e)=>(t,r,n,s,i,o,a,l,c,u,p,h)=>{if(It(n))r="";else if(It(s))r=`>=${n}.0.0${e?"-0":""}`;else if(It(i))r=`>=${n}.${s}.0${e?"-0":""}`;else if(o)r=`>=${r}`;else r=`>=${r}${e?"-0":""}`;if(It(c))l="";else if(It(u))l=`<${+c+1}.0.0-0`;else if(It(p))l=`<${c}.${+u+1}.0-0`;else if(h)l=`<=${c}.${u}.${p}-${h}`;else if(e)l=`<${c}.${u}.${+p+1}-0`;else l=`<=${l}`;return`${r} ${l}`.trim()},jF=(e,t,r)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let n=0;n<e.length;n++){if(st(e[n].semver),e[n].semver===yf.ANY)continue;if(e[n].semver.prerelease.length>0){let s=e[n].semver;if(s.major===t.major&&s.minor===t.minor&&s.patch===t.patch)return!0}}return!1}return!0}});var Wl=N(function(jne,xS){var Bl=Symbol("SemVer ANY");class bf{static get ANY(){return Bl}constructor(e,t){if(t=mS(t),e instanceof bf)if(e.loose===!!t.loose)return e;else e=e.value;if(e=e.trim().split(/\s+/).join(" "),gh("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===Bl)this.value="";else this.value=this.operator+this.semver.version;gh("comp",this)}parse(e){let t=this.options.loose?hS[gS.COMPARATORLOOSE]:hS[gS.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);if(this.operator=r[1]!==void 0?r[1]:"",this.operator==="=")this.operator="";if(!r[2])this.semver=Bl;else this.semver=new yS(r[2],this.options.loose)}toString(){return this.value}test(e){if(gh("Comparator.test",e,this.options.loose),this.semver===Bl||e===Bl)return!0;if(typeof e==="string")try{e=new yS(e,this.options)}catch(t){return!1}return hh(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof bf))throw TypeError("a Comparator is required");if(this.operator===""){if(this.value==="")return!0;return new bS(e.value,t).test(this.value)}else if(e.operator===""){if(e.value==="")return!0;return new bS(this.value,t).test(e.semver)}if(t=mS(t),t.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0"))return!1;if(!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0")))return!1;if(this.operator.startsWith(">")&&e.operator.startsWith(">"))return!0;if(this.operator.startsWith("<")&&e.operator.startsWith("<"))return!0;if(this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("="))return!0;if(hh(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))return!0;if(hh(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">"))return!0;return!1}}xS.exports=bf;var mS=of(),{safeRe:hS,t:gS}=pa(),hh=mh(),gh=Fl(),yS=zt(),bS=tn()});var Hl=N(function(Pne,$S){var PF=tn(),kF=(e,t,r)=>{try{t=new PF(t,r)}catch(n){return!1}return t.test(e)};$S.exports=kF});var vS=N(function(kne,wS){var _F=tn(),AF=(e,t)=>new _F(e,t).set.map((r)=>r.map((n)=>n.value).join(" ").trim().split(" "));wS.exports=AF});var ES=N(function(_ne,SS){var RF=zt(),OF=tn(),CF=(e,t,r)=>{let n=null,s=null,i=null;try{i=new OF(t,r)}catch(o){return null}return e.forEach((o)=>{if(i.test(o)){if(!n||s.compare(o)===-1)n=o,s=new RF(n,r)}}),n};SS.exports=CF});var PS=N(function(Ane,jS){var NF=zt(),TF=tn(),IF=(e,t,r)=>{let n=null,s=null,i=null;try{i=new TF(t,r)}catch(o){return null}return e.forEach((o)=>{if(i.test(o)){if(!n||s.compare(o)===1)n=o,s=new NF(n,r)}}),n};jS.exports=IF});var AS=N(function(Rne,_S){var yh=zt(),JF=tn(),kS=ql(),MF=(e,t)=>{e=new JF(e,t);let r=new yh("0.0.0");if(e.test(r))return r;if(r=new yh("0.0.0-0"),e.test(r))return r;r=null;for(let n=0;n<e.set.length;++n){let s=e.set[n],i=null;if(s.forEach((o)=>{let a=new yh(o.semver.version);switch(o.operator){case">":if(a.prerelease.length===0)a.patch++;else a.prerelease.push(0);a.raw=a.format();case"":case">=":if(!i||kS(a,i))i=a;break;case"<":case"<=":break;default:throw Error(`Unexpected operation: ${o.operator}`)}}),i&&(!r||kS(r,i)))r=i}if(r&&e.test(r))return r;return null};_S.exports=MF});var OS=N(function(One,RS){var DF=tn(),LF=(e,t)=>{try{return new DF(e,t).range||"*"}catch(r){return null}};RS.exports=LF});var xf=N(function(Cne,IS){var FF=zt(),TS=Wl(),{ANY:qF}=TS,VF=tn(),WF=Hl(),CS=ql(),NS=df(),BF=mf(),HF=pf(),UF=(e,t,r,n)=>{e=new FF(e,n),t=new VF(t,n);let s,i,o,a,l;switch(r){case">":s=CS,i=BF,o=NS,a=">",l=">=";break;case"<":s=NS,i=HF,o=CS,a="<",l="<=";break;default:throw TypeError('Must provide a hilo val of "<" or ">"')}if(WF(e,t,n))return!1;for(let c=0;c<t.set.length;++c){let u=t.set[c],p=null,h=null;if(u.forEach((m)=>{if(m.semver===qF)m=new TS(">=0.0.0");if(p=p||m,h=h||m,s(m.semver,p.semver,n))p=m;else if(o(m.semver,h.semver,n))h=m}),p.operator===a||p.operator===l)return!1;if((!h.operator||h.operator===a)&&i(e,h.semver))return!1;else if(h.operator===l&&o(e,h.semver))return!1}return!0};IS.exports=UF});var MS=N(function(Nne,JS){var zF=xf(),GF=(e,t,r)=>zF(e,t,">",r);JS.exports=GF});var LS=N(function(Tne,DS){var KF=xf(),YF=(e,t,r)=>KF(e,t,"<",r);DS.exports=YF});var VS=N(function(Ine,qS){var FS=tn(),XF=(e,t,r)=>(e=new FS(e,r),t=new FS(t,r),e.intersects(t,r));qS.exports=XF});var BS=N(function(Jne,WS){var ZF=Hl(),QF=en();WS.exports=(e,t,r)=>{let n=[],s=null,i=null,o=e.sort((u,p)=>QF(u,p,r));for(let u of o)if(ZF(u,t,r)){if(i=u,!s)s=u}else{if(i)n.push([s,i]);i=null,s=null}if(s)n.push([s,null]);let a=[];for(let[u,p]of n)if(u===p)a.push(u);else if(!p&&u===o[0])a.push("*");else if(!p)a.push(`>=${u}`);else if(u===o[0])a.push(`<=${p}`);else a.push(`${u} - ${p}`);let l=a.join(" || "),c=typeof t.raw==="string"?t.raw:String(t);return l.length<c.length?l:t}});var YS=N(function(Mne,KS){var HS=tn(),$h=Wl(),{ANY:bh}=$h,xh=Hl(),wh=en(),e5=(e,t,r={})=>{if(e===t)return!0;e=new HS(e,r),t=new HS(t,r);let n=!1;e:for(let s of e.set){for(let i of t.set){let o=r5(s,i,r);if(n=n||o!==null,o)continue e}if(n)return!1}return!0},t5=[new $h(">=0.0.0-0")],US=[new $h(">=0.0.0")],r5=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===bh)if(t.length===1&&t[0].semver===bh)return!0;else if(r.includePrerelease)e=t5;else e=US;if(t.length===1&&t[0].semver===bh)if(r.includePrerelease)return!0;else t=US;let n=new Set,s,i;for(let m of e)if(m.operator===">"||m.operator===">=")s=zS(s,m,r);else if(m.operator==="<"||m.operator==="<=")i=GS(i,m,r);else n.add(m.semver);if(n.size>1)return null;let o;if(s&&i){if(o=wh(s.semver,i.semver,r),o>0)return null;else if(o===0&&(s.operator!==">="||i.operator!=="<="))return null}for(let m of n){if(s&&!xh(m,String(s),r))return null;if(i&&!xh(m,String(i),r))return null;for(let b of t)if(!xh(m,String(b),r))return!1;return!0}let a,l,c,u,p=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1,h=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1;if(p&&p.prerelease.length===1&&i.operator==="<"&&p.prerelease[0]===0)p=!1;for(let m of t){if(u=u||m.operator===">"||m.operator===">=",c=c||m.operator==="<"||m.operator==="<=",s){if(h){if(m.semver.prerelease&&m.semver.prerelease.length&&m.semver.major===h.major&&m.semver.minor===h.minor&&m.semver.patch===h.patch)h=!1}if(m.operator===">"||m.operator===">="){if(a=zS(s,m,r),a===m&&a!==s)return!1}else if(s.operator===">="&&!m.test(s.semver))return!1}if(i){if(p){if(m.semver.prerelease&&m.semver.prerelease.length&&m.semver.major===p.major&&m.semver.minor===p.minor&&m.semver.patch===p.patch)p=!1}if(m.operator==="<"||m.operator==="<="){if(l=GS(i,m,r),l===m&&l!==i)return!1}else if(i.operator==="<="&&!m.test(i.semver))return!1}if(!m.operator&&(i||s)&&o!==0)return!1}if(s&&c&&!i&&o!==0)return!1;if(i&&u&&!s&&o!==0)return!1;if(h||p)return!1;return!0},zS=(e,t,r)=>{if(!e)return t;let n=wh(e.semver,t.semver,r);return n>0?e:n<0?t:t.operator===">"&&e.operator===">="?t:e},GS=(e,t,r)=>{if(!e)return t;let n=wh(e.semver,t.semver,r);return n<0?e:n>0?t:t.operator==="<"&&e.operator==="<="?t:e};KS.exports=e5});var ZS=N(function(Dne,XS){var ma=pa(),$f=da(),n5=zt(),wf=uh(),s5=ei(),i5=$v(),o5=vv(),a5=jv(),l5=_v(),c5=Rv(),u5=Cv(),f5=Tv(),d5=Jv(),p5=en(),m5=Fv(),h5=Vv(),g5=ff(),y5=Uv(),b5=Gv(),x5=ql(),$5=df(),w5=dh(),v5=ph(),S5=pf(),E5=mf(),j5=mh(),P5=nS(),k5=oS(),_5=Wl(),A5=tn(),R5=Hl(),O5=vS(),C5=ES(),N5=PS(),T5=AS(),I5=OS(),J5=xf(),M5=MS(),D5=LS(),L5=VS(),F5=BS(),q5=YS();XS.exports={parse:s5,valid:i5,clean:o5,inc:a5,diff:l5,major:c5,minor:u5,patch:f5,prerelease:d5,compare:p5,rcompare:m5,compareLoose:h5,compareBuild:g5,sort:y5,rsort:b5,gt:x5,lt:$5,eq:w5,neq:v5,gte:S5,lte:E5,cmp:j5,coerce:P5,truncate:k5,Comparator:_5,Range:A5,satisfies:R5,toComparators:O5,maxSatisfying:C5,minSatisfying:N5,minVersion:T5,validRange:I5,outside:J5,gtr:M5,ltr:D5,intersects:L5,simplifyRange:F5,subset:q5,SemVer:n5,re:ma.re,src:ma.src,tokens:ma.t,SEMVER_SPEC_VERSION:$f.SEMVER_SPEC_VERSION,RELEASE_TYPES:$f.RELEASE_TYPES,compareIdentifiers:wf.compareIdentifiers,rcompareIdentifiers:wf.rcompareIdentifiers}});var As;var vf=D(()=>{As={name:"sharp",description:"High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, GIF, AVIF and TIFF images",version:"0.35.5",author:"Lovell Fuller <npm@lovell.info>",homepage:"https://sharp.pixelplumbing.com",contributors:["Pierre Inglebert <pierre.inglebert@gmail.com>","Jonathan Ong <jonathanrichardong@gmail.com>","Chanon Sajjamanochai <chanon.s@gmail.com>","Juliano Julio <julianojulio@gmail.com>","Daniel Gasienica <daniel@gasienica.ch>","Julian Walker <julian@fiftythree.com>","Amit Pitaru <pitaru.amit@gmail.com>","Brandon Aaron <hello.brandon@aaron.sh>","Andreas Lind <andreas@one.com>","Maurus Cuelenaere <mcuelenaere@gmail.com>","Linus Unnebäck <linus@folkdatorn.se>","Victor Mateevitsi <mvictoras@gmail.com>","Alaric Holloway <alaric.holloway@gmail.com>","Bernhard K. Weisshuhn <bkw@codingforce.com>","Chris Riley <criley@primedia.com>","David Carley <dacarley@gmail.com>","John Tobin <john@limelightmobileinc.com>","Kenton Gray <kentongray@gmail.com>","Felix Bünemann <Felix.Buenemann@gmail.com>","Samy Al Zahrani <samyalzahrany@gmail.com>","Chintan Thakkar <lemnisk8@gmail.com>","F. Orlando Galashan <frulo@gmx.de>","Kleis Auke Wolthuizen <info@kleisauke.nl>","Matt Hirsch <mhirsch@media.mit.edu>","Matthias Thoemmes <thoemmes@gmail.com>","Patrick Paskaris <patrick@paskaris.gr>","Jérémy Lal <kapouer@melix.org>","Rahul Nanwani <r.nanwani@gmail.com>","Alice Monday <alice0meta@gmail.com>","Kristo Jorgenson <kristo.jorgenson@gmail.com>","YvesBos <yves_bos@outlook.com>","Guy Maliar <guy@tailorbrands.com>","Nicolas Coden <nicolas@ncoden.fr>","Matt Parrish <matt.r.parrish@gmail.com>","Marcel Bretschneider <marcel.bretschneider@gmail.com>","Matthew McEachen <matthew+github@mceachen.org>","Jarda Kotěšovec <jarda.kotesovec@gmail.com>","Kenric D'Souza <kenric.dsouza@gmail.com>","Oleh Aleinyk <oleg.aleynik@gmail.com>","Marcel Bretschneider <marcel.bretschneider@gmail.com>","Andrea Bianco <andrea.bianco@unibas.ch>","Rik Heywood <rik@rik.org>","Thomas Parisot <hi@oncletom.io>","Nathan Graves <nathanrgraves+github@gmail.com>","Tom Lokhorst <tom@lokhorst.eu>","Espen Hovlandsdal <espen@hovlandsdal.com>","Sylvain Dumont <sylvain.dumont35@gmail.com>","Alun Davies <alun.owain.davies@googlemail.com>","Aidan Hoolachan <ajhoolachan21@gmail.com>","Axel Eirola <axel.eirola@iki.fi>","Freezy <freezy@xbmc.org>","Daiz <taneli.vatanen@gmail.com>","Julian Aubourg <j@ubourg.net>","Keith Belovay <keith@picthrive.com>","Michael B. Klein <mbklein@gmail.com>","Jordan Prudhomme <jordan@raboland.fr>","Ilya Ovdin <iovdin@gmail.com>","Andargor <andargor@yahoo.com>","Paul Neave <paul.neave@gmail.com>","Brendan Kennedy <brenwken@gmail.com>","Brychan Bennett-Odlum <git@brychan.io>","Edward Silverton <e.silverton@gmail.com>","Roman Malieiev <aromaleev@gmail.com>","Tomas Szabo <tomas.szabo@deftomat.com>","Robert O'Rourke <robert@o-rourke.org>","Guillermo Alfonso Varela Chouciño <guillevch@gmail.com>","Christian Flintrup <chr@gigahost.dk>","Manan Jadhav <manan@motionden.com>","Leon Radley <leon@radley.se>","alza54 <alza54@thiocod.in>","Jacob Smith <jacob@frende.me>","Michael Nutt <michael@nutt.im>","Brad Parham <baparham@gmail.com>","Taneli Vatanen <taneli.vatanen@gmail.com>","Joris Dugué <zaruike10@gmail.com>","Chris Banks <christopher.bradley.banks@gmail.com>","Ompal Singh <ompal.hitm09@gmail.com>","Brodan <christopher.hranj@gmail.com>","Ankur Parihar <ankur.github@gmail.com>","Brahim Ait elhaj <brahima@gmail.com>","Mart Jansink <m.jansink@gmail.com>","Lachlan Newman <lachnewman007@gmail.com>","Dennis Beatty <dennis@dcbeatty.com>","Ingvar Stepanyan <me@rreverser.com>","Don Denton <don@happycollision.com>","Dmytro Tiapukhin <cool.gegeg@gmail.com>","Florian Lefebvre <contact@florian-lefebvre.dev>"],scripts:{build:"node install/build.js","build:dist":"node scripts/build.mjs",clean:"rm -rf src/build/ test/fixtures/output.*",test:"npm run lint && npm run test-unit",lint:"npm run lint-cpp && npm run lint-js && npm run lint-types && npm run lint-publish","lint-cpp":"cpplint --quiet src/*.h src/*.cc","lint-js":"biome lint","lint-publish":"publint --strict","lint-types":"tsd --files ./test/types/sharp.test-d.{cts,mts}","test-leak":"./test/leak/leak.sh","test-unit":"node --experimental-test-coverage test/unit.mjs","package-from-local-build":"node npm/from-local-build.js","package-wasm-wrappers":"node npm/wasm-wrappers.js","package-release-notes":"node npm/release-notes.js","docs-build":"node docs/build.mjs","docs-serve":"cd docs && npm start","docs-publish":"cd docs && npm run build && npx firebase-tools deploy --project pixelplumbing --only hosting:pixelplumbing-sharp"},type:"commonjs",files:["dist","install","lib/index.d.ts","src/*.{cc,h,gyp}"],main:"./dist/index.cjs",module:"./dist/index.mjs",types:"./dist/index.d.mts",exports:{".":{import:{types:"./dist/index.d.mts",default:"./dist/index.mjs"},require:{types:"./dist/index.d.cts",default:"./dist/index.cjs"}}},sideEffects:!0,repository:{type:"git",url:"git+https://github.com/lovell/sharp.git"},keywords:["jpeg","png","webp","avif","tiff","gif","svg","jp2","dzi","image","resize","thumbnail","crop","embed","libvips","vips"],dependencies:{"@img/colour":"^1.1.0","detect-libc":"^2.1.2",semver:"^7.8.5"},optionalDependencies:{"@img/sharp-darwin-arm64":"0.35.5","@img/sharp-darwin-x64":"0.35.5","@img/sharp-freebsd-wasm32":"0.35.5","@img/sharp-libvips-darwin-arm64":"1.3.4","@img/sharp-libvips-darwin-x64":"1.3.4","@img/sharp-libvips-linux-arm":"1.3.4","@img/sharp-libvips-linux-arm64":"1.3.4","@img/sharp-libvips-linux-ppc64":"1.3.4","@img/sharp-libvips-linux-riscv64":"1.3.4","@img/sharp-libvips-linux-s390x":"1.3.4","@img/sharp-libvips-linux-x64":"1.3.4","@img/sharp-libvips-linuxmusl-arm64":"1.3.4","@img/sharp-libvips-linuxmusl-x64":"1.3.4","@img/sharp-linux-arm":"0.35.5","@img/sharp-linux-arm64":"0.35.5","@img/sharp-linux-ppc64":"0.35.5","@img/sharp-linux-riscv64":"0.35.5","@img/sharp-linux-s390x":"0.35.5","@img/sharp-linux-x64":"0.35.5","@img/sharp-linuxmusl-arm64":"0.35.5","@img/sharp-linuxmusl-x64":"0.35.5","@img/sharp-webcontainers-wasm32":"0.35.5","@img/sharp-win32-arm64":"0.35.5","@img/sharp-win32-ia32":"0.35.5","@img/sharp-win32-x64":"0.35.5"},peerDependenciesMeta:{"@types/node":{optional:!0}},devDependencies:{"@biomejs/biome":"^2.5.14","@cpplint/cli":"^0.1.0","@emnapi/runtime":"^1.11.3","@img/sharp-libvips-dev":"1.3.4","@img/sharp-libvips-dev-wasm32":"1.3.4","@img/sharp-libvips-win32-arm64":"1.3.4","@img/sharp-libvips-win32-ia32":"1.3.4","@img/sharp-libvips-win32-x64":"1.3.4","@types/node":"*",emnapi:"^1.11.3","exif-reader":"^2.0.3",icc:"^4.0.0","node-addon-api":"^8.9.2","node-gyp":"^12.4.0",publint:"^0.3.24","tar-fs":"^3.1.3",tsd:"^0.33.0",yauzl:"^3.4.0"},license:"Apache-2.0",engines:{node:">=20.9.0"},config:{libvips:">=8.18.7"},funding:{url:"https://opencollective.com/libvips"}}});import{spawnSync as Ul}from"node:child_process";import{createHash as W5}from"node:crypto";var zl,Sh,B5,eE,H5,Eh,U5=(e)=>{if(e instanceof Error)console.error(`sharp: Installation error: ${e.message}`);else console.log(`sharp: ${e}`)},tE=()=>Sh.default.isNonGlibcLinuxSync()?Sh.default.familySync():"",z5=()=>`${process.platform}${tE()}-${process.arch}`,ha=()=>{if(rE())return"wasm32";let{npm_config_arch:e,npm_config_platform:t,npm_config_libc:r}=process.env,n=typeof r==="string"?r:tE();return`${t||process.platform}${n}-${e||process.arch}`},G5=()=>{try{return He(`@img/sharp-libvips-dev-${ha()}/include`)}catch{try{return (()=>{throw new Error("Cannot require module "+"@img/sharp-libvips-dev/include");})()}catch{}}return""},K5=()=>{try{return (()=>{throw new Error("Cannot require module "+"@img/sharp-libvips-dev/cplusplus");})()}catch{}return""},Y5=()=>{try{return He(`@img/sharp-libvips-dev-${ha()}/lib`)}catch{try{return He(`@img/sharp-libvips-${ha()}/lib`)}catch{}}return""},X5=()=>{if(process.release?.name==="node"&&process.versions){if(!zl.default.satisfies(process.versions.node,As.engines.node))return{found:process.versions.node,expected:As.engines.node}}},rE=()=>{let{CC:e}=process.env;return Boolean(e?.endsWith("/emcc"))},Z5=()=>{if(process.platform==="darwin"&&process.arch==="x64")return(Ul("sysctl sysctl.proc_translated",Eh).stdout||"").trim()==="sysctl.proc_translated: 1";return!1},QS=(e)=>W5("sha512").update(e).digest("hex"),Q5=()=>{try{let e=QS(`imgsharp-libvips-${ha()}`),t=zl.default.coerce(As.optionalDependencies[`@img/sharp-libvips-${ha()}`],{includePrerelease:!0}).version;return QS(`${e}npm:${t}`).slice(0,10)}catch{}return""},eq=()=>Ul(`node-gyp rebuild --directory=src ${rE()?"--nodedir=emscripten":""}`,{...Eh,stdio:"inherit"}).status,nE=()=>{if(process.platform!=="win32")return(Ul("pkg-config --modversion vips-cpp",{...Eh,env:{...process.env,PKG_CONFIG_PATH:sE()}}).stdout||"").trim();else return""},tq=()=>{try{let e=(Ul("brew",["--prefix"],{encoding:"utf8"}).stdout||"").trim();if(e)return`${e}/lib/pkgconfig`}catch(e){}return},rq=()=>{try{let e=(Ul("pkg-config",["--variable","pc_path","pkg-config"],{encoding:"utf8"}).stdout||"").trim();if(e)return e}catch(e){}return},sE=()=>{if(process.platform!=="win32")return[tq(),rq(),process.env.PKG_CONFIG_PATH].filter(Boolean).join(":");else return""},vh=(e,t,r)=>{if(r)r(`Detected ${t}, skipping search for globally-installed libvips`);return e},nq=(e)=>{if(Boolean(process.env.SHARP_IGNORE_GLOBAL_LIBVIPS)===!0)return vh(!1,"SHARP_IGNORE_GLOBAL_LIBVIPS",e);if(Boolean(process.env.SHARP_FORCE_GLOBAL_LIBVIPS)===!0)return vh(!0,"SHARP_FORCE_GLOBAL_LIBVIPS",e);if(Z5())return vh(!1,"Rosetta",e);let t=nE();return!!t&&zl.default.gte(t,eE)},Sf;var jh=D(()=>{vf();zl=br(ZS(),1),Sh=br(sf(),1);/*!
389
+ */f={defined:av,object:XD,plainObject:YD,fn:ZD,bool:QD,buffer:eL,typedArray:tL,arrayBuffer:rL,string:nL,number:sL,integer:iL,inRange:oL,inArray:aL,invalidParameterError:lL,nativeError:cL}});var uv=T(function(bse,cv){var lv=()=>process.platform==="linux",gf=null,uL=()=>{if(!gf)if(lv()&&process.report){let e=process.report.excludeNetwork;process.report.excludeNetwork=!0,gf=process.report.getReport(),process.report.excludeNetwork=e}else gf={};return gf};cv.exports={isLinux:lv,getReport:uL}});var dv=T(function(xse,fv){var tn=Ue("fs"),fL=(e)=>{let t=tn.openSync(e,"r"),r=Buffer.alloc(2048),n=tn.readSync(t,r,0,2048,0);return tn.close(t,()=>{}),r.subarray(0,n)},dL=(e)=>new Promise((t,r)=>{tn.open(e,"r",(n,s)=>{if(n)r(n);else{let i=Buffer.alloc(2048);tn.read(s,i,0,2048,0,(o,a)=>{t(i.subarray(0,a)),tn.close(s,()=>{})})}})});fv.exports={LDD_PATH:"/usr/bin/ldd",SELF_PATH:"/proc/self/exe",readFileSync:fL,readFile:dL}});var mv=T(function($se,pv){var pL=(e)=>{if(e.length<64)return null;if(e.readUInt32BE(0)!==2135247942)return null;if(e.readUInt8(4)!==2)return null;if(e.readUInt8(5)!==1)return null;let t=e.readUInt32LE(32),r=e.readUInt16LE(54),n=e.readUInt16LE(56);for(let s=0;s<n;s++){let i=t+s*r;if(e.readUInt32LE(i)===3){let a=e.readUInt32LE(i+8),l=e.readUInt32LE(i+32);return e.subarray(a,a+l).toString().replace(/\0.*$/g,"")}}return null};pv.exports={interpreterPath:pL}});var xf=T(function(wse,Rv){var yf=Ue("child_process"),{isLinux:ha,getReport:gv}=uv(),{LDD_PATH:bf,SELF_PATH:yv,readFile:jh,readFileSync:kh}=dv(),{interpreterPath:bv}=mv(),Dn,Ln,Fn,ri="",xv=()=>{if(!ri)return new Promise((e)=>{yf.exec("getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true",(t,r)=>{ri=t?" ":r,e(ri)})});return ri},$v=()=>{if(!ri)try{ri=yf.execSync("getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true",{encoding:"utf8"})}catch(e){ri=" "}return ri},Ns="glibc",wv=/LIBC[a-z0-9 \-).]*?(\d+\.\d+)/i,uo="musl",mL=(e)=>e.includes("libc.musl-")||e.includes("ld-musl-"),vv=()=>{let e=gv();if(e.header&&e.header.glibcVersionRuntime)return Ns;if(Array.isArray(e.sharedObjects)){if(e.sharedObjects.some(mL))return uo}return null},Sv=(e)=>{let[t,r]=e.split(/[\r\n]+/);if(t&&t.includes(Ns))return Ns;if(r&&r.includes(uo))return uo;return null},Ev=(e)=>{if(e){if(e.includes("/ld-musl-"))return uo;else if(e.includes("/ld-linux-"))return Ns}return null},Pv=(e)=>{if(e=e.toString(),e.includes("musl"))return uo;if(e.includes("GNU C Library"))return Ns;return null},hL=async()=>{if(Ln!==void 0)return Ln;Ln=null;try{let e=await jh(bf);Ln=Pv(e)}catch(e){}return Ln},gL=()=>{if(Ln!==void 0)return Ln;Ln=null;try{let e=kh(bf);Ln=Pv(e)}catch(e){}return Ln},yL=async()=>{if(Dn!==void 0)return Dn;Dn=null;try{let e=await jh(yv),t=bv(e);Dn=Ev(t)}catch(e){}return Dn},bL=()=>{if(Dn!==void 0)return Dn;Dn=null;try{let e=kh(yv),t=bv(e);Dn=Ev(t)}catch(e){}return Dn},jv=async()=>{let e=null;if(ha()){if(e=await yL(),!e){if(e=await hL(),!e)e=vv();if(!e){let t=await xv();e=Sv(t)}}}return e},kv=()=>{let e=null;if(ha()){if(e=bL(),!e){if(e=gL(),!e)e=vv();if(!e){let t=$v();e=Sv(t)}}}return e},xL=async()=>ha()&&await jv()!==Ns,$L=()=>ha()&&kv()!==Ns,wL=async()=>{if(Fn!==void 0)return Fn;Fn=null;try{let t=(await jh(bf)).match(wv);if(t)Fn=t[1]}catch(e){}return Fn},vL=()=>{if(Fn!==void 0)return Fn;Fn=null;try{let t=kh(bf).match(wv);if(t)Fn=t[1]}catch(e){}return Fn},_v=()=>{let e=gv();if(e.header&&e.header.glibcVersionRuntime)return e.header.glibcVersionRuntime;return null},hv=(e)=>e.trim().split(/\s+/)[1],Av=(e)=>{let[t,r,n]=e.split(/[\r\n]+/);if(t&&t.includes(Ns))return hv(t);if(r&&n&&r.includes(uo))return hv(n);return null},SL=async()=>{let e=null;if(ha()){if(e=await wL(),!e)e=_v();if(!e){let t=await xv();e=Av(t)}}return e},EL=()=>{let e=null;if(ha()){if(e=vL(),!e)e=_v();if(!e){let t=$v();e=Av(t)}}return e};Rv.exports={GLIBC:Ns,MUSL:uo,family:jv,familySync:kv,isNonGlibcLinux:xL,isNonGlibcLinuxSync:$L,version:SL,versionSync:EL}});var ga=T(function(vse,Ov){var PL=Number.MAX_SAFE_INTEGER||9007199254740991,jL=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Ov.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:PL,RELEASE_TYPES:jL,SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var Xl=T(function(Sse,Nv){var kL=typeof process==="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};Nv.exports=kL});var ya=T(function(qn,Cv){var{MAX_SAFE_COMPONENT_LENGTH:_h,MAX_SAFE_BUILD_LENGTH:_L,MAX_LENGTH:AL}=ga(),RL=Xl();qn=Cv.exports={};var OL=qn.re=[],NL=qn.safeRe=[],te=qn.src=[],CL=qn.safeSrc=[],re=qn.t={},TL=0,Ah="[a-zA-Z0-9-]",IL=[["\\s",1],["\\d",AL],[Ah,_L]],JL=(e)=>{for(let[t,r]of IL)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},Se=(e,t,r)=>{let n=JL(t),s=TL++;RL(e,s,t),re[e]=s,te[s]=t,CL[s]=n,OL[s]=new RegExp(t,r?"g":void 0),NL[s]=new RegExp(n,r?"g":void 0)};Se("NUMERICIDENTIFIER","0|[1-9]\\d*");Se("NUMERICIDENTIFIERLOOSE","\\d+");Se("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Ah}*`);Se("MAINVERSION",`(${te[re.NUMERICIDENTIFIER]})\\.(${te[re.NUMERICIDENTIFIER]})\\.(${te[re.NUMERICIDENTIFIER]})`);Se("MAINVERSIONLOOSE",`(${te[re.NUMERICIDENTIFIERLOOSE]})\\.(${te[re.NUMERICIDENTIFIERLOOSE]})\\.(${te[re.NUMERICIDENTIFIERLOOSE]})`);Se("PRERELEASEIDENTIFIER",`(?:${te[re.NONNUMERICIDENTIFIER]}|${te[re.NUMERICIDENTIFIER]})`);Se("PRERELEASEIDENTIFIERLOOSE",`(?:${te[re.NONNUMERICIDENTIFIER]}|${te[re.NUMERICIDENTIFIERLOOSE]})`);Se("PRERELEASE",`(?:-(${te[re.PRERELEASEIDENTIFIER]}(?:\\.${te[re.PRERELEASEIDENTIFIER]})*))`);Se("PRERELEASELOOSE",`(?:-?(${te[re.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${te[re.PRERELEASEIDENTIFIERLOOSE]})*))`);Se("BUILDIDENTIFIER",`${Ah}+`);Se("BUILD",`(?:\\+(${te[re.BUILDIDENTIFIER]}(?:\\.${te[re.BUILDIDENTIFIER]})*))`);Se("FULLPLAIN",`v?${te[re.MAINVERSION]}${te[re.PRERELEASE]}?${te[re.BUILD]}?`);Se("FULL",`^${te[re.FULLPLAIN]}$`);Se("LOOSEPLAIN",`[v=\\s]*${te[re.MAINVERSIONLOOSE]}${te[re.PRERELEASELOOSE]}?${te[re.BUILD]}?`);Se("LOOSE",`^${te[re.LOOSEPLAIN]}$`);Se("GTLT","((?:<|>)?=?)");Se("XRANGEIDENTIFIERLOOSE",`${te[re.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);Se("XRANGEIDENTIFIER",`${te[re.NUMERICIDENTIFIER]}|x|X|\\*`);Se("XRANGEPLAIN",`[v=\\s]*(${te[re.XRANGEIDENTIFIER]})(?:\\.(${te[re.XRANGEIDENTIFIER]})(?:\\.(${te[re.XRANGEIDENTIFIER]})(?:${te[re.PRERELEASE]})?${te[re.BUILD]}?)?)?`);Se("XRANGEPLAINLOOSE",`[v=\\s]*(${te[re.XRANGEIDENTIFIERLOOSE]})(?:\\.(${te[re.XRANGEIDENTIFIERLOOSE]})(?:\\.(${te[re.XRANGEIDENTIFIERLOOSE]})(?:${te[re.PRERELEASELOOSE]})?${te[re.BUILD]}?)?)?`);Se("XRANGE",`^${te[re.GTLT]}\\s*${te[re.XRANGEPLAIN]}$`);Se("XRANGELOOSE",`^${te[re.GTLT]}\\s*${te[re.XRANGEPLAINLOOSE]}$`);Se("COERCEPLAIN",`(^|[^\\d])(\\d{1,${_h}})(?:\\.(\\d{1,${_h}}))?(?:\\.(\\d{1,${_h}}))?`);Se("COERCE",`${te[re.COERCEPLAIN]}(?:$|[^\\d])`);Se("COERCEFULL",te[re.COERCEPLAIN]+`(?:${te[re.PRERELEASE]})?(?:${te[re.BUILD]})?(?:$|[^\\d])`);Se("COERCERTL",te[re.COERCE],!0);Se("COERCERTLFULL",te[re.COERCEFULL],!0);Se("LONETILDE","(?:~>?)");Se("TILDETRIM",`(\\s*)${te[re.LONETILDE]}\\s+`,!0);qn.tildeTrimReplace="$1~";Se("TILDE",`^${te[re.LONETILDE]}${te[re.XRANGEPLAIN]}$`);Se("TILDELOOSE",`^${te[re.LONETILDE]}${te[re.XRANGEPLAINLOOSE]}$`);Se("LONECARET","(?:\\^)");Se("CARETTRIM",`(\\s*)${te[re.LONECARET]}\\s+`,!0);qn.caretTrimReplace="$1^";Se("CARET",`^${te[re.LONECARET]}${te[re.XRANGEPLAIN]}$`);Se("CARETLOOSE",`^${te[re.LONECARET]}${te[re.XRANGEPLAINLOOSE]}$`);Se("COMPARATORLOOSE",`^${te[re.GTLT]}\\s*(${te[re.LOOSEPLAIN]})$|^$`);Se("COMPARATOR",`^${te[re.GTLT]}\\s*(${te[re.FULLPLAIN]})$|^$`);Se("COMPARATORTRIM",`(\\s*)${te[re.GTLT]}\\s*(${te[re.LOOSEPLAIN]}|${te[re.XRANGEPLAIN]})`,!0);qn.comparatorTrimReplace="$1$2$3";Se("HYPHENRANGE",`^\\s*(${te[re.XRANGEPLAIN]})\\s+-\\s+(${te[re.XRANGEPLAIN]})\\s*$`);Se("HYPHENRANGELOOSE",`^\\s*(${te[re.XRANGEPLAINLOOSE]})\\s+-\\s+(${te[re.XRANGEPLAINLOOSE]})\\s*$`);Se("STAR","(<|>)?=?\\s*\\*");Se("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");Se("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var $f=T(function(Ese,Tv){var ML=Object.freeze({loose:!0}),DL=Object.freeze({}),LL=(e)=>{if(!e)return DL;if(typeof e!=="object")return ML;return e};Tv.exports=LL});var Rh=T(function(Pse,Mv){var Iv=/^[0-9]+$/,Jv=(e,t)=>{if(typeof e==="number"&&typeof t==="number")return e===t?0:e<t?-1:1;let r=Iv.test(e),n=Iv.test(t);if(r&&n)e=+e,t=+t;return e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1},FL=(e,t)=>Jv(t,e);Mv.exports={compareIdentifiers:Jv,rcompareIdentifiers:FL}});var zt=T(function(jse,Lv){var wf=Xl(),{MAX_LENGTH:Dv,MAX_SAFE_INTEGER:vf}=ga(),{safeRe:Sf,t:Ef}=ya(),qL=$f(),{compareIdentifiers:Oh}=Rh(),VL=(e,t)=>{let r=t.split(".");if(r.length>e.length)return!1;for(let n=0;n<r.length;n++)if(Oh(e[n],r[n])!==0)return!1;return!0};class wn{constructor(e,t){if(t=qL(t),e instanceof wn)if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;else e=e.version;else if(typeof e!=="string")throw TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>Dv)throw TypeError(`version is longer than ${Dv} characters`);wf("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let r=e.trim().match(t.loose?Sf[Ef.LOOSE]:Sf[Ef.FULL]);if(!r)throw TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>vf||this.major<0)throw TypeError("Invalid major version");if(this.minor>vf||this.minor<0)throw TypeError("Invalid minor version");if(this.patch>vf||this.patch<0)throw TypeError("Invalid patch version");if(!r[4])this.prerelease=[];else this.prerelease=r[4].split(".").map((n)=>{if(/^[0-9]+$/.test(n)){let s=+n;if(s>=0&&s<vf)return s}return n});this.build=r[5]?r[5].split("."):[],this.format()}format(){if(this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length)this.version+=`-${this.prerelease.join(".")}`;return this.version}toString(){return this.version}compare(e){if(wf("SemVer.compare",this.version,this.options,e),!(e instanceof wn)){if(typeof e==="string"&&e===this.version)return 0;e=new wn(e,this.options)}if(e.version===this.version)return 0;return this.compareMain(e)||this.comparePre(e)}compareMain(e){if(!(e instanceof wn))e=new wn(e,this.options);if(this.major<e.major)return-1;if(this.major>e.major)return 1;if(this.minor<e.minor)return-1;if(this.minor>e.minor)return 1;if(this.patch<e.patch)return-1;if(this.patch>e.patch)return 1;return 0}comparePre(e){if(!(e instanceof wn))e=new wn(e,this.options);if(this.prerelease.length&&!e.prerelease.length)return-1;else if(!this.prerelease.length&&e.prerelease.length)return 1;else if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{let r=this.prerelease[t],n=e.prerelease[t];if(wf("prerelease compare",t,r,n),r===void 0&&n===void 0)return 0;else if(n===void 0)return 1;else if(r===void 0)return-1;else if(r===n)continue;else return Oh(r,n)}while(++t)}compareBuild(e){if(!(e instanceof wn))e=new wn(e,this.options);let t=0;do{let r=this.build[t],n=e.build[t];if(wf("build compare",t,r,n),r===void 0&&n===void 0)return 0;else if(n===void 0)return 1;else if(r===void 0)return-1;else if(r===n)continue;else return Oh(r,n)}while(++t)}inc(e,t,r){if(e.startsWith("pre")){if(!t&&r===!1)throw Error("invalid increment argument: identifier is empty");if(t){let n=`-${t}`.match(this.options.loose?Sf[Ef.PRERELEASELOOSE]:Sf[Ef.PRERELEASE]);if(!n||n[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,r),this.inc("pre",t,r);break;case"prerelease":if(this.prerelease.length===0)this.inc("patch",t,r);this.inc("pre",t,r);break;case"release":if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":if(this.minor!==0||this.patch!==0||this.prerelease.length===0)this.major++;this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":if(this.patch!==0||this.prerelease.length===0)this.minor++;this.patch=0,this.prerelease=[];break;case"patch":if(this.prerelease.length===0)this.patch++;this.prerelease=[];break;case"pre":{let n=Number(r)?1:0;if(this.prerelease.length===0)this.prerelease=[n];else{let s=this.prerelease.length;while(--s>=0)if(typeof this.prerelease[s]==="number")this.prerelease[s]++,s=-2;if(s===-1){if(t===this.prerelease.join(".")&&r===!1)throw Error("invalid increment argument: identifier already exists");this.prerelease.push(n)}}if(t){let s=[t,n];if(r===!1)s=[t];if(VL(this.prerelease,t)){let i=this.prerelease[t.split(".").length];if(isNaN(i))this.prerelease=s}else this.prerelease=s}break}default:throw Error(`invalid increment argument: ${e}`)}if(this.raw=this.format(),this.build.length)this.raw+=`+${this.build.join(".")}`;return this}}Lv.exports=wn});var ni=T(function(kse,qv){var Fv=zt(),BL=(e,t,r=!1)=>{if(e instanceof Fv)return e;try{return new Fv(e,t)}catch(n){if(!r)return null;throw n}};qv.exports=BL});var Bv=T(function(_se,Vv){var WL=ni(),UL=(e,t)=>{let r=WL(e,t);return r?r.version:null};Vv.exports=UL});var Uv=T(function(Ase,Wv){var HL=ni(),zL=(e,t)=>{let r=HL(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};Wv.exports=zL});var Gv=T(function(Rse,zv){var Hv=zt(),GL=(e,t,r,n,s)=>{if(typeof r==="string")s=n,n=r,r=void 0;try{return new Hv(e instanceof Hv?e.version:e,r).inc(t,n,s).version}catch(i){return null}};zv.exports=GL});var Yv=T(function(Ose,Xv){var Kv=ni(),KL=(e,t)=>{let r=Kv(e,null,!0),n=Kv(t,null,!0),s=r.compare(n);if(s===0)return null;let i=s>0,o=i?r:n,a=i?n:r,l=!!o.prerelease.length;if(!!a.prerelease.length&&!l){if(!a.patch&&!a.minor)return"major";if(a.compareMain(o)===0){if(a.minor&&!a.patch)return"minor";return"patch"}}let u=l?"pre":"";if(r.major!==n.major)return u+"major";if(r.minor!==n.minor)return u+"minor";if(r.patch!==n.patch)return u+"patch";return"prerelease"};Xv.exports=KL});var Qv=T(function(Nse,Zv){var XL=zt(),YL=(e,t)=>new XL(e,t).major;Zv.exports=YL});var tS=T(function(Cse,eS){var ZL=zt(),QL=(e,t)=>new ZL(e,t).minor;eS.exports=QL});var nS=T(function(Tse,rS){var eF=zt(),tF=(e,t)=>new eF(e,t).patch;rS.exports=tF});var iS=T(function(Ise,sS){var rF=ni(),nF=(e,t)=>{let r=rF(e,t);return r&&r.prerelease.length?r.prerelease:null};sS.exports=nF});var rn=T(function(Jse,aS){var oS=zt(),sF=(e,t,r)=>new oS(e,r).compare(new oS(t,r));aS.exports=sF});var cS=T(function(Mse,lS){var iF=rn(),oF=(e,t,r)=>iF(t,e,r);lS.exports=oF});var fS=T(function(Dse,uS){var aF=rn(),lF=(e,t)=>aF(e,t,!0);uS.exports=lF});var Pf=T(function(Lse,pS){var dS=zt(),cF=(e,t,r)=>{let n=new dS(e,r),s=new dS(t,r);return n.compare(s)||n.compareBuild(s)};pS.exports=cF});var hS=T(function(Fse,mS){var uF=Pf(),fF=(e,t)=>e.sort((r,n)=>uF(r,n,t));mS.exports=fF});var yS=T(function(qse,gS){var dF=Pf(),pF=(e,t)=>e.sort((r,n)=>dF(n,r,t));gS.exports=pF});var Yl=T(function(Vse,bS){var mF=rn(),hF=(e,t,r)=>mF(e,t,r)>0;bS.exports=hF});var jf=T(function(Bse,xS){var gF=rn(),yF=(e,t,r)=>gF(e,t,r)<0;xS.exports=yF});var Nh=T(function(Wse,$S){var bF=rn(),xF=(e,t,r)=>bF(e,t,r)===0;$S.exports=xF});var Ch=T(function(Use,wS){var $F=rn(),wF=(e,t,r)=>$F(e,t,r)!==0;wS.exports=wF});var kf=T(function(Hse,vS){var vF=rn(),SF=(e,t,r)=>vF(e,t,r)>=0;vS.exports=SF});var _f=T(function(zse,SS){var EF=rn(),PF=(e,t,r)=>EF(e,t,r)<=0;SS.exports=PF});var Th=T(function(Gse,ES){var jF=Nh(),kF=Ch(),_F=Yl(),AF=kf(),RF=jf(),OF=_f(),NF=(e,t,r,n)=>{switch(t){case"===":if(typeof e==="object")e=e.version;if(typeof r==="object")r=r.version;return e===r;case"!==":if(typeof e==="object")e=e.version;if(typeof r==="object")r=r.version;return e!==r;case"":case"=":case"==":return jF(e,r,n);case"!=":return kF(e,r,n);case">":return _F(e,r,n);case">=":return AF(e,r,n);case"<":return RF(e,r,n);case"<=":return OF(e,r,n);default:throw TypeError(`Invalid operator: ${t}`)}};ES.exports=NF});var jS=T(function(Kse,PS){var CF=zt(),TF=ni(),{safeRe:Af,t:Rf}=ya(),IF=(e,t)=>{if(e instanceof CF)return e;if(typeof e==="number")e=String(e);if(typeof e!=="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?Af[Rf.COERCEFULL]:Af[Rf.COERCE]);else{let l=t.includePrerelease?Af[Rf.COERCERTLFULL]:Af[Rf.COERCERTL],c;while((c=l.exec(e))&&(!r||r.index+r[0].length!==e.length)){if(!r||c.index+c[0].length!==r.index+r[0].length)r=c;l.lastIndex=c.index+c[1].length+c[2].length}l.lastIndex=-1}if(r===null)return null;let n=r[2],s=r[3]||"0",i=r[4]||"0",o=t.includePrerelease&&r[5]?`-${r[5]}`:"",a=t.includePrerelease&&r[6]?`+${r[6]}`:"";return TF(`${n}.${s}.${i}${o}${a}`,t)};PS.exports=IF});var AS=T(function(Xse,_S){var JF=ni(),kS=ga(),MF=zt(),DF=(e,t,r)=>{if(!kS.RELEASE_TYPES.includes(t))return null;let n=LF(e,r);return n&&FF(n,t)},LF=(e,t)=>{let r=e instanceof MF?e.version:e;return JF(r,t)},FF=(e,t)=>{if(qF(t))return e.version;switch(e.prerelease=[],t){case"major":e.minor=0,e.patch=0;break;case"minor":e.patch=0;break}return e.format()},qF=(e)=>e.startsWith("pre");_S.exports=DF});var NS=T(function(Yse,OS){class RS{constructor(){this.max=1000,this.map=new Map}get(e){let t=this.map.get(e);if(t===void 0)return;else return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&t!==void 0){if(this.map.size>=this.max){let n=this.map.keys().next().value;this.delete(n)}this.map.set(e,t)}return this}}OS.exports=RS});var nn=T(function(Zse,JS){var VF=/\s+/g;class Zl{constructor(e,t){if(t=WF(t),e instanceof Zl)if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;else return new Zl(e.raw,t);if(e instanceof Of)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().replace(VF," "),this.set=this.raw.split("||").map((r)=>this.parseRange(r.trim())).filter((r)=>r.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let r=this.set[0];if(this.set=this.set.filter((n)=>!TS(n[0])),this.set.length===0)this.set=[r];else if(this.set.length>1){for(let n of this.set)if(n.length===1&&QF(n[0])){this.set=[n];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){if(e>0)this.formatted+="||";let t=this.set[e];for(let r=0;r<t.length;r++){if(r>0)this.formatted+=" ";this.formatted+=t[r].toString().trim()}}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){e=e.replace(ZF,"");let r=((this.options.includePrerelease&&XF)|(this.options.loose&&YF))+":"+e,n=CS.get(r);if(n)return n;let s=this.options.loose,i=s?mr[Gt.HYPHENRANGELOOSE]:mr[Gt.HYPHENRANGE];e=e.replace(i,u5(this.options.includePrerelease)),st("hyphen replace",e),e=e.replace(mr[Gt.COMPARATORTRIM],zF),st("comparator trim",e),e=e.replace(mr[Gt.TILDETRIM],GF),st("tilde trim",e),e=e.replace(mr[Gt.CARETTRIM],KF),st("caret trim",e);let o=e.split(" ").map((u)=>e5(u,this.options)).join(" ").split(/\s+/).map((u)=>c5(u,this.options));if(s)o=o.filter((u)=>(st("loose invalid filter",u,this.options),!!u.match(mr[Gt.COMPARATORLOOSE])));st("range list",o);let a=new Map,l=o.map((u)=>new Of(u,this.options));for(let u of l){if(TS(u))return[u];a.set(u.value,u)}if(a.size>1&&a.has(""))a.delete("");let c=[...a.values()];return CS.set(r,c),c}intersects(e,t){if(!(e instanceof Zl))throw TypeError("a Range is required");return this.set.some((r)=>IS(r,t)&&e.set.some((n)=>IS(n,t)&&r.every((s)=>n.every((i)=>s.intersects(i,t)))))}test(e){if(!e)return!1;if(typeof e==="string")try{e=new UF(e,this.options)}catch(t){return!1}for(let t=0;t<this.set.length;t++)if(f5(this.set[t],e,this.options))return!0;return!1}}JS.exports=Zl;var BF=NS(),CS=new BF,WF=$f(),Of=Ql(),st=Xl(),UF=zt(),{safeRe:mr,src:HF,t:Gt,comparatorTrimReplace:zF,tildeTrimReplace:GF,caretTrimReplace:KF}=ya(),{FLAG_INCLUDE_PRERELEASE:XF,FLAG_LOOSE:YF}=ga(),ZF=new RegExp(HF[Gt.BUILD],"g"),TS=(e)=>e.value==="<0.0.0-0",QF=(e)=>e.value==="",IS=(e,t)=>{let r=!0,n=e.slice(),s=n.pop();while(r&&n.length)r=n.every((i)=>s.intersects(i,t)),s=n.pop();return r},e5=(e,t)=>(e=e.replace(mr[Gt.BUILD],""),st("comp",e,t),e=s5(e,t),st("caret",e),e=r5(e,t),st("tildes",e),e=o5(e,t),st("xrange",e),e=l5(e,t),st("stars",e),e),It=(e)=>!e||e.toLowerCase()==="x"||e==="*",t5=(e,t,r)=>It(e)&&!It(t)||It(t)&&r&&!It(r),r5=(e,t)=>e.trim().split(/\s+/).map((r)=>n5(r,t)).join(" "),n5=(e,t)=>{let r=t.loose?mr[Gt.TILDELOOSE]:mr[Gt.TILDE],n=t.includePrerelease?"-0":"";return e.replace(r,(s,i,o,a,l)=>{st("tilde",e,s,i,o,a,l);let c;if(It(i))c="";else if(It(o))c=`>=${i}.0.0${n} <${+i+1}.0.0-0`;else if(It(a))c=`>=${i}.${o}.0${n} <${i}.${+o+1}.0-0`;else if(l)st("replaceTilde pr",l),c=`>=${i}.${o}.${a}-${l} <${i}.${+o+1}.0-0`;else c=`>=${i}.${o}.${a} <${i}.${+o+1}.0-0`;return st("tilde return",c),c})},s5=(e,t)=>e.trim().split(/\s+/).map((r)=>i5(r,t)).join(" "),i5=(e,t)=>{st("caret",e,t);let r=t.loose?mr[Gt.CARETLOOSE]:mr[Gt.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(s,i,o,a,l)=>{st("caret",e,s,i,o,a,l);let c;if(It(i))c="";else if(It(o))c=`>=${i}.0.0${n} <${+i+1}.0.0-0`;else if(It(a))if(i==="0")c=`>=${i}.${o}.0${n} <${i}.${+o+1}.0-0`;else c=`>=${i}.${o}.0${n} <${+i+1}.0.0-0`;else if(l)if(st("replaceCaret pr",l),i==="0")if(o==="0")c=`>=${i}.${o}.${a}-${l} <${i}.${o}.${+a+1}-0`;else c=`>=${i}.${o}.${a}-${l} <${i}.${+o+1}.0-0`;else c=`>=${i}.${o}.${a}-${l} <${+i+1}.0.0-0`;else if(st("no pr"),i==="0")if(o==="0")c=`>=${i}.${o}.${a} <${i}.${o}.${+a+1}-0`;else c=`>=${i}.${o}.${a} <${i}.${+o+1}.0-0`;else c=`>=${i}.${o}.${a} <${+i+1}.0.0-0`;return st("caret return",c),c})},o5=(e,t)=>(st("replaceXRanges",e,t),e.split(/\s+/).map((r)=>a5(r,t)).join(" ")),a5=(e,t)=>{e=e.trim();let r=t.loose?mr[Gt.XRANGELOOSE]:mr[Gt.XRANGE];return e.replace(r,(n,s,i,o,a,l)=>{if(st("xRange",e,n,s,i,o,a,l),t5(i,o,a))return e;let c=It(i),u=c||It(o),p=u||It(a),h=p;if(s==="="&&h)s="";if(l=t.includePrerelease?"-0":"",c)if(s===">"||s==="<")n="<0.0.0-0";else n="*";else if(s&&h){if(u)o=0;if(a=0,s===">")if(s=">=",u)i=+i+1,o=0,a=0;else o=+o+1,a=0;else if(s==="<=")if(s="<",u)i=+i+1;else o=+o+1;if(s==="<")l="-0";n=`${s+i}.${o}.${a}${l}`}else if(u)n=`>=${i}.0.0${l} <${+i+1}.0.0-0`;else if(p)n=`>=${i}.${o}.0${l} <${i}.${+o+1}.0-0`;return st("xRange return",n),n})},l5=(e,t)=>(st("replaceStars",e,t),e.trim().replace(mr[Gt.STAR],"")),c5=(e,t)=>(st("replaceGTE0",e,t),e.trim().replace(mr[t.includePrerelease?Gt.GTE0PRE:Gt.GTE0],"")),u5=(e)=>(t,r,n,s,i,o,a,l,c,u,p,h)=>{if(It(n))r="";else if(It(s))r=`>=${n}.0.0${e?"-0":""}`;else if(It(i))r=`>=${n}.${s}.0${e?"-0":""}`;else if(o)r=`>=${r}`;else r=`>=${r}${e?"-0":""}`;if(It(c))l="";else if(It(u))l=`<${+c+1}.0.0-0`;else if(It(p))l=`<${c}.${+u+1}.0-0`;else if(h)l=`<=${c}.${u}.${p}-${h}`;else if(e)l=`<${c}.${u}.${+p+1}-0`;else l=`<=${l}`;return`${r} ${l}`.trim()},f5=(e,t,r)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let n=0;n<e.length;n++){if(st(e[n].semver),e[n].semver===Of.ANY)continue;if(e[n].semver.prerelease.length>0){let s=e[n].semver;if(s.major===t.major&&s.minor===t.minor&&s.patch===t.patch)return!0}}return!1}return!0}});var Ql=T(function(Qse,VS){var ec=Symbol("SemVer ANY");class Nf{static get ANY(){return ec}constructor(e,t){if(t=MS(t),e instanceof Nf)if(e.loose===!!t.loose)return e;else e=e.value;if(e=e.trim().split(/\s+/).join(" "),Jh("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===ec)this.value="";else this.value=this.operator+this.semver.version;Jh("comp",this)}parse(e){let t=this.options.loose?DS[LS.COMPARATORLOOSE]:DS[LS.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);if(this.operator=r[1]!==void 0?r[1]:"",this.operator==="=")this.operator="";if(!r[2])this.semver=ec;else this.semver=new FS(r[2],this.options.loose)}toString(){return this.value}test(e){if(Jh("Comparator.test",e,this.options.loose),this.semver===ec||e===ec)return!0;if(typeof e==="string")try{e=new FS(e,this.options)}catch(t){return!1}return Ih(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof Nf))throw TypeError("a Comparator is required");if(this.operator===""){if(this.value==="")return!0;return new qS(e.value,t).test(this.value)}else if(e.operator===""){if(e.value==="")return!0;return new qS(this.value,t).test(e.semver)}if(t=MS(t),t.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0"))return!1;if(!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0")))return!1;if(this.operator.startsWith(">")&&e.operator.startsWith(">"))return!0;if(this.operator.startsWith("<")&&e.operator.startsWith("<"))return!0;if(this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("="))return!0;if(Ih(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))return!0;if(Ih(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">"))return!0;return!1}}VS.exports=Nf;var MS=$f(),{safeRe:DS,t:LS}=ya(),Ih=Th(),Jh=Xl(),FS=zt(),qS=nn()});var tc=T(function(eie,BS){var d5=nn(),p5=(e,t,r)=>{try{t=new d5(t,r)}catch(n){return!1}return t.test(e)};BS.exports=p5});var US=T(function(tie,WS){var m5=nn(),h5=(e,t)=>new m5(e,t).set.map((r)=>r.map((n)=>n.value).join(" ").trim().split(" "));WS.exports=h5});var zS=T(function(rie,HS){var g5=zt(),y5=nn(),b5=(e,t,r)=>{let n=null,s=null,i=null;try{i=new y5(t,r)}catch(o){return null}return e.forEach((o)=>{if(i.test(o)){if(!n||s.compare(o)===-1)n=o,s=new g5(n,r)}}),n};HS.exports=b5});var KS=T(function(nie,GS){var x5=zt(),$5=nn(),w5=(e,t,r)=>{let n=null,s=null,i=null;try{i=new $5(t,r)}catch(o){return null}return e.forEach((o)=>{if(i.test(o)){if(!n||s.compare(o)===1)n=o,s=new x5(n,r)}}),n};GS.exports=w5});var ZS=T(function(sie,YS){var Mh=zt(),v5=nn(),XS=Yl(),S5=(e,t)=>{e=new v5(e,t);let r=new Mh("0.0.0");if(e.test(r))return r;if(r=new Mh("0.0.0-0"),e.test(r))return r;r=null;for(let n=0;n<e.set.length;++n){let s=e.set[n],i=null;if(s.forEach((o)=>{let a=new Mh(o.semver.version);switch(o.operator){case">":if(a.prerelease.length===0)a.patch++;else a.prerelease.push(0);a.raw=a.format();case"":case">=":if(!i||XS(a,i))i=a;break;case"<":case"<=":break;default:throw Error(`Unexpected operation: ${o.operator}`)}}),i&&(!r||XS(r,i)))r=i}if(r&&e.test(r))return r;return null};YS.exports=S5});var eE=T(function(iie,QS){var E5=nn(),P5=(e,t)=>{try{return new E5(e,t).range||"*"}catch(r){return null}};QS.exports=P5});var Cf=T(function(oie,sE){var j5=zt(),nE=Ql(),{ANY:k5}=nE,_5=nn(),A5=tc(),tE=Yl(),rE=jf(),R5=_f(),O5=kf(),N5=(e,t,r,n)=>{e=new j5(e,n),t=new _5(t,n);let s,i,o,a,l;switch(r){case">":s=tE,i=R5,o=rE,a=">",l=">=";break;case"<":s=rE,i=O5,o=tE,a="<",l="<=";break;default:throw TypeError('Must provide a hilo val of "<" or ">"')}if(A5(e,t,n))return!1;for(let c=0;c<t.set.length;++c){let u=t.set[c],p=null,h=null;if(u.forEach((m)=>{if(m.semver===k5)m=new nE(">=0.0.0");if(p=p||m,h=h||m,s(m.semver,p.semver,n))p=m;else if(o(m.semver,h.semver,n))h=m}),p.operator===a||p.operator===l)return!1;if((!h.operator||h.operator===a)&&i(e,h.semver))return!1;else if(h.operator===l&&o(e,h.semver))return!1}return!0};sE.exports=N5});var oE=T(function(aie,iE){var C5=Cf(),T5=(e,t,r)=>C5(e,t,">",r);iE.exports=T5});var lE=T(function(lie,aE){var I5=Cf(),J5=(e,t,r)=>I5(e,t,"<",r);aE.exports=J5});var fE=T(function(cie,uE){var cE=nn(),M5=(e,t,r)=>(e=new cE(e,r),t=new cE(t,r),e.intersects(t,r));uE.exports=M5});var pE=T(function(uie,dE){var D5=tc(),L5=rn();dE.exports=(e,t,r)=>{let n=[],s=null,i=null,o=e.sort((u,p)=>L5(u,p,r));for(let u of o)if(D5(u,t,r)){if(i=u,!s)s=u}else{if(i)n.push([s,i]);i=null,s=null}if(s)n.push([s,null]);let a=[];for(let[u,p]of n)if(u===p)a.push(u);else if(!p&&u===o[0])a.push("*");else if(!p)a.push(`>=${u}`);else if(u===o[0])a.push(`<=${p}`);else a.push(`${u} - ${p}`);let l=a.join(" || "),c=typeof t.raw==="string"?t.raw:String(t);return l.length<c.length?l:t}});var xE=T(function(fie,bE){var mE=nn(),Fh=Ql(),{ANY:Dh}=Fh,Lh=tc(),qh=rn(),F5=(e,t,r={})=>{if(e===t)return!0;e=new mE(e,r),t=new mE(t,r);let n=!1;e:for(let s of e.set){for(let i of t.set){let o=V5(s,i,r);if(n=n||o!==null,o)continue e}if(n)return!1}return!0},q5=[new Fh(">=0.0.0-0")],hE=[new Fh(">=0.0.0")],V5=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===Dh)if(t.length===1&&t[0].semver===Dh)return!0;else if(r.includePrerelease)e=q5;else e=hE;if(t.length===1&&t[0].semver===Dh)if(r.includePrerelease)return!0;else t=hE;let n=new Set,s,i;for(let m of e)if(m.operator===">"||m.operator===">=")s=gE(s,m,r);else if(m.operator==="<"||m.operator==="<=")i=yE(i,m,r);else n.add(m.semver);if(n.size>1)return null;let o;if(s&&i){if(o=qh(s.semver,i.semver,r),o>0)return null;else if(o===0&&(s.operator!==">="||i.operator!=="<="))return null}for(let m of n){if(s&&!Lh(m,String(s),r))return null;if(i&&!Lh(m,String(i),r))return null;for(let y of t)if(!Lh(m,String(y),r))return!1;return!0}let a,l,c,u,p=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1,h=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1;if(p&&p.prerelease.length===1&&i.operator==="<"&&p.prerelease[0]===0)p=!1;for(let m of t){if(u=u||m.operator===">"||m.operator===">=",c=c||m.operator==="<"||m.operator==="<=",s){if(h){if(m.semver.prerelease&&m.semver.prerelease.length&&m.semver.major===h.major&&m.semver.minor===h.minor&&m.semver.patch===h.patch)h=!1}if(m.operator===">"||m.operator===">="){if(a=gE(s,m,r),a===m&&a!==s)return!1}else if(s.operator===">="&&!m.test(s.semver))return!1}if(i){if(p){if(m.semver.prerelease&&m.semver.prerelease.length&&m.semver.major===p.major&&m.semver.minor===p.minor&&m.semver.patch===p.patch)p=!1}if(m.operator==="<"||m.operator==="<="){if(l=yE(i,m,r),l===m&&l!==i)return!1}else if(i.operator==="<="&&!m.test(i.semver))return!1}if(!m.operator&&(i||s)&&o!==0)return!1}if(s&&c&&!i&&o!==0)return!1;if(i&&u&&!s&&o!==0)return!1;if(h||p)return!1;return!0},gE=(e,t,r)=>{if(!e)return t;let n=qh(e.semver,t.semver,r);return n>0?e:n<0?t:t.operator===">"&&e.operator===">="?t:e},yE=(e,t,r)=>{if(!e)return t;let n=qh(e.semver,t.semver,r);return n<0?e:n>0?t:t.operator==="<"&&e.operator==="<="?t:e};bE.exports=F5});var wE=T(function(die,$E){var ba=ya(),Tf=ga(),B5=zt(),If=Rh(),W5=ni(),U5=Bv(),H5=Uv(),z5=Gv(),G5=Yv(),K5=Qv(),X5=tS(),Y5=nS(),Z5=iS(),Q5=rn(),eq=cS(),tq=fS(),rq=Pf(),nq=hS(),sq=yS(),iq=Yl(),oq=jf(),aq=Nh(),lq=Ch(),cq=kf(),uq=_f(),fq=Th(),dq=jS(),pq=AS(),mq=Ql(),hq=nn(),gq=tc(),yq=US(),bq=zS(),xq=KS(),$q=ZS(),wq=eE(),vq=Cf(),Sq=oE(),Eq=lE(),Pq=fE(),jq=pE(),kq=xE();$E.exports={parse:W5,valid:U5,clean:H5,inc:z5,diff:G5,major:K5,minor:X5,patch:Y5,prerelease:Z5,compare:Q5,rcompare:eq,compareLoose:tq,compareBuild:rq,sort:nq,rsort:sq,gt:iq,lt:oq,eq:aq,neq:lq,gte:cq,lte:uq,cmp:fq,coerce:dq,truncate:pq,Comparator:mq,Range:hq,satisfies:gq,toComparators:yq,maxSatisfying:bq,minSatisfying:xq,minVersion:$q,validRange:wq,outside:vq,gtr:Sq,ltr:Eq,intersects:Pq,simplifyRange:jq,subset:kq,SemVer:B5,re:ba.re,src:ba.src,tokens:ba.t,SEMVER_SPEC_VERSION:Tf.SEMVER_SPEC_VERSION,RELEASE_TYPES:Tf.RELEASE_TYPES,compareIdentifiers:If.compareIdentifiers,rcompareIdentifiers:If.rcompareIdentifiers}});var Cs;var Jf=M(()=>{Cs={name:"sharp",description:"High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, GIF, AVIF and TIFF images",version:"0.35.5",author:"Lovell Fuller <npm@lovell.info>",homepage:"https://sharp.pixelplumbing.com",contributors:["Pierre Inglebert <pierre.inglebert@gmail.com>","Jonathan Ong <jonathanrichardong@gmail.com>","Chanon Sajjamanochai <chanon.s@gmail.com>","Juliano Julio <julianojulio@gmail.com>","Daniel Gasienica <daniel@gasienica.ch>","Julian Walker <julian@fiftythree.com>","Amit Pitaru <pitaru.amit@gmail.com>","Brandon Aaron <hello.brandon@aaron.sh>","Andreas Lind <andreas@one.com>","Maurus Cuelenaere <mcuelenaere@gmail.com>","Linus Unnebäck <linus@folkdatorn.se>","Victor Mateevitsi <mvictoras@gmail.com>","Alaric Holloway <alaric.holloway@gmail.com>","Bernhard K. Weisshuhn <bkw@codingforce.com>","Chris Riley <criley@primedia.com>","David Carley <dacarley@gmail.com>","John Tobin <john@limelightmobileinc.com>","Kenton Gray <kentongray@gmail.com>","Felix Bünemann <Felix.Buenemann@gmail.com>","Samy Al Zahrani <samyalzahrany@gmail.com>","Chintan Thakkar <lemnisk8@gmail.com>","F. Orlando Galashan <frulo@gmx.de>","Kleis Auke Wolthuizen <info@kleisauke.nl>","Matt Hirsch <mhirsch@media.mit.edu>","Matthias Thoemmes <thoemmes@gmail.com>","Patrick Paskaris <patrick@paskaris.gr>","Jérémy Lal <kapouer@melix.org>","Rahul Nanwani <r.nanwani@gmail.com>","Alice Monday <alice0meta@gmail.com>","Kristo Jorgenson <kristo.jorgenson@gmail.com>","YvesBos <yves_bos@outlook.com>","Guy Maliar <guy@tailorbrands.com>","Nicolas Coden <nicolas@ncoden.fr>","Matt Parrish <matt.r.parrish@gmail.com>","Marcel Bretschneider <marcel.bretschneider@gmail.com>","Matthew McEachen <matthew+github@mceachen.org>","Jarda Kotěšovec <jarda.kotesovec@gmail.com>","Kenric D'Souza <kenric.dsouza@gmail.com>","Oleh Aleinyk <oleg.aleynik@gmail.com>","Marcel Bretschneider <marcel.bretschneider@gmail.com>","Andrea Bianco <andrea.bianco@unibas.ch>","Rik Heywood <rik@rik.org>","Thomas Parisot <hi@oncletom.io>","Nathan Graves <nathanrgraves+github@gmail.com>","Tom Lokhorst <tom@lokhorst.eu>","Espen Hovlandsdal <espen@hovlandsdal.com>","Sylvain Dumont <sylvain.dumont35@gmail.com>","Alun Davies <alun.owain.davies@googlemail.com>","Aidan Hoolachan <ajhoolachan21@gmail.com>","Axel Eirola <axel.eirola@iki.fi>","Freezy <freezy@xbmc.org>","Daiz <taneli.vatanen@gmail.com>","Julian Aubourg <j@ubourg.net>","Keith Belovay <keith@picthrive.com>","Michael B. Klein <mbklein@gmail.com>","Jordan Prudhomme <jordan@raboland.fr>","Ilya Ovdin <iovdin@gmail.com>","Andargor <andargor@yahoo.com>","Paul Neave <paul.neave@gmail.com>","Brendan Kennedy <brenwken@gmail.com>","Brychan Bennett-Odlum <git@brychan.io>","Edward Silverton <e.silverton@gmail.com>","Roman Malieiev <aromaleev@gmail.com>","Tomas Szabo <tomas.szabo@deftomat.com>","Robert O'Rourke <robert@o-rourke.org>","Guillermo Alfonso Varela Chouciño <guillevch@gmail.com>","Christian Flintrup <chr@gigahost.dk>","Manan Jadhav <manan@motionden.com>","Leon Radley <leon@radley.se>","alza54 <alza54@thiocod.in>","Jacob Smith <jacob@frende.me>","Michael Nutt <michael@nutt.im>","Brad Parham <baparham@gmail.com>","Taneli Vatanen <taneli.vatanen@gmail.com>","Joris Dugué <zaruike10@gmail.com>","Chris Banks <christopher.bradley.banks@gmail.com>","Ompal Singh <ompal.hitm09@gmail.com>","Brodan <christopher.hranj@gmail.com>","Ankur Parihar <ankur.github@gmail.com>","Brahim Ait elhaj <brahima@gmail.com>","Mart Jansink <m.jansink@gmail.com>","Lachlan Newman <lachnewman007@gmail.com>","Dennis Beatty <dennis@dcbeatty.com>","Ingvar Stepanyan <me@rreverser.com>","Don Denton <don@happycollision.com>","Dmytro Tiapukhin <cool.gegeg@gmail.com>","Florian Lefebvre <contact@florian-lefebvre.dev>"],scripts:{build:"node install/build.js","build:dist":"node scripts/build.mjs",clean:"rm -rf src/build/ test/fixtures/output.*",test:"npm run lint && npm run test-unit",lint:"npm run lint-cpp && npm run lint-js && npm run lint-types && npm run lint-publish","lint-cpp":"cpplint --quiet src/*.h src/*.cc","lint-js":"biome lint","lint-publish":"publint --strict","lint-types":"tsd --files ./test/types/sharp.test-d.{cts,mts}","test-leak":"./test/leak/leak.sh","test-unit":"node --experimental-test-coverage test/unit.mjs","package-from-local-build":"node npm/from-local-build.js","package-wasm-wrappers":"node npm/wasm-wrappers.js","package-release-notes":"node npm/release-notes.js","docs-build":"node docs/build.mjs","docs-serve":"cd docs && npm start","docs-publish":"cd docs && npm run build && npx firebase-tools deploy --project pixelplumbing --only hosting:pixelplumbing-sharp"},type:"commonjs",files:["dist","install","lib/index.d.ts","src/*.{cc,h,gyp}"],main:"./dist/index.cjs",module:"./dist/index.mjs",types:"./dist/index.d.mts",exports:{".":{import:{types:"./dist/index.d.mts",default:"./dist/index.mjs"},require:{types:"./dist/index.d.cts",default:"./dist/index.cjs"}}},sideEffects:!0,repository:{type:"git",url:"git+https://github.com/lovell/sharp.git"},keywords:["jpeg","png","webp","avif","tiff","gif","svg","jp2","dzi","image","resize","thumbnail","crop","embed","libvips","vips"],dependencies:{"@img/colour":"^1.1.0","detect-libc":"^2.1.2",semver:"^7.8.5"},optionalDependencies:{"@img/sharp-darwin-arm64":"0.35.5","@img/sharp-darwin-x64":"0.35.5","@img/sharp-freebsd-wasm32":"0.35.5","@img/sharp-libvips-darwin-arm64":"1.3.4","@img/sharp-libvips-darwin-x64":"1.3.4","@img/sharp-libvips-linux-arm":"1.3.4","@img/sharp-libvips-linux-arm64":"1.3.4","@img/sharp-libvips-linux-ppc64":"1.3.4","@img/sharp-libvips-linux-riscv64":"1.3.4","@img/sharp-libvips-linux-s390x":"1.3.4","@img/sharp-libvips-linux-x64":"1.3.4","@img/sharp-libvips-linuxmusl-arm64":"1.3.4","@img/sharp-libvips-linuxmusl-x64":"1.3.4","@img/sharp-linux-arm":"0.35.5","@img/sharp-linux-arm64":"0.35.5","@img/sharp-linux-ppc64":"0.35.5","@img/sharp-linux-riscv64":"0.35.5","@img/sharp-linux-s390x":"0.35.5","@img/sharp-linux-x64":"0.35.5","@img/sharp-linuxmusl-arm64":"0.35.5","@img/sharp-linuxmusl-x64":"0.35.5","@img/sharp-webcontainers-wasm32":"0.35.5","@img/sharp-win32-arm64":"0.35.5","@img/sharp-win32-ia32":"0.35.5","@img/sharp-win32-x64":"0.35.5"},peerDependenciesMeta:{"@types/node":{optional:!0}},devDependencies:{"@biomejs/biome":"^2.5.14","@cpplint/cli":"^0.1.0","@emnapi/runtime":"^1.11.3","@img/sharp-libvips-dev":"1.3.4","@img/sharp-libvips-dev-wasm32":"1.3.4","@img/sharp-libvips-win32-arm64":"1.3.4","@img/sharp-libvips-win32-ia32":"1.3.4","@img/sharp-libvips-win32-x64":"1.3.4","@types/node":"*",emnapi:"^1.11.3","exif-reader":"^2.0.3",icc:"^4.0.0","node-addon-api":"^8.9.2","node-gyp":"^12.4.0",publint:"^0.3.24","tar-fs":"^3.1.3",tsd:"^0.33.0",yauzl:"^3.4.0"},license:"Apache-2.0",engines:{node:">=20.9.0"},config:{libvips:">=8.18.7"},funding:{url:"https://opencollective.com/libvips"}}});import{spawnSync as rc}from"node:child_process";import{createHash as Aq}from"node:crypto";var nc,Bh,Rq,SE,Oq,Wh,Nq=(e)=>{if(e instanceof Error)console.error(`sharp: Installation error: ${e.message}`);else console.log(`sharp: ${e}`)},EE=()=>Bh.default.isNonGlibcLinuxSync()?Bh.default.familySync():"",Cq=()=>`${process.platform}${EE()}-${process.arch}`,xa=()=>{if(PE())return"wasm32";let{npm_config_arch:e,npm_config_platform:t,npm_config_libc:r}=process.env,n=typeof r==="string"?r:EE();return`${t||process.platform}${n}-${e||process.arch}`},Tq=()=>{try{return Ue(`@img/sharp-libvips-dev-${xa()}/include`)}catch{try{return (()=>{throw new Error("Cannot require module "+"@img/sharp-libvips-dev/include");})()}catch{}}return""},Iq=()=>{try{return (()=>{throw new Error("Cannot require module "+"@img/sharp-libvips-dev/cplusplus");})()}catch{}return""},Jq=()=>{try{return Ue(`@img/sharp-libvips-dev-${xa()}/lib`)}catch{try{return Ue(`@img/sharp-libvips-${xa()}/lib`)}catch{}}return""},Mq=()=>{if(process.release?.name==="node"&&process.versions){if(!nc.default.satisfies(process.versions.node,Cs.engines.node))return{found:process.versions.node,expected:Cs.engines.node}}},PE=()=>{let{CC:e}=process.env;return Boolean(e?.endsWith("/emcc"))},Dq=()=>{if(process.platform==="darwin"&&process.arch==="x64")return(rc("sysctl sysctl.proc_translated",Wh).stdout||"").trim()==="sysctl.proc_translated: 1";return!1},vE=(e)=>Aq("sha512").update(e).digest("hex"),Lq=()=>{try{let e=vE(`imgsharp-libvips-${xa()}`),t=nc.default.coerce(Cs.optionalDependencies[`@img/sharp-libvips-${xa()}`],{includePrerelease:!0}).version;return vE(`${e}npm:${t}`).slice(0,10)}catch{}return""},Fq=()=>rc(`node-gyp rebuild --directory=src ${PE()?"--nodedir=emscripten":""}`,{...Wh,stdio:"inherit"}).status,jE=()=>{if(process.platform!=="win32")return(rc("pkg-config --modversion vips-cpp",{...Wh,env:{...process.env,PKG_CONFIG_PATH:kE()}}).stdout||"").trim();else return""},qq=()=>{try{let e=(rc("brew",["--prefix"],{encoding:"utf8"}).stdout||"").trim();if(e)return`${e}/lib/pkgconfig`}catch(e){}return},Vq=()=>{try{let e=(rc("pkg-config",["--variable","pc_path","pkg-config"],{encoding:"utf8"}).stdout||"").trim();if(e)return e}catch(e){}return},kE=()=>{if(process.platform!=="win32")return[qq(),Vq(),process.env.PKG_CONFIG_PATH].filter(Boolean).join(":");else return""},Vh=(e,t,r)=>{if(r)r(`Detected ${t}, skipping search for globally-installed libvips`);return e},Bq=(e)=>{if(Boolean(process.env.SHARP_IGNORE_GLOBAL_LIBVIPS)===!0)return Vh(!1,"SHARP_IGNORE_GLOBAL_LIBVIPS",e);if(Boolean(process.env.SHARP_FORCE_GLOBAL_LIBVIPS)===!0)return Vh(!0,"SHARP_FORCE_GLOBAL_LIBVIPS",e);if(Dq())return Vh(!1,"Rosetta",e);let t=jE();return!!t&&nc.default.gte(t,SE)},Mf;var Uh=M(()=>{Jf();nc=xr(wE(),1),Bh=xr(xf(),1);/*!
389
390
  Copyright 2013 Lovell Fuller and others.
390
391
  SPDX-License-Identifier: Apache-2.0
391
- */B5=process.env.npm_package_config_libvips||As.config.libvips,eE=zl.default.coerce(B5).version,H5=["darwin-arm64","darwin-x64","freebsd-arm64","freebsd-x64","linux-arm","linux-arm64","linux-ppc64","linux-riscv64","linux-s390x","linux-wasm32","linux-x64","linuxmusl-arm64","linuxmusl-x64","win32-arm64","win32-ia32","win32-x64"],Eh={encoding:"utf8",shell:!0},Sf={minimumLibvipsVersion:eE,prebuiltPlatforms:H5,buildPlatformArch:ha,buildSharpLibvipsIncludeDir:G5,buildSharpLibvipsCPlusPlusDir:K5,buildSharpLibvipsLibDir:Y5,isUnsupportedNodeRuntime:X5,runtimePlatformArch:z5,log:U5,yarnLocator:Q5,spawnRebuild:eq,globalLibvipsVersion:nE,pkgConfigPath:sE,useGlobalLibvips:nq}});import{createRequire as sq}from"node:module";var Ef,Jt,oE,iq,iE,oq,aq,Rs,Qe,ti,Ve;var Gl=D(()=>{jh();vf();Ef=br(sf(),1);/*!
392
+ */Rq=process.env.npm_package_config_libvips||Cs.config.libvips,SE=nc.default.coerce(Rq).version,Oq=["darwin-arm64","darwin-x64","freebsd-arm64","freebsd-x64","linux-arm","linux-arm64","linux-ppc64","linux-riscv64","linux-s390x","linux-wasm32","linux-x64","linuxmusl-arm64","linuxmusl-x64","win32-arm64","win32-ia32","win32-x64"],Wh={encoding:"utf8",shell:!0},Mf={minimumLibvipsVersion:SE,prebuiltPlatforms:Oq,buildPlatformArch:xa,buildSharpLibvipsIncludeDir:Tq,buildSharpLibvipsCPlusPlusDir:Iq,buildSharpLibvipsLibDir:Jq,isUnsupportedNodeRuntime:Mq,runtimePlatformArch:Cq,log:Nq,yarnLocator:Lq,spawnRebuild:Fq,globalLibvipsVersion:jE,pkgConfigPath:kE,useGlobalLibvips:Bq}});import{createRequire as Wq}from"node:module";var Df,Jt,AE,Uq,_E,Hq,zq,Ts,Qe,si,Be;var sc=M(()=>{Uh();Jf();Df=xr(xf(),1);/*!
392
393
  Copyright 2013 Lovell Fuller and others.
393
394
  SPDX-License-Identifier: Apache-2.0
394
- */Jt=sq(import.meta.url),{version:oE}=As,{runtimePlatformArch:iq,isUnsupportedNodeRuntime:iE,prebuiltPlatforms:oq,minimumLibvipsVersion:aq}=Sf,Rs=iq(),ti=[];try{Qe=Jt(`../src/build/Release/sharp-${Rs}-${oE}.node`)}catch(e){ti.push(e)}if(!Qe)try{Qe=Jt(`../src/build/Release/sharp-wasm32-${oE}.node`)}catch(e){ti.push(e)}if(!Qe)try{switch(Rs){case"darwin-arm64":Qe=Jt("@img/sharp-darwin-arm64/sharp.node");break;case"darwin-x64":Qe=Jt("@img/sharp-darwin-x64/sharp.node");break;case"linux-arm":Qe=Jt("@img/sharp-linux-arm/sharp.node");break;case"linux-arm64":Qe=Jt("@img/sharp-linux-arm64/sharp.node");break;case"linux-ppc64":Qe=Jt("@img/sharp-linux-ppc64/sharp.node");break;case"linux-riscv64":Qe=Jt("@img/sharp-linux-riscv64/sharp.node");break;case"linux-s390x":Qe=Jt("@img/sharp-linux-s390x/sharp.node");break;case"linux-x64":Qe=Jt("@img/sharp-linux-x64/sharp.node");break;case"linuxmusl-arm64":Qe=Jt("@img/sharp-linuxmusl-arm64/sharp.node");break;case"linuxmusl-x64":Qe=Jt("@img/sharp-linuxmusl-x64/sharp.node");break;case"win32-arm64":Qe=Jt("@img/sharp-win32-arm64/sharp.node");break;case"win32-ia32":Qe=Jt("@img/sharp-win32-ia32/sharp.node");break;case"win32-x64":Qe=Jt("@img/sharp-win32-x64/sharp.node");break;case"freebsd-arm64":case"freebsd-x64":Qe=Jt("@img/sharp-freebsd-wasm32/sharp.node");break;case"linux-wasm32":Qe=Jt("@img/sharp-webcontainers-wasm32/sharp.node");break}if(Qe&&["linux-x64","linuxmusl-x64"].includes(Rs)&&!Qe._isUsingX64V2()){let e=Error("Prebuilt binaries for Linux x64 require v2 microarchitecture");e.code="Unsupported CPU",ti.push(e),Qe=null}if(Qe&&process.versions.electron&&Rs.startsWith("linux"))process.emitWarning("Binaries provided by Electron for use on Linux may be incompatible with sharp - see https://sharp.pixelplumbing.com/install#electron-and-linux",{code:"SharpElectronLinux"})}catch(e){ti.push(e)}if(!Qe)try{Qe=Jt("@img/sharp-wasm32/sharp.node")}catch(e){ti.push(e)}if(!Qe){let[e,t,r]=["linux","darwin","win32"].map((i)=>Rs.startsWith(i)),n=[`Could not load the "sharp" module using the ${Rs} runtime`];ti.forEach((i)=>{if(!i.code?.endsWith("MODULE_NOT_FOUND"))n.push(i.code?`${i.code}: ${i.message}`:i.message)});let s=ti.map((i)=>i.message).join(" ");if(n.push("Possible solutions:"),iE()){let{found:i,expected:o}=iE();n.push("- Please upgrade Node.js:",` Found ${i}`,` Requires ${o}`)}else if(oq.includes(Rs)&&!/libstdc\+\+\.so/.test(s)){let[i,o]=Rs.split("-"),a=i.endsWith("musl")?" --libc=musl":"";n.push("- Ensure optional dependencies can be installed:"," npm install --include=optional sharp","- Ensure your package manager supports multi-platform installation:"," See https://sharp.pixelplumbing.com/install#cross-platform","- Add platform-specific dependencies:",` npm install --os=${i.replace("musl","")}${a} --cpu=${o} sharp`)}else n.push(`- Manually install libvips >= ${aq}`," See https://sharp.pixelplumbing.com/install#building-from-source","- Add WebAssembly-based dependencies:"," npm install sharp @img/sharp-wasm32");if(e&&/(symbol not found|CXXABI_)/i.test(s))try{let{config:i}=Jt(`@img/sharp-libvips-${Rs}/package`),o=`${Ef.familySync()} ${Ef.versionSync()}`,a=`${i.musl?"musl":"glibc"} ${i.musl||i.glibc}`;n.push("- Update your OS:",` Found ${o}`,` Requires ${a}`)}catch(i){}if(e&&/\/snap\/core[0-9]{2}/.test(s))n.push("- Remove the Node.js Snap, which does not support native modules"," snap remove node");if(t&&/Incompatible library version/.test(s))n.push("- Update Homebrew:"," brew update && brew upgrade vips");if(ti.some((i)=>i.code==="ERR_DLOPEN_DISABLED"))n.push("- Run Node.js without using the --no-addons flag");if(r&&/The specified procedure could not be found/.test(s))n.push("- Using the canvas package on Windows?"," See https://sharp.pixelplumbing.com/install#canvas-and-windows","- Check for outdated versions of sharp in the dependency tree:"," npm ls sharp");throw n.push("- Consult the installation documentation:"," See https://sharp.pixelplumbing.com/install"),Error(n.join(`
395
- `))}Ve=Qe});import lq from"node:util";import Ph from"node:stream";function fq(){let e=this.constructor.call(),{debuglog:t,queueListener:r,...n}=this.options;if(e.options=structuredClone(n),e.options.debuglog=t,e.options.queueListener=r,this._isStreamInput())this._whenStreamInFinished(()=>{this._flattenBufferIn(),e.options.input.buffer=this.options.input.buffer,e.emit("finish")});return e}var cq,uq=(e)=>{ao.queue.emit("change",e)},ao=function(e,t){if(arguments.length===1&&!f.defined(e))throw Error("Invalid input");if(!(this instanceof ao))return new ao(e,t);return Ph.Duplex.call(this),this.options={topOffsetPre:-1,leftOffsetPre:-1,widthPre:-1,heightPre:-1,topOffsetPost:-1,leftOffsetPost:-1,widthPost:-1,heightPost:-1,width:-1,height:-1,canvas:"crop",position:0,resizeBackground:[0,0,0,255],angle:0,rotationAngle:0,rotationBackground:[0,0,0,255],rotateBefore:!1,orientBefore:!1,flip:!1,flop:!1,extendTop:0,extendBottom:0,extendLeft:0,extendRight:0,extendBackground:[0,0,0,255],extendWith:"background",withoutEnlargement:!1,withoutReduction:!1,affineMatrix:[],affineBackground:[0,0,0,255],affineIdx:0,affineIdy:0,affineOdx:0,affineOdy:0,affineInterpolator:this.constructor.interpolators.bilinear,kernel:"lanczos3",fastShrinkOnLoad:!0,tint:[-1,0,0,0],flatten:!1,flattenBackground:[0,0,0],unflatten:!1,negate:!1,negateAlpha:!0,medianSize:0,blurSigma:0,precision:"integer",minAmpl:0.2,sharpenSigma:0,sharpenM1:1,sharpenM2:2,sharpenX1:2,sharpenY2:10,sharpenY3:20,threshold:0,thresholdGrayscale:!0,trimBackground:[],trimThreshold:-1,trimLineArt:!1,trimMargin:0,dilateWidth:0,erodeWidth:0,gamma:0,gammaOut:0,greyscale:!1,normalise:!1,normaliseLower:1,normaliseUpper:99,claheWidth:0,claheHeight:0,claheMaxSlope:3,brightness:1,saturation:1,hue:0,lightness:0,booleanBufferIn:null,booleanFileIn:"",joinChannelIn:[],extractChannel:-1,removeAlpha:!1,ensureAlpha:-1,colourspace:"srgb",colourspacePipeline:"last",composite:[],fileOut:"",formatOut:"input",streamOut:!1,typedArrayOut:!1,keepMetadata:0,withMetadataOrientation:-1,withMetadataDensity:0,withIccProfile:"",withExif:{},withExifMerge:!0,withXmp:"",keepGainMap:!1,withGainMap:!1,resolveWithObject:!1,loop:-1,delay:[],jpegQuality:80,jpegProgressive:!1,jpegChromaSubsampling:"4:2:0",jpegTrellisQuantisation:!1,jpegOvershootDeringing:!1,jpegOptimiseScans:!1,jpegOptimiseCoding:!0,jpegQuantisationTable:0,pngProgressive:!1,pngCompressionLevel:6,pngAdaptiveFiltering:!1,pngPalette:!1,pngQuality:100,pngEffort:7,pngBitdepth:8,pngDither:1,jp2Quality:80,jp2TileHeight:512,jp2TileWidth:512,jp2Lossless:!1,jp2ChromaSubsampling:"4:4:4",webpQuality:80,webpAlphaQuality:100,webpLossless:!1,webpNearLossless:!1,webpSmartSubsample:!1,webpSmartDeblock:!1,webpPreset:"default",webpEffort:4,webpMinSize:!1,webpMixed:!1,webpExact:!1,gifBitdepth:8,gifEffort:7,gifDither:1,gifInterFrameMaxError:0,gifInterPaletteMaxError:3,gifKeepDuplicateFrames:!1,gifReuse:!0,gifProgressive:!1,tiffQuality:80,tiffCompression:"jpeg",tiffBigtiff:!1,tiffPredictor:"horizontal",tiffPyramid:!1,tiffMiniswhite:!1,tiffBitdepth:0,tiffTile:!1,tiffTileHeight:256,tiffTileWidth:256,tiffXres:1,tiffYres:1,tiffResolutionUnit:"inch",heifQuality:50,heifLossless:!1,heifCompression:"av1",heifEffort:4,heifChromaSubsampling:"4:4:4",heifBitdepth:8,heifTune:"auto",jxlDistance:1,jxlDecodingTier:0,jxlEffort:7,jxlLossless:!1,rawDepth:"uchar",tileSize:256,tileOverlap:0,tileContainer:"fs",tileLayout:"dz",tileFormat:"last",tileDepth:"last",tileAngle:0,tileSkipBlanks:-1,tileBackground:[255,255,255,255],tileCentre:!1,tileId:"https://example.com/iiif",tileBasename:"",timeoutSeconds:0,linearA:[],linearB:[],pdfBackground:[255,255,255,255],debuglog:(r)=>{this.emit("warning",r),cq(r)},queueListener:uq},this.options.input=this._createInputDescriptor(e,t,{allowStream:!0}),this},Mn;var aE=D(()=>{Cn();Gl();/*!
395
+ */Jt=Wq(import.meta.url),{version:AE}=Cs,{runtimePlatformArch:Uq,isUnsupportedNodeRuntime:_E,prebuiltPlatforms:Hq,minimumLibvipsVersion:zq}=Mf,Ts=Uq(),si=[];try{Qe=Jt(`../src/build/Release/sharp-${Ts}-${AE}.node`)}catch(e){si.push(e)}if(!Qe)try{Qe=Jt(`../src/build/Release/sharp-wasm32-${AE}.node`)}catch(e){si.push(e)}if(!Qe)try{switch(Ts){case"darwin-arm64":Qe=Jt("@img/sharp-darwin-arm64/sharp.node");break;case"darwin-x64":Qe=Jt("@img/sharp-darwin-x64/sharp.node");break;case"linux-arm":Qe=Jt("@img/sharp-linux-arm/sharp.node");break;case"linux-arm64":Qe=Jt("@img/sharp-linux-arm64/sharp.node");break;case"linux-ppc64":Qe=Jt("@img/sharp-linux-ppc64/sharp.node");break;case"linux-riscv64":Qe=Jt("@img/sharp-linux-riscv64/sharp.node");break;case"linux-s390x":Qe=Jt("@img/sharp-linux-s390x/sharp.node");break;case"linux-x64":Qe=Jt("@img/sharp-linux-x64/sharp.node");break;case"linuxmusl-arm64":Qe=Jt("@img/sharp-linuxmusl-arm64/sharp.node");break;case"linuxmusl-x64":Qe=Jt("@img/sharp-linuxmusl-x64/sharp.node");break;case"win32-arm64":Qe=Jt("@img/sharp-win32-arm64/sharp.node");break;case"win32-ia32":Qe=Jt("@img/sharp-win32-ia32/sharp.node");break;case"win32-x64":Qe=Jt("@img/sharp-win32-x64/sharp.node");break;case"freebsd-arm64":case"freebsd-x64":Qe=Jt("@img/sharp-freebsd-wasm32/sharp.node");break;case"linux-wasm32":Qe=Jt("@img/sharp-webcontainers-wasm32/sharp.node");break}if(Qe&&["linux-x64","linuxmusl-x64"].includes(Ts)&&!Qe._isUsingX64V2()){let e=Error("Prebuilt binaries for Linux x64 require v2 microarchitecture");e.code="Unsupported CPU",si.push(e),Qe=null}if(Qe&&process.versions.electron&&Ts.startsWith("linux"))process.emitWarning("Binaries provided by Electron for use on Linux may be incompatible with sharp - see https://sharp.pixelplumbing.com/install#electron-and-linux",{code:"SharpElectronLinux"})}catch(e){si.push(e)}if(!Qe)try{Qe=Jt("@img/sharp-wasm32/sharp.node")}catch(e){si.push(e)}if(!Qe){let[e,t,r]=["linux","darwin","win32"].map((i)=>Ts.startsWith(i)),n=[`Could not load the "sharp" module using the ${Ts} runtime`];si.forEach((i)=>{if(!i.code?.endsWith("MODULE_NOT_FOUND"))n.push(i.code?`${i.code}: ${i.message}`:i.message)});let s=si.map((i)=>i.message).join(" ");if(n.push("Possible solutions:"),_E()){let{found:i,expected:o}=_E();n.push("- Please upgrade Node.js:",` Found ${i}`,` Requires ${o}`)}else if(Hq.includes(Ts)&&!/libstdc\+\+\.so/.test(s)){let[i,o]=Ts.split("-"),a=i.endsWith("musl")?" --libc=musl":"";n.push("- Ensure optional dependencies can be installed:"," npm install --include=optional sharp","- Ensure your package manager supports multi-platform installation:"," See https://sharp.pixelplumbing.com/install#cross-platform","- Add platform-specific dependencies:",` npm install --os=${i.replace("musl","")}${a} --cpu=${o} sharp`)}else n.push(`- Manually install libvips >= ${zq}`," See https://sharp.pixelplumbing.com/install#building-from-source","- Add WebAssembly-based dependencies:"," npm install sharp @img/sharp-wasm32");if(e&&/(symbol not found|CXXABI_)/i.test(s))try{let{config:i}=Jt(`@img/sharp-libvips-${Ts}/package`),o=`${Df.familySync()} ${Df.versionSync()}`,a=`${i.musl?"musl":"glibc"} ${i.musl||i.glibc}`;n.push("- Update your OS:",` Found ${o}`,` Requires ${a}`)}catch(i){}if(e&&/\/snap\/core[0-9]{2}/.test(s))n.push("- Remove the Node.js Snap, which does not support native modules"," snap remove node");if(t&&/Incompatible library version/.test(s))n.push("- Update Homebrew:"," brew update && brew upgrade vips");if(si.some((i)=>i.code==="ERR_DLOPEN_DISABLED"))n.push("- Run Node.js without using the --no-addons flag");if(r&&/The specified procedure could not be found/.test(s))n.push("- Using the canvas package on Windows?"," See https://sharp.pixelplumbing.com/install#canvas-and-windows","- Check for outdated versions of sharp in the dependency tree:"," npm ls sharp");throw n.push("- Consult the installation documentation:"," See https://sharp.pixelplumbing.com/install"),Error(n.join(`
396
+ `))}Be=Qe});import Gq from"node:util";import Hh from"node:stream";function Yq(){let e=this.constructor.call(),{debuglog:t,queueListener:r,...n}=this.options;if(e.options=structuredClone(n),e.options.debuglog=t,e.options.queueListener=r,this._isStreamInput())this._whenStreamInFinished(()=>{this._flattenBufferIn(),e.options.input.buffer=this.options.input.buffer,e.emit("finish")});return e}var Kq,Xq=(e)=>{fo.queue.emit("change",e)},fo=function(e,t){if(arguments.length===1&&!f.defined(e))throw Error("Invalid input");if(!(this instanceof fo))return new fo(e,t);return Hh.Duplex.call(this),this.options={topOffsetPre:-1,leftOffsetPre:-1,widthPre:-1,heightPre:-1,topOffsetPost:-1,leftOffsetPost:-1,widthPost:-1,heightPost:-1,width:-1,height:-1,canvas:"crop",position:0,resizeBackground:[0,0,0,255],angle:0,rotationAngle:0,rotationBackground:[0,0,0,255],rotateBefore:!1,orientBefore:!1,flip:!1,flop:!1,extendTop:0,extendBottom:0,extendLeft:0,extendRight:0,extendBackground:[0,0,0,255],extendWith:"background",withoutEnlargement:!1,withoutReduction:!1,affineMatrix:[],affineBackground:[0,0,0,255],affineIdx:0,affineIdy:0,affineOdx:0,affineOdy:0,affineInterpolator:this.constructor.interpolators.bilinear,kernel:"lanczos3",fastShrinkOnLoad:!0,tint:[-1,0,0,0],flatten:!1,flattenBackground:[0,0,0],unflatten:!1,negate:!1,negateAlpha:!0,medianSize:0,blurSigma:0,precision:"integer",minAmpl:0.2,sharpenSigma:0,sharpenM1:1,sharpenM2:2,sharpenX1:2,sharpenY2:10,sharpenY3:20,threshold:0,thresholdGrayscale:!0,trimBackground:[],trimThreshold:-1,trimLineArt:!1,trimMargin:0,dilateWidth:0,erodeWidth:0,gamma:0,gammaOut:0,greyscale:!1,normalise:!1,normaliseLower:1,normaliseUpper:99,claheWidth:0,claheHeight:0,claheMaxSlope:3,brightness:1,saturation:1,hue:0,lightness:0,booleanBufferIn:null,booleanFileIn:"",joinChannelIn:[],extractChannel:-1,removeAlpha:!1,ensureAlpha:-1,colourspace:"srgb",colourspacePipeline:"last",composite:[],fileOut:"",formatOut:"input",streamOut:!1,typedArrayOut:!1,keepMetadata:0,withMetadataOrientation:-1,withMetadataDensity:0,withIccProfile:"",withExif:{},withExifMerge:!0,withXmp:"",keepGainMap:!1,withGainMap:!1,resolveWithObject:!1,loop:-1,delay:[],jpegQuality:80,jpegProgressive:!1,jpegChromaSubsampling:"4:2:0",jpegTrellisQuantisation:!1,jpegOvershootDeringing:!1,jpegOptimiseScans:!1,jpegOptimiseCoding:!0,jpegQuantisationTable:0,pngProgressive:!1,pngCompressionLevel:6,pngAdaptiveFiltering:!1,pngPalette:!1,pngQuality:100,pngEffort:7,pngBitdepth:8,pngDither:1,jp2Quality:80,jp2TileHeight:512,jp2TileWidth:512,jp2Lossless:!1,jp2ChromaSubsampling:"4:4:4",webpQuality:80,webpAlphaQuality:100,webpLossless:!1,webpNearLossless:!1,webpSmartSubsample:!1,webpSmartDeblock:!1,webpPreset:"default",webpEffort:4,webpMinSize:!1,webpMixed:!1,webpExact:!1,gifBitdepth:8,gifEffort:7,gifDither:1,gifInterFrameMaxError:0,gifInterPaletteMaxError:3,gifKeepDuplicateFrames:!1,gifReuse:!0,gifProgressive:!1,tiffQuality:80,tiffCompression:"jpeg",tiffBigtiff:!1,tiffPredictor:"horizontal",tiffPyramid:!1,tiffMiniswhite:!1,tiffBitdepth:0,tiffTile:!1,tiffTileHeight:256,tiffTileWidth:256,tiffXres:1,tiffYres:1,tiffResolutionUnit:"inch",heifQuality:50,heifLossless:!1,heifCompression:"av1",heifEffort:4,heifChromaSubsampling:"4:4:4",heifBitdepth:8,heifTune:"auto",jxlDistance:1,jxlDecodingTier:0,jxlEffort:7,jxlLossless:!1,rawDepth:"uchar",tileSize:256,tileOverlap:0,tileContainer:"fs",tileLayout:"dz",tileFormat:"last",tileDepth:"last",tileAngle:0,tileSkipBlanks:-1,tileBackground:[255,255,255,255],tileCentre:!1,tileId:"https://example.com/iiif",tileBasename:"",timeoutSeconds:0,linearA:[],linearB:[],pdfBackground:[255,255,255,255],debuglog:(r)=>{this.emit("warning",r),Kq(r)},queueListener:Xq},this.options.input=this._createInputDescriptor(e,t,{allowStream:!0}),this},Vn;var RE=M(()=>{Mn();sc();/*!
396
397
  Copyright 2013 Lovell Fuller and others.
397
398
  SPDX-License-Identifier: Apache-2.0
398
- */cq=lq.debuglog("sharp");Object.setPrototypeOf(ao.prototype,Ph.Duplex.prototype);Object.setPrototypeOf(ao,Ph.Duplex);Object.assign(ao.prototype,{clone:fq});Mn=ao});function lE(e){let t=pq.filter((r)=>f.defined(e[r])).map((r)=>[r,e[r]]);return t.length?Object.fromEntries(t):void 0}function mq(e,t,r){let n={autoOrient:!1,failOn:"warning",limitInputPixels:268402689,limitInputChannels:5,ignoreIcc:!1,unlimited:!1,sequentialRead:!0};if(f.string(e))n.file=e;else if(f.buffer(e)){if(e.length===0)throw Error("Input Buffer is empty");n.buffer=e}else if(f.arrayBuffer(e)){if(e.byteLength===0)throw Error("Input bit Array is empty");n.buffer=Buffer.from(e,0,e.byteLength)}else if(f.typedArray(e)){if(e.length===0)throw Error("Input Bit Array is empty");n.buffer=Buffer.from(e.buffer,e.byteOffset,e.byteLength)}else if(f.plainObject(e)&&!f.defined(t)){if(t=e,lE(t))n.buffer=[]}else if(!f.defined(e)&&!f.defined(t)&&f.object(r)&&r.allowStream)n.buffer=[];else if(Array.isArray(e))if(e.length>1)if(!this.options.joining)this.options.joining=!0,this.options.join=e.map((s)=>this._createInputDescriptor(s));else throw Error("Recursive join is unsupported");else throw Error("Expected at least two images to join");else throw Error(`Unsupported input '${e}' of type ${typeof e}${f.defined(t)?` when also providing options of type ${typeof t}`:""}`);if(f.object(t)){if(f.defined(t.failOn))if(f.string(t.failOn)&&f.inArray(t.failOn,["none","truncated","error","warning"]))n.failOn=t.failOn;else throw f.invalidParameterError("failOn","one of: none, truncated, error, warning",t.failOn);if(f.defined(t.autoOrient))if(f.bool(t.autoOrient))n.autoOrient=t.autoOrient;else throw f.invalidParameterError("autoOrient","boolean",t.autoOrient);if(f.defined(t.density))if(f.number(t.density)&&f.inRange(t.density,1,1e5))n.density=t.density;else throw f.invalidParameterError("density","number between 1 and 100000",t.density);if(f.defined(t.ignoreIcc))if(f.bool(t.ignoreIcc))n.ignoreIcc=t.ignoreIcc;else throw f.invalidParameterError("ignoreIcc","boolean",t.ignoreIcc);if(f.defined(t.limitInputPixels))if(f.bool(t.limitInputPixels))n.limitInputPixels=t.limitInputPixels?268402689:0;else if(f.integer(t.limitInputPixels)&&f.inRange(t.limitInputPixels,0,Number.MAX_SAFE_INTEGER))n.limitInputPixels=t.limitInputPixels;else throw f.invalidParameterError("limitInputPixels","positive integer",t.limitInputPixels);if(f.defined(t.limitInputChannels))if(f.bool(t.limitInputChannels))n.limitInputChannels=t.limitInputChannels?5:0;else if(f.integer(t.limitInputChannels)&&f.inRange(t.limitInputChannels,0,Number.MAX_SAFE_INTEGER))n.limitInputChannels=t.limitInputChannels;else throw f.invalidParameterError("limitInputChannels","positive integer",t.limitInputChannels);if(f.defined(t.unlimited))if(f.bool(t.unlimited))n.unlimited=t.unlimited;else throw f.invalidParameterError("unlimited","boolean",t.unlimited);if(f.defined(t.sequentialRead))if(f.bool(t.sequentialRead))n.sequentialRead=t.sequentialRead;else throw f.invalidParameterError("sequentialRead","boolean",t.sequentialRead);if(f.defined(t.raw)){if(f.object(t.raw)&&f.integer(t.raw.width)&&f.inRange(t.raw.width,1,1e8)&&f.integer(t.raw.height)&&f.inRange(t.raw.height,1,1e8)&&f.integer(t.raw.channels)&&f.inRange(t.raw.channels,1,4))switch(n.rawWidth=t.raw.width,n.rawHeight=t.raw.height,n.rawChannels=t.raw.channels,e.constructor){case Uint8Array:case Uint8ClampedArray:n.rawDepth="uchar";break;case Int8Array:n.rawDepth="char";break;case Uint16Array:n.rawDepth="ushort";break;case Int16Array:n.rawDepth="short";break;case Uint32Array:n.rawDepth="uint";break;case Int32Array:n.rawDepth="int";break;case Float32Array:n.rawDepth="float";break;case Float64Array:n.rawDepth="double";break;default:n.rawDepth="uchar";break}else throw Error("Expected width, height and channels for raw pixel input");if(n.rawPremultiplied=!1,f.defined(t.raw.premultiplied))if(f.bool(t.raw.premultiplied))n.rawPremultiplied=t.raw.premultiplied;else throw f.invalidParameterError("raw.premultiplied","boolean",t.raw.premultiplied);if(n.rawPageHeight=0,f.defined(t.raw.pageHeight))if(f.integer(t.raw.pageHeight)&&t.raw.pageHeight>0&&t.raw.pageHeight<=t.raw.height){if(t.raw.height%t.raw.pageHeight!==0)throw Error(`Expected raw.height ${t.raw.height} to be a multiple of raw.pageHeight ${t.raw.pageHeight}`);n.rawPageHeight=t.raw.pageHeight}else throw f.invalidParameterError("raw.pageHeight","positive integer",t.raw.pageHeight)}if(f.defined(t.animated))if(f.bool(t.animated))n.pages=t.animated?-1:1;else throw f.invalidParameterError("animated","boolean",t.animated);if(f.defined(t.pages))if(f.integer(t.pages)&&f.inRange(t.pages,-1,1e5))n.pages=t.pages;else throw f.invalidParameterError("pages","integer between -1 and 100000",t.pages);if(f.defined(t.page))if(f.integer(t.page)&&f.inRange(t.page,0,1e5))n.page=t.page;else throw f.invalidParameterError("page","integer between 0 and 100000",t.page);if(f.object(t.openSlide)&&f.defined(t.openSlide.level))if(f.integer(t.openSlide.level)&&f.inRange(t.openSlide.level,0,256))n.openSlideLevel=t.openSlide.level;else throw f.invalidParameterError("openSlide.level","integer between 0 and 256",t.openSlide.level);else if(f.defined(t.level))if(f.integer(t.level)&&f.inRange(t.level,0,256))n.openSlideLevel=t.level;else throw f.invalidParameterError("level","integer between 0 and 256",t.level);if(f.object(t.tiff)&&f.defined(t.tiff.subifd))if(f.integer(t.tiff.subifd)&&f.inRange(t.tiff.subifd,-1,1e5))n.tiffSubifd=t.tiff.subifd;else throw f.invalidParameterError("tiff.subifd","integer between -1 and 100000",t.tiff.subifd);else if(f.defined(t.subifd))if(f.integer(t.subifd)&&f.inRange(t.subifd,-1,1e5))n.tiffSubifd=t.subifd;else throw f.invalidParameterError("subifd","integer between -1 and 100000",t.subifd);if(f.object(t.svg)){if(f.defined(t.svg.stylesheet))if(f.string(t.svg.stylesheet))n.svgStylesheet=t.svg.stylesheet;else throw f.invalidParameterError("svg.stylesheet","string",t.svg.stylesheet);if(f.defined(t.svg.highBitdepth))if(f.bool(t.svg.highBitdepth))n.svgHighBitdepth=t.svg.highBitdepth;else throw f.invalidParameterError("svg.highBitdepth","boolean",t.svg.highBitdepth)}if(f.object(t.pdf)&&f.defined(t.pdf.background))n.pdfBackground=this._getBackgroundColourOption(t.pdf.background);else if(f.defined(t.pdfBackground))n.pdfBackground=this._getBackgroundColourOption(t.pdfBackground);if(f.object(t.jp2)&&f.defined(t.jp2.oneshot))if(f.bool(t.jp2.oneshot))n.jp2Oneshot=t.jp2.oneshot;else throw f.invalidParameterError("jp2.oneshot","boolean",t.jp2.oneshot);if(f.defined(t.create))if(f.object(t.create)&&f.integer(t.create.width)&&f.inRange(t.create.width,1,1e8)&&f.integer(t.create.height)&&f.inRange(t.create.height,1,1e8)&&f.integer(t.create.channels)){if(n.createWidth=t.create.width,n.createHeight=t.create.height,n.createChannels=t.create.channels,n.createPageHeight=0,f.defined(t.create.pageHeight))if(f.integer(t.create.pageHeight)&&t.create.pageHeight>0&&t.create.pageHeight<=t.create.height){if(t.create.height%t.create.pageHeight!==0)throw Error(`Expected create.height ${t.create.height} to be a multiple of create.pageHeight ${t.create.pageHeight}`);n.createPageHeight=t.create.pageHeight}else throw f.invalidParameterError("create.pageHeight","positive integer",t.create.pageHeight);if(f.defined(t.create.noise)){if(!f.object(t.create.noise))throw Error("Expected noise to be an object");if(t.create.noise.type!=="gaussian")throw Error("Only gaussian noise is supported at the moment");if(n.createNoiseType=t.create.noise.type,!f.inRange(t.create.channels,1,4))throw f.invalidParameterError("create.channels","number between 1 and 4",t.create.channels);if(n.createNoiseMean=128,f.defined(t.create.noise.mean))if(f.number(t.create.noise.mean)&&f.inRange(t.create.noise.mean,0,1e4))n.createNoiseMean=t.create.noise.mean;else throw f.invalidParameterError("create.noise.mean","number between 0 and 10000",t.create.noise.mean);if(n.createNoiseSigma=30,f.defined(t.create.noise.sigma))if(f.number(t.create.noise.sigma)&&f.inRange(t.create.noise.sigma,0,1e4))n.createNoiseSigma=t.create.noise.sigma;else throw f.invalidParameterError("create.noise.sigma","number between 0 and 10000",t.create.noise.sigma)}else if(f.defined(t.create.background)){if(!f.inRange(t.create.channels,3,4))throw f.invalidParameterError("create.channels","number between 3 and 4",t.create.channels);n.createBackground=this._getBackgroundColourOption(t.create.background)}else throw Error("Expected valid noise or background to create a new input image");delete n.buffer}else throw Error("Expected valid width, height and channels to create a new input image");if(f.defined(t.text))if(f.object(t.text)&&f.string(t.text.text)){if(n.textValue=t.text.text,f.defined(t.text.height)&&f.defined(t.text.dpi))throw Error("Expected only one of dpi or height");if(f.defined(t.text.font))if(f.string(t.text.font))n.textFont=t.text.font;else throw f.invalidParameterError("text.font","string",t.text.font);if(f.defined(t.text.fontfile))if(f.string(t.text.fontfile))n.textFontfile=t.text.fontfile;else throw f.invalidParameterError("text.fontfile","string",t.text.fontfile);if(f.defined(t.text.width))if(f.integer(t.text.width)&&f.inRange(t.text.width,1,1e6))n.textWidth=t.text.width;else throw f.invalidParameterError("text.width","integer between 1 and 1000000",t.text.width);if(f.defined(t.text.height))if(f.integer(t.text.height)&&f.inRange(t.text.height,1,1e6))n.textHeight=t.text.height;else throw f.invalidParameterError("text.height","integer between 1 and 1000000",t.text.height);if(f.defined(t.text.align))if(f.string(t.text.align)&&f.string(this.constructor.align[t.text.align]))n.textAlign=this.constructor.align[t.text.align];else throw f.invalidParameterError("text.align","valid alignment",t.text.align);if(f.defined(t.text.justify))if(f.bool(t.text.justify))n.textJustify=t.text.justify;else throw f.invalidParameterError("text.justify","boolean",t.text.justify);if(f.defined(t.text.dpi))if(f.integer(t.text.dpi)&&f.inRange(t.text.dpi,1,1e6))n.textDpi=t.text.dpi;else throw f.invalidParameterError("text.dpi","integer between 1 and 1000000",t.text.dpi);if(f.defined(t.text.rgba))if(f.bool(t.text.rgba))n.textRgba=t.text.rgba;else throw f.invalidParameterError("text.rgba","bool",t.text.rgba);if(f.defined(t.text.spacing))if(f.integer(t.text.spacing)&&f.inRange(t.text.spacing,-1e6,1e6))n.textSpacing=t.text.spacing;else throw f.invalidParameterError("text.spacing","integer between -1000000 and 1000000",t.text.spacing);if(f.defined(t.text.wrap))if(f.string(t.text.wrap)&&f.inArray(t.text.wrap,["word","char","word-char","none"]))n.textWrap=t.text.wrap;else throw f.invalidParameterError("text.wrap","one of: word, char, word-char, none",t.text.wrap);delete n.buffer}else throw Error("Expected a valid string to create an image with text.");if(f.defined(t.join))if(f.defined(this.options.join)){if(f.defined(t.join.animated))if(f.bool(t.join.animated))n.joinAnimated=t.join.animated;else throw f.invalidParameterError("join.animated","boolean",t.join.animated);if(f.defined(t.join.across))if(f.integer(t.join.across)&&f.inRange(t.join.across,1,1e6))n.joinAcross=t.join.across;else throw f.invalidParameterError("join.across","integer between 1 and 100000",t.join.across);if(f.defined(t.join.shim))if(f.integer(t.join.shim)&&f.inRange(t.join.shim,0,1e6))n.joinShim=t.join.shim;else throw f.invalidParameterError("join.shim","integer between 0 and 100000",t.join.shim);if(f.defined(t.join.background))n.joinBackground=this._getBackgroundColourOption(t.join.background);if(f.defined(t.join.halign))if(f.string(t.join.halign)&&f.string(this.constructor.align[t.join.halign]))n.joinHalign=this.constructor.align[t.join.halign];else throw f.invalidParameterError("join.halign","valid alignment",t.join.halign);if(f.defined(t.join.valign))if(f.string(t.join.valign)&&f.string(this.constructor.align[t.join.valign]))n.joinValign=this.constructor.align[t.join.valign];else throw f.invalidParameterError("join.valign","valid alignment",t.join.valign)}else throw Error("Expected input to be an array of images to join")}else if(f.defined(t))throw Error(`Invalid input options ${t}`);return n}function hq(e,t,r){if(Array.isArray(this.options.input.buffer))if(f.buffer(e))this.options.input.buffer.push(e),r();else r(Error("Non-Buffer data on Writable Stream"));else r(Error("Unexpected data on Writable Stream"))}function gq(){if(this._isStreamInput())this.options.input.buffer=Buffer.concat(this.options.input.buffer)}function yq(){return Array.isArray(this.options.input.buffer)}function bq(e){if(this.writableFinished)e();else this.once("finish",e)}function xq(e){let t=Error();if(f.fn(e)){if(this._isStreamInput())this._whenStreamInFinished(()=>{this._flattenBufferIn(),Ve.metadata(this.options,(r,n)=>{if(r)e(f.nativeError(r,t));else e(null,n)})});else Ve.metadata(this.options,(r,n)=>{if(r)e(f.nativeError(r,t));else e(null,n)});return this}else if(this._isStreamInput())return new Promise((r,n)=>{this._whenStreamInFinished(()=>{this._flattenBufferIn(),Ve.metadata(this.options,(s,i)=>{if(s)n(f.nativeError(s,t));else r(i)})})});else return new Promise((r,n)=>{Ve.metadata(this.options,(s,i)=>{if(s)n(f.nativeError(s,t));else r(i)})})}function $q(e){let t=Error();if(f.fn(e)){if(this._isStreamInput())this._whenStreamInFinished(()=>{this._flattenBufferIn(),Ve.stats(this.options,(r,n)=>{if(r)e(f.nativeError(r,t));else e(null,n)})});else Ve.stats(this.options,(r,n)=>{if(r)e(f.nativeError(r,t));else e(null,n)});return this}else if(this._isStreamInput())return new Promise((r,n)=>{this._whenStreamInFinished(()=>{this._flattenBufferIn(),Ve.stats(this.options,(s,i)=>{if(s)n(f.nativeError(s,t));else r(i)})})});else return new Promise((r,n)=>{Ve.stats(this.options,(s,i)=>{if(s)n(f.nativeError(s,t));else r(i)})})}var dq,pq,cE=(e)=>{Object.assign(e.prototype,{_inputOptionsFromObject:lE,_createInputDescriptor:mq,_write:hq,_flattenBufferIn:gq,_isStreamInput:yq,_whenStreamInFinished:bq,metadata:xq,stats:$q}),e.align=dq};var uE=D(()=>{Cn();Gl();/*!
399
+ */Kq=Gq.debuglog("sharp");Object.setPrototypeOf(fo.prototype,Hh.Duplex.prototype);Object.setPrototypeOf(fo,Hh.Duplex);Object.assign(fo.prototype,{clone:Yq});Vn=fo});function OE(e){let t=Qq.filter((r)=>f.defined(e[r])).map((r)=>[r,e[r]]);return t.length?Object.fromEntries(t):void 0}function eV(e,t,r){let n={autoOrient:!1,failOn:"warning",limitInputPixels:268402689,limitInputChannels:5,ignoreIcc:!1,unlimited:!1,sequentialRead:!0};if(f.string(e))n.file=e;else if(f.buffer(e)){if(e.length===0)throw Error("Input Buffer is empty");n.buffer=e}else if(f.arrayBuffer(e)){if(e.byteLength===0)throw Error("Input bit Array is empty");n.buffer=Buffer.from(e,0,e.byteLength)}else if(f.typedArray(e)){if(e.length===0)throw Error("Input Bit Array is empty");n.buffer=Buffer.from(e.buffer,e.byteOffset,e.byteLength)}else if(f.plainObject(e)&&!f.defined(t)){if(t=e,OE(t))n.buffer=[]}else if(!f.defined(e)&&!f.defined(t)&&f.object(r)&&r.allowStream)n.buffer=[];else if(Array.isArray(e))if(e.length>1)if(!this.options.joining)this.options.joining=!0,this.options.join=e.map((s)=>this._createInputDescriptor(s));else throw Error("Recursive join is unsupported");else throw Error("Expected at least two images to join");else throw Error(`Unsupported input '${e}' of type ${typeof e}${f.defined(t)?` when also providing options of type ${typeof t}`:""}`);if(f.object(t)){if(f.defined(t.failOn))if(f.string(t.failOn)&&f.inArray(t.failOn,["none","truncated","error","warning"]))n.failOn=t.failOn;else throw f.invalidParameterError("failOn","one of: none, truncated, error, warning",t.failOn);if(f.defined(t.autoOrient))if(f.bool(t.autoOrient))n.autoOrient=t.autoOrient;else throw f.invalidParameterError("autoOrient","boolean",t.autoOrient);if(f.defined(t.density))if(f.number(t.density)&&f.inRange(t.density,1,1e5))n.density=t.density;else throw f.invalidParameterError("density","number between 1 and 100000",t.density);if(f.defined(t.ignoreIcc))if(f.bool(t.ignoreIcc))n.ignoreIcc=t.ignoreIcc;else throw f.invalidParameterError("ignoreIcc","boolean",t.ignoreIcc);if(f.defined(t.limitInputPixels))if(f.bool(t.limitInputPixels))n.limitInputPixels=t.limitInputPixels?268402689:0;else if(f.integer(t.limitInputPixels)&&f.inRange(t.limitInputPixels,0,Number.MAX_SAFE_INTEGER))n.limitInputPixels=t.limitInputPixels;else throw f.invalidParameterError("limitInputPixels","positive integer",t.limitInputPixels);if(f.defined(t.limitInputChannels))if(f.bool(t.limitInputChannels))n.limitInputChannels=t.limitInputChannels?5:0;else if(f.integer(t.limitInputChannels)&&f.inRange(t.limitInputChannels,0,Number.MAX_SAFE_INTEGER))n.limitInputChannels=t.limitInputChannels;else throw f.invalidParameterError("limitInputChannels","positive integer",t.limitInputChannels);if(f.defined(t.unlimited))if(f.bool(t.unlimited))n.unlimited=t.unlimited;else throw f.invalidParameterError("unlimited","boolean",t.unlimited);if(f.defined(t.sequentialRead))if(f.bool(t.sequentialRead))n.sequentialRead=t.sequentialRead;else throw f.invalidParameterError("sequentialRead","boolean",t.sequentialRead);if(f.defined(t.raw)){if(f.object(t.raw)&&f.integer(t.raw.width)&&f.inRange(t.raw.width,1,1e8)&&f.integer(t.raw.height)&&f.inRange(t.raw.height,1,1e8)&&f.integer(t.raw.channels)&&f.inRange(t.raw.channels,1,4))switch(n.rawWidth=t.raw.width,n.rawHeight=t.raw.height,n.rawChannels=t.raw.channels,e.constructor){case Uint8Array:case Uint8ClampedArray:n.rawDepth="uchar";break;case Int8Array:n.rawDepth="char";break;case Uint16Array:n.rawDepth="ushort";break;case Int16Array:n.rawDepth="short";break;case Uint32Array:n.rawDepth="uint";break;case Int32Array:n.rawDepth="int";break;case Float32Array:n.rawDepth="float";break;case Float64Array:n.rawDepth="double";break;default:n.rawDepth="uchar";break}else throw Error("Expected width, height and channels for raw pixel input");if(n.rawPremultiplied=!1,f.defined(t.raw.premultiplied))if(f.bool(t.raw.premultiplied))n.rawPremultiplied=t.raw.premultiplied;else throw f.invalidParameterError("raw.premultiplied","boolean",t.raw.premultiplied);if(n.rawPageHeight=0,f.defined(t.raw.pageHeight))if(f.integer(t.raw.pageHeight)&&t.raw.pageHeight>0&&t.raw.pageHeight<=t.raw.height){if(t.raw.height%t.raw.pageHeight!==0)throw Error(`Expected raw.height ${t.raw.height} to be a multiple of raw.pageHeight ${t.raw.pageHeight}`);n.rawPageHeight=t.raw.pageHeight}else throw f.invalidParameterError("raw.pageHeight","positive integer",t.raw.pageHeight)}if(f.defined(t.animated))if(f.bool(t.animated))n.pages=t.animated?-1:1;else throw f.invalidParameterError("animated","boolean",t.animated);if(f.defined(t.pages))if(f.integer(t.pages)&&f.inRange(t.pages,-1,1e5))n.pages=t.pages;else throw f.invalidParameterError("pages","integer between -1 and 100000",t.pages);if(f.defined(t.page))if(f.integer(t.page)&&f.inRange(t.page,0,1e5))n.page=t.page;else throw f.invalidParameterError("page","integer between 0 and 100000",t.page);if(f.object(t.openSlide)&&f.defined(t.openSlide.level))if(f.integer(t.openSlide.level)&&f.inRange(t.openSlide.level,0,256))n.openSlideLevel=t.openSlide.level;else throw f.invalidParameterError("openSlide.level","integer between 0 and 256",t.openSlide.level);else if(f.defined(t.level))if(f.integer(t.level)&&f.inRange(t.level,0,256))n.openSlideLevel=t.level;else throw f.invalidParameterError("level","integer between 0 and 256",t.level);if(f.object(t.tiff)&&f.defined(t.tiff.subifd))if(f.integer(t.tiff.subifd)&&f.inRange(t.tiff.subifd,-1,1e5))n.tiffSubifd=t.tiff.subifd;else throw f.invalidParameterError("tiff.subifd","integer between -1 and 100000",t.tiff.subifd);else if(f.defined(t.subifd))if(f.integer(t.subifd)&&f.inRange(t.subifd,-1,1e5))n.tiffSubifd=t.subifd;else throw f.invalidParameterError("subifd","integer between -1 and 100000",t.subifd);if(f.object(t.svg)){if(f.defined(t.svg.stylesheet))if(f.string(t.svg.stylesheet))n.svgStylesheet=t.svg.stylesheet;else throw f.invalidParameterError("svg.stylesheet","string",t.svg.stylesheet);if(f.defined(t.svg.highBitdepth))if(f.bool(t.svg.highBitdepth))n.svgHighBitdepth=t.svg.highBitdepth;else throw f.invalidParameterError("svg.highBitdepth","boolean",t.svg.highBitdepth)}if(f.object(t.pdf)&&f.defined(t.pdf.background))n.pdfBackground=this._getBackgroundColourOption(t.pdf.background);else if(f.defined(t.pdfBackground))n.pdfBackground=this._getBackgroundColourOption(t.pdfBackground);if(f.object(t.jp2)&&f.defined(t.jp2.oneshot))if(f.bool(t.jp2.oneshot))n.jp2Oneshot=t.jp2.oneshot;else throw f.invalidParameterError("jp2.oneshot","boolean",t.jp2.oneshot);if(f.defined(t.create))if(f.object(t.create)&&f.integer(t.create.width)&&f.inRange(t.create.width,1,1e8)&&f.integer(t.create.height)&&f.inRange(t.create.height,1,1e8)&&f.integer(t.create.channels)){if(n.createWidth=t.create.width,n.createHeight=t.create.height,n.createChannels=t.create.channels,n.createPageHeight=0,f.defined(t.create.pageHeight))if(f.integer(t.create.pageHeight)&&t.create.pageHeight>0&&t.create.pageHeight<=t.create.height){if(t.create.height%t.create.pageHeight!==0)throw Error(`Expected create.height ${t.create.height} to be a multiple of create.pageHeight ${t.create.pageHeight}`);n.createPageHeight=t.create.pageHeight}else throw f.invalidParameterError("create.pageHeight","positive integer",t.create.pageHeight);if(f.defined(t.create.noise)){if(!f.object(t.create.noise))throw Error("Expected noise to be an object");if(t.create.noise.type!=="gaussian")throw Error("Only gaussian noise is supported at the moment");if(n.createNoiseType=t.create.noise.type,!f.inRange(t.create.channels,1,4))throw f.invalidParameterError("create.channels","number between 1 and 4",t.create.channels);if(n.createNoiseMean=128,f.defined(t.create.noise.mean))if(f.number(t.create.noise.mean)&&f.inRange(t.create.noise.mean,0,1e4))n.createNoiseMean=t.create.noise.mean;else throw f.invalidParameterError("create.noise.mean","number between 0 and 10000",t.create.noise.mean);if(n.createNoiseSigma=30,f.defined(t.create.noise.sigma))if(f.number(t.create.noise.sigma)&&f.inRange(t.create.noise.sigma,0,1e4))n.createNoiseSigma=t.create.noise.sigma;else throw f.invalidParameterError("create.noise.sigma","number between 0 and 10000",t.create.noise.sigma)}else if(f.defined(t.create.background)){if(!f.inRange(t.create.channels,3,4))throw f.invalidParameterError("create.channels","number between 3 and 4",t.create.channels);n.createBackground=this._getBackgroundColourOption(t.create.background)}else throw Error("Expected valid noise or background to create a new input image");delete n.buffer}else throw Error("Expected valid width, height and channels to create a new input image");if(f.defined(t.text))if(f.object(t.text)&&f.string(t.text.text)){if(n.textValue=t.text.text,f.defined(t.text.height)&&f.defined(t.text.dpi))throw Error("Expected only one of dpi or height");if(f.defined(t.text.font))if(f.string(t.text.font))n.textFont=t.text.font;else throw f.invalidParameterError("text.font","string",t.text.font);if(f.defined(t.text.fontfile))if(f.string(t.text.fontfile))n.textFontfile=t.text.fontfile;else throw f.invalidParameterError("text.fontfile","string",t.text.fontfile);if(f.defined(t.text.width))if(f.integer(t.text.width)&&f.inRange(t.text.width,1,1e6))n.textWidth=t.text.width;else throw f.invalidParameterError("text.width","integer between 1 and 1000000",t.text.width);if(f.defined(t.text.height))if(f.integer(t.text.height)&&f.inRange(t.text.height,1,1e6))n.textHeight=t.text.height;else throw f.invalidParameterError("text.height","integer between 1 and 1000000",t.text.height);if(f.defined(t.text.align))if(f.string(t.text.align)&&f.string(this.constructor.align[t.text.align]))n.textAlign=this.constructor.align[t.text.align];else throw f.invalidParameterError("text.align","valid alignment",t.text.align);if(f.defined(t.text.justify))if(f.bool(t.text.justify))n.textJustify=t.text.justify;else throw f.invalidParameterError("text.justify","boolean",t.text.justify);if(f.defined(t.text.dpi))if(f.integer(t.text.dpi)&&f.inRange(t.text.dpi,1,1e6))n.textDpi=t.text.dpi;else throw f.invalidParameterError("text.dpi","integer between 1 and 1000000",t.text.dpi);if(f.defined(t.text.rgba))if(f.bool(t.text.rgba))n.textRgba=t.text.rgba;else throw f.invalidParameterError("text.rgba","bool",t.text.rgba);if(f.defined(t.text.spacing))if(f.integer(t.text.spacing)&&f.inRange(t.text.spacing,-1e6,1e6))n.textSpacing=t.text.spacing;else throw f.invalidParameterError("text.spacing","integer between -1000000 and 1000000",t.text.spacing);if(f.defined(t.text.wrap))if(f.string(t.text.wrap)&&f.inArray(t.text.wrap,["word","char","word-char","none"]))n.textWrap=t.text.wrap;else throw f.invalidParameterError("text.wrap","one of: word, char, word-char, none",t.text.wrap);delete n.buffer}else throw Error("Expected a valid string to create an image with text.");if(f.defined(t.join))if(f.defined(this.options.join)){if(f.defined(t.join.animated))if(f.bool(t.join.animated))n.joinAnimated=t.join.animated;else throw f.invalidParameterError("join.animated","boolean",t.join.animated);if(f.defined(t.join.across))if(f.integer(t.join.across)&&f.inRange(t.join.across,1,1e6))n.joinAcross=t.join.across;else throw f.invalidParameterError("join.across","integer between 1 and 100000",t.join.across);if(f.defined(t.join.shim))if(f.integer(t.join.shim)&&f.inRange(t.join.shim,0,1e6))n.joinShim=t.join.shim;else throw f.invalidParameterError("join.shim","integer between 0 and 100000",t.join.shim);if(f.defined(t.join.background))n.joinBackground=this._getBackgroundColourOption(t.join.background);if(f.defined(t.join.halign))if(f.string(t.join.halign)&&f.string(this.constructor.align[t.join.halign]))n.joinHalign=this.constructor.align[t.join.halign];else throw f.invalidParameterError("join.halign","valid alignment",t.join.halign);if(f.defined(t.join.valign))if(f.string(t.join.valign)&&f.string(this.constructor.align[t.join.valign]))n.joinValign=this.constructor.align[t.join.valign];else throw f.invalidParameterError("join.valign","valid alignment",t.join.valign)}else throw Error("Expected input to be an array of images to join")}else if(f.defined(t))throw Error(`Invalid input options ${t}`);return n}function tV(e,t,r){if(Array.isArray(this.options.input.buffer))if(f.buffer(e))this.options.input.buffer.push(e),r();else r(Error("Non-Buffer data on Writable Stream"));else r(Error("Unexpected data on Writable Stream"))}function rV(){if(this._isStreamInput())this.options.input.buffer=Buffer.concat(this.options.input.buffer)}function nV(){return Array.isArray(this.options.input.buffer)}function sV(e){if(this.writableFinished)e();else this.once("finish",e)}function iV(e){let t=Error();if(f.fn(e)){if(this._isStreamInput())this._whenStreamInFinished(()=>{this._flattenBufferIn(),Be.metadata(this.options,(r,n)=>{if(r)e(f.nativeError(r,t));else e(null,n)})});else Be.metadata(this.options,(r,n)=>{if(r)e(f.nativeError(r,t));else e(null,n)});return this}else if(this._isStreamInput())return new Promise((r,n)=>{this._whenStreamInFinished(()=>{this._flattenBufferIn(),Be.metadata(this.options,(s,i)=>{if(s)n(f.nativeError(s,t));else r(i)})})});else return new Promise((r,n)=>{Be.metadata(this.options,(s,i)=>{if(s)n(f.nativeError(s,t));else r(i)})})}function oV(e){let t=Error();if(f.fn(e)){if(this._isStreamInput())this._whenStreamInFinished(()=>{this._flattenBufferIn(),Be.stats(this.options,(r,n)=>{if(r)e(f.nativeError(r,t));else e(null,n)})});else Be.stats(this.options,(r,n)=>{if(r)e(f.nativeError(r,t));else e(null,n)});return this}else if(this._isStreamInput())return new Promise((r,n)=>{this._whenStreamInFinished(()=>{this._flattenBufferIn(),Be.stats(this.options,(s,i)=>{if(s)n(f.nativeError(s,t));else r(i)})})});else return new Promise((r,n)=>{Be.stats(this.options,(s,i)=>{if(s)n(f.nativeError(s,t));else r(i)})})}var Zq,Qq,NE=(e)=>{Object.assign(e.prototype,{_inputOptionsFromObject:OE,_createInputDescriptor:eV,_write:tV,_flattenBufferIn:rV,_isStreamInput:nV,_whenStreamInFinished:sV,metadata:iV,stats:oV}),e.align=Zq};var CE=M(()=>{Mn();sc();/*!
399
400
  Copyright 2013 Lovell Fuller and others.
400
401
  SPDX-License-Identifier: Apache-2.0
401
- */dq={left:"low",top:"low",low:"low",center:"centre",centre:"centre",right:"high",bottom:"high",high:"high"},pq=["failOn","limitInputPixels","limitInputChannels","unlimited","animated","autoOrient","density","ignoreIcc","page","pages","sequentialRead","jp2","openSlide","pdf","raw","svg","tiff","openSlideLevel","pdfBackground","tiffSubifd"]});function _h(e){return e.angle%360!==0||e.rotationAngle!==0}function jf(e){return e.width!==-1||e.height!==-1}function Sq(e,t,r){if(jf(this.options))this.options.debuglog("ignoring previous resize options");if(this.options.widthPost!==-1)this.options.debuglog("operation order will be: extract, resize, extract");if(f.defined(e))if(f.object(e)&&!f.defined(r))r=e;else if(f.integer(e)&&f.inRange(e,1,1e8))this.options.width=e;else throw f.invalidParameterError("width","positive integer between 1 and 100000000",e);else this.options.width=-1;if(f.defined(t))if(f.integer(t)&&f.inRange(t,1,1e8))this.options.height=t;else throw f.invalidParameterError("height","positive integer between 1 and 100000000",t);else this.options.height=-1;if(f.object(r)){if(f.defined(r.width))if(f.integer(r.width)&&f.inRange(r.width,1,1e8))this.options.width=r.width;else throw f.invalidParameterError("width","positive integer between 1 and 100000000",r.width);if(f.defined(r.height))if(f.integer(r.height)&&f.inRange(r.height,1,1e8))this.options.height=r.height;else throw f.invalidParameterError("height","positive integer between 1 and 100000000",r.height);if(f.defined(r.fit)){let n=vq[r.fit];if(f.string(n))this.options.canvas=n;else throw f.invalidParameterError("fit","valid fit",r.fit)}if(f.defined(r.position)){let n=f.integer(r.position)?r.position:mE[r.position]||pE[r.position]||dE[r.position];if(f.integer(n)&&(f.inRange(n,0,8)||f.inRange(n,16,17)))this.options.position=n;else throw f.invalidParameterError("position","valid position/gravity/strategy",r.position)}if(this._setBackgroundColourOption("resizeBackground",r.background),f.defined(r.kernel))if(f.string(kh[r.kernel]))this.options.kernel=kh[r.kernel];else throw f.invalidParameterError("kernel","valid kernel name",r.kernel);if(f.defined(r.withoutEnlargement))this._setBooleanOption("withoutEnlargement",r.withoutEnlargement);if(f.defined(r.withoutReduction))this._setBooleanOption("withoutReduction",r.withoutReduction);if(f.defined(r.fastShrinkOnLoad))this._setBooleanOption("fastShrinkOnLoad",r.fastShrinkOnLoad)}if(_h(this.options)&&jf(this.options))this.options.rotateBefore=!0;return this}function Eq(e){if(f.integer(e))if(f.inRange(e,1,1e8))this.options.extendTop=e,this.options.extendBottom=e,this.options.extendLeft=e,this.options.extendRight=e;else throw f.invalidParameterError("extend","integer between 1 and 100000000",e);else if(f.object(e)){if(f.defined(e.top))if(f.integer(e.top)&&f.inRange(e.top,0,1e8))this.options.extendTop=e.top;else throw f.invalidParameterError("top","integer between 0 and 100000000",e.top);if(f.defined(e.bottom))if(f.integer(e.bottom)&&f.inRange(e.bottom,0,1e8))this.options.extendBottom=e.bottom;else throw f.invalidParameterError("bottom","integer between 0 and 100000000",e.bottom);if(f.defined(e.left))if(f.integer(e.left)&&f.inRange(e.left,0,1e8))this.options.extendLeft=e.left;else throw f.invalidParameterError("left","integer between 0 and 100000000",e.left);if(f.defined(e.right))if(f.integer(e.right)&&f.inRange(e.right,0,1e8))this.options.extendRight=e.right;else throw f.invalidParameterError("right","integer between 0 and 100000000",e.right);if(this._setBackgroundColourOption("extendBackground",e.background),f.defined(e.extendWith))if(f.string(fE[e.extendWith]))this.options.extendWith=fE[e.extendWith];else throw f.invalidParameterError("extendWith","one of: background, copy, repeat, mirror",e.extendWith)}else throw f.invalidParameterError("extend","integer or object",e);return this}function jq(e){let t=jf(this.options)||this.options.widthPre!==-1?"Post":"Pre";if(this.options[`width${t}`]!==-1)this.options.debuglog("ignoring previous extract options");if(["left","top","width","height"].forEach(function(r){let n=e[r];if(f.integer(n)&&f.inRange(n,0,1e8))this.options[r+(r==="left"||r==="top"?"Offset":"")+t]=n;else throw f.invalidParameterError(r,"integer between 0 and 100000000",n)},this),_h(this.options)&&!jf(this.options)){if(this.options.widthPre===-1||this.options.widthPost===-1)this.options.rotateBefore=!0}if(this.options.input.autoOrient)this.options.orientBefore=!0;return this}function Pq(e){if(this.options.trimThreshold=10,f.defined(e))if(f.object(e)){if(f.defined(e.background))this._setBackgroundColourOption("trimBackground",e.background);if(f.defined(e.threshold))if(f.number(e.threshold)&&e.threshold>=0)this.options.trimThreshold=e.threshold;else throw f.invalidParameterError("threshold","positive number",e.threshold);if(f.defined(e.lineArt))this._setBooleanOption("trimLineArt",e.lineArt);if(f.defined(e.margin))if(f.integer(e.margin)&&f.inRange(e.margin,0,1e7))this.options.trimMargin=e.margin;else throw f.invalidParameterError("margin","integer between 0 and 10000000",e.margin)}else throw f.invalidParameterError("trim","object",e);if(_h(this.options))this.options.rotateBefore=!0;return this}var dE,pE,fE,mE,kh,wq,vq,hE=(e)=>{Object.assign(e.prototype,{resize:Sq,extend:Eq,extract:jq,trim:Pq}),e.gravity=dE,e.strategy=mE,e.kernel=kh,e.fit=wq,e.position=pE};var gE=D(()=>{Cn();/*!
402
+ */Zq={left:"low",top:"low",low:"low",center:"centre",centre:"centre",right:"high",bottom:"high",high:"high"},Qq=["failOn","limitInputPixels","limitInputChannels","unlimited","animated","autoOrient","density","ignoreIcc","page","pages","sequentialRead","jp2","openSlide","pdf","raw","svg","tiff","openSlideLevel","pdfBackground","tiffSubifd"]});function Gh(e){return e.angle%360!==0||e.rotationAngle!==0}function Lf(e){return e.width!==-1||e.height!==-1}function cV(e,t,r){if(Lf(this.options))this.options.debuglog("ignoring previous resize options");if(this.options.widthPost!==-1)this.options.debuglog("operation order will be: extract, resize, extract");if(f.defined(e))if(f.object(e)&&!f.defined(r))r=e;else if(f.integer(e)&&f.inRange(e,1,1e8))this.options.width=e;else throw f.invalidParameterError("width","positive integer between 1 and 100000000",e);else this.options.width=-1;if(f.defined(t))if(f.integer(t)&&f.inRange(t,1,1e8))this.options.height=t;else throw f.invalidParameterError("height","positive integer between 1 and 100000000",t);else this.options.height=-1;if(f.object(r)){if(f.defined(r.width))if(f.integer(r.width)&&f.inRange(r.width,1,1e8))this.options.width=r.width;else throw f.invalidParameterError("width","positive integer between 1 and 100000000",r.width);if(f.defined(r.height))if(f.integer(r.height)&&f.inRange(r.height,1,1e8))this.options.height=r.height;else throw f.invalidParameterError("height","positive integer between 1 and 100000000",r.height);if(f.defined(r.fit)){let n=lV[r.fit];if(f.string(n))this.options.canvas=n;else throw f.invalidParameterError("fit","valid fit",r.fit)}if(f.defined(r.position)){let n=f.integer(r.position)?r.position:ME[r.position]||JE[r.position]||IE[r.position];if(f.integer(n)&&(f.inRange(n,0,8)||f.inRange(n,16,17)))this.options.position=n;else throw f.invalidParameterError("position","valid position/gravity/strategy",r.position)}if(this._setBackgroundColourOption("resizeBackground",r.background),f.defined(r.kernel))if(f.string(zh[r.kernel]))this.options.kernel=zh[r.kernel];else throw f.invalidParameterError("kernel","valid kernel name",r.kernel);if(f.defined(r.withoutEnlargement))this._setBooleanOption("withoutEnlargement",r.withoutEnlargement);if(f.defined(r.withoutReduction))this._setBooleanOption("withoutReduction",r.withoutReduction);if(f.defined(r.fastShrinkOnLoad))this._setBooleanOption("fastShrinkOnLoad",r.fastShrinkOnLoad)}if(Gh(this.options)&&Lf(this.options))this.options.rotateBefore=!0;return this}function uV(e){if(f.integer(e))if(f.inRange(e,1,1e8))this.options.extendTop=e,this.options.extendBottom=e,this.options.extendLeft=e,this.options.extendRight=e;else throw f.invalidParameterError("extend","integer between 1 and 100000000",e);else if(f.object(e)){if(f.defined(e.top))if(f.integer(e.top)&&f.inRange(e.top,0,1e8))this.options.extendTop=e.top;else throw f.invalidParameterError("top","integer between 0 and 100000000",e.top);if(f.defined(e.bottom))if(f.integer(e.bottom)&&f.inRange(e.bottom,0,1e8))this.options.extendBottom=e.bottom;else throw f.invalidParameterError("bottom","integer between 0 and 100000000",e.bottom);if(f.defined(e.left))if(f.integer(e.left)&&f.inRange(e.left,0,1e8))this.options.extendLeft=e.left;else throw f.invalidParameterError("left","integer between 0 and 100000000",e.left);if(f.defined(e.right))if(f.integer(e.right)&&f.inRange(e.right,0,1e8))this.options.extendRight=e.right;else throw f.invalidParameterError("right","integer between 0 and 100000000",e.right);if(this._setBackgroundColourOption("extendBackground",e.background),f.defined(e.extendWith))if(f.string(TE[e.extendWith]))this.options.extendWith=TE[e.extendWith];else throw f.invalidParameterError("extendWith","one of: background, copy, repeat, mirror",e.extendWith)}else throw f.invalidParameterError("extend","integer or object",e);return this}function fV(e){let t=Lf(this.options)||this.options.widthPre!==-1?"Post":"Pre";if(this.options[`width${t}`]!==-1)this.options.debuglog("ignoring previous extract options");if(["left","top","width","height"].forEach(function(r){let n=e[r];if(f.integer(n)&&f.inRange(n,0,1e8))this.options[r+(r==="left"||r==="top"?"Offset":"")+t]=n;else throw f.invalidParameterError(r,"integer between 0 and 100000000",n)},this),Gh(this.options)&&!Lf(this.options)){if(this.options.widthPre===-1||this.options.widthPost===-1)this.options.rotateBefore=!0}if(this.options.input.autoOrient)this.options.orientBefore=!0;return this}function dV(e){if(this.options.trimThreshold=10,f.defined(e))if(f.object(e)){if(f.defined(e.background))this._setBackgroundColourOption("trimBackground",e.background);if(f.defined(e.threshold))if(f.number(e.threshold)&&e.threshold>=0)this.options.trimThreshold=e.threshold;else throw f.invalidParameterError("threshold","positive number",e.threshold);if(f.defined(e.lineArt))this._setBooleanOption("trimLineArt",e.lineArt);if(f.defined(e.margin))if(f.integer(e.margin)&&f.inRange(e.margin,0,1e7))this.options.trimMargin=e.margin;else throw f.invalidParameterError("margin","integer between 0 and 10000000",e.margin)}else throw f.invalidParameterError("trim","object",e);if(Gh(this.options))this.options.rotateBefore=!0;return this}var IE,JE,TE,ME,zh,aV,lV,DE=(e)=>{Object.assign(e.prototype,{resize:cV,extend:uV,extract:fV,trim:dV}),e.gravity=IE,e.strategy=ME,e.kernel=zh,e.fit=aV,e.position=JE};var LE=M(()=>{Mn();/*!
402
403
  Copyright 2013 Lovell Fuller and others.
403
404
  SPDX-License-Identifier: Apache-2.0
404
- */dE={center:0,centre:0,north:1,east:2,south:3,west:4,northeast:5,southeast:6,southwest:7,northwest:8},pE={top:1,right:2,bottom:3,left:4,"right top":5,"right bottom":6,"left bottom":7,"left top":8},fE={background:"background",copy:"copy",repeat:"repeat",mirror:"mirror"},mE={entropy:16,attention:17},kh={nearest:"nearest",linear:"linear",cubic:"cubic",mitchell:"mitchell",lanczos2:"lanczos2",lanczos3:"lanczos3",mks2013:"mks2013",mks2021:"mks2021"},wq={contain:"contain",cover:"cover",fill:"fill",inside:"inside",outside:"outside"},vq={contain:"embed",cover:"crop",fill:"ignore_aspect",inside:"max",outside:"min"}});function kq(e){if(!Array.isArray(e))throw f.invalidParameterError("images to composite","array",e);return this.options.composite=e.map((t)=>{if(!f.object(t))throw f.invalidParameterError("image to composite","object",t);let r=this._inputOptionsFromObject(t),n={input:this._createInputDescriptor(t.input,r,{allowStream:!1}),blend:"over",tile:!1,left:0,top:0,hasOffset:!1,gravity:0,premultiplied:!1};if(f.defined(t.blend))if(f.string(Ah[t.blend]))n.blend=Ah[t.blend];else throw f.invalidParameterError("blend","valid blend name",t.blend);if(f.defined(t.tile))if(f.bool(t.tile))n.tile=t.tile;else throw f.invalidParameterError("tile","boolean",t.tile);if(f.defined(t.left))if(f.integer(t.left)&&f.inRange(t.left,-1e8,1e8))n.left=t.left;else throw f.invalidParameterError("left","integer between -100000000 and 100000000",t.left);if(f.defined(t.top))if(f.integer(t.top)&&f.inRange(t.top,-1e8,1e8))n.top=t.top;else throw f.invalidParameterError("top","integer between -100000000 and 100000000",t.top);if(f.defined(t.top)!==f.defined(t.left))throw Error("Expected both left and top to be set");else n.hasOffset=f.integer(t.top)&&f.integer(t.left);if(f.defined(t.gravity))if(f.integer(t.gravity)&&f.inRange(t.gravity,0,8))n.gravity=t.gravity;else if(f.string(t.gravity)&&f.integer(this.constructor.gravity[t.gravity]))n.gravity=this.constructor.gravity[t.gravity];else throw f.invalidParameterError("gravity","valid gravity",t.gravity);if(f.defined(t.premultiplied))if(f.bool(t.premultiplied))n.premultiplied=t.premultiplied;else throw f.invalidParameterError("premultiplied","boolean",t.premultiplied);return n}),this}var Ah,yE=(e)=>{e.prototype.composite=kq,e.blend=Ah};var bE=D(()=>{Cn();/*!
405
+ */IE={center:0,centre:0,north:1,east:2,south:3,west:4,northeast:5,southeast:6,southwest:7,northwest:8},JE={top:1,right:2,bottom:3,left:4,"right top":5,"right bottom":6,"left bottom":7,"left top":8},TE={background:"background",copy:"copy",repeat:"repeat",mirror:"mirror"},ME={entropy:16,attention:17},zh={nearest:"nearest",linear:"linear",cubic:"cubic",mitchell:"mitchell",lanczos2:"lanczos2",lanczos3:"lanczos3",mks2013:"mks2013",mks2021:"mks2021"},aV={contain:"contain",cover:"cover",fill:"fill",inside:"inside",outside:"outside"},lV={contain:"embed",cover:"crop",fill:"ignore_aspect",inside:"max",outside:"min"}});function pV(e){if(!Array.isArray(e))throw f.invalidParameterError("images to composite","array",e);return this.options.composite=e.map((t)=>{if(!f.object(t))throw f.invalidParameterError("image to composite","object",t);let r=this._inputOptionsFromObject(t),n={input:this._createInputDescriptor(t.input,r,{allowStream:!1}),blend:"over",tile:!1,left:0,top:0,hasOffset:!1,gravity:0,premultiplied:!1};if(f.defined(t.blend))if(f.string(Kh[t.blend]))n.blend=Kh[t.blend];else throw f.invalidParameterError("blend","valid blend name",t.blend);if(f.defined(t.tile))if(f.bool(t.tile))n.tile=t.tile;else throw f.invalidParameterError("tile","boolean",t.tile);if(f.defined(t.left))if(f.integer(t.left)&&f.inRange(t.left,-1e8,1e8))n.left=t.left;else throw f.invalidParameterError("left","integer between -100000000 and 100000000",t.left);if(f.defined(t.top))if(f.integer(t.top)&&f.inRange(t.top,-1e8,1e8))n.top=t.top;else throw f.invalidParameterError("top","integer between -100000000 and 100000000",t.top);if(f.defined(t.top)!==f.defined(t.left))throw Error("Expected both left and top to be set");else n.hasOffset=f.integer(t.top)&&f.integer(t.left);if(f.defined(t.gravity))if(f.integer(t.gravity)&&f.inRange(t.gravity,0,8))n.gravity=t.gravity;else if(f.string(t.gravity)&&f.integer(this.constructor.gravity[t.gravity]))n.gravity=this.constructor.gravity[t.gravity];else throw f.invalidParameterError("gravity","valid gravity",t.gravity);if(f.defined(t.premultiplied))if(f.bool(t.premultiplied))n.premultiplied=t.premultiplied;else throw f.invalidParameterError("premultiplied","boolean",t.premultiplied);return n}),this}var Kh,FE=(e)=>{e.prototype.composite=pV,e.blend=Kh};var qE=M(()=>{Mn();/*!
405
406
  Copyright 2013 Lovell Fuller and others.
406
407
  SPDX-License-Identifier: Apache-2.0
407
- */Ah={clear:"clear",source:"source",over:"over",in:"in",out:"out",atop:"atop",dest:"dest","dest-over":"dest-over","dest-in":"dest-in","dest-out":"dest-out","dest-atop":"dest-atop",xor:"xor",add:"add",saturate:"saturate",multiply:"multiply",screen:"screen",overlay:"overlay",darken:"darken",lighten:"lighten","colour-dodge":"colour-dodge","color-dodge":"colour-dodge","colour-burn":"colour-burn","color-burn":"colour-burn","hard-light":"hard-light","soft-light":"soft-light",difference:"difference",exclusion:"exclusion"}});function _q(e,t){if(!f.defined(e))return this.autoOrient();if(this.options.angle||this.options.rotationAngle)this.options.debuglog("ignoring previous rotate options"),this.options.angle=0,this.options.rotationAngle=0;if(f.integer(e)&&!(e%90))this.options.angle=e;else if(f.number(e)){if(this.options.rotationAngle=e,f.object(t)&&t.background)this._setBackgroundColourOption("rotationBackground",t.background)}else throw f.invalidParameterError("angle","numeric",e);return this}function Aq(){return this.options.input.autoOrient=!0,this}function Rq(e){return this.options.flip=f.bool(e)?e:!0,this}function Oq(e){return this.options.flop=f.bool(e)?e:!0,this}function Cq(e,t){let n=Array.isArray(e)&&(e.length===4&&e.every(f.number)||e.length===2&&e.every((s)=>Array.isArray(s)&&s.length===2))?e.flat():[];if(n.length===4&&n.every(f.number))this.options.affineMatrix=n;else throw f.invalidParameterError("matrix","1x4 or 2x2 array",e);if(f.defined(t))if(f.object(t)){if(this._setBackgroundColourOption("affineBackground",t.background),f.defined(t.idx))if(f.number(t.idx))this.options.affineIdx=t.idx;else throw f.invalidParameterError("options.idx","number",t.idx);if(f.defined(t.idy))if(f.number(t.idy))this.options.affineIdy=t.idy;else throw f.invalidParameterError("options.idy","number",t.idy);if(f.defined(t.odx))if(f.number(t.odx))this.options.affineOdx=t.odx;else throw f.invalidParameterError("options.odx","number",t.odx);if(f.defined(t.ody))if(f.number(t.ody))this.options.affineOdy=t.ody;else throw f.invalidParameterError("options.ody","number",t.ody);if(f.defined(t.interpolator))if(f.inArray(t.interpolator,Object.values(this.constructor.interpolators)))this.options.affineInterpolator=t.interpolator;else throw f.invalidParameterError("options.interpolator","valid interpolator name",t.interpolator)}else throw f.invalidParameterError("options","object",t);return this}function Nq(e){if(f.plainObject(e)){if(f.number(e.sigma)&&f.inRange(e.sigma,0.000001,10))this.options.sharpenSigma=e.sigma;else throw f.invalidParameterError("options.sigma","number between 0.000001 and 10",e.sigma);if(f.defined(e.m1))if(f.number(e.m1)&&f.inRange(e.m1,0,1e6))this.options.sharpenM1=e.m1;else throw f.invalidParameterError("options.m1","number between 0 and 1000000",e.m1);if(f.defined(e.m2))if(f.number(e.m2)&&f.inRange(e.m2,0,1e6))this.options.sharpenM2=e.m2;else throw f.invalidParameterError("options.m2","number between 0 and 1000000",e.m2);if(f.defined(e.x1))if(f.number(e.x1)&&f.inRange(e.x1,0,1e6))this.options.sharpenX1=e.x1;else throw f.invalidParameterError("options.x1","number between 0 and 1000000",e.x1);if(f.defined(e.y2))if(f.number(e.y2)&&f.inRange(e.y2,0,1e6))this.options.sharpenY2=e.y2;else throw f.invalidParameterError("options.y2","number between 0 and 1000000",e.y2);if(f.defined(e.y3))if(f.number(e.y3)&&f.inRange(e.y3,0,1e6))this.options.sharpenY3=e.y3;else throw f.invalidParameterError("options.y3","number between 0 and 1000000",e.y3)}else this.options.sharpenSigma=-1;return this}function Tq(e){if(!f.defined(e))this.options.medianSize=3;else if(f.integer(e)&&f.inRange(e,1,1000))this.options.medianSize=e;else throw f.invalidParameterError("size","integer between 1 and 1000",e);return this}function Iq(e){let t;if(f.number(e))t=e;else if(f.plainObject(e)){if(!f.number(e.sigma))throw f.invalidParameterError("options.sigma","number between 0.3 and 1000",t);if(t=e.sigma,"precision"in e)if(f.string(xE[e.precision]))this.options.precision=xE[e.precision];else throw f.invalidParameterError("precision","one of: integer, float, approximate",e.precision);if("minAmplitude"in e)if(f.number(e.minAmplitude)&&f.inRange(e.minAmplitude,0.001,1))this.options.minAmpl=e.minAmplitude;else throw f.invalidParameterError("minAmplitude","number between 0.001 and 1",e.minAmplitude)}if(!f.defined(e))this.options.blurSigma=-1;else if(f.bool(e))this.options.blurSigma=e?-1:0;else if(f.number(t)&&f.inRange(t,0.3,1000))this.options.blurSigma=t;else throw f.invalidParameterError("sigma","number between 0.3 and 1000",t);return this}function Jq(e){if(!f.defined(e))this.options.dilateWidth=1;else if(f.integer(e)&&f.inRange(e,1,65536))this.options.dilateWidth=e;else throw f.invalidParameterError("width","integer between 1 and 65536",e);return this}function Mq(e){if(!f.defined(e))this.options.erodeWidth=1;else if(f.integer(e)&&f.inRange(e,1,65536))this.options.erodeWidth=e;else throw f.invalidParameterError("width","integer between 1 and 65536",e);return this}function Dq(e){if(this.options.flatten=f.bool(e)?e:!0,f.object(e))this._setBackgroundColourOption("flattenBackground",e.background);return this}function Lq(){return this.options.unflatten=!0,this}function Fq(e,t){if(!f.defined(e))this.options.gamma=2.2;else if(f.number(e)&&f.inRange(e,1,3))this.options.gamma=e;else throw f.invalidParameterError("gamma","number between 1.0 and 3.0",e);if(!f.defined(t))this.options.gammaOut=this.options.gamma;else if(f.number(t)&&f.inRange(t,1,3))this.options.gammaOut=t;else throw f.invalidParameterError("gammaOut","number between 1.0 and 3.0",t);return this}function qq(e){if(this.options.negate=f.bool(e)?e:!0,f.plainObject(e)&&"alpha"in e)if(!f.bool(e.alpha))throw f.invalidParameterError("alpha","should be boolean value",e.alpha);else this.options.negateAlpha=e.alpha;return this}function Vq(e){if(f.plainObject(e)){if(f.defined(e.lower))if(f.number(e.lower)&&f.inRange(e.lower,0,99))this.options.normaliseLower=e.lower;else throw f.invalidParameterError("lower","number between 0 and 99",e.lower);if(f.defined(e.upper))if(f.number(e.upper)&&f.inRange(e.upper,1,100))this.options.normaliseUpper=e.upper;else throw f.invalidParameterError("upper","number between 1 and 100",e.upper)}if(this.options.normaliseLower>=this.options.normaliseUpper)throw f.invalidParameterError("range","lower to be less than upper",`${this.options.normaliseLower} >= ${this.options.normaliseUpper}`);return this.options.normalise=!0,this}function Wq(e){return this.normalise(e)}function Bq(e){if(f.plainObject(e)){if(f.integer(e.width)&&f.inRange(e.width,1,65536))this.options.claheWidth=e.width;else throw f.invalidParameterError("width","integer between 1 and 65536",e.width);if(f.integer(e.height)&&f.inRange(e.height,1,65536))this.options.claheHeight=e.height;else throw f.invalidParameterError("height","integer between 1 and 65536",e.height);if(f.defined(e.maxSlope))if(f.integer(e.maxSlope)&&f.inRange(e.maxSlope,0,100))this.options.claheMaxSlope=e.maxSlope;else throw f.invalidParameterError("maxSlope","integer between 0 and 100",e.maxSlope)}else throw f.invalidParameterError("options","plain object",e);return this}function Hq(e){if(!f.object(e)||!Array.isArray(e.kernel)||!f.integer(e.width)||!f.integer(e.height)||!f.inRange(e.width,3,1001)||!f.inRange(e.height,3,1001)||e.height*e.width!==e.kernel.length||!e.kernel.every(f.number))throw Error("Invalid convolution kernel");if(!f.integer(e.scale))e.scale=e.kernel.reduce((t,r)=>t+r,0);if(e.scale<1)e.scale=1;if(!f.integer(e.offset))e.offset=0;return this.options.convKernel=e,this}function Uq(e,t){if(!f.defined(e))this.options.threshold=128;else if(f.bool(e))this.options.threshold=e?128:0;else if(f.integer(e)&&f.inRange(e,0,255))this.options.threshold=e;else throw f.invalidParameterError("threshold","integer between 0 and 255",e);if(!f.object(t)||t.greyscale===!0||t.grayscale===!0)this.options.thresholdGrayscale=!0;else this.options.thresholdGrayscale=!1;return this}function zq(e,t,r){if(this.options.boolean=this._createInputDescriptor(e,r),f.string(t)&&f.inArray(t,["and","or","eor"]))this.options.booleanOp=t;else throw f.invalidParameterError("operator","one of: and, or, eor",t);return this}function Gq(e,t){if(!f.defined(e)&&f.number(t))e=1;else if(f.number(e)&&!f.defined(t))t=0;if(!f.defined(e))this.options.linearA=[];else if(f.number(e))this.options.linearA=[e];else if(Array.isArray(e)&&f.inRange(e.length,1,1e6)&&e.every(f.number))this.options.linearA=e;else throw f.invalidParameterError("a","number or array of numbers",e);if(!f.defined(t))this.options.linearB=[];else if(f.number(t))this.options.linearB=[t];else if(Array.isArray(t)&&f.inRange(t.length,1,1e6)&&t.every(f.number))this.options.linearB=t;else throw f.invalidParameterError("b","number or array of numbers",t);if(this.options.linearA.length!==this.options.linearB.length)throw Error("Expected a and b to be arrays of the same length");return this}function Kq(e){if(!Array.isArray(e))throw f.invalidParameterError("inputMatrix","array",e);let t=e.length;if(t!==3&&t!==4)throw f.invalidParameterError("inputMatrix","3x3 or 4x4 array",t);if(!e.every((n)=>Array.isArray(n)&&n.length===t))throw f.invalidParameterError("inputMatrix",`array of ${t} arrays of length ${t}`,e);let r=e.flat();if(!r.every(f.number))throw f.invalidParameterError("inputMatrix","array of numbers",r);return this.options.recombMatrix=r,this}function Yq(e){if(!f.plainObject(e))throw f.invalidParameterError("options","plain object",e);if("brightness"in e)if(f.number(e.brightness)&&e.brightness>=0)this.options.brightness=e.brightness;else throw f.invalidParameterError("brightness","number above zero",e.brightness);if("saturation"in e)if(f.number(e.saturation)&&e.saturation>=0)this.options.saturation=e.saturation;else throw f.invalidParameterError("saturation","number above zero",e.saturation);if("hue"in e)if(f.integer(e.hue))this.options.hue=e.hue%360;else throw f.invalidParameterError("hue","number",e.hue);if("lightness"in e)if(f.number(e.lightness))this.options.lightness=e.lightness;else throw f.invalidParameterError("lightness","number",e.lightness);return this}var xE,$E=(e)=>{Object.assign(e.prototype,{autoOrient:Aq,rotate:_q,flip:Rq,flop:Oq,affine:Cq,sharpen:Nq,erode:Mq,dilate:Jq,median:Tq,blur:Iq,flatten:Dq,unflatten:Lq,gamma:Fq,negate:qq,normalise:Vq,normalize:Wq,clahe:Bq,convolve:Hq,threshold:Uq,boolean:zq,linear:Gq,recomb:Kq,modulate:Yq})};var wE=D(()=>{Cn();/*!
408
+ */Kh={clear:"clear",source:"source",over:"over",in:"in",out:"out",atop:"atop",dest:"dest","dest-over":"dest-over","dest-in":"dest-in","dest-out":"dest-out","dest-atop":"dest-atop",xor:"xor",add:"add",saturate:"saturate",multiply:"multiply",screen:"screen",overlay:"overlay",darken:"darken",lighten:"lighten","colour-dodge":"colour-dodge","color-dodge":"colour-dodge","colour-burn":"colour-burn","color-burn":"colour-burn","hard-light":"hard-light","soft-light":"soft-light",difference:"difference",exclusion:"exclusion"}});function mV(e,t){if(!f.defined(e))return this.autoOrient();if(this.options.angle||this.options.rotationAngle)this.options.debuglog("ignoring previous rotate options"),this.options.angle=0,this.options.rotationAngle=0;if(f.integer(e)&&!(e%90))this.options.angle=e;else if(f.number(e)){if(this.options.rotationAngle=e,f.object(t)&&t.background)this._setBackgroundColourOption("rotationBackground",t.background)}else throw f.invalidParameterError("angle","numeric",e);return this}function hV(){return this.options.input.autoOrient=!0,this}function gV(e){return this.options.flip=f.bool(e)?e:!0,this}function yV(e){return this.options.flop=f.bool(e)?e:!0,this}function bV(e,t){let n=Array.isArray(e)&&(e.length===4&&e.every(f.number)||e.length===2&&e.every((s)=>Array.isArray(s)&&s.length===2))?e.flat():[];if(n.length===4&&n.every(f.number))this.options.affineMatrix=n;else throw f.invalidParameterError("matrix","1x4 or 2x2 array",e);if(f.defined(t))if(f.object(t)){if(this._setBackgroundColourOption("affineBackground",t.background),f.defined(t.idx))if(f.number(t.idx))this.options.affineIdx=t.idx;else throw f.invalidParameterError("options.idx","number",t.idx);if(f.defined(t.idy))if(f.number(t.idy))this.options.affineIdy=t.idy;else throw f.invalidParameterError("options.idy","number",t.idy);if(f.defined(t.odx))if(f.number(t.odx))this.options.affineOdx=t.odx;else throw f.invalidParameterError("options.odx","number",t.odx);if(f.defined(t.ody))if(f.number(t.ody))this.options.affineOdy=t.ody;else throw f.invalidParameterError("options.ody","number",t.ody);if(f.defined(t.interpolator))if(f.inArray(t.interpolator,Object.values(this.constructor.interpolators)))this.options.affineInterpolator=t.interpolator;else throw f.invalidParameterError("options.interpolator","valid interpolator name",t.interpolator)}else throw f.invalidParameterError("options","object",t);return this}function xV(e){if(f.plainObject(e)){if(f.number(e.sigma)&&f.inRange(e.sigma,0.000001,10))this.options.sharpenSigma=e.sigma;else throw f.invalidParameterError("options.sigma","number between 0.000001 and 10",e.sigma);if(f.defined(e.m1))if(f.number(e.m1)&&f.inRange(e.m1,0,1e6))this.options.sharpenM1=e.m1;else throw f.invalidParameterError("options.m1","number between 0 and 1000000",e.m1);if(f.defined(e.m2))if(f.number(e.m2)&&f.inRange(e.m2,0,1e6))this.options.sharpenM2=e.m2;else throw f.invalidParameterError("options.m2","number between 0 and 1000000",e.m2);if(f.defined(e.x1))if(f.number(e.x1)&&f.inRange(e.x1,0,1e6))this.options.sharpenX1=e.x1;else throw f.invalidParameterError("options.x1","number between 0 and 1000000",e.x1);if(f.defined(e.y2))if(f.number(e.y2)&&f.inRange(e.y2,0,1e6))this.options.sharpenY2=e.y2;else throw f.invalidParameterError("options.y2","number between 0 and 1000000",e.y2);if(f.defined(e.y3))if(f.number(e.y3)&&f.inRange(e.y3,0,1e6))this.options.sharpenY3=e.y3;else throw f.invalidParameterError("options.y3","number between 0 and 1000000",e.y3)}else this.options.sharpenSigma=-1;return this}function $V(e){if(!f.defined(e))this.options.medianSize=3;else if(f.integer(e)&&f.inRange(e,1,1000))this.options.medianSize=e;else throw f.invalidParameterError("size","integer between 1 and 1000",e);return this}function wV(e){let t;if(f.number(e))t=e;else if(f.plainObject(e)){if(!f.number(e.sigma))throw f.invalidParameterError("options.sigma","number between 0.3 and 1000",t);if(t=e.sigma,"precision"in e)if(f.string(VE[e.precision]))this.options.precision=VE[e.precision];else throw f.invalidParameterError("precision","one of: integer, float, approximate",e.precision);if("minAmplitude"in e)if(f.number(e.minAmplitude)&&f.inRange(e.minAmplitude,0.001,1))this.options.minAmpl=e.minAmplitude;else throw f.invalidParameterError("minAmplitude","number between 0.001 and 1",e.minAmplitude)}if(!f.defined(e))this.options.blurSigma=-1;else if(f.bool(e))this.options.blurSigma=e?-1:0;else if(f.number(t)&&f.inRange(t,0.3,1000))this.options.blurSigma=t;else throw f.invalidParameterError("sigma","number between 0.3 and 1000",t);return this}function vV(e){if(!f.defined(e))this.options.dilateWidth=1;else if(f.integer(e)&&f.inRange(e,1,65536))this.options.dilateWidth=e;else throw f.invalidParameterError("width","integer between 1 and 65536",e);return this}function SV(e){if(!f.defined(e))this.options.erodeWidth=1;else if(f.integer(e)&&f.inRange(e,1,65536))this.options.erodeWidth=e;else throw f.invalidParameterError("width","integer between 1 and 65536",e);return this}function EV(e){if(this.options.flatten=f.bool(e)?e:!0,f.object(e))this._setBackgroundColourOption("flattenBackground",e.background);return this}function PV(){return this.options.unflatten=!0,this}function jV(e,t){if(!f.defined(e))this.options.gamma=2.2;else if(f.number(e)&&f.inRange(e,1,3))this.options.gamma=e;else throw f.invalidParameterError("gamma","number between 1.0 and 3.0",e);if(!f.defined(t))this.options.gammaOut=this.options.gamma;else if(f.number(t)&&f.inRange(t,1,3))this.options.gammaOut=t;else throw f.invalidParameterError("gammaOut","number between 1.0 and 3.0",t);return this}function kV(e){if(this.options.negate=f.bool(e)?e:!0,f.plainObject(e)&&"alpha"in e)if(!f.bool(e.alpha))throw f.invalidParameterError("alpha","should be boolean value",e.alpha);else this.options.negateAlpha=e.alpha;return this}function _V(e){if(f.plainObject(e)){if(f.defined(e.lower))if(f.number(e.lower)&&f.inRange(e.lower,0,99))this.options.normaliseLower=e.lower;else throw f.invalidParameterError("lower","number between 0 and 99",e.lower);if(f.defined(e.upper))if(f.number(e.upper)&&f.inRange(e.upper,1,100))this.options.normaliseUpper=e.upper;else throw f.invalidParameterError("upper","number between 1 and 100",e.upper)}if(this.options.normaliseLower>=this.options.normaliseUpper)throw f.invalidParameterError("range","lower to be less than upper",`${this.options.normaliseLower} >= ${this.options.normaliseUpper}`);return this.options.normalise=!0,this}function AV(e){return this.normalise(e)}function RV(e){if(f.plainObject(e)){if(f.integer(e.width)&&f.inRange(e.width,1,65536))this.options.claheWidth=e.width;else throw f.invalidParameterError("width","integer between 1 and 65536",e.width);if(f.integer(e.height)&&f.inRange(e.height,1,65536))this.options.claheHeight=e.height;else throw f.invalidParameterError("height","integer between 1 and 65536",e.height);if(f.defined(e.maxSlope))if(f.integer(e.maxSlope)&&f.inRange(e.maxSlope,0,100))this.options.claheMaxSlope=e.maxSlope;else throw f.invalidParameterError("maxSlope","integer between 0 and 100",e.maxSlope)}else throw f.invalidParameterError("options","plain object",e);return this}function OV(e){if(!f.object(e)||!Array.isArray(e.kernel)||!f.integer(e.width)||!f.integer(e.height)||!f.inRange(e.width,3,1001)||!f.inRange(e.height,3,1001)||e.height*e.width!==e.kernel.length||!e.kernel.every(f.number))throw Error("Invalid convolution kernel");if(!f.integer(e.scale))e.scale=e.kernel.reduce((t,r)=>t+r,0);if(e.scale<1)e.scale=1;if(!f.integer(e.offset))e.offset=0;return this.options.convKernel=e,this}function NV(e,t){if(!f.defined(e))this.options.threshold=128;else if(f.bool(e))this.options.threshold=e?128:0;else if(f.integer(e)&&f.inRange(e,0,255))this.options.threshold=e;else throw f.invalidParameterError("threshold","integer between 0 and 255",e);if(!f.object(t)||t.greyscale===!0||t.grayscale===!0)this.options.thresholdGrayscale=!0;else this.options.thresholdGrayscale=!1;return this}function CV(e,t,r){if(this.options.boolean=this._createInputDescriptor(e,r),f.string(t)&&f.inArray(t,["and","or","eor"]))this.options.booleanOp=t;else throw f.invalidParameterError("operator","one of: and, or, eor",t);return this}function TV(e,t){if(!f.defined(e)&&f.number(t))e=1;else if(f.number(e)&&!f.defined(t))t=0;if(!f.defined(e))this.options.linearA=[];else if(f.number(e))this.options.linearA=[e];else if(Array.isArray(e)&&f.inRange(e.length,1,1e6)&&e.every(f.number))this.options.linearA=e;else throw f.invalidParameterError("a","number or array of numbers",e);if(!f.defined(t))this.options.linearB=[];else if(f.number(t))this.options.linearB=[t];else if(Array.isArray(t)&&f.inRange(t.length,1,1e6)&&t.every(f.number))this.options.linearB=t;else throw f.invalidParameterError("b","number or array of numbers",t);if(this.options.linearA.length!==this.options.linearB.length)throw Error("Expected a and b to be arrays of the same length");return this}function IV(e){if(!Array.isArray(e))throw f.invalidParameterError("inputMatrix","array",e);let t=e.length;if(t!==3&&t!==4)throw f.invalidParameterError("inputMatrix","3x3 or 4x4 array",t);if(!e.every((n)=>Array.isArray(n)&&n.length===t))throw f.invalidParameterError("inputMatrix",`array of ${t} arrays of length ${t}`,e);let r=e.flat();if(!r.every(f.number))throw f.invalidParameterError("inputMatrix","array of numbers",r);return this.options.recombMatrix=r,this}function JV(e){if(!f.plainObject(e))throw f.invalidParameterError("options","plain object",e);if("brightness"in e)if(f.number(e.brightness)&&e.brightness>=0)this.options.brightness=e.brightness;else throw f.invalidParameterError("brightness","number above zero",e.brightness);if("saturation"in e)if(f.number(e.saturation)&&e.saturation>=0)this.options.saturation=e.saturation;else throw f.invalidParameterError("saturation","number above zero",e.saturation);if("hue"in e)if(f.integer(e.hue))this.options.hue=e.hue%360;else throw f.invalidParameterError("hue","number",e.hue);if("lightness"in e)if(f.number(e.lightness))this.options.lightness=e.lightness;else throw f.invalidParameterError("lightness","number",e.lightness);return this}var VE,BE=(e)=>{Object.assign(e.prototype,{autoOrient:hV,rotate:mV,flip:gV,flop:yV,affine:bV,sharpen:xV,erode:SV,dilate:vV,median:$V,blur:wV,flatten:EV,unflatten:PV,gamma:jV,negate:kV,normalise:_V,normalize:AV,clahe:RV,convolve:OV,threshold:NV,boolean:CV,linear:TV,recomb:IV,modulate:JV})};var WE=M(()=>{Mn();/*!
408
409
  Copyright 2013 Lovell Fuller and others.
409
410
  SPDX-License-Identifier: Apache-2.0
410
- */xE={integer:"integer",float:"float",approximate:"approximate"}});var kE=N(function(cse,PE){var{defineProperty:Th,getOwnPropertyDescriptor:Xq,getOwnPropertyNames:Zq}=Object,Qq=Object.prototype.hasOwnProperty,eV=(e,t)=>{for(var r in t)Th(e,r,{get:t[r],enumerable:!0})},tV=(e,t,r,n)=>{if(t&&typeof t==="object"||typeof t==="function"){for(let s of Zq(t))if(!Qq.call(e,s)&&s!==r)Th(e,s,{get:()=>t[s],enumerable:!(n=Xq(t,s))||n.enumerable})}return e},rV=(e)=>tV(Th({},"__esModule",{value:!0}),e),vE={};eV(vE,{default:()=>gV});PE.exports=rV(vE);var Rh={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};for(let e in Rh)Object.freeze(Rh[e]);var Dn=Object.freeze(Rh),SE=Object.create(null);for(let e in Dn)if(Object.hasOwn(Dn,e))SE[Dn[e]]=e;var kr={to:{},get:{}};kr.get=function(e){let t=e.slice(0,3).toLowerCase(),r,n;switch(t){case"hsl":{r=kr.get.hsl(e),n="hsl";break}case"hwb":{r=kr.get.hwb(e),n="hwb";break}default:{r=kr.get.rgb(e),n="rgb";break}}if(!r)return null;return{model:n,value:r}};kr.get.rgb=function(e){if(!e)return null;let t=/^#([a-f\d]{3,4})$/i,r=/^#([a-f\d]{6})([a-f\d]{2})?$/i,n=/^rgba?\(\s*([+-]?(?:\d*\.)?\d+(?:e\d+)?)(?=[\s,])\s*(?:,\s*)?([+-]?(?:\d*\.)?\d+(?:e\d+)?)(?=[\s,])\s*(?:,\s*)?([+-]?(?:\d*\.)?\d+(?:e\d+)?)\s*(?:[\s,|/]\s*([+-]?(?:\d*\.)?\d+(?:e\d+)?)(%?)\s*)?\)$/i,s=/^rgba?\(\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[\s,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/i,i=/^(\w+)$/,o=[0,0,0,1],a,l,c;if(a=e.match(r)){c=a[2],a=a[1];for(l=0;l<3;l++){let u=l*2;o[l]=Number.parseInt(a.slice(u,u+2),16)}if(c)o[3]=Number.parseInt(c,16)/255}else if(a=e.match(t)){a=a[1],c=a[3];for(l=0;l<3;l++)o[l]=Number.parseInt(a[l]+a[l],16);if(c)o[3]=Number.parseInt(c+c,16)/255}else if(a=e.match(n)){for(l=0;l<3;l++)o[l]=Number.parseFloat(a[l+1]);if(a[4])o[3]=a[5]?Number.parseFloat(a[4])*0.01:Number.parseFloat(a[4])}else if(a=e.match(s)){for(l=0;l<3;l++)o[l]=Math.round(Number.parseFloat(a[l+1])*2.55);if(a[4])o[3]=a[5]?Number.parseFloat(a[4])*0.01:Number.parseFloat(a[4])}else if(a=e.toLowerCase().match(i)){if(a[1]==="transparent")return[0,0,0,0];if(!Object.hasOwn(Dn,a[1]))return null;return o=Dn[a[1]].slice(),o[3]=1,o}else return null;for(l=0;l<3;l++)o[l]=ri(o[l],0,255);return o[3]=ri(o[3],0,1),o};kr.get.hsl=function(e){if(!e)return null;let t=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[,|/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:e[+-]?\d+)?)\s*)?\)$/i,r=e.match(t);if(r){let n=Number.parseFloat(r[4]),s=(Number.parseFloat(r[1])%360+360)%360,i=ri(Number.parseFloat(r[2]),0,100),o=ri(Number.parseFloat(r[3]),0,100),a=ri(Number.isNaN(n)?1:n,0,1);return[s,i,o,a]}return null};kr.get.hwb=function(e){if(!e)return null;let t=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*[\s,]\s*([+-]?[\d.]+)%\s*[\s,]\s*([+-]?[\d.]+)%\s*(?:[\s,]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:e[+-]?\d+)?)\s*)?\)$/i,r=e.match(t);if(r){let n=Number.parseFloat(r[4]),s=(Number.parseFloat(r[1])%360+360)%360,i=ri(Number.parseFloat(r[2]),0,100),o=ri(Number.parseFloat(r[3]),0,100),a=ri(Number.isNaN(n)?1:n,0,1);return[s,i,o,a]}return null};kr.to.hex=function(...e){return"#"+Pf(e[0])+Pf(e[1])+Pf(e[2])+(e[3]<1?Pf(Math.round(e[3]*255)):"")};kr.to.rgb=function(...e){return e.length<4||e[3]===1?"rgb("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+")":"rgba("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+", "+e[3]+")"};kr.to.rgb.percent=function(...e){let t=Math.round(e[0]/255*100),r=Math.round(e[1]/255*100),n=Math.round(e[2]/255*100);return e.length<4||e[3]===1?"rgb("+t+"%, "+r+"%, "+n+"%)":"rgba("+t+"%, "+r+"%, "+n+"%, "+e[3]+")"};kr.to.hsl=function(...e){return e.length<4||e[3]===1?"hsl("+e[0]+", "+e[1]+"%, "+e[2]+"%)":"hsla("+e[0]+", "+e[1]+"%, "+e[2]+"%, "+e[3]+")"};kr.to.hwb=function(...e){let t="";if(e.length>=4&&e[3]!==1)t=", "+e[3];return"hwb("+e[0]+", "+e[1]+"%, "+e[2]+"%"+t+")"};kr.to.keyword=function(...e){return SE[e.slice(0,3)]};function ri(e,t,r){return Math.min(Math.max(t,e),r)}function Pf(e){let t=Math.round(e).toString(16).toUpperCase();return t.length<2?"0"+t:t}var ga=kr,EE={};for(let e of Object.keys(Dn))EE[Dn[e]]=e;var Q={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},oklab:{channels:3,labels:["okl","oka","okb"]},lch:{channels:3,labels:"lch"},oklch:{channels:3,labels:["okl","okc","okh"]},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}},lo=Q,Os=0.008856451679035631;function ba(e){let t=e>0.0031308?1.055*e**0.4166666666666667-0.055:e*12.92;return Math.min(Math.max(0,t),1)}function xa(e){return e>0.04045?((e+0.055)/1.055)**2.4:e/12.92}for(let e of Object.keys(Q)){if(!("channels"in Q[e]))throw Error("missing channels property: "+e);if(!("labels"in Q[e]))throw Error("missing channel labels property: "+e);if(Q[e].labels.length!==Q[e].channels)throw Error("channel and label counts mismatch: "+e);let{channels:t,labels:r}=Q[e];delete Q[e].channels,delete Q[e].labels,Object.defineProperty(Q[e],"channels",{value:t}),Object.defineProperty(Q[e],"labels",{value:r})}Q.rgb.hsl=function(e){let t=e[0]/255,r=e[1]/255,n=e[2]/255,s=Math.min(t,r,n),i=Math.max(t,r,n),o=i-s,a,l;switch(i){case s:{a=0;break}case t:{a=(r-n)/o;break}case r:{a=2+(n-t)/o;break}case n:{a=4+(t-r)/o;break}}if(a=Math.min(a*60,360),a<0)a+=360;let c=(s+i)/2;if(i===s)l=0;else if(c<=0.5)l=o/(i+s);else l=o/(2-i-s);return[a,l*100,c*100]};Q.rgb.hsv=function(e){let t,r,n,s,i,o=e[0]/255,a=e[1]/255,l=e[2]/255,c=Math.max(o,a,l),u=c-Math.min(o,a,l),p=function(h){return(c-h)/6/u+0.5};if(u===0)s=0,i=0;else{switch(i=u/c,t=p(o),r=p(a),n=p(l),c){case o:{s=n-r;break}case a:{s=0.3333333333333333+t-n;break}case l:{s=0.6666666666666666+r-t;break}}if(s<0)s+=1;else if(s>1)s-=1}return[s*360,i*100,c*100]};Q.rgb.hwb=function(e){let t=e[0],r=e[1],n=e[2],s=Q.rgb.hsl(e)[0],i=0.00392156862745098*Math.min(t,Math.min(r,n));return n=1-0.00392156862745098*Math.max(t,Math.max(r,n)),[s,i*100,n*100]};Q.rgb.oklab=function(e){let t=xa(e[0]/255),r=xa(e[1]/255),n=xa(e[2]/255),s=Math.cbrt(0.4122214708*t+0.5363325363*r+0.0514459929*n),i=Math.cbrt(0.2119034982*t+0.6806995451*r+0.1073969566*n),o=Math.cbrt(0.0883024619*t+0.2817188376*r+0.6299787005*n),a=0.2104542553*s+0.793617785*i-0.0040720468*o,l=1.9779984951*s-2.428592205*i+0.4505937099*o,c=0.0259040371*s+0.7827717662*i-0.808675766*o;return[a*100,l*100,c*100]};Q.rgb.cmyk=function(e){let t=e[0]/255,r=e[1]/255,n=e[2]/255,s=Math.min(1-t,1-r,1-n),i=(1-t-s)/(1-s)||0,o=(1-r-s)/(1-s)||0,a=(1-n-s)/(1-s)||0;return[i*100,o*100,a*100,s*100]};function nV(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}Q.rgb.keyword=function(e){let t=EE[e];if(t)return t;let r=Number.POSITIVE_INFINITY,n;for(let s of Object.keys(Dn)){let i=Dn[s],o=nV(e,i);if(o<r)r=o,n=s}return n};Q.keyword.rgb=function(e){return[...Dn[e]]};Q.rgb.xyz=function(e){let t=xa(e[0]/255),r=xa(e[1]/255),n=xa(e[2]/255),s=t*0.4124564+r*0.3575761+n*0.1804375,i=t*0.2126729+r*0.7151522+n*0.072175,o=t*0.0193339+r*0.119192+n*0.9503041;return[s*100,i*100,o*100]};Q.rgb.lab=function(e){let t=Q.rgb.xyz(e),r=t[0],n=t[1],s=t[2];r/=95.047,n/=100,s/=108.883,r=r>Os?r**0.3333333333333333:7.787*r+0.13793103448275862,n=n>Os?n**0.3333333333333333:7.787*n+0.13793103448275862,s=s>Os?s**0.3333333333333333:7.787*s+0.13793103448275862;let i=116*n-16,o=500*(r-n),a=200*(n-s);return[i,o,a]};Q.hsl.rgb=function(e){let t=e[0]/360,r=e[1]/100,n=e[2]/100,s,i;if(r===0)return i=n*255,[i,i,i];let o=n<0.5?n*(1+r):n+r-n*r,a=2*n-o,l=[0,0,0];for(let c=0;c<3;c++){if(s=t+0.3333333333333333*-(c-1),s<0)s++;if(s>1)s--;if(6*s<1)i=a+(o-a)*6*s;else if(2*s<1)i=o;else if(3*s<2)i=a+(o-a)*(0.6666666666666666-s)*6;else i=a;l[c]=i*255}return l};Q.hsl.hsv=function(e){let t=e[0],r=e[1]/100,n=e[2]/100,s=r,i=Math.max(n,0.01);n*=2,r*=n<=1?n:2-n,s*=i<=1?i:2-i;let o=(n+r)/2,a=n===0?2*s/(i+s):2*r/(n+r);return[t,a*100,o*100]};Q.hsv.rgb=function(e){let t=e[0]/60,r=e[1]/100,n=e[2]/100,s=Math.floor(t)%6,i=t-Math.floor(t),o=255*n*(1-r),a=255*n*(1-r*i),l=255*n*(1-r*(1-i));switch(n*=255,s){case 0:return[n,l,o];case 1:return[a,n,o];case 2:return[o,n,l];case 3:return[o,a,n];case 4:return[l,o,n];case 5:return[n,o,a]}};Q.hsv.hsl=function(e){let t=e[0],r=e[1]/100,n=e[2]/100,s=Math.max(n,0.01),i,o;o=(2-r)*n;let a=(2-r)*s;return i=r*s,i/=a<=1?a:2-a,i=i||0,o/=2,[t,i*100,o*100]};Q.hwb.rgb=function(e){let t=e[0]/360,r=e[1]/100,n=e[2]/100,s=r+n,i;if(s>1)r/=s,n/=s;let o=Math.floor(6*t),a=1-n;if(i=6*t-o,(o&1)!==0)i=1-i;let l=r+i*(a-r),c,u,p;switch(o){default:case 6:case 0:{c=a,u=l,p=r;break}case 1:{c=l,u=a,p=r;break}case 2:{c=r,u=a,p=l;break}case 3:{c=r,u=l,p=a;break}case 4:{c=l,u=r,p=a;break}case 5:{c=a,u=r,p=l;break}}return[c*255,u*255,p*255]};Q.cmyk.rgb=function(e){let t=e[0]/100,r=e[1]/100,n=e[2]/100,s=e[3]/100,i=1-Math.min(1,t*(1-s)+s),o=1-Math.min(1,r*(1-s)+s),a=1-Math.min(1,n*(1-s)+s);return[i*255,o*255,a*255]};Q.xyz.rgb=function(e){let t=e[0]/100,r=e[1]/100,n=e[2]/100,s,i,o;return s=t*3.2404542+r*-1.5371385+n*-0.4985314,i=t*-0.969266+r*1.8760108+n*0.041556,o=t*0.0556434+r*-0.2040259+n*1.0572252,s=ba(s),i=ba(i),o=ba(o),[s*255,i*255,o*255]};Q.xyz.lab=function(e){let t=e[0],r=e[1],n=e[2];t/=95.047,r/=100,n/=108.883,t=t>Os?t**0.3333333333333333:7.787*t+0.13793103448275862,r=r>Os?r**0.3333333333333333:7.787*r+0.13793103448275862,n=n>Os?n**0.3333333333333333:7.787*n+0.13793103448275862;let s=116*r-16,i=500*(t-r),o=200*(r-n);return[s,i,o]};Q.xyz.oklab=function(e){let t=e[0]/100,r=e[1]/100,n=e[2]/100,s=Math.cbrt(0.8189330101*t+0.3618667424*r-0.1288597137*n),i=Math.cbrt(0.0329845436*t+0.9293118715*r+0.0361456387*n),o=Math.cbrt(0.0482003018*t+0.2643662691*r+0.633851707*n),a=0.2104542553*s+0.793617785*i-0.0040720468*o,l=1.9779984951*s-2.428592205*i+0.4505937099*o,c=0.0259040371*s+0.7827717662*i-0.808675766*o;return[a*100,l*100,c*100]};Q.oklab.oklch=function(e){return Q.lab.lch(e)};Q.oklab.xyz=function(e){let t=e[0]/100,r=e[1]/100,n=e[2]/100,s=(0.999999998*t+0.396337792*r+0.215803758*n)**3,i=(1.000000008*t-0.105561342*r-0.063854175*n)**3,o=(1.000000055*t-0.089484182*r-1.291485538*n)**3,a=1.227013851*s-0.55779998*i+0.281256149*o,l=-0.040580178*s+1.11225687*i-0.071676679*o,c=-0.076381285*s-0.421481978*i+1.58616322*o;return[a*100,l*100,c*100]};Q.oklab.rgb=function(e){let t=e[0]/100,r=e[1]/100,n=e[2]/100,s=(t+0.3963377774*r+0.2158037573*n)**3,i=(t-0.1055613458*r-0.0638541728*n)**3,o=(t-0.0894841775*r-1.291485548*n)**3,a=ba(4.0767416621*s-3.3077115913*i+0.2309699292*o),l=ba(-1.2684380046*s+2.6097574011*i-0.3413193965*o),c=ba(-0.0041960863*s-0.7034186147*i+1.707614701*o);return[a*255,l*255,c*255]};Q.oklch.oklab=function(e){return Q.lch.lab(e)};Q.lab.xyz=function(e){let t=e[0],r=e[1],n=e[2],s,i,o;i=(t+16)/116,s=r/500+i,o=i-n/200;let a=i**3,l=s**3,c=o**3;return i=a>Os?a:(i-0.13793103448275862)/7.787,s=l>Os?l:(s-0.13793103448275862)/7.787,o=c>Os?c:(o-0.13793103448275862)/7.787,s*=95.047,i*=100,o*=108.883,[s,i,o]};Q.lab.lch=function(e){let t=e[0],r=e[1],n=e[2],s;if(s=Math.atan2(n,r)*360/2/Math.PI,s<0)s+=360;let o=Math.sqrt(r*r+n*n);return[t,o,s]};Q.lch.lab=function(e){let t=e[0],r=e[1],s=e[2]/360*2*Math.PI,i=r*Math.cos(s),o=r*Math.sin(s);return[t,i,o]};Q.rgb.ansi16=function(e,t=null){let[r,n,s]=e,i=t===null?Q.rgb.hsv(e)[2]:t;if(i=Math.round(i/50),i===0)return 30;let o=30+(Math.round(s/255)<<2|Math.round(n/255)<<1|Math.round(r/255));if(i===2)o+=60;return o};Q.hsv.ansi16=function(e){return Q.rgb.ansi16(Q.hsv.rgb(e),e[2])};Q.rgb.ansi256=function(e){let t=e[0],r=e[1],n=e[2];if(t>>4===r>>4&&r>>4===n>>4){if(t<8)return 16;if(t>248)return 231;return Math.round((t-8)/247*24)+232}return 16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)};Q.ansi16.rgb=function(e){e=e[0];let t=e%10;if(t===0||t===7){if(e>50)t+=3.5;return t=t/10.5*255,[t,t,t]}let r=(Math.trunc(e>50)+1)*0.5,n=(t&1)*r*255,s=(t>>1&1)*r*255,i=(t>>2&1)*r*255;return[n,s,i]};Q.ansi256.rgb=function(e){if(e=e[0],e>=232){let i=(e-232)*10+8;return[i,i,i]}e-=16;let t,r=Math.floor(e/36)/5*255,n=Math.floor((t=e%36)/6)/5*255,s=t%6/5*255;return[r,n,s]};Q.rgb.hex=function(e){let r=(((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255)).toString(16).toUpperCase();return"000000".slice(r.length)+r};Q.hex.rgb=function(e){let t=e.toString(16).match(/[a-f\d]{6}|[a-f\d]{3}/i);if(!t)return[0,0,0];let r=t[0];if(t[0].length===3)r=[...r].map((a)=>a+a).join("");let n=Number.parseInt(r,16),s=n>>16&255,i=n>>8&255,o=n&255;return[s,i,o]};Q.rgb.hcg=function(e){let t=e[0]/255,r=e[1]/255,n=e[2]/255,s=Math.max(Math.max(t,r),n),i=Math.min(Math.min(t,r),n),o=s-i,a,l=o<1?i/(1-o):0;if(o<=0)a=0;else if(s===t)a=(r-n)/o%6;else if(s===r)a=2+(n-t)/o;else a=4+(t-r)/o;return a/=6,a%=1,[a*360,o*100,l*100]};Q.hsl.hcg=function(e){let t=e[1]/100,r=e[2]/100,n=r<0.5?2*t*r:2*t*(1-r),s=0;if(n<1)s=(r-0.5*n)/(1-n);return[e[0],n*100,s*100]};Q.hsv.hcg=function(e){let t=e[1]/100,r=e[2]/100,n=t*r,s=0;if(n<1)s=(r-n)/(1-n);return[e[0],n*100,s*100]};Q.hcg.rgb=function(e){let t=e[0]/360,r=e[1]/100,n=e[2]/100;if(r===0)return[n*255,n*255,n*255];let s=[0,0,0],i=t%1*6,o=i%1,a=1-o,l=0;switch(Math.floor(i)){case 0:{s[0]=1,s[1]=o,s[2]=0;break}case 1:{s[0]=a,s[1]=1,s[2]=0;break}case 2:{s[0]=0,s[1]=1,s[2]=o;break}case 3:{s[0]=0,s[1]=a,s[2]=1;break}case 4:{s[0]=o,s[1]=0,s[2]=1;break}default:s[0]=1,s[1]=0,s[2]=a}return l=(1-r)*n,[(r*s[0]+l)*255,(r*s[1]+l)*255,(r*s[2]+l)*255]};Q.hcg.hsv=function(e){let t=e[1]/100,r=e[2]/100,n=t+r*(1-t),s=0;if(n>0)s=t/n;return[e[0],s*100,n*100]};Q.hcg.hsl=function(e){let t=e[1]/100,n=e[2]/100*(1-t)+0.5*t,s=0;if(n>0&&n<0.5)s=t/(2*n);else if(n>=0.5&&n<1)s=t/(2*(1-n));return[e[0],s*100,n*100]};Q.hcg.hwb=function(e){let t=e[1]/100,r=e[2]/100,n=t+r*(1-t);return[e[0],(n-t)*100,(1-n)*100]};Q.hwb.hcg=function(e){let t=e[1]/100,n=1-e[2]/100,s=n-t,i=0;if(s<1)i=(n-s)/(1-s);return[e[0],s*100,i*100]};Q.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]};Q.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]};Q.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]};Q.gray.hsl=function(e){return[0,0,e[0]]};Q.gray.hsv=Q.gray.hsl;Q.gray.hwb=function(e){return[0,100,e[0]]};Q.gray.cmyk=function(e){return[0,0,0,e[0]]};Q.gray.lab=function(e){return[e[0],0,0]};Q.gray.hex=function(e){let t=Math.round(e[0]/100*255)&255,n=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".slice(n.length)+n};Q.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]};function sV(){let e={},t=Object.keys(lo);for(let{length:r}=t,n=0;n<r;n++)e[t[n]]={distance:-1,parent:null};return e}function iV(e){let t=sV(),r=[e];t[e].distance=0;while(r.length>0){let n=r.pop(),s=Object.keys(lo[n]);for(let{length:i}=s,o=0;o<i;o++){let a=s[o],l=t[a];if(l.distance===-1)l.distance=t[n].distance+1,l.parent=n,r.unshift(a)}}return t}function oV(e,t){return function(r){return t(e(r))}}function aV(e,t){let r=[t[e].parent,e],n=lo[t[e].parent][e],s=t[e].parent;while(t[s].parent)r.unshift(t[s].parent),n=oV(lo[t[s].parent][s],n),s=t[s].parent;return n.conversion=r,n}function lV(e){let t=iV(e),r={},n=Object.keys(t);for(let{length:s}=n,i=0;i<s;i++){let o=n[i];if(t[o].parent===null)continue;r[o]=aV(o,t)}return r}var cV=lV,ya={},uV=Object.keys(lo);function fV(e){let t=function(...r){let n=r[0];if(n===void 0||n===null)return n;if(n.length>1)r=n;return e(r)};if("conversion"in e)t.conversion=e.conversion;return t}function dV(e){let t=function(...r){let n=r[0];if(n===void 0||n===null)return n;if(n.length>1)r=n;let s=e(r);if(typeof s==="object")for(let{length:i}=s,o=0;o<i;o++)s[o]=Math.round(s[o]);return s};if("conversion"in e)t.conversion=e.conversion;return t}for(let e of uV){ya[e]={},Object.defineProperty(ya[e],"channels",{value:lo[e].channels}),Object.defineProperty(ya[e],"labels",{value:lo[e].labels});let t=cV(e),r=Object.keys(t);for(let n of r){let s=t[n];ya[e][n]=dV(s),ya[e][n].raw=fV(s)}}var Ur=ya,jE=["keyword","gray","hex"],Oh={};for(let e of Object.keys(Ur))Oh[[...Ur[e].labels].sort().join("")]=e;var Ch={};function Ft(e,t){if(!(this instanceof Ft))return new Ft(e,t);if(t&&t in jE)t=null;if(t&&!(t in Ur))throw Error("Unknown model: "+t);let r,n;if(e==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(e instanceof Ft)this.model=e.model,this.color=[...e.color],this.valpha=e.valpha;else if(typeof e==="string"){let s=ga.get(e);if(s===null)throw Error("Unable to parse color from string: "+e);this.model=s.model,n=Ur[this.model].channels,this.color=s.value.slice(0,n),this.valpha=typeof s.value[n]==="number"?s.value[n]:1}else if(e.length>0){this.model=t||"rgb",n=Ur[this.model].channels;let s=Array.prototype.slice.call(e,0,n);this.color=Nh(s,n),this.valpha=typeof e[n]==="number"?e[n]:1}else if(typeof e==="number")this.model="rgb",this.color=[e>>16&255,e>>8&255,e&255],this.valpha=1;else{this.valpha=1;let s=Object.keys(e);if("alpha"in e)s.splice(s.indexOf("alpha"),1),this.valpha=typeof e.alpha==="number"?e.alpha:0;let i=s.sort().join("");if(!(i in Oh))throw Error("Unable to parse color from object: "+JSON.stringify(e));this.model=Oh[i];let{labels:o}=Ur[this.model],a=[];for(r=0;r<o.length;r++)a.push(e[o[r]]);this.color=Nh(a)}if(Ch[this.model]){n=Ur[this.model].channels;for(r=0;r<n;r++){let s=Ch[this.model][r];if(s)this.color[r]=s(this.color[r])}}if(this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze)Object.freeze(this)}Ft.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(e){let t=this.model in ga.to?this:this.rgb();t=t.round(typeof e==="number"?e:1);let r=t.valpha===1?t.color:[...t.color,this.valpha];return ga.to[t.model](...r)},percentString(e){let t=this.rgb().round(typeof e==="number"?e:1),r=t.valpha===1?t.color:[...t.color,this.valpha];return ga.to.rgb.percent(...r)},array(){return this.valpha===1?[...this.color]:[...this.color,this.valpha]},object(){let e={},{channels:t}=Ur[this.model],{labels:r}=Ur[this.model];for(let n=0;n<t;n++)e[r[n]]=this.color[n];if(this.valpha!==1)e.alpha=this.valpha;return e},unitArray(){let e=this.rgb().color;if(e[0]/=255,e[1]/=255,e[2]/=255,this.valpha!==1)e.push(this.valpha);return e},unitObject(){let e=this.rgb().object();if(e.r/=255,e.g/=255,e.b/=255,this.valpha!==1)e.alpha=this.valpha;return e},round(e){return e=Math.max(e||0,0),new Ft([...this.color.map(mV(e)),this.valpha],this.model)},alpha(e){if(e!==void 0)return new Ft([...this.color,Math.max(0,Math.min(1,e))],this.model);return this.valpha},red:mt("rgb",0,Mt(255)),green:mt("rgb",1,Mt(255)),blue:mt("rgb",2,Mt(255)),hue:mt(["hsl","hsv","hsl","hwb","hcg"],0,(e)=>(e%360+360)%360),saturationl:mt("hsl",1,Mt(100)),lightness:mt("hsl",2,Mt(100)),saturationv:mt("hsv",1,Mt(100)),value:mt("hsv",2,Mt(100)),chroma:mt("hcg",1,Mt(100)),gray:mt("hcg",2,Mt(100)),white:mt("hwb",1,Mt(100)),wblack:mt("hwb",2,Mt(100)),cyan:mt("cmyk",0,Mt(100)),magenta:mt("cmyk",1,Mt(100)),yellow:mt("cmyk",2,Mt(100)),black:mt("cmyk",3,Mt(100)),x:mt("xyz",0,Mt(95.047)),y:mt("xyz",1,Mt(100)),z:mt("xyz",2,Mt(108.833)),l:mt("lab",0,Mt(100)),a:mt("lab",1),b:mt("lab",2),keyword(e){if(e!==void 0)return new Ft(e);return Ur[this.model].keyword(this.color)},hex(e){if(e!==void 0)return new Ft(e);return ga.to.hex(...this.rgb().round().color)},hexa(e){if(e!==void 0)return new Ft(e);let t=this.rgb().round().color,r=Math.round(this.valpha*255).toString(16).toUpperCase();if(r.length===1)r="0"+r;return ga.to.hex(...t)+r},rgbNumber(){let e=this.rgb().color;return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255},luminosity(){let e=this.rgb().color,t=[];for(let[r,n]of e.entries()){let s=n/255;t[r]=s<=0.04045?s/12.92:((s+0.055)/1.055)**2.4}return 0.2126*t[0]+0.7152*t[1]+0.0722*t[2]},contrast(e){let t=this.luminosity(),r=e.luminosity();if(t>r)return(t+0.05)/(r+0.05);return(r+0.05)/(t+0.05)},level(e){let t=this.contrast(e);if(t>=7)return"AAA";return t>=4.5?"AA":""},isDark(){let e=this.rgb().color;return(e[0]*2126+e[1]*7152+e[2]*722)/1e4<128},isLight(){return!this.isDark()},negate(){let e=this.rgb();for(let t=0;t<3;t++)e.color[t]=255-e.color[t];return e},lighten(e){let t=this.hsl();return t.color[2]+=t.color[2]*e,t},darken(e){let t=this.hsl();return t.color[2]-=t.color[2]*e,t},saturate(e){let t=this.hsl();return t.color[1]+=t.color[1]*e,t},desaturate(e){let t=this.hsl();return t.color[1]-=t.color[1]*e,t},whiten(e){let t=this.hwb();return t.color[1]+=t.color[1]*e,t},blacken(e){let t=this.hwb();return t.color[2]+=t.color[2]*e,t},grayscale(){let e=this.rgb().color,t=e[0]*0.3+e[1]*0.59+e[2]*0.11;return Ft.rgb(t,t,t)},fade(e){return this.alpha(this.valpha-this.valpha*e)},opaquer(e){return this.alpha(this.valpha+this.valpha*e)},rotate(e){let t=this.hsl(),r=t.color[0];return r=(r+e)%360,r=r<0?360+r:r,t.color[0]=r,t},mix(e,t){if(!e||!e.rgb)throw Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof e);let r=e.rgb(),n=this.rgb(),s=t===void 0?0.5:t,i=2*s-1,o=r.alpha()-n.alpha(),a=((i*o===-1?i:(i+o)/(1+i*o))+1)/2,l=1-a;return Ft.rgb(a*r.red()+l*n.red(),a*r.green()+l*n.green(),a*r.blue()+l*n.blue(),r.alpha()*s+n.alpha()*(1-s))}};for(let e of Object.keys(Ur)){if(jE.includes(e))continue;let{channels:t}=Ur[e];Ft.prototype[e]=function(...r){if(this.model===e)return new Ft(this);if(r.length>0)return new Ft(r,e);return new Ft([...hV(Ur[this.model][e].raw(this.color)),this.valpha],e)},Ft[e]=function(...r){let n=r[0];if(typeof n==="number")n=Nh(r,t);return new Ft(n,e)}}function pV(e,t){return Number(e.toFixed(t))}function mV(e){return function(t){return pV(t,e)}}function mt(e,t,r){e=Array.isArray(e)?e:[e];for(let n of e)(Ch[n]||=[])[t]=r;return e=e[0],function(n){let s;if(n!==void 0){if(r)n=r(n);return s=this[e](),s.color[t]=n,s}if(s=this[e]().color[t],r)s=r(s);return s}}function Mt(e){return function(t){return Math.max(0,Math.min(e,t))}}function hV(e){return Array.isArray(e)?e:[e]}function Nh(e,t){for(let r=0;r<t;r++)if(typeof e[r]!=="number")e[r]=0;return e}var gV=Ft});var AE=N(function(use,_E){_E.exports=kE().default});function yV(e){return this._setBackgroundColourOption("tint",e),this}function bV(e){return this.options.greyscale=f.bool(e)?e:!0,this}function xV(e){return this.greyscale(e)}function $V(e){if(!f.string(e))throw f.invalidParameterError("colourspace","string",e);return this.options.colourspacePipeline=e,this}function wV(e){return this.pipelineColourspace(e)}function vV(e){if(!f.string(e))throw f.invalidParameterError("colourspace","string",e);return this.options.colourspace=e,this}function SV(e){return this.toColourspace(e)}function CE(e){if(f.object(e)||f.string(e)&&e.length>=3&&e.length<=200){let t=OE.default(e),r=t.red(),n=t.green(),s=t.blue(),i=Math.round(t.alpha()*255);for(let[o,a]of[["red",r],["green",n],["blue",s],["alpha",i]])if(!f.number(a))throw f.invalidParameterError(`background.${o}`,"number",a);return[r,n,s,i]}else throw f.invalidParameterError("background","object or string",e)}function EV(e,t){if(f.defined(t))this.options[e]=CE(t)}var OE,RE,NE=(e)=>{Object.assign(e.prototype,{tint:yV,greyscale:bV,grayscale:xV,pipelineColourspace:$V,pipelineColorspace:wV,toColourspace:vV,toColorspace:SV,_getBackgroundColourOption:CE,_setBackgroundColourOption:EV}),e.colourspace=RE,e.colorspace=RE};var TE=D(()=>{Cn();OE=br(AE(),1);/*!
411
+ */VE={integer:"integer",float:"float",approximate:"approximate"}});var XE=T(function(Mie,KE){var{defineProperty:eg,getOwnPropertyDescriptor:MV,getOwnPropertyNames:DV}=Object,LV=Object.prototype.hasOwnProperty,FV=(e,t)=>{for(var r in t)eg(e,r,{get:t[r],enumerable:!0})},qV=(e,t,r,n)=>{if(t&&typeof t==="object"||typeof t==="function"){for(let s of DV(t))if(!LV.call(e,s)&&s!==r)eg(e,s,{get:()=>t[s],enumerable:!(n=MV(t,s))||n.enumerable})}return e},VV=(e)=>qV(eg({},"__esModule",{value:!0}),e),UE={};FV(UE,{default:()=>r3});KE.exports=VV(UE);var Xh={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};for(let e in Xh)Object.freeze(Xh[e]);var Bn=Object.freeze(Xh),HE=Object.create(null);for(let e in Bn)if(Object.hasOwn(Bn,e))HE[Bn[e]]=e;var _r={to:{},get:{}};_r.get=function(e){let t=e.slice(0,3).toLowerCase(),r,n;switch(t){case"hsl":{r=_r.get.hsl(e),n="hsl";break}case"hwb":{r=_r.get.hwb(e),n="hwb";break}default:{r=_r.get.rgb(e),n="rgb";break}}if(!r)return null;return{model:n,value:r}};_r.get.rgb=function(e){if(!e)return null;let t=/^#([a-f\d]{3,4})$/i,r=/^#([a-f\d]{6})([a-f\d]{2})?$/i,n=/^rgba?\(\s*([+-]?(?:\d*\.)?\d+(?:e\d+)?)(?=[\s,])\s*(?:,\s*)?([+-]?(?:\d*\.)?\d+(?:e\d+)?)(?=[\s,])\s*(?:,\s*)?([+-]?(?:\d*\.)?\d+(?:e\d+)?)\s*(?:[\s,|/]\s*([+-]?(?:\d*\.)?\d+(?:e\d+)?)(%?)\s*)?\)$/i,s=/^rgba?\(\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[\s,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/i,i=/^(\w+)$/,o=[0,0,0,1],a,l,c;if(a=e.match(r)){c=a[2],a=a[1];for(l=0;l<3;l++){let u=l*2;o[l]=Number.parseInt(a.slice(u,u+2),16)}if(c)o[3]=Number.parseInt(c,16)/255}else if(a=e.match(t)){a=a[1],c=a[3];for(l=0;l<3;l++)o[l]=Number.parseInt(a[l]+a[l],16);if(c)o[3]=Number.parseInt(c+c,16)/255}else if(a=e.match(n)){for(l=0;l<3;l++)o[l]=Number.parseFloat(a[l+1]);if(a[4])o[3]=a[5]?Number.parseFloat(a[4])*0.01:Number.parseFloat(a[4])}else if(a=e.match(s)){for(l=0;l<3;l++)o[l]=Math.round(Number.parseFloat(a[l+1])*2.55);if(a[4])o[3]=a[5]?Number.parseFloat(a[4])*0.01:Number.parseFloat(a[4])}else if(a=e.toLowerCase().match(i)){if(a[1]==="transparent")return[0,0,0,0];if(!Object.hasOwn(Bn,a[1]))return null;return o=Bn[a[1]].slice(),o[3]=1,o}else return null;for(l=0;l<3;l++)o[l]=ii(o[l],0,255);return o[3]=ii(o[3],0,1),o};_r.get.hsl=function(e){if(!e)return null;let t=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[,|/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:e[+-]?\d+)?)\s*)?\)$/i,r=e.match(t);if(r){let n=Number.parseFloat(r[4]),s=(Number.parseFloat(r[1])%360+360)%360,i=ii(Number.parseFloat(r[2]),0,100),o=ii(Number.parseFloat(r[3]),0,100),a=ii(Number.isNaN(n)?1:n,0,1);return[s,i,o,a]}return null};_r.get.hwb=function(e){if(!e)return null;let t=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*[\s,]\s*([+-]?[\d.]+)%\s*[\s,]\s*([+-]?[\d.]+)%\s*(?:[\s,]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:e[+-]?\d+)?)\s*)?\)$/i,r=e.match(t);if(r){let n=Number.parseFloat(r[4]),s=(Number.parseFloat(r[1])%360+360)%360,i=ii(Number.parseFloat(r[2]),0,100),o=ii(Number.parseFloat(r[3]),0,100),a=ii(Number.isNaN(n)?1:n,0,1);return[s,i,o,a]}return null};_r.to.hex=function(...e){return"#"+Ff(e[0])+Ff(e[1])+Ff(e[2])+(e[3]<1?Ff(Math.round(e[3]*255)):"")};_r.to.rgb=function(...e){return e.length<4||e[3]===1?"rgb("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+")":"rgba("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+", "+e[3]+")"};_r.to.rgb.percent=function(...e){let t=Math.round(e[0]/255*100),r=Math.round(e[1]/255*100),n=Math.round(e[2]/255*100);return e.length<4||e[3]===1?"rgb("+t+"%, "+r+"%, "+n+"%)":"rgba("+t+"%, "+r+"%, "+n+"%, "+e[3]+")"};_r.to.hsl=function(...e){return e.length<4||e[3]===1?"hsl("+e[0]+", "+e[1]+"%, "+e[2]+"%)":"hsla("+e[0]+", "+e[1]+"%, "+e[2]+"%, "+e[3]+")"};_r.to.hwb=function(...e){let t="";if(e.length>=4&&e[3]!==1)t=", "+e[3];return"hwb("+e[0]+", "+e[1]+"%, "+e[2]+"%"+t+")"};_r.to.keyword=function(...e){return HE[e.slice(0,3)]};function ii(e,t,r){return Math.min(Math.max(t,e),r)}function Ff(e){let t=Math.round(e).toString(16).toUpperCase();return t.length<2?"0"+t:t}var $a=_r,zE={};for(let e of Object.keys(Bn))zE[Bn[e]]=e;var Q={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},oklab:{channels:3,labels:["okl","oka","okb"]},lch:{channels:3,labels:"lch"},oklch:{channels:3,labels:["okl","okc","okh"]},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}},po=Q,Is=0.008856451679035631;function va(e){let t=e>0.0031308?1.055*e**0.4166666666666667-0.055:e*12.92;return Math.min(Math.max(0,t),1)}function Sa(e){return e>0.04045?((e+0.055)/1.055)**2.4:e/12.92}for(let e of Object.keys(Q)){if(!("channels"in Q[e]))throw Error("missing channels property: "+e);if(!("labels"in Q[e]))throw Error("missing channel labels property: "+e);if(Q[e].labels.length!==Q[e].channels)throw Error("channel and label counts mismatch: "+e);let{channels:t,labels:r}=Q[e];delete Q[e].channels,delete Q[e].labels,Object.defineProperty(Q[e],"channels",{value:t}),Object.defineProperty(Q[e],"labels",{value:r})}Q.rgb.hsl=function(e){let t=e[0]/255,r=e[1]/255,n=e[2]/255,s=Math.min(t,r,n),i=Math.max(t,r,n),o=i-s,a,l;switch(i){case s:{a=0;break}case t:{a=(r-n)/o;break}case r:{a=2+(n-t)/o;break}case n:{a=4+(t-r)/o;break}}if(a=Math.min(a*60,360),a<0)a+=360;let c=(s+i)/2;if(i===s)l=0;else if(c<=0.5)l=o/(i+s);else l=o/(2-i-s);return[a,l*100,c*100]};Q.rgb.hsv=function(e){let t,r,n,s,i,o=e[0]/255,a=e[1]/255,l=e[2]/255,c=Math.max(o,a,l),u=c-Math.min(o,a,l),p=function(h){return(c-h)/6/u+0.5};if(u===0)s=0,i=0;else{switch(i=u/c,t=p(o),r=p(a),n=p(l),c){case o:{s=n-r;break}case a:{s=0.3333333333333333+t-n;break}case l:{s=0.6666666666666666+r-t;break}}if(s<0)s+=1;else if(s>1)s-=1}return[s*360,i*100,c*100]};Q.rgb.hwb=function(e){let t=e[0],r=e[1],n=e[2],s=Q.rgb.hsl(e)[0],i=0.00392156862745098*Math.min(t,Math.min(r,n));return n=1-0.00392156862745098*Math.max(t,Math.max(r,n)),[s,i*100,n*100]};Q.rgb.oklab=function(e){let t=Sa(e[0]/255),r=Sa(e[1]/255),n=Sa(e[2]/255),s=Math.cbrt(0.4122214708*t+0.5363325363*r+0.0514459929*n),i=Math.cbrt(0.2119034982*t+0.6806995451*r+0.1073969566*n),o=Math.cbrt(0.0883024619*t+0.2817188376*r+0.6299787005*n),a=0.2104542553*s+0.793617785*i-0.0040720468*o,l=1.9779984951*s-2.428592205*i+0.4505937099*o,c=0.0259040371*s+0.7827717662*i-0.808675766*o;return[a*100,l*100,c*100]};Q.rgb.cmyk=function(e){let t=e[0]/255,r=e[1]/255,n=e[2]/255,s=Math.min(1-t,1-r,1-n),i=(1-t-s)/(1-s)||0,o=(1-r-s)/(1-s)||0,a=(1-n-s)/(1-s)||0;return[i*100,o*100,a*100,s*100]};function BV(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}Q.rgb.keyword=function(e){let t=zE[e];if(t)return t;let r=Number.POSITIVE_INFINITY,n;for(let s of Object.keys(Bn)){let i=Bn[s],o=BV(e,i);if(o<r)r=o,n=s}return n};Q.keyword.rgb=function(e){return[...Bn[e]]};Q.rgb.xyz=function(e){let t=Sa(e[0]/255),r=Sa(e[1]/255),n=Sa(e[2]/255),s=t*0.4124564+r*0.3575761+n*0.1804375,i=t*0.2126729+r*0.7151522+n*0.072175,o=t*0.0193339+r*0.119192+n*0.9503041;return[s*100,i*100,o*100]};Q.rgb.lab=function(e){let t=Q.rgb.xyz(e),r=t[0],n=t[1],s=t[2];r/=95.047,n/=100,s/=108.883,r=r>Is?r**0.3333333333333333:7.787*r+0.13793103448275862,n=n>Is?n**0.3333333333333333:7.787*n+0.13793103448275862,s=s>Is?s**0.3333333333333333:7.787*s+0.13793103448275862;let i=116*n-16,o=500*(r-n),a=200*(n-s);return[i,o,a]};Q.hsl.rgb=function(e){let t=e[0]/360,r=e[1]/100,n=e[2]/100,s,i;if(r===0)return i=n*255,[i,i,i];let o=n<0.5?n*(1+r):n+r-n*r,a=2*n-o,l=[0,0,0];for(let c=0;c<3;c++){if(s=t+0.3333333333333333*-(c-1),s<0)s++;if(s>1)s--;if(6*s<1)i=a+(o-a)*6*s;else if(2*s<1)i=o;else if(3*s<2)i=a+(o-a)*(0.6666666666666666-s)*6;else i=a;l[c]=i*255}return l};Q.hsl.hsv=function(e){let t=e[0],r=e[1]/100,n=e[2]/100,s=r,i=Math.max(n,0.01);n*=2,r*=n<=1?n:2-n,s*=i<=1?i:2-i;let o=(n+r)/2,a=n===0?2*s/(i+s):2*r/(n+r);return[t,a*100,o*100]};Q.hsv.rgb=function(e){let t=e[0]/60,r=e[1]/100,n=e[2]/100,s=Math.floor(t)%6,i=t-Math.floor(t),o=255*n*(1-r),a=255*n*(1-r*i),l=255*n*(1-r*(1-i));switch(n*=255,s){case 0:return[n,l,o];case 1:return[a,n,o];case 2:return[o,n,l];case 3:return[o,a,n];case 4:return[l,o,n];case 5:return[n,o,a]}};Q.hsv.hsl=function(e){let t=e[0],r=e[1]/100,n=e[2]/100,s=Math.max(n,0.01),i,o;o=(2-r)*n;let a=(2-r)*s;return i=r*s,i/=a<=1?a:2-a,i=i||0,o/=2,[t,i*100,o*100]};Q.hwb.rgb=function(e){let t=e[0]/360,r=e[1]/100,n=e[2]/100,s=r+n,i;if(s>1)r/=s,n/=s;let o=Math.floor(6*t),a=1-n;if(i=6*t-o,(o&1)!==0)i=1-i;let l=r+i*(a-r),c,u,p;switch(o){default:case 6:case 0:{c=a,u=l,p=r;break}case 1:{c=l,u=a,p=r;break}case 2:{c=r,u=a,p=l;break}case 3:{c=r,u=l,p=a;break}case 4:{c=l,u=r,p=a;break}case 5:{c=a,u=r,p=l;break}}return[c*255,u*255,p*255]};Q.cmyk.rgb=function(e){let t=e[0]/100,r=e[1]/100,n=e[2]/100,s=e[3]/100,i=1-Math.min(1,t*(1-s)+s),o=1-Math.min(1,r*(1-s)+s),a=1-Math.min(1,n*(1-s)+s);return[i*255,o*255,a*255]};Q.xyz.rgb=function(e){let t=e[0]/100,r=e[1]/100,n=e[2]/100,s,i,o;return s=t*3.2404542+r*-1.5371385+n*-0.4985314,i=t*-0.969266+r*1.8760108+n*0.041556,o=t*0.0556434+r*-0.2040259+n*1.0572252,s=va(s),i=va(i),o=va(o),[s*255,i*255,o*255]};Q.xyz.lab=function(e){let t=e[0],r=e[1],n=e[2];t/=95.047,r/=100,n/=108.883,t=t>Is?t**0.3333333333333333:7.787*t+0.13793103448275862,r=r>Is?r**0.3333333333333333:7.787*r+0.13793103448275862,n=n>Is?n**0.3333333333333333:7.787*n+0.13793103448275862;let s=116*r-16,i=500*(t-r),o=200*(r-n);return[s,i,o]};Q.xyz.oklab=function(e){let t=e[0]/100,r=e[1]/100,n=e[2]/100,s=Math.cbrt(0.8189330101*t+0.3618667424*r-0.1288597137*n),i=Math.cbrt(0.0329845436*t+0.9293118715*r+0.0361456387*n),o=Math.cbrt(0.0482003018*t+0.2643662691*r+0.633851707*n),a=0.2104542553*s+0.793617785*i-0.0040720468*o,l=1.9779984951*s-2.428592205*i+0.4505937099*o,c=0.0259040371*s+0.7827717662*i-0.808675766*o;return[a*100,l*100,c*100]};Q.oklab.oklch=function(e){return Q.lab.lch(e)};Q.oklab.xyz=function(e){let t=e[0]/100,r=e[1]/100,n=e[2]/100,s=(0.999999998*t+0.396337792*r+0.215803758*n)**3,i=(1.000000008*t-0.105561342*r-0.063854175*n)**3,o=(1.000000055*t-0.089484182*r-1.291485538*n)**3,a=1.227013851*s-0.55779998*i+0.281256149*o,l=-0.040580178*s+1.11225687*i-0.071676679*o,c=-0.076381285*s-0.421481978*i+1.58616322*o;return[a*100,l*100,c*100]};Q.oklab.rgb=function(e){let t=e[0]/100,r=e[1]/100,n=e[2]/100,s=(t+0.3963377774*r+0.2158037573*n)**3,i=(t-0.1055613458*r-0.0638541728*n)**3,o=(t-0.0894841775*r-1.291485548*n)**3,a=va(4.0767416621*s-3.3077115913*i+0.2309699292*o),l=va(-1.2684380046*s+2.6097574011*i-0.3413193965*o),c=va(-0.0041960863*s-0.7034186147*i+1.707614701*o);return[a*255,l*255,c*255]};Q.oklch.oklab=function(e){return Q.lch.lab(e)};Q.lab.xyz=function(e){let t=e[0],r=e[1],n=e[2],s,i,o;i=(t+16)/116,s=r/500+i,o=i-n/200;let a=i**3,l=s**3,c=o**3;return i=a>Is?a:(i-0.13793103448275862)/7.787,s=l>Is?l:(s-0.13793103448275862)/7.787,o=c>Is?c:(o-0.13793103448275862)/7.787,s*=95.047,i*=100,o*=108.883,[s,i,o]};Q.lab.lch=function(e){let t=e[0],r=e[1],n=e[2],s;if(s=Math.atan2(n,r)*360/2/Math.PI,s<0)s+=360;let o=Math.sqrt(r*r+n*n);return[t,o,s]};Q.lch.lab=function(e){let t=e[0],r=e[1],s=e[2]/360*2*Math.PI,i=r*Math.cos(s),o=r*Math.sin(s);return[t,i,o]};Q.rgb.ansi16=function(e,t=null){let[r,n,s]=e,i=t===null?Q.rgb.hsv(e)[2]:t;if(i=Math.round(i/50),i===0)return 30;let o=30+(Math.round(s/255)<<2|Math.round(n/255)<<1|Math.round(r/255));if(i===2)o+=60;return o};Q.hsv.ansi16=function(e){return Q.rgb.ansi16(Q.hsv.rgb(e),e[2])};Q.rgb.ansi256=function(e){let t=e[0],r=e[1],n=e[2];if(t>>4===r>>4&&r>>4===n>>4){if(t<8)return 16;if(t>248)return 231;return Math.round((t-8)/247*24)+232}return 16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)};Q.ansi16.rgb=function(e){e=e[0];let t=e%10;if(t===0||t===7){if(e>50)t+=3.5;return t=t/10.5*255,[t,t,t]}let r=(Math.trunc(e>50)+1)*0.5,n=(t&1)*r*255,s=(t>>1&1)*r*255,i=(t>>2&1)*r*255;return[n,s,i]};Q.ansi256.rgb=function(e){if(e=e[0],e>=232){let i=(e-232)*10+8;return[i,i,i]}e-=16;let t,r=Math.floor(e/36)/5*255,n=Math.floor((t=e%36)/6)/5*255,s=t%6/5*255;return[r,n,s]};Q.rgb.hex=function(e){let r=(((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255)).toString(16).toUpperCase();return"000000".slice(r.length)+r};Q.hex.rgb=function(e){let t=e.toString(16).match(/[a-f\d]{6}|[a-f\d]{3}/i);if(!t)return[0,0,0];let r=t[0];if(t[0].length===3)r=[...r].map((a)=>a+a).join("");let n=Number.parseInt(r,16),s=n>>16&255,i=n>>8&255,o=n&255;return[s,i,o]};Q.rgb.hcg=function(e){let t=e[0]/255,r=e[1]/255,n=e[2]/255,s=Math.max(Math.max(t,r),n),i=Math.min(Math.min(t,r),n),o=s-i,a,l=o<1?i/(1-o):0;if(o<=0)a=0;else if(s===t)a=(r-n)/o%6;else if(s===r)a=2+(n-t)/o;else a=4+(t-r)/o;return a/=6,a%=1,[a*360,o*100,l*100]};Q.hsl.hcg=function(e){let t=e[1]/100,r=e[2]/100,n=r<0.5?2*t*r:2*t*(1-r),s=0;if(n<1)s=(r-0.5*n)/(1-n);return[e[0],n*100,s*100]};Q.hsv.hcg=function(e){let t=e[1]/100,r=e[2]/100,n=t*r,s=0;if(n<1)s=(r-n)/(1-n);return[e[0],n*100,s*100]};Q.hcg.rgb=function(e){let t=e[0]/360,r=e[1]/100,n=e[2]/100;if(r===0)return[n*255,n*255,n*255];let s=[0,0,0],i=t%1*6,o=i%1,a=1-o,l=0;switch(Math.floor(i)){case 0:{s[0]=1,s[1]=o,s[2]=0;break}case 1:{s[0]=a,s[1]=1,s[2]=0;break}case 2:{s[0]=0,s[1]=1,s[2]=o;break}case 3:{s[0]=0,s[1]=a,s[2]=1;break}case 4:{s[0]=o,s[1]=0,s[2]=1;break}default:s[0]=1,s[1]=0,s[2]=a}return l=(1-r)*n,[(r*s[0]+l)*255,(r*s[1]+l)*255,(r*s[2]+l)*255]};Q.hcg.hsv=function(e){let t=e[1]/100,r=e[2]/100,n=t+r*(1-t),s=0;if(n>0)s=t/n;return[e[0],s*100,n*100]};Q.hcg.hsl=function(e){let t=e[1]/100,n=e[2]/100*(1-t)+0.5*t,s=0;if(n>0&&n<0.5)s=t/(2*n);else if(n>=0.5&&n<1)s=t/(2*(1-n));return[e[0],s*100,n*100]};Q.hcg.hwb=function(e){let t=e[1]/100,r=e[2]/100,n=t+r*(1-t);return[e[0],(n-t)*100,(1-n)*100]};Q.hwb.hcg=function(e){let t=e[1]/100,n=1-e[2]/100,s=n-t,i=0;if(s<1)i=(n-s)/(1-s);return[e[0],s*100,i*100]};Q.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]};Q.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]};Q.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]};Q.gray.hsl=function(e){return[0,0,e[0]]};Q.gray.hsv=Q.gray.hsl;Q.gray.hwb=function(e){return[0,100,e[0]]};Q.gray.cmyk=function(e){return[0,0,0,e[0]]};Q.gray.lab=function(e){return[e[0],0,0]};Q.gray.hex=function(e){let t=Math.round(e[0]/100*255)&255,n=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".slice(n.length)+n};Q.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]};function WV(){let e={},t=Object.keys(po);for(let{length:r}=t,n=0;n<r;n++)e[t[n]]={distance:-1,parent:null};return e}function UV(e){let t=WV(),r=[e];t[e].distance=0;while(r.length>0){let n=r.pop(),s=Object.keys(po[n]);for(let{length:i}=s,o=0;o<i;o++){let a=s[o],l=t[a];if(l.distance===-1)l.distance=t[n].distance+1,l.parent=n,r.unshift(a)}}return t}function HV(e,t){return function(r){return t(e(r))}}function zV(e,t){let r=[t[e].parent,e],n=po[t[e].parent][e],s=t[e].parent;while(t[s].parent)r.unshift(t[s].parent),n=HV(po[t[s].parent][s],n),s=t[s].parent;return n.conversion=r,n}function GV(e){let t=UV(e),r={},n=Object.keys(t);for(let{length:s}=n,i=0;i<s;i++){let o=n[i];if(t[o].parent===null)continue;r[o]=zV(o,t)}return r}var KV=GV,wa={},XV=Object.keys(po);function YV(e){let t=function(...r){let n=r[0];if(n===void 0||n===null)return n;if(n.length>1)r=n;return e(r)};if("conversion"in e)t.conversion=e.conversion;return t}function ZV(e){let t=function(...r){let n=r[0];if(n===void 0||n===null)return n;if(n.length>1)r=n;let s=e(r);if(typeof s==="object")for(let{length:i}=s,o=0;o<i;o++)s[o]=Math.round(s[o]);return s};if("conversion"in e)t.conversion=e.conversion;return t}for(let e of XV){wa[e]={},Object.defineProperty(wa[e],"channels",{value:po[e].channels}),Object.defineProperty(wa[e],"labels",{value:po[e].labels});let t=KV(e),r=Object.keys(t);for(let n of r){let s=t[n];wa[e][n]=ZV(s),wa[e][n].raw=YV(s)}}var Hr=wa,GE=["keyword","gray","hex"],Yh={};for(let e of Object.keys(Hr))Yh[[...Hr[e].labels].sort().join("")]=e;var Zh={};function Lt(e,t){if(!(this instanceof Lt))return new Lt(e,t);if(t&&t in GE)t=null;if(t&&!(t in Hr))throw Error("Unknown model: "+t);let r,n;if(e==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(e instanceof Lt)this.model=e.model,this.color=[...e.color],this.valpha=e.valpha;else if(typeof e==="string"){let s=$a.get(e);if(s===null)throw Error("Unable to parse color from string: "+e);this.model=s.model,n=Hr[this.model].channels,this.color=s.value.slice(0,n),this.valpha=typeof s.value[n]==="number"?s.value[n]:1}else if(e.length>0){this.model=t||"rgb",n=Hr[this.model].channels;let s=Array.prototype.slice.call(e,0,n);this.color=Qh(s,n),this.valpha=typeof e[n]==="number"?e[n]:1}else if(typeof e==="number")this.model="rgb",this.color=[e>>16&255,e>>8&255,e&255],this.valpha=1;else{this.valpha=1;let s=Object.keys(e);if("alpha"in e)s.splice(s.indexOf("alpha"),1),this.valpha=typeof e.alpha==="number"?e.alpha:0;let i=s.sort().join("");if(!(i in Yh))throw Error("Unable to parse color from object: "+JSON.stringify(e));this.model=Yh[i];let{labels:o}=Hr[this.model],a=[];for(r=0;r<o.length;r++)a.push(e[o[r]]);this.color=Qh(a)}if(Zh[this.model]){n=Hr[this.model].channels;for(r=0;r<n;r++){let s=Zh[this.model][r];if(s)this.color[r]=s(this.color[r])}}if(this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze)Object.freeze(this)}Lt.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(e){let t=this.model in $a.to?this:this.rgb();t=t.round(typeof e==="number"?e:1);let r=t.valpha===1?t.color:[...t.color,this.valpha];return $a.to[t.model](...r)},percentString(e){let t=this.rgb().round(typeof e==="number"?e:1),r=t.valpha===1?t.color:[...t.color,this.valpha];return $a.to.rgb.percent(...r)},array(){return this.valpha===1?[...this.color]:[...this.color,this.valpha]},object(){let e={},{channels:t}=Hr[this.model],{labels:r}=Hr[this.model];for(let n=0;n<t;n++)e[r[n]]=this.color[n];if(this.valpha!==1)e.alpha=this.valpha;return e},unitArray(){let e=this.rgb().color;if(e[0]/=255,e[1]/=255,e[2]/=255,this.valpha!==1)e.push(this.valpha);return e},unitObject(){let e=this.rgb().object();if(e.r/=255,e.g/=255,e.b/=255,this.valpha!==1)e.alpha=this.valpha;return e},round(e){return e=Math.max(e||0,0),new Lt([...this.color.map(e3(e)),this.valpha],this.model)},alpha(e){if(e!==void 0)return new Lt([...this.color,Math.max(0,Math.min(1,e))],this.model);return this.valpha},red:mt("rgb",0,Mt(255)),green:mt("rgb",1,Mt(255)),blue:mt("rgb",2,Mt(255)),hue:mt(["hsl","hsv","hsl","hwb","hcg"],0,(e)=>(e%360+360)%360),saturationl:mt("hsl",1,Mt(100)),lightness:mt("hsl",2,Mt(100)),saturationv:mt("hsv",1,Mt(100)),value:mt("hsv",2,Mt(100)),chroma:mt("hcg",1,Mt(100)),gray:mt("hcg",2,Mt(100)),white:mt("hwb",1,Mt(100)),wblack:mt("hwb",2,Mt(100)),cyan:mt("cmyk",0,Mt(100)),magenta:mt("cmyk",1,Mt(100)),yellow:mt("cmyk",2,Mt(100)),black:mt("cmyk",3,Mt(100)),x:mt("xyz",0,Mt(95.047)),y:mt("xyz",1,Mt(100)),z:mt("xyz",2,Mt(108.833)),l:mt("lab",0,Mt(100)),a:mt("lab",1),b:mt("lab",2),keyword(e){if(e!==void 0)return new Lt(e);return Hr[this.model].keyword(this.color)},hex(e){if(e!==void 0)return new Lt(e);return $a.to.hex(...this.rgb().round().color)},hexa(e){if(e!==void 0)return new Lt(e);let t=this.rgb().round().color,r=Math.round(this.valpha*255).toString(16).toUpperCase();if(r.length===1)r="0"+r;return $a.to.hex(...t)+r},rgbNumber(){let e=this.rgb().color;return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255},luminosity(){let e=this.rgb().color,t=[];for(let[r,n]of e.entries()){let s=n/255;t[r]=s<=0.04045?s/12.92:((s+0.055)/1.055)**2.4}return 0.2126*t[0]+0.7152*t[1]+0.0722*t[2]},contrast(e){let t=this.luminosity(),r=e.luminosity();if(t>r)return(t+0.05)/(r+0.05);return(r+0.05)/(t+0.05)},level(e){let t=this.contrast(e);if(t>=7)return"AAA";return t>=4.5?"AA":""},isDark(){let e=this.rgb().color;return(e[0]*2126+e[1]*7152+e[2]*722)/1e4<128},isLight(){return!this.isDark()},negate(){let e=this.rgb();for(let t=0;t<3;t++)e.color[t]=255-e.color[t];return e},lighten(e){let t=this.hsl();return t.color[2]+=t.color[2]*e,t},darken(e){let t=this.hsl();return t.color[2]-=t.color[2]*e,t},saturate(e){let t=this.hsl();return t.color[1]+=t.color[1]*e,t},desaturate(e){let t=this.hsl();return t.color[1]-=t.color[1]*e,t},whiten(e){let t=this.hwb();return t.color[1]+=t.color[1]*e,t},blacken(e){let t=this.hwb();return t.color[2]+=t.color[2]*e,t},grayscale(){let e=this.rgb().color,t=e[0]*0.3+e[1]*0.59+e[2]*0.11;return Lt.rgb(t,t,t)},fade(e){return this.alpha(this.valpha-this.valpha*e)},opaquer(e){return this.alpha(this.valpha+this.valpha*e)},rotate(e){let t=this.hsl(),r=t.color[0];return r=(r+e)%360,r=r<0?360+r:r,t.color[0]=r,t},mix(e,t){if(!e||!e.rgb)throw Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof e);let r=e.rgb(),n=this.rgb(),s=t===void 0?0.5:t,i=2*s-1,o=r.alpha()-n.alpha(),a=((i*o===-1?i:(i+o)/(1+i*o))+1)/2,l=1-a;return Lt.rgb(a*r.red()+l*n.red(),a*r.green()+l*n.green(),a*r.blue()+l*n.blue(),r.alpha()*s+n.alpha()*(1-s))}};for(let e of Object.keys(Hr)){if(GE.includes(e))continue;let{channels:t}=Hr[e];Lt.prototype[e]=function(...r){if(this.model===e)return new Lt(this);if(r.length>0)return new Lt(r,e);return new Lt([...t3(Hr[this.model][e].raw(this.color)),this.valpha],e)},Lt[e]=function(...r){let n=r[0];if(typeof n==="number")n=Qh(r,t);return new Lt(n,e)}}function QV(e,t){return Number(e.toFixed(t))}function e3(e){return function(t){return QV(t,e)}}function mt(e,t,r){e=Array.isArray(e)?e:[e];for(let n of e)(Zh[n]||=[])[t]=r;return e=e[0],function(n){let s;if(n!==void 0){if(r)n=r(n);return s=this[e](),s.color[t]=n,s}if(s=this[e]().color[t],r)s=r(s);return s}}function Mt(e){return function(t){return Math.max(0,Math.min(e,t))}}function t3(e){return Array.isArray(e)?e:[e]}function Qh(e,t){for(let r=0;r<t;r++)if(typeof e[r]!=="number")e[r]=0;return e}var r3=Lt});var ZE=T(function(Die,YE){YE.exports=XE().default});function n3(e){return this._setBackgroundColourOption("tint",e),this}function s3(e){return this.options.greyscale=f.bool(e)?e:!0,this}function i3(e){return this.greyscale(e)}function o3(e){if(!f.string(e))throw f.invalidParameterError("colourspace","string",e);return this.options.colourspacePipeline=e,this}function a3(e){return this.pipelineColourspace(e)}function l3(e){if(!f.string(e))throw f.invalidParameterError("colourspace","string",e);return this.options.colourspace=e,this}function c3(e){return this.toColourspace(e)}function t1(e){if(f.object(e)||f.string(e)&&e.length>=3&&e.length<=200){let t=e1.default(e),r=t.red(),n=t.green(),s=t.blue(),i=Math.round(t.alpha()*255);for(let[o,a]of[["red",r],["green",n],["blue",s],["alpha",i]])if(!f.number(a))throw f.invalidParameterError(`background.${o}`,"number",a);return[r,n,s,i]}else throw f.invalidParameterError("background","object or string",e)}function u3(e,t){if(f.defined(t))this.options[e]=t1(t)}var e1,QE,r1=(e)=>{Object.assign(e.prototype,{tint:n3,greyscale:s3,grayscale:i3,pipelineColourspace:o3,pipelineColorspace:a3,toColourspace:l3,toColorspace:c3,_getBackgroundColourOption:t1,_setBackgroundColourOption:u3}),e.colourspace=QE,e.colorspace=QE};var n1=M(()=>{Mn();e1=xr(ZE(),1);/*!
411
412
  Copyright 2013 Lovell Fuller and others.
412
413
  SPDX-License-Identifier: Apache-2.0
413
- */RE={multiband:"multiband","b-w":"b-w",bw:"b-w",cmyk:"cmyk",srgb:"srgb"}});function PV(){return this.options.removeAlpha=!0,this}function kV(e){if(f.defined(e))if(f.number(e)&&f.inRange(e,0,1))this.options.ensureAlpha=e;else throw f.invalidParameterError("alpha","number between 0 and 1",e);else this.options.ensureAlpha=1;return this}function _V(e){let t={red:0,green:1,blue:2,alpha:3};if(Object.keys(t).includes(e))e=t[e];if(f.integer(e)&&f.inRange(e,0,4))this.options.extractChannel=e;else throw f.invalidParameterError("channel","integer or one of: red, green, blue, alpha",e);return this}function AV(e,t){if(Array.isArray(e))e.forEach(function(r){this.options.joinChannelIn.push(this._createInputDescriptor(r,t))},this);else this.options.joinChannelIn.push(this._createInputDescriptor(e,t));return this}function RV(e){if(f.string(e)&&f.inArray(e,["and","or","eor"]))this.options.bandBoolOp=e;else throw f.invalidParameterError("boolOp","one of: and, or, eor",e);return this}var jV,IE=(e)=>{Object.assign(e.prototype,{removeAlpha:PV,ensureAlpha:kV,extractChannel:_V,joinChannel:AV,bandbool:RV}),e.bool=jV};var JE=D(()=>{Cn();/*!
414
+ */QE={multiband:"multiband","b-w":"b-w",bw:"b-w",cmyk:"cmyk",srgb:"srgb"}});function d3(){return this.options.removeAlpha=!0,this}function p3(e){if(f.defined(e))if(f.number(e)&&f.inRange(e,0,1))this.options.ensureAlpha=e;else throw f.invalidParameterError("alpha","number between 0 and 1",e);else this.options.ensureAlpha=1;return this}function m3(e){let t={red:0,green:1,blue:2,alpha:3};if(Object.keys(t).includes(e))e=t[e];if(f.integer(e)&&f.inRange(e,0,4))this.options.extractChannel=e;else throw f.invalidParameterError("channel","integer or one of: red, green, blue, alpha",e);return this}function h3(e,t){if(Array.isArray(e))e.forEach(function(r){this.options.joinChannelIn.push(this._createInputDescriptor(r,t))},this);else this.options.joinChannelIn.push(this._createInputDescriptor(e,t));return this}function g3(e){if(f.string(e)&&f.inArray(e,["and","or","eor"]))this.options.bandBoolOp=e;else throw f.invalidParameterError("boolOp","one of: and, or, eor",e);return this}var f3,s1=(e)=>{Object.assign(e.prototype,{removeAlpha:d3,ensureAlpha:p3,extractChannel:m3,joinChannel:h3,bandbool:g3}),e.bool=f3};var i1=M(()=>{Mn();/*!
414
415
  Copyright 2013 Lovell Fuller and others.
415
416
  SPDX-License-Identifier: Apache-2.0
416
- */jV={and:"and",or:"or",eor:"eor"}});import Ih from"node:path";function CV(e,t){let r;if(!f.string(e))r=Error("Missing output file path");else if(f.string(this.options.input.file)&&Ih.resolve(this.options.input.file)===Ih.resolve(e))r=Error("Cannot use same file for input and output");else if(OV.test(Ih.extname(e))&&!this.constructor.format.jp2.output.file)r=DE();if(r)if(f.fn(t))t(r);else return Promise.reject(r);else{this.options.fileOut=e;let n=Error();return this._pipeline(t,n)}return this}function NV(e,t){if(f.object(e))this._setBooleanOption("resolveWithObject",e.resolveWithObject);else if(this.options.resolveWithObject)this.options.resolveWithObject=!1;this.options.fileOut="";let r=Error();return this._pipeline(f.fn(e)?e:t,r)}function TV(){this.options.resolveWithObject=!0,this.options.typedArrayOut=!0;let e=Error();return this._pipeline(null,e)}function IV(e){if(f.number(e)&&e>0)this.options.withMetadataDensity=e;else throw f.invalidParameterError("density","positive number",e);return this.keepExif()}function JV(){return this.options.keepMetadata|=1,this}function MV(e){if(f.object(e))for(let[t,r]of Object.entries(e))if(f.object(r))for(let[n,s]of Object.entries(r))if(f.string(s))this.options.withExif[`exif-${t.toLowerCase()}-${n}`]=s;else throw f.invalidParameterError(`${t}.${n}`,"string",s);else throw f.invalidParameterError(t,"object",r);else throw f.invalidParameterError("exif","object",e);return this.options.withExifMerge=!1,this.keepExif()}function DV(e){return this.withExif(e),this.options.withExifMerge=!0,this}function LV(){return this.options.keepMetadata|=8,this}function FV(e,t){if(f.string(e))this.options.withIccProfile=e;else throw f.invalidParameterError("icc","string",e);if(this.keepIccProfile(),f.object(t)){if(f.defined(t.attach))if(f.bool(t.attach)){if(!t.attach)this.options.keepMetadata&=-9}else throw f.invalidParameterError("attach","boolean",t.attach)}return this}function qV(){return this.options.keepGainMap=!0,this.options.withGainMap=!1,this.options.keepMetadata|=32,this}function VV(){return this.options.withGainMap=!0,this.options.keepGainMap=!1,this.options.colourspace="scrgb",this}function WV(){return this.options.keepMetadata|=2,this}function BV(e){if(f.string(e)&&e.length>0)this.options.withXmp=e,this.options.keepMetadata|=2;else throw f.invalidParameterError("xmp","non-empty string",e);return this}function HV(){return this.options.keepMetadata|=31,this}function UV(e){if(this.keepMetadata(),this.withIccProfile("srgb"),f.object(e)){if(f.defined(e.orientation))if(f.integer(e.orientation)&&f.inRange(e.orientation,1,8))this.options.withMetadataOrientation=e.orientation;else throw f.invalidParameterError("orientation","integer between 1 and 8",e.orientation);if(f.defined(e.density))if(f.number(e.density)&&e.density>0)this.options.withMetadataDensity=e.density;else throw f.invalidParameterError("density","positive number",e.density);if(f.defined(e.icc))this.withIccProfile(e.icc);if(f.defined(e.exif))this.withExifMerge(e.exif)}return this}function zV(e,t){let r=ME.get((f.object(e)&&f.string(e.id)?e.id:e).toLowerCase());if(!r)throw f.invalidParameterError("format",`one of: ${[...ME.keys()].join(", ")}`,e);return this[r](t)}function GV(e){if(f.object(e)){if(f.defined(e.quality))if(f.integer(e.quality)&&f.inRange(e.quality,1,100))this.options.jpegQuality=e.quality;else throw f.invalidParameterError("quality","integer between 1 and 100",e.quality);if(f.defined(e.progressive))this._setBooleanOption("jpegProgressive",e.progressive);if(f.defined(e.chromaSubsampling))if(f.string(e.chromaSubsampling)&&f.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.jpegChromaSubsampling=e.chromaSubsampling;else throw f.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling);let t=f.bool(e.optimizeCoding)?e.optimizeCoding:e.optimiseCoding;if(f.defined(t))this._setBooleanOption("jpegOptimiseCoding",t);if(f.defined(e.mozjpeg))if(f.bool(e.mozjpeg)){if(e.mozjpeg)this.options.jpegTrellisQuantisation=!0,this.options.jpegOvershootDeringing=!0,this.options.jpegOptimiseScans=!0,this.options.jpegProgressive=!0,this.options.jpegQuantisationTable=3}else throw f.invalidParameterError("mozjpeg","boolean",e.mozjpeg);let r=f.bool(e.trellisQuantization)?e.trellisQuantization:e.trellisQuantisation;if(f.defined(r))this._setBooleanOption("jpegTrellisQuantisation",r);if(f.defined(e.overshootDeringing))this._setBooleanOption("jpegOvershootDeringing",e.overshootDeringing);let n=f.bool(e.optimizeScans)?e.optimizeScans:e.optimiseScans;if(f.defined(n)){if(this._setBooleanOption("jpegOptimiseScans",n),n)this.options.jpegProgressive=!0}let s=f.number(e.quantizationTable)?e.quantizationTable:e.quantisationTable;if(f.defined(s))if(f.integer(s)&&f.inRange(s,0,8))this.options.jpegQuantisationTable=s;else throw f.invalidParameterError("quantisationTable","integer between 0 and 8",s)}return this._updateFormatOut("jpeg",e)}function KV(e){if(f.object(e)){if(f.defined(e.progressive))this._setBooleanOption("pngProgressive",e.progressive);if(f.defined(e.compressionLevel))if(f.integer(e.compressionLevel)&&f.inRange(e.compressionLevel,0,9))this.options.pngCompressionLevel=e.compressionLevel;else throw f.invalidParameterError("compressionLevel","integer between 0 and 9",e.compressionLevel);if(f.defined(e.adaptiveFiltering))this._setBooleanOption("pngAdaptiveFiltering",e.adaptiveFiltering);let t=e.colours||e.colors;if(f.defined(t))if(f.integer(t)&&f.inRange(t,2,256))this.options.pngBitdepth=LE(t);else throw f.invalidParameterError("colours","integer between 2 and 256",t);if(f.defined(e.palette))this._setBooleanOption("pngPalette",e.palette);else if([e.quality,e.effort,e.colours,e.colors,e.dither].some(f.defined))this._setBooleanOption("pngPalette",!0);if(this.options.pngPalette){if(f.defined(e.quality))if(f.integer(e.quality)&&f.inRange(e.quality,0,100))this.options.pngQuality=e.quality;else throw f.invalidParameterError("quality","integer between 0 and 100",e.quality);if(f.defined(e.effort))if(f.integer(e.effort)&&f.inRange(e.effort,1,10))this.options.pngEffort=e.effort;else throw f.invalidParameterError("effort","integer between 1 and 10",e.effort);if(f.defined(e.dither))if(f.number(e.dither)&&f.inRange(e.dither,0,1))this.options.pngDither=e.dither;else throw f.invalidParameterError("dither","number between 0.0 and 1.0",e.dither)}}return this._updateFormatOut("png",e)}function YV(e){if(f.object(e)){if(f.defined(e.quality))if(f.integer(e.quality)&&f.inRange(e.quality,1,100))this.options.webpQuality=e.quality;else throw f.invalidParameterError("quality","integer between 1 and 100",e.quality);if(f.defined(e.alphaQuality))if(f.integer(e.alphaQuality)&&f.inRange(e.alphaQuality,0,100))this.options.webpAlphaQuality=e.alphaQuality;else throw f.invalidParameterError("alphaQuality","integer between 0 and 100",e.alphaQuality);if(f.defined(e.lossless))this._setBooleanOption("webpLossless",e.lossless);if(f.defined(e.nearLossless))this._setBooleanOption("webpNearLossless",e.nearLossless);if(f.defined(e.smartSubsample))this._setBooleanOption("webpSmartSubsample",e.smartSubsample);if(f.defined(e.smartDeblock))this._setBooleanOption("webpSmartDeblock",e.smartDeblock);if(f.defined(e.preset))if(f.string(e.preset)&&f.inArray(e.preset,["default","photo","picture","drawing","icon","text"]))this.options.webpPreset=e.preset;else throw f.invalidParameterError("preset","one of: default, photo, picture, drawing, icon, text",e.preset);if(f.defined(e.effort))if(f.integer(e.effort)&&f.inRange(e.effort,0,6))this.options.webpEffort=e.effort;else throw f.invalidParameterError("effort","integer between 0 and 6",e.effort);if(f.defined(e.minSize))this._setBooleanOption("webpMinSize",e.minSize);if(f.defined(e.mixed))this._setBooleanOption("webpMixed",e.mixed);if(f.defined(e.exact))this._setBooleanOption("webpExact",e.exact)}return Jh(e,this.options),this._updateFormatOut("webp",e)}function XV(e){if(f.object(e)){if(f.defined(e.reuse))this._setBooleanOption("gifReuse",e.reuse);if(f.defined(e.progressive))this._setBooleanOption("gifProgressive",e.progressive);let t=e.colours||e.colors;if(f.defined(t))if(f.integer(t)&&f.inRange(t,2,256))this.options.gifBitdepth=LE(t);else throw f.invalidParameterError("colours","integer between 2 and 256",t);if(f.defined(e.effort))if(f.integer(e.effort)&&f.inRange(e.effort,1,10))this.options.gifEffort=e.effort;else throw f.invalidParameterError("effort","integer between 1 and 10",e.effort);if(f.defined(e.dither))if(f.number(e.dither)&&f.inRange(e.dither,0,1))this.options.gifDither=e.dither;else throw f.invalidParameterError("dither","number between 0.0 and 1.0",e.dither);if(f.defined(e.interFrameMaxError))if(f.number(e.interFrameMaxError)&&f.inRange(e.interFrameMaxError,0,32))this.options.gifInterFrameMaxError=e.interFrameMaxError;else throw f.invalidParameterError("interFrameMaxError","number between 0.0 and 32.0",e.interFrameMaxError);if(f.defined(e.interPaletteMaxError))if(f.number(e.interPaletteMaxError)&&f.inRange(e.interPaletteMaxError,0,256))this.options.gifInterPaletteMaxError=e.interPaletteMaxError;else throw f.invalidParameterError("interPaletteMaxError","number between 0.0 and 256.0",e.interPaletteMaxError);if(f.defined(e.keepDuplicateFrames))if(f.bool(e.keepDuplicateFrames))this._setBooleanOption("gifKeepDuplicateFrames",e.keepDuplicateFrames);else throw f.invalidParameterError("keepDuplicateFrames","boolean",e.keepDuplicateFrames)}return Jh(e,this.options),this._updateFormatOut("gif",e)}function ZV(e){if(!this.constructor.format.jp2.output.buffer)throw DE();if(f.object(e)){if(f.defined(e.quality))if(f.integer(e.quality)&&f.inRange(e.quality,1,100))this.options.jp2Quality=e.quality;else throw f.invalidParameterError("quality","integer between 1 and 100",e.quality);if(f.defined(e.lossless))if(f.bool(e.lossless))this.options.jp2Lossless=e.lossless;else throw f.invalidParameterError("lossless","boolean",e.lossless);if(f.defined(e.tileWidth))if(f.integer(e.tileWidth)&&f.inRange(e.tileWidth,1,32768))this.options.jp2TileWidth=e.tileWidth;else throw f.invalidParameterError("tileWidth","integer between 1 and 32768",e.tileWidth);if(f.defined(e.tileHeight))if(f.integer(e.tileHeight)&&f.inRange(e.tileHeight,1,32768))this.options.jp2TileHeight=e.tileHeight;else throw f.invalidParameterError("tileHeight","integer between 1 and 32768",e.tileHeight);if(f.defined(e.chromaSubsampling))if(f.string(e.chromaSubsampling)&&f.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.jp2ChromaSubsampling=e.chromaSubsampling;else throw f.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling)}return this._updateFormatOut("jp2",e)}function Jh(e,t){if(f.object(e)&&f.defined(e.loop))if(f.integer(e.loop)&&f.inRange(e.loop,0,65535))t.loop=e.loop;else throw f.invalidParameterError("loop","integer between 0 and 65535",e.loop);if(f.object(e)&&f.defined(e.delay))if(f.integer(e.delay)&&f.inRange(e.delay,0,65535))t.delay=[e.delay];else if(Array.isArray(e.delay)&&f.inRange(e.delay.length,1,1e6)&&e.delay.every(f.integer)&&e.delay.every((r)=>f.inRange(r,0,65535)))t.delay=e.delay;else throw f.invalidParameterError("delay","integer or an array of integers between 0 and 65535",e.delay)}function QV(e){if(f.object(e)){if(f.defined(e.quality))if(f.integer(e.quality)&&f.inRange(e.quality,1,100))this.options.tiffQuality=e.quality;else throw f.invalidParameterError("quality","integer between 1 and 100",e.quality);if(f.defined(e.bitdepth))if(f.integer(e.bitdepth)&&f.inArray(e.bitdepth,[1,2,4]))this.options.tiffBitdepth=e.bitdepth;else throw f.invalidParameterError("bitdepth","1, 2 or 4",e.bitdepth);if(f.defined(e.tile))this._setBooleanOption("tiffTile",e.tile);if(f.defined(e.tileWidth))if(f.integer(e.tileWidth)&&f.inRange(e.tileWidth,1,32768))this.options.tiffTileWidth=e.tileWidth;else throw f.invalidParameterError("tileWidth","integer between 1 and 32768",e.tileWidth);if(f.defined(e.tileHeight))if(f.integer(e.tileHeight)&&f.inRange(e.tileHeight,1,32768))this.options.tiffTileHeight=e.tileHeight;else throw f.invalidParameterError("tileHeight","integer between 1 and 32768",e.tileHeight);if(f.defined(e.miniswhite))this._setBooleanOption("tiffMiniswhite",e.miniswhite);if(f.defined(e.pyramid))this._setBooleanOption("tiffPyramid",e.pyramid);if(f.defined(e.xres))if(f.number(e.xres)&&f.inRange(e.xres,0.001,1e6))this.options.tiffXres=e.xres;else throw f.invalidParameterError("xres","number between 0.001 and 1000000",e.xres);if(f.defined(e.yres))if(f.number(e.yres)&&f.inRange(e.yres,0.001,1e6))this.options.tiffYres=e.yres;else throw f.invalidParameterError("yres","number between 0.001 and 1000000",e.yres);if(f.defined(e.compression))if(f.string(e.compression)&&f.inArray(e.compression,["none","jpeg","deflate","packbits","ccittfax4","lzw","webp","zstd","jp2k"]))this.options.tiffCompression=e.compression;else throw f.invalidParameterError("compression","one of: none, jpeg, deflate, packbits, ccittfax4, lzw, webp, zstd, jp2k",e.compression);if(f.defined(e.bigtiff))this._setBooleanOption("tiffBigtiff",e.bigtiff);if(f.defined(e.predictor))if(f.string(e.predictor)&&f.inArray(e.predictor,["none","horizontal","float"]))this.options.tiffPredictor=e.predictor;else throw f.invalidParameterError("predictor","one of: none, horizontal, float",e.predictor);if(f.defined(e.resolutionUnit))if(f.string(e.resolutionUnit)&&f.inArray(e.resolutionUnit,["inch","cm"]))this.options.tiffResolutionUnit=e.resolutionUnit;else throw f.invalidParameterError("resolutionUnit","one of: inch, cm",e.resolutionUnit)}return this._updateFormatOut("tiff",e)}function e3(e){return this.heif({...e,compression:"av1"})}function t3(e){if(f.object(e)){if(f.string(e.compression)&&f.inArray(e.compression,["av1","hevc"]))this.options.heifCompression=e.compression;else throw f.invalidParameterError("compression","one of: av1, hevc",e.compression);if(f.defined(e.quality))if(f.integer(e.quality)&&f.inRange(e.quality,1,100))this.options.heifQuality=e.quality;else throw f.invalidParameterError("quality","integer between 1 and 100",e.quality);if(f.defined(e.lossless))if(f.bool(e.lossless))this.options.heifLossless=e.lossless;else throw f.invalidParameterError("lossless","boolean",e.lossless);if(f.defined(e.effort))if(f.integer(e.effort)&&f.inRange(e.effort,0,9))this.options.heifEffort=e.effort;else throw f.invalidParameterError("effort","integer between 0 and 9",e.effort);if(f.defined(e.chromaSubsampling))if(f.string(e.chromaSubsampling)&&f.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.heifChromaSubsampling=e.chromaSubsampling;else throw f.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling);if(f.defined(e.bitdepth))if(f.integer(e.bitdepth)&&f.inArray(e.bitdepth,[8,10,12]))this.options.heifBitdepth=e.bitdepth;else throw f.invalidParameterError("bitdepth","8, 10 or 12",e.bitdepth);if(f.defined(e.tune))if(f.string(e.tune)&&f.inArray(e.tune,["auto","iq","psnr","ssim"]))if(this.options.heifLossless&&e.tune==="iq")this.options.heifTune="ssim";else this.options.heifTune=e.tune;else throw f.invalidParameterError("tune","one of: auto, iq, psnr, ssim",e.tune)}else throw f.invalidParameterError("options","Object",e);return this._updateFormatOut("heif",e)}function r3(e){if(f.object(e)){if(f.defined(e.quality))if(f.integer(e.quality)&&f.inRange(e.quality,1,100))this.options.jxlDistance=e.quality>=30?0.1+(100-e.quality)*0.09:0.017666666666666667*e.quality*e.quality-1.15*e.quality+25;else throw f.invalidParameterError("quality","integer between 1 and 100",e.quality);else if(f.defined(e.distance))if(f.number(e.distance)&&f.inRange(e.distance,0,15))this.options.jxlDistance=e.distance;else throw f.invalidParameterError("distance","number between 0.0 and 15.0",e.distance);if(f.defined(e.decodingTier))if(f.integer(e.decodingTier)&&f.inRange(e.decodingTier,0,4))this.options.jxlDecodingTier=e.decodingTier;else throw f.invalidParameterError("decodingTier","integer between 0 and 4",e.decodingTier);if(f.defined(e.lossless))if(f.bool(e.lossless))this.options.jxlLossless=e.lossless;else throw f.invalidParameterError("lossless","boolean",e.lossless);if(f.defined(e.effort))if(f.integer(e.effort)&&f.inRange(e.effort,1,9))this.options.jxlEffort=e.effort;else throw f.invalidParameterError("effort","integer between 1 and 9",e.effort)}return Jh(e,this.options),this._updateFormatOut("jxl",e)}function n3(e){if(f.object(e)){if(f.defined(e.depth))if(f.string(e.depth)&&f.inArray(e.depth,["char","uchar","short","ushort","int","uint","float","complex","double","dpcomplex"]))this.options.rawDepth=e.depth;else throw f.invalidParameterError("depth","one of: char, uchar, short, ushort, int, uint, float, complex, double, dpcomplex",e.depth)}return this._updateFormatOut("raw")}function s3(e){if(f.object(e)){if(f.defined(e.size))if(f.integer(e.size)&&f.inRange(e.size,1,8192))this.options.tileSize=e.size;else throw f.invalidParameterError("size","integer between 1 and 8192",e.size);if(f.defined(e.overlap))if(f.integer(e.overlap)&&f.inRange(e.overlap,0,8192)){if(e.overlap>this.options.tileSize)throw f.invalidParameterError("overlap",`<= size (${this.options.tileSize})`,e.overlap);this.options.tileOverlap=e.overlap}else throw f.invalidParameterError("overlap","integer between 0 and 8192",e.overlap);if(f.defined(e.container))if(f.string(e.container)&&f.inArray(e.container,["fs","zip"]))this.options.tileContainer=e.container;else throw f.invalidParameterError("container","one of: fs, zip",e.container);if(f.defined(e.layout))if(f.string(e.layout)&&f.inArray(e.layout,["dz","google","iiif","iiif3","zoomify"]))this.options.tileLayout=e.layout;else throw f.invalidParameterError("layout","one of: dz, google, iiif, iiif3, zoomify",e.layout);if(f.defined(e.angle))if(f.integer(e.angle)&&!(e.angle%90))this.options.tileAngle=e.angle;else throw f.invalidParameterError("angle","positive/negative multiple of 90",e.angle);if(this._setBackgroundColourOption("tileBackground",e.background),f.defined(e.depth))if(f.string(e.depth)&&f.inArray(e.depth,["onepixel","onetile","one"]))this.options.tileDepth=e.depth;else throw f.invalidParameterError("depth","one of: onepixel, onetile, one",e.depth);if(f.defined(e.skipBlanks))if(f.integer(e.skipBlanks)&&f.inRange(e.skipBlanks,-1,65535))this.options.tileSkipBlanks=e.skipBlanks;else throw f.invalidParameterError("skipBlanks","integer between -1 and 255/65535",e.skipBlanks);else if(f.defined(e.layout)&&e.layout==="google")this.options.tileSkipBlanks=5;let t=f.bool(e.center)?e.center:e.centre;if(f.defined(t))this._setBooleanOption("tileCentre",t);if(f.defined(e.id))if(f.string(e.id))this.options.tileId=e.id;else throw f.invalidParameterError("id","string",e.id);if(f.defined(e.basename))if(f.string(e.basename))this.options.tileBasename=e.basename;else throw f.invalidParameterError("basename","string",e.basename)}if(f.inArray(this.options.formatOut,["jpeg","png","webp"]))this.options.tileFormat=this.options.formatOut;else if(this.options.formatOut!=="input")throw f.invalidParameterError("format","one of: jpeg, png, webp",this.options.formatOut);return this._updateFormatOut("dz")}function i3(e){if(!f.plainObject(e))throw f.invalidParameterError("options","object",e);if(f.integer(e.seconds)&&f.inRange(e.seconds,0,3600))this.options.timeoutSeconds=e.seconds;else throw f.invalidParameterError("seconds","integer between 0 and 3600",e.seconds);return this}function o3(e,t){if(!(f.object(t)&&t.force===!1))this.options.formatOut=e;return this}function a3(e,t){if(f.bool(t))this.options[e]=t;else throw f.invalidParameterError(e,"boolean",t)}function l3(){if(!this.options.streamOut){this.options.streamOut=!0;let e=Error();this._pipeline(void 0,e)}}function c3(e,t){if(typeof e==="function"){if(this._isStreamInput())this._whenStreamInFinished(()=>{this._flattenBufferIn(),Ve.pipeline(this.options,(r,n,s)=>{if(r)e(f.nativeError(r,t));else e(null,n,s)})});else Ve.pipeline(this.options,(r,n,s)=>{if(r)e(f.nativeError(r,t));else e(null,n,s)});return this}else if(this.options.streamOut){if(this._isStreamInput())this._whenStreamInFinished(()=>{this._flattenBufferIn(),Ve.pipeline(this.options,(r,n,s)=>{if(r)this.emit("error",f.nativeError(r,t));else this.emit("info",s),this.push(n);this.push(null),this.on("end",()=>this.emit("close"))})});else Ve.pipeline(this.options,(r,n,s)=>{if(r)this.emit("error",f.nativeError(r,t));else this.emit("info",s),this.push(n);this.push(null),this.on("end",()=>this.emit("close"))});return this}else if(this._isStreamInput())return new Promise((r,n)=>{this._whenStreamInFinished(()=>{this._flattenBufferIn(),Ve.pipeline(this.options,(s,i,o)=>{if(s)n(f.nativeError(s,t));else if(this.options.resolveWithObject)r({data:i,info:o});else r(i)})})});else return new Promise((r,n)=>{Ve.pipeline(this.options,(s,i,o)=>{if(s)n(f.nativeError(s,t));else if(this.options.resolveWithObject)r({data:i,info:o});else r(i)})})}var ME,OV,DE=()=>Error("JP2 output requires libvips with support for OpenJPEG"),LE=(e)=>1<<32-Math.clz32(Math.ceil(Math.log2(e))-1),FE=(e)=>{Object.assign(e.prototype,{toFile:CV,toBuffer:NV,toUint8Array:TV,withDensity:IV,keepExif:JV,withExif:MV,withExifMerge:DV,keepIccProfile:LV,withIccProfile:FV,keepGainMap:qV,withGainMap:VV,keepXmp:WV,withXmp:BV,keepMetadata:HV,withMetadata:UV,toFormat:zV,jpeg:GV,jp2:ZV,png:KV,webp:YV,tiff:QV,avif:e3,heif:t3,jxl:r3,gif:XV,raw:n3,tile:s3,timeout:i3,_updateFormatOut:o3,_setBooleanOption:a3,_read:l3,_pipeline:c3})};var qE=D(()=>{Cn();Gl();/*!
417
+ */f3={and:"and",or:"or",eor:"eor"}});import tg from"node:path";function b3(e,t){let r;if(!f.string(e))r=Error("Missing output file path");else if(f.string(this.options.input.file)&&tg.resolve(this.options.input.file)===tg.resolve(e))r=Error("Cannot use same file for input and output");else if(y3.test(tg.extname(e))&&!this.constructor.format.jp2.output.file)r=a1();if(r)if(f.fn(t))t(r);else return Promise.reject(r);else{this.options.fileOut=e;let n=Error();return this._pipeline(t,n)}return this}function x3(e,t){if(f.object(e))this._setBooleanOption("resolveWithObject",e.resolveWithObject);else if(this.options.resolveWithObject)this.options.resolveWithObject=!1;this.options.fileOut="";let r=Error();return this._pipeline(f.fn(e)?e:t,r)}function $3(){this.options.resolveWithObject=!0,this.options.typedArrayOut=!0;let e=Error();return this._pipeline(null,e)}function w3(e){if(f.number(e)&&e>0)this.options.withMetadataDensity=e;else throw f.invalidParameterError("density","positive number",e);return this.keepExif()}function v3(){return this.options.keepMetadata|=1,this}function S3(e){if(f.object(e))for(let[t,r]of Object.entries(e))if(f.object(r))for(let[n,s]of Object.entries(r))if(f.string(s))this.options.withExif[`exif-${t.toLowerCase()}-${n}`]=s;else throw f.invalidParameterError(`${t}.${n}`,"string",s);else throw f.invalidParameterError(t,"object",r);else throw f.invalidParameterError("exif","object",e);return this.options.withExifMerge=!1,this.keepExif()}function E3(e){return this.withExif(e),this.options.withExifMerge=!0,this}function P3(){return this.options.keepMetadata|=8,this}function j3(e,t){if(f.string(e))this.options.withIccProfile=e;else throw f.invalidParameterError("icc","string",e);if(this.keepIccProfile(),f.object(t)){if(f.defined(t.attach))if(f.bool(t.attach)){if(!t.attach)this.options.keepMetadata&=-9}else throw f.invalidParameterError("attach","boolean",t.attach)}return this}function k3(){return this.options.keepGainMap=!0,this.options.withGainMap=!1,this.options.keepMetadata|=32,this}function _3(){return this.options.withGainMap=!0,this.options.keepGainMap=!1,this.options.colourspace="scrgb",this}function A3(){return this.options.keepMetadata|=2,this}function R3(e){if(f.string(e)&&e.length>0)this.options.withXmp=e,this.options.keepMetadata|=2;else throw f.invalidParameterError("xmp","non-empty string",e);return this}function O3(){return this.options.keepMetadata|=31,this}function N3(e){if(this.keepMetadata(),this.withIccProfile("srgb"),f.object(e)){if(f.defined(e.orientation))if(f.integer(e.orientation)&&f.inRange(e.orientation,1,8))this.options.withMetadataOrientation=e.orientation;else throw f.invalidParameterError("orientation","integer between 1 and 8",e.orientation);if(f.defined(e.density))if(f.number(e.density)&&e.density>0)this.options.withMetadataDensity=e.density;else throw f.invalidParameterError("density","positive number",e.density);if(f.defined(e.icc))this.withIccProfile(e.icc);if(f.defined(e.exif))this.withExifMerge(e.exif)}return this}function C3(e,t){let r=o1.get((f.object(e)&&f.string(e.id)?e.id:e).toLowerCase());if(!r)throw f.invalidParameterError("format",`one of: ${[...o1.keys()].join(", ")}`,e);return this[r](t)}function T3(e){if(f.object(e)){if(f.defined(e.quality))if(f.integer(e.quality)&&f.inRange(e.quality,1,100))this.options.jpegQuality=e.quality;else throw f.invalidParameterError("quality","integer between 1 and 100",e.quality);if(f.defined(e.progressive))this._setBooleanOption("jpegProgressive",e.progressive);if(f.defined(e.chromaSubsampling))if(f.string(e.chromaSubsampling)&&f.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.jpegChromaSubsampling=e.chromaSubsampling;else throw f.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling);let t=f.bool(e.optimizeCoding)?e.optimizeCoding:e.optimiseCoding;if(f.defined(t))this._setBooleanOption("jpegOptimiseCoding",t);if(f.defined(e.mozjpeg))if(f.bool(e.mozjpeg)){if(e.mozjpeg)this.options.jpegTrellisQuantisation=!0,this.options.jpegOvershootDeringing=!0,this.options.jpegOptimiseScans=!0,this.options.jpegProgressive=!0,this.options.jpegQuantisationTable=3}else throw f.invalidParameterError("mozjpeg","boolean",e.mozjpeg);let r=f.bool(e.trellisQuantization)?e.trellisQuantization:e.trellisQuantisation;if(f.defined(r))this._setBooleanOption("jpegTrellisQuantisation",r);if(f.defined(e.overshootDeringing))this._setBooleanOption("jpegOvershootDeringing",e.overshootDeringing);let n=f.bool(e.optimizeScans)?e.optimizeScans:e.optimiseScans;if(f.defined(n)){if(this._setBooleanOption("jpegOptimiseScans",n),n)this.options.jpegProgressive=!0}let s=f.number(e.quantizationTable)?e.quantizationTable:e.quantisationTable;if(f.defined(s))if(f.integer(s)&&f.inRange(s,0,8))this.options.jpegQuantisationTable=s;else throw f.invalidParameterError("quantisationTable","integer between 0 and 8",s)}return this._updateFormatOut("jpeg",e)}function I3(e){if(f.object(e)){if(f.defined(e.progressive))this._setBooleanOption("pngProgressive",e.progressive);if(f.defined(e.compressionLevel))if(f.integer(e.compressionLevel)&&f.inRange(e.compressionLevel,0,9))this.options.pngCompressionLevel=e.compressionLevel;else throw f.invalidParameterError("compressionLevel","integer between 0 and 9",e.compressionLevel);if(f.defined(e.adaptiveFiltering))this._setBooleanOption("pngAdaptiveFiltering",e.adaptiveFiltering);let t=e.colours||e.colors;if(f.defined(t))if(f.integer(t)&&f.inRange(t,2,256))this.options.pngBitdepth=l1(t);else throw f.invalidParameterError("colours","integer between 2 and 256",t);if(f.defined(e.palette))this._setBooleanOption("pngPalette",e.palette);else if([e.quality,e.effort,e.colours,e.colors,e.dither].some(f.defined))this._setBooleanOption("pngPalette",!0);if(this.options.pngPalette){if(f.defined(e.quality))if(f.integer(e.quality)&&f.inRange(e.quality,0,100))this.options.pngQuality=e.quality;else throw f.invalidParameterError("quality","integer between 0 and 100",e.quality);if(f.defined(e.effort))if(f.integer(e.effort)&&f.inRange(e.effort,1,10))this.options.pngEffort=e.effort;else throw f.invalidParameterError("effort","integer between 1 and 10",e.effort);if(f.defined(e.dither))if(f.number(e.dither)&&f.inRange(e.dither,0,1))this.options.pngDither=e.dither;else throw f.invalidParameterError("dither","number between 0.0 and 1.0",e.dither)}}return this._updateFormatOut("png",e)}function J3(e){if(f.object(e)){if(f.defined(e.quality))if(f.integer(e.quality)&&f.inRange(e.quality,1,100))this.options.webpQuality=e.quality;else throw f.invalidParameterError("quality","integer between 1 and 100",e.quality);if(f.defined(e.alphaQuality))if(f.integer(e.alphaQuality)&&f.inRange(e.alphaQuality,0,100))this.options.webpAlphaQuality=e.alphaQuality;else throw f.invalidParameterError("alphaQuality","integer between 0 and 100",e.alphaQuality);if(f.defined(e.lossless))this._setBooleanOption("webpLossless",e.lossless);if(f.defined(e.nearLossless))this._setBooleanOption("webpNearLossless",e.nearLossless);if(f.defined(e.smartSubsample))this._setBooleanOption("webpSmartSubsample",e.smartSubsample);if(f.defined(e.smartDeblock))this._setBooleanOption("webpSmartDeblock",e.smartDeblock);if(f.defined(e.preset))if(f.string(e.preset)&&f.inArray(e.preset,["default","photo","picture","drawing","icon","text"]))this.options.webpPreset=e.preset;else throw f.invalidParameterError("preset","one of: default, photo, picture, drawing, icon, text",e.preset);if(f.defined(e.effort))if(f.integer(e.effort)&&f.inRange(e.effort,0,6))this.options.webpEffort=e.effort;else throw f.invalidParameterError("effort","integer between 0 and 6",e.effort);if(f.defined(e.minSize))this._setBooleanOption("webpMinSize",e.minSize);if(f.defined(e.mixed))this._setBooleanOption("webpMixed",e.mixed);if(f.defined(e.exact))this._setBooleanOption("webpExact",e.exact)}return rg(e,this.options),this._updateFormatOut("webp",e)}function M3(e){if(f.object(e)){if(f.defined(e.reuse))this._setBooleanOption("gifReuse",e.reuse);if(f.defined(e.progressive))this._setBooleanOption("gifProgressive",e.progressive);let t=e.colours||e.colors;if(f.defined(t))if(f.integer(t)&&f.inRange(t,2,256))this.options.gifBitdepth=l1(t);else throw f.invalidParameterError("colours","integer between 2 and 256",t);if(f.defined(e.effort))if(f.integer(e.effort)&&f.inRange(e.effort,1,10))this.options.gifEffort=e.effort;else throw f.invalidParameterError("effort","integer between 1 and 10",e.effort);if(f.defined(e.dither))if(f.number(e.dither)&&f.inRange(e.dither,0,1))this.options.gifDither=e.dither;else throw f.invalidParameterError("dither","number between 0.0 and 1.0",e.dither);if(f.defined(e.interFrameMaxError))if(f.number(e.interFrameMaxError)&&f.inRange(e.interFrameMaxError,0,32))this.options.gifInterFrameMaxError=e.interFrameMaxError;else throw f.invalidParameterError("interFrameMaxError","number between 0.0 and 32.0",e.interFrameMaxError);if(f.defined(e.interPaletteMaxError))if(f.number(e.interPaletteMaxError)&&f.inRange(e.interPaletteMaxError,0,256))this.options.gifInterPaletteMaxError=e.interPaletteMaxError;else throw f.invalidParameterError("interPaletteMaxError","number between 0.0 and 256.0",e.interPaletteMaxError);if(f.defined(e.keepDuplicateFrames))if(f.bool(e.keepDuplicateFrames))this._setBooleanOption("gifKeepDuplicateFrames",e.keepDuplicateFrames);else throw f.invalidParameterError("keepDuplicateFrames","boolean",e.keepDuplicateFrames)}return rg(e,this.options),this._updateFormatOut("gif",e)}function D3(e){if(!this.constructor.format.jp2.output.buffer)throw a1();if(f.object(e)){if(f.defined(e.quality))if(f.integer(e.quality)&&f.inRange(e.quality,1,100))this.options.jp2Quality=e.quality;else throw f.invalidParameterError("quality","integer between 1 and 100",e.quality);if(f.defined(e.lossless))if(f.bool(e.lossless))this.options.jp2Lossless=e.lossless;else throw f.invalidParameterError("lossless","boolean",e.lossless);if(f.defined(e.tileWidth))if(f.integer(e.tileWidth)&&f.inRange(e.tileWidth,1,32768))this.options.jp2TileWidth=e.tileWidth;else throw f.invalidParameterError("tileWidth","integer between 1 and 32768",e.tileWidth);if(f.defined(e.tileHeight))if(f.integer(e.tileHeight)&&f.inRange(e.tileHeight,1,32768))this.options.jp2TileHeight=e.tileHeight;else throw f.invalidParameterError("tileHeight","integer between 1 and 32768",e.tileHeight);if(f.defined(e.chromaSubsampling))if(f.string(e.chromaSubsampling)&&f.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.jp2ChromaSubsampling=e.chromaSubsampling;else throw f.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling)}return this._updateFormatOut("jp2",e)}function rg(e,t){if(f.object(e)&&f.defined(e.loop))if(f.integer(e.loop)&&f.inRange(e.loop,0,65535))t.loop=e.loop;else throw f.invalidParameterError("loop","integer between 0 and 65535",e.loop);if(f.object(e)&&f.defined(e.delay))if(f.integer(e.delay)&&f.inRange(e.delay,0,65535))t.delay=[e.delay];else if(Array.isArray(e.delay)&&f.inRange(e.delay.length,1,1e6)&&e.delay.every(f.integer)&&e.delay.every((r)=>f.inRange(r,0,65535)))t.delay=e.delay;else throw f.invalidParameterError("delay","integer or an array of integers between 0 and 65535",e.delay)}function L3(e){if(f.object(e)){if(f.defined(e.quality))if(f.integer(e.quality)&&f.inRange(e.quality,1,100))this.options.tiffQuality=e.quality;else throw f.invalidParameterError("quality","integer between 1 and 100",e.quality);if(f.defined(e.bitdepth))if(f.integer(e.bitdepth)&&f.inArray(e.bitdepth,[1,2,4]))this.options.tiffBitdepth=e.bitdepth;else throw f.invalidParameterError("bitdepth","1, 2 or 4",e.bitdepth);if(f.defined(e.tile))this._setBooleanOption("tiffTile",e.tile);if(f.defined(e.tileWidth))if(f.integer(e.tileWidth)&&f.inRange(e.tileWidth,1,32768))this.options.tiffTileWidth=e.tileWidth;else throw f.invalidParameterError("tileWidth","integer between 1 and 32768",e.tileWidth);if(f.defined(e.tileHeight))if(f.integer(e.tileHeight)&&f.inRange(e.tileHeight,1,32768))this.options.tiffTileHeight=e.tileHeight;else throw f.invalidParameterError("tileHeight","integer between 1 and 32768",e.tileHeight);if(f.defined(e.miniswhite))this._setBooleanOption("tiffMiniswhite",e.miniswhite);if(f.defined(e.pyramid))this._setBooleanOption("tiffPyramid",e.pyramid);if(f.defined(e.xres))if(f.number(e.xres)&&f.inRange(e.xres,0.001,1e6))this.options.tiffXres=e.xres;else throw f.invalidParameterError("xres","number between 0.001 and 1000000",e.xres);if(f.defined(e.yres))if(f.number(e.yres)&&f.inRange(e.yres,0.001,1e6))this.options.tiffYres=e.yres;else throw f.invalidParameterError("yres","number between 0.001 and 1000000",e.yres);if(f.defined(e.compression))if(f.string(e.compression)&&f.inArray(e.compression,["none","jpeg","deflate","packbits","ccittfax4","lzw","webp","zstd","jp2k"]))this.options.tiffCompression=e.compression;else throw f.invalidParameterError("compression","one of: none, jpeg, deflate, packbits, ccittfax4, lzw, webp, zstd, jp2k",e.compression);if(f.defined(e.bigtiff))this._setBooleanOption("tiffBigtiff",e.bigtiff);if(f.defined(e.predictor))if(f.string(e.predictor)&&f.inArray(e.predictor,["none","horizontal","float"]))this.options.tiffPredictor=e.predictor;else throw f.invalidParameterError("predictor","one of: none, horizontal, float",e.predictor);if(f.defined(e.resolutionUnit))if(f.string(e.resolutionUnit)&&f.inArray(e.resolutionUnit,["inch","cm"]))this.options.tiffResolutionUnit=e.resolutionUnit;else throw f.invalidParameterError("resolutionUnit","one of: inch, cm",e.resolutionUnit)}return this._updateFormatOut("tiff",e)}function F3(e){return this.heif({...e,compression:"av1"})}function q3(e){if(f.object(e)){if(f.string(e.compression)&&f.inArray(e.compression,["av1","hevc"]))this.options.heifCompression=e.compression;else throw f.invalidParameterError("compression","one of: av1, hevc",e.compression);if(f.defined(e.quality))if(f.integer(e.quality)&&f.inRange(e.quality,1,100))this.options.heifQuality=e.quality;else throw f.invalidParameterError("quality","integer between 1 and 100",e.quality);if(f.defined(e.lossless))if(f.bool(e.lossless))this.options.heifLossless=e.lossless;else throw f.invalidParameterError("lossless","boolean",e.lossless);if(f.defined(e.effort))if(f.integer(e.effort)&&f.inRange(e.effort,0,9))this.options.heifEffort=e.effort;else throw f.invalidParameterError("effort","integer between 0 and 9",e.effort);if(f.defined(e.chromaSubsampling))if(f.string(e.chromaSubsampling)&&f.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.heifChromaSubsampling=e.chromaSubsampling;else throw f.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling);if(f.defined(e.bitdepth))if(f.integer(e.bitdepth)&&f.inArray(e.bitdepth,[8,10,12]))this.options.heifBitdepth=e.bitdepth;else throw f.invalidParameterError("bitdepth","8, 10 or 12",e.bitdepth);if(f.defined(e.tune))if(f.string(e.tune)&&f.inArray(e.tune,["auto","iq","psnr","ssim"]))if(this.options.heifLossless&&e.tune==="iq")this.options.heifTune="ssim";else this.options.heifTune=e.tune;else throw f.invalidParameterError("tune","one of: auto, iq, psnr, ssim",e.tune)}else throw f.invalidParameterError("options","Object",e);return this._updateFormatOut("heif",e)}function V3(e){if(f.object(e)){if(f.defined(e.quality))if(f.integer(e.quality)&&f.inRange(e.quality,1,100))this.options.jxlDistance=e.quality>=30?0.1+(100-e.quality)*0.09:0.017666666666666667*e.quality*e.quality-1.15*e.quality+25;else throw f.invalidParameterError("quality","integer between 1 and 100",e.quality);else if(f.defined(e.distance))if(f.number(e.distance)&&f.inRange(e.distance,0,15))this.options.jxlDistance=e.distance;else throw f.invalidParameterError("distance","number between 0.0 and 15.0",e.distance);if(f.defined(e.decodingTier))if(f.integer(e.decodingTier)&&f.inRange(e.decodingTier,0,4))this.options.jxlDecodingTier=e.decodingTier;else throw f.invalidParameterError("decodingTier","integer between 0 and 4",e.decodingTier);if(f.defined(e.lossless))if(f.bool(e.lossless))this.options.jxlLossless=e.lossless;else throw f.invalidParameterError("lossless","boolean",e.lossless);if(f.defined(e.effort))if(f.integer(e.effort)&&f.inRange(e.effort,1,9))this.options.jxlEffort=e.effort;else throw f.invalidParameterError("effort","integer between 1 and 9",e.effort)}return rg(e,this.options),this._updateFormatOut("jxl",e)}function B3(e){if(f.object(e)){if(f.defined(e.depth))if(f.string(e.depth)&&f.inArray(e.depth,["char","uchar","short","ushort","int","uint","float","complex","double","dpcomplex"]))this.options.rawDepth=e.depth;else throw f.invalidParameterError("depth","one of: char, uchar, short, ushort, int, uint, float, complex, double, dpcomplex",e.depth)}return this._updateFormatOut("raw")}function W3(e){if(f.object(e)){if(f.defined(e.size))if(f.integer(e.size)&&f.inRange(e.size,1,8192))this.options.tileSize=e.size;else throw f.invalidParameterError("size","integer between 1 and 8192",e.size);if(f.defined(e.overlap))if(f.integer(e.overlap)&&f.inRange(e.overlap,0,8192)){if(e.overlap>this.options.tileSize)throw f.invalidParameterError("overlap",`<= size (${this.options.tileSize})`,e.overlap);this.options.tileOverlap=e.overlap}else throw f.invalidParameterError("overlap","integer between 0 and 8192",e.overlap);if(f.defined(e.container))if(f.string(e.container)&&f.inArray(e.container,["fs","zip"]))this.options.tileContainer=e.container;else throw f.invalidParameterError("container","one of: fs, zip",e.container);if(f.defined(e.layout))if(f.string(e.layout)&&f.inArray(e.layout,["dz","google","iiif","iiif3","zoomify"]))this.options.tileLayout=e.layout;else throw f.invalidParameterError("layout","one of: dz, google, iiif, iiif3, zoomify",e.layout);if(f.defined(e.angle))if(f.integer(e.angle)&&!(e.angle%90))this.options.tileAngle=e.angle;else throw f.invalidParameterError("angle","positive/negative multiple of 90",e.angle);if(this._setBackgroundColourOption("tileBackground",e.background),f.defined(e.depth))if(f.string(e.depth)&&f.inArray(e.depth,["onepixel","onetile","one"]))this.options.tileDepth=e.depth;else throw f.invalidParameterError("depth","one of: onepixel, onetile, one",e.depth);if(f.defined(e.skipBlanks))if(f.integer(e.skipBlanks)&&f.inRange(e.skipBlanks,-1,65535))this.options.tileSkipBlanks=e.skipBlanks;else throw f.invalidParameterError("skipBlanks","integer between -1 and 255/65535",e.skipBlanks);else if(f.defined(e.layout)&&e.layout==="google")this.options.tileSkipBlanks=5;let t=f.bool(e.center)?e.center:e.centre;if(f.defined(t))this._setBooleanOption("tileCentre",t);if(f.defined(e.id))if(f.string(e.id))this.options.tileId=e.id;else throw f.invalidParameterError("id","string",e.id);if(f.defined(e.basename))if(f.string(e.basename))this.options.tileBasename=e.basename;else throw f.invalidParameterError("basename","string",e.basename)}if(f.inArray(this.options.formatOut,["jpeg","png","webp"]))this.options.tileFormat=this.options.formatOut;else if(this.options.formatOut!=="input")throw f.invalidParameterError("format","one of: jpeg, png, webp",this.options.formatOut);return this._updateFormatOut("dz")}function U3(e){if(!f.plainObject(e))throw f.invalidParameterError("options","object",e);if(f.integer(e.seconds)&&f.inRange(e.seconds,0,3600))this.options.timeoutSeconds=e.seconds;else throw f.invalidParameterError("seconds","integer between 0 and 3600",e.seconds);return this}function H3(e,t){if(!(f.object(t)&&t.force===!1))this.options.formatOut=e;return this}function z3(e,t){if(f.bool(t))this.options[e]=t;else throw f.invalidParameterError(e,"boolean",t)}function G3(){if(!this.options.streamOut){this.options.streamOut=!0;let e=Error();this._pipeline(void 0,e)}}function K3(e,t){if(typeof e==="function"){if(this._isStreamInput())this._whenStreamInFinished(()=>{this._flattenBufferIn(),Be.pipeline(this.options,(r,n,s)=>{if(r)e(f.nativeError(r,t));else e(null,n,s)})});else Be.pipeline(this.options,(r,n,s)=>{if(r)e(f.nativeError(r,t));else e(null,n,s)});return this}else if(this.options.streamOut){if(this._isStreamInput())this._whenStreamInFinished(()=>{this._flattenBufferIn(),Be.pipeline(this.options,(r,n,s)=>{if(r)this.emit("error",f.nativeError(r,t));else this.emit("info",s),this.push(n);this.push(null),this.on("end",()=>this.emit("close"))})});else Be.pipeline(this.options,(r,n,s)=>{if(r)this.emit("error",f.nativeError(r,t));else this.emit("info",s),this.push(n);this.push(null),this.on("end",()=>this.emit("close"))});return this}else if(this._isStreamInput())return new Promise((r,n)=>{this._whenStreamInFinished(()=>{this._flattenBufferIn(),Be.pipeline(this.options,(s,i,o)=>{if(s)n(f.nativeError(s,t));else if(this.options.resolveWithObject)r({data:i,info:o});else r(i)})})});else return new Promise((r,n)=>{Be.pipeline(this.options,(s,i,o)=>{if(s)n(f.nativeError(s,t));else if(this.options.resolveWithObject)r({data:i,info:o});else r(i)})})}var o1,y3,a1=()=>Error("JP2 output requires libvips with support for OpenJPEG"),l1=(e)=>1<<32-Math.clz32(Math.ceil(Math.log2(e))-1),c1=(e)=>{Object.assign(e.prototype,{toFile:b3,toBuffer:x3,toUint8Array:$3,withDensity:w3,keepExif:v3,withExif:S3,withExifMerge:E3,keepIccProfile:P3,withIccProfile:j3,keepGainMap:k3,withGainMap:_3,keepXmp:A3,withXmp:R3,keepMetadata:O3,withMetadata:N3,toFormat:C3,jpeg:T3,jp2:D3,png:I3,webp:J3,tiff:L3,avif:F3,heif:q3,jxl:V3,gif:M3,raw:B3,tile:W3,timeout:U3,_updateFormatOut:H3,_setBooleanOption:z3,_read:G3,_pipeline:K3})};var u1=M(()=>{Mn();sc();/*!
417
418
  Copyright 2013 Lovell Fuller and others.
418
419
  SPDX-License-Identifier: Apache-2.0
419
- */ME=new Map([["heic","heif"],["heif","heif"],["avif","avif"],["jpeg","jpeg"],["jpg","jpeg"],["jpe","jpeg"],["tile","tile"],["dz","tile"],["png","png"],["raw","raw"],["tiff","tiff"],["tif","tiff"],["webp","webp"],["gif","gif"],["jp2","jp2"],["jpx","jp2"],["j2k","jp2"],["j2c","jp2"],["jxl","jxl"]]),OV=/\.(jp[2x]|j2[kc])$/i});import u3 from"node:events";import{createRequire as f3}from"node:module";import{availableParallelism as d3}from"node:os";function WE(e){if(f.bool(e))if(e)return Ve.cache(50,20,100);else return Ve.cache(0,0,0);else if(f.object(e)){for(let t of["memory","files","items"]){let r=e[t];if(f.defined(r)&&!(f.integer(r)&&r>=0))throw f.invalidParameterError(t,"a positive integer",r)}return Ve.cache(e.memory,e.files,e.items)}else return Ve.cache()}function m3(e){return Ve.concurrency(f.integer(e)?e:null)}function g3(){return Ve.counters()}function y3(e){return Ve.simd(f.bool(e)?e:null)}function b3(e){if(f.object(e))if(Array.isArray(e.operation)&&e.operation.every(f.string))Ve.block(e.operation,!0);else throw f.invalidParameterError("operation","Array<string>",e.operation);else throw f.invalidParameterError("options","object",e)}function x3(e){if(f.object(e))if(Array.isArray(e.operation)&&e.operation.every(f.string))Ve.block(e.operation,!1);else throw f.invalidParameterError("operation","Array<string>",e.operation);else throw f.invalidParameterError("options","object",e)}var Kl,Mh,VE,Dh,ni,p3,$a,h3,BE=(e)=>{e.cache=WE,e.concurrency=m3,e.counters=g3,e.simd=y3,e.format=ni,e.interpolators=p3,e.versions=$a,e.queue=h3,e.block=b3,e.unblock=x3};var HE=D(()=>{Cn();jh();Gl();vf();Kl=br(sf(),1);/*!
420
+ */o1=new Map([["heic","heif"],["heif","heif"],["avif","avif"],["jpeg","jpeg"],["jpg","jpeg"],["jpe","jpeg"],["tile","tile"],["dz","tile"],["png","png"],["raw","raw"],["tiff","tiff"],["tif","tiff"],["webp","webp"],["gif","gif"],["jp2","jp2"],["jpx","jp2"],["j2k","jp2"],["j2c","jp2"],["jxl","jxl"]]),y3=/\.(jp[2x]|j2[kc])$/i});import X3 from"node:events";import{createRequire as Y3}from"node:module";import{availableParallelism as Z3}from"node:os";function d1(e){if(f.bool(e))if(e)return Be.cache(50,20,100);else return Be.cache(0,0,0);else if(f.object(e)){for(let t of["memory","files","items"]){let r=e[t];if(f.defined(r)&&!(f.integer(r)&&r>=0))throw f.invalidParameterError(t,"a positive integer",r)}return Be.cache(e.memory,e.files,e.items)}else return Be.cache()}function eB(e){return Be.concurrency(f.integer(e)?e:null)}function rB(){return Be.counters()}function nB(e){return Be.simd(f.bool(e)?e:null)}function sB(e){if(f.object(e))if(Array.isArray(e.operation)&&e.operation.every(f.string))Be.block(e.operation,!0);else throw f.invalidParameterError("operation","Array<string>",e.operation);else throw f.invalidParameterError("options","object",e)}function iB(e){if(f.object(e))if(Array.isArray(e.operation)&&e.operation.every(f.string))Be.block(e.operation,!1);else throw f.invalidParameterError("operation","Array<string>",e.operation);else throw f.invalidParameterError("options","object",e)}var ic,ng,f1,sg,oi,Q3,Ea,tB,p1=(e)=>{e.cache=d1,e.concurrency=eB,e.counters=rB,e.simd=nB,e.format=oi,e.interpolators=Q3,e.versions=Ea,e.queue=tB,e.block=sB,e.unblock=iB};var m1=M(()=>{Mn();Uh();sc();Jf();ic=xr(xf(),1);/*!
420
421
  Copyright 2013 Lovell Fuller and others.
421
422
  SPDX-License-Identifier: Apache-2.0
422
- */Mh=f3(import.meta.url),VE=Sf.runtimePlatformArch(),Dh=Ve.libvipsVersion(),ni=Ve.format();ni.heif.output.alias=["avif","heic"];ni.jpeg.output.alias=["jpe","jpg"];ni.tiff.output.alias=["tif"];ni.jp2.output.alias=["j2c","j2k","jp2","jpx"];p3={nearest:"nearest",bilinear:"bilinear",bicubic:"bicubic",locallyBoundedBicubic:"lbb",nohalo:"nohalo",vertexSplitQuadraticBasisSpline:"vsqbs"},$a={vips:Dh.semver};if(!Dh.isGlobal)if(!Dh.isWasm)try{$a=Mh(`@img/sharp-${VE}/versions`)}catch(e){try{$a=Mh(`@img/sharp-libvips-${VE}/versions`)}catch(t){}}else try{$a=Mh("@img/sharp-wasm32/versions")}catch(e){}$a.sharp=As.version;if($a.heif&&ni.heif)ni.heif.input.fileSuffix=[".avif"],ni.heif.output.alias=["avif"];WE(!0);if(!process.env.MALLOC_ARENA_MAX&&Kl.default.familySync()===Kl.default.GLIBC&&!Ve._isUsingJemalloc())Ve.concurrency(1);else if(Kl.default.familySync()===Kl.default.MUSL&&Ve.concurrency()===1024)Ve.concurrency(d3());h3=new u3.EventEmitter});var $3;var UE=D(()=>{aE();uE();gE();bE();wE();TE();JE();qE();HE();/*!
423
+ */ng=Y3(import.meta.url),f1=Mf.runtimePlatformArch(),sg=Be.libvipsVersion(),oi=Be.format();oi.heif.output.alias=["avif","heic"];oi.jpeg.output.alias=["jpe","jpg"];oi.tiff.output.alias=["tif"];oi.jp2.output.alias=["j2c","j2k","jp2","jpx"];Q3={nearest:"nearest",bilinear:"bilinear",bicubic:"bicubic",locallyBoundedBicubic:"lbb",nohalo:"nohalo",vertexSplitQuadraticBasisSpline:"vsqbs"},Ea={vips:sg.semver};if(!sg.isGlobal)if(!sg.isWasm)try{Ea=ng(`@img/sharp-${f1}/versions`)}catch(e){try{Ea=ng(`@img/sharp-libvips-${f1}/versions`)}catch(t){}}else try{Ea=ng("@img/sharp-wasm32/versions")}catch(e){}Ea.sharp=Cs.version;if(Ea.heif&&oi.heif)oi.heif.input.fileSuffix=[".avif"],oi.heif.output.alias=["avif"];d1(!0);if(!process.env.MALLOC_ARENA_MAX&&ic.default.familySync()===ic.default.GLIBC&&!Be._isUsingJemalloc())Be.concurrency(1);else if(ic.default.familySync()===ic.default.MUSL&&Be.concurrency()===1024)Be.concurrency(Z3());tB=new X3.EventEmitter});var oB;var h1=M(()=>{RE();CE();LE();qE();WE();n1();i1();u1();m1();/*!
423
424
  Copyright 2013 Lovell Fuller and others.
424
425
  SPDX-License-Identifier: Apache-2.0
425
- */cE(Mn);hE(Mn);yE(Mn);$E(Mn);NE(Mn);IE(Mn);FE(Mn);BE(Mn);$3=Mn});import{createHash as zE}from"node:crypto";import{existsSync as w3,mkdirSync as v3,readFileSync as S3}from"node:fs";import{basename as E3,extname as j3,resolve as Lh}from"node:path";import{createRequire as P3}from"node:module";async function GE(){if(wa)return wa;try{let e=await Promise.resolve().then(() => (UE(),{}));return wa=$3,wa}catch{}try{return wa=P3(Lh(process.cwd(),"package.json"))("sharp"),wa}catch(e){throw Error(`Sharp is required for image optimization but failed to load: ${je(e)}`,{cause:e})}}async function Fh(e){let r=await(await GE())(e).metadata();return{format:r.format??"unknown",height:r.height??0,width:r.width??0}}function Yl(e){let t=S3(e);return zE("md5").update(t).digest("hex").slice(0,8)}function KE(e){let t=JSON.stringify({formats:e.formats,quality:e.quality,v:_3,widths:e.widths});return zE("md5").update(t).digest("hex").slice(0,8)}function A3(e,t,r,n){return`${e}-${t}-${r}.${n}`}async function YE(e,t,r){let n=await GE(),s=await Fh(e),i=Yl(e),o=E3(e,j3(e)),a=Lh(t,"_optimized");v3(a,{recursive:!0});let l=[],c=r.widths.length>0?Math.max(...r.widths):s.width,u=r.widths.filter((m)=>m<=s.width);if(s.width<c&&!u.includes(s.width))u.push(s.width);if(u.length===0)u.push(s.width);u.sort((m,b)=>m-b);let p=[];for(let m of u)for(let b of r.formats){let g=A3(o,m,i,b),y=`/${k3}/${g}`,w=Lh(a,g);if(l.push({absolutePath:w,format:b,outputPath:y,width:m}),w3(w))continue;let j=r.quality[b]??80,S=n(e).resize(m).toFormat(b,{quality:j}).toFile(w).then(()=>{});p.push(S)}let h=4;for(let m=0;m<p.length;m+=h)await Promise.all(p.slice(m,m+h));return{contentHash:i,original:{format:s.format,height:s.height,width:s.width},variants:l}}function XE(e,t){return e.flatMap((r)=>r.format===t?[`${qh(r.outputPath)} ${r.width}w`]:[]).join(", ")}function qh(e){return e.split("/").map((t)=>encodeURIComponent(t)).join("/")}var wa=null,k3="images/_optimized",_3=2;var Vh=D(()=>{er()});import{existsSync as R3,mkdirSync as O3,readFileSync as C3,rmSync as N3,writeFileSync as T3}from"node:fs";import{basename as ZE,extname as I3,resolve as _f}from"node:path";import{execSync as J3}from"node:child_process";import{tmpdir as M3}from"node:os";function L3(){let e=process.env.npm_config_cache??process.env.NPM_CONFIG_CACHE;if(e)return e;try{let t=J3("npm config get cache",{cwd:M3(),encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:D3}).trim();return t&&t!=="undefined"?t:null}catch{return null}}function va(e){if(kf===void 0)kf=L3();if(kf)return _f(kf,"jxsuite-images",ZE(e));return _f(e,".cache/images")}function QE(e,t){return`${Yl(e)}:${KE(t)}:${ZE(e,I3(e))}`}function ej(e){let t=_f(va(e),"manifest.json");if(!R3(t))return{entries:{},touched:new Set,version:1};try{let r=JSON.parse(C3(t,"utf8"));return r.touched=new Set,r}catch{return{entries:{},touched:new Set,version:1}}}function tj(e,t,r={}){if(r.prune&&t.touched)F3(t,t.touched);let n=va(e);O3(n,{recursive:!0}),T3(_f(n,"manifest.json"),JSON.stringify({entries:t.entries,version:t.version},null,2),"utf8")}function F3(e,t){let r=new Set,n=Object.entries(e.entries);for(let[s,i]of n)if(t.has(s))for(let o of i.manifest.variants??[])r.add(o.absolutePath);for(let[s,i]of n){if(t.has(s))continue;for(let o of i.manifest.variants??[])if(!r.has(o.absolutePath))N3(o.absolutePath,{force:!0});delete e.entries[s]}}function rj(e,t){e.touched?.add(t);let r=e.entries[t];if(!r)return null;return r.manifest}function nj(e,t,r,n){e.touched?.add(t),e.entries[t]={manifest:n,source:r,timestamp:Date.now()}}var kf,D3=3000;var Wh=D(()=>{Vh()});function Bh(e,t){if(!t||sj(e.loading))return{};if(String(e.fetchpriority??"").toLowerCase()==="high")return{};return sj(e.decoding)?{loading:"lazy"}:{decoding:"async",loading:"lazy"}}var sj=(e)=>e!==void 0&&e!==null&&e!=="";import{existsSync as uj}from"node:fs";import{basename as q3,extname as fj,resolve as ij}from"node:path";async function W3(e,t){let r=t.get(e);if(!r){let n=Yl(e);try{let s=await Fh(e);r={width:s.width,height:s.height,hash:n}}catch(s){if(!oj)oj=!0,console.warn(`Could not read image dimensions (${je(s)}) — `+"emitting srcsets without width/height attributes.");r={width:null,height:null,hash:n}}t.set(e,r)}return r}function aj(e,t,r,n){let s=t.quality.webp??80,i=e.startsWith("/")?"":"/",o=n?`?v=${n}`:"",a=B3(e);return t.widths.filter((l)=>l<=r).toSorted((l,c)=>l-c).map((l)=>`/cdn-cgi/image/width=${l},quality=${s},fit=scale-down,format=auto${i}${a}${o} ${l}w`).join(", ")}function B3(e){return e.replaceAll(/[\s,]/g,(t)=>encodeURIComponent(t))}async function H3(e,t,r,n,s){let i=QE(e,r),o=rj(s,i);if(o){if(o.variants.every((c)=>uj(c.absolutePath)))return o}if(!o)console.log(` Optimizing ${q3(e)}...`);let a=await YE(e,va(n),r);return nj(s,i,t,a),a}function U3(e){if(!e)return!0;if(e.includes("${"))return!0;if(V3.some((t)=>e.startsWith(t)))return!0;if(dj.has(fj(e).toLowerCase()))return!0;return!1}function z3(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 r=new URL(e);if(dj.has(fj(r.pathname).toLowerCase()))return!1;return t.remoteDomains.includes(r.hostname)}catch{return!1}}function G3(e,t,r){let n=r?.length?cu(r,e):null;if(n)return n;if(e.startsWith("/"))return ij(t,"public",e.slice(1));return ij(t,e)}async function pj(e,t,r,n,s,i=[]){let o=new Map;return await mj(e,t,r,n,s??new Map,o,i),{imageRefs:o}}async function mj(e,t,r,n,s,i,o,a=null){if(e.tagName==="img"){if(await eW(e,t,r,n,s,i,o,a))return}if(O(e.innerHTML)&&e.innerHTML.includes("<img"))e.innerHTML=await iW(e.innerHTML,t,r,n,s,i,o);if(Array.isArray(e.children)){let l=gj(e,a);for(let c of e.children){if(!xr(c))continue;await mj(c,t,r,n,s,i,o,l)}}}async function hj(e,t,r,n,s,i,o,a){if(!O(e)||t)return null;let l=z3(e,r);if(!l&&U3(e))return null;if(l)return{dims:null,sources:[],srcset:aj(e,r,1/0,null)};let c=G3(e,n,a);if(!uj(c))return null;if(r.service==="cloudflare"){let g=await W3(c,i),y=aj(e,r,g.width??1/0,g.hash);return{dims:g.width&&g.height?{height:g.height,width:g.width}:null,sources:[],srcset:y}}let u=o.get(c);if(!u)u=await H3(c,e,r,n,s),o.set(c,u);let h=[...lj.filter((g)=>r.formats.includes(g)),...r.formats.filter((g)=>!lj.includes(g))].flatMap((g)=>{let y=XE(u.variants,g);return y===""?[]:[{srcset:y,type:K3.get(g)??`image/${g}`}]}),m=u.original?.width&&u.original.height?{height:u.original.height,width:u.original.width}:null,b=r.picture!==!1&&h.length>1;return{dims:m,fallbackSrc:X3(u.variants,r.formats),sources:b?h:[],srcset:h[0]?.srcset??""}}function X3(e,t){let r=Y3.find((s)=>t.includes(s));if(r===void 0)return;let n;for(let s of e)if(s.format===r&&(n===void 0||s.width>n.width))n=s;return n&&qh(n.outputPath)}function cj(e){if(!O(e))return null;let t=Z3.exec(e.trim());if(!t)return null;let r=Number(t[1]);return t[2]==="rem"?r*16:r}function gj(e,t){let{style:r}=e;if(!V(r))return t;let n=cj(r.maxWidth)??cj(r.width);if(n===null)return t;return t===null?n:Math.min(t,n)}function Q3(e){if(e===null)return;let t=Math.round(e);return`(max-width: ${t}px) 100vw, ${t}px`}async function eW(e,t,r,n,s,i,o,a=null){if(!e.attributes)e.attributes={};let l=e.attributes;if(l.src===void 0&&O(e.src))l.src=e.src,delete e.src;let c=t.optimize?await hj(l.src,l["data-no-optimize"]!==void 0,t,r,n,s,i,o):null,u=gj(e,a),p=l.sizes??Q3(u)??t.sizes;if(c){if(c.srcset!==""){if(l.srcset=c.srcset,l.sizes=p,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,Bh(l,t.lazyLoad)),c&&c.sources.length>0)return tW(e,c.sources,p),!0;return!1}function tW(e,t,r){let n={...e.attributes},s=n.sizes??r;delete n.srcset,delete n.sizes;let i={attributes:n,tagName:"img"};if(e.style!==void 0)i.style=e.style,delete e.style;let o=t.map((a)=>{let l={};if(s!=="")l.sizes=s;return l.srcset=a.srcset,l.type=a.type,{attributes:l,tagName:"source"}});o.push(i),e.tagName="picture",e.attributes={},e.children=o}async function iW(e,t,r,n,s,i,o){let a=[];for(let c of e.matchAll(rW)){let u=c[0],p=c[1],h=(Xl(p,"src")??"").replaceAll("&amp;","&"),m=nW.test(p),b=t.optimize&&h!==""&&!m?await hj(h,sW.test(p),t,r,n,s,i,o):null,g="";if(b&&b.srcset!=="")g+=` srcset="${b.srcset}" sizes="${t.sizes}"`;if(b?.dims&&!/\bwidth=/.test(p)&&!/\bheight=/.test(p))g+=` width="${b.dims.width}" height="${b.dims.height}"`;let y=Bh({decoding:Xl(p,"decoding"),fetchpriority:Xl(p,"fetchpriority"),loading:Xl(p,"loading")},t.lazyLoad);for(let[j,S]of Object.entries(y))g+=` ${j}="${S}"`;if(g==="")continue;let w=b&&b.sources.length>0?oW(p,b.sources,t.sizes,g):`<img${p}${g}>`;a.push({match:u,replacement:w})}let l=e;for(let{match:c,replacement:u}of a)l=l.replace(c,u);return l}function oW(e,t,r,n){let s=Xl(e,"sizes")??r,i=n.replace(/ srcset="[^"]*"/,"").replace(/ sizes="[^"]*"/,"");return`<picture>${t.map((a)=>`<source type="${a.type}" srcset="${a.srcset}" sizes="${s}">`).join("")}<img${e}${i}></picture>`}function Xl(e,t){return new RegExp(`\\b${t}="([^"]*)"`,"i").exec(e)?.[1]}var dj,V3,oj=!1,lj,K3,Y3,Z3,rW,nW,sW;var yj=D(()=>{Vh();Wh();Vr();ye();er();dj=new Set([".svg",".gif"]),V3=["http://","https://","data:","//"];lj=["avif","webp","jpeg","png"],K3=new Map([["avif","image/avif"],["jpeg","image/jpeg"],["png","image/png"],["webp","image/webp"]]);Y3=["jpeg","png"];Z3=/^(\d+(?:\.\d+)?)(px|rem)$/;rW=/<img\b([^>]*)>/gi,nW=/\bsrcset="/,sW=/\bdata-no-optimize\b/});import{createHash as aW}from"node:crypto";import{existsSync as lW}from"node:fs";import{join as bj}from"node:path";function uW(e,t){let r=e.replace(/^\//,"");return e.endsWith("/")||r===""?bj(t,r,"index.html"):bj(t,r)}function Uh(e){if(e===void 0)return null;if(e===!1)return!1;if(e===!0)return{};return e.enabled===!1?!1:e}function fW(e){let t=JSON.stringify({fallback:e.offlineFallback??null,precache:[...e.precache??[]].toSorted(),scope:e.scope??"/"});return aW("sha256").update(t,"utf8").digest("hex").slice(0,8)}function xj(e,t,r=""){let n=[],s=[],i=[...e.precache??[]],o=e.offlineFallback;if(o!==void 0&&!i.includes(o))i.push(o),n.push(`serviceWorker: "${o}" 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 h of i)if(!h.startsWith("/"))s.push(`serviceWorker.precache: "${h}" must be a site-absolute URL starting with /.`);else if(!lW(uW(h,t)))s.push(`serviceWorker.precache: "${h}" is not a file this build produced — `+"`cache.addAll()` is all-or-nothing, so one bad entry stops the worker installing.")}let a=i.map((h)=>Xe(r,h)),l=Xe(r,cW),c=o===void 0?null:Xe(r,o),u=`jx-${fW(e)}`,p=`/*
426
+ */NE(Vn);DE(Vn);FE(Vn);BE(Vn);r1(Vn);s1(Vn);c1(Vn);p1(Vn);oB=Vn});import{createHash as g1}from"node:crypto";import{existsSync as aB,mkdirSync as lB,readFileSync as cB}from"node:fs";import{basename as uB,extname as fB,resolve as ig}from"node:path";import{createRequire as dB}from"node:module";async function y1(){if(Pa)return Pa;try{let e=await Promise.resolve().then(() => (h1(),{}));return Pa=oB,Pa}catch{}try{return Pa=dB(ig(process.cwd(),"package.json"))("sharp"),Pa}catch(e){throw Error(`Sharp is required for image optimization but failed to load: ${Pe(e)}`,{cause:e})}}async function og(e){let r=await(await y1())(e).metadata();return{format:r.format??"unknown",height:r.height??0,width:r.width??0}}function oc(e){let t=cB(e);return g1("md5").update(t).digest("hex").slice(0,8)}function b1(e){let t=JSON.stringify({formats:e.formats,quality:e.quality,v:mB,widths:e.widths});return g1("md5").update(t).digest("hex").slice(0,8)}function hB(e,t,r,n){return`${e}-${t}-${r}.${n}`}async function x1(e,t,r){let n=await y1(),s=await og(e),i=oc(e),o=uB(e,fB(e)),a=ig(t,"_optimized");lB(a,{recursive:!0});let l=[],c=r.widths.length>0?Math.max(...r.widths):s.width,u=r.widths.filter((m)=>m<=s.width);if(s.width<c&&!u.includes(s.width))u.push(s.width);if(u.length===0)u.push(s.width);u.sort((m,y)=>m-y);let p=[];for(let m of u)for(let y of r.formats){let g=hB(o,m,i,y),b=`/${pB}/${g}`,w=ig(a,g);if(l.push({absolutePath:w,format:y,outputPath:b,width:m}),aB(w))continue;let j=r.quality[y]??80,S=n(e).resize(m).toFormat(y,{quality:j}).toFile(w).then(()=>{});p.push(S)}let h=4;for(let m=0;m<p.length;m+=h)await Promise.all(p.slice(m,m+h));return{contentHash:i,original:{format:s.format,height:s.height,width:s.width},variants:l}}function $1(e,t){return e.flatMap((r)=>r.format===t?[`${ag(r.outputPath)} ${r.width}w`]:[]).join(", ")}function ag(e){return e.split("/").map((t)=>encodeURIComponent(t)).join("/")}var Pa=null,pB="images/_optimized",mB=2;var lg=M(()=>{er()});import{existsSync as gB,mkdirSync as yB,readFileSync as bB,rmSync as xB,writeFileSync as $B}from"node:fs";import{basename as w1,extname as wB,resolve as Vf}from"node:path";import{execSync as vB}from"node:child_process";import{tmpdir as SB}from"node:os";function PB(){let e=process.env.npm_config_cache??process.env.NPM_CONFIG_CACHE;if(e)return e;try{let t=vB("npm config get cache",{cwd:SB(),encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:EB}).trim();return t&&t!=="undefined"?t:null}catch{return null}}function ja(e){if(qf===void 0)qf=PB();if(qf)return Vf(qf,"jxsuite-images",w1(e));return Vf(e,".cache/images")}function v1(e,t){return`${oc(e)}:${b1(t)}:${w1(e,wB(e))}`}function S1(e){let t=Vf(ja(e),"manifest.json");if(!gB(t))return{entries:{},touched:new Set,version:1};try{let r=JSON.parse(bB(t,"utf8"));return r.touched=new Set,r}catch{return{entries:{},touched:new Set,version:1}}}function E1(e,t,r={}){if(r.prune&&t.touched)jB(t,t.touched);let n=ja(e);yB(n,{recursive:!0}),$B(Vf(n,"manifest.json"),JSON.stringify({entries:t.entries,version:t.version},null,2),"utf8")}function jB(e,t){let r=new Set,n=Object.entries(e.entries);for(let[s,i]of n)if(t.has(s))for(let o of i.manifest.variants??[])r.add(o.absolutePath);for(let[s,i]of n){if(t.has(s))continue;for(let o of i.manifest.variants??[])if(!r.has(o.absolutePath))xB(o.absolutePath,{force:!0});delete e.entries[s]}}function P1(e,t){e.touched?.add(t);let r=e.entries[t];if(!r)return null;return r.manifest}function j1(e,t,r,n){e.touched?.add(t),e.entries[t]={manifest:n,source:r,timestamp:Date.now()}}var qf,EB=3000;var cg=M(()=>{lg()});function ug(e,t){if(!t||k1(e.loading))return{};if(String(e.fetchpriority??"").toLowerCase()==="high")return{};return k1(e.decoding)?{loading:"lazy"}:{decoding:"async",loading:"lazy"}}var k1=(e)=>e!==void 0&&e!==null&&e!=="";function A1(e){let t=e.lastIndexOf(".");return kB.get(t>0?e.slice(t).toLowerCase():"")??null}function Wf(e){try{return AB.decode(e)}catch{throw new zr("The metadata is not valid UTF-8.")}}function Bf(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function ac(e,t,r){return String.fromCodePoint(...e.subarray(t,t+r))}function R1(e,t){switch(t){case"jpeg":return NB(e).packet;case"png":return JB(e).packet;case"webp":return DB(e).packet;default:return VB(Wf(e)).packet}}function RB(e){if(e[0]!==255||e[1]!==216)throw new zr("Not a JPEG file.");let t=[],r=2;while(r+4<=e.length){if(e[r]!==255)throw new zr("The JPEG's markers are damaged.");let n=e[r+1]??0;if(n===255){r+=1;continue}if(n===218||n===217)break;let s=Bf(e).getUint16(r+2),i=r+2+s;if(s<2||i>e.length)throw new zr("The JPEG's markers are damaged.");t.push({end:i,marker:n,start:r}),r=i}return t}function OB(e,t){let r=t.start+4;return t.marker===225&&t.end-r>=fg.length&&fg.every((n,s)=>e[r+s]===n)}function NB(e){let t=RB(e),r=t.find((s)=>OB(e,s));return{packet:r===void 0?null:Wf(e.subarray(r.start+4+fg.length,r.end)),parts:t}}function TB(e){if(!_1.every((n,s)=>e[s]===n))throw new zr("Not a PNG file.");let t=[],r=_1.length;while(r+12<=e.length){let n=Bf(e).getUint32(r),s=r+12+n;if(s>e.length)throw new zr("The PNG's chunks are damaged.");let i=ac(e,r+4,4);if(t.push({dataStart:r+8,end:s,start:r,type:i}),r=s,i==="IEND")break}return t}function IB(e,t){if(t.type!=="iTXt")return null;let r=e.subarray(t.dataStart,t.end-4),n=r.indexOf(0);if(n===-1||ac(r,0,n)!==CB)return null;if(r[n+1]!==0)throw new zr("The PNG's metadata is compressed, which Studio does not rewrite.");let s=r.indexOf(0,n+3),i=s===-1?-1:r.indexOf(0,s+1);if(i===-1)throw new zr("The PNG's metadata chunk is damaged.");return Wf(r.subarray(i+1))}function JB(e){let t=TB(e);return{packet:t.map((n)=>IB(e,n)).find((n)=>n!==null)??null,parts:t}}function MB(e){if(ac(e,0,4)!=="RIFF"||ac(e,8,4)!=="WEBP")throw new zr("Not a WebP file.");let t=Math.min(e.length,8+Bf(e).getUint32(4,!0)),r=[],n=12;while(n+8<=t){let s=Bf(e).getUint32(n+4,!0),i=n+8,o=i+s+s%2;if(i+s>t)throw new zr("The WebP's chunks are damaged.");r.push({dataStart:i,end:Math.min(o,t),fourcc:ac(e,n,4),size:s,start:n}),n=o}return r}function DB(e){let t=MB(e),r=t.find((s)=>s.fourcc==="XMP ");return{packet:r===void 0?null:Wf(e.subarray(r.dataStart,r.dataStart+r.size)),parts:t}}function FB(e,t){let r=null;for(let n=t+1;n<e.length;n++){let s=e[n];if(r!==null){if(s===r)r=null}else if(s==='"'||s==="'")r=s;else if(s===">")return n}return-1}function qB(e){let t=/<svg[\s>/]/.exec(e);if(t===null)throw new zr("Not an SVG file.");let r=FB(e,t.index);if(r===-1)throw new zr("The SVG's root element is damaged.");return{end:r,selfClosing:e[r-1]==="/",start:t.index}}function VB(e){qB(e);let t=LB.exec(e);return t===null?{end:-1,packet:null,start:-1}:{end:t.index+t[0].length,packet:t[0],start:t.index}}var zr,kB,_B,AB,fg,_1,CB="XML:com.adobe.xmp",LB;var O1=M(()=>{zr=class zr extends Error{name="XmpContainerError"};kB=new Map([[".jpeg","jpeg"],[".jpg","jpeg"],[".png","png"],[".svg","svg"],[".webp","webp"]]);_B=new TextEncoder,AB=new TextDecoder("utf-8",{fatal:!0});fg=_B.encode("http://ns.adobe.com/xap/1.0/\x00");_1=Uint8Array.of(137,80,78,71,13,10,26,10);LB=/<([\w.-]+:)?xmpmeta\b[\s\S]*?<\/\1?xmpmeta\s*>/});function N1(){return{alt:"",focus:null,tags:[]}}function WB(e){if(e.startsWith("#x")||e.startsWith("#X"))return Number.parseInt(e.slice(2),16);return e.startsWith("#")?Number(e.slice(1)):null}function dg(e){return e.replaceAll(/&(#x[\da-f]+|#\d+|\w+);/gi,(t,r)=>{let n=WB(r),s=n===null?BB.get(r):n<=1114111?String.fromCodePoint(n):void 0;if(s===void 0)throw new Gr(`Unknown entity ${t}`);return s})}function UB(e){let t={attrs:[],children:[],name:"#root",type:"element"},r=[t],n=0,s=()=>r.at(-1)??t;while(n<e.length){let i=e.indexOf("<",n);if(i===-1){s().children.push({type:"text",value:dg(e.slice(n))});break}if(i>n)s().children.push({type:"text",value:dg(e.slice(n,i))});let o=e.slice(i,i+9),a;if(o.startsWith("<!--"))a=e.indexOf("-->",i),a=a===-1?-1:a+3;else if(o.startsWith("<![CDATA["))a=e.indexOf("]]>",i),a=a===-1?-1:a+3;else if(o.startsWith("<?"))a=e.indexOf("?>",i),a=a===-1?-1:a+2;else if(o.startsWith("<!"))throw new Gr("A packet may not declare a document type.");else if(o.startsWith("</")){let l=e.indexOf(">",i);if(l===-1)throw new Gr("Unclosed end tag.");let c=e.slice(i+2,l).trim(),u=r.pop();if(u===void 0||u===t||u.name!==c)throw new Gr(`Unexpected </${c}>.`);n=l+1;continue}else{n=HB(e,i,r);continue}if(a===-1)throw new Gr("Unterminated markup.");s().children.push({source:e.slice(i,a),type:"raw"}),n=a}if(r.length!==1)throw new Gr(`<${s().name}> is never closed.`);return t.children}function HB(e,t,r){let n=t+1,s=C1.exec(e.slice(n));if(s===null)throw new Gr("A tag has no name.");let i={attrs:[],children:[],name:s[0],type:"element"};n+=s[0].length;for(;;){while(/\s/.test(e[n]??""))n+=1;let o=e[n];if(o===void 0)throw new Gr(`<${i.name}> is never finished.`);if(o===">"||e.startsWith("/>",n)){if(r.at(-1)?.children.push(i),o===">")return r.push(i),n+1;return n+2}let a=C1.exec(e.slice(n));if(a===null)throw new Gr(`<${i.name}> has a malformed attribute.`);n+=a[0].length;while(/\s/.test(e[n]??""))n+=1;if(e[n]!=="=")throw new Gr(`${a[0]} has no value.`);n+=1;while(/\s/.test(e[n]??""))n+=1;let l=e[n];if(l!=='"'&&l!=="'")throw new Gr(`${a[0]} is not quoted.`);let c=e.indexOf(l,n+1);if(c===-1)throw new Gr(`${a[0]} is never closed.`);i.attrs.push([a[0],dg(e.slice(n+1,c))]),n=c+1}}function ka(e,t){let r=e.attrs.filter(([s])=>s==="xmlns"||s.startsWith("xmlns:"));if(r.length===0)return t;let n=new Map(t);for(let[s,i]of r)n.set(s==="xmlns"?"":s.slice(6),i);return n}function zB(e,t,r=!1){let n=e.indexOf(":");if(n===-1)return r?["",e]:[t.get("")??"",e];let s=e.slice(0,n),i=s==="xml"?"http://www.w3.org/XML/1998/namespace":t.get(s);return i===void 0?null:[i,e.slice(n+1)]}function vn(e,t,r,n,s=!1){let i=zB(e,t,s);return i!==null&&i[0]===r&&i[1]===n}function _a(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 I1(e,t=new Map){let r=[];for(let n of _a(e)){let s=ka(n,t);if(vn(n.name,s,"http://www.w3.org/1999/02/22-rdf-syntax-ns#","Description"))r.push([n,s]);else r.push(...I1(n.children,s))}return r}function Ra(e,t){let r=[];for(let n of _a(e.children)){let s=ka(n,t);for(let i of _a(n.children)){let o=ka(i,s);if(vn(i.name,o,"http://www.w3.org/1999/02/22-rdf-syntax-ns#","li"))r.push([i,o])}}return r}function GB(e,t){let r=e.attrs.find(([n])=>vn(n,t,"http://www.w3.org/XML/1998/namespace","lang",!0));return r===void 0?null:r[1]}function KB(e,t){let r=Ra(e,t),n=r.find(([s,i])=>GB(s,i)?.toLowerCase()==="x-default")??r[0];return n===void 0?Aa(e).trim():Aa(n[0])}function Uf(e,t){if(!e.attrs.some(([n,s])=>s==="Resource"&&vn(n,t,"http://www.w3.org/1999/02/22-rdf-syntax-ns#","parseType",!0)))for(let n of _a(e.children)){let s=ka(n,t);if(vn(n.name,s,"http://www.w3.org/1999/02/22-rdf-syntax-ns#","Description"))return[n,s]}return[e,t]}function cc(e,t,r,n){for(let s of _a(e.children)){let i=ka(s,t);if(vn(s.name,i,r,n))return[s,i]}return null}function lc(e,t,r,n){let s=e.attrs.find(([o])=>vn(o,t,r,n,!0));if(s!==void 0)return s[1].trim();let i=cc(e,t,r,n);return i===null?null:Aa(i[0]).trim()}function T1(e){if(e===null||e==="")return null;let t=Number(e);return Number.isFinite(t)&&t>=0&&t<=1?t:null}function XB(e,t){let r=cc(e,t,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rRole");if(r===null)return!1;return Ra(...r).some(([n,s])=>{let[i,o]=Uf(n,s),a=cc(i,o,"http://ns.adobe.com/xap/1.0/","Identifier");return(a===null?[lc(i,o,"http://ns.adobe.com/xap/1.0/","Identifier")??""]:Ra(...a).map(([c])=>Aa(c).trim())).some((c)=>c.replace(/^https:/,"http:")==="http://cv.iptc.org/newscodes/imageregionrole/areaOfInterest")})}function YB(e,t){let[r,n]=Uf(e,t),s=cc(r,n,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","RegionBoundary");if(s===null||!XB(r,n))return null;let[i,o]=Uf(...s),a=cc(i,o,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbVertices");if(lc(i,o,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbShape")!=="polygon"||lc(i,o,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbUnit")!=="relative"||a===null)return null;let l=Ra(...a);if(l.length!==1)return null;let[c,u]=Uf(...l[0]),p=T1(lc(c,u,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbX")),h=T1(lc(c,u,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbY"));return p===null||h===null?null:{x:p,y:h}}function ZB(e){let t=new Set,r=[];for(let n of e){let s=n.trim(),i=s.toLowerCase();if(s!==""&&!t.has(i))t.add(i),r.push(s)}return r}function J1(e){if(e===null)return N1();let t=N1(),r=!1;for(let[n,s]of I1(UB(e))){for(let[i,o]of n.attrs)if(!r&&vn(i,s,"http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/","AltTextAccessibility",!0))t.alt=o,r=!0;for(let i of _a(n.children)){let o=ka(i,s);if(!r&&vn(i.name,o,"http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/","AltTextAccessibility"))t.alt=KB(i,o),r=!0;else if(vn(i.name,o,"http://purl.org/dc/elements/1.1/","subject"))t.tags.push(...Ra(i,o).map(([a])=>Aa(a)));else if(t.focus===null&&vn(i.name,o,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","ImageRegion"))for(let[a,l]of Ra(i,o))t.focus??=YB(a,l)}}return t.tags=ZB(t.tags),t.alt=t.alt.trim(),t}var Gr,BB,C1;var M1=M(()=>{Gr=class Gr extends Error{name="XmpParseError"};BB=new Map([["amp","&"],["apos","'"],["gt",">"],["lt","<"],["quot",'"']]);C1=/^[A-Za-z_][\w.:-]*/});import{existsSync as U1,readFileSync as QB,statSync as eW}from"node:fs";import{basename as tW,extname as H1,resolve as D1}from"node:path";async function rW(e,t){let r=t.get(e);if(!r){let n=oc(e);try{let s=await og(e);r={width:s.width,height:s.height,hash:n}}catch(s){if(!L1)L1=!0,console.warn(`Could not read image dimensions (${Pe(s)}) — `+"emitting srcsets without width/height attributes.");r={width:null,height:null,hash:n}}t.set(e,r)}return r}function F1(e,t,r,n){let s=t.quality.webp??80,i=e.startsWith("/")?"":"/",o=n?`?v=${n}`:"",a=nW(e);return t.widths.filter((l)=>l<=r).toSorted((l,c)=>l-c).map((l)=>`/cdn-cgi/image/width=${l},quality=${s},fit=scale-down,format=auto${i}${a}${o} ${l}w`).join(", ")}function nW(e){return e.replaceAll(/[\s,]/g,(t)=>encodeURIComponent(t))}async function sW(e,t,r,n,s){let i=v1(e,r),o=P1(s,i);if(o){if(o.variants.every((c)=>U1(c.absolutePath)))return o}if(!o)console.log(` Optimizing ${tW(e)}...`);let a=await x1(e,ja(n),r);return j1(s,i,t,a),a}function iW(e){if(!e)return!0;if(e.includes("${"))return!0;if(G1.some((t)=>e.startsWith(t)))return!0;if(z1.has(H1(e).toLowerCase()))return!0;return!1}function oW(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 r=new URL(e);if(z1.has(H1(r.pathname).toLowerCase()))return!1;return t.remoteDomains.includes(r.hostname)}catch{return!1}}function K1(e,t,r){let n=r?.length?Su(r,e):null;if(n)return n;if(e.startsWith("/"))return D1(t,"public",e.slice(1));return D1(t,e)}function V1(e){return`${Math.round(e*1000)/10}%`}function aW(e){let t=A1(e);if(t===null)return null;let r;try{let i=eW(e);r=`${e}|${i.mtimeMs}|${i.size}`}catch{return null}let n=q1.get(r);if(n!==void 0)return n;let s=null;try{let i=new Uint8Array(QB(e)),{focus:o}=J1(R1(i,t));s=o===null?null:`${V1(o.x)} ${V1(o.y)}`}catch{s=null}return q1.set(r,s),s}function lW(e,t,r,n){if(!A(t)||t===""||t.includes("${"))return;if(G1.some((a)=>t.startsWith(a)))return;let{style:s}=e;if(s!==void 0&&!V(s))return;if(s?.objectPosition!==void 0)return;let[i=""]=t.split(/[?#]/),o=aW(K1(i,r,n));if(o!==null)e.style={...s,objectPosition:o}}async function X1(e,t,r,n,s,i=[]){let o=new Map;return await Y1(e,t,r,n,s??new Map,o,i),{imageRefs:o}}async function Y1(e,t,r,n,s,i,o,a=null){if(e.tagName==="img"){if(await mW(e,t,r,n,s,i,o,a))return}if(A(e.innerHTML)&&e.innerHTML.includes("<img"))e.innerHTML=await xW(e.innerHTML,t,r,n,s,i,o);if(Array.isArray(e.children)){let l=Q1(e,a);for(let c of e.children){if(!$r(c))continue;await Y1(c,t,r,n,s,i,o,l)}}}async function Z1(e,t,r,n,s,i,o,a){if(!A(e)||t)return null;let l=oW(e,r);if(!l&&iW(e))return null;if(l)return{dims:null,sources:[],srcset:F1(e,r,1/0,null)};let c=K1(e,n,a);if(!U1(c))return null;if(r.service==="cloudflare"){let g=await rW(c,i),b=F1(e,r,g.width??1/0,g.hash);return{dims:g.width&&g.height?{height:g.height,width:g.width}:null,sources:[],srcset:b}}let u=o.get(c);if(!u)u=await sW(c,e,r,n,s),o.set(c,u);let h=[...B1.filter((g)=>r.formats.includes(g)),...r.formats.filter((g)=>!B1.includes(g))].flatMap((g)=>{let b=$1(u.variants,g);return b===""?[]:[{srcset:b,type:cW.get(g)??`image/${g}`}]}),m=u.original?.width&&u.original.height?{height:u.original.height,width:u.original.width}:null,y=r.picture!==!1&&h.length>1;return{dims:m,fallbackSrc:fW(u.variants,r.formats),sources:y?h:[],srcset:h[0]?.srcset??""}}function fW(e,t){let r=uW.find((s)=>t.includes(s));if(r===void 0)return;let n;for(let s of e)if(s.format===r&&(n===void 0||s.width>n.width))n=s;return n&&ag(n.outputPath)}function W1(e){if(!A(e))return null;let t=dW.exec(e.trim());if(!t)return null;let r=Number(t[1]);return t[2]==="rem"?r*16:r}function Q1(e,t){let{style:r}=e;if(!V(r))return t;let n=W1(r.maxWidth)??W1(r.width);if(n===null)return t;return t===null?n:Math.min(t,n)}function pW(e){if(e===null)return;let t=Math.round(e);return`(max-width: ${t}px) 100vw, ${t}px`}async function mW(e,t,r,n,s,i,o,a=null){if(!e.attributes)e.attributes={};let l=e.attributes;if(l.src===void 0&&A(e.src))l.src=e.src,delete e.src;lW(e,l.src,r,o);let c=t.optimize?await Z1(l.src,l["data-no-optimize"]!==void 0,t,r,n,s,i,o):null,u=Q1(e,a),p=l.sizes??pW(u)??t.sizes;if(c){if(c.srcset!==""){if(l.srcset=c.srcset,l.sizes=p,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,ug(l,t.lazyLoad)),c&&c.sources.length>0)return hW(e,c.sources,p),!0;return!1}function hW(e,t,r){let n={...e.attributes},s=n.sizes??r;delete n.srcset,delete n.sizes;let i={attributes:n,tagName:"img"};if(e.style!==void 0)i.style=e.style,delete e.style;let o=t.map((a)=>{let l={};if(s!=="")l.sizes=s;return l.srcset=a.srcset,l.type=a.type,{attributes:l,tagName:"source"}});o.push(i),e.tagName="picture",e.attributes={},e.children=o}async function xW(e,t,r,n,s,i,o){let a=[];for(let c of e.matchAll(gW)){let u=c[0],p=c[1],h=(uc(p,"src")??"").replaceAll("&amp;","&"),m=yW.test(p),y=t.optimize&&h!==""&&!m?await Z1(h,bW.test(p),t,r,n,s,i,o):null,g="";if(y&&y.srcset!=="")g+=` srcset="${y.srcset}" sizes="${t.sizes}"`;if(y?.dims&&!/\bwidth=/.test(p)&&!/\bheight=/.test(p))g+=` width="${y.dims.width}" height="${y.dims.height}"`;let b=ug({decoding:uc(p,"decoding"),fetchpriority:uc(p,"fetchpriority"),loading:uc(p,"loading")},t.lazyLoad);for(let[j,S]of Object.entries(b))g+=` ${j}="${S}"`;if(g==="")continue;let w=y&&y.sources.length>0?$W(p,y.sources,t.sizes,g):`<img${p}${g}>`;a.push({match:u,replacement:w})}let l=e;for(let{match:c,replacement:u}of a)l=l.replace(c,u);return l}function $W(e,t,r,n){let s=uc(e,"sizes")??r,i=n.replace(/ srcset="[^"]*"/,"").replace(/ sizes="[^"]*"/,"");return`<picture>${t.map((a)=>`<source type="${a.type}" srcset="${a.srcset}" sizes="${s}">`).join("")}<img${e}${i}></picture>`}function uc(e,t){return new RegExp(`\\b${t}="([^"]*)"`,"i").exec(e)?.[1]}var z1,G1,L1=!1,q1,B1,cW,uW,dW,gW,yW,bW;var eP=M(()=>{lg();cg();Vr();ye();er();O1();M1();z1=new Set([".svg",".gif"]),G1=["http://","https://","data:","//"];q1=new Map;B1=["avif","webp","jpeg","png"],cW=new Map([["avif","image/avif"],["jpeg","image/jpeg"],["png","image/png"],["webp","image/webp"]]);uW=["jpeg","png"];dW=/^(\d+(?:\.\d+)?)(px|rem)$/;gW=/<img\b([^>]*)>/gi,yW=/\bsrcset="/,bW=/\bdata-no-optimize\b/});import{createHash as wW}from"node:crypto";import{existsSync as vW}from"node:fs";import{join as tP}from"node:path";function EW(e,t){let r=e.replace(/^\//,"");return e.endsWith("/")||r===""?tP(t,r,"index.html"):tP(t,r)}function mg(e){if(e===void 0)return null;if(e===!1)return!1;if(e===!0)return{};return e.enabled===!1?!1:e}function PW(e){let t=JSON.stringify({fallback:e.offlineFallback??null,precache:[...e.precache??[]].toSorted(),scope:e.scope??"/"});return wW("sha256").update(t,"utf8").digest("hex").slice(0,8)}function rP(e,t,r=""){let n=[],s=[],i=[...e.precache??[]],o=e.offlineFallback;if(o!==void 0&&!i.includes(o))i.push(o),n.push(`serviceWorker: "${o}" 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 h of i)if(!h.startsWith("/"))s.push(`serviceWorker.precache: "${h}" must be a site-absolute URL starting with /.`);else if(!vW(EW(h,t)))s.push(`serviceWorker.precache: "${h}" is not a file this build produced — `+"`cache.addAll()` is all-or-nothing, so one bad entry stops the worker installing.")}let a=i.map((h)=>Ye(r,h)),l=Ye(r,SW),c=o===void 0?null:Ye(r,o),u=`jx-${PW(e)}`,p=`/*
426
427
  * Generated by @jxsuite/compiler — configure via \`serviceWorker\` in project.json.
427
428
  * Set \`"serviceWorker": false\` to replace this with a worker that removes itself.
428
429
  */
@@ -512,7 +513,7 @@ self.addEventListener("fetch", (event) => {
512
513
  })(),
513
514
  );
514
515
  });
515
- `;return{errors:s,path:Hh,source:p,warnings:n}}function $j(){return{errors:[],path:Hh,source:`/*
516
+ `;return{errors:s,path:pg,source:p,warnings:n}}function nP(){return{errors:[],path:pg,source:`/*
516
517
  * Generated by @jxsuite/compiler. This site had a service worker and no longer does.
517
518
  *
518
519
  * A worker is sticky: removing the file would leave every previous visitor running the old one
@@ -535,96 +536,96 @@ self.addEventListener("activate", (event) => {
535
536
  })(),
536
537
  );
537
538
  });
538
- `,warnings:[]}}function wj(e,t=""){return`if('serviceWorker' in navigator){addEventListener('load',function(){navigator.serviceWorker.register('${Xe(t,`/${Hh}`)}',{scope:${JSON.stringify(Xe(t,e))}}).catch(function(){})})}`}var Hh="sw.js",cW="/images/_optimized/";var vj=D(()=>{Vr()});import{mkdirSync as dW,writeFileSync as pW}from"node:fs";import{dirname as mW,join as hW}from"node:path";function si(e,t,r){if(r!==void 0)e[t]=r}function Sj(e){let t=e.manifest,r=[],n=[];if(t===void 0||t.enabled===!1)return{errors:r,files:[],warnings:n};let s=t.name??e.name??"Jx Site",i=Hi(e.url),o=[];for(let u of t.icons??[])o.push(O(u.src)?{...u,src:Xe(i,u.src)}:u);let a={display:t.display??"standalone",icons:o,name:s,short_name:t.shortName??s,start_url:Xe(i,t.startUrl??"/")};si(a,"description",t.description),si(a,"theme_color",t.themeColor),si(a,"background_color",t.backgroundColor),si(a,"scope",t.scope===void 0?void 0:Xe(i,t.scope)),si(a,"orientation",t.orientation),si(a,"lang",t.lang),si(a,"dir",t.dir),si(a,"categories",t.categories);let l=new Set(o.flatMap((u)=>(u.sizes??"").split(/\s+/).map((p)=>Math.trunc(Number(p.split("x")[0]))))),c=gW.filter((u)=>!l.has(u));if(c.length>0)n.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:r,files:[{content:`${JSON.stringify(a,null,2)}
539
- `,path:"manifest.webmanifest"}],warnings:n}}function Ej(e){let t=e.manifest;if(t===void 0||t.enabled===!1)return[];let r=[{attributes:{href:"/manifest.webmanifest",rel:"manifest"},tagName:"link"}];if(t.themeColor!==void 0)r.push({attributes:{content:t.themeColor,name:"theme-color"},tagName:"meta"});return r}function jj(e,t){let r=e.securityTxt,n=[],s=[];if(r===void 0||r.enabled===!1)return{errors:n,files:[],warnings:s};let i=r.contact??[];if(i.length===0)n.push("securityTxt: at least one `contact` is required (RFC 9116 §2.5.3).");if(r.expires===void 0)n.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(r.expires);if(Number.isNaN(l.getTime()))n.push(`securityTxt: \`expires\` is not a valid date: "${r.expires}".`);else if(l.getTime()<=t.getTime())n.push(`securityTxt: \`expires\` is in the past (${l.toISOString()}) — an expired `+"security.txt tells a reporter not to trust what it says.")}let o=[];for(let l of r.preferredLanguages??[]){let c=Xr(l);if(c===null)n.push(`securityTxt.preferredLanguages: "${l}" is not a well-formed language tag.`);else o.push(c)}if(n.length>0)return{errors:n,files:[],warnings:s};let a=["# Generated by @jxsuite/compiler — configure via securityTxt in project.json.",...i.map((l)=>`Contact: ${l}`),`Expires: ${new Date(r.expires).toISOString().replace(/\.\d{3}Z$/,"Z")}`,...(r.encryption??[]).map((l)=>`Encryption: ${l}`),...(r.acknowledgments??[]).map((l)=>`Acknowledgments: ${l}`),...o.length>0?[`Preferred-Languages: ${o.join(", ")}`]:[],...r.canonical===void 0?[]:[`Canonical: ${r.canonical}`],...(r.policy??[]).map((l)=>`Policy: ${l}`),...(r.hiring??[]).map((l)=>`Hiring: ${l}`)];return{errors:n,files:[{content:`${a.join(`
539
+ `,warnings:[]}}function sP(e,t=""){return`if('serviceWorker' in navigator){addEventListener('load',function(){navigator.serviceWorker.register('${Ye(t,`/${pg}`)}',{scope:${JSON.stringify(Ye(t,e))}}).catch(function(){})})}`}var pg="sw.js",SW="/images/_optimized/";var iP=M(()=>{Vr()});import{mkdirSync as jW,writeFileSync as kW}from"node:fs";import{dirname as _W,join as AW}from"node:path";function ai(e,t,r){if(r!==void 0)e[t]=r}function oP(e){let t=e.manifest,r=[],n=[];if(t===void 0||t.enabled===!1)return{errors:r,files:[],warnings:n};let s=t.name??e.name??"Jx Site",i=zi(e.url),o=[];for(let u of t.icons??[])o.push(A(u.src)?{...u,src:Ye(i,u.src)}:u);let a={display:t.display??"standalone",icons:o,name:s,short_name:t.shortName??s,start_url:Ye(i,t.startUrl??"/")};ai(a,"description",t.description),ai(a,"theme_color",t.themeColor),ai(a,"background_color",t.backgroundColor),ai(a,"scope",t.scope===void 0?void 0:Ye(i,t.scope)),ai(a,"orientation",t.orientation),ai(a,"lang",t.lang),ai(a,"dir",t.dir),ai(a,"categories",t.categories);let l=new Set(o.flatMap((u)=>(u.sizes??"").split(/\s+/).map((p)=>Math.trunc(Number(p.split("x")[0]))))),c=RW.filter((u)=>!l.has(u));if(c.length>0)n.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:r,files:[{content:`${JSON.stringify(a,null,2)}
540
+ `,path:"manifest.webmanifest"}],warnings:n}}function aP(e){let t=e.manifest;if(t===void 0||t.enabled===!1)return[];let r=[{attributes:{href:"/manifest.webmanifest",rel:"manifest"},tagName:"link"}];if(t.themeColor!==void 0)r.push({attributes:{content:t.themeColor,name:"theme-color"},tagName:"meta"});return r}function lP(e,t){let r=e.securityTxt,n=[],s=[];if(r===void 0||r.enabled===!1)return{errors:n,files:[],warnings:s};let i=r.contact??[];if(i.length===0)n.push("securityTxt: at least one `contact` is required (RFC 9116 §2.5.3).");if(r.expires===void 0)n.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(r.expires);if(Number.isNaN(l.getTime()))n.push(`securityTxt: \`expires\` is not a valid date: "${r.expires}".`);else if(l.getTime()<=t.getTime())n.push(`securityTxt: \`expires\` is in the past (${l.toISOString()}) — an expired `+"security.txt tells a reporter not to trust what it says.")}let o=[];for(let l of r.preferredLanguages??[]){let c=Qr(l);if(c===null)n.push(`securityTxt.preferredLanguages: "${l}" is not a well-formed language tag.`);else o.push(c)}if(n.length>0)return{errors:n,files:[],warnings:s};let a=["# Generated by @jxsuite/compiler — configure via securityTxt in project.json.",...i.map((l)=>`Contact: ${l}`),`Expires: ${new Date(r.expires).toISOString().replace(/\.\d{3}Z$/,"Z")}`,...(r.encryption??[]).map((l)=>`Encryption: ${l}`),...(r.acknowledgments??[]).map((l)=>`Acknowledgments: ${l}`),...o.length>0?[`Preferred-Languages: ${o.join(", ")}`]:[],...r.canonical===void 0?[]:[`Canonical: ${r.canonical}`],...(r.policy??[]).map((l)=>`Policy: ${l}`),...(r.hiring??[]).map((l)=>`Hiring: ${l}`)];return{errors:n,files:[{content:`${a.join(`
540
541
  `)}
541
- `,path:".well-known/security.txt"}],warnings:s}}function Pj(e,t,r){let n=0,s=[];for(let i of e){let o=hW(t,i.path);if(r(o)){s.push(i.path);continue}dW(mW(o),{recursive:!0}),pW(o,i.content,"utf8"),n+=1}return{skipped:s,written:n}}var gW;var kj=D(()=>{Vr();eo();ye();gW=[192,512]});import{existsSync as yW,mkdirSync as Gh,readFileSync as bW,readdirSync as xW,writeFileSync as $W}from"node:fs";import{dirname as Zl,join as wW,relative as vW,resolve as Ql}from"node:path";function SW(e){return e.endsWith("/")}function Aj(e=Kh){let t={},r=[],n=[];for(let s of Af)if(EW(s.specifier,e))t[s.specifier]=s.assetPath,t[`${s.specifier}/`]=s.assetDir,n.push(s.assetPath);else t[s.specifier]=s.fallback,r.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:n,imports:t,warnings:r}}async function Rj(e,t,r=Kh,n=!0){let s=[],i=0;for(let o of Af){if(!e.assetPaths.includes(o.assetPath))continue;let a=Ql(t,o.assetPath.replace(/^\//,""));Gh(Zl(a),{recursive:!0});try{await Zi(`export * from ${JSON.stringify(o.specifier)};
542
- `,{outfile:a,resolveDir:r},{minify:n,target:"browser"}),i+=1}catch(l){s.push(`Bundling client runtime "${o.specifier}": ${je(l)}`)}}return{errors:s,written:i}}function Yh(e){return Object.entries(e).filter(([t,r])=>!SW(t)&&r.startsWith("/")).map(([,t])=>t)}function Oj(e){let t=[];for(let r of e.matchAll(/<script type="importmap">([\s\S]*?)<\/script>/g)){let n;try{n=JSON.parse(r[1])}catch{continue}let s=W(n)?n.imports:void 0;if(!V(s))continue;let i=Object.entries(s).flatMap(([o,a])=>O(a)?[[o,a]]:[]);t.push(...Yh(Object.fromEntries(i)))}return t}function Cj(e){return`<script type="importmap">
542
+ `,path:".well-known/security.txt"}],warnings:s}}function cP(e,t,r){let n=0,s=[];for(let i of e){let o=AW(t,i.path);if(r(o)){s.push(i.path);continue}jW(_W(o),{recursive:!0}),kW(o,i.content,"utf8"),n+=1}return{skipped:s,written:n}}var RW;var uP=M(()=>{Vr();ro();ye();RW=[192,512]});import{existsSync as OW,mkdirSync as gg,readFileSync as NW,readdirSync as CW,writeFileSync as TW}from"node:fs";import{dirname as fc,join as IW,relative as JW,resolve as dc}from"node:path";function MW(e){return e.endsWith("/")}function dP(e=yg){let t={},r=[],n=[];for(let s of Hf)if(DW(s.specifier,e))t[s.specifier]=s.assetPath,t[`${s.specifier}/`]=s.assetDir,n.push(s.assetPath);else t[s.specifier]=s.fallback,r.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:n,imports:t,warnings:r}}async function pP(e,t,r=yg,n=!0){let s=[],i=0;for(let o of Hf){if(!e.assetPaths.includes(o.assetPath))continue;let a=dc(t,o.assetPath.replace(/^\//,""));gg(fc(a),{recursive:!0});try{await eo(`export * from ${JSON.stringify(o.specifier)};
543
+ `,{outfile:a,resolveDir:r},{minify:n,target:"browser"}),i+=1}catch(l){s.push(`Bundling client runtime "${o.specifier}": ${Pe(l)}`)}}return{errors:s,written:i}}function bg(e){return Object.entries(e).filter(([t,r])=>!MW(t)&&r.startsWith("/")).map(([,t])=>t)}function mP(e){let t=[];for(let r of e.matchAll(/<script type="importmap">([\s\S]*?)<\/script>/g)){let n;try{n=JSON.parse(r[1])}catch{continue}let s=B(n)?n.imports:void 0;if(!V(s))continue;let i=Object.entries(s).flatMap(([o,a])=>A(a)?[[o,a]]:[]);t.push(...bg(Object.fromEntries(i)))}return t}function hP(e){return`<script type="importmap">
543
544
  {
544
545
  "imports": {
545
546
  ${Object.entries(e).map(([r,n])=>` ${JSON.stringify(r)}: ${JSON.stringify(n)}`).join(`,
546
547
  `)}
547
548
  }
548
549
  }
549
- </script>`}function EW(e,t){try{return p0(e,t),!0}catch{return!1}}async function Nj(e,t=Kh,r=!0){let n=[],s=new Set,i=new Map,o=new Map,a=Ql(e,"assets"),l=0,c=async(p)=>{if(!o.has(p.specifier))o.set(p.specifier,await g0(p.specifier,t,{target:"browser"}));return o.get(p.specifier)},u=async(p)=>[...bW(p,"utf8").matchAll(/(?:from|import)\s*["']([^"']+)["']/g)].map((m)=>m[1]);for(let p=0;p<_j;p++){let h=0,m=[];try{m=xW(a,{recursive:!0}).map(String).filter((b)=>b.endsWith(".js")).map((b)=>wW(a,b))}catch{return zh(e,i,n,l)}for(let b of m){let g=[];try{g=await u(b)}catch{continue}for(let y of g){let w=Af.find((E)=>y.startsWith(`${E.specifier}/`));if(!w||s.has(y))continue;s.add(y);let j=y.slice(w.specifier.length+1),S=Ql(e,`${w.assetDir.replace(/^\//,"")}${j}`);Gh(Zl(S),{recursive:!0});try{await Zi(`export * from ${JSON.stringify(y)};
550
- `,{outfile:S,resolveDir:t},{minify:r,resolver:jW(w,S,await c(w),i),target:"browser"}),l+=1,h+=1}catch(E){n.push(`Bundling runtime subpath "${y}": ${je(E)}`)}}}if(h===0)return zh(e,i,n,l)}return n.push(`Runtime subpath resolution did not settle in ${_j} passes — a package subpath `+"graph this deep is more likely a cycle in the scan than a real dependency chain."),zh(e,i,n,l)}function jW(e,t,r,n){return{filter:/.*/,resolve:({importer:s,path:i})=>{if(Kp(s))return;if(Af.find((a)=>i===a.specifier||i.startsWith(`${a.specifier}/`))!==void 0)return{external:!0,path:i};if(r===void 0||!i.startsWith("."))return;if(Ql(Zl(s),i)!==r)return;return n.set(Ql(Zl(t),i),e.specifier),{external:!0,path:i}}}}function zh(e,t,r,n){let s=n;for(let[i,o]of t){if(yW(i))continue;try{Gh(Zl(i),{recursive:!0}),$W(i,`export * from ${JSON.stringify(o)};
551
- `,"utf8"),s+=1}catch(a){r.push(`Writing shared core stub ${vW(e,i)}: ${je(a)}`)}}return{errors:r,written:s}}var Af,Kh,_j=10;var Tj=D(()=>{Yp();Rn();ye();er();Af=[{assetDir:"/assets/@vue/reactivity/",assetPath:"/assets/vue-reactivity.js",fallback:ta,specifier:"@vue/reactivity"},{assetDir:"/assets/lit-html/",assetPath:"/assets/lit-html.js",fallback:ra,specifier:"lit-html"}];Kh=import.meta.dirname});import{cpSync as Rf,existsSync as Cs,mkdirSync as $n,readFileSync as PW,readdirSync as kW,rmSync as _W,statSync as AW,writeFileSync as rn}from"node:fs";import{createHash as RW}from"node:crypto";import{basename as OW,dirname as Ln,join as ii,relative as CW,resolve as ft,sep as NW}from"node:path";async function Dj(e,t={}){let{clean:r=!0,includeHeld:n=!1,verbose:s=!1}=t,i=[],o=s?console.log.bind(console):()=>{};o("Loading project.json...");let{config:a}=Hs(e);if("contentTypes"in a)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 l=ft(e,a.build.outDir),c=ft(e,"pages"),u=ft(e,"public"),p=a.build.trailingSlash??"always",h=a.build.minify!==!1,m=new Map,b=new Map,g=new Map,y=(M)=>{let H=M.toSorted(),le=`/assets/elements-${RW("sha1").update(H.join("\x00")).digest("hex").slice(0,12)}.js`;return g.set(le,H),le},w=Aj(),j=w.imports,S=new Set,E=F$(),{errors:P,i18n:A}=sm(a);for(let M of P)i.push(M),console.error(M);for(let M of w.warnings)console.warn(M);let R=new Map,_=(M,H,U)=>{let le=R.get(M);if(le!==void 0&&le.entryPath!==H)throw Error(`"${U}" and "${le.specifier}" both map to ${M} — rename one`);R.set(M,{entryPath:H,specifier:U})},I=(M,H)=>{if(!d0(M))return M;try{let U=Gp(M,H??e,e);if(!Bi(M)&&!Cs(U))return console.warn(`Sidecar "${M}" not found at ${U} — emitting unbundled`),M;let le=Bi(M)?M:`./${CW(e,U)}`,Ne=Rx(le);return _(Ne,U,M),m.set(Ne,{entryPath:U,specifier:M}),Ne}catch(U){return i.push(`Sidecar "${M}": ${je(U)}`),M}},L=(M)=>{let H=Ox(M);try{let U=Gp(`npm:${M}`,e,e);return _(H,U,M),b.set(H,U),H}catch(U){return i.push(`$head specifier "${M}": ${je(U)}`),M}},J=await Bs(e,a),F=J.formats;if(F.entries.length>0)o(` Registered ${F.entries.length} format(s): ${F.entries.map((M)=>M.name).join(", ")}`);let K=J.serverMounts().filter((M)=>{if(!M.project)return!0;let H=a[M.project.key];return V(H)&&Object.keys(H).length>0});if(K.length>0&&!a.build.adapter){let M=K.map((H)=>H.project?`"${H.project.key}"`:`"${H.server.basePath}"`).join(", ");throw Error(`project.json declares dynamic section(s) ${M} served by extension mounts, but `+`build.adapter is "static". Dynamic tables need a server-capable adapter — ${Ij}`)}if(r&&Cs(l))_W(l,{force:!0,recursive:!0});if($n(l,{recursive:!0}),!Cs(c))throw Error(`pages/ directory not found in ${e}`);o("Discovering pages...");let ae=await T$(c,F);o(` Found ${ae.length} page(s)`),o("Loading project sections...");let me=await Z$(e,a,J,{includeHeld:n}),ce=Object.keys(me);if(ce.length>0)o(` Loaded ${ce.length} section(s): ${ce.join(", ")}`);let{errors:se,mounts:ue}=await ew(J,a,e);i.push(...se);for(let M of se)console.error(M);if(ue.length>0)o(` Mounted ${ue.length} asset dir(s): ${ue.map((M)=>M.urlPrefix).join(", ")}`);let Ce=new Set,Y=await JW(J,a,e),oe=(await M$(ae,e,me,J,a,A,{errors:i})).map((M)=>Object.assign(M,{locale:gn(M.urlPattern,A)}));o(` ${oe.length} route(s) after expansion`);let B=0,ot=ft(e,"components"),de=[],$t=new Map,X=new Map,jt=new Map;if(Cs(ot)){o("Compiling components...");let M=[".json",...F.documentExtensions("component")],H=kW(ot).filter((Xt)=>M.some((tt)=>Xt.endsWith(tt))).toSorted(),U=ft(l,"components");$n(U,{recursive:!0});let le=new Map;for(let Xt of H){let tt=ft(ot,Xt);try{let{tagName:ve}=await so(tt,F);if(ve)le.set(tt,ve)}catch{}}let Ne=Hi(a.url),Pt=ef(Ne);for(let Xt of H)try{let tt=ft(ot,Xt),ve={formats:F,resolveElementPath:(Ct,d)=>{let x=d?ft(d,Ct):ft(Ct),v=le.get(x);return v?`./${v}.js`:Ct.replace(/\.(?:json|jxn)$/i,".js")},rewriteSrc:(Ct,d)=>Xe(Ne,I(Ct,d)),serverBaseUrl:Pt};if(a.$media)ve.$media=a.$media;let Zt=await Zu(tt,ve);for(let Ct of Zt.files){let d=Ct.tagName?`${Ct.tagName}.js`:OW(Ct.path);if(!de.includes(Ct.tagName))rn(ft(U,d),Ct.content,"utf8"),de.push(Ct.tagName),B+=1}let kt=await so(tt,F);if(kt.tagName){X.set(kt.tagName,kt),jt.set(kt.tagName,tt);let Ct=ro(kt,a.defaults),d=x$(kt.tagName,kt.style,kt,a.$media??{},Ct);if(d){if(Ct===null)$t.set(kt.tagName,d);Um(d,ue,Ce),rn(ft(U,`${kt.tagName}.css`),d,"utf8"),B+=1}}}catch(tt){let ve=je(tt);i.push(`Error compiling component ${Xt}: ${ve}`),console.error(`Error compiling component ${Xt}: ${ve}`)}o(` Compiled ${de.length} component(s): ${de.join(", ")}`)}let et=[];for(let[M,H]of X)et.push(...Ml(H,jt.get(M),e));if(a.state)et.push(...Ml({state:a.state},kn(e),e));let Kt=a.images.optimize&&a.images.service==="cloudflare",wt=a.images.optimize&&!Kt?ej(e):null,Ot=Kt?new Map:null;if(Kt)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 Yt=a.url,Vt=Hi(Yt),ts=Boolean(Yt)&&a.build.sitemap!==!1,rs=[],yo=oe.filter((M)=>!M.urlPattern.includes(":")&&!M.urlPattern.includes("*")),Ir=A===null?new Map:await N$(yo,F),ns=yo.map((M)=>({translationKey:Ir.get(M.urlPattern),urlPattern:M.urlPattern})),bo=P$(ns,A,Yt,p),{conflicts:xo,sets:Wd}=Mm(ns,A);for(let M of xo){let[H,U]=M.urlPatterns,le=M.declared?"Give one of them a different $translationKey.":"Move one out of the locale tree, or give it its own $translationKey.",Ne=`${U} and ${H} are both the "${M.locale}" version of "${M.key}". A translation set names one URL per language, so ${U} is `+`dropped from it — it carries no alternates and no switcher. ${le}`;if(M.declared)i.push(Ne),console.error(Ne);else console.warn(Ne)}let ss=E$(oe,A);if(ss.length>0)console.warn(`i18n.routing is "prefix-always", but ${ss.length} route(s) sit outside the locale tree and are served as "${A?.defaultLocale}": ${ss.slice(0,10).join(", ")}${ss.length>10?`, and ${ss.length-10} more`:""}. Move them under a locale directory, or use "prefix-except-default".`);if(A!==null&&A.routing==="prefix-always"&&!a.build.adapter&&!oe.some((M)=>M.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 Sc=new Set,$o=new Set;for(let M of oe){let H=j$(M.urlPattern,A);if(H&&!Sc.has(H.segment))Sc.add(H.segment),console.warn(`Routes under /${H.segment}/ are served as "${A?.defaultLocale}" — `+`i18n.locales declares "${H.meant}", not "${H.segment}". Rename the directory to "${H.meant.toLowerCase()}" or declare the shorter tag.`);try{o(` Compiling ${M.urlPattern} ...`);let U=await TW(M,a,e,me,wt,X,Ot,F,J,I,ue,Y,L,{alternates:bo.get(M.urlPattern)??[],i18n:A,translations:Wd.get(M.urlPattern)??[]},j,y);et.push(...U.serverEntries);for(let ve of U.unregisteredRelations)if(!$o.has(ve))$o.add(ve),console.warn(`<link rel="${ve}"> — "${ve}" is not an IANA link relation, and a relation nobody recognizes does nothing. Check the spelling, or use an absolute `+"URI if it is an extension relation (RFC 8288 §2.1.2).");let le=new Set;for(let[ve,Zt]of X)if(Wu(Zt))le.add(ve);if(de.length>0)U.html=LW(U.html,de,$t,le,U.files.map((ve)=>ve.content).join(`
552
- `),j);for(let ve of Oj(U.html))S.add(ve);Um(U.html,ue,Ce),q$(U.html,E);let Ne=Vj(M.urlPattern,l,p);$n(Ln(Ne),{recursive:!0});let Pt=!M.urlPattern.includes(":")&&!M.urlPattern.includes("*"),Xt=!Jl(M.urlPattern)&&!$$(U.html);if(ts&&!U.excludeFromSitemap&&Xt&&Pt){let ve=bo.get(M.urlPattern)??[];rs.push({lastmod:O(M.sourceMtime)&&M.sourceMtime!==""?M.sourceMtime:WW(AW(M.sourcePath).mtime),loc:Us(ca(M.urlPattern,p),Yt),...ve.length>0&&{alternates:ve}})}let tt=[];for(let ve of F.withCapability("serialize")){if(!ve.exportTarget||Jl(M.urlPattern))continue;try{let Zt=await ve.call("serialize",U.doc,{buildScope:(kt)=>Qo(kt,null),componentDefs:X,evaluateTemplate:(kt,Ct)=>{if(!be(kt))return;return sr(kt,Ct)??kt},mode:"export"});if(Zt){let kt=Ne.replace(/\.html$/,ve.extensions[0]);tt.push({content:Zt,path:kt,type:ve.mediaTypeEssence})}}catch(Zt){i.push(`Error exporting ${ve.name} for ${M.urlPattern}: ${je(Zt)}`)}}for(let ve of tt)if(ve.type!==null)U.html=v$(U.html,{href:S$(l,ve.path),type:ve.type});rn(Ne,Ix(U.html,Vt),"utf8"),B+=1;for(let ve of tt)rn(ve.path,ve.content,"utf8"),B+=1;for(let ve of U.files){let Zt=ft(Ln(Ne),ve.path);$n(Ln(Zt),{recursive:!0}),rn(Zt,ve.content,"utf8"),B+=1}}catch(U){let le=`Error compiling ${M.urlPattern}: ${je(U)}`;i.push(le),console.error(le)}}if(wt&&a.images.optimize){tj(e,wt,{prune:i.length===0});let M=ft(va(e),"_optimized");if(Cs(M)){let U=ft(l,"images/_optimized");$n(U,{recursive:!0}),Rf(M,U,{recursive:!0})}let H=Object.keys(wt.entries).length;if(H>0)o(` Optimized ${H} image(s)`)}let is=[];if(!a.build.adapter&&et.length>0){let H=`timing: "server" entries ${[...new Set(et.map(({exportName:U,declaredIn:le})=>`${U} (${le})`))].join(", ")} need a server-capable adapter, but `+`build.adapter is "static": a static deployment has nothing to serve /_jx/server — ${Ij}`;i.push(H),console.error(H)}if(a.build.adapter){let{adapter:M}=a.build;o("Generating site-wide server worker...");let{entries:H,errors:U}=fw(et);is=H;for(let tt of U)i.push(tt),console.error(tt);let{mounts:le,connectors:Ne}=IW(K,J,a);if(le.length>0)o(` Mounting ${le.length} extension route(s): ${le.map((tt)=>tt.basePath).join(", ")}`);let Xt=M==="cloudflare-pages"&&is.length===0&&le.length===0?null:nh(is,{adapter:M,base:Vt,connectors:Ne,i18n:A,mounts:le});if(Xt){let tt=M==="cloudflare-pages"?"_worker.js":"worker.js";try{await y0(Xt,{adapter:M,outfile:ft(l,tt),projectRoot:e}),B+=1,o(` Generated dist/${tt} (bundled, ${is.length} server function(s))`)}catch(ve){let Zt=`Error bundling dist/${tt}: ${je(ve)}`;i.push(Zt),console.error(Zt)}if(M==="cloudflare-pages")rn(ft(l,"_routes.json"),`${JSON.stringify({exclude:[],include:(A&&A.locales.length>1?["/","/_jx/*"]:["/_jx/*"]).map((ve)=>Xe(Vt,ve)),version:1},null,2)}
553
- `,"utf8"),B+=1}}if(S.size>0){o(`Bundling ${S.size} client runtime module(s)...`);let M=await Rj({...w,assetPaths:[...S]},l,void 0,h);B+=M.written;for(let H of M.errors)i.push(H),console.error(H)}if(b.size>0){o(`Copying ${b.size} package asset(s)...`);for(let[M,H]of b){let U=ft(l,M.replace(/^\//,""));$n(Ln(U),{recursive:!0}),Rf(H,U),B+=1,o(` ${H} → ${M}`)}}if(m.size>0){o(`Bundling ${m.size} client sidecar module(s)...`);for(let[M,H]of m)try{let U=ft(l,M.replace(/^\//,""));$n(Ln(U),{recursive:!0}),await h0({entryPath:H.entryPath,outfile:U},{external:f0,minify:h,target:"browser"}),B+=1,o(` ${H.specifier} → ${M}`)}catch(U){let le=`Error bundling sidecar "${H.specifier}": ${je(U)}`;i.push(le),console.error(le)}}if(g.size>0){o(`Bundling ${g.size} npm element set(s)...`);for(let[M,H]of g){let U=ft(l,M.replace(/^\//,""));$n(Ln(U),{recursive:!0});try{await Zi(`${H.map((le)=>`import ${JSON.stringify(le)};`).join(`
550
+ </script>`}function DW(e,t){try{return J0(e,t),!0}catch{return!1}}async function gP(e,t=yg,r=!0){let n=[],s=new Set,i=new Map,o=new Map,a=dc(e,"assets"),l=0,c=async(p)=>{if(!o.has(p.specifier))o.set(p.specifier,await L0(p.specifier,t,{target:"browser"}));return o.get(p.specifier)},u=async(p)=>[...NW(p,"utf8").matchAll(/(?:from|import)\s*["']([^"']+)["']/g)].map((m)=>m[1]);for(let p=0;p<fP;p++){let h=0,m=[];try{m=CW(a,{recursive:!0}).map(String).filter((y)=>y.endsWith(".js")).map((y)=>IW(a,y))}catch{return hg(e,i,n,l)}for(let y of m){let g=[];try{g=await u(y)}catch{continue}for(let b of g){let w=Hf.find((E)=>b.startsWith(`${E.specifier}/`));if(!w||s.has(b))continue;s.add(b);let j=b.slice(w.specifier.length+1),S=dc(e,`${w.assetDir.replace(/^\//,"")}${j}`);gg(fc(S),{recursive:!0});try{await eo(`export * from ${JSON.stringify(b)};
551
+ `,{outfile:S,resolveDir:t},{minify:r,resolver:LW(w,S,await c(w),i),target:"browser"}),l+=1,h+=1}catch(E){n.push(`Bundling runtime subpath "${b}": ${Pe(E)}`)}}}if(h===0)return hg(e,i,n,l)}return n.push(`Runtime subpath resolution did not settle in ${fP} passes — a package subpath `+"graph this deep is more likely a cycle in the scan than a real dependency chain."),hg(e,i,n,l)}function LW(e,t,r,n){return{filter:/.*/,resolve:({importer:s,path:i})=>{if(pm(s))return;if(Hf.find((a)=>i===a.specifier||i.startsWith(`${a.specifier}/`))!==void 0)return{external:!0,path:i};if(r===void 0||!i.startsWith("."))return;if(dc(fc(s),i)!==r)return;return n.set(dc(fc(t),i),e.specifier),{external:!0,path:i}}}}function hg(e,t,r,n){let s=n;for(let[i,o]of t){if(OW(i))continue;try{gg(fc(i),{recursive:!0}),TW(i,`export * from ${JSON.stringify(o)};
552
+ `,"utf8"),s+=1}catch(a){r.push(`Writing shared core stub ${JW(e,i)}: ${Pe(a)}`)}}return{errors:r,written:s}}var Hf,yg,fP=10;var yP=M(()=>{mm();In();ye();er();Hf=[{assetDir:"/assets/@vue/reactivity/",assetPath:"/assets/vue-reactivity.js",fallback:ia,specifier:"@vue/reactivity"},{assetDir:"/assets/lit-html/",assetPath:"/assets/lit-html.js",fallback:oa,specifier:"lit-html"}];yg=import.meta.dirname});import{cpSync as zf,existsSync as Js,mkdirSync as Sn,readFileSync as FW,readdirSync as qW,rmSync as VW,statSync as BW,writeFileSync as sn}from"node:fs";import{createHash as WW}from"node:crypto";import{basename as UW,dirname as Wn,join as li,relative as HW,resolve as ft,sep as zW}from"node:path";async function wP(e,t={}){let{clean:r=!0,includeHeld:n=!1,verbose:s=!1}=t,i=[],o=s?console.log.bind(console):()=>{};o("Loading project.json...");let{config:a}=Gs(e);if("contentTypes"in a)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 l=ft(e,a.build.outDir),c=ft(e,"pages"),u=ft(e,"public"),p=a.build.trailingSlash??"always",h=a.build.minify!==!1,m=new Map,y=new Map,g=new Map,b=(J)=>{let U=J.toSorted(),le=`/assets/elements-${WW("sha1").update(U.join("\x00")).digest("hex").slice(0,12)}.js`;return g.set(le,U),le},w=dP(),j=w.imports,S=new Set,E=cw(),{errors:P,i18n:R}=vm(a);for(let J of P)i.push(J),console.error(J);for(let J of w.warnings)console.warn(J);let N=new Map,_=(J,U,H)=>{let le=N.get(J);if(le!==void 0&&le.entryPath!==U)throw Error(`"${H}" and "${le.specifier}" both map to ${J} — rename one`);N.set(J,{entryPath:U,specifier:H})},q=(J,U)=>{if(!I0(J))return J;try{let H=dm(J,U??e,e);if(!Hi(J)&&!Js(H))return console.warn(`Sidecar "${J}" not found at ${H} — emitting unbundled`),J;let le=Hi(J)?J:`./${HW(e,H)}`,Ce=Qx(le);return _(Ce,H,J),m.set(Ce,{entryPath:H,specifier:J}),Ce}catch(H){return i.push(`Sidecar "${J}": ${Pe(H)}`),J}},D=(J)=>{let U=e0(J);try{let H=dm(`npm:${J}`,e,e);return _(U,H,J),y.set(U,H),U}catch(H){return i.push(`$head specifier "${J}": ${Pe(H)}`),J}},O=await zs(e,a),L=O.formats;if(L.entries.length>0)o(` Registered ${L.entries.length} format(s): ${L.entries.map((J)=>J.name).join(", ")}`);let K=O.serverMounts().filter((J)=>{if(!J.project)return!0;let U=a[J.project.key];return V(U)&&Object.keys(U).length>0});if(K.length>0&&!a.build.adapter){let J=K.map((U)=>U.project?`"${U.project.key}"`:`"${U.server.basePath}"`).join(", ");throw Error(`project.json declares dynamic section(s) ${J} served by extension mounts, but `+`build.adapter is "static". Dynamic tables need a server-capable adapter — ${bP}`)}if(r&&Js(l))VW(l,{force:!0,recursive:!0});if(Sn(l,{recursive:!0}),!Js(c))throw Error(`pages/ directory not found in ${e}`);o("Discovering pages...");let ae=await nw(c,L);o(` Found ${ae.length} page(s)`),o("Loading project sections...");let me=await ww(e,a,O,{includeHeld:n}),ce=Object.keys(me);if(ce.length>0)o(` Loaded ${ce.length} section(s): ${ce.join(", ")}`);let{errors:se,mounts:ue}=await Sw(O,a,e);i.push(...se);for(let J of se)console.error(J);if(ue.length>0)o(` Mounted ${ue.length} asset dir(s): ${ue.map((J)=>J.urlPrefix).join(", ")}`);let Ne=new Set,X=await XW(O,a,e),oe=(await ow(ae,e,me,O,a,R,{errors:i})).map((J)=>Object.assign(J,{locale:bn(J.urlPattern,R)}));o(` ${oe.length} route(s) after expansion`);let W=0,ot=ft(e,"components"),de=[],$t=new Map,Y=new Map,Pt=new Map;if(Js(ot)){o("Compiling components...");let J=[".json",...L.documentExtensions("component")],U=qW(ot).filter((Yt)=>J.some((tt)=>Yt.endsWith(tt))).toSorted(),H=ft(l,"components");Sn(H,{recursive:!0});let le=new Map;for(let Yt of U){let tt=ft(ot,Yt);try{let{tagName:ve}=await ao(tt,L);if(ve)le.set(tt,ve)}catch{}}let Ce=zi(a.url),jt=hf(Ce);for(let Yt of U)try{let tt=ft(ot,Yt),ve={formats:L,resolveElementPath:(Nt,d)=>{let x=d?ft(d,Nt):ft(Nt),v=le.get(x);return v?`./${v}.js`:Nt.replace(/\.(?:json|jxn)$/i,".js")},rewriteSrc:(Nt,d)=>Ye(Ce,q(Nt,d)),serverBaseUrl:jt};if(a.$media)ve.$media=a.$media;let Zt=await pf(tt,ve);for(let Nt of Zt.files){let d=Nt.tagName?`${Nt.tagName}.js`:UW(Nt.path);if(!de.includes(Nt.tagName))sn(ft(H,d),Nt.content,"utf8"),de.push(Nt.tagName),W+=1}let kt=await ao(tt,L);if(kt.tagName){Y.set(kt.tagName,kt),Pt.set(kt.tagName,tt);let Nt=io(kt,a.defaults),d=V$(kt.tagName,kt.style,kt,a.$media??{},Nt);if(d){if(Nt===null)$t.set(kt.tagName,d);dh(d,ue,Ne),sn(ft(H,`${kt.tagName}.css`),d,"utf8"),W+=1}}}catch(tt){let ve=Pe(tt);i.push(`Error compiling component ${Yt}: ${ve}`),console.error(`Error compiling component ${Yt}: ${ve}`)}o(` Compiled ${de.length} component(s): ${de.join(", ")}`)}let et=[];for(let[J,U]of Y)et.push(...zl(U,Pt.get(J),e));if(a.state)et.push(...zl({state:a.state},On(e),e));let Kt=a.images.optimize&&a.images.service==="cloudflare",wt=a.images.optimize&&!Kt?S1(e):null,Ot=Kt?new Map:null;if(Kt)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 Xt=a.url,qt=zi(Xt),os=Boolean(Xt)&&a.build.sitemap!==!1,as=[],wo=oe.filter((J)=>!J.urlPattern.includes(":")&&!J.urlPattern.includes("*")),Jr=R===null?new Map:await rw(wo,L),ls=wo.map((J)=>({translationKey:Jr.get(J.urlPattern),urlPattern:J.urlPattern})),vo=K$(ls,R,Xt,p),{conflicts:So,sets:op}=nh(ls,R);for(let J of So){let[U,H]=J.urlPatterns,le=J.declared?"Give one of them a different $translationKey.":"Move one out of the locale tree, or give it its own $translationKey.",Ce=`${H} and ${U} are both the "${J.locale}" version of "${J.key}". A translation set names one URL per language, so ${H} is `+`dropped from it — it carries no alternates and no switcher. ${le}`;if(J.declared)i.push(Ce),console.error(Ce);else console.warn(Ce)}let cs=z$(oe,R);if(cs.length>0)console.warn(`i18n.routing is "prefix-always", but ${cs.length} route(s) sit outside the locale tree and are served as "${R?.defaultLocale}": ${cs.slice(0,10).join(", ")}${cs.length>10?`, and ${cs.length-10} more`:""}. Move them under a locale directory, or use "prefix-except-default".`);if(R!==null&&R.routing==="prefix-always"&&!a.build.adapter&&!oe.some((J)=>J.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 "/${R.defaultLocale.toLowerCase()}/", set build.adapter, or use "prefix-except-default".`);let Jc=new Set,Eo=new Set;for(let J of oe){let U=G$(J.urlPattern,R);if(U&&!Jc.has(U.segment))Jc.add(U.segment),console.warn(`Routes under /${U.segment}/ are served as "${R?.defaultLocale}" — `+`i18n.locales declares "${U.meant}", not "${U.segment}". Rename the directory to "${U.meant.toLowerCase()}" or declare the shorter tag.`);try{o(` Compiling ${J.urlPattern} ...`);let H=await GW(J,a,e,me,wt,Y,Ot,L,O,q,ue,X,D,{alternates:vo.get(J.urlPattern)??[],i18n:R,translations:op.get(J.urlPattern)??[]},j,b);et.push(...H.serverEntries);for(let ve of H.unregisteredRelations)if(!Eo.has(ve))Eo.add(ve),console.warn(`<link rel="${ve}"> — "${ve}" is not an IANA link relation, and a relation nobody recognizes does nothing. Check the spelling, or use an absolute `+"URI if it is an extension relation (RFC 8288 §2.1.2).");let le=new Set;for(let[ve,Zt]of Y)if(nf(Zt))le.add(ve);if(de.length>0)H.html=QW(H.html,de,$t,le,H.files.map((ve)=>ve.content).join(`
553
+ `),j);for(let ve of mP(H.html))S.add(ve);dh(H.html,ue,Ne),uw(H.html,E);let Ce=PP(J.urlPattern,l,p);Sn(Wn(Ce),{recursive:!0});let jt=!J.urlPattern.includes(":")&&!J.urlPattern.includes("*"),Yt=!Hl(J.urlPattern)&&!B$(H.html);if(os&&!H.excludeFromSitemap&&Yt&&jt){let ve=vo.get(J.urlPattern)??[];as.push({lastmod:A(J.sourceMtime)&&J.sourceMtime!==""?J.sourceMtime:nU(BW(J.sourcePath).mtime),loc:Ks(pa(J.urlPattern,p),Xt),...ve.length>0&&{alternates:ve}})}let tt=[];for(let ve of L.withCapability("serialize")){if(!ve.exportTarget||Hl(J.urlPattern))continue;try{let Zt=await ve.call("serialize",H.doc,{buildScope:(kt)=>na(kt,null),componentDefs:Y,evaluateTemplate:(kt,Nt)=>{if(!be(kt))return;return sr(kt,Nt)??kt},mode:"export"});if(Zt){let kt=Ce.replace(/\.html$/,ve.extensions[0]);tt.push({content:Zt,path:kt,type:ve.mediaTypeEssence})}}catch(Zt){i.push(`Error exporting ${ve.name} for ${J.urlPattern}: ${Pe(Zt)}`)}}for(let ve of tt)if(ve.type!==null)H.html=U$(H.html,{href:H$(l,ve.path),type:ve.type});sn(Ce,s0(H.html,qt),"utf8"),W+=1;for(let ve of tt)sn(ve.path,ve.content,"utf8"),W+=1;for(let ve of H.files){let Zt=ft(Wn(Ce),ve.path);Sn(Wn(Zt),{recursive:!0}),sn(Zt,ve.content,"utf8"),W+=1}}catch(H){let le=`Error compiling ${J.urlPattern}: ${Pe(H)}`;i.push(le),console.error(le)}}if(wt&&a.images.optimize){E1(e,wt,{prune:i.length===0});let J=ft(ja(e),"_optimized");if(Js(J)){let H=ft(l,"images/_optimized");Sn(H,{recursive:!0}),zf(J,H,{recursive:!0})}let U=Object.keys(wt.entries).length;if(U>0)o(` Optimized ${U} image(s)`)}let us=[];if(!a.build.adapter&&et.length>0){let U=`timing: "server" entries ${[...new Set(et.map(({exportName:H,declaredIn:le})=>`${H} (${le})`))].join(", ")} need a server-capable adapter, but `+`build.adapter is "static": a static deployment has nothing to serve /_jx/server — ${bP}`;i.push(U),console.error(U)}if(a.build.adapter){let{adapter:J}=a.build;o("Generating site-wide server worker...");let{entries:U,errors:H}=Tw(et);us=U;for(let tt of H)i.push(tt),console.error(tt);let{mounts:le,connectors:Ce}=KW(K,O,a);if(le.length>0)o(` Mounting ${le.length} extension route(s): ${le.map((tt)=>tt.basePath).join(", ")}`);let Yt=J==="cloudflare-pages"&&us.length===0&&le.length===0?null:Sh(us,{adapter:J,base:qt,connectors:Ce,i18n:R,mounts:le});if(Yt){let tt=J==="cloudflare-pages"?"_worker.js":"worker.js";try{await F0(Yt,{adapter:J,outfile:ft(l,tt),projectRoot:e}),W+=1,o(` Generated dist/${tt} (bundled, ${us.length} server function(s))`)}catch(ve){let Zt=`Error bundling dist/${tt}: ${Pe(ve)}`;i.push(Zt),console.error(Zt)}if(J==="cloudflare-pages")sn(ft(l,"_routes.json"),`${JSON.stringify({exclude:[],include:(R&&R.locales.length>1?["/","/_jx/*"]:["/_jx/*"]).map((ve)=>Ye(qt,ve)),version:1},null,2)}
554
+ `,"utf8"),W+=1}}if(S.size>0){o(`Bundling ${S.size} client runtime module(s)...`);let J=await pP({...w,assetPaths:[...S]},l,void 0,h);W+=J.written;for(let U of J.errors)i.push(U),console.error(U)}if(y.size>0){o(`Copying ${y.size} package asset(s)...`);for(let[J,U]of y){let H=ft(l,J.replace(/^\//,""));Sn(Wn(H),{recursive:!0}),zf(U,H),W+=1,o(` ${U} → ${J}`)}}if(m.size>0){o(`Bundling ${m.size} client sidecar module(s)...`);for(let[J,U]of m)try{let H=ft(l,J.replace(/^\//,""));Sn(Wn(H),{recursive:!0}),await D0({entryPath:U.entryPath,outfile:H},{external:T0,minify:h,target:"browser"}),W+=1,o(` ${U.specifier} → ${J}`)}catch(H){let le=`Error bundling sidecar "${U.specifier}": ${Pe(H)}`;i.push(le),console.error(le)}}if(g.size>0){o(`Bundling ${g.size} npm element set(s)...`);for(let[J,U]of g){let H=ft(l,J.replace(/^\//,""));Sn(Wn(H),{recursive:!0});try{await eo(`${U.map((le)=>`import ${JSON.stringify(le)};`).join(`
554
555
  `)}
555
- `,{outfile:U,resolveDir:e},{minify:h,target:"browser"}),B+=1,o(` ${H.length} element(s) → ${M}`)}catch(le){let Ne=`Error bundling npm $elements [${H.join(", ")}]: ${je(le)}`;i.push(Ne),console.error(Ne)}}}if(S.size>0){let M=await Nj(l,void 0,h);if(M.written>0)o(`Bundling ${M.written} runtime subpath module(s)...`);B+=M.written;for(let H of M.errors)i.push(H),console.error(H)}for(let M of J.emitters()){let H=M.project?.key,U=H?a[H]:void 0;if(H&&(U==null||V(U)&&Object.keys(U).length===0))continue;try{let le=await M.call("emit",U??null,{projectConfig:a,root:e,routes:oe,sections:me});for(let Ne of le??[]){let Pt=ft(l,Ne.path.replace(/^\//,""));if(!Pt.startsWith(l+NW))throw Error(`emit path escapes outDir: ${Ne.path}`);$n(Ln(Pt),{recursive:!0}),rn(Pt,Ne.content),B+=1,o(` ${M.name} emitted ${Ne.path}`)}}catch(le){let Ne=`Error in ${M.name}.emit: ${je(le)}`;i.push(Ne),console.error(Ne)}}if(a.redirects&&Object.keys(a.redirects).length>0){o("Generating redirects...");let M=new Set(oe.map((U)=>U.urlPattern)),H=VW(a.redirects,l,{basePath:Vt,compiledUrls:M,trailingSlash:a.build.trailingSlash});B+=H.files,i.push(...H.errors)}if(ts)o(`Generating sitemap (${rs.length} URL(s))...`),B+=HW(rs,l);else if(!Yt&&a.build.sitemap!==!1)console.warn("sitemap.xml skipped — set `url` in project.json to enable sitemap generation.");if(Ce.size>0){let{copied:M,missing:H}=tw(Ce,ue,l);B+=M,o(`Copying ${M} mounted asset(s)...`);for(let U of H)console.warn(`Referenced asset not found: ${U}`)}if(Cs(u))o("Copying public/ assets..."),Rf(u,l,{recursive:!0});if(ts)B+=UW(l,Yt);{let M=[Sj(a),jj(a,new Date)];for(let le of M){for(let Ne of le.errors)i.push(Ne),console.error(Ne);for(let Ne of le.warnings)console.warn(Ne)}let{skipped:H,written:U}=Pj(M.flatMap((le)=>le.files),l,Cs);B+=U;for(let le of H)o(` ${le} — kept the copy from public/`)}{let M=Uh(a.serviceWorker);if(M!==null){let H=M===!1?$j():xj(M,l,Vt);for(let U of H.warnings)console.warn(U);for(let U of H.errors)i.push(U),console.error(U);if(H.path!==null)rn(ii(l,H.path),H.source,"utf8"),B+=1,o(M===!1?" sw.js — tombstone (unregisters and clears)":" sw.js")}}{let{errors:M,rules:H}=U$(a.build,E);i.push(...M);let U=G$([...H,...z$(l)],Vt);if(U.length>0){o("Writing response headers..."),B+=K$(l,U);let{adapter:le,deploy:Ne}=a.build;if(le==="node"||le==="bun")console.warn(`The "${le}" 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(le===void 0&&Ne===void 0)if(Cs(ft(u,"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 o(" note: _headers is read by Cloudflare Pages, Cloudflare Workers assets and Netlify; other static hosts ignore it and serve their own Cache-Control.")}B+=Y$(l)}if(a.copy){o("Copying mapped files...");for(let[M,H]of Object.entries(a.copy)){if(!O(H))throw TypeError(`project.json copy["${M}"] must be a destination path string`);let U=ft(e,M),le=ft(l,H);$n(Ln(le),{recursive:!0}),Rf(U,le)}}if(o(`
556
- Build complete: ${oe.length} routes, ${B} files`),i.length>0)o(` ${i.length} error(s)`);return{errors:i,files:B,routes:oe.length,serverEntries:is}}async function TW(e,t,r,n,s,i,o,a,l,c,u,p,h,m,b,g){let y=Hi(t.url),w=await so(e.sourcePath,a),j=await aw(w,t,r),S=[...Ml(w,e.sourcePath,r),...lw(w,t,r).flatMap((de)=>Ml(de.doc,de.path,r))],E=pw(w.$head??j._pageHead??[],w.description),P=j.$head??[],A=w.title??j._pageTitle??null;delete j._pageHead,delete j._pageTitle,R$(j,t,e,r,m.i18n,m.translations);let R=k$({defaults:t.defaults,pageDir:O(w.$dir)?w.$dir:void 0,pageLang:O(w.$lang)?w.$lang:void 0,routeLocale:gn(e.urlPattern,m.i18n)});if(e.pagedState&&j.state&&e.pagedState.key in j.state)j.state[e.pagedState.key]=e.pagedState.items;await Uu(j,e,r,{config:t,registerBundle:(de)=>{c(de,null)},registry:l,sections:n});let _=Qo(j.state??{}),I=A??t.name;if(be(I))I=sr(I,_)??I;let L=Xh(Jj(E,_),h),J=Xh(Jj(P,_),h);ec(j,_);let F={counter:{n:0},media:{...t.$media,...j.$media},rules:[]},K={n:0};if(rg(j,i,F,t.defaults,K),j.state){let de=new Set;for(let[X,jt]of Object.entries(j.state)){if(X==="$site"||X==="$page")continue;if(W(jt)&&jt.timing==="compiler")delete j.state[X];else if(Array.isArray(jt))de.add(X)}let $t=!0;while($t){$t=!1;let X={...j.state};for(let et of de)delete X[et];let jt=JSON.stringify({children:j.children,state:X});for(let et of de)if(DW(jt,et))de.delete(et),$t=!0}for(let X of de)delete j.state[X]}let ae=Uh(t.serviceWorker),me=ae===null||ae===!1?[]:[{tagName:"script",textContent:wj(ae.scope??"/",y)}],ce=[...Ej(t),...me,...p,...Xh(t.$head??[],h)],se=mw(ce,J,L,{title:I,charset:t.defaults.charset??"utf8",siteName:t.name,siteUrl:t.url,...m.alternates.length>0&&{alternates:m.alternates},...!Jl(e.urlPattern)&&{pageUrl:ca(e.urlPattern,t.build.trailingSlash)}});if(t.$media)j.$media={...t.$media,...j.$media};if(Object.values(j.$media??{}).some((de)=>bn(String(de))!==null))se.splice(2,0,{tagName:"script",textContent:ia()});let ue=t.images;await pj(j,ue,r,s,o??void 0,u);let Ce={lang:R.lang,prePaintScheme:!1,projectStyle:t.style??null,rewriteSrc:(de)=>Xe(y,c(de,Ln(e.sourcePath))),serverBaseUrl:ef(y),title:I},Y=b["@vue/reactivity"];if(Y!==void 0)Ce.reactivitySrc=Y;let Ee=b["lit-html"];if(Ee!==void 0)Ce.litHtmlSrc=Ee;let oe=await ih(j,Ce);if(F.rules.length>0)oe.html=oe.html.replace("</head>",`<style>
557
- ${Fu(F.rules.join(`
556
+ `,{outfile:H,resolveDir:e},{minify:h,target:"browser"}),W+=1,o(` ${U.length} element(s) → ${J}`)}catch(le){let Ce=`Error bundling npm $elements [${U.join(", ")}]: ${Pe(le)}`;i.push(Ce),console.error(Ce)}}}if(S.size>0){let J=await gP(l,void 0,h);if(J.written>0)o(`Bundling ${J.written} runtime subpath module(s)...`);W+=J.written;for(let U of J.errors)i.push(U),console.error(U)}for(let J of O.emitters()){let U=J.project?.key,H=U?a[U]:void 0;if(U&&(H==null||V(H)&&Object.keys(H).length===0))continue;try{let le=await J.call("emit",H??null,{projectConfig:a,root:e,routes:oe,sections:me});for(let Ce of le??[]){let jt=ft(l,Ce.path.replace(/^\//,""));if(!jt.startsWith(l+zW))throw Error(`emit path escapes outDir: ${Ce.path}`);Sn(Wn(jt),{recursive:!0}),sn(jt,Ce.content),W+=1,o(` ${J.name} emitted ${Ce.path}`)}}catch(le){let Ce=`Error in ${J.name}.emit: ${Pe(le)}`;i.push(Ce),console.error(Ce)}}if(a.redirects&&Object.keys(a.redirects).length>0){o("Generating redirects...");let J=new Set(oe.map((H)=>H.urlPattern)),U=rU(a.redirects,l,{basePath:qt,compiledUrls:J,trailingSlash:a.build.trailingSlash});W+=U.files,i.push(...U.errors)}if(os)o(`Generating sitemap (${as.length} URL(s))...`),W+=iU(as,l);else if(!Xt&&a.build.sitemap!==!1)console.warn("sitemap.xml skipped — set `url` in project.json to enable sitemap generation.");if(Ne.size>0){let{copied:J,missing:U}=Ew(Ne,ue,l);W+=J,o(`Copying ${J} mounted asset(s)...`);for(let H of U)console.warn(`Referenced asset not found: ${H}`)}if(Js(u))o("Copying public/ assets..."),zf(u,l,{recursive:!0});if(os)W+=oU(l,Xt);{let J=[oP(a),lP(a,new Date)];for(let le of J){for(let Ce of le.errors)i.push(Ce),console.error(Ce);for(let Ce of le.warnings)console.warn(Ce)}let{skipped:U,written:H}=cP(J.flatMap((le)=>le.files),l,Js);W+=H;for(let le of U)o(` ${le} — kept the copy from public/`)}{let J=mg(a.serviceWorker);if(J!==null){let U=J===!1?nP():rP(J,l,qt);for(let H of U.warnings)console.warn(H);for(let H of U.errors)i.push(H),console.error(H);if(U.path!==null)sn(li(l,U.path),U.source,"utf8"),W+=1,o(J===!1?" sw.js — tombstone (unregisters and clears)":" sw.js")}}{let{errors:J,rules:U}=hw(a.build,E);i.push(...J);let H=yw([...U,...gw(l)],qt);if(H.length>0){o("Writing response headers..."),W+=bw(l,H);let{adapter:le,deploy:Ce}=a.build;if(le==="node"||le==="bun")console.warn(`The "${le}" 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(le===void 0&&Ce===void 0)if(Js(ft(u,"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 o(" note: _headers is read by Cloudflare Pages, Cloudflare Workers assets and Netlify; other static hosts ignore it and serve their own Cache-Control.")}W+=xw(l)}if(a.copy){o("Copying mapped files...");for(let[J,U]of Object.entries(a.copy)){if(!A(U))throw TypeError(`project.json copy["${J}"] must be a destination path string`);let H=ft(e,J),le=ft(l,U);Sn(Wn(le),{recursive:!0}),zf(H,le)}}if(o(`
557
+ Build complete: ${oe.length} routes, ${W} files`),i.length>0)o(` ${i.length} error(s)`);return{errors:i,files:W,routes:oe.length,serverEntries:us}}async function GW(e,t,r,n,s,i,o,a,l,c,u,p,h,m,y,g){let b=zi(t.url),w=await ao(e.sourcePath,a),j=await Rw(w,t,r),S=[...zl(w,e.sourcePath,r),...Ow(w,t,r).flatMap((de)=>zl(de.doc,de.path,r))],E=Jw(w.$head??j._pageHead??[],w.description),P=j.$head??[],R=w.title??j._pageTitle??null;delete j._pageHead,delete j._pageTitle,Q$(j,t,e,r,m.i18n,m.translations);let N=X$({defaults:t.defaults,pageDir:A(w.$dir)?w.$dir:void 0,pageLang:A(w.$lang)?w.$lang:void 0,routeLocale:bn(e.urlPattern,m.i18n)});if(e.pagedState&&j.state&&e.pagedState.key in j.state)j.state[e.pagedState.key]=e.pagedState.items;await af(j,e,r,{config:t,registerBundle:(de)=>{c(de,null)},registry:l,sections:n});let _=na(j.state??{}),q=R??t.name;if(be(q))q=sr(q,_)??q;let D=xg(xP(E,_),h),O=xg(xP(P,_),h);pc(j,_);let L={counter:{n:0},media:{...t.$media,...j.$media},rules:[]},K={n:0};if(Eg(j,i,L,t.defaults,K),j.state){let de=new Set;for(let[Y,Pt]of Object.entries(j.state)){if(Y==="$site"||Y==="$page")continue;if(B(Pt)&&Pt.timing==="compiler")delete j.state[Y];else if(Array.isArray(Pt))de.add(Y)}let $t=!0;while($t){$t=!1;let Y={...j.state};for(let et of de)delete Y[et];let Pt=JSON.stringify({children:j.children,state:Y});for(let et of de)if(ZW(Pt,et))de.delete(et),$t=!0}for(let Y of de)delete j.state[Y]}let ae=mg(t.serviceWorker),me=ae===null||ae===!1?[]:[{tagName:"script",textContent:sP(ae.scope??"/",b)}],ce=[...aP(t),...me,...p,...xg(t.$head??[],h)],se=Mw(ce,O,D,{title:q,charset:t.defaults.charset??"utf8",siteName:t.name,siteUrl:t.url,...m.alternates.length>0&&{alternates:m.alternates},...!Hl(e.urlPattern)&&{pageUrl:pa(e.urlPattern,t.build.trailingSlash)}});if(t.$media)j.$media={...t.$media,...j.$media};if(Object.values(j.$media??{}).some((de)=>$n(String(de))!==null))se.splice(2,0,{tagName:"script",textContent:ca()});let ue=t.images;await X1(j,ue,r,s,o??void 0,u);let Ne={lang:N.lang,prePaintScheme:!1,projectStyle:t.style??null,rewriteSrc:(de)=>Ye(b,c(de,Wn(e.sourcePath))),serverBaseUrl:hf(b),title:q},X=y["@vue/reactivity"];if(X!==void 0)Ne.reactivitySrc=X;let Ee=y["lit-html"];if(Ee!==void 0)Ne.litHtmlSrc=Ee;let oe=await Ph(j,Ne);if(L.rules.length>0)oe.html=oe.html.replace("</head>",`<style>
558
+ ${ef(L.rules.join(`
558
559
  `))}
559
560
  </style>
560
- </head>`);oe.html=qW(oe.html,se,R);let B=(de)=>typeof de==="string"&&!de.startsWith("./")&&!de.startsWith("../"),ot=[...new Set([...j.$elements??[],...w.$elements??[]].filter((de)=>B(de)))];if(ot.length>0)oe.html=FW(oe.html,g(ot));return{doc:j,excludeFromSitemap:w.$sitemap===!1,files:oe.files,html:oe.html,unregisteredRelations:yw(se),serverEntries:S}}function IW(e,t,r){if(e.length===0)return{connectors:[],mounts:[]};let n=Hi(r.url),s={};for(let l of t.projectContributions()){let{key:c}=l.project;if(c in r)s[c]=r[c]}let i=e.map((l)=>{let c=l.server,{module:u}=c;if(!O(u)||u==="")throw Error(`Extension class "${l.name}": server.module (a bare import specifier) is required to generate a deployable worker`);let p=Xe(n,c.basePath);return{basePath:p,className:l.classDef.title??l.name,module:u,options:{basePath:p,sections:s},order:c.order??100}}),o=new Set;for(let l of Object.values(s)){if(!W(l))continue;for(let c of Object.values(l)){let u=W(c)?c.provider:void 0;if(O(u))o.add(u)}}let a=[];for(let l of t.connectors()){let c=String(l.connector.provider);if(!o.has(c))continue;let{module:u}=l.connector;if(!O(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:i}}async function JW(e,t,r){let n=[];for(let s of e.headProviders()){let i=s.project?.key,o=i===void 0?null:t[i];if(i!==void 0&&(o===void 0||o===null))continue;try{let a=await s.call("head",o??null,{projectConfig:t,root:r});n.push(...a??[])}catch(a){console.warn(`${s.name} head capability failed: ${je(a)}`)}}return n}function tg(e,t){if(Array.isArray(e))return e.map((r)=>tg(r,t));if(W(e))return Object.fromEntries(Object.entries(e).map(([r,n])=>[r,tg(n,t)]));if(be(e))return sr(e,t)??e;return e}function Jj(e,t){return e.map((r)=>{if(!V(r))return r;let n={...r};if(n.attributes){n.attributes={...n.attributes};for(let[s,i]of Object.entries(n.attributes))if(be(i))n.attributes[s]=sr(i,t)??i}if(be(n.textContent))n.textContent=sr(n.textContent,t)??n.textContent;else if(V(n.textContent))n.textContent=tg(n.textContent,t);return n})}function Xh(e,t){return e.map((r)=>{if(!V(r)||!r.attributes)return r;let n={...r,attributes:{...r.attributes}};for(let s of["href","src"]){let i=n.attributes[s];if(O(i)&&MW(i))n.attributes[s]=t(i)}return n})}function MW(e){return!e.startsWith("/")&&!e.startsWith("./")&&!e.startsWith("../")&&!e.startsWith("http")&&!e.startsWith("data:")}function Lj(e){return Wj(e).replaceAll("${","&#36;{")}function Fj(e){return e.replaceAll("${","$​{")}function qj(e,t){if(!V(e))return e;let r={};for(let[n,s]of Object.entries(e))if(n==="children"&&Array.isArray(e.children))r.children=e.children.map((i)=>{if(O(i))return i;return qj(i,t)});else if(n==="style"&&V(e.style)){let i={...e.style};for(let[o,a]of Object.entries(i))if(be(a))i[o]=Of(a,t)??a;r.style=i}else if(n==="attributes"&&V(e.attributes)){let i={...e.attributes};for(let[o,a]of Object.entries(i))if(be(a)){let l=Of(a,t);i[o]=O(l)&&l.includes("${")?Fj(l):l??a}r.attributes=i}else if(n==="$props"&&V(e.$props)){let i={...e.$props};for(let[o,a]of Object.entries(i))if(be(a)){let l=Of(a,t);i[o]=l!==null?l??null:a}r.$props=i}else if(be(s)){let i=Of(s,t);if(n==="textContent"&&O(i)&&i.includes("${"))r.innerHTML=Lj(i);else r[n]=i??s}else r[n]=s;return r}function Of(e,t){try{let r=t.$map,n=V(r)&&"item"in r?r.item:void 0,s=V(r)&&"index"in r?r.index:void 0,i=Xo(e)?`return (${e.slice(2,-1)})`:`return \`${e}\``;return Function("state","$map","item","index",i)(t,r,n,s)}catch{return null}}function ec(e,t){if(!V(e))return;if(be(e.innerHTML)){let s=sr(e.innerHTML,t);if(s!=null)e.innerHTML=String(s).replaceAll("${","&#36;{")}let r=e.textContent;if(be(r)){let s=sr(r,t);if(O(s)&&s.includes("${"))e.innerHTML=Lj(s),delete e.textContent;else e.textContent=s??r}if(V(e.style)){for(let[s,i]of Object.entries(e.style))if(be(i))e.style[s]=sr(i,t)??i}if(V(e.attributes)){for(let[s,i]of Object.entries(e.attributes))if(be(i)){let o=sr(i,t);e.attributes[s]=O(o)&&o.includes("${")?Fj(o):o??i}}if(V(e.$props)){let s=e.$props;for(let[i,o]of Object.entries(s))if(be(o))s[i]=sr(o,t)??o}let n=e.children;if(dt(n)){let s=Mj(n,t);if(s&&s.length>0){e.children=s;return}}if(be(n)){let s=sr(n,t);if(Array.isArray(s)){let i=s;e.children=i;for(let o of i)ec(o,t)}}else if(Array.isArray(e.children)){let s=0;while(s<e.children.length){let i=e.children[s];if(be(i)){let o=sr(i,t);if(Array.isArray(o)){let a=o;e.children.splice(s,1,...a);for(let l of a)ec(l,t);s+=a.length;continue}}if(dt(i)){let o=Mj(i,t);if(o&&o.length>0){e.children.splice(s,1,...o),s+=o.length;continue}}ec(i,t),s+=1}}}function DW(e,t){let r=t.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`);return new RegExp(String.raw`\bstate\.${r}\b|#/state/${r}(?=["/])`).test(e)}function Mj(e,t){let r=e.items,n=Be(r)?Pm(r.$ref,t):r,s=e.map;if(!Array.isArray(n)||!s)return null;return n.map((o,a)=>{let l=Object.create(t);l.$map={index:a,item:o},l["$map/item"]=o,l["$map/index"]=a;let c=qj(s,l);return ec(c,l),c})}function rg(e,t,r,n,s){if(!V(e))return;if(Array.isArray(e)){for(let a of e)rg(a,t,r,n,s);return}if(Array.isArray(e.children))for(let a of e.children)rg(a,t,r,n,s);let{tagName:i}=e;if(!O(i))return;let o=t.get(i);if(o){if(e.attributes){let{lifted:w,rest:j}=Tm(e.attributes);if(w)e.attributes=j,e.$props={...w,...e.$props}}let a=(w)=>{if(r&&V(w)&&!Array.isArray(w))Ys(w,r.rules,r.media,"",r.counter,"jxs");return ea(w,{},null)},l=ro(o,n),c=e.$props||null,u={componentDefs:t,defaults:n,path:[{key:JSON.stringify(c??{}),tag:i}],slotIds:s},p=Wu(o),{children:h}=e,m=!l&&!p&&Ks(o.children)?Cm(u):null,b=l?(Array.isArray(h)?h:[]).map((w)=>a(w)).join(`
561
- `):null,g=b$(o,c,l?null:Nm(h,{},a,m),u);if(m!==null)e.attributes={...e.attributes,[Cl]:String(m)};e.innerHTML=l?`<template shadowrootmode="${l}"><link rel="stylesheet" href="/components/${i}.css">${g}</template>${b??""}`:g,delete e.children;let y=Im(o.style,Vu(o,c));if(Object.keys(y).length>0)e.style={...e.style,...y};if(!p&&e.$props&&Object.keys(e.$props).length>0)e.attributes={...e.attributes,"data-jx-props":JSON.stringify(e.$props)};if(delete e.$props,p)e.$static=!0;else e.$prerendered=!0}}function LW(e,t,r=new Map,n=new Set,s="",i={}){let o=(S)=>e.includes(`<${S}`),a=(S)=>s.includes(`<${S}`),l=t.filter((S)=>o(S)||a(S));if(l.length===0)return e;let c=l.flatMap((S)=>{let E=r.get(S);return E===void 0||E===""?[]:[E]}).join(`
561
+ </head>`);oe.html=tU(oe.html,se,N);let W=(de)=>typeof de==="string"&&!de.startsWith("./")&&!de.startsWith("../"),ot=[...new Set([...j.$elements??[],...w.$elements??[]].filter((de)=>W(de)))];if(ot.length>0)oe.html=eU(oe.html,g(ot));return{doc:j,excludeFromSitemap:w.$sitemap===!1,files:oe.files,html:oe.html,unregisteredRelations:Fw(se),serverEntries:S}}function KW(e,t,r){if(e.length===0)return{connectors:[],mounts:[]};let n=zi(r.url),s={};for(let l of t.projectContributions()){let{key:c}=l.project;if(c in r)s[c]=r[c]}let i=e.map((l)=>{let c=l.server,{module:u}=c;if(!A(u)||u==="")throw Error(`Extension class "${l.name}": server.module (a bare import specifier) is required to generate a deployable worker`);let p=Ye(n,c.basePath);return{basePath:p,className:l.classDef.title??l.name,module:u,options:{basePath:p,sections:s},order:c.order??100}}),o=new Set;for(let l of Object.values(s)){if(!B(l))continue;for(let c of Object.values(l)){let u=B(c)?c.provider:void 0;if(A(u))o.add(u)}}let a=[];for(let l of t.connectors()){let c=String(l.connector.provider);if(!o.has(c))continue;let{module:u}=l.connector;if(!A(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:i}}async function XW(e,t,r){let n=[];for(let s of e.headProviders()){let i=s.project?.key,o=i===void 0?null:t[i];if(i!==void 0&&(o===void 0||o===null))continue;try{let a=await s.call("head",o??null,{projectConfig:t,root:r});n.push(...a??[])}catch(a){console.warn(`${s.name} head capability failed: ${Pe(a)}`)}}return n}function Sg(e,t){if(Array.isArray(e))return e.map((r)=>Sg(r,t));if(B(e))return Object.fromEntries(Object.entries(e).map(([r,n])=>[r,Sg(n,t)]));if(be(e))return sr(e,t)??e;return e}function xP(e,t){return e.map((r)=>{if(!V(r))return r;let n={...r};if(n.attributes){n.attributes={...n.attributes};for(let[s,i]of Object.entries(n.attributes))if(be(i))n.attributes[s]=sr(i,t)??i}if(be(n.textContent))n.textContent=sr(n.textContent,t)??n.textContent;else if(V(n.textContent))n.textContent=Sg(n.textContent,t);return n})}function xg(e,t){return e.map((r)=>{if(!V(r)||!r.attributes)return r;let n={...r,attributes:{...r.attributes}};for(let s of["href","src"]){let i=n.attributes[s];if(A(i)&&YW(i))n.attributes[s]=t(i)}return n})}function YW(e){return!e.startsWith("/")&&!e.startsWith("./")&&!e.startsWith("../")&&!e.startsWith("http")&&!e.startsWith("data:")}function vP(e){return jP(e).replaceAll("${","&#36;{")}function SP(e){return e.replaceAll("${","$​{")}function EP(e,t){if(!V(e))return e;let r={};for(let[n,s]of Object.entries(e))if(n==="children"&&Array.isArray(e.children))r.children=e.children.map((i)=>{if(A(i))return i;return EP(i,t)});else if(n==="style"&&V(e.style)){let i={...e.style};for(let[o,a]of Object.entries(i))if(be(a))i[o]=Gf(a,t)??a;r.style=i}else if(n==="attributes"&&V(e.attributes)){let i={...e.attributes};for(let[o,a]of Object.entries(i))if(be(a)){let l=Gf(a,t);i[o]=A(l)&&l.includes("${")?SP(l):l??a}r.attributes=i}else if(n==="$props"&&V(e.$props)){let i={...e.$props};for(let[o,a]of Object.entries(i))if(be(a)){let l=Gf(a,t);i[o]=l!==null?l??null:a}r.$props=i}else if(be(s)){let i=Gf(s,t);if(n==="textContent"&&A(i)&&i.includes("${"))r.innerHTML=vP(i);else r[n]=i??s}else r[n]=s;return r}function Gf(e,t){try{let r=t.$map,n=V(r)&&"item"in r?r.item:void 0,s=V(r)&&"index"in r?r.index:void 0,i=ta(e)?`return (${e.slice(2,-1)})`:`return \`${e}\``;return Function("state","$map","item","index",i)(t,r,n,s)}catch{return null}}function pc(e,t){if(!V(e))return;if(be(e.innerHTML)){let s=sr(e.innerHTML,t);if(s!=null)e.innerHTML=String(s).replaceAll("${","&#36;{")}let r=e.textContent;if(be(r)){let s=sr(r,t);if(A(s)&&s.includes("${"))e.innerHTML=vP(s),delete e.textContent;else e.textContent=s??r}if(V(e.style)){for(let[s,i]of Object.entries(e.style))if(be(i))e.style[s]=sr(i,t)??i}if(V(e.attributes)){for(let[s,i]of Object.entries(e.attributes))if(be(i)){let o=sr(i,t);e.attributes[s]=A(o)&&o.includes("${")?SP(o):o??i}}if(V(e.$props)){let s=e.$props;for(let[i,o]of Object.entries(s))if(be(o))s[i]=sr(o,t)??o}let n=e.children;if(dt(n)){let s=$P(n,t);if(s&&s.length>0){e.children=s;return}}if(be(n)){let s=sr(n,t);if(Array.isArray(s)){let i=s;e.children=i;for(let o of i)pc(o,t)}}else if(Array.isArray(e.children)){let s=0;while(s<e.children.length){let i=e.children[s];if(be(i)){let o=sr(i,t);if(Array.isArray(o)){let a=o;e.children.splice(s,1,...a);for(let l of a)pc(l,t);s+=a.length;continue}}if(dt(i)){let o=$P(i,t);if(o&&o.length>0){e.children.splice(s,1,...o),s+=o.length;continue}}pc(i,t),s+=1}}}function ZW(e,t){let r=t.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`);return new RegExp(String.raw`\bstate\.${r}\b|#/state/${r}(?=["/])`).test(e)}function $P(e,t){let r=e.items,n=qe(r)?Hm(r.$ref,t):r,s=e.map;if(!Array.isArray(n)||!s)return null;return n.map((o,a)=>{let l=Object.create(t);l.$map={index:a,item:o},l["$map/item"]=o,l["$map/index"]=a;let c=EP(s,l);return pc(c,l),c})}function Eg(e,t,r,n,s){if(!V(e))return;if(Array.isArray(e)){for(let a of e)Eg(a,t,r,n,s);return}if(Array.isArray(e.children))for(let a of e.children)Eg(a,t,r,n,s);let{tagName:i}=e;if(!A(i))return;let o=t.get(i);if(o){if(e.attributes){let{lifted:w,rest:j}=eh(e.attributes);if(w)e.attributes=j,e.$props={...w,...e.$props}}let a=(w)=>{if(r&&V(w)&&!Array.isArray(w))Qs(w,r.rules,r.media,"",r.counter,"jxs");return sa(w,{},null)},l=io(o,n),c=e.$props||null,u={componentDefs:t,defaults:n,path:[{key:JSON.stringify(c??{}),tag:i}],slotIds:s},p=nf(o),{children:h}=e,m=!l&&!p&&Zs(o.children)?Zm(u):null,y=l?(Array.isArray(h)?h:[]).map((w)=>a(w)).join(`
562
+ `):null,g=q$(o,c,l?null:Qm(h,{},a,m),u);if(m!==null)e.attributes={...e.attributes,[Vl]:String(m)};e.innerHTML=l?`<template shadowrootmode="${l}"><link rel="stylesheet" href="/components/${i}.css">${g}</template>${y??""}`:g,delete e.children;let b=th(o.style,rf(o,c));if(Object.keys(b).length>0)e.style={...e.style,...b};if(!p&&e.$props&&Object.keys(e.$props).length>0)e.attributes={...e.attributes,"data-jx-props":JSON.stringify(e.$props)};if(delete e.$props,p)e.$static=!0;else e.$prerendered=!0}}function QW(e,t,r=new Map,n=new Set,s="",i={}){let o=(S)=>e.includes(`<${S}`),a=(S)=>s.includes(`<${S}`),l=t.filter((S)=>o(S)||a(S));if(l.length===0)return e;let c=l.flatMap((S)=>{let E=r.get(S);return E===void 0||E===""?[]:[E]}).join(`
562
563
  `),u=c===""?"":`<style>
563
- ${Fu(c)}
564
+ ${ef(c)}
564
565
  </style>`,p=(S)=>{let E=S.filter(Boolean).join(`
565
566
  `);return E===""?e:e.replace("</head>",` ${E}
566
- </head>`)},h=l.filter((S)=>a(S)||!n.has(S));if(h.length===0)return p([u]);let m=Cj(i),g=[...Yh(i),...h.map((S)=>`/components/${S}.js`)].map((S)=>`<link rel="modulepreload" href="${S}">`).join(`
567
- `),y=e.includes('<script type="importmap">'),w=p([y?"":m,g,u]),j=h.map((S)=>`<script type="module" src="/components/${S}.js"></script>`).join(`
567
+ </head>`)},h=l.filter((S)=>a(S)||!n.has(S));if(h.length===0)return p([u]);let m=hP(i),g=[...bg(i),...h.map((S)=>`/components/${S}.js`)].map((S)=>`<link rel="modulepreload" href="${S}">`).join(`
568
+ `),b=e.includes('<script type="importmap">'),w=p([b?"":m,g,u]),j=h.map((S)=>`<script type="module" src="/components/${S}.js"></script>`).join(`
568
569
  `);return w.replace("</body>",` ${j}
569
- </body>`)}function FW(e,t){return e.replace("</body>",` <script type="module" src="${t}"></script>
570
- </body>`)}function qW(e,t,r){let n=hw(t),s=/<head>([\s\S]*?)<\/head>/i,i=e.match(s),o="";if(i){let l=i[1].match(/<style>[\s\S]*?<\/style>/gi);if(l)o+=`
570
+ </body>`)}function eU(e,t){return e.replace("</body>",` <script type="module" src="${t}"></script>
571
+ </body>`)}function tU(e,t,r){let n=Dw(t),s=/<head>([\s\S]*?)<\/head>/i,i=e.match(s),o="";if(i){let l=i[1].match(/<style>[\s\S]*?<\/style>/gi);if(l)o+=`
571
572
  ${l.join(`
572
573
  `)}`;let c=i[1].match(/<script[\s\S]*?<\/script>/gi);if(c)o+=`
573
574
  ${c.join(`
574
575
  `)}`}let a=e;if(s.test(a))a=a.replace(s,`<head>
575
576
  ${n}${o}
576
- </head>`);return a=a.replace(/<html\s[^>]*>/i,(l)=>{let c=/lang=/.test(l)?l.replace(/lang="[^"]*"/,`lang="${r.lang}"`):l.replace("<html",`<html lang="${r.lang}"`);if(r.dir!==void 0)c=/\sdir=/.test(c)?c.replace(/\sdir="[^"]*"/,` dir="${r.dir}"`):c.replace("<html",`<html dir="${r.dir}"`);return c}),a}function Vj(e,t,r){if(e==="/")return ii(t,"index.html");if(Jl(e))return ii(t,"404.html");let n=e.replace(/^\//,"");if(r==="always")return ii(t,n,"index.html");return ii(t,`${n}.html`)}function VW(e,t,r={}){let n=0,s=[],i=[],o=(c)=>c.length>1&&c.endsWith("/")?c.slice(0,-1):c,a=new Set([...r.compiledUrls??[]].map((c)=>o(c))),l=r.trailingSlash??"always";for(let[c,u]of Object.entries(e)){let p=O(u)?u:u.destination,h=!O(u)&&"rewrite"in u&&u.rewrite,m=h?200:!O(u)&&("status"in u)?u.status??301:301;if(!h&&!Zh.has(String(m))){s.push(`Redirect "${c}" has status ${m}, which is not an RFC 9110 §15.4 redirection `+`status. Use one of ${[...Zh.keys()].join(", ")}, or { destination, rewrite: true } for a proxy.`);continue}let b=r.basePath??"";if(i.push(`${Xe(b,c)} ${Xe(b,p)} ${m}`),c.includes(":")||c.includes("*"))continue;if(a.has(o(c)))console.warn(`The ${h?"rewrite":"redirect"} "${c}" collides with a compiled page at the same route — `+"remove one or the other.");if(h)continue;let g=Zh.get(String(m));if(!g.html)continue;let y=Vj(c,t,l),w=g.canonical?`
577
- <link rel="canonical" href="${Qh(p)}">`:`
577
+ </head>`);return a=a.replace(/<html\s[^>]*>/i,(l)=>{let c=/lang=/.test(l)?l.replace(/lang="[^"]*"/,`lang="${r.lang}"`):l.replace("<html",`<html lang="${r.lang}"`);if(r.dir!==void 0)c=/\sdir=/.test(c)?c.replace(/\sdir="[^"]*"/,` dir="${r.dir}"`):c.replace("<html",`<html dir="${r.dir}"`);return c}),a}function PP(e,t,r){if(e==="/")return li(t,"index.html");if(Hl(e))return li(t,"404.html");let n=e.replace(/^\//,"");if(r==="always")return li(t,n,"index.html");return li(t,`${n}.html`)}function rU(e,t,r={}){let n=0,s=[],i=[],o=(c)=>c.length>1&&c.endsWith("/")?c.slice(0,-1):c,a=new Set([...r.compiledUrls??[]].map((c)=>o(c))),l=r.trailingSlash??"always";for(let[c,u]of Object.entries(e)){let p=A(u)?u:u.destination,h=!A(u)&&"rewrite"in u&&u.rewrite,m=h?200:!A(u)&&("status"in u)?u.status??301:301;if(!h&&!$g.has(String(m))){s.push(`Redirect "${c}" has status ${m}, which is not an RFC 9110 §15.4 redirection `+`status. Use one of ${[...$g.keys()].join(", ")}, or { destination, rewrite: true } for a proxy.`);continue}let y=r.basePath??"";if(i.push(`${Ye(y,c)} ${Ye(y,p)} ${m}`),c.includes(":")||c.includes("*"))continue;if(a.has(o(c)))console.warn(`The ${h?"rewrite":"redirect"} "${c}" collides with a compiled page at the same route — `+"remove one or the other.");if(h)continue;let g=$g.get(String(m));if(!g.html)continue;let b=PP(c,t,l),w=g.canonical?`
578
+ <link rel="canonical" href="${wg(p)}">`:`
578
579
  <meta name="robots" content="noindex">`,j=`<!DOCTYPE html>
579
580
  <html>
580
581
  <head>
581
582
  <meta charset="utf-8">
582
- <meta http-equiv="refresh" content="0;url=${Qh(p)}">${w}
583
+ <meta http-equiv="refresh" content="0;url=${wg(p)}">${w}
583
584
  <title>Redirecting...</title>
584
585
  </head>
585
586
  <body>
586
- <p>Redirecting to <a href="${Qh(p)}">${Wj(p)}</a>...</p>
587
+ <p>Redirecting to <a href="${wg(p)}">${jP(p)}</a>...</p>
587
588
  </body>
588
- </html>`;$n(Ln(y),{recursive:!0}),rn(y,j,"utf8"),n+=1}if(i.length>0)rn(ii(t,"_redirects"),`${i.join(`
589
+ </html>`;Sn(Wn(b),{recursive:!0}),sn(b,j,"utf8"),n+=1}if(i.length>0)sn(li(t,"_redirects"),`${i.join(`
589
590
  `)}
590
- `,"utf8"),n+=1;return{errors:s,files:n}}function Wj(e){return String(e).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;")}function Qh(e){return String(e).replaceAll("&","&amp;").replaceAll('"',"&quot;").replaceAll("<","&lt;")}function eg(e){return String(e).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&apos;")}function WW(e){return e.toISOString().replace(/\.\d{3}Z$/,"Z")}function HW(e,t){if(e.length===0)return 0;let r=e.map((i)=>{let o=(i.alternates??[]).map((a)=>` <xhtml:link rel="alternate" hreflang="${eg(a.hreflang)}" href="${eg(a.href)}"/>`).join(`
591
+ `,"utf8"),n+=1;return{errors:s,files:n}}function jP(e){return String(e).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;")}function wg(e){return String(e).replaceAll("&","&amp;").replaceAll('"',"&quot;").replaceAll("<","&lt;")}function vg(e){return String(e).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&apos;")}function nU(e){return e.toISOString().replace(/\.\d{3}Z$/,"Z")}function iU(e,t){if(e.length===0)return 0;let r=e.map((i)=>{let o=(i.alternates??[]).map((a)=>` <xhtml:link rel="alternate" hreflang="${vg(a.hreflang)}" href="${vg(a.href)}"/>`).join(`
591
592
  `);return` <url>
592
- <loc>${eg(i.loc)}</loc>
593
+ <loc>${vg(i.loc)}</loc>
593
594
  <lastmod>${i.lastmod}</lastmod>
594
595
  ${o===""?"":`${o}
595
596
  `} </url>`}).join(`
596
597
  `),s=`<?xml version="1.0" encoding="UTF-8"?>
597
- <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"${e.some((i)=>(i.alternates?.length??0)>0)?` xmlns:xhtml="${BW}"`:""}>
598
+ <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"${e.some((i)=>(i.alternates?.length??0)>0)?` xmlns:xhtml="${sU}"`:""}>
598
599
  ${r}
599
600
  </urlset>
600
- `;return rn(ii(t,"sitemap.xml"),s,"utf8"),1}function UW(e,t){let r=ii(e,"robots.txt"),n=Cs(r),s=n?PW(r,"utf8"):`User-agent: *
601
+ `;return sn(li(t,"sitemap.xml"),s,"utf8"),1}function oU(e,t){let r=li(e,"robots.txt"),n=Js(r),s=n?FW(r,"utf8"):`User-agent: *
601
602
  Allow: /
602
603
  `;if(/^Sitemap:/im.test(s))return 0;if(!s.endsWith(`
603
604
  `))s+=`
604
605
  `;return s+=`
605
- Sitemap: ${Us("/sitemap.xml",t)}
606
- `,rn(r,s,"utf8"),n?0:1}var Ij='set build.adapter to "cloudflare-workers", "cloudflare-pages", "node", or "bun".',Zh,BW="http://www.w3.org/1999/xhtml";var Bj=D(()=>{ye();er();Vr();Jx();Yp();bl();L$();X$();bs();Q$();rw();cw();dw();gw();bw();Fm();Mw();Ll();sh();Rn();Zo();Vm();yj();Hm();vj();Jm();kj();Dm();Tj();Wh();Vo();Zh=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 zW}from"node:module";import{join as GW}from"node:path";import{spawn as KW}from"node:child_process";function YW(e){try{return zW(GW(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 Hj(e,t,r=KW,n=process){let i=[YW(e),"--root",e];if(t!==void 0)i.push("--port",String(t));let o=r("bun",i,{stdio:"inherit"});return o.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}`);n.exitCode=1}),n.on("SIGINT",()=>{o.kill("SIGINT")}),n.on("SIGTERM",()=>{o.kill("SIGTERM")}),o.on("exit",(a)=>{n.exitCode=a??0}),o}var Uj=()=>{};import{createServer as XW}from"node:http";import{existsSync as Cf,readFileSync as zj,statSync as ZW}from"node:fs";import{extname as QW,join as ng,normalize as eB,resolve as Gj,sep as tB}from"node:path";function nB(e,t){let r=eB(t).replaceAll("\\","/"),n=Gj(e,`.${r.startsWith("/")?r:`/${r}`}`);if(n!==e&&!n.startsWith(e+tB))return null;if(Cf(n)){if(ZW(n).isDirectory()){let i=ng(n,"index.html");return Cf(i)?i:null}return n}let s=ng(n,"index.html");return Cf(s)?s:null}function Kj(e,t){let r=Gj(e),n=XW((s,i)=>{let o=new URL(s.url??"/","http://localhost"),a=nB(r,decodeURIComponent(o.pathname));if(a){i.writeHead(200,{"Content-Type":rB.get(QW(a).toLowerCase())??"application/octet-stream"}),i.end(zj(a));return}let l=ng(r,"404.html");if(Cf(l)){i.writeHead(404,{"Content-Type":"text/html; charset=utf-8"}),i.end(zj(l));return}i.writeHead(404,{"Content-Type":"text/plain; charset=utf-8"}),i.end("Not found")});return n.listen(t),n}var rB;var Yj=D(()=>{zd();rB=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",...pb}))});var tc="https://jxsuite.com/schema/project/fields/v2",co="https://jxsuite.com/schema/document/paths/v2",Xj,Zj,rc,sg;var Nf=D(()=>{Xj={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"},Zj={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"},rc=[{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"}],sg={description:"A source shape contributed by an extension this schema cannot see. The project's generated document.schema.json validates these exactly; enable the owning extension and regenerate with `jx schema` to get precise checking here.",minProperties:1,type:"object"}});function sB(e){let{corePath:t,fragments:r,fieldSchemaRefs:n=[]}=e;return{$comment:rP,$defs:{Fields:{$id:tc,anyOf:[{$ref:`${Qj}#/$defs/JxFieldSchema`},{$ref:`${Qj}#/$defs/RelationshipRef`},...n.map((s)=>({$ref:s}))]}},$schema:"https://json-schema.org/draft/2020-12/schema",allOf:[{$ref:t},...r.map((s)=>({$ref:s}))],type:"object",unevaluatedProperties:!1}}async function sc(e,t,r,n=[]){let s=structuredClone(e),i=new Map,o=new Set;ig(s,o);let a=0,l=async(u)=>{let p=nc(u),h=i.get(p);if(h!==void 0)return h;let m;try{m=structuredClone(await t(p))}catch(w){throw Error(`bundleSchema: cannot load $ref target "${p}": ${fB(w)}`,{cause:w})}let b=O(m.$id)&&oi(m.$id)?m.$id:null;a+=b===null?1:0;let g=b??`urn:jx:bundled:${a}`;if(i.set(p,g),o.has(g))return g;o.add(g),m.$id=g,await c(m,uB(p),!0);let y=s.$defs??={};return y[g]=m,g},c=async(u,p,h=!1)=>{if(Array.isArray(u)){for(let y of u)await c(y,p);return}if(!W(u))return;let m=u,b=p;if(!h&&O(m.$id)&&oi(m.$id))b=null;let g=m.$ref;if(O(g)&&b!==null&&!g.startsWith("#")&&!oi(g)){let y=g.indexOf("#"),w=y===-1?g:g.slice(0,y),j=y===-1?"":g.slice(y);if(w){let S=await l(`${b}/${w}`);m.$ref=`${S}${j}`}}for(let y of Object.values(m))await c(y,b)};await c(s,nc(r),!0);for(let u of n)await l(`${nc(r)}/${u}`);return s}function lB(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function*eP(e,t){for(let r of iB){let n=e[r];if(Array.isArray(n)){for(let[s,i]of n.entries())if(W(i))yield[i,`${t}/${r}/${s}`]}else if(W(n))yield[n,`${t}/${r}`]}for(let r of oB){let n=e[r];if(!W(n))continue;for(let[s,i]of Object.entries(n))if(W(i))yield[i,`${t}/${r}/${lB(s)}`]}for(let r of aB){let n=e[r];if(!Array.isArray(n))continue;for(let[s,i]of n.entries())if(W(i))yield[i,`${t}/${r}/${s}`]}}function cB(e,t){let r=e.replace(/^[a-zA-Z][a-zA-Z\d+.-]*:/,"");if(r.startsWith("//")){let i=r.indexOf("/",2);r=i===-1?"":r.slice(i+1)}r=r.replace(/^schema\//,"");let n=r.split(/[^a-zA-Z0-9]+/).filter(Boolean).join("-")||"resource",s=n;for(let i=2;t.has(s);i+=1)s=`${n}-${i}`;return t.add(s),s}function ic(e){let t=structuredClone(e);if(W(t.$defs)){let i=new Set(Object.keys(t.$defs).filter((a)=>!oi(a))),o={};for(let[a,l]of Object.entries(t.$defs)){let c=W(l)&&O(l.$id)?l.$id:a;o[oi(a)?cB(c,i):a]=l}t.$defs=o}let r=new Map,n=(i,o)=>{let{$id:a}=i;if(O(a)&&oi(a)&&!r.has(a))r.set(a,o);for(let[l,c]of eP(i,o))n(l,c)};n(t,"#");let s=(i,o)=>{let a=o,{$id:l}=i;if(O(l)&&oi(l)){if(a=r.get(l)??o,a!=="#")delete i.$id}let c=i.$ref;if(O(c)){let u=c.indexOf("#"),p=u===-1?c:c.slice(0,u),h=u===-1?"":c.slice(u+1);if(p===""){if(h.startsWith("/"))i.$ref=`${a}${h}`}else{let m=r.get(p);if(m!==void 0)i.$ref=h?`${m}${h}`:m}}for(let[u]of eP(i,a))s(u,a)};return s(t,"#"),t}function ig(e,t){if(Array.isArray(e)){for(let n of e)ig(n,t);return}if(!W(e))return;let r=e;if(O(r.$id)&&oi(r.$id))t.add(r.$id);for(let n of Object.values(r))ig(n,t)}function oi(e){return/^[a-zA-Z][a-zA-Z\d+.-]*:/.test(e)}function nc(e){let t=e.replaceAll("\\","/"),r=t.startsWith("/"),n=[];for(let s of t.split("/")){if(s===""||s===".")continue;if(s===".."){if(n.length>0&&n.at(-1)!=="..")n.pop();else if(!r)n.push("..");continue}n.push(s)}return(r?"/":"")+n.join("/")}function uB(e){let t=e.lastIndexOf("/");if(t===-1)return".";return t===0?"/":e.slice(0,t)}function fB(e){return e instanceof Error?e.message:String(e)}function dB(e){let{corePath:t,pathsValueRefs:r}=e;return{$comment:rP,$defs:{PathsValue:{$id:co,anyOf:[...rc,...r.map((n)=>({$ref:n}))]}},$schema:"https://json-schema.org/draft/2020-12/schema",allOf:[{$ref:t}]}}async function nP(e){let{baseDir:t,coreDocumentRef:r,coreProjectRef:n,extensions:s,loadJson:i}=e,o=[],a=[],l=[],c=[];for(let h of s){if(h.project)o.push(h.project);if(h.document){let m=await tP(h.document,i,t);if(a.push(...m),m.length>0)l.push(h.document)}if(h.fields)c.push(...await tP(h.fields,i,t)),o.push(h.fields)}let u=sB({corePath:n,fieldSchemaRefs:c,fragments:o}),p=dB({corePath:r,pathsValueRefs:a});return{document:ic(await sc(p,i,t,l)),project:ic(await sc(u,i,t))}}async function tP(e,t,r){let n;try{n=await t(nc(`${nc(r)}/${e}`))}catch{return[]}let{$id:s}=n;if(!O(s)||!n.$defs)return[];return Object.keys(n.$defs).map((i)=>`${s}#/$defs/${i}`)}var Qj="https://jxsuite.com/schema/project/core/v2",rP="Generated by `jx schema` from project.json#/extensions — do not edit.",iB,oB,aB;var sP=D(()=>{Nf();ye();Nf();iB=["additionalItems","additionalProperties","contains","contentSchema","else","if","items","not","propertyNames","then","unevaluatedItems","unevaluatedProperties"],oB=["$defs","definitions","dependencies","dependentSchemas","patternProperties","properties"],aB=["allOf","anyOf","oneOf","prefixItems"]});import{existsSync as aP,readFileSync as pB,statSync as iP,writeFileSync as Tf}from"node:fs";import{createRequire as ag}from"node:module";import{dirname as mB,isAbsolute as hB,relative as lg,resolve as ai,sep as cg}from"node:path";async function lP(e){let{config:t}=Hs(e),r=await Bs(e,t),n=ai(e),{document:s,project:i}=await nP({baseDir:n,coreDocumentRef:oP(e,yB),coreProjectRef:oP(e,gB),extensions:r.extensions.map((o)=>({document:o.schemas.document&&og(e,o,o.schemas.document),fields:o.schemas.fields&&og(e,o,o.schemas.fields),project:o.schemas.project&&og(e,o,o.schemas.project)})),loadJson:fP(n)});return{documentSchema:s,projectSchema:i}}async function cP(e){let{documentSchema:t,projectSchema:r}=await lP(e),n=ai(e,"project.schema.json"),s=ai(e,"document.schema.json");return Tf(n,`${JSON.stringify(r,null,2)}
607
- `,"utf8"),Tf(s,`${JSON.stringify(t,null,2)}
608
- `,"utf8"),{documentSchemaPath:s,projectSchemaPath:n}}async function uP(e,t={}){let{write:r=!0}=t,n=ai(e),s=kn(n),i=ai(n,"project.schema.json"),o=ai(n,"document.schema.json"),a=(g)=>{if(!aP(g))return!0;try{return iP(s).mtimeMs>iP(g).mtimeMs}catch{return!1}},c=a(i)||a(o)?await lP(n):null;if(c&&r)Tf(i,`${JSON.stringify(c.projectSchema,null,2)}
609
- `,"utf8"),Tf(o,`${JSON.stringify(c.documentSchema,null,2)}
610
- `,"utf8");let u=fP(n),p=c?.projectSchema??oc(i),h=c?.documentSchema??oc(o),m=ic(await sc(p,u,n));return{document:ic(await sc(h,u,n)),project:m}}function oc(e){let t=JSON.parse(pB(e,"utf8"));if(!W(t))throw TypeError(`Schema file "${e}" is not a JSON object`);return t}function xB(e){return e.startsWith(bB)&&e.endsWith(".json")}function $B(e,t){try{return ag(import.meta.url).resolve(e)}catch(r){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:r})}}function fP(e){return async(t)=>{let r=ai(t),n=lg(e,r);if(n.startsWith("..")||hB(n))throw Error(`Schema ref "${t}" escapes the project root ${e}`);let s=n.split(cg).join("/"),i="node_modules/",o=s.lastIndexOf(i),a=o===-1?null:s.slice(o+i.length);if(a!==null&&xB(a))return oc($B(a,t));if(aP(r))return oc(r);if(a===null)throw Error(`Schema ref "${t}" does not exist`);let l;try{l=Ip(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 oc(l)}}function oP(e,t){let r=null;try{r=ag(ai(e,"package.json")).resolve(t)}catch{try{r=ag(import.meta.url).resolve(t)}catch{r=null}}let n=`./node_modules/${t}`;return r?dP(e,r,n):n}function og(e,t,r){let n=lg(mB(t.manifestPath),r).split(cg).join("/"),s=`./node_modules/${t.specifier}/${n}`;return dP(e,r,s)}function dP(e,t,r){let n=lg(e,t).split(cg).join("/");if(n.startsWith(".."))return r;return n.startsWith("./")?n:`./${n}`}var gB="@jxsuite/schema/schemas/project.core.schema.json",yB="@jxsuite/schema/schema.json",bB="@jxsuite/schema/";var ug=D(()=>{sP();ye();bs();bl();Vo()});var hP=N(function(_oe,mP){var __dirname="/home/runner/work/jx/jx/node_modules/@webref/elements",pP=He("fs").promises,If=He("path");async function wB({folder:e=__dirname}={}){let t={},r=await pP.readdir(e);for(let n of r)if(n.endsWith(".json")&&n!=="package.json"){let s=await pP.readFile(If.join(e,n),"utf8");t[If.basename(n,".json")]=JSON.parse(s)}return t}mP.exports={listAll:wB}});var xP=N(function(Aoe,bP){var __dirname="/home/runner/work/jx/jx/node_modules/@webref/css",vB=He("fs").promises,gP=He("path");async function yP({folder:e=__dirname}={}){let t=await vB.readFile(gP.join(e,"css.json"),"utf8");return JSON.parse(t)}async function SB({folder:e=__dirname}={}){let t=await yP(e),r={};for(let[n,s]of Object.entries(t)){r[n]={};for(let i of s){let o=i.name,a=null;if(i.for)a=s.find((l)=>l!==i&&l.name===i.name);if(a)o+=" for "+i.for[0];if(r[n][o]=i,i.descriptors){let l=i.descriptors;i.descriptors={};for(let c of l)i.descriptors[c.name]=c}}}return r}bP.exports={listAll:yP,index:SB}});var $P=N(function(Jf,fg){(function(e,t){typeof Jf=="object"&&typeof fg=="object"?fg.exports=t():typeof define=="function"&&define.amd?define([],t):typeof Jf=="object"?Jf.WebIDL2=t():e.WebIDL2=t()})(globalThis,()=>(()=>{var e={d:(d,x)=>{for(var v in x)e.o(x,v)&&!e.o(d,v)&&Object.defineProperty(d,v,{enumerable:!0,get:x[v]})},o:(d,x)=>Object.prototype.hasOwnProperty.call(d,x),r:(d)=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(d,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(d,"__esModule",{value:!0})}},t={};function r(d,x,v,k,C,{level:G="error",autofix:ee,ruleName:ge}={}){function pe(Jr){return Jr>0?d.slice(x,x+Jr):d.slice(Math.max(x+Jr,0),x)}function $e(Jr,{precedes:Ai}={}){let os=Jr.map((el)=>el.trivia+el.value).join(""),Qa=d[x];return Qa.type==="eof"?os:Ai?os+Qa.trivia:os.slice(Qa.trivia.length)}let Te=d[x].type!=="eof"?d[x].line:d.length>1?d[x-1].line:1,qe=function(Jr){let Ai=Jr.split(`
611
- `);return Ai[Ai.length-1]}($e(pe(-5),{precedes:!0})),cr=pe(5),yr=$e(cr),Za=qe+yr.split(`
606
+ Sitemap: ${Ks("/sitemap.xml",t)}
607
+ `,sn(r,s,"utf8"),n?0:1}var bP='set build.adapter to "cloudflare-workers", "cloudflare-pages", "node", or "bun".',$g,sU="http://www.w3.org/1999/xhtml";var kP=M(()=>{ye();er();Vr();i0();mm();jl();lw();$w();vs();vw();Pw();Nw();Iw();Lw();qw();oh();ov();Kl();Eh();In();ra();lh();eP();fh();iP();rh();uP();sh();yP();cg();Ho();$g=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 aU}from"node:module";import{join as lU}from"node:path";import{spawn as cU}from"node:child_process";function uU(e){try{return aU(lU(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 _P(e,t,r=cU,n=process){let i=[uU(e),"--root",e];if(t!==void 0)i.push("--port",String(t));let o=r("bun",i,{stdio:"inherit"});return o.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}`);n.exitCode=1}),n.on("SIGINT",()=>{o.kill("SIGINT")}),n.on("SIGTERM",()=>{o.kill("SIGTERM")}),o.on("exit",(a)=>{n.exitCode=a??0}),o}var AP=()=>{};import{createServer as fU}from"node:http";import{existsSync as Kf,readFileSync as RP,statSync as dU}from"node:fs";import{extname as pU,join as Pg,normalize as mU,resolve as OP,sep as hU}from"node:path";function yU(e,t){let r=mU(t).replaceAll("\\","/"),n=OP(e,`.${r.startsWith("/")?r:`/${r}`}`);if(n!==e&&!n.startsWith(e+hU))return null;if(Kf(n)){if(dU(n).isDirectory()){let i=Pg(n,"index.html");return Kf(i)?i:null}return n}let s=Pg(n,"index.html");return Kf(s)?s:null}function NP(e,t){let r=OP(e),n=fU((s,i)=>{let o=new URL(s.url??"/","http://localhost"),a=yU(r,decodeURIComponent(o.pathname));if(a){i.writeHead(200,{"Content-Type":gU.get(pU(a).toLowerCase())??"application/octet-stream"}),i.end(RP(a));return}let l=Pg(r,"404.html");if(Kf(l)){i.writeHead(404,{"Content-Type":"text/html; charset=utf-8"}),i.end(RP(l));return}i.writeHead(404,{"Content-Type":"text/plain; charset=utf-8"}),i.end("Not found")});return n.listen(t),n}var gU;var CP=M(()=>{fp();gU=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",...Jb}))});var mc="https://jxsuite.com/schema/project/fields/v2",mo="https://jxsuite.com/schema/document/paths/v2",TP,IP,hc,jg;var Xf=M(()=>{TP={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"},IP={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"},hc=[{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"}],jg={description:"A source shape contributed by an extension this schema cannot see. The project's generated document.schema.json validates these exactly; enable the owning extension and regenerate with `jx schema` to get precise checking here.",minProperties:1,type:"object"}});function bU(e){let{corePath:t,fragments:r,fieldSchemaRefs:n=[]}=e;return{$comment:LP,$defs:{Fields:{$id:mc,anyOf:[{$ref:`${JP}#/$defs/JxFieldSchema`},{$ref:`${JP}#/$defs/RelationshipRef`},...n.map((s)=>({$ref:s}))]}},$schema:"https://json-schema.org/draft/2020-12/schema",allOf:[{$ref:t},...r.map((s)=>({$ref:s}))],type:"object",unevaluatedProperties:!1}}async function yc(e,t,r,n=[]){let s=structuredClone(e),i=new Map,o=new Set;kg(s,o);let a=0,l=async(u)=>{let p=gc(u),h=i.get(p);if(h!==void 0)return h;let m;try{m=structuredClone(await t(p))}catch(w){throw Error(`bundleSchema: cannot load $ref target "${p}": ${PU(w)}`,{cause:w})}let y=A(m.$id)&&ci(m.$id)?m.$id:null;a+=y===null?1:0;let g=y??`urn:jx:bundled:${a}`;if(i.set(p,g),o.has(g))return g;o.add(g),m.$id=g,await c(m,EU(p),!0);let b=s.$defs??={};return b[g]=m,g},c=async(u,p,h=!1)=>{if(Array.isArray(u)){for(let b of u)await c(b,p);return}if(!B(u))return;let m=u,y=p;if(!h&&A(m.$id)&&ci(m.$id))y=null;let g=m.$ref;if(A(g)&&y!==null&&!g.startsWith("#")&&!ci(g)){let b=g.indexOf("#"),w=b===-1?g:g.slice(0,b),j=b===-1?"":g.slice(b);if(w){let S=await l(`${y}/${w}`);m.$ref=`${S}${j}`}}for(let b of Object.values(m))await c(b,y)};await c(s,gc(r),!0);for(let u of n)await l(`${gc(r)}/${u}`);return s}function vU(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function*MP(e,t){for(let r of xU){let n=e[r];if(Array.isArray(n)){for(let[s,i]of n.entries())if(B(i))yield[i,`${t}/${r}/${s}`]}else if(B(n))yield[n,`${t}/${r}`]}for(let r of $U){let n=e[r];if(!B(n))continue;for(let[s,i]of Object.entries(n))if(B(i))yield[i,`${t}/${r}/${vU(s)}`]}for(let r of wU){let n=e[r];if(!Array.isArray(n))continue;for(let[s,i]of n.entries())if(B(i))yield[i,`${t}/${r}/${s}`]}}function SU(e,t){let r=e.replace(/^[a-zA-Z][a-zA-Z\d+.-]*:/,"");if(r.startsWith("//")){let i=r.indexOf("/",2);r=i===-1?"":r.slice(i+1)}r=r.replace(/^schema\//,"");let n=r.split(/[^a-zA-Z0-9]+/).filter(Boolean).join("-")||"resource",s=n;for(let i=2;t.has(s);i+=1)s=`${n}-${i}`;return t.add(s),s}function bc(e){let t=structuredClone(e);if(B(t.$defs)){let i=new Set(Object.keys(t.$defs).filter((a)=>!ci(a))),o={};for(let[a,l]of Object.entries(t.$defs)){let c=B(l)&&A(l.$id)?l.$id:a;o[ci(a)?SU(c,i):a]=l}t.$defs=o}let r=new Map,n=(i,o)=>{let{$id:a}=i;if(A(a)&&ci(a)&&!r.has(a))r.set(a,o);for(let[l,c]of MP(i,o))n(l,c)};n(t,"#");let s=(i,o)=>{let a=o,{$id:l}=i;if(A(l)&&ci(l)){if(a=r.get(l)??o,a!=="#")delete i.$id}let c=i.$ref;if(A(c)){let u=c.indexOf("#"),p=u===-1?c:c.slice(0,u),h=u===-1?"":c.slice(u+1);if(p===""){if(h.startsWith("/"))i.$ref=`${a}${h}`}else{let m=r.get(p);if(m!==void 0)i.$ref=h?`${m}${h}`:m}}for(let[u]of MP(i,a))s(u,a)};return s(t,"#"),t}function kg(e,t){if(Array.isArray(e)){for(let n of e)kg(n,t);return}if(!B(e))return;let r=e;if(A(r.$id)&&ci(r.$id))t.add(r.$id);for(let n of Object.values(r))kg(n,t)}function ci(e){return/^[a-zA-Z][a-zA-Z\d+.-]*:/.test(e)}function gc(e){let t=e.replaceAll("\\","/"),r=t.startsWith("/"),n=[];for(let s of t.split("/")){if(s===""||s===".")continue;if(s===".."){if(n.length>0&&n.at(-1)!=="..")n.pop();else if(!r)n.push("..");continue}n.push(s)}return(r?"/":"")+n.join("/")}function EU(e){let t=e.lastIndexOf("/");if(t===-1)return".";return t===0?"/":e.slice(0,t)}function PU(e){return e instanceof Error?e.message:String(e)}function jU(e){let{corePath:t,pathsValueRefs:r}=e;return{$comment:LP,$defs:{PathsValue:{$id:mo,anyOf:[...hc,...r.map((n)=>({$ref:n}))]}},$schema:"https://json-schema.org/draft/2020-12/schema",allOf:[{$ref:t}]}}async function FP(e){let{baseDir:t,coreDocumentRef:r,coreProjectRef:n,extensions:s,loadJson:i}=e,o=[],a=[],l=[],c=[];for(let h of s){if(h.project)o.push(h.project);if(h.document){let m=await DP(h.document,i,t);if(a.push(...m),m.length>0)l.push(h.document)}if(h.fields)c.push(...await DP(h.fields,i,t)),o.push(h.fields)}let u=bU({corePath:n,fieldSchemaRefs:c,fragments:o}),p=jU({corePath:r,pathsValueRefs:a});return{document:bc(await yc(p,i,t,l)),project:bc(await yc(u,i,t))}}async function DP(e,t,r){let n;try{n=await t(gc(`${gc(r)}/${e}`))}catch{return[]}let{$id:s}=n;if(!A(s)||!n.$defs)return[];return Object.keys(n.$defs).map((i)=>`${s}#/$defs/${i}`)}var JP="https://jxsuite.com/schema/project/core/v2",LP="Generated by `jx schema` from project.json#/extensions — do not edit.",xU,$U,wU;var qP=M(()=>{Xf();ye();Xf();xU=["additionalItems","additionalProperties","contains","contentSchema","else","if","items","not","propertyNames","then","unevaluatedItems","unevaluatedProperties"],$U=["$defs","definitions","dependencies","dependentSchemas","patternProperties","properties"],wU=["allOf","anyOf","oneOf","prefixItems"]});import{existsSync as WP,readFileSync as kU,statSync as VP,writeFileSync as Yf}from"node:fs";import{createRequire as Ag}from"node:module";import{dirname as _U,isAbsolute as AU,relative as Rg,resolve as ui,sep as Og}from"node:path";async function UP(e){let{config:t}=Gs(e),r=await zs(e,t),n=ui(e),{document:s,project:i}=await FP({baseDir:n,coreDocumentRef:BP(e,OU),coreProjectRef:BP(e,RU),extensions:r.extensions.map((o)=>({document:o.schemas.document&&_g(e,o,o.schemas.document),fields:o.schemas.fields&&_g(e,o,o.schemas.fields),project:o.schemas.project&&_g(e,o,o.schemas.project)})),loadJson:GP(n)});return{documentSchema:s,projectSchema:i}}async function HP(e){let{documentSchema:t,projectSchema:r}=await UP(e),n=ui(e,"project.schema.json"),s=ui(e,"document.schema.json");return Yf(n,`${JSON.stringify(r,null,2)}
608
+ `,"utf8"),Yf(s,`${JSON.stringify(t,null,2)}
609
+ `,"utf8"),{documentSchemaPath:s,projectSchemaPath:n}}async function zP(e,t={}){let{write:r=!0}=t,n=ui(e),s=On(n),i=ui(n,"project.schema.json"),o=ui(n,"document.schema.json"),a=(g)=>{if(!WP(g))return!0;try{return VP(s).mtimeMs>VP(g).mtimeMs}catch{return!1}},c=a(i)||a(o)?await UP(n):null;if(c&&r)Yf(i,`${JSON.stringify(c.projectSchema,null,2)}
610
+ `,"utf8"),Yf(o,`${JSON.stringify(c.documentSchema,null,2)}
611
+ `,"utf8");let u=GP(n),p=c?.projectSchema??xc(i),h=c?.documentSchema??xc(o),m=bc(await yc(p,u,n));return{document:bc(await yc(h,u,n)),project:m}}function xc(e){let t=JSON.parse(kU(e,"utf8"));if(!B(t))throw TypeError(`Schema file "${e}" is not a JSON object`);return t}function CU(e){return e.startsWith(NU)&&e.endsWith(".json")}function TU(e,t){try{return Ag(import.meta.url).resolve(e)}catch(r){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:r})}}function GP(e){return async(t)=>{let r=ui(t),n=Rg(e,r);if(n.startsWith("..")||AU(n))throw Error(`Schema ref "${t}" escapes the project root ${e}`);let s=n.split(Og).join("/"),i="node_modules/",o=s.lastIndexOf(i),a=o===-1?null:s.slice(o+i.length);if(a!==null&&CU(a))return xc(TU(a,t));if(WP(r))return xc(r);if(a===null)throw Error(`Schema ref "${t}" does not exist`);let l;try{l=Qp(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 xc(l)}}function BP(e,t){let r=null;try{r=Ag(ui(e,"package.json")).resolve(t)}catch{try{r=Ag(import.meta.url).resolve(t)}catch{r=null}}let n=`./node_modules/${t}`;return r?KP(e,r,n):n}function _g(e,t,r){let n=Rg(_U(t.manifestPath),r).split(Og).join("/"),s=`./node_modules/${t.specifier}/${n}`;return KP(e,r,s)}function KP(e,t,r){let n=Rg(e,t).split(Og).join("/");if(n.startsWith(".."))return r;return n.startsWith("./")?n:`./${n}`}var RU="@jxsuite/schema/schemas/project.core.schema.json",OU="@jxsuite/schema/schema.json",NU="@jxsuite/schema/";var Ng=M(()=>{qP();ye();vs();jl();Ho()});var ZP=T(function(ole,YP){var __dirname="/home/runner/work/jx/jx/node_modules/@webref/elements",XP=Ue("fs").promises,Zf=Ue("path");async function IU({folder:e=__dirname}={}){let t={},r=await XP.readdir(e);for(let n of r)if(n.endsWith(".json")&&n!=="package.json"){let s=await XP.readFile(Zf.join(e,n),"utf8");t[Zf.basename(n,".json")]=JSON.parse(s)}return t}YP.exports={listAll:IU}});var rj=T(function(ale,tj){var __dirname="/home/runner/work/jx/jx/node_modules/@webref/css",JU=Ue("fs").promises,QP=Ue("path");async function ej({folder:e=__dirname}={}){let t=await JU.readFile(QP.join(e,"css.json"),"utf8");return JSON.parse(t)}async function MU({folder:e=__dirname}={}){let t=await ej(e),r={};for(let[n,s]of Object.entries(t)){r[n]={};for(let i of s){let o=i.name,a=null;if(i.for)a=s.find((l)=>l!==i&&l.name===i.name);if(a)o+=" for "+i.for[0];if(r[n][o]=i,i.descriptors){let l=i.descriptors;i.descriptors={};for(let c of l)i.descriptors[c.name]=c}}}return r}tj.exports={listAll:ej,index:MU}});var nj=T(function(Qf,Cg){(function(e,t){typeof Qf=="object"&&typeof Cg=="object"?Cg.exports=t():typeof define=="function"&&define.amd?define([],t):typeof Qf=="object"?Qf.WebIDL2=t():e.WebIDL2=t()})(globalThis,()=>(()=>{var e={d:(d,x)=>{for(var v in x)e.o(x,v)&&!e.o(d,v)&&Object.defineProperty(d,v,{enumerable:!0,get:x[v]})},o:(d,x)=>Object.prototype.hasOwnProperty.call(d,x),r:(d)=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(d,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(d,"__esModule",{value:!0})}},t={};function r(d,x,v,k,C,{level:G="error",autofix:ee,ruleName:ge}={}){function pe(Mr){return Mr>0?d.slice(x,x+Mr):d.slice(Math.max(x+Mr,0),x)}function $e(Mr,{precedes:Ni}={}){let fs=Mr.map((ll)=>ll.trivia+ll.value).join(""),al=d[x];return al.type==="eof"?fs:Ni?fs+al.trivia:fs.slice(al.trivia.length)}let Te=d[x].type!=="eof"?d[x].line:d.length>1?d[x-1].line:1,Fe=function(Mr){let Ni=Mr.split(`
612
+ `);return Ni[Ni.length-1]}($e(pe(-5),{precedes:!0})),cr=pe(5),br=$e(cr),ol=Fe+br.split(`
612
613
  `)[0]+`
613
- `+(" ".repeat(qe.length)+"^"),Bd=C==="Syntax"?"since":"inside",Fy=`${C} error at line ${Te}${d.name?` in ${d.name}`:""}${v&&v.name?`, ${Bd} \`${v.partial?"partial ":""}${function(Jr){let Ai=[Jr];for(;Jr&&Jr.parent;){let{parent:os}=Jr;Ai.unshift(os),Jr=os}return Ai.map((os)=>function(Qa,el){let qy=Qa;return el&&(qy+=` ${el}`),qy}(os.type,os.name)).join(" -> ")}(v)}\``:""}:
614
- ${Za}`;return{message:`${Fy} ${k}`,bareMessage:k,context:Fy,line:Te,sourceName:d.name,level:G,ruleName:ge,autofix:ee,input:yr,tokens:cr}}function n(d,x,v,k){return r(d,x,v,k,"Syntax")}function s(d,x,v,k,C={}){return C.ruleName=v,r(x.source,d.index,x,k,"Validation",C)}e.r(t),e.d(t,{WebIDLParseError:()=>Ot,parse:()=>Ne,validate:()=>Ct,write:()=>ve});class i{constructor({source:d,tokens:x}){Object.defineProperties(this,{source:{value:d},tokens:{value:x,writable:!0},parent:{value:null,writable:!0},this:{value:this}})}toJSON(){let d={type:void 0,name:void 0,inheritance:void 0},x=this;for(;x!==Object.prototype;){let v=Object.getOwnPropertyDescriptors(x);for(let[k,C]of Object.entries(v))(C.enumerable||C.get)&&(d[k]=this[k]);x=Object.getPrototypeOf(x)}return d}}function o(d,x,{useNullableInner:v}={}){if(!d.union){let k=x.unique.get(d.idlType);if(!k)return;if(k.type==="typedef"){let{typedefIncludesDictionary:C}=x.cache;if(C.has(k))return C.get(k);x.cache.typedefIncludesDictionary.set(k,void 0);let G=o(k.idlType,x);if(x.cache.typedefIncludesDictionary.set(k,G),G)return{reference:d,dictionary:G.dictionary}}if(k.type==="dictionary"&&(v||!d.nullable))return{reference:d,dictionary:k}}for(let k of d.subtype){let C=o(k,x);if(C)return k.union?C:{reference:k,dictionary:C.dictionary}}}function a(d,x){if(x.cache.dictionaryIncludesRequiredField.has(d))return x.cache.dictionaryIncludesRequiredField.get(d);x.cache.dictionaryIncludesRequiredField.set(d,void 0);let v=d.members.some((k)=>k.required);if(!v&&d.inheritance){let k=x.unique.get(d.inheritance);k?a(k,x)&&(v=!0):v=!0}return x.cache.dictionaryIncludesRequiredField.set(d,v),v}class l extends Array{constructor({source:d,tokens:x}){super(),Object.defineProperties(this,{source:{value:d},tokens:{value:x},parent:{value:null,writable:!0}})}}class c extends i{static parser(d,x){return()=>{let v=d.consumeKind(x);if(v)return new c({source:d.source,tokens:{value:v}})}}get value(){return J(this.tokens.value.value)}write(d){return d.ts.wrap([d.token(this.tokens.value),d.token(this.tokens.separator)])}}class u extends c{static parse(d){let x=d.consumeKind("eof");if(x)return new u({source:d.source,tokens:{value:x}})}get type(){return"eof"}}function p(d,x){return F(d,{parser:c.parser(d,x),listName:x+" list"})}let h=["identifier","decimal","integer","string"],m=new Map([...["NoInterfaceObject","LenientSetter","LenientThis","TreatNonObjectAsNull","Unforgeable"].map((d)=>[d,`Legacy${d}`]),["NamedConstructor","LegacyFactoryFunction"],["OverrideBuiltins","LegacyOverrideBuiltIns"],["TreatNullAs","LegacyNullToEmptyString"]]);function b(d){for(let x of h){let v=p(d,x);if(v.length)return v}d.error("Expected identifiers, strings, decimals, or integers but none found")}class g extends i{static parse(d){let x={assign:d.consume("=")},v=B(new g({source:d.source,tokens:x}));if(v.list=[],x.assign){if(x.asterisk=d.consume("*"),x.asterisk)return v.this;x.secondaryName=d.consumeKind(...h)}return x.open=d.consume("("),x.open?(v.list=v.rhsIsList?b(d):ce(d),x.close=d.consume(")")||d.error("Unexpected token in extended attribute argument list")):x.assign&&!x.secondaryName&&d.error("No right hand side to extended attribute assignment"),v.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(d){let{rhsType:x}=this;return d.ts.wrap([d.token(this.tokens.assign),d.token(this.tokens.asterisk),d.reference_token(this.tokens.secondaryName,this.parent),d.token(this.tokens.open),...this.list.map((v)=>x==="identifier-list"?d.identifier(v,this.parent):v.write(d)),d.token(this.tokens.close)])}}class y extends i{static parse(d){let x=d.consumeKind("identifier");if(x)return new y({source:d.source,tokens:{name:x},params:g.parse(d)})}constructor({source:d,tokens:x,params:v}){super({source:d,tokens:x}),v.parent=this,Object.defineProperty(this,"params",{value:v})}get type(){return"extended-attribute"}get name(){return this.tokens.name.value}get rhs(){let{rhsType:d,tokens:x,list:v}=this.params;if(!d)return null;return{type:d,value:this.params.rhsIsList?v:this.params.tokens.secondaryName?J(x.secondaryName.value):null}}get arguments(){let{rhsIsList:d,list:x}=this.params;return!x||d?[]:x}*validate(d){let{name:x}=this;if(x==="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(x)){let k=`\`[${x}]\` extended attribute is a legacy feature that is now renamed to \`[${m.get(x)}]\`. Refer to the [relevant upstream PR](https://github.com/whatwg/webidl/pull/870) for more information.`;yield s(this.tokens.name,this,"renamed-legacy",k,{level:"warning",autofix:(v=this,()=>{let{name:C}=v;v.tokens.name.value=m.get(C),C==="TreatNullAs"&&(v.params.tokens={})})})}var v;for(let k of this.arguments)yield*k.validate(d)}write(d){return d.ts.wrap([d.ts.trivia(this.tokens.name.trivia),d.ts.extendedAttribute(d.ts.wrap([d.ts.extendedAttributeReference(this.name),this.params.write(d)])),d.token(this.tokens.separator)])}}class w extends l{static parse(d){let x={};x.open=d.consume("[");let v=new w({source:d.source,tokens:x});return x.open?(v.push(...F(d,{parser:y.parse,listName:"extended attribute"})),x.close=d.consume("]")||d.error("Expected a closing token for the extended attribute list"),v.length||(d.unconsume(x.close.index),d.error("An extended attribute list must not be empty")),d.probe("[")&&d.error("Illegal double extended attribute lists, consider merging them"),v):v}*validate(d){for(let x of this)yield*x.validate(d)}write(d){return this.length?d.ts.wrap([d.token(this.tokens.open),...this.map((x)=>x.write(d)),d.token(this.tokens.close)]):""}}function j(d,x){let v=d.consume("?");v&&(x.tokens.nullable=v),d.probe("?")&&d.error("Can't nullable more than once")}function S(d,x){let v=function(k,C){let G=k.consume("FrozenArray","ObservableArray","Promise","async_sequence","sequence","record");if(!G)return;let ee=B(new E({source:k.source,tokens:{base:G}}));switch(ee.tokens.open=k.consume("<")||k.error(`No opening bracket after ${G.value}`),G.value){case"Promise":{k.probe("[")&&k.error("Promise type cannot have extended attribute");let ge=ue(k,C)||k.error("Missing Promise subtype");ee.subtype.push(ge);break}case"async_sequence":case"sequence":case"FrozenArray":case"ObservableArray":{let ge=se(k,C)||k.error(`Missing ${G.value} subtype`);ee.subtype.push(ge);break}case"record":{k.probe("[")&&k.error("Record key cannot have extended attribute");let ge=k.consume(...$t)||k.error(`Record key must be one of: ${$t.join(", ")}`),pe=new E({source:k.source,tokens:{base:ge}});pe.tokens.separator=k.consume(",")||k.error("Missing comma after record key type"),pe.type=C;let $e=se(k,C)||k.error("Error parsing generic type record");ee.subtype.push(pe,$e);break}}return ee.idlType||k.error(`Error parsing generic type ${G.value}`),ee.tokens.close=k.consume(">")||k.error(`Missing closing bracket after ${G.value}`),ee.this}(d,x)||me(d);if(!v){let k=d.consumeKind("identifier")||d.consume(...$t,...de);if(!k)return;v=new E({source:d.source,tokens:{base:k}}),d.probe("<")&&d.error(`Unsupported generic type ${k.value}`)}return v.generic==="Promise"&&d.probe("?")&&d.error("Promise type cannot be nullable"),v.type=x||null,j(d,v),v.nullable&&v.idlType==="any"&&d.error("Type `any` cannot be made nullable"),v}class E extends i{static parse(d,x){return S(d,x)||function(v,k){let C={};if(C.open=v.consume("("),!C.open)return;let G=B(new E({source:v.source,tokens:C}));for(G.type=k||null;;){let ee=se(v,k)||v.error("No type after open parenthesis or 'or' in union type");ee.idlType==="any"&&v.error("Type `any` cannot be included in a union type"),ee.generic==="Promise"&&v.error("Type `Promise` cannot be included in a union type"),G.subtype.push(ee);let ge=v.consume("or");if(!ge)break;ee.tokens.separator=ge}return G.idlType.length<2&&v.error("At least two types are expected in a union type but found less"),C.close=v.consume(")")||v.error("Unterminated union type"),j(v,G),G.this}(d,x)}constructor({source:d,tokens:x}){super({source:d,tokens:x}),Object.defineProperty(this,"subtype",{value:[],writable:!0}),this.extAttrs=new w({source:d,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 J([this.tokens.prefix,this.tokens.base,this.tokens.postfix].filter((d)=>d).map((d)=>d.value).join(" "))}*validate(d){if(yield*this.extAttrs.validate(d),this.idlType==="BufferSource")for(let C of[this.extAttrs,this.parent?.extAttrs])for(let G of C){if(G.name!=="AllowShared")continue;let ee="`[AllowShared] BufferSource` is now replaced with AllowSharedBufferSource.";yield s(this.tokens.base,this,"migrate-allowshared",ee,{autofix:P(this,G,C)})}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:(x=this,()=>{x.tokens.base.value="undefined"})});var x;let v=!this.union&&d.unique.get(this.idlType),k=this.union?this:v&&v.type==="typedef"?v.idlType:void 0;if(k&&this.nullable){let{reference:C}=o(k,d)||{};if(C){let G=(this.union?C:this).tokens.base;yield s(G,this,"no-nullable-union-dict","Nullable union cannot include a dictionary type.")}}else for(let C of this.subtype)yield*C.validate(d)}write(d){return d.ts.wrap([this.extAttrs.write(d),(()=>{if(this.union||this.generic)return d.ts.wrap([d.token(this.tokens.base,d.ts.generic),d.token(this.tokens.open),...this.subtype.map((C)=>C.write(d)),d.token(this.tokens.close)]);let x=this.tokens.prefix||this.tokens.base,v=this.tokens.prefix?[this.tokens.prefix.value,d.ts.trivia(this.tokens.base.trivia)]:[],k=d.reference(d.ts.wrap([...v,this.tokens.base.value,d.token(this.tokens.postfix)]),{unescaped:this.idlType,context:this});return d.ts.wrap([d.ts.trivia(x.trivia),k])})(),d.token(this.tokens.nullable),d.token(this.tokens.separator)])}}function P(d,x,v){return()=>{let k=v.indexOf(x);v.splice(k,1),!v.length&&d.tokens.base.trivia.match(/^\s$/)&&(d.tokens.base.trivia=""),d.tokens.base.value="AllowSharedBufferSource"}}class A extends i{static parse(d){let x=d.consume("=");if(!x)return null;let v=K(d)||d.consumeKind("string")||d.consume("null","[","{")||d.error("No value for default"),k=[v];if(v.value==="["){let C=d.consume("]")||d.error("Default sequence value must be empty");k.push(C)}else if(v.value==="{"){let C=d.consume("}")||d.error("Default dictionary value must be empty");k.push(C)}return new A({source:d.source,tokens:{assign:x},expression:k})}constructor({source:d,tokens:x,expression:v}){super({source:d,tokens:x}),v.parent=this,Object.defineProperty(this,"expression",{value:v})}get type(){return ae(this.expression[0]).type}get value(){return ae(this.expression[0]).value}get negative(){return ae(this.expression[0]).negative}write(d){return d.ts.wrap([d.token(this.tokens.assign),...this.expression.map((x)=>d.token(x))])}}class R extends i{static parse(d){let x=d.position,v={},k=B(new R({source:d.source,tokens:v}));return k.extAttrs=w.parse(d),v.optional=d.consume("optional"),k.idlType=se(d,"argument-type"),k.idlType?(v.optional||(v.variadic=d.consume("...")),v.name=d.consumeKind("identifier")||d.consume(...X),v.name?(k.default=v.optional?A.parse(d):null,k.this):d.unconsume(x)):d.unconsume(x)}get type(){return"argument"}get optional(){return!!this.tokens.optional}get variadic(){return!!this.tokens.variadic}get name(){return J(this.tokens.name.value)}*validate(d){yield*this.extAttrs.validate(d),yield*this.idlType.validate(d);let x=o(this.idlType,d,{useNullableInner:!0});if(x){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:_(this)})}else if(this.parent&&!a(x.dictionary,d)&&function(k){let C=k.parent.arguments||k.parent.list,G=C.indexOf(k);return!C.slice(G+1).some((ge)=>!ge.optional)}(this))yield s(this.tokens.name,this,"dict-arg-optional","Dictionary argument must be optional if it has no required fields",{autofix:(v=this,()=>{let C=oe(v.idlType);v.tokens.optional={...C,type:"optional",value:"optional"},C.trivia=" ",_(v)()})})}var v}write(d){return d.ts.wrap([this.extAttrs.write(d),d.token(this.tokens.optional),d.ts.type(this.idlType.write(d)),d.token(this.tokens.variadic),d.name_token(this.tokens.name,{data:this}),this.default?this.default.write(d):"",d.token(this.tokens.separator)])}}function _(d){return()=>{d.default=A.parse(new wt(" = {}"))}}class I extends i{static parse(d,{special:x,regular:v}={}){let k={special:x},C=B(new I({source:d.source,tokens:k}));return x&&x.value==="stringifier"&&(k.termination=d.consume(";"),k.termination)?(C.arguments=[],C):(x||v||(k.special=d.consume("getter","setter","deleter")),C.idlType=ue(d)||d.error("Missing return type"),k.name=d.consumeKind("identifier")||d.consume("includes"),k.open=d.consume("(")||d.error("Invalid operation"),C.arguments=ce(d),k.close=d.consume(")")||d.error("Unterminated operation"),k.termination=d.consume(";")||d.error("Unterminated operation, expected `;`"),C.this)}get type(){return"operation"}get name(){let{name:d}=this.tokens;return d?J(d.value):""}get special(){return this.tokens.special?this.tokens.special.value:""}*validate(d){if(yield*this.extAttrs.validate(d),!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(d)}for(let x of this.arguments)yield*x.validate(d)}write(d){let{parent:x}=this,v=this.idlType?[d.ts.type(this.idlType.write(d)),d.name_token(this.tokens.name,{data:this,parent:x}),d.token(this.tokens.open),d.ts.wrap(this.arguments.map((k)=>k.write(d))),d.token(this.tokens.close)]:[];return d.ts.definition(d.ts.wrap([this.extAttrs.write(d),this.tokens.name?d.token(this.tokens.special):d.token(this.tokens.special,d.ts.nameless,{data:this,parent:x}),...v,d.token(this.tokens.termination)]),{data:this,parent:x})}}class L extends i{static parse(d,{special:x,noInherit:v=!1,readonly:k=!1}={}){let C=d.position,G={special:x},ee=B(new L({source:d.source,tokens:G}));if(x||v||(G.special=d.consume("inherit")),ee.special==="inherit"&&d.probe("readonly")&&d.error("Inherited attributes cannot be read-only"),G.readonly=d.consume("readonly"),k&&!G.readonly&&d.probe("attribute")&&d.error("Attributes must be readonly in this context"),G.base=d.consume("attribute"),G.base)return ee.idlType=se(d,"attribute-type")||d.error("Attribute lacks a type"),G.name=d.consumeKind("identifier")||d.consume("async","required")||d.error("Attribute lacks a name"),G.termination=d.consume(";")||d.error("Unterminated attribute, expected `;`"),ee.this;d.unconsume(C)}get type(){return"attribute"}get special(){return this.tokens.special?this.tokens.special.value:""}get readonly(){return!!this.tokens.readonly}get name(){return J(this.tokens.name.value)}*validate(d){if(yield*this.extAttrs.validate(d),yield*this.idlType.validate(d),["async_sequence","sequence","record"].includes(this.idlType.generic)){let x=`Attributes cannot accept ${this.idlType.generic} types.`;yield s(this.tokens.name,this,"attr-invalid-type",x)}{let{reference:x}=o(this.idlType,d)||{};if(x){let v=(this.idlType.union?x:this.idlType).tokens.base;yield s(v,this,"attr-invalid-type","Attributes cannot accept dictionary types.")}}if(this.readonly&&function(x,v){if(x.union)return!1;if(x.extAttrs.some((C)=>C.name==="EnforceRange"))return!0;let k=v.unique.get(x.idlType);return k?.type==="typedef"&&k.idlType.extAttrs.some((C)=>C.name==="EnforceRange")}(this.idlType,d)){let x=this.idlType.tokens.base;yield s(x,this,"attr-invalid-type","Readonly attributes cannot accept [EnforceRange] extended attribute.")}}write(d){let{parent:x}=this;return d.ts.definition(d.ts.wrap([this.extAttrs.write(d),d.token(this.tokens.special),d.token(this.tokens.readonly),d.token(this.tokens.base),d.ts.type(this.idlType.write(d)),d.name_token(this.tokens.name,{data:this,parent:x}),d.token(this.tokens.termination)]),{data:this,parent:x})}}function J(d){return d.startsWith("_")?d.slice(1):d}function F(d,{parser:x,allowDangler:v,listName:k="list"}){let C=x(d);if(!C)return[];C.tokens.separator=d.consume(",");let G=[C];for(;C.tokens.separator;){let ee=x(d);if(!ee){v||d.error(`Trailing comma in ${k}`);break}if(ee.tokens.separator=d.consume(","),G.push(ee),!ee.tokens.separator)break}return G}function K(d){return d.consumeKind("decimal","integer")||d.consume("true","false","Infinity","-Infinity","NaN")}function ae({type:d,value:x}){switch(d){case"decimal":case"integer":return{type:"number",value:x};case"string":return{type:"string",value:x.slice(1,-1)}}switch(x){case"true":case"false":return{type:"boolean",value:x==="true"};case"Infinity":case"-Infinity":return{type:"Infinity",negative:x.startsWith("-")};case"[":return{type:"sequence",value:[]};case"{":return{type:"dictionary"};default:return{type:x}}}function me(d){let{source:x}=d,v=function(){let C=d.consume("unsigned"),G=d.consume("short","long");if(G){let ee=d.consume("long");return new E({source:x,tokens:{prefix:C,base:G,postfix:ee}})}C&&d.error("Failed to parse integer type")}()||function(){let C=d.consume("unrestricted"),G=d.consume("float","double");if(G)return new E({source:x,tokens:{prefix:C,base:G}});C&&d.error("Failed to parse float type")}();if(v)return v;let k=d.consume("bigint","boolean","byte","octet","undefined");return k?new E({source:x,tokens:{base:k}}):void 0}function ce(d){return F(d,{parser:R.parse,listName:"arguments list"})}function se(d,x){let v=w.parse(d),k=E.parse(d,x);return k&&(B(k).extAttrs=v),k}function ue(d,x){let v=E.parse(d,x||"return-type");if(v)return v;let k=d.consume("void");if(k){let C=new E({source:d.source,tokens:{base:k}});return C.type="return-type",C}}function Ce(d){let x=d.consume("stringifier");if(!x)return;return L.parse(d,{special:x})||I.parse(d,{special:x})||d.error("Unterminated stringifier")}function Y(d){let x=d.split(`
615
- `);if(x.length){let v=x[x.length-1].match(/^\s+/);if(v)return v[0]}return""}function Ee(d){return()=>{if(d.extAttrs.length){let x=new wt("Exposed=Window,"),v=y.parse(x);v.tokens.separator=x.consume(",");let k=d.extAttrs[0];/^\s/.test(k.tokens.name.trivia)||(k.tokens.name.trivia=` ${k.tokens.name.trivia}`),d.extAttrs.unshift(v)}else{B(d).extAttrs=w.parse(new wt("[Exposed=Window]"));let x=d.tokens.base.trivia;d.extAttrs.tokens.open.trivia=x,d.tokens.base.trivia=`
616
- ${Y(x)}`}}}function oe(d){if(d.extAttrs.length)return d.extAttrs.tokens.open;if(d.type==="operation"&&!d.special)return oe(d.idlType);return Object.values(d.tokens).sort((x,v)=>x.index-v.index)[0]}function B(d,x){if(x||(x=d),!d)return d;return new Proxy(d,{get(v,k){let C=v[k];return Array.isArray(C)&&k!=="source"?B(C,v):C},set(v,k,C){if(v[k]=C,!C)return!0;if(Array.isArray(C))for(let G of C)G.parent!==void 0&&(G.parent=x);else C.parent!==void 0&&(C.parent=x);return!0}})}let ot={decimal:/-?(?=[0-9]*\.|[0-9]+[eE])(([0-9]+\.[0-9]*|[0-9]*\.[0-9]+)([Ee][-+]?[0-9]+)?|[0-9]+[Ee][-+]?[0-9]+)/y,integer:/-?(0([Xx][0-9A-Fa-f]+|[0-7]*)|[1-9][0-9]*)/y,identifier:/[_-]?[A-Za-z][0-9A-Z_a-z-]*/y,string:/"[^"]*"/y,whitespace:/[\t\n\r ]+/y,comment:/\/\/.*|\/\*[\s\S]*?\*\//y,other:/[^\t\n\r 0-9A-Za-z]/y},de=["ArrayBuffer","SharedArrayBuffer","DataView","Int8Array","Int16Array","Int32Array","Uint8Array","Uint16Array","Uint32Array","Uint8ClampedArray","BigInt64Array","BigUint64Array","Float16Array","Float32Array","Float64Array","any","object","symbol"],$t=["ByteString","DOMString","USVString"],X=["async","attribute","callback","const","constructor","deleter","dictionary","enum","getter","includes","inherit","interface","iterable","maplike","namespace","partial","required","setlike","setter","static","stringifier","typedef","unrestricted"],jt=["-Infinity","FrozenArray","Infinity","NaN","ObservableArray","Promise","async_iterable","async_sequence","bigint","boolean","byte","double","false","float","long","mixin","null","octet","optional","or","readonly","record","sequence","short","true","undefined","unsigned","void"].concat(X,$t,de),et=["(",")",",","...",":",";","<","=",">","?","*","[","]","{","}"],Kt=["_constructor","toString","_toString"];class wt{constructor(d){this.source=function(x){let v=[],k=0,C="",G=1,ee=0;for(;k<x.length;){let pe=x.charAt(k),$e=-1;if(/[\t\n\r ]/.test(pe)?$e=ge("whitespace",{noFlushTrivia:!0}):pe==="/"&&($e=ge("comment",{noFlushTrivia:!0})),$e!==-1){let Te=v.pop().value;G+=(Te.match(/\n/g)||[]).length,C+=Te,ee-=1}else if(/[-0-9.A-Z_a-z]/.test(pe)){if($e=ge("decimal"),$e===-1&&($e=ge("integer")),$e===-1){$e=ge("identifier");let Te=v.length-1,qe=v[Te];if($e!==-1){if(Kt.includes(qe.value)){let cr=`${J(qe.value)} is a reserved identifier and must not be used.`;throw new Ot(n(v,Te,null,cr))}jt.includes(qe.value)&&(qe.type="inline")}}}else pe==='"'&&($e=ge("string"));for(let Te of et)if(x.startsWith(Te,k)){v.push({type:"inline",value:Te,trivia:C,line:G,index:ee}),C="",k+=Te.length,$e=k;break}if($e===-1&&($e=ge("other")),$e===-1)throw Error("Token stream not progressing");k=$e,ee+=1}return v.push({type:"eof",value:"",trivia:C,line:G,index:ee}),v;function ge(pe,{noFlushTrivia:$e}={}){let Te=ot[pe];Te.lastIndex=k;let qe=Te.exec(x);return qe?(v.push({type:pe,value:qe[0],trivia:C,line:G,index:ee}),$e||(C=""),Te.lastIndex):-1}}(d),this.position=0}error(d){throw new Ot(n(this.source,this.position,this.current,d))}probeKind(d){return this.source.length>this.position&&this.source[this.position].type===d}probe(d){return this.probeKind("inline")&&this.source[this.position].value===d}consumeKind(...d){for(let x of d){if(!this.probeKind(x))continue;let v=this.source[this.position];return this.position++,v}}consume(...d){if(!this.probeKind("inline"))return;let x=this.source[this.position];for(let v of d)if(x.value===v)return this.position++,x}consumeIdentifier(d){if(this.probeKind("identifier")&&this.source[this.position].value===d)return this.consumeKind("identifier")}unconsume(d){this.position=d}}class Ot extends Error{constructor({message:d,bareMessage:x,context:v,line:k,sourceName:C,input:G,tokens:ee}){super(d),this.name="WebIDLParseError",this.bareMessage=x,this.context=v,this.line=k,this.sourceName=C,this.input=G,this.tokens=ee}}class Yt extends c{static parse(d){let x=d.consumeKind("string");if(x)return new Yt({source:d.source,tokens:{value:x}})}get type(){return"enum-value"}get value(){return super.value.slice(1,-1)}write(d){let{parent:x}=this;return d.ts.wrap([d.ts.trivia(this.tokens.value.trivia),d.ts.definition(d.ts.wrap(['"',d.ts.name(this.value,{data:this,parent:x}),'"']),{data:this,parent:x}),d.token(this.tokens.separator)])}}class Vt extends i{static parse(d){let x={};if(x.base=d.consume("enum"),!x.base)return;x.name=d.consumeKind("identifier")||d.error("No name for enum");let v=B(new Vt({source:d.source,tokens:x}));return d.current=v.this,x.open=d.consume("{")||d.error("Bodyless enum"),v.values=F(d,{parser:Yt.parse,allowDangler:!0,listName:"enumeration"}),d.probeKind("string")&&d.error("No comma between enum values"),x.close=d.consume("}")||d.error("Unexpected value in enum"),v.values.length||d.error("No value in enum"),x.termination=d.consume(";")||d.error("No semicolon after enum"),v.this}get type(){return"enum"}get name(){return J(this.tokens.name.value)}write(d){return d.ts.definition(d.ts.wrap([this.extAttrs.write(d),d.token(this.tokens.base),d.name_token(this.tokens.name,{data:this}),d.token(this.tokens.open),d.ts.wrap(this.values.map((x)=>x.write(d))),d.token(this.tokens.close),d.token(this.tokens.termination)]),{data:this})}}class ts extends i{static parse(d){let x=d.consumeKind("identifier");if(!x)return;let v={target:x};if(v.includes=d.consume("includes"),v.includes)return v.mixin=d.consumeKind("identifier")||d.error("Incomplete includes statement"),v.termination=d.consume(";")||d.error("No terminating ; for includes statement"),new ts({source:d.source,tokens:v});d.unconsume(x.index)}get type(){return"includes"}get target(){return J(this.tokens.target.value)}get includes(){return J(this.tokens.mixin.value)}write(d){return d.ts.definition(d.ts.wrap([this.extAttrs.write(d),d.reference_token(this.tokens.target,this),d.token(this.tokens.includes),d.reference_token(this.tokens.mixin,this),d.token(this.tokens.termination)]),{data:this})}}class rs extends i{static parse(d){let x={},v=B(new rs({source:d.source,tokens:x}));if(x.base=d.consume("typedef"),x.base)return v.idlType=se(d,"typedef-type")||d.error("Typedef lacks a type"),x.name=d.consumeKind("identifier")||d.error("Typedef lacks a name"),d.current=v.this,x.termination=d.consume(";")||d.error("Unterminated typedef, expected `;`"),v.this}get type(){return"typedef"}get name(){return J(this.tokens.name.value)}*validate(d){yield*this.idlType.validate(d)}write(d){return d.ts.definition(d.ts.wrap([this.extAttrs.write(d),d.token(this.tokens.base),d.ts.type(this.idlType.write(d)),d.name_token(this.tokens.name,{data:this}),d.token(this.tokens.termination)]),{data:this})}}class yo extends i{static parse(d,x){let v={base:x},k=B(new yo({source:d.source,tokens:v}));return v.name=d.consumeKind("identifier")||d.error("Callback lacks a name"),d.current=k.this,v.assign=d.consume("=")||d.error("Callback lacks an assignment"),k.idlType=ue(d)||d.error("Callback lacks a return type"),v.open=d.consume("(")||d.error("Callback lacks parentheses for arguments"),k.arguments=ce(d),v.close=d.consume(")")||d.error("Unterminated callback"),v.termination=d.consume(";")||d.error("Unterminated callback, expected `;`"),k.this}get type(){return"callback"}get name(){return J(this.tokens.name.value)}*validate(d){yield*this.extAttrs.validate(d);for(let x of this.arguments)if(yield*x.validate(d),x.idlType.generic==="async_sequence")yield s(x.tokens.name,x,"async-sequence-idl-to-js","async_sequence types cannot be returned as a callback argument.");yield*this.idlType.validate(d)}write(d){return d.ts.definition(d.ts.wrap([this.extAttrs.write(d),d.token(this.tokens.base),d.name_token(this.tokens.name,{data:this}),d.token(this.tokens.assign),d.ts.type(this.idlType.write(d)),d.token(this.tokens.open),...this.arguments.map((x)=>x.write(d)),d.token(this.tokens.close),d.token(this.tokens.termination)]),{data:this})}}class Ir extends i{static parse(d,x,{inheritable:v,allowedMembers:k}){let{tokens:C,type:G}=x;for(C.name=d.consumeKind("identifier")||d.error(`Missing name in ${G}`),d.current=x,x=B(x),v&&Object.assign(C,function(ee){let ge=ee.consume(":");return ge?{colon:ge,inheritance:ee.consumeKind("identifier")||ee.error("Inheritance lacks a type")}:{}}(d)),C.open=d.consume("{")||d.error(`Bodyless ${G}`),x.members=[];;){if(C.close=d.consume("}"),C.close)return C.termination=d.consume(";")||d.error(`Missing semicolon after ${G}`),x.this;let ee=w.parse(d),ge;for(let[pe,...$e]of k)if(ge=B(pe(d,...$e)),ge)break;ge||d.error("Unknown member"),ge.extAttrs=ee,x.members.push(ge.this)}}get partial(){return!!this.tokens.partial}get name(){return J(this.tokens.name.value)}get inheritance(){return this.tokens.inheritance?J(this.tokens.inheritance.value):null}*validate(d){for(let x of this.members)x.validate&&(yield*x.validate(d))}write(d){return d.ts.definition(d.ts.wrap([this.extAttrs.write(d),d.token(this.tokens.callback),d.token(this.tokens.partial),d.token(this.tokens.base),d.token(this.tokens.mixin),d.name_token(this.tokens.name,{data:this}),(()=>this.tokens.inheritance?d.ts.wrap([d.token(this.tokens.colon),d.ts.trivia(this.tokens.inheritance.trivia),d.ts.inheritance(d.reference(this.tokens.inheritance.value,{context:this}))]):"")(),d.token(this.tokens.open),d.ts.wrap(this.members.map((x)=>x.write(d))),d.token(this.tokens.close),d.token(this.tokens.termination)]),{data:this})}}class ns extends i{static parse(d){let x={};if(x.base=d.consume("const"),!x.base)return;let v=me(d);if(!v){let C=d.consumeKind("identifier")||d.error("Const lacks a type");v=new E({source:d.source,tokens:{base:C}})}d.probe("?")&&d.error("Unexpected nullable constant type"),v.type="const-type",x.name=d.consumeKind("identifier")||d.error("Const lacks a name"),x.assign=d.consume("=")||d.error("Const lacks value assignment"),x.value=K(d)||d.error("Const lacks a value"),x.termination=d.consume(";")||d.error("Unterminated const, expected `;`");let k=new ns({source:d.source,tokens:x});return B(k).idlType=v,k}get type(){return"const"}get name(){return J(this.tokens.name.value)}get value(){return ae(this.tokens.value)}write(d){let{parent:x}=this;return d.ts.definition(d.ts.wrap([this.extAttrs.write(d),d.token(this.tokens.base),d.ts.type(this.idlType.write(d)),d.name_token(this.tokens.name,{data:this,parent:x}),d.token(this.tokens.assign),d.token(this.tokens.value),d.token(this.tokens.termination)]),{data:this,parent:x})}}class bo extends i{static parse(d){let x=d.position,v=B(new bo({source:d.source,tokens:{}})),{tokens:k}=v;if(k.readonly=d.consume("readonly"),k.readonly||(k.async=d.consume("async")),k.base=k.readonly?d.consume("maplike","setlike"):k.async?d.consume("iterable"):d.consume("iterable","async_iterable","maplike","setlike"),!k.base)return void d.unconsume(x);let{type:C}=v,G=C==="maplike",ee=G||C==="iterable"||C==="async_iterable",ge=C==="async_iterable"||v.async&&C==="iterable";k.open=d.consume("<")||d.error(`Missing less-than sign \`<\` in ${C} declaration`);let pe=se(d)||d.error(`Missing a type argument in ${C} declaration`);return v.idlType=[pe],v.arguments=[],ee&&(pe.tokens.separator=d.consume(","),pe.tokens.separator?v.idlType.push(se(d)):G&&d.error(`Missing second type argument in ${C} declaration`)),k.close=d.consume(">")||d.error(`Missing greater-than sign \`>\` in ${C} declaration`),d.probe("(")&&(ge?(k.argsOpen=d.consume("("),v.arguments.push(...ce(d)),k.argsClose=d.consume(")")||d.error("Unterminated async iterable argument list")):d.error("Arguments are only allowed for `async iterable`")),k.termination=d.consume(";")||d.error(`Missing semicolon after ${C} declaration`),v.this}get type(){return this.tokens.base.value}get readonly(){return!!this.tokens.readonly}get async(){return!!this.tokens.async}*validate(d){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:(x=this,()=>{let k=x.tokens.async;x.tokens.base={...k,type:"async_iterable",value:"async_iterable"},delete x.tokens.async})});var x;for(let v of this.idlType)yield*v.validate(d);for(let v of this.arguments)yield*v.validate(d)}write(d){return d.ts.definition(d.ts.wrap([this.extAttrs.write(d),d.token(this.tokens.readonly),d.token(this.tokens.async),d.token(this.tokens.base,d.ts.generic),d.token(this.tokens.open),d.ts.wrap(this.idlType.map((x)=>x.write(d))),d.token(this.tokens.close),d.token(this.tokens.argsOpen),d.ts.wrap(this.arguments.map((x)=>x.write(d))),d.token(this.tokens.argsClose),d.token(this.tokens.termination)]),{data:this,parent:this.parent})}}class xo extends i{static parse(d){let x=d.consume("constructor");if(!x)return;let v={base:x};v.open=d.consume("(")||d.error("No argument list in constructor");let k=ce(d);v.close=d.consume(")")||d.error("Unterminated constructor"),v.termination=d.consume(";")||d.error("No semicolon after constructor");let C=new xo({source:d.source,tokens:v});return B(C).arguments=k,C}get type(){return"constructor"}*validate(d){for(let x of this.arguments)yield*x.validate(d)}write(d){let{parent:x}=this;return d.ts.definition(d.ts.wrap([this.extAttrs.write(d),d.token(this.tokens.base,d.ts.nameless,{data:this,parent:x}),d.token(this.tokens.open),d.ts.wrap(this.arguments.map((v)=>v.write(d))),d.token(this.tokens.close),d.token(this.tokens.termination)]),{data:this,parent:x})}}function Wd(d){let x=d.consume("static");if(!x)return;return L.parse(d,{special:x})||I.parse(d,{special:x})||d.error("No body in static member")}class ss extends Ir{static parse(d,x,{extMembers:v=[],partial:k=null}={}){let C={partial:k,base:x};return Ir.parse(d,new ss({source:d.source,tokens:C}),{inheritable:!k,allowedMembers:[...v,[ns.parse],[xo.parse],[Wd],[Ce],[bo.parse],[L.parse],[I.parse]]})}get type(){return"interface"}*validate(d){if(yield*this.extAttrs.validate(d),!this.partial&&this.extAttrs.every((v)=>v.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:Ee(this)});let x=this.extAttrs.filter((v)=>v.name==="Constructor");for(let v of x)yield s(v.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:Sc(this,v)});if(this.extAttrs.some((v)=>v.name==="Global")){let v=this.extAttrs.filter((C)=>C.name==="LegacyFactoryFunction");for(let C of v)yield s(C.tokens.name,this,"no-constructible-global","Interfaces marked as `[Global]` cannot have factory functions.");let k=this.members.filter((C)=>C.type==="constructor");for(let C of k)yield s(C.tokens.base,this,"no-constructible-global","Interfaces marked as `[Global]` cannot have constructors.")}yield*super.validate(d),this.partial||(yield*function*(v,k){let C=function($e){let Te=pe($e);return{statics:new Set(Te.filter((qe)=>qe.special==="static").map((qe)=>qe.name)),nonstatics:new Set(Te.filter((qe)=>qe.special!=="static").map((qe)=>qe.name))}}(k),G=v.partials.get(k.name)||[],ee=v.mixinMap.get(k.name)||[];for(let $e of[...G,...ee]){let Te=pe($e),qe=Te.filter((yr)=>yr.special==="static"),cr=Te.filter((yr)=>yr.special!=="static");yield*ge(qe,C.statics,$e,k),yield*ge(cr,C.nonstatics,$e,k),qe.forEach((yr)=>C.statics.add(yr.name)),cr.forEach((yr)=>C.nonstatics.add(yr.name))}function*ge($e,Te,qe,cr){for(let yr of $e){let{name:Za}=yr;if(Za&&Te.has(Za)){let Bd=`The ${yr.special==="static"?"static ":""}operation "${Za}" has already been defined for the base interface "${cr.name}" either in itself or in a mixin`;yield s(yr.tokens.name,qe,"no-cross-overload",Bd)}}}function pe($e){return $e.members.filter(({type:Te})=>Te==="operation")}}(d,this))}}function Sc(d,x){return d=B(d),()=>{let v=Y(d.extAttrs.tokens.open.trivia),k=d.members.length?Y(oe(d.members[0]).trivia):function(Te){let qe=Y(Te),cr=qe.includes("\t")?"\t":" ";return qe+cr}(v),C=xo.parse(new wt(`
617
- ${k}constructor();`));C.extAttrs=new w({source:d.source,tokens:{}}),B(C).arguments=x.arguments;let G=function(Te,qe){let cr=Te.slice().reverse().findIndex(qe);return cr===-1?cr:Te.length-cr-1}(d.members,(Te)=>Te.type==="constructor");d.members.splice(G+1,0,C);let{close:ee}=d.tokens;ee.trivia.includes(`
614
+ `+(" ".repeat(Fe.length)+"^"),ap=C==="Syntax"?"since":"inside",lb=`${C} error at line ${Te}${d.name?` in ${d.name}`:""}${v&&v.name?`, ${ap} \`${v.partial?"partial ":""}${function(Mr){let Ni=[Mr];for(;Mr&&Mr.parent;){let{parent:fs}=Mr;Ni.unshift(fs),Mr=fs}return Ni.map((fs)=>function(al,ll){let cb=al;return ll&&(cb+=` ${ll}`),cb}(fs.type,fs.name)).join(" -> ")}(v)}\``:""}:
615
+ ${ol}`;return{message:`${lb} ${k}`,bareMessage:k,context:lb,line:Te,sourceName:d.name,level:G,ruleName:ge,autofix:ee,input:br,tokens:cr}}function n(d,x,v,k){return r(d,x,v,k,"Syntax")}function s(d,x,v,k,C={}){return C.ruleName=v,r(x.source,d.index,x,k,"Validation",C)}e.r(t),e.d(t,{WebIDLParseError:()=>Ot,parse:()=>Ce,validate:()=>Nt,write:()=>ve});class i{constructor({source:d,tokens:x}){Object.defineProperties(this,{source:{value:d},tokens:{value:x,writable:!0},parent:{value:null,writable:!0},this:{value:this}})}toJSON(){let d={type:void 0,name:void 0,inheritance:void 0},x=this;for(;x!==Object.prototype;){let v=Object.getOwnPropertyDescriptors(x);for(let[k,C]of Object.entries(v))(C.enumerable||C.get)&&(d[k]=this[k]);x=Object.getPrototypeOf(x)}return d}}function o(d,x,{useNullableInner:v}={}){if(!d.union){let k=x.unique.get(d.idlType);if(!k)return;if(k.type==="typedef"){let{typedefIncludesDictionary:C}=x.cache;if(C.has(k))return C.get(k);x.cache.typedefIncludesDictionary.set(k,void 0);let G=o(k.idlType,x);if(x.cache.typedefIncludesDictionary.set(k,G),G)return{reference:d,dictionary:G.dictionary}}if(k.type==="dictionary"&&(v||!d.nullable))return{reference:d,dictionary:k}}for(let k of d.subtype){let C=o(k,x);if(C)return k.union?C:{reference:k,dictionary:C.dictionary}}}function a(d,x){if(x.cache.dictionaryIncludesRequiredField.has(d))return x.cache.dictionaryIncludesRequiredField.get(d);x.cache.dictionaryIncludesRequiredField.set(d,void 0);let v=d.members.some((k)=>k.required);if(!v&&d.inheritance){let k=x.unique.get(d.inheritance);k?a(k,x)&&(v=!0):v=!0}return x.cache.dictionaryIncludesRequiredField.set(d,v),v}class l extends Array{constructor({source:d,tokens:x}){super(),Object.defineProperties(this,{source:{value:d},tokens:{value:x},parent:{value:null,writable:!0}})}}class c extends i{static parser(d,x){return()=>{let v=d.consumeKind(x);if(v)return new c({source:d.source,tokens:{value:v}})}}get value(){return O(this.tokens.value.value)}write(d){return d.ts.wrap([d.token(this.tokens.value),d.token(this.tokens.separator)])}}class u extends c{static parse(d){let x=d.consumeKind("eof");if(x)return new u({source:d.source,tokens:{value:x}})}get type(){return"eof"}}function p(d,x){return L(d,{parser:c.parser(d,x),listName:x+" list"})}let h=["identifier","decimal","integer","string"],m=new Map([...["NoInterfaceObject","LenientSetter","LenientThis","TreatNonObjectAsNull","Unforgeable"].map((d)=>[d,`Legacy${d}`]),["NamedConstructor","LegacyFactoryFunction"],["OverrideBuiltins","LegacyOverrideBuiltIns"],["TreatNullAs","LegacyNullToEmptyString"]]);function y(d){for(let x of h){let v=p(d,x);if(v.length)return v}d.error("Expected identifiers, strings, decimals, or integers but none found")}class g extends i{static parse(d){let x={assign:d.consume("=")},v=W(new g({source:d.source,tokens:x}));if(v.list=[],x.assign){if(x.asterisk=d.consume("*"),x.asterisk)return v.this;x.secondaryName=d.consumeKind(...h)}return x.open=d.consume("("),x.open?(v.list=v.rhsIsList?y(d):ce(d),x.close=d.consume(")")||d.error("Unexpected token in extended attribute argument list")):x.assign&&!x.secondaryName&&d.error("No right hand side to extended attribute assignment"),v.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(d){let{rhsType:x}=this;return d.ts.wrap([d.token(this.tokens.assign),d.token(this.tokens.asterisk),d.reference_token(this.tokens.secondaryName,this.parent),d.token(this.tokens.open),...this.list.map((v)=>x==="identifier-list"?d.identifier(v,this.parent):v.write(d)),d.token(this.tokens.close)])}}class b extends i{static parse(d){let x=d.consumeKind("identifier");if(x)return new b({source:d.source,tokens:{name:x},params:g.parse(d)})}constructor({source:d,tokens:x,params:v}){super({source:d,tokens:x}),v.parent=this,Object.defineProperty(this,"params",{value:v})}get type(){return"extended-attribute"}get name(){return this.tokens.name.value}get rhs(){let{rhsType:d,tokens:x,list:v}=this.params;if(!d)return null;return{type:d,value:this.params.rhsIsList?v:this.params.tokens.secondaryName?O(x.secondaryName.value):null}}get arguments(){let{rhsIsList:d,list:x}=this.params;return!x||d?[]:x}*validate(d){let{name:x}=this;if(x==="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(x)){let k=`\`[${x}]\` extended attribute is a legacy feature that is now renamed to \`[${m.get(x)}]\`. Refer to the [relevant upstream PR](https://github.com/whatwg/webidl/pull/870) for more information.`;yield s(this.tokens.name,this,"renamed-legacy",k,{level:"warning",autofix:(v=this,()=>{let{name:C}=v;v.tokens.name.value=m.get(C),C==="TreatNullAs"&&(v.params.tokens={})})})}var v;for(let k of this.arguments)yield*k.validate(d)}write(d){return d.ts.wrap([d.ts.trivia(this.tokens.name.trivia),d.ts.extendedAttribute(d.ts.wrap([d.ts.extendedAttributeReference(this.name),this.params.write(d)])),d.token(this.tokens.separator)])}}class w extends l{static parse(d){let x={};x.open=d.consume("[");let v=new w({source:d.source,tokens:x});return x.open?(v.push(...L(d,{parser:b.parse,listName:"extended attribute"})),x.close=d.consume("]")||d.error("Expected a closing token for the extended attribute list"),v.length||(d.unconsume(x.close.index),d.error("An extended attribute list must not be empty")),d.probe("[")&&d.error("Illegal double extended attribute lists, consider merging them"),v):v}*validate(d){for(let x of this)yield*x.validate(d)}write(d){return this.length?d.ts.wrap([d.token(this.tokens.open),...this.map((x)=>x.write(d)),d.token(this.tokens.close)]):""}}function j(d,x){let v=d.consume("?");v&&(x.tokens.nullable=v),d.probe("?")&&d.error("Can't nullable more than once")}function S(d,x){let v=function(k,C){let G=k.consume("FrozenArray","ObservableArray","Promise","async_sequence","sequence","record");if(!G)return;let ee=W(new E({source:k.source,tokens:{base:G}}));switch(ee.tokens.open=k.consume("<")||k.error(`No opening bracket after ${G.value}`),G.value){case"Promise":{k.probe("[")&&k.error("Promise type cannot have extended attribute");let ge=ue(k,C)||k.error("Missing Promise subtype");ee.subtype.push(ge);break}case"async_sequence":case"sequence":case"FrozenArray":case"ObservableArray":{let ge=se(k,C)||k.error(`Missing ${G.value} subtype`);ee.subtype.push(ge);break}case"record":{k.probe("[")&&k.error("Record key cannot have extended attribute");let ge=k.consume(...$t)||k.error(`Record key must be one of: ${$t.join(", ")}`),pe=new E({source:k.source,tokens:{base:ge}});pe.tokens.separator=k.consume(",")||k.error("Missing comma after record key type"),pe.type=C;let $e=se(k,C)||k.error("Error parsing generic type record");ee.subtype.push(pe,$e);break}}return ee.idlType||k.error(`Error parsing generic type ${G.value}`),ee.tokens.close=k.consume(">")||k.error(`Missing closing bracket after ${G.value}`),ee.this}(d,x)||me(d);if(!v){let k=d.consumeKind("identifier")||d.consume(...$t,...de);if(!k)return;v=new E({source:d.source,tokens:{base:k}}),d.probe("<")&&d.error(`Unsupported generic type ${k.value}`)}return v.generic==="Promise"&&d.probe("?")&&d.error("Promise type cannot be nullable"),v.type=x||null,j(d,v),v.nullable&&v.idlType==="any"&&d.error("Type `any` cannot be made nullable"),v}class E extends i{static parse(d,x){return S(d,x)||function(v,k){let C={};if(C.open=v.consume("("),!C.open)return;let G=W(new E({source:v.source,tokens:C}));for(G.type=k||null;;){let ee=se(v,k)||v.error("No type after open parenthesis or 'or' in union type");ee.idlType==="any"&&v.error("Type `any` cannot be included in a union type"),ee.generic==="Promise"&&v.error("Type `Promise` cannot be included in a union type"),G.subtype.push(ee);let ge=v.consume("or");if(!ge)break;ee.tokens.separator=ge}return G.idlType.length<2&&v.error("At least two types are expected in a union type but found less"),C.close=v.consume(")")||v.error("Unterminated union type"),j(v,G),G.this}(d,x)}constructor({source:d,tokens:x}){super({source:d,tokens:x}),Object.defineProperty(this,"subtype",{value:[],writable:!0}),this.extAttrs=new w({source:d,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((d)=>d).map((d)=>d.value).join(" "))}*validate(d){if(yield*this.extAttrs.validate(d),this.idlType==="BufferSource")for(let C of[this.extAttrs,this.parent?.extAttrs])for(let G of C){if(G.name!=="AllowShared")continue;let ee="`[AllowShared] BufferSource` is now replaced with AllowSharedBufferSource.";yield s(this.tokens.base,this,"migrate-allowshared",ee,{autofix:P(this,G,C)})}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:(x=this,()=>{x.tokens.base.value="undefined"})});var x;let v=!this.union&&d.unique.get(this.idlType),k=this.union?this:v&&v.type==="typedef"?v.idlType:void 0;if(k&&this.nullable){let{reference:C}=o(k,d)||{};if(C){let G=(this.union?C:this).tokens.base;yield s(G,this,"no-nullable-union-dict","Nullable union cannot include a dictionary type.")}}else for(let C of this.subtype)yield*C.validate(d)}write(d){return d.ts.wrap([this.extAttrs.write(d),(()=>{if(this.union||this.generic)return d.ts.wrap([d.token(this.tokens.base,d.ts.generic),d.token(this.tokens.open),...this.subtype.map((C)=>C.write(d)),d.token(this.tokens.close)]);let x=this.tokens.prefix||this.tokens.base,v=this.tokens.prefix?[this.tokens.prefix.value,d.ts.trivia(this.tokens.base.trivia)]:[],k=d.reference(d.ts.wrap([...v,this.tokens.base.value,d.token(this.tokens.postfix)]),{unescaped:this.idlType,context:this});return d.ts.wrap([d.ts.trivia(x.trivia),k])})(),d.token(this.tokens.nullable),d.token(this.tokens.separator)])}}function P(d,x,v){return()=>{let k=v.indexOf(x);v.splice(k,1),!v.length&&d.tokens.base.trivia.match(/^\s$/)&&(d.tokens.base.trivia=""),d.tokens.base.value="AllowSharedBufferSource"}}class R extends i{static parse(d){let x=d.consume("=");if(!x)return null;let v=K(d)||d.consumeKind("string")||d.consume("null","[","{")||d.error("No value for default"),k=[v];if(v.value==="["){let C=d.consume("]")||d.error("Default sequence value must be empty");k.push(C)}else if(v.value==="{"){let C=d.consume("}")||d.error("Default dictionary value must be empty");k.push(C)}return new R({source:d.source,tokens:{assign:x},expression:k})}constructor({source:d,tokens:x,expression:v}){super({source:d,tokens:x}),v.parent=this,Object.defineProperty(this,"expression",{value:v})}get type(){return ae(this.expression[0]).type}get value(){return ae(this.expression[0]).value}get negative(){return ae(this.expression[0]).negative}write(d){return d.ts.wrap([d.token(this.tokens.assign),...this.expression.map((x)=>d.token(x))])}}class N extends i{static parse(d){let x=d.position,v={},k=W(new N({source:d.source,tokens:v}));return k.extAttrs=w.parse(d),v.optional=d.consume("optional"),k.idlType=se(d,"argument-type"),k.idlType?(v.optional||(v.variadic=d.consume("...")),v.name=d.consumeKind("identifier")||d.consume(...Y),v.name?(k.default=v.optional?R.parse(d):null,k.this):d.unconsume(x)):d.unconsume(x)}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(d){yield*this.extAttrs.validate(d),yield*this.idlType.validate(d);let x=o(this.idlType,d,{useNullableInner:!0});if(x){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:_(this)})}else if(this.parent&&!a(x.dictionary,d)&&function(k){let C=k.parent.arguments||k.parent.list,G=C.indexOf(k);return!C.slice(G+1).some((ge)=>!ge.optional)}(this))yield s(this.tokens.name,this,"dict-arg-optional","Dictionary argument must be optional if it has no required fields",{autofix:(v=this,()=>{let C=oe(v.idlType);v.tokens.optional={...C,type:"optional",value:"optional"},C.trivia=" ",_(v)()})})}var v}write(d){return d.ts.wrap([this.extAttrs.write(d),d.token(this.tokens.optional),d.ts.type(this.idlType.write(d)),d.token(this.tokens.variadic),d.name_token(this.tokens.name,{data:this}),this.default?this.default.write(d):"",d.token(this.tokens.separator)])}}function _(d){return()=>{d.default=R.parse(new wt(" = {}"))}}class q extends i{static parse(d,{special:x,regular:v}={}){let k={special:x},C=W(new q({source:d.source,tokens:k}));return x&&x.value==="stringifier"&&(k.termination=d.consume(";"),k.termination)?(C.arguments=[],C):(x||v||(k.special=d.consume("getter","setter","deleter")),C.idlType=ue(d)||d.error("Missing return type"),k.name=d.consumeKind("identifier")||d.consume("includes"),k.open=d.consume("(")||d.error("Invalid operation"),C.arguments=ce(d),k.close=d.consume(")")||d.error("Unterminated operation"),k.termination=d.consume(";")||d.error("Unterminated operation, expected `;`"),C.this)}get type(){return"operation"}get name(){let{name:d}=this.tokens;return d?O(d.value):""}get special(){return this.tokens.special?this.tokens.special.value:""}*validate(d){if(yield*this.extAttrs.validate(d),!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(d)}for(let x of this.arguments)yield*x.validate(d)}write(d){let{parent:x}=this,v=this.idlType?[d.ts.type(this.idlType.write(d)),d.name_token(this.tokens.name,{data:this,parent:x}),d.token(this.tokens.open),d.ts.wrap(this.arguments.map((k)=>k.write(d))),d.token(this.tokens.close)]:[];return d.ts.definition(d.ts.wrap([this.extAttrs.write(d),this.tokens.name?d.token(this.tokens.special):d.token(this.tokens.special,d.ts.nameless,{data:this,parent:x}),...v,d.token(this.tokens.termination)]),{data:this,parent:x})}}class D extends i{static parse(d,{special:x,noInherit:v=!1,readonly:k=!1}={}){let C=d.position,G={special:x},ee=W(new D({source:d.source,tokens:G}));if(x||v||(G.special=d.consume("inherit")),ee.special==="inherit"&&d.probe("readonly")&&d.error("Inherited attributes cannot be read-only"),G.readonly=d.consume("readonly"),k&&!G.readonly&&d.probe("attribute")&&d.error("Attributes must be readonly in this context"),G.base=d.consume("attribute"),G.base)return ee.idlType=se(d,"attribute-type")||d.error("Attribute lacks a type"),G.name=d.consumeKind("identifier")||d.consume("async","required")||d.error("Attribute lacks a name"),G.termination=d.consume(";")||d.error("Unterminated attribute, expected `;`"),ee.this;d.unconsume(C)}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(d){if(yield*this.extAttrs.validate(d),yield*this.idlType.validate(d),["async_sequence","sequence","record"].includes(this.idlType.generic)){let x=`Attributes cannot accept ${this.idlType.generic} types.`;yield s(this.tokens.name,this,"attr-invalid-type",x)}{let{reference:x}=o(this.idlType,d)||{};if(x){let v=(this.idlType.union?x:this.idlType).tokens.base;yield s(v,this,"attr-invalid-type","Attributes cannot accept dictionary types.")}}if(this.readonly&&function(x,v){if(x.union)return!1;if(x.extAttrs.some((C)=>C.name==="EnforceRange"))return!0;let k=v.unique.get(x.idlType);return k?.type==="typedef"&&k.idlType.extAttrs.some((C)=>C.name==="EnforceRange")}(this.idlType,d)){let x=this.idlType.tokens.base;yield s(x,this,"attr-invalid-type","Readonly attributes cannot accept [EnforceRange] extended attribute.")}}write(d){let{parent:x}=this;return d.ts.definition(d.ts.wrap([this.extAttrs.write(d),d.token(this.tokens.special),d.token(this.tokens.readonly),d.token(this.tokens.base),d.ts.type(this.idlType.write(d)),d.name_token(this.tokens.name,{data:this,parent:x}),d.token(this.tokens.termination)]),{data:this,parent:x})}}function O(d){return d.startsWith("_")?d.slice(1):d}function L(d,{parser:x,allowDangler:v,listName:k="list"}){let C=x(d);if(!C)return[];C.tokens.separator=d.consume(",");let G=[C];for(;C.tokens.separator;){let ee=x(d);if(!ee){v||d.error(`Trailing comma in ${k}`);break}if(ee.tokens.separator=d.consume(","),G.push(ee),!ee.tokens.separator)break}return G}function K(d){return d.consumeKind("decimal","integer")||d.consume("true","false","Infinity","-Infinity","NaN")}function ae({type:d,value:x}){switch(d){case"decimal":case"integer":return{type:"number",value:x};case"string":return{type:"string",value:x.slice(1,-1)}}switch(x){case"true":case"false":return{type:"boolean",value:x==="true"};case"Infinity":case"-Infinity":return{type:"Infinity",negative:x.startsWith("-")};case"[":return{type:"sequence",value:[]};case"{":return{type:"dictionary"};default:return{type:x}}}function me(d){let{source:x}=d,v=function(){let C=d.consume("unsigned"),G=d.consume("short","long");if(G){let ee=d.consume("long");return new E({source:x,tokens:{prefix:C,base:G,postfix:ee}})}C&&d.error("Failed to parse integer type")}()||function(){let C=d.consume("unrestricted"),G=d.consume("float","double");if(G)return new E({source:x,tokens:{prefix:C,base:G}});C&&d.error("Failed to parse float type")}();if(v)return v;let k=d.consume("bigint","boolean","byte","octet","undefined");return k?new E({source:x,tokens:{base:k}}):void 0}function ce(d){return L(d,{parser:N.parse,listName:"arguments list"})}function se(d,x){let v=w.parse(d),k=E.parse(d,x);return k&&(W(k).extAttrs=v),k}function ue(d,x){let v=E.parse(d,x||"return-type");if(v)return v;let k=d.consume("void");if(k){let C=new E({source:d.source,tokens:{base:k}});return C.type="return-type",C}}function Ne(d){let x=d.consume("stringifier");if(!x)return;return D.parse(d,{special:x})||q.parse(d,{special:x})||d.error("Unterminated stringifier")}function X(d){let x=d.split(`
616
+ `);if(x.length){let v=x[x.length-1].match(/^\s+/);if(v)return v[0]}return""}function Ee(d){return()=>{if(d.extAttrs.length){let x=new wt("Exposed=Window,"),v=b.parse(x);v.tokens.separator=x.consume(",");let k=d.extAttrs[0];/^\s/.test(k.tokens.name.trivia)||(k.tokens.name.trivia=` ${k.tokens.name.trivia}`),d.extAttrs.unshift(v)}else{W(d).extAttrs=w.parse(new wt("[Exposed=Window]"));let x=d.tokens.base.trivia;d.extAttrs.tokens.open.trivia=x,d.tokens.base.trivia=`
617
+ ${X(x)}`}}}function oe(d){if(d.extAttrs.length)return d.extAttrs.tokens.open;if(d.type==="operation"&&!d.special)return oe(d.idlType);return Object.values(d.tokens).sort((x,v)=>x.index-v.index)[0]}function W(d,x){if(x||(x=d),!d)return d;return new Proxy(d,{get(v,k){let C=v[k];return Array.isArray(C)&&k!=="source"?W(C,v):C},set(v,k,C){if(v[k]=C,!C)return!0;if(Array.isArray(C))for(let G of C)G.parent!==void 0&&(G.parent=x);else C.parent!==void 0&&(C.parent=x);return!0}})}let ot={decimal:/-?(?=[0-9]*\.|[0-9]+[eE])(([0-9]+\.[0-9]*|[0-9]*\.[0-9]+)([Ee][-+]?[0-9]+)?|[0-9]+[Ee][-+]?[0-9]+)/y,integer:/-?(0([Xx][0-9A-Fa-f]+|[0-7]*)|[1-9][0-9]*)/y,identifier:/[_-]?[A-Za-z][0-9A-Z_a-z-]*/y,string:/"[^"]*"/y,whitespace:/[\t\n\r ]+/y,comment:/\/\/.*|\/\*[\s\S]*?\*\//y,other:/[^\t\n\r 0-9A-Za-z]/y},de=["ArrayBuffer","SharedArrayBuffer","DataView","Int8Array","Int16Array","Int32Array","Uint8Array","Uint16Array","Uint32Array","Uint8ClampedArray","BigInt64Array","BigUint64Array","Float16Array","Float32Array","Float64Array","any","object","symbol"],$t=["ByteString","DOMString","USVString"],Y=["async","attribute","callback","const","constructor","deleter","dictionary","enum","getter","includes","inherit","interface","iterable","maplike","namespace","partial","required","setlike","setter","static","stringifier","typedef","unrestricted"],Pt=["-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(Y,$t,de),et=["(",")",",","...",":",";","<","=",">","?","*","[","]","{","}"],Kt=["_constructor","toString","_toString"];class wt{constructor(d){this.source=function(x){let v=[],k=0,C="",G=1,ee=0;for(;k<x.length;){let pe=x.charAt(k),$e=-1;if(/[\t\n\r ]/.test(pe)?$e=ge("whitespace",{noFlushTrivia:!0}):pe==="/"&&($e=ge("comment",{noFlushTrivia:!0})),$e!==-1){let Te=v.pop().value;G+=(Te.match(/\n/g)||[]).length,C+=Te,ee-=1}else if(/[-0-9.A-Z_a-z]/.test(pe)){if($e=ge("decimal"),$e===-1&&($e=ge("integer")),$e===-1){$e=ge("identifier");let Te=v.length-1,Fe=v[Te];if($e!==-1){if(Kt.includes(Fe.value)){let cr=`${O(Fe.value)} is a reserved identifier and must not be used.`;throw new Ot(n(v,Te,null,cr))}Pt.includes(Fe.value)&&(Fe.type="inline")}}}else pe==='"'&&($e=ge("string"));for(let Te of et)if(x.startsWith(Te,k)){v.push({type:"inline",value:Te,trivia:C,line:G,index:ee}),C="",k+=Te.length,$e=k;break}if($e===-1&&($e=ge("other")),$e===-1)throw Error("Token stream not progressing");k=$e,ee+=1}return v.push({type:"eof",value:"",trivia:C,line:G,index:ee}),v;function ge(pe,{noFlushTrivia:$e}={}){let Te=ot[pe];Te.lastIndex=k;let Fe=Te.exec(x);return Fe?(v.push({type:pe,value:Fe[0],trivia:C,line:G,index:ee}),$e||(C=""),Te.lastIndex):-1}}(d),this.position=0}error(d){throw new Ot(n(this.source,this.position,this.current,d))}probeKind(d){return this.source.length>this.position&&this.source[this.position].type===d}probe(d){return this.probeKind("inline")&&this.source[this.position].value===d}consumeKind(...d){for(let x of d){if(!this.probeKind(x))continue;let v=this.source[this.position];return this.position++,v}}consume(...d){if(!this.probeKind("inline"))return;let x=this.source[this.position];for(let v of d)if(x.value===v)return this.position++,x}consumeIdentifier(d){if(this.probeKind("identifier")&&this.source[this.position].value===d)return this.consumeKind("identifier")}unconsume(d){this.position=d}}class Ot extends Error{constructor({message:d,bareMessage:x,context:v,line:k,sourceName:C,input:G,tokens:ee}){super(d),this.name="WebIDLParseError",this.bareMessage=x,this.context=v,this.line=k,this.sourceName=C,this.input=G,this.tokens=ee}}class Xt extends c{static parse(d){let x=d.consumeKind("string");if(x)return new Xt({source:d.source,tokens:{value:x}})}get type(){return"enum-value"}get value(){return super.value.slice(1,-1)}write(d){let{parent:x}=this;return d.ts.wrap([d.ts.trivia(this.tokens.value.trivia),d.ts.definition(d.ts.wrap(['"',d.ts.name(this.value,{data:this,parent:x}),'"']),{data:this,parent:x}),d.token(this.tokens.separator)])}}class qt extends i{static parse(d){let x={};if(x.base=d.consume("enum"),!x.base)return;x.name=d.consumeKind("identifier")||d.error("No name for enum");let v=W(new qt({source:d.source,tokens:x}));return d.current=v.this,x.open=d.consume("{")||d.error("Bodyless enum"),v.values=L(d,{parser:Xt.parse,allowDangler:!0,listName:"enumeration"}),d.probeKind("string")&&d.error("No comma between enum values"),x.close=d.consume("}")||d.error("Unexpected value in enum"),v.values.length||d.error("No value in enum"),x.termination=d.consume(";")||d.error("No semicolon after enum"),v.this}get type(){return"enum"}get name(){return O(this.tokens.name.value)}write(d){return d.ts.definition(d.ts.wrap([this.extAttrs.write(d),d.token(this.tokens.base),d.name_token(this.tokens.name,{data:this}),d.token(this.tokens.open),d.ts.wrap(this.values.map((x)=>x.write(d))),d.token(this.tokens.close),d.token(this.tokens.termination)]),{data:this})}}class os extends i{static parse(d){let x=d.consumeKind("identifier");if(!x)return;let v={target:x};if(v.includes=d.consume("includes"),v.includes)return v.mixin=d.consumeKind("identifier")||d.error("Incomplete includes statement"),v.termination=d.consume(";")||d.error("No terminating ; for includes statement"),new os({source:d.source,tokens:v});d.unconsume(x.index)}get type(){return"includes"}get target(){return O(this.tokens.target.value)}get includes(){return O(this.tokens.mixin.value)}write(d){return d.ts.definition(d.ts.wrap([this.extAttrs.write(d),d.reference_token(this.tokens.target,this),d.token(this.tokens.includes),d.reference_token(this.tokens.mixin,this),d.token(this.tokens.termination)]),{data:this})}}class as extends i{static parse(d){let x={},v=W(new as({source:d.source,tokens:x}));if(x.base=d.consume("typedef"),x.base)return v.idlType=se(d,"typedef-type")||d.error("Typedef lacks a type"),x.name=d.consumeKind("identifier")||d.error("Typedef lacks a name"),d.current=v.this,x.termination=d.consume(";")||d.error("Unterminated typedef, expected `;`"),v.this}get type(){return"typedef"}get name(){return O(this.tokens.name.value)}*validate(d){yield*this.idlType.validate(d)}write(d){return d.ts.definition(d.ts.wrap([this.extAttrs.write(d),d.token(this.tokens.base),d.ts.type(this.idlType.write(d)),d.name_token(this.tokens.name,{data:this}),d.token(this.tokens.termination)]),{data:this})}}class wo extends i{static parse(d,x){let v={base:x},k=W(new wo({source:d.source,tokens:v}));return v.name=d.consumeKind("identifier")||d.error("Callback lacks a name"),d.current=k.this,v.assign=d.consume("=")||d.error("Callback lacks an assignment"),k.idlType=ue(d)||d.error("Callback lacks a return type"),v.open=d.consume("(")||d.error("Callback lacks parentheses for arguments"),k.arguments=ce(d),v.close=d.consume(")")||d.error("Unterminated callback"),v.termination=d.consume(";")||d.error("Unterminated callback, expected `;`"),k.this}get type(){return"callback"}get name(){return O(this.tokens.name.value)}*validate(d){yield*this.extAttrs.validate(d);for(let x of this.arguments)if(yield*x.validate(d),x.idlType.generic==="async_sequence")yield s(x.tokens.name,x,"async-sequence-idl-to-js","async_sequence types cannot be returned as a callback argument.");yield*this.idlType.validate(d)}write(d){return d.ts.definition(d.ts.wrap([this.extAttrs.write(d),d.token(this.tokens.base),d.name_token(this.tokens.name,{data:this}),d.token(this.tokens.assign),d.ts.type(this.idlType.write(d)),d.token(this.tokens.open),...this.arguments.map((x)=>x.write(d)),d.token(this.tokens.close),d.token(this.tokens.termination)]),{data:this})}}class Jr extends i{static parse(d,x,{inheritable:v,allowedMembers:k}){let{tokens:C,type:G}=x;for(C.name=d.consumeKind("identifier")||d.error(`Missing name in ${G}`),d.current=x,x=W(x),v&&Object.assign(C,function(ee){let ge=ee.consume(":");return ge?{colon:ge,inheritance:ee.consumeKind("identifier")||ee.error("Inheritance lacks a type")}:{}}(d)),C.open=d.consume("{")||d.error(`Bodyless ${G}`),x.members=[];;){if(C.close=d.consume("}"),C.close)return C.termination=d.consume(";")||d.error(`Missing semicolon after ${G}`),x.this;let ee=w.parse(d),ge;for(let[pe,...$e]of k)if(ge=W(pe(d,...$e)),ge)break;ge||d.error("Unknown member"),ge.extAttrs=ee,x.members.push(ge.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(d){for(let x of this.members)x.validate&&(yield*x.validate(d))}write(d){return d.ts.definition(d.ts.wrap([this.extAttrs.write(d),d.token(this.tokens.callback),d.token(this.tokens.partial),d.token(this.tokens.base),d.token(this.tokens.mixin),d.name_token(this.tokens.name,{data:this}),(()=>this.tokens.inheritance?d.ts.wrap([d.token(this.tokens.colon),d.ts.trivia(this.tokens.inheritance.trivia),d.ts.inheritance(d.reference(this.tokens.inheritance.value,{context:this}))]):"")(),d.token(this.tokens.open),d.ts.wrap(this.members.map((x)=>x.write(d))),d.token(this.tokens.close),d.token(this.tokens.termination)]),{data:this})}}class ls extends i{static parse(d){let x={};if(x.base=d.consume("const"),!x.base)return;let v=me(d);if(!v){let C=d.consumeKind("identifier")||d.error("Const lacks a type");v=new E({source:d.source,tokens:{base:C}})}d.probe("?")&&d.error("Unexpected nullable constant type"),v.type="const-type",x.name=d.consumeKind("identifier")||d.error("Const lacks a name"),x.assign=d.consume("=")||d.error("Const lacks value assignment"),x.value=K(d)||d.error("Const lacks a value"),x.termination=d.consume(";")||d.error("Unterminated const, expected `;`");let k=new ls({source:d.source,tokens:x});return W(k).idlType=v,k}get type(){return"const"}get name(){return O(this.tokens.name.value)}get value(){return ae(this.tokens.value)}write(d){let{parent:x}=this;return d.ts.definition(d.ts.wrap([this.extAttrs.write(d),d.token(this.tokens.base),d.ts.type(this.idlType.write(d)),d.name_token(this.tokens.name,{data:this,parent:x}),d.token(this.tokens.assign),d.token(this.tokens.value),d.token(this.tokens.termination)]),{data:this,parent:x})}}class vo extends i{static parse(d){let x=d.position,v=W(new vo({source:d.source,tokens:{}})),{tokens:k}=v;if(k.readonly=d.consume("readonly"),k.readonly||(k.async=d.consume("async")),k.base=k.readonly?d.consume("maplike","setlike"):k.async?d.consume("iterable"):d.consume("iterable","async_iterable","maplike","setlike"),!k.base)return void d.unconsume(x);let{type:C}=v,G=C==="maplike",ee=G||C==="iterable"||C==="async_iterable",ge=C==="async_iterable"||v.async&&C==="iterable";k.open=d.consume("<")||d.error(`Missing less-than sign \`<\` in ${C} declaration`);let pe=se(d)||d.error(`Missing a type argument in ${C} declaration`);return v.idlType=[pe],v.arguments=[],ee&&(pe.tokens.separator=d.consume(","),pe.tokens.separator?v.idlType.push(se(d)):G&&d.error(`Missing second type argument in ${C} declaration`)),k.close=d.consume(">")||d.error(`Missing greater-than sign \`>\` in ${C} declaration`),d.probe("(")&&(ge?(k.argsOpen=d.consume("("),v.arguments.push(...ce(d)),k.argsClose=d.consume(")")||d.error("Unterminated async iterable argument list")):d.error("Arguments are only allowed for `async iterable`")),k.termination=d.consume(";")||d.error(`Missing semicolon after ${C} declaration`),v.this}get type(){return this.tokens.base.value}get readonly(){return!!this.tokens.readonly}get async(){return!!this.tokens.async}*validate(d){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:(x=this,()=>{let k=x.tokens.async;x.tokens.base={...k,type:"async_iterable",value:"async_iterable"},delete x.tokens.async})});var x;for(let v of this.idlType)yield*v.validate(d);for(let v of this.arguments)yield*v.validate(d)}write(d){return d.ts.definition(d.ts.wrap([this.extAttrs.write(d),d.token(this.tokens.readonly),d.token(this.tokens.async),d.token(this.tokens.base,d.ts.generic),d.token(this.tokens.open),d.ts.wrap(this.idlType.map((x)=>x.write(d))),d.token(this.tokens.close),d.token(this.tokens.argsOpen),d.ts.wrap(this.arguments.map((x)=>x.write(d))),d.token(this.tokens.argsClose),d.token(this.tokens.termination)]),{data:this,parent:this.parent})}}class So extends i{static parse(d){let x=d.consume("constructor");if(!x)return;let v={base:x};v.open=d.consume("(")||d.error("No argument list in constructor");let k=ce(d);v.close=d.consume(")")||d.error("Unterminated constructor"),v.termination=d.consume(";")||d.error("No semicolon after constructor");let C=new So({source:d.source,tokens:v});return W(C).arguments=k,C}get type(){return"constructor"}*validate(d){for(let x of this.arguments)yield*x.validate(d)}write(d){let{parent:x}=this;return d.ts.definition(d.ts.wrap([this.extAttrs.write(d),d.token(this.tokens.base,d.ts.nameless,{data:this,parent:x}),d.token(this.tokens.open),d.ts.wrap(this.arguments.map((v)=>v.write(d))),d.token(this.tokens.close),d.token(this.tokens.termination)]),{data:this,parent:x})}}function op(d){let x=d.consume("static");if(!x)return;return D.parse(d,{special:x})||q.parse(d,{special:x})||d.error("No body in static member")}class cs extends Jr{static parse(d,x,{extMembers:v=[],partial:k=null}={}){let C={partial:k,base:x};return Jr.parse(d,new cs({source:d.source,tokens:C}),{inheritable:!k,allowedMembers:[...v,[ls.parse],[So.parse],[op],[Ne],[vo.parse],[D.parse],[q.parse]]})}get type(){return"interface"}*validate(d){if(yield*this.extAttrs.validate(d),!this.partial&&this.extAttrs.every((v)=>v.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:Ee(this)});let x=this.extAttrs.filter((v)=>v.name==="Constructor");for(let v of x)yield s(v.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:Jc(this,v)});if(this.extAttrs.some((v)=>v.name==="Global")){let v=this.extAttrs.filter((C)=>C.name==="LegacyFactoryFunction");for(let C of v)yield s(C.tokens.name,this,"no-constructible-global","Interfaces marked as `[Global]` cannot have factory functions.");let k=this.members.filter((C)=>C.type==="constructor");for(let C of k)yield s(C.tokens.base,this,"no-constructible-global","Interfaces marked as `[Global]` cannot have constructors.")}yield*super.validate(d),this.partial||(yield*function*(v,k){let C=function($e){let Te=pe($e);return{statics:new Set(Te.filter((Fe)=>Fe.special==="static").map((Fe)=>Fe.name)),nonstatics:new Set(Te.filter((Fe)=>Fe.special!=="static").map((Fe)=>Fe.name))}}(k),G=v.partials.get(k.name)||[],ee=v.mixinMap.get(k.name)||[];for(let $e of[...G,...ee]){let Te=pe($e),Fe=Te.filter((br)=>br.special==="static"),cr=Te.filter((br)=>br.special!=="static");yield*ge(Fe,C.statics,$e,k),yield*ge(cr,C.nonstatics,$e,k),Fe.forEach((br)=>C.statics.add(br.name)),cr.forEach((br)=>C.nonstatics.add(br.name))}function*ge($e,Te,Fe,cr){for(let br of $e){let{name:ol}=br;if(ol&&Te.has(ol)){let ap=`The ${br.special==="static"?"static ":""}operation "${ol}" has already been defined for the base interface "${cr.name}" either in itself or in a mixin`;yield s(br.tokens.name,Fe,"no-cross-overload",ap)}}}function pe($e){return $e.members.filter(({type:Te})=>Te==="operation")}}(d,this))}}function Jc(d,x){return d=W(d),()=>{let v=X(d.extAttrs.tokens.open.trivia),k=d.members.length?X(oe(d.members[0]).trivia):function(Te){let Fe=X(Te),cr=Fe.includes("\t")?"\t":" ";return Fe+cr}(v),C=So.parse(new wt(`
618
+ ${k}constructor();`));C.extAttrs=new w({source:d.source,tokens:{}}),W(C).arguments=x.arguments;let G=function(Te,Fe){let cr=Te.slice().reverse().findIndex(Fe);return cr===-1?cr:Te.length-cr-1}(d.members,(Te)=>Te.type==="constructor");d.members.splice(G+1,0,C);let{close:ee}=d.tokens;ee.trivia.includes(`
618
619
  `)||(ee.trivia+=`
619
- ${v}`);let{extAttrs:ge}=d,pe=ge.indexOf(x),$e=ge.splice(pe,1);ge.length?ge.length===pe?ge[pe-1].tokens.separator=void 0:ge[pe].tokens.name.trivia.trim()||(ge[pe].tokens.name.trivia=$e[0].tokens.name.trivia):ge.tokens.open=ge.tokens.close=void 0}}class $o extends Ir{static parse(d,x,{extMembers:v=[],partial:k}={}){let C={partial:k,base:x};if(C.mixin=d.consume("mixin"),C.mixin)return Ir.parse(d,new $o({source:d.source,tokens:C}),{allowedMembers:[...v,[ns.parse],[Ce],[L.parse,{noInherit:!0}],[I.parse,{regular:!0}]]})}get type(){return"interface mixin"}}class is extends i{static parse(d){let x={},v=B(new is({source:d.source,tokens:x}));return v.extAttrs=w.parse(d),x.required=d.consume("required"),v.idlType=se(d,"dictionary-type")||d.error("Dictionary member lacks a type"),x.name=d.consumeKind("identifier")||d.error("Dictionary member lacks a name"),v.default=A.parse(d),x.required&&v.default&&d.error("Required member must not have a default"),x.termination=d.consume(";")||d.error("Unterminated dictionary member, expected `;`"),v.this}get type(){return"field"}get name(){return J(this.tokens.name.value)}get required(){return!!this.tokens.required}*validate(d){yield*this.idlType.validate(d)}write(d){let{parent:x}=this;return d.ts.definition(d.ts.wrap([this.extAttrs.write(d),d.token(this.tokens.required),d.ts.type(this.idlType.write(d)),d.name_token(this.tokens.name,{data:this,parent:x}),this.default?this.default.write(d):"",d.token(this.tokens.termination)]),{data:this,parent:x})}}class M extends Ir{static parse(d,{extMembers:x=[],partial:v}={}){let k={partial:v};if(k.base=d.consume("dictionary"),k.base)return Ir.parse(d,new M({source:d.source,tokens:k}),{inheritable:!v,allowedMembers:[...x,[is.parse]]})}get type(){return"dictionary"}}class H extends Ir{static parse(d,{extMembers:x=[],partial:v}={}){let k={partial:v};if(k.base=d.consume("namespace"),k.base)return Ir.parse(d,new H({source:d.source,tokens:k}),{allowedMembers:[...x,[L.parse,{noInherit:!0,readonly:!0}],[ns.parse],[I.parse,{regular:!0}]]})}get type(){return"namespace"}*validate(d){if(!this.partial&&this.extAttrs.every((x)=>x.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:Ee(this)});yield*super.validate(d)}}class U extends Ir{static parse(d,x,{extMembers:v=[]}={}){let k={callback:x};if(k.base=d.consume("interface"),k.base)return Ir.parse(d,new U({source:d.source,tokens:k}),{allowedMembers:[...v,[ns.parse],[I.parse,{regular:!0}]]})}get type(){return"callback interface"}}function le(d,x){let v=d.source;function k(pe){d.error(pe)}function C(...pe){return d.consume(...pe)}function G(pe){let $e=C("interface");if($e)return $o.parse(d,$e,{...pe,...x?.extensions?.mixin})||ss.parse(d,$e,{...pe,...x?.extensions?.interface})||k("Interface has no proper body")}function ee(){if(x.productions)for(let pe of x.productions){let $e=pe(d);if($e)return $e}return function(){let pe=C("callback");if(pe)return d.probe("interface")?U.parse(d,pe,{...x?.extensions?.callbackInterface}):yo.parse(d,pe)}()||G()||function(){let pe=C("partial");if(pe)return M.parse(d,{partial:pe,...x?.extensions?.dictionary})||G({partial:pe})||H.parse(d,{partial:pe,...x?.extensions?.namespace})||k("Partial doesn't apply to anything")}()||M.parse(d,x?.extensions?.dictionary)||Vt.parse(d)||rs.parse(d)||ts.parse(d)||H.parse(d,x?.extensions?.namespace)}let ge=function(){if(!v.length)return[];let pe=[];for(;;){let Te=w.parse(d),qe=ee();if(!qe){Te.length&&k("Stray extended attributes");break}B(qe).extAttrs=Te,pe.push(qe)}let $e=u.parse(d);return x.concrete&&pe.push($e),pe}();return d.position<v.length&&k("Unrecognised tokens"),ge}function Ne(d,x={}){let v=new wt(d);return x.sourceName!==void 0&&(v.source.name=x.sourceName),le(v,x)}function Pt(d){return d}let Xt={wrap:(d)=>d.join(""),trivia:Pt,name:Pt,reference:Pt,type:Pt,generic:Pt,nameless:Pt,inheritance:Pt,definition:Pt,extendedAttribute:Pt,extendedAttributeReference:Pt};class tt{constructor(d){this.ts=Object.assign({},Xt,d)}reference(d,{unescaped:x,context:v}){return x||(x=d.startsWith("_")?d.slice(1):d),this.ts.reference(d,x,v)}token(d,x=Pt,...v){if(!d)return"";let k=x(d.value,...v);return this.ts.wrap([this.ts.trivia(d.trivia),k])}reference_token(d,x){return this.token(d,this.reference.bind(this),{context:x})}name_token(d,x){return this.token(d,this.ts.name,x)}identifier(d,x){return this.ts.wrap([this.reference_token(d.tokens.value,x),this.token(d.tokens.separator)])}}function ve(d,{templates:x=Xt}={}){x=Object.assign({},Xt,x);let v=new tt(x);return x.wrap(d.map((k)=>k.write(v)))}function Zt(d,x){let v=new Map,k=d.filter((C)=>C.type==="includes");for(let C of k){let G=x.get(C.includes);if(!G)continue;let ee=v.get(C.target);ee?ee.push(G):v.set(C.target,[G])}return v}function*kt(d){let x=function(v){let k=new Map,C=new Set,G=new Map;for(let ee of v)if(ee.partial){let ge=G.get(ee.name);ge?ge.push(ee):G.set(ee.name,[ee])}else ee.name&&(k.has(ee.name)?C.add(ee):k.set(ee.name,ee));return{all:v,unique:k,partials:G,duplicates:C,mixinMap:Zt(v,k),cache:{typedefIncludesDictionary:new WeakMap,dictionaryIncludesRequiredField:new WeakMap}}}(d);for(let v of x.all)v.validate&&(yield*v.validate(x));yield*function*({unique:v,duplicates:k}){for(let C of k){let{name:G}=C,ee=`The name "${G}" of type "${v.get(G).type}" was already seen`;yield s(C.tokens.name,C,"no-duplicate",ee)}}(x)}function Ct(d){return[...kt((x=d,x.flat?x.flat():[].concat(...x)))];var x}return t})())});var PP=N(function(Roe,jP){var __dirname="/home/runner/work/jx/jx/node_modules/@webref/idl",wP=He("fs").promises,Mf=He("path"),vP=$P();class SP{constructor(e,t){this.filename=t,this.shortname=Mf.basename(t,".idl"),this.path=Mf.join(e,t)}async text(){return await wP.readFile(this.path,"utf8")}async parse(){let e=await this.text();return vP.parse(e)}}async function EP({folder:e=__dirname}={}){let t={},r=await wP.readdir(e);for(let n of r)if(n.endsWith(".idl")){let s=new SP(e,n);t[s.shortname]=s}return t}async function EB(e){let t=await EP(e);for(let[r,n]of Object.entries(t))t[r]=await n.parse();return t}jP.exports={listAll:EP,parseAll:EB}});var kP,_P;var AP=D(()=>{kP={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."},_P={anyOf:[{$ref:"#/$defs/TagName"},{additionalProperties:!1,properties:{$expression:{$ref:"#/$defs/TagExpression"}},required:["$expression"],type:"object"}]}});var RP;var OP=D(()=>{RP={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 CP,NP,TP;var IP=D(()=>{CP={oneOf:[{type:"string"},{$ref:"#/$defs/RefObject"}]},NP={oneOf:[{type:"boolean"},{$ref:"#/$defs/RefObject"}]},TP={oneOf:[{type:"number"},{$ref:"#/$defs/RefObject"}]}});var JP;var MP=D(()=>{JP={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 DP,LP;var FP=D(()=>{DP={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"},LP={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 qP;var VP=D(()=>{qP={enum:["string","number","integer","boolean","array","object","null"],type:"string"}});var WP,BP,HP,UP,zP,GP,KP,YP,XP;var ZP=D(()=>{WP={description:"Reference to a $defs type definition in the current component.",examples:["#/$defs/Count","#/$defs/TodoItem","#/$defs/Status"],pattern:String.raw`^#/\$defs/`,type:"string"},BP={description:"Reference to a state entry (runtime variable) in the current component.",examples:["#/state/count","#/state/addTask","#/state/items"],pattern:"^#/state/",type:"string"},HP={description:"Reference to an external Jx component file.",examples:["./card.json","https://cdn.example.com/button.json"],pattern:String.raw`^(\./|\.\./).*\.json$|^https?://`,type:"string"},UP={description:"Reference to a window or document global.",examples:["window#/currentUser","document#/appConfig"],pattern:"^(window|document)#/",type:"string"},zP={description:"Reference to a named state entry passed via $props from a parent component.",examples:["parent#/sharedState","parent#/theme"],pattern:"^parent#/",type:"string"},GP={description:"Reference to the current Array map iteration context.",examples:["$map/item","$map/index","$map/item/text","$map/item/done"],pattern:String.raw`^\$map/(item|index)(/.*)?$`,type:"string"},KP={oneOf:[{$ref:"#/$defs/InternalRef"},{$ref:"#/$defs/StateRef"},{$ref:"#/$defs/ExternalRef"},{$ref:"#/$defs/GlobalRef"},{$ref:"#/$defs/ParentRef"},{$ref:"#/$defs/MapRef"}],type:"string"},YP={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"},XP={properties:{$props:{$ref:"#/$defs/PropsObject"},$ref:{$ref:"#/$defs/ExternalRef"}},required:["$ref"],type:"object"}});var Df;var QP=D(()=>{Df={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 e1,t1;var r1=D(()=>{e1={additionalProperties:!1,description:"Dynamic mapped list. Re-renders when the items state entry changes.",properties:{$prototype:{const:"Array",type:"string"},filter:{$ref:"#/$defs/RefObject"},items:{oneOf:[{$ref:"#/$defs/RefObject"},{type:"array"}]},key:{additionalProperties:!1,description:"The identity of each rendered row: a $map/item pointer read per item. A row whose key survives a change keeps its DOM node and its effects across reorders, insertions and "+"removals; without a key, rows are keyed by index. $map/index is not a key — an index "+"names a position, not a row.",properties:{$ref:{pattern:String.raw`^\$map/item(/.+)?$`,type:"string"}},required:["$ref"],type:"object"},map:{$ref:"#/$defs/ElementDef"},sort:{$ref:"#/$defs/RefObject"}},required:["$prototype","items","map"],type:"object"},t1={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 n1,s1,i1,o1,a1,dg;var l1=D(()=>{n1={additionalProperties:{oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{$ref:"#/$defs/RefObject"}]},description:"HTML attributes and ARIA attributes set via element.setAttribute().",type:"object"},s1={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"},i1={oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"null"},{$ref:"#/$defs/RefObject"}]},o1={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"},a1={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"},dg={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 c1;var u1=D(()=>{c1={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 f1;var d1=D(()=>{f1={additionalProperties:!1,description:'A function declaration. $prototype must be "Function". body (inline) and $src (external) are mutually exclusive. First parameter is always state (the reactive scope).',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: an opaque JS source string (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 → JS string.",examples:["state.count++",'state.items.push({ id: Date.now(), text: "", done: false })','return state.score >= 90 ? "gold" : "silver"',[{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 p1,m1;var h1=D(()=>{p1={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"}]},m1={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 g1;var y1=D(()=>{g1={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 b1;var x1=D(()=>{b1={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 $1,w1,v1,S1,E1,j1,P1,k1,_1,A1,R1,O1,C1,N1,T1,I1,J1;var M1=D(()=>{um();$1={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"},w1={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."},v1={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."},S1={enum:["!","-"]},E1={enum:["+","-","*","/","%","===","!==","<","<=",">",">=","&&","||","??"]},j1={const:"?:"},P1={const:"switch"},k1={const:"call"},_1={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"]},A1={enum:["=","+=","-=","*=","/="]},R1={enum:["pop","shift"]},O1={enum:["push","unshift"]},C1={const:"splice"},N1={const:"reduce"},T1={enum:["map","filter"]},I1={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 "+`${F0()}) — 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"},J1={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 D1,L1,F1,q1;var V1=D(()=>{D1={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"}]},L1={additionalProperties:{$ref:"#/$defs/StateEntry"},description:"Map of runtime variables. Keys are camelCase (public) or #-prefixed (private). All entries are reactive by default.",type:"object"},F1={additionalProperties:{$ref:"#/$defs/TypeDefEntry"},description:"Map of reusable JSON Schema type definitions. Keys are PascalCase type names. No runtime artifacts are produced.",type:"object"},q1={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 jB,pg,mg,hg,gg,yg,bg,xg,$g,wg,W1;var B1=D(()=>{jB=["method","accessor","parse","serialize","rewrite","discover","load","projectData","resolvePaths","lower","emit","head","assets","mount","dialect","deploySchema","bindings","testConnection"],pg={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"},mg={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"},hg={description:"Class constructor definition.",properties:{$prototype:{const:"Function",type:"string"},body:{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"},gg={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:{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:jB,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"},yg={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"},bg={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"},xg={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"},$g={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"},wg={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"},W1={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 H1;var U1=D(()=>{H1={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 Lf;var z1=D(()=>{Lf={description:"Image optimization configuration for the project.",properties:{formats:{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:{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" runs Sharp 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 PB,vg;var G1=D(()=>{eo();PB=[301,302,303,307,308],vg={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:Su,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:Su,type:"string"},locales:{description:"Available locales, as BCP 47 language tags.",examples:[["en","fr","de"]],items:{pattern:Su,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:[...PB],type:"integer"}},required:["destination"],type:"object"},{additionalProperties:!1,description:"A rewrite (proxy): the destination's content is served AT the source URL, with no "+"redirect. Emitted as status 200 in `_redirects`, which is the host convention — "+"not an HTTP redirection status.",properties:{destination:{type:"string"},rewrite:{const:!0,type:"boolean"}},required:["destination","rewrite"],type:"object"}]},description:"Static redirect and rewrite rules. Keys are source paths in URLPattern pathname syntax.",examples:[{"/api/*":{destination:"https://api.example.com/*",rewrite:!0},"/legacy/*":{destination:"/archive/*",status:308},"/old-about":"/about"}],propertyNames:{pattern:"^/"},type:"object"},state:{description:"Site-wide reactive state available to all pages.",type:"object"},style:{additionalProperties:{oneOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/StyleObject"}]},description:"Global CSS styles applied to the <body> element. Uses the same camelCase CSSOM convention and recursive selector/at-rule nesting as component styles.",type:"object"},url:{description:"Production URL of the deployed site.",examples:["https://example.com","https://jxsuite.com"],type:"string"}},type:"object"}});function kB(){return K1??=_B(),K1}async function _B(){let[e,t,r]=await Promise.all([X1.listAll(),Z1.default.listAll(),Q1.default.parseAll()]),n=new Set;for(let{elements:c}of Object.values(e))for(let u of c)if(!u.obsolete)n.add(u.name);let s=[...n].toSorted(),i=new Set;for(let c of t.properties)for(let u of c.styleDeclaration??[])i.add(u);let o=[...i].toSorted(),a=new Set;for(let c of Object.values(r))for(let u of c){if(u.type!=="interface"&&u.type!=="interface mixin")continue;if(!u.members)continue;for(let p of u.members)if(p.type==="attribute"&&p.name?.startsWith("on")&&p.idlType?.idlType==="EventHandler")a.add(p.name)}let l=[...a].toSorted();return{cssProps:o,eventHandlers:l,tagExamples:s}}function AB(e){let t={};for(let r of e)t[r]={description:`Event handler for the "${r.slice(2)}" event.`,oneOf:[{$ref:"#/$defs/RefObject"},{$ref:"#/$defs/ExpressionEntry"},{$ref:"#/$defs/FunctionDef"}]};return t}function RB(e){let t={...Df.properties};for(let r of e)t[r]={oneOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/RefObject"}]};return t}async function OB(){let{tagExamples:e,cssProps:t,eventHandlers:r}=await kB();return{$defs:{DefsMap:F1,TypeDefEntry:q1,StateMap:L1,StateEntry:D1,TypedStateDef:c1,PureTypeDef:b1,FunctionDef:f1,ClassDef:W1,ClassParameterDef:pg,ClassFieldDef:mg,ClassConstructorDef:hg,ClassMethodDef:gg,FormatDef:yg,ProjectBlockDef:bg,ServerBlockDef:xg,ConnectorBlockDef:$g,StudioHints:wg,ExternalClassDef:g1,ExpressionPointer:$1,ExpressionLiteral:w1,ExpressionOperand:v1,UnaryOperator:S1,BinaryOperator:E1,ConditionalOperator:j1,SwitchOperator:P1,CallOperator:k1,PureMethod:_1,AssignmentOperator:A1,NoArgMethod:R1,OneArgMethod:O1,SpliceMethod:C1,ReduceMethod:N1,MapFilterMethod:T1,ExpressionNode:I1,ExpressionEntry:J1,Statement:p1,StatementList:m1,ElementDef:{...dg,properties:{...dg.properties,...AB(r)}},ChildrenValue:t1,ArrayNamespace:e1,SwitchDef:o1,SwitchNode:a1,StyleObject:{...Df,properties:RB(t)},AttributesObject:n1,PropsObject:s1,RefObject:YP,AnyRef:KP,InternalRef:WP,StateRef:BP,ExternalRef:HP,ExternalComponentRef:XP,GlobalRef:UP,ParentRef:zP,MapRef:GP,ElementPropertyValue:i1,StringOrRef:CP,BoolOrRef:NP,NumberOrRef:TP,CemParameter:DP,CemEvent:LP,TagName:{...RP,examples:[...e,"my-counter","todo-app","user-card"]},TagExpression:kP,ElementTagName:_P,JsonSchemaType:qP,HeadEntry:JP,ImageConfig:Lf,PathsValue:{$id:co,anyOf:[...rc,sg],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"}]},$shadow:{description:"Render this component into a shadow root instead of the light DOM (spec.md §16.6). "+"Off unless set: a shadow root isolates the component's styles from the page and replaces the <slot> emulation with real slot distribution, so it changes how the "+"component composes. Overrides `defaults.shadow` in both directions — `false` opts "+"one component out of a project that opted in.",oneOf:[{enum:["open","closed"],type:"string"},{const:!1,type:"boolean"}]},$sitemap:{description:"Set false to exclude this page from sitemap.xml (site-architecture.md §8.4.1). "+"Every other page with a URL is included.",type:"boolean"},$media:{additionalProperties:{type:"string"},description:'Named media breakpoints following CSS @custom-media convention. Keys use the CSS custom property -- prefix. Pure color-scheme queries (e.g. "--dark": "(prefers-color-scheme: dark)") are dual-emitted so a data-color-scheme attribute on the root element forces the scheme '+"regardless of the OS preference (spec §9.5).",examples:[{"--dark":"(prefers-color-scheme: dark)","--md":"(min-width: 768px)","--sm":"(min-width: 640px)"}],type:"object"},$paths:{$ref:co,description:"Dynamic route source for a page: expands one page per entry at build time. One of the core shapes (explicit `values`, a `$ref` data file, or a bare array of parameter objects) or a source shape contributed by an enabled extension, such as the parser's `contentType`."},$schema:{description:"URI identifying the Jx dialect version. Enables schema-aware IDE tooling.",examples:["https://jxsuite.com/schema/v1"],type:"string"},attributes:{$ref:"#/$defs/AttributesObject"},cases:{additionalProperties:{oneOf:[{$ref:"#/$defs/ElementDef"},{$ref:"#/$defs/ExternalComponentRef"}]},description:"Switch cases object. Maps case values to element definitions or external component refs. Used alongside $switch for dynamic component rendering.",type:"object"},children:{$ref:"#/$defs/ChildrenValue"},imports:{additionalProperties:{type:"string"},description:"Import map: $prototype names to .class.json file paths. Allows state entries to reference external classes by name without $src.",type:"object"},observedAttributes:{description:"HTML attributes the custom element watches for changes. Follows the Web Components observedAttributes convention.",items:{type:"string"},type:"array"},state:{$ref:"#/$defs/StateMap",description:"Runtime variables for this component. All entries are reactive by default. Entry shape is determined by value type: "+"scalar/array → reactive property, string with ${} → computed, "+"object with $prototype → function or data source, "+"object with type and default → typed reactive property."},style:{$ref:"#/$defs/StyleObject"},tagName:{$ref:"#/$defs/TagName"},title:{$ref:"#/$defs/StringOrRef",description:"Page title. Can be a static string or a template string with ${} expressions."}},title:"Jx Document",type:"object"}}function CB(){return{$defs:{ImageConfig:Lf,StyleObject:ek},$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:vg.properties,title:"Jx Project",type:"object"}}function NB(){return{$defs:{ImageConfig:Lf,JxFieldSchema:Xj,RelationshipRef:Zj,StyleObject:ek},$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:vg.properties,title:"Jx Project Core",type:"object"}}function TB(){return{$id:tc,$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 IB(){return{$id:co,$schema:"https://json-schema.org/draft/2020-12/schema",anyOf:[...rc,sg],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 JB(){return{$id:"https://jxsuite.com/schema/extension-manifest/v1",$schema:"https://json-schema.org/draft/2020-12/schema",title:"Jx Extension Manifest",...H1}}function Sg(){return{$defs:{ClassConstructorDef:hg,ClassFieldDef:mg,ClassMethodDef:gg,ClassParameterDef:pg,ConnectorBlockDef:$g,FormatDef:yg,ProjectBlockDef:bg,ServerBlockDef:xg,StudioHints:wg},$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 MB(e){let{mkdirSync:t,writeFileSync:r}=await import("node:fs"),{resolve:n,dirname:s}=await import("node:path"),i=s(n(e,"..")),o=await OB(),a=CB(),l=Sg(),c=NB(),u=JB(),p=TB(),h=IB(),m=JSON.stringify(o,null,2),b=JSON.stringify(a,null,2),g=JSON.stringify(l,null,2),y=JSON.stringify(c,null,2),w=JSON.stringify(u,null,2),j=JSON.stringify(p,null,2),S=JSON.stringify(h,null,2),[E]=process.argv.slice(2);if(E)r(E,m,"utf8"),console.error(`Jx component schema written to ${E}`);else{r(n(i,"schema.json"),m,"utf8"),r(n(i,"project-schema.json"),b,"utf8"),r(n(i,"class-schema.json"),g,"utf8"),t(n(i,"schemas"),{recursive:!0}),r(n(i,"schemas","project.core.schema.json"),y,"utf8"),r(n(i,"schemas","project.fields.schema.json"),j,"utf8"),r(n(i,"schemas","document.paths.schema.json"),S,"utf8"),r(n(i,"extension-manifest.schema.json"),w,"utf8");let P=Bun.spawnSync(["bunx","oxfmt",n(i,"schemas","project.core.schema.json"),n(i,"schemas","project.fields.schema.json"),n(i,"schemas","document.paths.schema.json")],{cwd:i});if(P.exitCode!==0){let A=P.stderr.toString()||P.stdout.toString()||`exit ${P.exitCode}${P.signalCode?`, signal ${P.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 X1,Z1,Q1,K1=null,ek,Y1,vae;var tk=D(()=>{AP();OP();IP();MP();FP();VP();ZP();QP();r1();l1();u1();d1();h1();y1();x1();M1();V1();B1();U1();Nf();z1();G1();X1=br(hP(),1),Z1=br(xP(),1),Q1=br(PP(),1);ek={...Df,additionalProperties:{anyOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/StyleObject"}]}};[,Y1]=process.argv,vae=Y1?.endsWith("schema.ts")?MB(Y1):void 0});var lc=N(function(sk){Object.defineProperty(sk,"__esModule",{value:!0});sk.regexpCode=sk.getEsmExportName=sk.getProperty=sk.safeStringify=sk.stringify=sk.strConcat=sk.addCodeArg=sk.str=sk._=sk.nil=sk._Code=sk.Name=sk.IDENTIFIER=sk._CodeOrName=void 0;class Ff{}sk._CodeOrName=Ff;sk.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class Sa extends Ff{constructor(e){super();if(!sk.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}}}sk.Name=Sa;class wn extends Ff{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,r)=>`${t}${r}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((t,r)=>{if(r instanceof Sa)t[r.str]=(t[r.str]||0)+1;return t},{})}}sk._Code=wn;sk.nil=new wn("");function rk(e,...t){let r=[e[0]],n=0;while(n<t.length)jg(r,t[n]),r.push(e[++n]);return new wn(r)}sk._=rk;var Eg=new wn("+");function nk(e,...t){let r=[ac(e[0])],n=0;while(n<t.length)r.push(Eg),jg(r,t[n]),r.push(Eg,ac(e[++n]));return DB(r),new wn(r)}sk.str=nk;function jg(e,t){if(t instanceof wn)e.push(...t._items);else if(t instanceof Sa)e.push(t);else e.push(qB(t))}sk.addCodeArg=jg;function DB(e){let t=1;while(t<e.length-1){if(e[t]===Eg){let r=LB(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function LB(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string"){if(t instanceof Sa||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 Sa))return`"${e}${t.slice(1)}`;return}function FB(e,t){return t.emptyStr()?e:e.emptyStr()?t:nk`${e}${t}`}sk.strConcat=FB;function qB(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:ac(Array.isArray(e)?e.join(","):e)}function VB(e){return new wn(ac(e))}sk.stringify=VB;function ac(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}sk.safeStringify=ac;function WB(e){return typeof e=="string"&&sk.IDENTIFIER.test(e)?new wn(`.${e}`):rk`[${e}]`}sk.getProperty=WB;function BB(e){if(typeof e=="string"&&sk.IDENTIFIER.test(e))return new wn(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}sk.getEsmExportName=BB;function HB(e){return new wn(e.toString())}sk.regexpCode=HB});var Ag=N(function(lk){Object.defineProperty(lk,"__esModule",{value:!0});lk.ValueScope=lk.ValueScopeName=lk.Scope=lk.varKinds=lk.UsedValueState=void 0;var Ke=lc();class ok extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var Vf;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(Vf||(lk.UsedValueState=Vf={}));lk.varKinds={const:new Ke.Name("const"),let:new Ke.Name("let"),var:new Ke.Name("var")};class kg{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,r;if(((r=(t=this._parent)===null||t===void 0?void 0:t._prefixes)===null||r===void 0?void 0:r.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}}}lk.Scope=kg;class _g extends Ke.Name{constructor(e,t){super(t);this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e,this.scopePath=Ke._`.${new Ke.Name(t)}[${r}]`}}lk.ValueScopeName=_g;var sH=Ke._`\n`;class ak extends kg{constructor(e){super(e);this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?sH:Ke.nil}}get(){return this._scope}name(e){return new _g(e,this._newName(e))}value(e,t){var r;if(t.ref===void 0)throw Error("CodeGen: ref must be passed in value");let n=this.toName(e),{prefix:s}=n,i=(r=t.key)!==null&&r!==void 0?r:t.ref,o=this._values[s];if(o){let c=o.get(i);if(c)return c}else o=this._values[s]=new Map;o.set(i,n);let a=this._scope[s]||(this._scope[s]=[]),l=a.length;return a[l]=t.ref,n.setValue(t,{property:s,itemIndex:l}),n}getValue(e,t){let r=this._values[e];if(!r)return;return r.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,(r)=>{if(r.scopePath===void 0)throw Error(`CodeGen: name "${r}" has no value`);return Ke._`${e}${r.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,(n)=>{if(n.value===void 0)throw Error(`CodeGen: name "${n}" has no value`);return n.value.code},t,r)}_reduceValues(e,t,r={},n){let s=Ke.nil;for(let i in e){let o=e[i];if(!o)continue;let a=r[i]=r[i]||new Map;o.forEach((l)=>{if(a.has(l))return;a.set(l,Vf.Started);let c=t(l);if(c){let u=this.opts.es5?lk.varKinds.var:lk.varKinds.const;s=Ke._`${s}${u} ${l} = ${c};${this.opts._n}`}else if(c=n===null||n===void 0?void 0:n(l))s=Ke._`${s}${c}${this.opts._n}`;else throw new ok(l);a.set(l,Vf.Completed)})}return s}}lk.ValueScope=ak});var we=N(function(_r){Object.defineProperty(_r,"__esModule",{value:!0});_r.or=_r.and=_r.not=_r.CodeGen=_r.operators=_r.varKinds=_r.ValueScopeName=_r.ValueScope=_r.Scope=_r.Name=_r.regexpCode=_r.stringify=_r.getProperty=_r.nil=_r.strConcat=_r.str=_r._=void 0;var Z=lc(),ht=Ag(),li=lc();Object.defineProperty(_r,"_",{enumerable:!0,get:function(){return li._}});Object.defineProperty(_r,"str",{enumerable:!0,get:function(){return li.str}});Object.defineProperty(_r,"strConcat",{enumerable:!0,get:function(){return li.strConcat}});Object.defineProperty(_r,"nil",{enumerable:!0,get:function(){return li.nil}});Object.defineProperty(_r,"getProperty",{enumerable:!0,get:function(){return li.getProperty}});Object.defineProperty(_r,"stringify",{enumerable:!0,get:function(){return li.stringify}});Object.defineProperty(_r,"regexpCode",{enumerable:!0,get:function(){return li.regexpCode}});Object.defineProperty(_r,"Name",{enumerable:!0,get:function(){return li.Name}});var Gf=Ag();Object.defineProperty(_r,"Scope",{enumerable:!0,get:function(){return Gf.Scope}});Object.defineProperty(_r,"ValueScope",{enumerable:!0,get:function(){return Gf.ValueScope}});Object.defineProperty(_r,"ValueScopeName",{enumerable:!0,get:function(){return Gf.ValueScopeName}});Object.defineProperty(_r,"varKinds",{enumerable:!0,get:function(){return Gf.varKinds}});_r.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 ci{optimizeNodes(){return this}optimizeNames(e,t){return this}}class uk extends ci{constructor(e,t,r){super();this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){let r=e?ht.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${r} ${this.name}${n};`+t}optimizeNames(e,t){if(!e[this.name.str])return;if(this.rhs)this.rhs=ja(this.rhs,e,t);return this}get names(){return this.rhs instanceof Z._CodeOrName?this.rhs.names:{}}}class Cg extends ci{constructor(e,t,r){super();this.lhs=e,this.rhs=t,this.sideEffects=r}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=ja(this.rhs,e,t),this}get names(){let e=this.lhs instanceof Z.Name?{}:{...this.lhs.names};return zf(e,this.rhs)}}class fk extends Cg{constructor(e,t,r,n){super(e,r,n);this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class dk extends ci{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class pk extends ci{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class mk extends ci{constructor(e){super();this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class hk extends ci{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=ja(this.code,e,t),this}get names(){return this.code instanceof Z._CodeOrName?this.code.names:{}}}class Kf extends ci{constructor(e=[]){super();this.nodes=e}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){let{nodes:e}=this,t=e.length;while(t--){let r=e[t].optimizeNodes();if(Array.isArray(r))e.splice(t,1,...r);else if(r)e[t]=r;else e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:r}=this,n=r.length;while(n--){let s=r[n];if(s.optimizeNames(e,t))continue;lH(e,s.names),r.splice(n,1)}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>uo(e,t.names),{})}}class ui extends Kf{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class gk extends Kf{}class cc extends ui{}cc.kind="else";class Ns extends ui{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 r=t.optimizeNodes();t=this.else=Array.isArray(r)?new cc(r):r}if(t){if(e===!1)return t instanceof Ns?t:t.nodes;if(this.nodes.length)return this;return new Ns(wk(e),t instanceof Ns?[t]:t.nodes)}if(e===!1||!this.nodes.length)return;return this}optimizeNames(e,t){var r;if(this.else=(r=this.else)===null||r===void 0?void 0:r.optimizeNames(e,t),!(super.optimizeNames(e,t)||this.else))return;return this.condition=ja(this.condition,e,t),this}get names(){let e=super.names;if(zf(e,this.condition),this.else)uo(e,this.else.names);return e}}Ns.kind="if";class Ea extends ui{}Ea.kind="for";class yk extends Ea{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=ja(this.iteration,e,t),this}get names(){return uo(super.names,this.iteration.names)}}class bk extends Ea{constructor(e,t,r,n){super();this.varKind=e,this.name=t,this.from=r,this.to=n}render(e){let t=e.es5?ht.varKinds.var:this.varKind,{name:r,from:n,to:s}=this;return`for(${t} ${r}=${n}; ${r}<${s}; ${r}++)`+super.render(e)}get names(){let e=zf(super.names,this.from);return zf(e,this.to)}}class Rg extends Ea{constructor(e,t,r,n){super();this.loop=e,this.varKind=t,this.name=r,this.iterable=n}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=ja(this.iterable,e,t),this}get names(){return uo(super.names,this.iterable.names)}}class Wf extends ui{constructor(e,t,r){super();this.name=e,this.args=t,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}Wf.kind="func";class Bf extends Kf{render(e){return"return "+super.render(e)}}Bf.kind="return";class xk extends ui{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 r,n;return super.optimizeNames(e,t),(r=this.catch)===null||r===void 0||r.optimizeNames(e,t),(n=this.finally)===null||n===void 0||n.optimizeNames(e,t),this}get names(){let e=super.names;if(this.catch)uo(e,this.catch.names);if(this.finally)uo(e,this.finally.names);return e}}class Hf extends ui{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}Hf.kind="catch";class Uf extends ui{render(e){return"finally"+super.render(e)}}Uf.kind="finally";class $k{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
620
- `:""},this._extScope=e,this._scope=new ht.Scope({parent:e}),this._nodes=[new gk]}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 r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}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,r,n){let s=this._scope.toName(t);if(r!==void 0&&n)this._constants[s.str]=r;return this._leafNode(new uk(e,s,r)),s}const(e,t,r){return this._def(ht.varKinds.const,e,t,r)}let(e,t,r){return this._def(ht.varKinds.let,e,t,r)}var(e,t,r){return this._def(ht.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new Cg(e,t,r))}add(e,t){return this._leafNode(new fk(e,_r.operators.ADD,t))}code(e){if(typeof e=="function")e();else if(e!==Z.nil)this._leafNode(new hk(e));return this}object(...e){let t=["{"];for(let[r,n]of e){if(t.length>1)t.push(",");if(t.push(r),r!==n||this.opts.es5)t.push(":"),Z.addCodeArg(t,n)}return t.push("}"),new Z._Code(t)}if(e,t,r){if(this._blockNode(new Ns(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new Ns(e))}else(){return this._elseNode(new cc)}endIf(){return this._endBlockNode(Ns,cc)}_for(e,t){if(this._blockNode(e),t)this.code(t).endFor();return this}for(e,t){return this._for(new yk(e),t)}forRange(e,t,r,n,s=this.opts.es5?ht.varKinds.var:ht.varKinds.let){let i=this._scope.toName(e);return this._for(new bk(s,i,t,r),()=>n(i))}forOf(e,t,r,n=ht.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let i=t instanceof Z.Name?t:this.var("_arr",t);return this.forRange("_i",0,Z._`${i}.length`,(o)=>{this.var(s,Z._`${i}[${o}]`),r(s)})}return this._for(new Rg("of",n,s,t),()=>r(s))}forIn(e,t,r,n=this.opts.es5?ht.varKinds.var:ht.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,Z._`Object.keys(${t})`,r);let s=this._scope.toName(e);return this._for(new Rg("in",n,s,t),()=>r(s))}endFor(){return this._endBlockNode(Ea)}label(e){return this._leafNode(new dk(e))}break(e){return this._leafNode(new pk(e))}return(e){let t=new Bf;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(Bf)}try(e,t,r){if(!t&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let n=new xk;if(this._blockNode(n),this.code(e),t){let s=this.name("e");this._currNode=n.catch=new Hf(s),t(s)}if(r)this._currNode=n.finally=new Uf,this.code(r);return this._endBlockNode(Hf,Uf)}throw(e){return this._leafNode(new mk(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 r=this._nodes.length-t;if(r<0||e!==void 0&&r!==e)throw Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=Z.nil,r,n){if(this._blockNode(new Wf(e,t,r)),n)this.code(n).endFunc();return this}endFunc(){return this._endBlockNode(Wf)}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 r=this._currNode;if(r instanceof e||t&&r 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 Ns))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}}_r.CodeGen=$k;function uo(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function zf(e,t){return t instanceof Z._CodeOrName?uo(e,t.names):e}function ja(e,t,r){if(e instanceof Z.Name)return n(e);if(!s(e))return e;return new Z._Code(e._items.reduce((i,o)=>{if(o instanceof Z.Name)o=n(o);if(o instanceof Z._Code)i.push(...o._items);else i.push(o);return i},[]));function n(i){let o=r[i.str];if(o===void 0||t[i.str]!==1)return i;return delete t[i.str],o}function s(i){return i instanceof Z._Code&&i._items.some((o)=>o instanceof Z.Name&&t[o.str]===1&&r[o.str]!==void 0)}}function lH(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function wk(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:Z._`!${Og(e)}`}_r.not=wk;var cH=vk(_r.operators.AND);function uH(...e){return e.reduce(cH)}_r.and=uH;var fH=vk(_r.operators.OR);function dH(...e){return e.reduce(fH)}_r.or=dH;function vk(e){return(t,r)=>t===Z.nil?r:r===Z.nil?t:Z._`${Og(t)} ${e} ${Og(r)}`}function Og(e){return e instanceof Z.Name?e:Z._`(${e})`}});var Oe=N(function(Ck){Object.defineProperty(Ck,"__esModule",{value:!0});Ck.checkStrictMode=Ck.getErrorPath=Ck.Type=Ck.useFunc=Ck.setEvaluated=Ck.evaluatedPropsToName=Ck.mergeEvaluated=Ck.eachItem=Ck.unescapeJsonPointer=Ck.escapeJsonPointer=Ck.escapeFragment=Ck.unescapeFragment=Ck.schemaRefOrVal=Ck.schemaHasRulesButRef=Ck.schemaHasRules=Ck.checkUnknownRules=Ck.alwaysValidSchema=Ck.toHash=void 0;var fe=we(),Pk=lc();function gH(e){let t={};for(let r of e)t[r]=!0;return t}Ck.toHash=gH;function yH(e,t){if(typeof t=="boolean")return t;if(Object.keys(t).length===0)return!0;return kk(e,t),!_k(t,e.self.RULES.all)}Ck.alwaysValidSchema=yH;function kk(e,t=e.schema){let{opts:r,self:n}=e;if(!r.strictSchema)return;if(typeof t==="boolean")return;let s=n.RULES.keywords;for(let i in t)if(!s[i])Ok(e,`unknown keyword: "${i}"`)}Ck.checkUnknownRules=kk;function _k(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}Ck.schemaHasRules=_k;function bH(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}Ck.schemaHasRulesButRef=bH;function xH({topSchemaRef:e,schemaPath:t},r,n,s){if(!s){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return fe._`${r}`}return fe._`${e}${t}${fe.getProperty(n)}`}Ck.schemaRefOrVal=xH;function $H(e){return Ak(decodeURIComponent(e))}Ck.unescapeFragment=$H;function wH(e){return encodeURIComponent(Tg(e))}Ck.escapeFragment=wH;function Tg(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}Ck.escapeJsonPointer=Tg;function Ak(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}Ck.unescapeJsonPointer=Ak;function vH(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}Ck.eachItem=vH;function Ek({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(s,i,o,a)=>{let l=o===void 0?i:o instanceof fe.Name?(i instanceof fe.Name?e(s,i,o):t(s,i,o),o):i instanceof fe.Name?(t(s,o,i),i):r(i,o);return a===fe.Name&&!(l instanceof fe.Name)?n(s,l):l}}Ck.mergeEvaluated={props:Ek({mergeNames:(e,t,r)=>e.if(fe._`${r} !== true && ${t} !== undefined`,()=>{e.if(fe._`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,fe._`${r} || {}`).code(fe._`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if(fe._`${r} !== true`,()=>{if(t===!0)e.assign(r,!0);else e.assign(r,fe._`${r} || {}`),Ig(e,r,t)}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:Rk}),items:Ek({mergeNames:(e,t,r)=>e.if(fe._`${r} !== true && ${t} !== undefined`,()=>e.assign(r,fe._`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if(fe._`${r} !== true`,()=>e.assign(r,t===!0?!0:fe._`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function Rk(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",fe._`{}`);if(t!==void 0)Ig(e,r,t);return r}Ck.evaluatedPropsToName=Rk;function Ig(e,t,r){Object.keys(r).forEach((n)=>e.assign(fe._`${t}${fe.getProperty(n)}`,!0))}Ck.setEvaluated=Ig;var jk={};function SH(e,t){return e.scopeValue("func",{ref:t,code:jk[t.code]||(jk[t.code]=new Pk._Code(t.code))})}Ck.useFunc=SH;var Ng;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Ng||(Ck.Type=Ng={}));function EH(e,t,r){if(e instanceof fe.Name){let n=t===Ng.Num;return r?n?fe._`"[" + ${e} + "]"`:fe._`"['" + ${e} + "']"`:n?fe._`"/" + ${e}`:fe._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?fe.getProperty(e).toString():"/"+Tg(e)}Ck.getErrorPath=EH;function Ok(e,t,r=e.opts.strictSchema){if(!r)return;if(t=`strict mode: ${t}`,r===!0)throw Error(t);e.self.logger.warn(t)}Ck.checkStrictMode=Ok});var nn=N(function(Tk){Object.defineProperty(Tk,"__esModule",{value:!0});var We=we(),VH={data:new We.Name("data"),valCxt:new We.Name("valCxt"),instancePath:new We.Name("instancePath"),parentData:new We.Name("parentData"),parentDataProperty:new We.Name("parentDataProperty"),rootData:new We.Name("rootData"),dynamicAnchors:new We.Name("dynamicAnchors"),vErrors:new We.Name("vErrors"),errors:new We.Name("errors"),this:new We.Name("this"),self:new We.Name("self"),scope:new We.Name("scope"),json:new We.Name("json"),jsonPos:new We.Name("jsonPos"),jsonLen:new We.Name("jsonLen"),jsonPart:new We.Name("jsonPart")};Tk.default=VH});var uc=N(function(Dk){Object.defineProperty(Dk,"__esModule",{value:!0});Dk.extendErrors=Dk.resetErrorsCount=Dk.reportExtraError=Dk.reportError=Dk.keyword$DataError=Dk.keywordError=void 0;var ne=we(),fi=Oe(),mr=nn();Dk.keywordError={message:({keyword:e})=>ne.str`must pass "${e}" keyword validation`};Dk.keyword$DataError={message:({keyword:e,schemaType:t})=>t?ne.str`"${e}" keyword must be ${t} ($data)`:ne.str`"${e}" keyword is invalid ($data)`};function BH(e,t=Dk.keywordError,r,n){let{it:s}=e,{gen:i,compositeRule:o,allErrors:a}=s,l=Mk(e,t,r);if(n!==null&&n!==void 0?n:o||a)Ik(i,l);else Jk(s,ne._`[${l}]`)}Dk.reportError=BH;function HH(e,t=Dk.keywordError,r){let{it:n}=e,{gen:s,compositeRule:i,allErrors:o}=n,a=Mk(e,t,r);if(Ik(s,a),!(i||o))Jk(n,mr.default.vErrors)}Dk.reportExtraError=HH;function UH(e,t){e.assign(mr.default.errors,t),e.if(ne._`${mr.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(ne._`${mr.default.vErrors}.length`,t),()=>e.assign(mr.default.vErrors,null)))}Dk.resetErrorsCount=UH;function zH({gen:e,keyword:t,schemaValue:r,data:n,errsCount:s,it:i}){if(s===void 0)throw Error("ajv implementation error");let o=e.name("err");e.forRange("i",s,mr.default.errors,(a)=>{if(e.const(o,ne._`${mr.default.vErrors}[${a}]`),e.if(ne._`${o}.instancePath === undefined`,()=>e.assign(ne._`${o}.instancePath`,ne.strConcat(mr.default.instancePath,i.errorPath))),e.assign(ne._`${o}.schemaPath`,ne.str`${i.errSchemaPath}/${t}`),i.opts.verbose)e.assign(ne._`${o}.schema`,r),e.assign(ne._`${o}.data`,n)})}Dk.extendErrors=zH;function Ik(e,t){let r=e.const("err",t);e.if(ne._`${mr.default.vErrors} === null`,()=>e.assign(mr.default.vErrors,ne._`[${r}]`),ne._`${mr.default.vErrors}.push(${r})`),e.code(ne._`${mr.default.errors}++`)}function Jk(e,t){let{gen:r,validateName:n,schemaEnv:s}=e;if(s.$async)r.throw(ne._`new ${e.ValidationError}(${t})`);else r.assign(ne._`${n}.errors`,t),r.return(!1)}var fo={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 Mk(e,t,r){let{createErrors:n}=e.it;if(n===!1)return ne._`{}`;return GH(e,t,r)}function GH(e,t,r={}){let{gen:n,it:s}=e,i=[KH(s,r),YH(e,r)];return XH(e,t,i),n.object(...i)}function KH({errorPath:e},{instancePath:t}){let r=t?ne.str`${e}${fi.getErrorPath(t,fi.Type.Str)}`:e;return[mr.default.instancePath,ne.strConcat(mr.default.instancePath,r)]}function YH({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let s=n?t:ne.str`${t}/${e}`;if(r)s=ne.str`${s}${fi.getErrorPath(r,fi.Type.Str)}`;return[fo.schemaPath,s]}function XH(e,{params:t,message:r},n){let{keyword:s,data:i,schemaValue:o,it:a}=e,{opts:l,propertyName:c,topSchemaRef:u,schemaPath:p}=a;if(n.push([fo.keyword,s],[fo.params,typeof t=="function"?t(e):t||ne._`{}`]),l.messages)n.push([fo.message,typeof r=="function"?r(e):r]);if(l.verbose)n.push([fo.schema,o],[fo.parentSchema,ne._`${u}${p}`],[mr.default.data,i]);if(c)n.push([fo.propertyName,c])}});var Hk=N(function(Wk){Object.defineProperty(Wk,"__esModule",{value:!0});Wk.boolOrEmptySchema=Wk.topBoolOrEmptySchema=void 0;var Fk=uc(),qk=we(),rU=nn(),nU={message:"boolean schema is false"};function sU(e){let{gen:t,schema:r,validateName:n}=e;if(r===!1)Vk(e,!1);else if(typeof r=="object"&&r.$async===!0)t.return(rU.default.data);else t.assign(qk._`${n}.errors`,null),t.return(!0)}Wk.topBoolOrEmptySchema=sU;function iU(e,t){let{gen:r,schema:n}=e;if(n===!1)r.var(t,!1),Vk(e);else r.var(t,!0)}Wk.boolOrEmptySchema=iU;function Vk(e,t){let{gen:r,data:n}=e;Fk.reportError({gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},nU,void 0,t)}});var Mg=N(function(Uk){Object.defineProperty(Uk,"__esModule",{value:!0});Uk.getRules=Uk.isJSONType=void 0;var aU=["string","number","integer","boolean","null","object","array"],lU=new Set(aU);function cU(e){return typeof e=="string"&&lU.has(e)}Uk.isJSONType=cU;function uU(){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:{}}}Uk.getRules=uU});var Dg=N(function(Yk){Object.defineProperty(Yk,"__esModule",{value:!0});Yk.shouldUseRule=Yk.shouldUseGroup=Yk.schemaHasRulesForType=void 0;function dU({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&Gk(e,n)}Yk.schemaHasRulesForType=dU;function Gk(e,t){return t.rules.some((r)=>Kk(e,r))}Yk.shouldUseGroup=Gk;function Kk(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some((n)=>e[n]!==void 0))}Yk.shouldUseRule=Kk});var fc=N(function(n_){Object.defineProperty(n_,"__esModule",{value:!0});n_.reportTypeError=n_.checkDataTypes=n_.checkDataType=n_.coerceAndCheckDataType=n_.getJSONTypes=n_.getSchemaTypes=n_.DataType=void 0;var Zk=Mg(),Qk=Dg(),e_=uc(),z=we(),Xf=Oe(),Pa;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(Pa||(n_.DataType=Pa={}));function hU(e){let t=t_(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}n_.getSchemaTypes=hU;function t_(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(Zk.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}n_.getJSONTypes=t_;function gU(e,t){let{gen:r,data:n,opts:s}=e,i=yU(t,s.coerceTypes),o=t.length>0&&!(i.length===0&&t.length===1&&Qk.schemaHasRulesForType(e,t[0]));if(o){let a=Fg(t,n,s.strictNumbers,Pa.Wrong);r.if(a,()=>{if(i.length)bU(e,t,i);else qg(e)})}return o}n_.coerceAndCheckDataType=gU;var r_=new Set(["string","number","integer","boolean","null"]);function yU(e,t){return t?e.filter((r)=>r_.has(r)||t==="array"&&r==="array"):[]}function bU(e,t,r){let{gen:n,data:s,opts:i}=e,o=n.let("dataType",z._`typeof ${s}`),a=n.let("coerced",z._`undefined`);if(i.coerceTypes==="array")n.if(z._`${o} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,()=>n.assign(s,z._`${s}[0]`).assign(o,z._`typeof ${s}`).if(Fg(t,s,i.strictNumbers),()=>n.assign(a,s)));n.if(z._`${a} !== undefined`);for(let c of r)if(r_.has(c)||c==="array"&&i.coerceTypes==="array")l(c);n.else(),qg(e),n.endIf(),n.if(z._`${a} !== undefined`,()=>{n.assign(s,a),xU(e,a)});function l(c){switch(c){case"string":n.elseIf(z._`${o} == "number" || ${o} == "boolean"`).assign(a,z._`"" + ${s}`).elseIf(z._`${s} === null`).assign(a,z._`""`);return;case"number":n.elseIf(z._`${o} == "boolean" || ${s} === null
620
+ ${v}`);let{extAttrs:ge}=d,pe=ge.indexOf(x),$e=ge.splice(pe,1);ge.length?ge.length===pe?ge[pe-1].tokens.separator=void 0:ge[pe].tokens.name.trivia.trim()||(ge[pe].tokens.name.trivia=$e[0].tokens.name.trivia):ge.tokens.open=ge.tokens.close=void 0}}class Eo extends Jr{static parse(d,x,{extMembers:v=[],partial:k}={}){let C={partial:k,base:x};if(C.mixin=d.consume("mixin"),C.mixin)return Jr.parse(d,new Eo({source:d.source,tokens:C}),{allowedMembers:[...v,[ls.parse],[Ne],[D.parse,{noInherit:!0}],[q.parse,{regular:!0}]]})}get type(){return"interface mixin"}}class us extends i{static parse(d){let x={},v=W(new us({source:d.source,tokens:x}));return v.extAttrs=w.parse(d),x.required=d.consume("required"),v.idlType=se(d,"dictionary-type")||d.error("Dictionary member lacks a type"),x.name=d.consumeKind("identifier")||d.error("Dictionary member lacks a name"),v.default=R.parse(d),x.required&&v.default&&d.error("Required member must not have a default"),x.termination=d.consume(";")||d.error("Unterminated dictionary member, expected `;`"),v.this}get type(){return"field"}get name(){return O(this.tokens.name.value)}get required(){return!!this.tokens.required}*validate(d){yield*this.idlType.validate(d)}write(d){let{parent:x}=this;return d.ts.definition(d.ts.wrap([this.extAttrs.write(d),d.token(this.tokens.required),d.ts.type(this.idlType.write(d)),d.name_token(this.tokens.name,{data:this,parent:x}),this.default?this.default.write(d):"",d.token(this.tokens.termination)]),{data:this,parent:x})}}class J extends Jr{static parse(d,{extMembers:x=[],partial:v}={}){let k={partial:v};if(k.base=d.consume("dictionary"),k.base)return Jr.parse(d,new J({source:d.source,tokens:k}),{inheritable:!v,allowedMembers:[...x,[us.parse]]})}get type(){return"dictionary"}}class U extends Jr{static parse(d,{extMembers:x=[],partial:v}={}){let k={partial:v};if(k.base=d.consume("namespace"),k.base)return Jr.parse(d,new U({source:d.source,tokens:k}),{allowedMembers:[...x,[D.parse,{noInherit:!0,readonly:!0}],[ls.parse],[q.parse,{regular:!0}]]})}get type(){return"namespace"}*validate(d){if(!this.partial&&this.extAttrs.every((x)=>x.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:Ee(this)});yield*super.validate(d)}}class H extends Jr{static parse(d,x,{extMembers:v=[]}={}){let k={callback:x};if(k.base=d.consume("interface"),k.base)return Jr.parse(d,new H({source:d.source,tokens:k}),{allowedMembers:[...v,[ls.parse],[q.parse,{regular:!0}]]})}get type(){return"callback interface"}}function le(d,x){let v=d.source;function k(pe){d.error(pe)}function C(...pe){return d.consume(...pe)}function G(pe){let $e=C("interface");if($e)return Eo.parse(d,$e,{...pe,...x?.extensions?.mixin})||cs.parse(d,$e,{...pe,...x?.extensions?.interface})||k("Interface has no proper body")}function ee(){if(x.productions)for(let pe of x.productions){let $e=pe(d);if($e)return $e}return function(){let pe=C("callback");if(pe)return d.probe("interface")?H.parse(d,pe,{...x?.extensions?.callbackInterface}):wo.parse(d,pe)}()||G()||function(){let pe=C("partial");if(pe)return J.parse(d,{partial:pe,...x?.extensions?.dictionary})||G({partial:pe})||U.parse(d,{partial:pe,...x?.extensions?.namespace})||k("Partial doesn't apply to anything")}()||J.parse(d,x?.extensions?.dictionary)||qt.parse(d)||as.parse(d)||os.parse(d)||U.parse(d,x?.extensions?.namespace)}let ge=function(){if(!v.length)return[];let pe=[];for(;;){let Te=w.parse(d),Fe=ee();if(!Fe){Te.length&&k("Stray extended attributes");break}W(Fe).extAttrs=Te,pe.push(Fe)}let $e=u.parse(d);return x.concrete&&pe.push($e),pe}();return d.position<v.length&&k("Unrecognised tokens"),ge}function Ce(d,x={}){let v=new wt(d);return x.sourceName!==void 0&&(v.source.name=x.sourceName),le(v,x)}function jt(d){return d}let Yt={wrap:(d)=>d.join(""),trivia:jt,name:jt,reference:jt,type:jt,generic:jt,nameless:jt,inheritance:jt,definition:jt,extendedAttribute:jt,extendedAttributeReference:jt};class tt{constructor(d){this.ts=Object.assign({},Yt,d)}reference(d,{unescaped:x,context:v}){return x||(x=d.startsWith("_")?d.slice(1):d),this.ts.reference(d,x,v)}token(d,x=jt,...v){if(!d)return"";let k=x(d.value,...v);return this.ts.wrap([this.ts.trivia(d.trivia),k])}reference_token(d,x){return this.token(d,this.reference.bind(this),{context:x})}name_token(d,x){return this.token(d,this.ts.name,x)}identifier(d,x){return this.ts.wrap([this.reference_token(d.tokens.value,x),this.token(d.tokens.separator)])}}function ve(d,{templates:x=Yt}={}){x=Object.assign({},Yt,x);let v=new tt(x);return x.wrap(d.map((k)=>k.write(v)))}function Zt(d,x){let v=new Map,k=d.filter((C)=>C.type==="includes");for(let C of k){let G=x.get(C.includes);if(!G)continue;let ee=v.get(C.target);ee?ee.push(G):v.set(C.target,[G])}return v}function*kt(d){let x=function(v){let k=new Map,C=new Set,G=new Map;for(let ee of v)if(ee.partial){let ge=G.get(ee.name);ge?ge.push(ee):G.set(ee.name,[ee])}else ee.name&&(k.has(ee.name)?C.add(ee):k.set(ee.name,ee));return{all:v,unique:k,partials:G,duplicates:C,mixinMap:Zt(v,k),cache:{typedefIncludesDictionary:new WeakMap,dictionaryIncludesRequiredField:new WeakMap}}}(d);for(let v of x.all)v.validate&&(yield*v.validate(x));yield*function*({unique:v,duplicates:k}){for(let C of k){let{name:G}=C,ee=`The name "${G}" of type "${v.get(G).type}" was already seen`;yield s(C.tokens.name,C,"no-duplicate",ee)}}(x)}function Nt(d){return[...kt((x=d,x.flat?x.flat():[].concat(...x)))];var x}return t})())});var cj=T(function(lle,lj){var __dirname="/home/runner/work/jx/jx/node_modules/@webref/idl",sj=Ue("fs").promises,ed=Ue("path"),ij=nj();class oj{constructor(e,t){this.filename=t,this.shortname=ed.basename(t,".idl"),this.path=ed.join(e,t)}async text(){return await sj.readFile(this.path,"utf8")}async parse(){let e=await this.text();return ij.parse(e)}}async function aj({folder:e=__dirname}={}){let t={},r=await sj.readdir(e);for(let n of r)if(n.endsWith(".idl")){let s=new oj(e,n);t[s.shortname]=s}return t}async function DU(e){let t=await aj(e);for(let[r,n]of Object.entries(t))t[r]=await n.parse();return t}lj.exports={listAll:aj,parseAll:DU}});var uj,fj;var dj=M(()=>{uj={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."},fj={anyOf:[{$ref:"#/$defs/TagName"},{additionalProperties:!1,properties:{$expression:{$ref:"#/$defs/TagExpression"}},required:["$expression"],type:"object"}]}});var pj;var mj=M(()=>{pj={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 hj,gj,yj;var bj=M(()=>{hj={oneOf:[{type:"string"},{$ref:"#/$defs/RefObject"}]},gj={oneOf:[{type:"boolean"},{$ref:"#/$defs/RefObject"}]},yj={oneOf:[{type:"number"},{$ref:"#/$defs/RefObject"}]}});var xj;var $j=M(()=>{xj={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 wj,vj;var Sj=M(()=>{wj={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"},vj={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 Ej;var Pj=M(()=>{Ej={enum:["string","number","integer","boolean","array","object","null"],type:"string"}});var jj,kj,_j,Aj,Rj,Oj,Nj,Cj,Tj;var Ij=M(()=>{jj={description:"Reference to a $defs type definition in the current component.",examples:["#/$defs/Count","#/$defs/TodoItem","#/$defs/Status"],pattern:String.raw`^#/\$defs/`,type:"string"},kj={description:"Reference to a state entry (runtime variable) in the current component.",examples:["#/state/count","#/state/addTask","#/state/items"],pattern:"^#/state/",type:"string"},_j={description:"Reference to an external Jx component file.",examples:["./card.json","https://cdn.example.com/button.json"],pattern:String.raw`^(\./|\.\./).*\.json$|^https?://`,type:"string"},Aj={description:"Reference to a window or document global.",examples:["window#/currentUser","document#/appConfig"],pattern:"^(window|document)#/",type:"string"},Rj={description:"Reference to a named state entry passed via $props from a parent component.",examples:["parent#/sharedState","parent#/theme"],pattern:"^parent#/",type:"string"},Oj={description:"Reference to the current Array map iteration context.",examples:["$map/item","$map/index","$map/item/text","$map/item/done"],pattern:String.raw`^\$map/(item|index)(/.*)?$`,type:"string"},Nj={oneOf:[{$ref:"#/$defs/InternalRef"},{$ref:"#/$defs/StateRef"},{$ref:"#/$defs/ExternalRef"},{$ref:"#/$defs/GlobalRef"},{$ref:"#/$defs/ParentRef"},{$ref:"#/$defs/MapRef"}],type:"string"},Cj={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"},Tj={properties:{$props:{$ref:"#/$defs/PropsObject"},$ref:{$ref:"#/$defs/ExternalRef"}},required:["$ref"],type:"object"}});var td;var Jj=M(()=>{td={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 Mj,Dj;var Lj=M(()=>{Mj={additionalProperties:!1,description:"Dynamic mapped list. Re-renders when the items state entry changes.",properties:{$prototype:{const:"Array",type:"string"},filter:{$ref:"#/$defs/RefObject"},items:{oneOf:[{$ref:"#/$defs/RefObject"},{type:"array"}]},key:{additionalProperties:!1,description:"The identity of each rendered row: a $map/item pointer read per item. A row whose key survives a change keeps its DOM node and its effects across reorders, insertions and "+"removals; without a key, rows are keyed by index. $map/index is not a key — an index "+"names a position, not a row.",properties:{$ref:{pattern:String.raw`^\$map/item(/.+)?$`,type:"string"}},required:["$ref"],type:"object"},map:{$ref:"#/$defs/ElementDef"},sort:{$ref:"#/$defs/RefObject"}},required:["$prototype","items","map"],type:"object"},Dj={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 Fj,qj,Vj,Bj,Wj,Tg;var Uj=M(()=>{Fj={additionalProperties:{oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{$ref:"#/$defs/RefObject"}]},description:"HTML attributes and ARIA attributes set via element.setAttribute().",type:"object"},qj={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"},Vj={oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"null"},{$ref:"#/$defs/RefObject"}]},Bj={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"},Wj={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"},Tg={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 Hj;var zj=M(()=>{Hj={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 Gj;var Kj=M(()=>{Gj={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 Xj,Yj;var Zj=M(()=>{Xj={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"}]},Yj={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 Qj;var ek=M(()=>{Qj={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 tk;var rk=M(()=>{tk={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 nk,sk,ik,ok,ak,lk,ck,uk,fk,dk,pk,mk,hk,gk,yk,bk,xk;var $k=M(()=>{Am();nk={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"},sk={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."},ik={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."},ok={enum:["!","-"]},ak={enum:["+","-","*","/","%","===","!==","<","<=",">",">=","&&","||","??"]},lk={const:"?:"},ck={const:"switch"},uk={const:"call"},fk={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"]},dk={enum:["=","+=","-=","*=","/="]},pk={enum:["pop","shift"]},mk={enum:["push","unshift"]},hk={const:"splice"},gk={const:"reduce"},yk={enum:["map","filter"]},bk={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 "+`${c$()}) — 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"},xk={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 wk,vk,Sk,Ek;var Pk=M(()=>{wk={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"}]},vk={additionalProperties:{$ref:"#/$defs/StateEntry"},description:"Map of runtime variables. Keys are camelCase (public) or #-prefixed (private). All entries are reactive by default.",type:"object"},Sk={additionalProperties:{$ref:"#/$defs/TypeDefEntry"},description:"Map of reusable JSON Schema type definitions. Keys are PascalCase type names. No runtime artifacts are produced.",type:"object"},Ek={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 LU,Ig,Jg,Mg,Dg,Lg,Fg,qg,Vg,Bg,jk;var kk=M(()=>{LU=["method","accessor","parse","serialize","rewrite","discover","load","projectData","resolvePaths","lower","emit","head","assets","mount","dialect","deploySchema","bindings","testConnection"],Ig={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"},Jg={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"},Mg={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"},Dg={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:LU,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"},Lg={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"},Fg={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"},qg={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"},Vg={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"},Bg={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"},jk={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 _k;var Ak=M(()=>{_k={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 rd;var Rk=M(()=>{rd={description:"Image optimization configuration for the project.",properties:{formats:{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:{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" runs Sharp 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 FU,Wg;var Ok=M(()=>{ro();FU=[301,302,303,307,308],Wg={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:Mu,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:Mu,type:"string"},locales:{description:"Available locales, as BCP 47 language tags.",examples:[["en","fr","de"]],items:{pattern:Mu,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:[...FU],type:"integer"}},required:["destination"],type:"object"},{additionalProperties:!1,description:"A rewrite (proxy): the destination's content is served AT the source URL, with no "+"redirect. Emitted as status 200 in `_redirects`, which is the host convention — "+"not an HTTP redirection status.",properties:{destination:{type:"string"},rewrite:{const:!0,type:"boolean"}},required:["destination","rewrite"],type:"object"}]},description:"Static redirect and rewrite rules. Keys are source paths in URLPattern pathname syntax.",examples:[{"/api/*":{destination:"https://api.example.com/*",rewrite:!0},"/legacy/*":{destination:"/archive/*",status:308},"/old-about":"/about"}],propertyNames:{pattern:"^/"},type:"object"},state:{description:"Site-wide reactive state available to all pages.",type:"object"},style:{additionalProperties:{oneOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/StyleObject"}]},description:"Global CSS styles applied to the <body> element. Uses the same camelCase CSSOM convention and recursive selector/at-rule nesting as component styles.",type:"object"},url:{description:"Production URL of the deployed site.",examples:["https://example.com","https://jxsuite.com"],type:"string"}},type:"object"}});function qU(){return Nk??=VU(),Nk}async function VU(){let[e,t,r]=await Promise.all([Tk.listAll(),Ik.default.listAll(),Jk.default.parseAll()]),n=new Set;for(let{elements:c}of Object.values(e))for(let u of c)if(!u.obsolete)n.add(u.name);let s=[...n].toSorted(),i=new Set;for(let c of t.properties)for(let u of c.styleDeclaration??[])i.add(u);let o=[...i].toSorted(),a=new Set;for(let c of Object.values(r))for(let u of c){if(u.type!=="interface"&&u.type!=="interface mixin")continue;if(!u.members)continue;for(let p of u.members)if(p.type==="attribute"&&p.name?.startsWith("on")&&p.idlType?.idlType==="EventHandler")a.add(p.name)}let l=[...a].toSorted();return{cssProps:o,eventHandlers:l,tagExamples:s}}function BU(e){let t={};for(let r of e)t[r]={description:`Event handler for the "${r.slice(2)}" event.`,oneOf:[{$ref:"#/$defs/RefObject"},{$ref:"#/$defs/ExpressionEntry"},{$ref:"#/$defs/FunctionDef"}]};return t}function WU(e){let t={...td.properties};for(let r of e)t[r]={oneOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/RefObject"}]};return t}async function UU(){let{tagExamples:e,cssProps:t,eventHandlers:r}=await qU();return{$defs:{DefsMap:Sk,TypeDefEntry:Ek,StateMap:vk,StateEntry:wk,TypedStateDef:Hj,PureTypeDef:tk,FunctionDef:Gj,ClassDef:jk,ClassParameterDef:Ig,ClassFieldDef:Jg,ClassConstructorDef:Mg,ClassMethodDef:Dg,FormatDef:Lg,ProjectBlockDef:Fg,ServerBlockDef:qg,ConnectorBlockDef:Vg,StudioHints:Bg,ExternalClassDef:Qj,ExpressionPointer:nk,ExpressionLiteral:sk,ExpressionOperand:ik,UnaryOperator:ok,BinaryOperator:ak,ConditionalOperator:lk,SwitchOperator:ck,CallOperator:uk,PureMethod:fk,AssignmentOperator:dk,NoArgMethod:pk,OneArgMethod:mk,SpliceMethod:hk,ReduceMethod:gk,MapFilterMethod:yk,ExpressionNode:bk,ExpressionEntry:xk,Statement:Xj,StatementList:Yj,ElementDef:{...Tg,properties:{...Tg.properties,...BU(r)}},ChildrenValue:Dj,ArrayNamespace:Mj,SwitchDef:Bj,SwitchNode:Wj,StyleObject:{...td,properties:WU(t)},AttributesObject:Fj,PropsObject:qj,RefObject:Cj,AnyRef:Nj,InternalRef:jj,StateRef:kj,ExternalRef:_j,ExternalComponentRef:Tj,GlobalRef:Aj,ParentRef:Rj,MapRef:Oj,ElementPropertyValue:Vj,StringOrRef:hj,BoolOrRef:gj,NumberOrRef:yj,CemParameter:wj,CemEvent:vj,TagName:{...pj,examples:[...e,"my-counter","todo-app","user-card"]},TagExpression:uj,ElementTagName:fj,JsonSchemaType:Ej,HeadEntry:xj,ImageConfig:rd,PathsValue:{$id:mo,anyOf:[...hc,jg],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"}]},$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:mo,description:"Dynamic route source for a page: expands one page per entry at build time. One of the core shapes (explicit `values`, a `$ref` data file, or a bare array of parameter objects) or a source shape contributed by an enabled extension, such as the parser's `contentType`."},$schema:{description:"URI identifying the Jx dialect version. Enables schema-aware IDE tooling.",examples:["https://jxsuite.com/schema/v1"],type:"string"},attributes:{$ref:"#/$defs/AttributesObject"},cases:{additionalProperties:{oneOf:[{$ref:"#/$defs/ElementDef"},{$ref:"#/$defs/ExternalComponentRef"}]},description:"Switch cases object. Maps case values to element definitions or external component refs. Used alongside $switch for dynamic component rendering.",type:"object"},children:{$ref:"#/$defs/ChildrenValue"},imports:{additionalProperties:{type:"string"},description:"Import map: $prototype names to .class.json file paths. Allows state entries to reference external classes by name without $src.",type:"object"},observedAttributes:{description:"HTML attributes the custom element watches for changes. Follows the Web Components observedAttributes convention.",items:{type:"string"},type:"array"},state:{$ref:"#/$defs/StateMap",description:"Runtime variables for this component. All entries are reactive by default. Entry shape is determined by value type: "+"scalar/array → reactive property, string with ${} → computed, "+"object with $prototype → function or data source, "+"object with type and default → typed reactive property."},style:{$ref:"#/$defs/StyleObject"},tagName:{$ref:"#/$defs/TagName"},title:{$ref:"#/$defs/StringOrRef",description:"Page title. Can be a static string or a template string with ${} expressions."}},title:"Jx Document",type:"object"}}function HU(){return{$defs:{ImageConfig:rd,StyleObject:Mk},$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:Wg.properties,title:"Jx Project",type:"object"}}function zU(){return{$defs:{ImageConfig:rd,JxFieldSchema:TP,RelationshipRef:IP,StyleObject:Mk},$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:Wg.properties,title:"Jx Project Core",type:"object"}}function GU(){return{$id:mc,$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 KU(){return{$id:mo,$schema:"https://json-schema.org/draft/2020-12/schema",anyOf:[...hc,jg],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 XU(){return{$id:"https://jxsuite.com/schema/extension-manifest/v1",$schema:"https://json-schema.org/draft/2020-12/schema",title:"Jx Extension Manifest",..._k}}function Ug(){return{$defs:{ClassConstructorDef:Mg,ClassFieldDef:Jg,ClassMethodDef:Dg,ClassParameterDef:Ig,ConnectorBlockDef:Vg,FormatDef:Lg,ProjectBlockDef:Fg,ServerBlockDef:qg,StudioHints:Bg},$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 YU(e){let{mkdirSync:t,writeFileSync:r}=await import("node:fs"),{resolve:n,dirname:s}=await import("node:path"),i=s(n(e,"..")),o=await UU(),a=HU(),l=Ug(),c=zU(),u=XU(),p=GU(),h=KU(),m=JSON.stringify(o,null,2),y=JSON.stringify(a,null,2),g=JSON.stringify(l,null,2),b=JSON.stringify(c,null,2),w=JSON.stringify(u,null,2),j=JSON.stringify(p,null,2),S=JSON.stringify(h,null,2),[E]=process.argv.slice(2);if(E)r(E,m,"utf8"),console.error(`Jx component schema written to ${E}`);else{r(n(i,"schema.json"),m,"utf8"),r(n(i,"project-schema.json"),y,"utf8"),r(n(i,"class-schema.json"),g,"utf8"),t(n(i,"schemas"),{recursive:!0}),r(n(i,"schemas","project.core.schema.json"),b,"utf8"),r(n(i,"schemas","project.fields.schema.json"),j,"utf8"),r(n(i,"schemas","document.paths.schema.json"),S,"utf8"),r(n(i,"extension-manifest.schema.json"),w,"utf8");let P=Bun.spawnSync(["bunx","oxfmt",n(i,"schemas","project.core.schema.json"),n(i,"schemas","project.fields.schema.json"),n(i,"schemas","document.paths.schema.json")],{cwd:i});if(P.exitCode!==0){let R=P.stderr.toString()||P.stdout.toString()||`exit ${P.exitCode}${P.signalCode?`, signal ${P.signalCode}`:""}`;console.error(`Warning: skipped oxfmt reformat of generated schemas (${R})`)}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 Tk,Ik,Jk,Nk=null,Mk,Ck,ece;var Dk=M(()=>{dj();mj();bj();$j();Sj();Pj();Ij();Jj();Lj();Uj();zj();Kj();Zj();ek();rk();$k();Pk();kk();Ak();Xf();Rk();Ok();Tk=xr(ZP(),1),Ik=xr(rj(),1),Jk=xr(cj(),1);Mk={...td,additionalProperties:{anyOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/StyleObject"}]}};[,Ck]=process.argv,ece=Ck?.endsWith("schema.ts")?YU(Ck):void 0});var wc=T(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 nd{}qk._CodeOrName=nd;qk.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class Oa extends nd{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=Oa;class En extends nd{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,r)=>`${t}${r}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((t,r)=>{if(r instanceof Oa)t[r.str]=(t[r.str]||0)+1;return t},{})}}qk._Code=En;qk.nil=new En("");function Lk(e,...t){let r=[e[0]],n=0;while(n<t.length)zg(r,t[n]),r.push(e[++n]);return new En(r)}qk._=Lk;var Hg=new En("+");function Fk(e,...t){let r=[$c(e[0])],n=0;while(n<t.length)r.push(Hg),zg(r,t[n]),r.push(Hg,$c(e[++n]));return ZU(r),new En(r)}qk.str=Fk;function zg(e,t){if(t instanceof En)e.push(...t._items);else if(t instanceof Oa)e.push(t);else e.push(tH(t))}qk.addCodeArg=zg;function ZU(e){let t=1;while(t<e.length-1){if(e[t]===Hg){let r=QU(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function QU(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string"){if(t instanceof Oa||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 Oa))return`"${e}${t.slice(1)}`;return}function eH(e,t){return t.emptyStr()?e:e.emptyStr()?t:Fk`${e}${t}`}qk.strConcat=eH;function tH(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:$c(Array.isArray(e)?e.join(","):e)}function rH(e){return new En($c(e))}qk.stringify=rH;function $c(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}qk.safeStringify=$c;function nH(e){return typeof e=="string"&&qk.IDENTIFIER.test(e)?new En(`.${e}`):Lk`[${e}]`}qk.getProperty=nH;function sH(e){if(typeof e=="string"&&qk.IDENTIFIER.test(e))return new En(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}qk.getEsmExportName=sH;function iH(e){return new En(e.toString())}qk.regexpCode=iH});var Yg=T(function(Uk){Object.defineProperty(Uk,"__esModule",{value:!0});Uk.ValueScope=Uk.ValueScopeName=Uk.Scope=Uk.varKinds=Uk.UsedValueState=void 0;var Ke=wc();class Bk extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var id;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(id||(Uk.UsedValueState=id={}));Uk.varKinds={const:new Ke.Name("const"),let:new Ke.Name("let"),var:new Ke.Name("var")};class Kg{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,r;if(((r=(t=this._parent)===null||t===void 0?void 0:t._prefixes)===null||r===void 0?void 0:r.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=Kg;class Xg extends Ke.Name{constructor(e,t){super(t);this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e,this.scopePath=Ke._`.${new Ke.Name(t)}[${r}]`}}Uk.ValueScopeName=Xg;var bH=Ke._`\n`;class Wk extends Kg{constructor(e){super(e);this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?bH:Ke.nil}}get(){return this._scope}name(e){return new Xg(e,this._newName(e))}value(e,t){var r;if(t.ref===void 0)throw Error("CodeGen: ref must be passed in value");let n=this.toName(e),{prefix:s}=n,i=(r=t.key)!==null&&r!==void 0?r:t.ref,o=this._values[s];if(o){let c=o.get(i);if(c)return c}else o=this._values[s]=new Map;o.set(i,n);let a=this._scope[s]||(this._scope[s]=[]),l=a.length;return a[l]=t.ref,n.setValue(t,{property:s,itemIndex:l}),n}getValue(e,t){let r=this._values[e];if(!r)return;return r.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,(r)=>{if(r.scopePath===void 0)throw Error(`CodeGen: name "${r}" has no value`);return Ke._`${e}${r.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,(n)=>{if(n.value===void 0)throw Error(`CodeGen: name "${n}" has no value`);return n.value.code},t,r)}_reduceValues(e,t,r={},n){let s=Ke.nil;for(let i in e){let o=e[i];if(!o)continue;let a=r[i]=r[i]||new Map;o.forEach((l)=>{if(a.has(l))return;a.set(l,id.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=n===null||n===void 0?void 0:n(l))s=Ke._`${s}${c}${this.opts._n}`;else throw new Bk(l);a.set(l,id.Completed)})}return s}}Uk.ValueScope=Wk});var we=T(function(Ar){Object.defineProperty(Ar,"__esModule",{value:!0});Ar.or=Ar.and=Ar.not=Ar.CodeGen=Ar.operators=Ar.varKinds=Ar.ValueScopeName=Ar.ValueScope=Ar.Scope=Ar.Name=Ar.regexpCode=Ar.stringify=Ar.getProperty=Ar.nil=Ar.strConcat=Ar.str=Ar._=void 0;var Z=wc(),ht=Yg(),fi=wc();Object.defineProperty(Ar,"_",{enumerable:!0,get:function(){return fi._}});Object.defineProperty(Ar,"str",{enumerable:!0,get:function(){return fi.str}});Object.defineProperty(Ar,"strConcat",{enumerable:!0,get:function(){return fi.strConcat}});Object.defineProperty(Ar,"nil",{enumerable:!0,get:function(){return fi.nil}});Object.defineProperty(Ar,"getProperty",{enumerable:!0,get:function(){return fi.getProperty}});Object.defineProperty(Ar,"stringify",{enumerable:!0,get:function(){return fi.stringify}});Object.defineProperty(Ar,"regexpCode",{enumerable:!0,get:function(){return fi.regexpCode}});Object.defineProperty(Ar,"Name",{enumerable:!0,get:function(){return fi.Name}});var fd=Yg();Object.defineProperty(Ar,"Scope",{enumerable:!0,get:function(){return fd.Scope}});Object.defineProperty(Ar,"ValueScope",{enumerable:!0,get:function(){return fd.ValueScope}});Object.defineProperty(Ar,"ValueScopeName",{enumerable:!0,get:function(){return fd.ValueScopeName}});Object.defineProperty(Ar,"varKinds",{enumerable:!0,get:function(){return fd.varKinds}});Ar.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 di{optimizeNodes(){return this}optimizeNames(e,t){return this}}class zk extends di{constructor(e,t,r){super();this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){let r=e?ht.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${r} ${this.name}${n};`+t}optimizeNames(e,t){if(!e[this.name.str])return;if(this.rhs)this.rhs=Ca(this.rhs,e,t);return this}get names(){return this.rhs instanceof Z._CodeOrName?this.rhs.names:{}}}class ey extends di{constructor(e,t,r){super();this.lhs=e,this.rhs=t,this.sideEffects=r}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=Ca(this.rhs,e,t),this}get names(){let e=this.lhs instanceof Z.Name?{}:{...this.lhs.names};return ud(e,this.rhs)}}class Gk extends ey{constructor(e,t,r,n){super(e,r,n);this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class Kk extends di{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class Xk extends di{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class Yk extends di{constructor(e){super();this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class Zk extends di{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=Ca(this.code,e,t),this}get names(){return this.code instanceof Z._CodeOrName?this.code.names:{}}}class dd extends di{constructor(e=[]){super();this.nodes=e}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){let{nodes:e}=this,t=e.length;while(t--){let r=e[t].optimizeNodes();if(Array.isArray(r))e.splice(t,1,...r);else if(r)e[t]=r;else e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:r}=this,n=r.length;while(n--){let s=r[n];if(s.optimizeNames(e,t))continue;vH(e,s.names),r.splice(n,1)}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>ho(e,t.names),{})}}class pi extends dd{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class Qk extends dd{}class vc extends pi{}vc.kind="else";class Ms extends pi{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 r=t.optimizeNodes();t=this.else=Array.isArray(r)?new vc(r):r}if(t){if(e===!1)return t instanceof Ms?t:t.nodes;if(this.nodes.length)return this;return new Ms(s_(e),t instanceof Ms?[t]:t.nodes)}if(e===!1||!this.nodes.length)return;return this}optimizeNames(e,t){var r;if(this.else=(r=this.else)===null||r===void 0?void 0:r.optimizeNames(e,t),!(super.optimizeNames(e,t)||this.else))return;return this.condition=Ca(this.condition,e,t),this}get names(){let e=super.names;if(ud(e,this.condition),this.else)ho(e,this.else.names);return e}}Ms.kind="if";class Na extends pi{}Na.kind="for";class e_ extends Na{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=Ca(this.iteration,e,t),this}get names(){return ho(super.names,this.iteration.names)}}class t_ extends Na{constructor(e,t,r,n){super();this.varKind=e,this.name=t,this.from=r,this.to=n}render(e){let t=e.es5?ht.varKinds.var:this.varKind,{name:r,from:n,to:s}=this;return`for(${t} ${r}=${n}; ${r}<${s}; ${r}++)`+super.render(e)}get names(){let e=ud(super.names,this.from);return ud(e,this.to)}}class Zg extends Na{constructor(e,t,r,n){super();this.loop=e,this.varKind=t,this.name=r,this.iterable=n}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=Ca(this.iterable,e,t),this}get names(){return ho(super.names,this.iterable.names)}}class od extends pi{constructor(e,t,r){super();this.name=e,this.args=t,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}od.kind="func";class ad extends dd{render(e){return"return "+super.render(e)}}ad.kind="return";class r_ extends pi{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 r,n;return super.optimizeNames(e,t),(r=this.catch)===null||r===void 0||r.optimizeNames(e,t),(n=this.finally)===null||n===void 0||n.optimizeNames(e,t),this}get names(){let e=super.names;if(this.catch)ho(e,this.catch.names);if(this.finally)ho(e,this.finally.names);return e}}class ld extends pi{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}ld.kind="catch";class cd extends pi{render(e){return"finally"+super.render(e)}}cd.kind="finally";class n_{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
621
+ `:""},this._extScope=e,this._scope=new ht.Scope({parent:e}),this._nodes=[new Qk]}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 r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}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,r,n){let s=this._scope.toName(t);if(r!==void 0&&n)this._constants[s.str]=r;return this._leafNode(new zk(e,s,r)),s}const(e,t,r){return this._def(ht.varKinds.const,e,t,r)}let(e,t,r){return this._def(ht.varKinds.let,e,t,r)}var(e,t,r){return this._def(ht.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new ey(e,t,r))}add(e,t){return this._leafNode(new Gk(e,Ar.operators.ADD,t))}code(e){if(typeof e=="function")e();else if(e!==Z.nil)this._leafNode(new Zk(e));return this}object(...e){let t=["{"];for(let[r,n]of e){if(t.length>1)t.push(",");if(t.push(r),r!==n||this.opts.es5)t.push(":"),Z.addCodeArg(t,n)}return t.push("}"),new Z._Code(t)}if(e,t,r){if(this._blockNode(new Ms(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new Ms(e))}else(){return this._elseNode(new vc)}endIf(){return this._endBlockNode(Ms,vc)}_for(e,t){if(this._blockNode(e),t)this.code(t).endFor();return this}for(e,t){return this._for(new e_(e),t)}forRange(e,t,r,n,s=this.opts.es5?ht.varKinds.var:ht.varKinds.let){let i=this._scope.toName(e);return this._for(new t_(s,i,t,r),()=>n(i))}forOf(e,t,r,n=ht.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let i=t instanceof Z.Name?t:this.var("_arr",t);return this.forRange("_i",0,Z._`${i}.length`,(o)=>{this.var(s,Z._`${i}[${o}]`),r(s)})}return this._for(new Zg("of",n,s,t),()=>r(s))}forIn(e,t,r,n=this.opts.es5?ht.varKinds.var:ht.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,Z._`Object.keys(${t})`,r);let s=this._scope.toName(e);return this._for(new Zg("in",n,s,t),()=>r(s))}endFor(){return this._endBlockNode(Na)}label(e){return this._leafNode(new Kk(e))}break(e){return this._leafNode(new Xk(e))}return(e){let t=new ad;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(ad)}try(e,t,r){if(!t&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let n=new r_;if(this._blockNode(n),this.code(e),t){let s=this.name("e");this._currNode=n.catch=new ld(s),t(s)}if(r)this._currNode=n.finally=new cd,this.code(r);return this._endBlockNode(ld,cd)}throw(e){return this._leafNode(new Yk(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 r=this._nodes.length-t;if(r<0||e!==void 0&&r!==e)throw Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=Z.nil,r,n){if(this._blockNode(new od(e,t,r)),n)this.code(n).endFunc();return this}endFunc(){return this._endBlockNode(od)}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 r=this._currNode;if(r instanceof e||t&&r 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 Ms))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}}Ar.CodeGen=n_;function ho(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function ud(e,t){return t instanceof Z._CodeOrName?ho(e,t.names):e}function Ca(e,t,r){if(e instanceof Z.Name)return n(e);if(!s(e))return e;return new Z._Code(e._items.reduce((i,o)=>{if(o instanceof Z.Name)o=n(o);if(o instanceof Z._Code)i.push(...o._items);else i.push(o);return i},[]));function n(i){let o=r[i.str];if(o===void 0||t[i.str]!==1)return i;return delete t[i.str],o}function s(i){return i instanceof Z._Code&&i._items.some((o)=>o instanceof Z.Name&&t[o.str]===1&&r[o.str]!==void 0)}}function vH(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function s_(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:Z._`!${Qg(e)}`}Ar.not=s_;var SH=i_(Ar.operators.AND);function EH(...e){return e.reduce(SH)}Ar.and=EH;var PH=i_(Ar.operators.OR);function jH(...e){return e.reduce(PH)}Ar.or=jH;function i_(e){return(t,r)=>t===Z.nil?r:r===Z.nil?t:Z._`${Qg(t)} ${e} ${Qg(r)}`}function Qg(e){return e instanceof Z.Name?e:Z._`(${e})`}});var Oe=T(function(h_){Object.defineProperty(h_,"__esModule",{value:!0});h_.checkStrictMode=h_.getErrorPath=h_.Type=h_.useFunc=h_.setEvaluated=h_.evaluatedPropsToName=h_.mergeEvaluated=h_.eachItem=h_.unescapeJsonPointer=h_.escapeJsonPointer=h_.escapeFragment=h_.unescapeFragment=h_.schemaRefOrVal=h_.schemaHasRulesButRef=h_.schemaHasRules=h_.checkUnknownRules=h_.alwaysValidSchema=h_.toHash=void 0;var fe=we(),c_=wc();function RH(e){let t={};for(let r of e)t[r]=!0;return t}h_.toHash=RH;function OH(e,t){if(typeof t=="boolean")return t;if(Object.keys(t).length===0)return!0;return u_(e,t),!f_(t,e.self.RULES.all)}h_.alwaysValidSchema=OH;function u_(e,t=e.schema){let{opts:r,self:n}=e;if(!r.strictSchema)return;if(typeof t==="boolean")return;let s=n.RULES.keywords;for(let i in t)if(!s[i])m_(e,`unknown keyword: "${i}"`)}h_.checkUnknownRules=u_;function f_(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}h_.schemaHasRules=f_;function NH(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}h_.schemaHasRulesButRef=NH;function CH({topSchemaRef:e,schemaPath:t},r,n,s){if(!s){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return fe._`${r}`}return fe._`${e}${t}${fe.getProperty(n)}`}h_.schemaRefOrVal=CH;function TH(e){return d_(decodeURIComponent(e))}h_.unescapeFragment=TH;function IH(e){return encodeURIComponent(ry(e))}h_.escapeFragment=IH;function ry(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}h_.escapeJsonPointer=ry;function d_(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}h_.unescapeJsonPointer=d_;function JH(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}h_.eachItem=JH;function a_({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(s,i,o,a)=>{let l=o===void 0?i:o instanceof fe.Name?(i instanceof fe.Name?e(s,i,o):t(s,i,o),o):i instanceof fe.Name?(t(s,o,i),i):r(i,o);return a===fe.Name&&!(l instanceof fe.Name)?n(s,l):l}}h_.mergeEvaluated={props:a_({mergeNames:(e,t,r)=>e.if(fe._`${r} !== true && ${t} !== undefined`,()=>{e.if(fe._`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,fe._`${r} || {}`).code(fe._`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if(fe._`${r} !== true`,()=>{if(t===!0)e.assign(r,!0);else e.assign(r,fe._`${r} || {}`),ny(e,r,t)}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:p_}),items:a_({mergeNames:(e,t,r)=>e.if(fe._`${r} !== true && ${t} !== undefined`,()=>e.assign(r,fe._`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if(fe._`${r} !== true`,()=>e.assign(r,t===!0?!0:fe._`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function p_(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",fe._`{}`);if(t!==void 0)ny(e,r,t);return r}h_.evaluatedPropsToName=p_;function ny(e,t,r){Object.keys(r).forEach((n)=>e.assign(fe._`${t}${fe.getProperty(n)}`,!0))}h_.setEvaluated=ny;var l_={};function MH(e,t){return e.scopeValue("func",{ref:t,code:l_[t.code]||(l_[t.code]=new c_._Code(t.code))})}h_.useFunc=MH;var ty;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(ty||(h_.Type=ty={}));function DH(e,t,r){if(e instanceof fe.Name){let n=t===ty.Num;return r?n?fe._`"[" + ${e} + "]"`:fe._`"['" + ${e} + "']"`:n?fe._`"/" + ${e}`:fe._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?fe.getProperty(e).toString():"/"+ry(e)}h_.getErrorPath=DH;function m_(e,t,r=e.opts.strictSchema){if(!r)return;if(t=`strict mode: ${t}`,r===!0)throw Error(t);e.self.logger.warn(t)}h_.checkStrictMode=m_});var on=T(function(y_){Object.defineProperty(y_,"__esModule",{value:!0});var We=we(),r4={data:new We.Name("data"),valCxt:new We.Name("valCxt"),instancePath:new We.Name("instancePath"),parentData:new We.Name("parentData"),parentDataProperty:new We.Name("parentDataProperty"),rootData:new We.Name("rootData"),dynamicAnchors:new We.Name("dynamicAnchors"),vErrors:new We.Name("vErrors"),errors:new We.Name("errors"),this:new We.Name("this"),self:new We.Name("self"),scope:new We.Name("scope"),json:new We.Name("json"),jsonPos:new We.Name("jsonPos"),jsonLen:new We.Name("jsonLen"),jsonPart:new We.Name("jsonPart")};y_.default=r4});var Sc=T(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=we(),mi=Oe(),hr=on();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 s4(e,t=w_.keywordError,r,n){let{it:s}=e,{gen:i,compositeRule:o,allErrors:a}=s,l=$_(e,t,r);if(n!==null&&n!==void 0?n:o||a)b_(i,l);else x_(s,ne._`[${l}]`)}w_.reportError=s4;function i4(e,t=w_.keywordError,r){let{it:n}=e,{gen:s,compositeRule:i,allErrors:o}=n,a=$_(e,t,r);if(b_(s,a),!(i||o))x_(n,hr.default.vErrors)}w_.reportExtraError=i4;function o4(e,t){e.assign(hr.default.errors,t),e.if(ne._`${hr.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(ne._`${hr.default.vErrors}.length`,t),()=>e.assign(hr.default.vErrors,null)))}w_.resetErrorsCount=o4;function a4({gen:e,keyword:t,schemaValue:r,data:n,errsCount:s,it:i}){if(s===void 0)throw Error("ajv implementation error");let o=e.name("err");e.forRange("i",s,hr.default.errors,(a)=>{if(e.const(o,ne._`${hr.default.vErrors}[${a}]`),e.if(ne._`${o}.instancePath === undefined`,()=>e.assign(ne._`${o}.instancePath`,ne.strConcat(hr.default.instancePath,i.errorPath))),e.assign(ne._`${o}.schemaPath`,ne.str`${i.errSchemaPath}/${t}`),i.opts.verbose)e.assign(ne._`${o}.schema`,r),e.assign(ne._`${o}.data`,n)})}w_.extendErrors=a4;function b_(e,t){let r=e.const("err",t);e.if(ne._`${hr.default.vErrors} === null`,()=>e.assign(hr.default.vErrors,ne._`[${r}]`),ne._`${hr.default.vErrors}.push(${r})`),e.code(ne._`${hr.default.errors}++`)}function x_(e,t){let{gen:r,validateName:n,schemaEnv:s}=e;if(s.$async)r.throw(ne._`new ${e.ValidationError}(${t})`);else r.assign(ne._`${n}.errors`,t),r.return(!1)}var go={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 $_(e,t,r){let{createErrors:n}=e.it;if(n===!1)return ne._`{}`;return l4(e,t,r)}function l4(e,t,r={}){let{gen:n,it:s}=e,i=[c4(s,r),u4(e,r)];return f4(e,t,i),n.object(...i)}function c4({errorPath:e},{instancePath:t}){let r=t?ne.str`${e}${mi.getErrorPath(t,mi.Type.Str)}`:e;return[hr.default.instancePath,ne.strConcat(hr.default.instancePath,r)]}function u4({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let s=n?t:ne.str`${t}/${e}`;if(r)s=ne.str`${s}${mi.getErrorPath(r,mi.Type.Str)}`;return[go.schemaPath,s]}function f4(e,{params:t,message:r},n){let{keyword:s,data:i,schemaValue:o,it:a}=e,{opts:l,propertyName:c,topSchemaRef:u,schemaPath:p}=a;if(n.push([go.keyword,s],[go.params,typeof t=="function"?t(e):t||ne._`{}`]),l.messages)n.push([go.message,typeof r=="function"?r(e):r]);if(l.verbose)n.push([go.schema,o],[go.parentSchema,ne._`${u}${p}`],[hr.default.data,i]);if(c)n.push([go.propertyName,c])}});var __=T(function(j_){Object.defineProperty(j_,"__esModule",{value:!0});j_.boolOrEmptySchema=j_.topBoolOrEmptySchema=void 0;var S_=Sc(),E_=we(),g4=on(),y4={message:"boolean schema is false"};function b4(e){let{gen:t,schema:r,validateName:n}=e;if(r===!1)P_(e,!1);else if(typeof r=="object"&&r.$async===!0)t.return(g4.default.data);else t.assign(E_._`${n}.errors`,null),t.return(!0)}j_.topBoolOrEmptySchema=b4;function x4(e,t){let{gen:r,schema:n}=e;if(n===!1)r.var(t,!1),P_(e);else r.var(t,!0)}j_.boolOrEmptySchema=x4;function P_(e,t){let{gen:r,data:n}=e;S_.reportError({gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},y4,void 0,t)}});var iy=T(function(A_){Object.defineProperty(A_,"__esModule",{value:!0});A_.getRules=A_.isJSONType=void 0;var w4=["string","number","integer","boolean","null","object","array"],v4=new Set(w4);function S4(e){return typeof e=="string"&&v4.has(e)}A_.isJSONType=S4;function E4(){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=E4});var oy=T(function(C_){Object.defineProperty(C_,"__esModule",{value:!0});C_.shouldUseRule=C_.shouldUseGroup=C_.schemaHasRulesForType=void 0;function j4({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&O_(e,n)}C_.schemaHasRulesForType=j4;function O_(e,t){return t.rules.some((r)=>N_(e,r))}C_.shouldUseGroup=O_;function N_(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some((n)=>e[n]!==void 0))}C_.shouldUseRule=N_});var Ec=T(function(F_){Object.defineProperty(F_,"__esModule",{value:!0});F_.reportTypeError=F_.checkDataTypes=F_.checkDataType=F_.coerceAndCheckDataType=F_.getJSONTypes=F_.getSchemaTypes=F_.DataType=void 0;var I_=iy(),J_=oy(),M_=Sc(),z=we(),md=Oe(),Ta;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(Ta||(F_.DataType=Ta={}));function A4(e){let t=D_(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}F_.getSchemaTypes=A4;function D_(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(I_.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}F_.getJSONTypes=D_;function R4(e,t){let{gen:r,data:n,opts:s}=e,i=O4(t,s.coerceTypes),o=t.length>0&&!(i.length===0&&t.length===1&&J_.schemaHasRulesForType(e,t[0]));if(o){let a=ly(t,n,s.strictNumbers,Ta.Wrong);r.if(a,()=>{if(i.length)N4(e,t,i);else cy(e)})}return o}F_.coerceAndCheckDataType=R4;var L_=new Set(["string","number","integer","boolean","null"]);function O4(e,t){return t?e.filter((r)=>L_.has(r)||t==="array"&&r==="array"):[]}function N4(e,t,r){let{gen:n,data:s,opts:i}=e,o=n.let("dataType",z._`typeof ${s}`),a=n.let("coerced",z._`undefined`);if(i.coerceTypes==="array")n.if(z._`${o} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,()=>n.assign(s,z._`${s}[0]`).assign(o,z._`typeof ${s}`).if(ly(t,s,i.strictNumbers),()=>n.assign(a,s)));n.if(z._`${a} !== undefined`);for(let c of r)if(L_.has(c)||c==="array"&&i.coerceTypes==="array")l(c);n.else(),cy(e),n.endIf(),n.if(z._`${a} !== undefined`,()=>{n.assign(s,a),C4(e,a)});function l(c){switch(c){case"string":n.elseIf(z._`${o} == "number" || ${o} == "boolean"`).assign(a,z._`"" + ${s}`).elseIf(z._`${s} === null`).assign(a,z._`""`);return;case"number":n.elseIf(z._`${o} == "boolean" || ${s} === null
621
622
  || (${o} == "string" && ${s} && ${s} == +${s})`).assign(a,z._`+${s}`);return;case"integer":n.elseIf(z._`${o} === "boolean" || ${s} === null
622
623
  || (${o} === "string" && ${s} && ${s} == +${s} && !(${s} % 1))`).assign(a,z._`+${s}`);return;case"boolean":n.elseIf(z._`${s} === "false" || ${s} === 0 || ${s} === null`).assign(a,!1).elseIf(z._`${s} === "true" || ${s} === 1`).assign(a,!0);return;case"null":n.elseIf(z._`${s} === "" || ${s} === 0 || ${s} === false`),n.assign(a,null);return;case"array":n.elseIf(z._`${o} === "string" || ${o} === "number"
623
- || ${o} === "boolean" || ${s} === null`).assign(a,z._`[${s}]`)}}}function xU({gen:e,parentData:t,parentDataProperty:r},n){e.if(z._`${t} !== undefined`,()=>e.assign(z._`${t}[${r}]`,n))}function Lg(e,t,r,n=Pa.Correct){let s=n===Pa.Correct?z.operators.EQ:z.operators.NEQ,i;switch(e){case"null":return z._`${t} ${s} null`;case"array":i=z._`Array.isArray(${t})`;break;case"object":i=z._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":i=o(z._`!(${t} % 1) && !isNaN(${t})`);break;case"number":i=o();break;default:return z._`typeof ${t} ${s} ${e}`}return n===Pa.Correct?i:z.not(i);function o(a=z.nil){return z.and(z._`typeof ${t} == "number"`,a,r?z._`isFinite(${t})`:z.nil)}}n_.checkDataType=Lg;function Fg(e,t,r,n){if(e.length===1)return Lg(e[0],t,r,n);let s,i=Xf.toHash(e);if(i.array&&i.object){let o=z._`typeof ${t} != "object"`;s=i.null?o:z._`!${t} || ${o}`,delete i.null,delete i.array,delete i.object}else s=z.nil;if(i.number)delete i.integer;for(let o in i)s=z.and(s,Lg(o,t,r,n));return s}n_.checkDataTypes=Fg;var $U={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?z._`{type: ${e}}`:z._`{type: ${t}}`};function qg(e){let t=wU(e);e_.reportError(t,$U)}n_.reportTypeError=qg;function wU(e){let{gen:t,data:r,schema:n}=e,s=Xf.schemaRefOrVal(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:s,schemaValue:s,parentSchema:n,params:{},it:e}}});var c_=N(function(a_){Object.defineProperty(a_,"__esModule",{value:!0});a_.assignDefaults=void 0;var sn=we(),o_=Oe();function _U(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let s in r)i_(e,s,r[s].default);else if(t==="array"&&Array.isArray(n))n.forEach((s,i)=>i_(e,i,s.default))}a_.assignDefaults=_U;function i_(e,t,r){let{gen:n,compositeRule:s,data:i,opts:o}=e;if(r===void 0)return;let a=sn._`${i}${sn.getProperty(t)}`;if(s){o_.checkStrictMode(e,`default is ignored for: ${a}`);return}let l=sn._`${a} === undefined`;if(o.useDefaults==="empty")l=sn._`${l} || ${a} === null || ${a} === ""`;n.if(l,sn._`${a} = ${sn.stringify(r)}`)}});var on=N(function(p_){Object.defineProperty(p_,"__esModule",{value:!0});p_.validateUnion=p_.validateArray=p_.usePattern=p_.callValidateCode=p_.schemaProperties=p_.allSchemaProperties=p_.noPropertyInData=p_.propertyInData=p_.isOwnProperty=p_.hasPropFunc=p_.reportMissingProp=p_.checkMissingProp=p_.checkReportMissingProp=void 0;var he=we(),ka=Oe(),di=nn(),u_=Oe();function AU(e,t){let{gen:r,data:n,it:s}=e;r.if(Wg(r,n,t,s.opts.ownProperties),()=>{e.setParams({missingProperty:he._`${t}`},!0),e.error()})}p_.checkReportMissingProp=AU;function RU({gen:e,data:t,it:{opts:r}},n,s){return he.or(...n.map((i)=>he.and(Wg(e,t,i,r.ownProperties),he._`${s} = ${i}`)))}p_.checkMissingProp=RU;function OU(e,t){e.setParams({missingProperty:t},!0),e.error()}p_.reportMissingProp=OU;function f_(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:he._`Object.prototype.hasOwnProperty`})}p_.hasPropFunc=f_;function Vg(e,t,r){return he._`${f_(e)}.call(${t}, ${r})`}p_.isOwnProperty=Vg;function CU(e,t,r,n){let s=he._`${t}${he.getProperty(r)} !== undefined`;return n?he._`${s} && ${Vg(e,t,r)}`:s}p_.propertyInData=CU;function Wg(e,t,r,n){let s=he._`${t}${he.getProperty(r)} === undefined`;return n?he.or(s,he.not(Vg(e,t,r))):s}p_.noPropertyInData=Wg;function d_(e){return e?Object.keys(e).filter((t)=>t!=="__proto__"):[]}p_.allSchemaProperties=d_;function NU(e,t){return d_(t).filter((r)=>!ka.alwaysValidSchema(e,t[r]))}p_.schemaProperties=NU;function TU({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:s,errorPath:i},it:o},a,l,c){let u=c?he._`${e}, ${t}, ${n}${s}`:t,p=[[di.default.instancePath,he.strConcat(di.default.instancePath,i)],[di.default.parentData,o.parentData],[di.default.parentDataProperty,o.parentDataProperty],[di.default.rootData,di.default.rootData]];if(o.opts.dynamicRef)p.push([di.default.dynamicAnchors,di.default.dynamicAnchors]);let h=he._`${u}, ${r.object(...p)}`;return l!==he.nil?he._`${a}.call(${l}, ${h})`:he._`${a}(${h})`}p_.callValidateCode=TU;var IU=he._`new RegExp`;function JU({gen:e,it:{opts:t}},r){let n=t.unicodeRegExp?"u":"",{regExp:s}=t.code,i=s(r,n);return e.scopeValue("pattern",{key:i.toString(),ref:i,code:he._`${s.code==="new RegExp"?IU:u_.useFunc(e,s)}(${r}, ${n})`})}p_.usePattern=JU;function MU(e){let{gen:t,data:r,keyword:n,it:s}=e,i=t.name("valid");if(s.allErrors){let a=t.let("valid",!0);return o(()=>t.assign(a,!1)),a}return t.var(i,!0),o(()=>t.break()),i;function o(a){let l=t.const("len",he._`${r}.length`);t.forRange("i",0,l,(c)=>{e.subschema({keyword:n,dataProp:c,dataPropType:ka.Type.Num},i),t.if(he.not(i),a)})}}p_.validateArray=MU;function DU(e){let{gen:t,schema:r,keyword:n,it:s}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(r.some((l)=>ka.alwaysValidSchema(s,l))&&!s.opts.unevaluated)return;let o=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((l,c)=>{let u=e.subschema({keyword:n,schemaProp:c,compositeRule:!0},a);if(t.assign(o,he._`${o} || ${a}`),!e.mergeValidEvaluated(u,a))t.if(he.not(o))})),e.result(o,()=>e.reset(),()=>e.error(!0))}p_.validateUnion=DU});var w_=N(function(x_){Object.defineProperty(x_,"__esModule",{value:!0});x_.validateKeywordUsage=x_.validSchemaType=x_.funcKeywordCode=x_.macroKeywordCode=void 0;var Ue=we(),po=nn(),g_=on(),y_=uc();function XU(e,t){let{gen:r,keyword:n,schema:s,parentSchema:i,it:o}=e,a=t.macro.call(o.self,s,i,o),l=b_(r,n,a);if(o.opts.validateSchema!==!1)o.self.validateSchema(a,!0);let c=r.name("valid");e.subschema({schema:a,schemaPath:Ue.nil,errSchemaPath:`${o.errSchemaPath}/${n}`,topSchemaRef:l,compositeRule:!0},c),e.pass(c,()=>e.error(!0))}x_.macroKeywordCode=XU;function ZU(e,t){var r;let{gen:n,keyword:s,schema:i,parentSchema:o,$data:a,it:l}=e;e4(l,t);let c=!a&&t.compile?t.compile.call(l.self,i,o,l):t.validate,u=b_(n,s,c),p=n.let("valid");e.block$data(p,h),e.ok((r=t.valid)!==null&&r!==void 0?r:p);function h(){if(t.errors===!1){if(g(),t.modifying)h_(e);y(()=>e.error())}else{let w=t.async?m():b();if(t.modifying)h_(e);y(()=>QU(e,w))}}function m(){let w=n.let("ruleErrs",null);return n.try(()=>g(Ue._`await `),(j)=>n.assign(p,!1).if(Ue._`${j} instanceof ${l.ValidationError}`,()=>n.assign(w,Ue._`${j}.errors`),()=>n.throw(j))),w}function b(){let w=Ue._`${u}.errors`;return n.assign(w,null),g(Ue.nil),w}function g(w=t.async?Ue._`await `:Ue.nil){let j=l.opts.passContext?po.default.this:po.default.self,S=!(("compile"in t)&&!a||t.schema===!1);n.assign(p,Ue._`${w}${g_.callValidateCode(e,u,j,S)}`,t.modifying)}function y(w){var j;n.if(Ue.not((j=t.valid)!==null&&j!==void 0?j:p),w)}}x_.funcKeywordCode=ZU;function h_(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,Ue._`${n.parentData}[${n.parentDataProperty}]`))}function QU(e,t){let{gen:r}=e;r.if(Ue._`Array.isArray(${t})`,()=>{r.assign(po.default.vErrors,Ue._`${po.default.vErrors} === null ? ${t} : ${po.default.vErrors}.concat(${t})`).assign(po.default.errors,Ue._`${po.default.vErrors}.length`),y_.extendErrors(e)},()=>e.error())}function e4({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}function b_(e,t,r){if(r===void 0)throw Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:Ue.stringify(r)})}function t4(e,t,r=!1){return!t.length||t.some((n)=>n==="array"?Array.isArray(e):n==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==n||r&&typeof e>"u")}x_.validSchemaType=t4;function r4({schema:e,opts:t,self:r,errSchemaPath:n},s,i){if(Array.isArray(s.keyword)?!s.keyword.includes(i):s.keyword!==i)throw Error("ajv implementation error");let o=s.dependencies;if(o===null||o===void 0?void 0:o.some((a)=>!Object.prototype.hasOwnProperty.call(e,a)))throw Error(`parent schema must have dependencies of ${i}: ${o.join(",")}`);if(s.validateSchema){if(!s.validateSchema(e[i])){let l=`keyword "${i}" value is invalid at path "${n}": `+r.errorsText(s.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(l);else throw Error(l)}}}x_.validateKeywordUsage=r4});var E_=N(function(v_){Object.defineProperty(v_,"__esModule",{value:!0});v_.extendSubschemaMode=v_.extendSubschemaData=v_.getSubschema=void 0;var Rt=we(),Zf=Oe();function o4(e,{keyword:t,schemaProp:r,schema:n,schemaPath:s,errSchemaPath:i,topSchemaRef:o}){if(t!==void 0&&n!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let a=e.schema[t];return r===void 0?{schema:a,schemaPath:Rt._`${e.schemaPath}${Rt.getProperty(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:Rt._`${e.schemaPath}${Rt.getProperty(t)}${Rt.getProperty(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${Zf.escapeFragment(r)}`}}if(n!==void 0){if(s===void 0||i===void 0||o===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:s,topSchemaRef:o,errSchemaPath:i}}throw Error('either "keyword" or "schema" must be passed')}v_.getSubschema=o4;function a4(e,t,{dataProp:r,dataPropType:n,data:s,dataTypes:i,propertyName:o}){if(s!==void 0&&r!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(r!==void 0){let{errorPath:c,dataPathArr:u,opts:p}=t,h=a.let("data",Rt._`${t.data}${Rt.getProperty(r)}`,!0);l(h),e.errorPath=Rt.str`${c}${Zf.getErrorPath(r,n,p.jsPropertySyntax)}`,e.parentDataProperty=Rt._`${r}`,e.dataPathArr=[...u,e.parentDataProperty]}if(s!==void 0){let c=s instanceof Rt.Name?s:a.let("data",s,!0);if(l(c),o!==void 0)e.propertyName=o}if(i)e.dataTypes=i;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]}}v_.extendSubschemaData=a4;function l4(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:s,allErrors:i}){if(n!==void 0)e.compositeRule=n;if(s!==void 0)e.createErrors=s;if(i!==void 0)e.allErrors=i;e.jtdDiscriminator=t,e.jtdMetadata=r}v_.extendSubschemaMode=l4});var Bg=N(function(Yae,j_){j_.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,s,i;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(s=n;s--!==0;)if(!e(t[s],r[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(i=Object.keys(t),n=i.length,n!==Object.keys(r).length)return!1;for(s=n;s--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[s]))return!1;for(s=n;s--!==0;){var o=i[s];if(!e(t[o],r[o]))return!1}return!0}return t!==t&&r!==r}});var k_=N(function(Xae,P_){var pi=P_.exports=function(e,t,r){if(typeof t=="function")r=t,t={};r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},s=r.post||function(){};Qf(t,n,s,e,"",e)};pi.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};pi.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};pi.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};pi.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 Qf(e,t,r,n,s,i,o,a,l,c){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,s,i,o,a,l,c);for(var u in n){var p=n[u];if(Array.isArray(p)){if(u in pi.arrayKeywords)for(var h=0;h<p.length;h++)Qf(e,t,r,p[h],s+"/"+u+"/"+h,i,s,u,n,h)}else if(u in pi.propsKeywords){if(p&&typeof p=="object")for(var m in p)Qf(e,t,r,p[m],s+"/"+u+"/"+f4(m),i,s,u,n,m)}else if(u in pi.keywords||e.allKeys&&!(u in pi.skipKeywords))Qf(e,t,r,p,s+"/"+u,i,s,u,n)}r(n,s,i,o,a,l,c)}}function f4(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var dc=N(function(C_){Object.defineProperty(C_,"__esModule",{value:!0});C_.getSchemaRefs=C_.resolveUrl=C_.normalizeId=C_._getFullPath=C_.getFullPath=C_.inlineRef=void 0;var __=Oe(),d4=Bg(),p4=k_(),m4=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function h4(e,t=!0){if(typeof e=="boolean")return!0;if(t===!0)return!Hg(e);if(!t)return!1;return A_(e)<=t}C_.inlineRef=h4;var g4=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Hg(e){for(let t in e){if(g4.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(Hg))return!0;if(typeof r=="object"&&Hg(r))return!0}return!1}function A_(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,m4.has(r))continue;if(typeof e[r]=="object")__.eachItem(e[r],(n)=>t+=A_(n));if(t===1/0)return 1/0}return t}function R_(e,t="",r){if(r!==!1)t=_a(t);let n=e.parse(t);return O_(e,n)}C_.getFullPath=R_;function O_(e,t){return e.serialize(t).split("#")[0]+"#"}C_._getFullPath=O_;var y4=/#\/?$/;function _a(e){return e?e.replace(y4,""):""}C_.normalizeId=_a;function b4(e,t,r){return r=_a(r),e.resolve(t,r)}C_.resolveUrl=b4;var x4=/^[a-z_][-a-z0-9._]*$/i;function $4(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,s=_a(e[r]||t),i={"":s},o=R_(n,s,!1),a={},l=new Set;return p4(e,{allKeys:!0},(p,h,m,b)=>{if(b===void 0)return;let g=o+h,y=i[b];if(typeof p[r]=="string")y=w.call(this,p[r]);j.call(this,p.$anchor),j.call(this,p.$dynamicAnchor),i[h]=y;function w(S){let E=this.opts.uriResolver.resolve;if(S=_a(y?E(y,S):S),l.has(S))throw u(S);l.add(S);let P=this.refs[S];if(typeof P=="string")P=this.refs[P];if(typeof P=="object")c(p,P.schema,S);else if(S!==_a(g))if(S[0]==="#")c(p,a[S],S),a[S]=p;else this.refs[S]=g;return S}function j(S){if(typeof S=="string"){if(!x4.test(S))throw Error(`invalid anchor "${S}"`);w.call(this,`#${S}`)}}}),a;function c(p,h,m){if(h!==void 0&&!d4(p,h))throw u(m)}function u(p){return Error(`reference "${p}" resolves to more than one schema`)}}C_.getSchemaRefs=$4});var Oa=N(function(G_){Object.defineProperty(G_,"__esModule",{value:!0});G_.getData=G_.KeywordCxt=G_.validateFunctionCode=void 0;var td=Hk(),ed=fc(),Ra=Dg(),mi=fc(),M_=c_(),qn=w_(),Aa=E_(),q=we(),xe=nn(),D_=dc(),qt=Oe(),Fn=uc();function P4(e){if(q_(e)){if(V_(e),F_(e)){A4(e);return}}L_(e,()=>td.topBoolOrEmptySchema(e))}G_.validateFunctionCode=P4;function L_({gen:e,validateName:t,schema:r,schemaEnv:n,opts:s},i){if(s.code.es5)e.func(t,q._`${xe.default.data}, ${xe.default.valCxt}`,n.$async,()=>{e.code(q._`"use strict"; ${T_(r,s)}`),_4(e,s),e.code(i)});else e.func(t,q._`${xe.default.data}, ${k4(s)}`,n.$async,()=>e.code(T_(r,s)).code(i))}function k4(e){return q._`{${xe.default.instancePath}="", ${xe.default.parentData}, ${xe.default.parentDataProperty}, ${xe.default.rootData}=${xe.default.data}${e.dynamicRef?q._`, ${xe.default.dynamicAnchors}={}`:q.nil}}={}`}function _4(e,t){e.if(xe.default.valCxt,()=>{if(e.var(xe.default.instancePath,q._`${xe.default.valCxt}.${xe.default.instancePath}`),e.var(xe.default.parentData,q._`${xe.default.valCxt}.${xe.default.parentData}`),e.var(xe.default.parentDataProperty,q._`${xe.default.valCxt}.${xe.default.parentDataProperty}`),e.var(xe.default.rootData,q._`${xe.default.valCxt}.${xe.default.rootData}`),t.dynamicRef)e.var(xe.default.dynamicAnchors,q._`${xe.default.valCxt}.${xe.default.dynamicAnchors}`)},()=>{if(e.var(xe.default.instancePath,q._`""`),e.var(xe.default.parentData,q._`undefined`),e.var(xe.default.parentDataProperty,q._`undefined`),e.var(xe.default.rootData,xe.default.data),t.dynamicRef)e.var(xe.default.dynamicAnchors,q._`{}`)})}function A4(e){let{schema:t,opts:r,gen:n}=e;L_(e,()=>{if(r.$comment&&t.$comment)B_(e);if(T4(e),n.let(xe.default.vErrors,null),n.let(xe.default.errors,0),r.unevaluated)R4(e);W_(e),M4(e)});return}function R4(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",q._`${r}.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 T_(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?q._`/*# sourceURL=${r} */`:q.nil}function O4(e,t){if(q_(e)){if(V_(e),F_(e)){C4(e,t);return}}td.boolOrEmptySchema(e,t)}function F_({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function q_(e){return typeof e.schema!="boolean"}function C4(e,t){let{schema:r,gen:n,opts:s}=e;if(s.$comment&&r.$comment)B_(e);I4(e),J4(e);let i=n.const("_errs",xe.default.errors);W_(e,i),n.var(t,q._`${i} === ${xe.default.errors}`)}function V_(e){qt.checkUnknownRules(e),N4(e)}function W_(e,t){if(e.opts.jtd)return I_(e,[],!1,t);let r=ed.getSchemaTypes(e.schema),n=ed.coerceAndCheckDataType(e,r);I_(e,r,!n,t)}function N4(e){let{schema:t,errSchemaPath:r,opts:n,self:s}=e;if(t.$ref&&n.ignoreKeywordsWithRef&&qt.schemaHasRulesButRef(t,s.RULES))s.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function T4(e){let{schema:t,opts:r}=e;if(t.default!==void 0&&r.useDefaults&&r.strictSchema)qt.checkStrictMode(e,"default is ignored in the schema root")}function I4(e){let t=e.schema[e.opts.schemaId];if(t)e.baseId=D_.resolveUrl(e.opts.uriResolver,e.baseId,t)}function J4(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function B_({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:s}){let i=r.$comment;if(s.$comment===!0)e.code(q._`${xe.default.self}.logger.log(${i})`);else if(typeof s.$comment=="function"){let o=q.str`${n}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code(q._`${xe.default.self}.opts.$comment(${i}, ${o}, ${a}.schema)`)}}function M4(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:s,opts:i}=e;if(r.$async)t.if(q._`${xe.default.errors} === 0`,()=>t.return(xe.default.data),()=>t.throw(q._`new ${s}(${xe.default.vErrors})`));else{if(t.assign(q._`${n}.errors`,xe.default.vErrors),i.unevaluated)D4(e);t.return(q._`${xe.default.errors} === 0`)}}function D4({gen:e,evaluated:t,props:r,items:n}){if(r instanceof q.Name)e.assign(q._`${t}.props`,r);if(n instanceof q.Name)e.assign(q._`${t}.items`,n)}function I_(e,t,r,n){let{gen:s,schema:i,data:o,allErrors:a,opts:l,self:c}=e,{RULES:u}=c;if(i.$ref&&(l.ignoreKeywordsWithRef||!qt.schemaHasRulesButRef(i,u))){s.block(()=>U_(e,"$ref",u.all.$ref.definition));return}if(!l.jtd)L4(e,t);s.block(()=>{for(let h of u.rules)p(h);p(u.post)});function p(h){if(!Ra.shouldUseGroup(i,h))return;if(h.type){if(s.if(mi.checkDataType(h.type,o,l.strictNumbers)),J_(e,h),t.length===1&&t[0]===h.type&&r)s.else(),mi.reportTypeError(e);s.endIf()}else J_(e,h);if(!a)s.if(q._`${xe.default.errors} === ${n||0}`)}}function J_(e,t){let{gen:r,schema:n,opts:{useDefaults:s}}=e;if(s)M_.assignDefaults(e,t.type);r.block(()=>{for(let i of t.rules)if(Ra.shouldUseRule(n,i))U_(e,i.keyword,i.definition,t.type)})}function L4(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;if(F4(e,t),!e.opts.allowUnionTypes)q4(e,t);V4(e,e.dataTypes)}function F4(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((r)=>{if(!H_(e.dataTypes,r))Ug(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),B4(e,t)}function q4(e,t){if(t.length>1&&!(t.length===2&&t.includes("null")))Ug(e,"use allowUnionTypes to allow union type keyword")}function V4(e,t){let r=e.self.RULES.all;for(let n in r){let s=r[n];if(typeof s=="object"&&Ra.shouldUseRule(e.schema,s)){let{type:i}=s.definition;if(i.length&&!i.some((o)=>W4(t,o)))Ug(e,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function W4(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function H_(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function B4(e,t){let r=[];for(let n of e.dataTypes)if(H_(t,n))r.push(n);else if(t.includes("integer")&&n==="number")r.push("integer");e.dataTypes=r}function Ug(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,qt.checkStrictMode(e,t,e.opts.strictTypes)}class zg{constructor(e,t,r){if(qn.validateKeywordUsage(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=qt.schemaRefOrVal(e,this.schema,r,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",z_(this.$data,e));else if(this.schemaCode=this.schemaValue,!qn.validSchemaType(this.schema,t.schemaType,t.allowUndefined))throw Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);if("code"in t?t.trackErrors:t.errors!==!1)this.errsCount=e.gen.const("_errs",xe.default.errors)}result(e,t,r){this.failResult(q.not(e),t,r)}failResult(e,t,r){if(this.gen.if(e),r)r();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,r){if(t){this.setParams(t),this._error(e,r),this.setParams({});return}this._error(e,r)}_error(e,t){(e?Fn.reportExtraError:Fn.reportError)(this,this.def.error,t)}$dataError(){Fn.reportError(this,this.def.$dataError||Fn.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');Fn.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,r=q.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=q.nil,t=q.nil){if(!this.$data)return;let{gen:r,schemaCode:n,schemaType:s,def:i}=this;if(r.if(q.or(q._`${n} === undefined`,t)),e!==q.nil)r.assign(e,!0);if(s.length||i.validateSchema){if(r.elseIf(this.invalid$data()),this.$dataError(),e!==q.nil)r.assign(e,!1)}r.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:r,def:n,it:s}=this;return q.or(i(),o());function i(){if(r.length){if(!(t instanceof q.Name))throw Error("ajv implementation error");let a=Array.isArray(r)?r:[r];return q._`${mi.checkDataTypes(a,t,s.opts.strictNumbers,mi.DataType.Wrong)}`}return q.nil}function o(){if(n.validateSchema){let a=e.scopeValue("validate$data",{ref:n.validateSchema});return q._`!${a}(${t})`}return q.nil}}subschema(e,t){let r=Aa.getSubschema(this.it,e);Aa.extendSubschemaData(r,this.it,e),Aa.extendSubschemaMode(r,e);let n={...this.it,...r,items:void 0,props:void 0};return O4(n,t),n}mergeEvaluated(e,t){let{it:r,gen:n}=this;if(!r.opts.unevaluated)return;if(r.props!==!0&&e.props!==void 0)r.props=qt.mergeEvaluated.props(n,e.props,r.props,t);if(r.items!==!0&&e.items!==void 0)r.items=qt.mergeEvaluated.items(n,e.items,r.items,t)}mergeValidEvaluated(e,t){let{it:r,gen:n}=this;if(r.opts.unevaluated&&(r.props!==!0||r.items!==!0))return n.if(t,()=>this.mergeEvaluated(e,q.Name)),!0}}G_.KeywordCxt=zg;function U_(e,t,r,n){let s=new zg(e,r,t);if("code"in r)r.code(s,n);else if(s.$data&&r.validate)qn.funcKeywordCode(s,r);else if("macro"in r)qn.macroKeywordCode(s,r);else if(r.compile||r.validate)qn.funcKeywordCode(s,r)}var H4=/^\/(?:[^~]|~0|~1)*$/,U4=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function z_(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let s,i;if(e==="")return xe.default.rootData;if(e[0]==="/"){if(!H4.test(e))throw Error(`Invalid JSON-pointer: ${e}`);s=e,i=xe.default.rootData}else{let c=U4.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 n[t-u]}if(u>t)throw Error(l("data",u));if(i=r[t-u],!s)return i}let o=i,a=s.split("/");for(let c of a)if(c)i=q._`${i}${q.getProperty(qt.unescapeJsonPointer(c))}`,o=q._`${o} && ${i}`;return o;function l(c,u){return`Cannot access ${c} ${u} levels up, current level is ${t}`}}G_.getData=z_});var pc=N(function(X_){Object.defineProperty(X_,"__esModule",{value:!0});class Y_ extends Error{constructor(e){super("validation failed");this.errors=e,this.ajv=this.validation=!0}}X_.default=Y_});var Na=N(function(Q_){Object.defineProperty(Q_,"__esModule",{value:!0});var Ca=dc();class Z_ extends Error{constructor(e,t,r,n){super(n||`can't resolve reference ${r} from id ${t}`);this.missingRef=Ca.resolveUrl(e,t,r),this.missingSchema=Ca.normalizeId(Ca.getFullPath(e,this.missingRef))}}Q_.default=Z_});var hc=N(function(rA){Object.defineProperty(rA,"__esModule",{value:!0});rA.resolveSchema=rA.getCompilingSchema=rA.resolveRef=rA.compileSchema=rA.SchemaEnv=void 0;var gt=we(),X4=pc(),mo=nn(),yt=dc(),rd=Oe(),eA=Oa();class mc{constructor(e){var t;this.refs={},this.dynamicAnchors={};let r;if(typeof e.schema=="object")r=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:yt.normalizeId(r===null||r===void 0?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=r===null||r===void 0?void 0:r.$async,this.refs={}}}rA.SchemaEnv=mc;function Kg(e){let t=tA.call(this,e);if(t)return t;let r=yt.getFullPath(this.opts.uriResolver,e.root.baseId),{es5:n,lines:s}=this.opts.code,{ownProperties:i}=this.opts,o=new gt.CodeGen(this.scope,{es5:n,lines:s,ownProperties:i}),a;if(e.$async)a=o.scopeValue("Error",{ref:X4.default,code:gt._`require("ajv/dist/runtime/validation_error").default`});let l=o.scopeName("validate");e.validateName=l;let c={gen:o,allErrors:this.opts.allErrors,data:mo.default.data,parentData:mo.default.parentData,parentDataProperty:mo.default.parentDataProperty,dataNames:[mo.default.data],dataPathArr:[gt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:o.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:gt.stringify(e.schema)}:{ref:e.schema}),validateName:l,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:gt.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:gt._`""`,opts:this.opts,self:this},u;try{this._compilations.add(e),eA.validateFunctionCode(c),o.optimize(this.opts.code.optimize);let p=o.toString();if(u=`${o.scopeRefs(mo.default.scope)}return ${p}`,this.opts.code.process)u=this.opts.code.process(u,e);let m=Function(`${mo.default.self}`,`${mo.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:p,scopeValues:o._values};if(this.opts.unevaluated){let{props:b,items:g}=c;if(m.evaluated={props:b instanceof gt.Name?void 0:b,items:g instanceof gt.Name?void 0:g,dynamicProps:b instanceof gt.Name,dynamicItems:g instanceof gt.Name},m.source)m.source.evaluated=gt.stringify(m.evaluated)}return e.validate=m,e}catch(p){if(delete e.validate,delete e.validateName,u)this.logger.error("Error compiling schema, function code:",u);throw p}finally{this._compilations.delete(e)}}rA.compileSchema=Kg;function Z4(e,t,r){var n;r=yt.resolveUrl(this.opts.uriResolver,t,r);let s=e.refs[r];if(s)return s;let i=t6.call(this,e,r);if(i===void 0){let o=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;if(o)i=new mc({schema:o,schemaId:a,root:e,baseId:t})}if(i===void 0)return;return e.refs[r]=Q4.call(this,i)}rA.resolveRef=Z4;function Q4(e){if(yt.inlineRef(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:Kg.call(this,e)}function tA(e){for(let t of this._compilations)if(e6(t,e))return t}rA.getCompilingSchema=tA;function e6(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function t6(e,t){let r;while(typeof(r=this.refs[t])=="string")t=r;return r||this.schemas[t]||nd.call(this,e,t)}function nd(e,t){let r=this.opts.uriResolver.parse(t),n=yt._getFullPath(this.opts.uriResolver,r),s=yt.getFullPath(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===s)return Gg.call(this,r,e);let i=yt.normalizeId(n),o=this.refs[i]||this.schemas[i];if(typeof o=="string"){let a=nd.call(this,e,o);if(typeof(a===null||a===void 0?void 0:a.schema)!=="object")return;return Gg.call(this,r,a)}if(typeof(o===null||o===void 0?void 0:o.schema)!=="object")return;if(!o.validate)Kg.call(this,o);if(i===yt.normalizeId(t)){let{schema:a}=o,{schemaId:l}=this.opts,c=a[l];if(c)s=yt.resolveUrl(this.opts.uriResolver,s,c);return new mc({schema:a,schemaId:l,root:e,baseId:s})}return Gg.call(this,r,o)}rA.resolveSchema=nd;var r6=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Gg(e,{baseId:t,schema:r,root:n}){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 r==="boolean")return;let l=r[rd.unescapeFragment(a)];if(l===void 0)return;r=l;let c=typeof r==="object"&&r[this.opts.schemaId];if(!r6.has(a)&&c)t=yt.resolveUrl(this.opts.uriResolver,t,c)}let i;if(typeof r!="boolean"&&r.$ref&&!rd.schemaHasRulesButRef(r,this.RULES)){let a=yt.resolveUrl(this.opts.uriResolver,t,r.$ref);i=nd.call(this,n,a)}let{schemaId:o}=this.opts;if(i=i||new mc({schema:r,schemaId:o,root:n,baseId:t}),i.schema!==i.root.schema)return i;return}});var sA=N(function(nle,a6){a6.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 ty=N(function(sle,dA){var l6=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Xg=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),c6=RegExp.prototype.test.bind(/^\d*$/u),ho=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),Zg=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),oA=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),Qg=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),u6=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),Ar=Array(256);for(let t=0;t<256;t++)Ar[t]="%"+"0123456789ABCDEF"[t>>4]+"0123456789ABCDEF"[t&15];function ir(e){if(e<2048)return Ar[192|e>>6]+Ar[128|e&63];if(e<65536)return Ar[224|e>>12]+Ar[128|e>>6&63]+Ar[128|e&63];return Ar[240|e>>18]+Ar[128|e>>12&63]+Ar[128|e>>6&63]+Ar[128|e&63]}function f6(e){let t="",r=0,n=0;for(n=0;n<e.length;n++){if(r=e[n].charCodeAt(0),r===48)continue;if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n];break}for(n+=1;n<e.length;n++){if(r=e[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n]}return t}var d6=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),p6=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),m6=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),h6=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function g6(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++){if(m6(e[t]))continue;if(e[t]==="%"&&t+2<e.length&&ho(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function iA(e){let t=-1,r=0,n=-1,s=0;for(let a=0;a<e.length;a++)if(e[a]==="0"){if(n===-1)n=a;if(s++,s>r)r=s,t=n}else n=-1,s=0;if(r<2)return e.join(":");let i=e.slice(0,t).join(":"),o=e.slice(t+r).join(":");return i+"::"+o}function y6(e){let t=e.indexOf("::");if(t!==-1&&e.indexOf("::",t+1)!==-1)return;let r=t===-1?e.split(":"):e.slice(0,t).split(":"),n=t===-1?[]:e.slice(t+2).split(":");if(t!==-1){if(r.length===1&&r[0]==="")r.length=0;if(n.length===1&&n[0]==="")n.length=0}let s=r.concat(n),i=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&&n.length===0||!Xg(l))return;i+=2;continue}if(!d6(l))return;s[a]=parseInt(l,16).toString(16),i++}if(t===-1){if(i!==8)return;return iA(s)}if(i>=8)return;let o=s.slice(0,r.length);for(let a=i;a<8;a++)o.push("0");for(let a=r.length;a<s.length;a++)o.push(s[a]);return iA(o)}function Yg(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 n=t?e.slice(1,-1):e;if(t&&p6(n))return n=n.toLowerCase(),{host:`[${n}]`,escapedHost:n,isIPV6:!1,isIPVFuture:!0};if(b6(n,":")<2)return{host:e,isIPV6:!1,error:t};let s="",i=n.indexOf("%");if(i!==-1){let a=n.slice(i,i+3).toLowerCase()==="%25"?3:1;if(s=n.slice(i+a),!g6(s))return{host:e,isIPV6:!1,error:!0};n=n.slice(0,i)}let o=y6(n);if(o===void 0)return{host:e,isIPV6:!1,error:!0};return{host:o+(s?"%"+s:""),escapedHost:o+(s?"%25"+s:""),isIPV6:!0}}function b6(e,t){let r=0;for(let n=0;n<e.length;n++)if(e[n]===t)r++;return r}function aA(e){let t=e,r=[],n=-1,s=0;while(s=t.length){if(s===1)if(t===".")break;else if(t==="/"){r.push("/");break}else{r.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]==="/"){r.push("/");break}}}else if(s===3){if(t==="/.."){if(r.length!==0)r.pop();r.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),r.length!==0)r.pop();continue}}}}if((n=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,n)),t=t.slice(n)}return r.join("")}function x6(e){if(e===""||e[0]==="/")return aA(e);let t=e.split("/"),r=t.length-1,n=[],s=!1;for(let i=0;i<=r;i++){let o=t[i];if(o==="."||o===".."){if(o==="..")if(n.length!==0&&n[n.length-1]!=="..")n.pop();else n.push("..");s=i===r}else n.push(o)}if(s&&n[n.length-1]!=="..")n.push("");if(n.length===0||n[0]===""||n[0].includes(":"))n.unshift(".");return n.join("/")}var $6={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},w6=/[@/?#:]/g,v6=/[@/?#]/g;function lA(e,t){let r=t?v6:w6;return r.lastIndex=0,e.replace(r,(n)=>$6[n])}function cA(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let n=0;n<e.length;n++){if(e[n]==="%"&&n+2<e.length){let s=e.slice(n+1,n+3);if(ho(s)){let i=s.toUpperCase(),o=String.fromCharCode(parseInt(i,16));if(t&&Zg(o))r+=o;else r+="%"+i;n+=2;continue}}r+=e[n]}return r}function S6(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let s=e.slice(r+1,r+3);if(ho(s)){let i=s.toUpperCase(),o=String.fromCharCode(parseInt(i,16));if(o!=="."&&Zg(o))t+=o;else t+="%"+i;r+=2;continue}}if(oA(n))t+=n;else{let s=e.charCodeAt(r);if(s<128)t+=fA(s)?n:Ar[s];else if(s<55296||s>57343)t+=ir(s);else if(s<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);if(i>=56320&&i<=57343)t+=ir(65536+(s-55296<<10)+(i-56320)),r++;else t+=ir(65533)}else t+=ir(65533)}}return t}function E6(e,t=!1){let r="",n=t&&e[0]!=="/";for(let s=0;s<e.length;s++){let i=e[s];if(i==="%"&&s+2<e.length){let o=e.slice(s+1,s+3);if(ho(o)){r+="%"+o.toUpperCase(),s+=2;continue}}if(i==="/")n=!1;if(oA(i)&&(i!==":"||!n))r+=i;else{let o=e.charCodeAt(s);if(o<128)r+=Ar[o];else if(o<55296||o>57343)r+=ir(o);else if(o<=56319&&s+1<e.length){let a=e.charCodeAt(s+1);if(a>=56320&&a<=57343)r+=ir(65536+(o-55296<<10)+(a-56320)),s++;else r+=ir(65533)}else r+=ir(65533)}}return r}function ey(e,t){let r="";for(let n=0;n<e.length;n++){let s=e[n];if(s==="%"&&n+2<e.length){let i=e.slice(n+1,n+3);if(ho(i)){r+="%"+i.toUpperCase(),n+=2;continue}}if(t(s))r+=s;else{let i=e.charCodeAt(n);if(i<128)r+=Ar[i];else if(i<55296||i>57343)r+=ir(i);else if(i<=56319&&n+1<e.length){let o=e.charCodeAt(n+1);if(o>=56320&&o<=57343)r+=ir(65536+(i-55296<<10)+(o-56320)),n++;else r+=ir(65533)}else r+=ir(65533)}}return r}function uA(e){return ey(e,u6)}function j6(e){return ey(e,Qg)}function P6(e){return ey(e,Qg)}function fA(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 k6(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let s=e.slice(r+1,r+3);if(ho(s)){let i=s.toUpperCase(),o=String.fromCharCode(parseInt(i,16));if(Zg(o))t+=o;else t+="%"+i;r+=2;continue}}if(Qg(n))t+=n;else{let s=e.charCodeAt(r);if(s<128)t+=fA(s)?n:Ar[s];else if(s<55296||s>57343)t+=ir(s);else if(s<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);if(i>=56320&&i<=57343)t+=ir(65536+(s-55296<<10)+(i-56320)),r++;else t+=ir(65533)}else t+=ir(65533)}}return t}function _6(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let n=e.slice(r+1,r+3);if(ho(n)){t+="%"+n.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function A6(e){let t=[];if(e.userinfo!==void 0)t.push(uA(e.userinfo)),t.push("@");if(e.host!==void 0){let r=e.host;if(!Xg(r)){let n=Yg(r);if(n.isIPV6!==!0&&n.isIPVFuture!==!0)r=cA(r,!0),n=Yg(r);if(n.isIPV6===!0||n.isIPVFuture===!0)r=`[${n.escapedHost}]`;else r=lA(r,!1)}t.push(r)}if(typeof e.port==="number"||typeof e.port==="string"){let r=String(e.port);if(!c6(r))throw TypeError("URI port is malformed.");t.push(":"),t.push(r)}return t.length?t.join(""):void 0}dA.exports={nonSimpleDomain:h6,recomposeAuthority:A6,reescapeHostDelimiters:lA,normalizePercentEncoding:cA,normalizePathEncoding:S6,serializePathEncoding:E6,normalizeQueryFragmentEncoding:k6,encodeUserinfo:uA,encodeQuery:j6,encodeFragment:P6,escapePreservingEscapes:_6,removeDotSegments:aA,removeDotSegmentsRelative:x6,isIPv4:Xg,isUUID:l6,normalizeIPv6:Yg,stringArrayToHexStripped:f6}});var yA=N(function(ile,gA){var{isUUID:R6}=ty(),O6=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,C6=["http","https","ws","wss","urn","urn:uuid"];function N6(e){return C6.indexOf(e)!==-1}function ry(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 pA(e){if(!e.host)e.error=e.error||"HTTP URIs must have a host.";return e}function mA(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 T6(e){return e.secure=ry(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function I6(e){if(e.port===(ry(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("?"),r=t===-1?e.resourceName:e.resourceName.slice(0,t);e.path=r&&r!=="/"?r:void 0,e.query=t===-1?void 0:e.resourceName.slice(t+1),e.resourceName=void 0}return e.fragment=void 0,e}function J6(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(O6);if(r&&r[0]===e.path){let n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let s=`${n}:${t.nid||e.nid}`,i=ny(s);if(e.path=void 0,i)e=i.parse(e,t)}else e.error=e.error||"URN can not be parsed.";return e}function M6(e,t){if(e.nid===void 0)throw Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),s=`${r}:${t.nid||n}`,i=ny(s);if(i)e=i.serialize(e,t);let o=e,a=e.nss;return o.path=`${n||t.nid}:${a}`,t.skipEscape=!0,o}function D6(e,t){let r=e;if(r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!R6(r.uuid)))r.error=r.error||"UUID is not valid.";return r}function L6(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var hA={scheme:"http",domainHost:!0,parse:pA,serialize:mA},F6={scheme:"https",domainHost:hA.domainHost,parse:pA,serialize:mA},sd={scheme:"ws",domainHost:!0,parse:T6,serialize:I6},q6={scheme:"wss",domainHost:sd.domainHost,parse:sd.parse,serialize:sd.serialize},V6={scheme:"urn",parse:J6,serialize:M6,skipNormalize:!0},W6={scheme:"urn:uuid",parse:D6,serialize:L6,skipNormalize:!0},id={http:hA,https:F6,ws:sd,wss:q6,urn:V6,"urn:uuid":W6};Object.setPrototypeOf(id,null);function ny(e){return e&&(id[e]||id[e.toLowerCase()])||void 0}gA.exports={wsIsSecure:ry,SCHEMES:id,isValidSchemeName:N6,getSchemeHandler:ny}});var OA=N(function(ole,cd){var{normalizeIPv6:vA,removeDotSegments:yc,removeDotSegmentsRelative:SA,recomposeAuthority:B6,normalizePercentEncoding:sy,normalizePathEncoding:H6,serializePathEncoding:bA,normalizeQueryFragmentEncoding:xA,encodeQuery:U6,encodeFragment:z6,reescapeHostDelimiters:G6,isIPv4:EA,nonSimpleDomain:K6}=ty(),{SCHEMES:jA,getSchemeHandler:iy}=yA(),PA=/^[A-Za-z][A-Za-z0-9+.-]*$/u,Y6=/[\0-\x20"#/:<>?@[\\\]^`{|}\x7F]/u;function $A(e){let t=String(e);if(!PA.test(t))throw TypeError("URI scheme is malformed.");return t}function X6(e,t){if(typeof e==="string")e=oz(e,t);else if(typeof e==="object")e=ad(go(e,t),t);return e}function Z6(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:s,malformedAuthorityOrPort:i,malformedPercentEncoding:o,malformedSchemeSpecific:a,malformedHost:l,malformedScheme:c}=od(e,n),{parsed:u,malformedAuthorityOrPort:p,malformedPercentEncoding:h,malformedSchemeSpecific:m,malformedHost:b,malformedScheme:g}=od(t,n);if(i||p||o||h||a||m||l||b||c||g)throw Error(s.error||u.error||"URI is malformed.");let y=kA(s,u,n,!0),w=iy(r&&r.scheme||y.scheme),j=y.host,S=j!==void 0&&j!==""&&(EA(j)||vA(j).isIPV6);if(AA(y,r||{},w,S))throw Error("URI host is malformed.");_A(y,r||{},w,S);let E=j&&j.indexOf("%")!==-1&&!/\P{ASCII}/u.test(j);if(y.error&&!E)throw Error(y.error);return n.skipEscape=!0,go(y,n)}function kA(e,t,r,n){let s={};if(!n)e=ad(go(e,r),r),t=ad(go(t,r),r);if(r=r||{},!r.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 i=e.userinfo!==void 0||e.host!==void 0||e.port!==void 0;if(i&&!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&&!i&&s.path[0]!=="/"?SA(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 Q6(e,t,r){let n=wA(e,r),s=wA(t,r);return n!==void 0&&s!==void 0&&n===s}function go(e,t){let r={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:""},n=Object.assign({},t),s=[];if(r.scheme)r.scheme=$A(r.scheme);let i=iy(n.scheme||r.scheme);if(i&&i.serialize)i.serialize(r,n);let o=r.userinfo!==void 0||r.host!==void 0||r.port!==void 0,a=(r.scheme===void 0||n.reference==="suffix")&&!o,l=!n.skipEscape&&a;if(r.path!==void 0)if(!n.skipEscape)r.path=bA(r.path,l);else r.path=sy(r.path);if(n.reference!=="suffix"&&r.scheme)r.scheme=$A(r.scheme),s.push(r.scheme,":");let c=B6(r);if(c!==void 0){if(n.reference!=="suffix")s.push("//");if(s.push(c),r.path&&r.path[0]!=="/")s.push("/")}if(r.path!==void 0){let u=r.path;if(!n.absolutePath&&(!i||!i.absolutePath))u=a&&u[0]!=="/"?SA(u):yc(u);if(a)u=bA(u,!0);if(c===void 0&&u[0]==="/"&&u[1]==="/")u="/%2F"+u.slice(2);s.push(u)}if(r.query!==void 0)s.push("?",U6(r.query));if(r.fragment!==void 0)s.push("#",z6(r.fragment));return s.join("")}var ez=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,tz=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,rz=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function nz(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 ld(e){return e[0]==="["&&e[e.length-1]==="]"}function sz(e){let t=e[4];return gc(e[3])||t!==void 0&&!ld(t)&&gc(t)||gc(e[6])||gc(e[7])||gc(e[8])}function _A(e,t,r,n){if(AA(e,t,r,n))return e.error=e.error||"URI host is malformed.",!0;if(!t.unicodeSupport&&(!r||!r.unicodeSupport)&&e.host&&!ld(e.host)&&(t.domainHost||r&&r.domainHost)&&n===!1&&K6(e.host)){let s;try{s=new URL("http://"+e.host)}catch(i){return e.error=e.error||"Host's domain name can not be converted to ASCII: "+i,!0}if(!iz(s))return e.error=e.error||"URI host is malformed.",!0;e.host=s.hostname}return!1}function AA(e,t,r,n){return Boolean(e.host&&n===!1&&!ld(e.host)&&(t.domainHost||r&&r.domainHost)&&Y6.test(e.host))}function iz(e){return e.username===""&&e.password===""&&e.port===""&&e.pathname==="/"&&e.search===""&&e.hash===""&&e.hostname!==""}function od(e,t){let r=Object.assign({},t),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},s=!1,i=!1,o=!1,a=!1,l=!1,c=!1,u=!1;if(r.reference==="suffix")if(r.scheme)e=r.scheme+":"+e;else e="//"+e;let p=e.match(tz);if(p!==null&&p[1].indexOf("\\")!==-1)n.error="URI authority must not contain a literal backslash.",s=!0;let h=e.match(rz);if(h!==null){let b=h[1],g=b.replace(/[\t\n\r]/g,"");if(g.length>=2){if(g.slice(0,2)!=="//")n.error=n.error||"URI authority must not contain a literal backslash.",s=!0;else if(b.length!==g.length)n.error=n.error||"URI authority introducer must not contain whitespace.",s=!0}}let m=e.match(ez);if(m){if(n.scheme=m[1],n.userinfo=m[3],n.host=m[4],n.port=parseInt(m[5],10),n.path=m[6]||"",n.query=m[7],n.fragment=m[8],n.scheme!==void 0)if(PA.test(n.scheme))n.scheme=n.scheme.toLowerCase();else n.error=n.error||"URI scheme is malformed.",c=!0;if(i=sz(m),i)n.error=n.error||"URI contains malformed percent-encoding.";if(isNaN(n.port))n.port=m[5];let b=nz(n,m);if(b!==void 0)n.error=n.error||b,s=!0;if(n.host)if(EA(n.host)===!1){let w=ld(n.host),j=n.host.indexOf("[")!==-1||n.host.indexOf("]")!==-1,S=vA(n.host);if(u=S.isIPV6||S.isIPVFuture===!0,l=j&&(!w||S.error===!0),n.host=u?S.host:S.host.toLowerCase(),l)n.error=n.error||"URI host is malformed.",s=!0}else u=!0;if(n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path)n.reference="same-document";else if(n.scheme===void 0)n.reference="relative";else if(n.fragment===void 0)n.reference="absolute";else n.reference="uri";if(r.reference&&r.reference!=="suffix"&&r.reference!==n.reference)n.error=n.error||"URI is not a "+r.reference+" reference.";let g=iy(r.scheme||n.scheme);if(!l)a=_A(n,r,g,u);if(e.indexOf("%")!==-1&&n.host!==void 0&&!l){let y=u?n.host:sy(n.host,!0);if(!u)y=sy(y.toLowerCase());n.host=u||r.scheme!=="null"?G6(y,u):y}if(!g||g&&!g.skipNormalize){if(n.path)n.path=H6(n.path);if(n.query)n.query=xA(n.query);if(n.fragment)n.fragment=xA(n.fragment)}if(g&&g.parse){if(g.parse(n,r),g===jA.urn&&n.nid===void 0)o=!0}}else n.error=n.error||"URI can not be parsed.";return{parsed:n,malformedAuthorityOrPort:s,malformedPercentEncoding:i,malformedSchemeSpecific:o,malformedHost:a,malformedScheme:c}}function ad(e,t){return od(e,t).parsed}function oz(e,t){return RA(e,t).normalized}function RA(e,t){let{parsed:r,malformedAuthorityOrPort:n,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:o,malformedScheme:a}=od(e,t);return{normalized:n||s||i||o||a?e:go(r,t),malformedAuthorityOrPort:n,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:o,malformedScheme:a}}function wA(e,t){if(typeof e!=="string"&&typeof e!=="object")return;let r;try{r=typeof e==="string"?e:go(e,t)}catch{return}let{normalized:n,malformedAuthorityOrPort:s,malformedPercentEncoding:i,malformedSchemeSpecific:o,malformedHost:a,malformedScheme:l}=RA(r,t);return s||i||o||a||l?void 0:n}var oy={SCHEMES:jA,normalize:X6,resolve:Z6,resolveComponent:kA,equal:Q6,serialize:go,parse:ad};cd.exports=oy;cd.exports.default=oy;cd.exports.fastUri=oy});var TA=N(function(NA){Object.defineProperty(NA,"__esModule",{value:!0});var CA=OA();CA.code='require("ajv/dist/runtime/uri").default';NA.default=CA});var ly=N(function(Ts){Object.defineProperty(Ts,"__esModule",{value:!0});Ts.CodeGen=Ts.Name=Ts.nil=Ts.stringify=Ts.str=Ts._=Ts.KeywordCxt=void 0;var lz=Oa();Object.defineProperty(Ts,"KeywordCxt",{enumerable:!0,get:function(){return lz.KeywordCxt}});var Ia=we();Object.defineProperty(Ts,"_",{enumerable:!0,get:function(){return Ia._}});Object.defineProperty(Ts,"str",{enumerable:!0,get:function(){return Ia.str}});Object.defineProperty(Ts,"stringify",{enumerable:!0,get:function(){return Ia.stringify}});Object.defineProperty(Ts,"nil",{enumerable:!0,get:function(){return Ia.nil}});Object.defineProperty(Ts,"Name",{enumerable:!0,get:function(){return Ia.Name}});Object.defineProperty(Ts,"CodeGen",{enumerable:!0,get:function(){return Ia.CodeGen}});var cz=pc(),LA=Na(),FA=Mg(),Vn=hc(),qA=we(),Wn=dc(),hi=fc(),Ta=Oe(),IA=sA(),uz=TA(),VA=(e,t)=>new RegExp(e,t);VA.code="new RegExp";var fz=["removeAdditional","useDefaults","coerceTypes"],dz=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),pz={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."},mz={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},JA=200;function hz(e){var t,r,n,s,i,o,a,l,c,u,p,h,m,b,g,y,w,j,S,E,P,A,R,_,I;let L=e.strict,J=(t=e.code)===null||t===void 0?void 0:t.optimize,F=J===!0||J===void 0?1:J||0,K=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:VA,ae=(s=e.uriResolver)!==null&&s!==void 0?s:uz.default;return{strictSchema:(o=(i=e.strictSchema)!==null&&i!==void 0?i:L)!==null&&o!==void 0?o:!0,strictNumbers:(l=(a=e.strictNumbers)!==null&&a!==void 0?a:L)!==null&&l!==void 0?l:!0,strictTypes:(u=(c=e.strictTypes)!==null&&c!==void 0?c:L)!==null&&u!==void 0?u:"log",strictTuples:(h=(p=e.strictTuples)!==null&&p!==void 0?p:L)!==null&&h!==void 0?h:"log",strictRequired:(b=(m=e.strictRequired)!==null&&m!==void 0?m:L)!==null&&b!==void 0?b:!1,code:e.code?{...e.code,optimize:F,regExp:K}:{optimize:F,regExp:K},loopRequired:(g=e.loopRequired)!==null&&g!==void 0?g:JA,loopEnum:(y=e.loopEnum)!==null&&y!==void 0?y:JA,meta:(w=e.meta)!==null&&w!==void 0?w:!0,messages:(j=e.messages)!==null&&j!==void 0?j:!0,inlineRefs:(S=e.inlineRefs)!==null&&S!==void 0?S:!0,schemaId:(E=e.schemaId)!==null&&E!==void 0?E:"$id",addUsedSchema:(P=e.addUsedSchema)!==null&&P!==void 0?P:!0,validateSchema:(A=e.validateSchema)!==null&&A!==void 0?A:!0,validateFormats:(R=e.validateFormats)!==null&&R!==void 0?R:!0,unicodeRegExp:(_=e.unicodeRegExp)!==null&&_!==void 0?_:!0,int32range:(I=e.int32range)!==null&&I!==void 0?I:!0,uriResolver:ae}}class ud{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,...hz(e)};let{es5:t,lines:r}=this.opts.code;this.scope=new qA.ValueScope({scope:{},prefixes:dz,es5:t,lines:r}),this.logger=wz(e.logger);let n=e.validateFormats;if(e.validateFormats=!1,this.RULES=FA.getRules(),MA.call(this,pz,e,"NOT SUPPORTED"),MA.call(this,mz,e,"DEPRECATED","warn"),this._metaOpts=xz.call(this),e.formats)yz.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords)bz.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);gz.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,n=IA;if(r==="id")n={...IA},n.id=n.$id,delete n.$id;if(t&&e)this.addMetaSchema(n,n[r],!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 r;if(typeof e=="string"){if(r=this.getSchema(e),!r)throw Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);let n=r(t);if(!("$async"in r))this.errors=r.errors;return n}compile(e,t){let r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:r}=this.opts;return n.call(this,e,t);async function n(c,u){await s.call(this,c.$schema);let p=this._addSchema(c,u);return p.validate||i.call(this,p)}async function s(c){if(c&&!this.getSchema(c))await n.call(this,{$ref:c},!0)}async function i(c){try{return this._compileSchemaEnv(c)}catch(u){if(!(u instanceof LA.default))throw u;return o.call(this,u),await a.call(this,u.missingSchema),i.call(this,c)}}function o({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]=r(c))}finally{delete this._loading[c]}}}addSchema(e,t,r,n=this.opts.validateSchema){if(Array.isArray(e)){for(let i of e)this.addSchema(i,void 0,r,n);return this}let s;if(typeof e==="object"){let{schemaId:i}=this.opts;if(s=e[i],s!==void 0&&typeof s!="string")throw Error(`schema ${i} must be string`)}return t=Wn.normalizeId(t||s),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,n,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){if(typeof e=="boolean")return!0;let r;if(r=e.$schema,r!==void 0&&typeof r!="string")throw Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let n=this.validate(r,e);if(!n&&t){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw Error(s)}return n}getSchema(e){let t;while(typeof(t=DA.call(this,e))=="string")e=t;if(t===void 0){let{schemaId:r}=this.opts,n=new Vn.SchemaEnv({schema:{},schemaId:r});if(t=Vn.resolveSchema.call(this,n,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=DA.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 r=e[this.opts.schemaId];if(r)r=Wn.normalizeId(r),delete this.schemas[r],delete this.refs[r];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 r;if(typeof e=="string"){if(r=e,typeof t=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r}else if(typeof e=="object"&&t===void 0){if(t=e,r=t.keyword,Array.isArray(r)&&!r.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(Sz.call(this,r,t),!t)return Ta.eachItem(r,(s)=>ay.call(this,s)),this;jz.call(this,t);let n={...t,type:hi.getJSONTypes(t.type),schemaType:hi.getJSONTypes(t.schemaType)};return Ta.eachItem(r,n.type.length===0?(s)=>ay.call(this,s,n):(s)=>n.type.forEach((i)=>ay.call(this,s,n,i))),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 r of t.rules){let n=r.rules.findIndex((s)=>s.keyword===e);if(n>=0)r.rules.splice(n,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:r="data"}={}){if(!e||e.length===0)return"No errors";return e.map((n)=>`${r}${n.instancePath} ${n.message}`).reduce((n,s)=>n+t+s)}$dataMetaSchema(e,t){let r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let n of t){let s=n.split("/").slice(1),i=e;for(let o of s)i=i[o];for(let o in r){let a=r[o];if(typeof a!="object")continue;let{$data:l}=a.definition,c=i[o];if(l&&c)i[o]=WA(c)}}return e}_removeAllSchemas(e,t){for(let r in e){let n=e[r];if(!t||t.test(r)){if(typeof n=="string")delete e[r];else if(n&&!n.meta)this._cache.delete(n.schema),delete e[r]}}}_addSchema(e,t,r,n=this.opts.validateSchema,s=this.opts.addUsedSchema){let i,{schemaId:o}=this.opts;if(typeof e=="object")i=e[o];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;r=Wn.normalizeId(i||r);let l=Wn.getSchemaRefs.call(this,e,r);if(a=new Vn.SchemaEnv({schema:e,schemaId:o,meta:t,baseId:r,localRefs:l}),this._cache.set(a.schema,a),s&&!r.startsWith("#")){if(r)this._checkUnique(r);this.refs[r]=a}if(n)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 Vn.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{Vn.compileSchema.call(this,e)}finally{this.opts=t}}}ud.ValidationError=cz.default;ud.MissingRefError=LA.default;Ts.default=ud;function MA(e,t,r,n="error"){for(let s in e){let i=s;if(i in t)this.logger[n](`${r}: option ${s}. ${e[i]}`)}}function DA(e){return e=Wn.normalizeId(e),this.schemas[e]||this.refs[e]}function gz(){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 yz(){for(let e in this.opts.formats){let t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function bz(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 r=e[t];if(!r.keyword)r.keyword=t;this.addKeyword(r)}}function xz(){let e={...this.opts};for(let t of fz)delete e[t];return e}var $z={log(){},warn(){},error(){}};function wz(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 vz=/^[a-z_$][a-z0-9_$:-]*$/i;function Sz(e,t){let{RULES:r}=this;if(Ta.eachItem(e,(n)=>{if(r.keywords[n])throw Error(`Keyword ${n} is already defined`);if(!vz.test(n))throw Error(`Keyword ${n} 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 ay(e,t,r){var n;let s=t===null||t===void 0?void 0:t.post;if(r&&s)throw Error('keyword with "post" flag cannot have "type"');let{RULES:i}=this,o=s?i.post:i.rules.find(({type:l})=>l===r);if(!o)o={type:r,rules:[]},i.rules.push(o);if(i.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:hi.getJSONTypes(t.type),schemaType:hi.getJSONTypes(t.schemaType)}};if(t.before)Ez.call(this,o,a,t.before);else o.rules.push(a);i.all[e]=a,(n=t.implements)===null||n===void 0||n.forEach((l)=>this.addKeyword(l))}function Ez(e,t,r){let n=e.rules.findIndex((s)=>s.keyword===r);if(n>=0)e.rules.splice(n,0,t);else e.rules.push(t),this.logger.warn(`rule ${r} is not defined`)}function jz(e){let{metaSchema:t}=e;if(t===void 0)return;if(e.$data&&this.opts.$data)t=WA(t);e.validateSchema=this.compile(t,!0)}var Pz={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function WA(e){return{anyOf:[e,Pz]}}});var HA=N(function(BA){Object.defineProperty(BA,"__esModule",{value:!0});var Az={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};BA.default=Az});var md=N(function(zA){Object.defineProperty(zA,"__esModule",{value:!0});zA.callRef=zA.getValidate=void 0;var Oz=Na(),dd=on(),Ye=we(),Ja=nn(),pd=hc(),gi=Oe(),Cz={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:s,schemaEnv:i,validateName:o,opts:a,self:l}=n,{root:c}=i;if((r==="#"||r==="#/")&&s===c.baseId)return p();let u=pd.resolveRef.call(l,c,s,r);if(u===void 0)throw new Oz.default(n.opts.uriResolver,s,r);if(u instanceof pd.SchemaEnv)return h(u);return m(u);function p(){if(i===c)return fd(e,o,i,i.$async);let b=t.scopeValue("root",{ref:c});return fd(e,Ye._`${b}.validate`,c,c.$async)}function h(b){let g=UA(e,b);fd(e,g,b,b.$async)}function m(b){let g=t.scopeValue("schema",a.code.source===!0?{ref:b,code:Ye.stringify(b)}:{ref:b}),y=t.name("valid"),w=e.subschema({schema:b,dataTypes:[],schemaPath:Ye.nil,topSchemaRef:g,errSchemaPath:r},y);e.mergeEvaluated(w),e.ok(y)}}};function UA(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):Ye._`${r.scopeValue("wrapper",{ref:t})}.validate`}zA.getValidate=UA;function fd(e,t,r,n){let{gen:s,it:i}=e,{allErrors:o,schemaEnv:a,opts:l}=i,c=l.passContext?Ja.default.this:Ye.nil;if(n)u();else p();function u(){if(!a.$async)throw Error("async schema referenced by sync schema");let b=s.let("valid");s.try(()=>{if(s.code(Ye._`await ${dd.callValidateCode(e,t,c)}`),m(t),!o)s.assign(b,!0)},(g)=>{if(s.if(Ye._`!(${g} instanceof ${i.ValidationError})`,()=>s.throw(g)),h(g),!o)s.assign(b,!1)}),e.ok(b)}function p(){e.result(dd.callValidateCode(e,t,c),()=>m(t),()=>h(t))}function h(b){let g=Ye._`${b}.errors`;s.assign(Ja.default.vErrors,Ye._`${Ja.default.vErrors} === null ? ${g} : ${Ja.default.vErrors}.concat(${g})`),s.assign(Ja.default.errors,Ye._`${Ja.default.vErrors}.length`)}function m(b){var g;if(!i.opts.unevaluated)return;let y=(g=r===null||r===void 0?void 0:r.validate)===null||g===void 0?void 0:g.evaluated;if(i.props!==!0)if(y&&!y.dynamicProps){if(y.props!==void 0)i.props=gi.mergeEvaluated.props(s,y.props,i.props)}else{let w=s.var("props",Ye._`${b}.evaluated.props`);i.props=gi.mergeEvaluated.props(s,w,i.props,Ye.Name)}if(i.items!==!0)if(y&&!y.dynamicItems){if(y.items!==void 0)i.items=gi.mergeEvaluated.items(s,y.items,i.items)}else{let w=s.var("items",Ye._`${b}.evaluated.items`);i.items=gi.mergeEvaluated.items(s,w,i.items,Ye.Name)}}}zA.callRef=fd;zA.default=Cz});var cy=N(function(KA){Object.defineProperty(KA,"__esModule",{value:!0});var Iz=HA(),Jz=md(),Mz=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Iz.default,Jz.default];KA.default=Mz});var XA=N(function(YA){Object.defineProperty(YA,"__esModule",{value:!0});var bi=we(),yi=bi.operators,hd={maximum:{okStr:"<=",ok:yi.LTE,fail:yi.GT},minimum:{okStr:">=",ok:yi.GTE,fail:yi.LT},exclusiveMaximum:{okStr:"<",ok:yi.LT,fail:yi.GTE},exclusiveMinimum:{okStr:">",ok:yi.GT,fail:yi.LTE}},Lz={message:({keyword:e,schemaCode:t})=>bi.str`must be ${hd[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>bi._`{comparison: ${hd[e].okStr}, limit: ${t}}`},Fz={keyword:Object.keys(hd),type:"number",schemaType:"number",$data:!0,error:Lz,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data(bi._`${r} ${hd[t].fail} ${n} || isNaN(${r})`)}};YA.default=Fz});var QA=N(function(ZA){Object.defineProperty(ZA,"__esModule",{value:!0});var Bn=we(),Vz={message:({schemaCode:e})=>Bn.str`must be multiple of ${e}`,params:({schemaCode:e})=>Bn._`{multipleOf: ${e}}`},Wz={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:Vz,code(e){let{gen:t,data:r,schemaCode:n,it:s}=e,i=s.opts.multipleOfPrecision,o=t.let("res"),a=i?Bn._`Math.abs(Math.round(${o}) - ${o}) > 1e-${i}`:Bn._`${o} !== parseInt(${o})`;e.fail$data(Bn._`(${n} === 0 || (${o} = ${r}/${n}, ${a}))`)}};ZA.default=Wz});var rR=N(function(tR){Object.defineProperty(tR,"__esModule",{value:!0});function eR(e){let t=e.length,r=0,n=0,s;while(n<t)if(r++,s=e.charCodeAt(n++),s>=55296&&s<=56319&&n<t){if(s=e.charCodeAt(n),(s&64512)===56320)n++}return r}tR.default=eR;eR.code='require("ajv/dist/runtime/ucs2length").default'});var iR=N(function(sR){Object.defineProperty(sR,"__esModule",{value:!0});var Rr=we(),nR=Oe(),Uz=rR(),zz={message({keyword:e,schemaCode:t}){return Rr.str`must NOT have ${e==="maxLength"?"more":"fewer"} than ${t} characters`},params:({schemaCode:e})=>Rr._`{limit: ${e}}`},Gz={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:zz,code(e){let{keyword:t,data:r,schemaCode:n,it:s}=e,i=t==="maxLength"?Rr.operators.GT:Rr.operators.LT,o=s.opts.unicode===!1?Rr._`${r}.length`:Rr._`${nR.useFunc(e.gen,Uz.default)}(${r})`;e.fail$data(Rr._`${o} ${i} ${n}`)}};sR.default=Gz});var cR=N(function(lR){Object.defineProperty(lR,"__esModule",{value:!0});var oR=on(),aR=Oe(),an=we(),Yz={message:({schemaCode:e})=>an.str`must match pattern "${e}"`,params:({schemaCode:e})=>an._`{pattern: ${e}}`},Xz={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:Yz,code(e){let{gen:t,data:r,$data:n,schema:s,schemaCode:i,it:o}=e,a=o.opts.unicodeRegExp?"u":"";if(n){let{regExp:l}=o.opts.code,c=l.code==="new RegExp"?an._`new RegExp`:aR.useFunc(t,l),u=t.let("valid");t.try(()=>t.assign(u,an._`${c}(${i}, ${a}).test(${r})`),()=>t.assign(u,!1)),e.fail$data(an._`!${u}`)}else{let l=oR.usePattern(e,s);e.fail$data(an._`!${l}.test(${r})`)}}};lR.default=Xz});var fR=N(function(uR){Object.defineProperty(uR,"__esModule",{value:!0});var Hn=we(),Qz={message({keyword:e,schemaCode:t}){return Hn.str`must NOT have ${e==="maxProperties"?"more":"fewer"} than ${t} properties`},params:({schemaCode:e})=>Hn._`{limit: ${e}}`},e8={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:Qz,code(e){let{keyword:t,data:r,schemaCode:n}=e,s=t==="maxProperties"?Hn.operators.GT:Hn.operators.LT;e.fail$data(Hn._`Object.keys(${r}).length ${s} ${n}`)}};uR.default=e8});var mR=N(function(pR){Object.defineProperty(pR,"__esModule",{value:!0});var Un=on(),zn=we(),dR=Oe(),r8={message:({params:{missingProperty:e}})=>zn.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>zn._`{missingProperty: ${e}}`},n8={keyword:"required",type:"object",schemaType:"array",$data:!0,error:r8,code(e){let{gen:t,schema:r,schemaCode:n,data:s,$data:i,it:o}=e,{opts:a}=o;if(!i&&r.length===0)return;let l=r.length>=a.loopRequired;if(o.allErrors)c();else u();if(a.strictRequired){let m=e.parentSchema.properties,{definedProperties:b}=e.it;for(let g of r)if((m===null||m===void 0?void 0:m[g])===void 0&&!b.has(g)){let y=o.schemaEnv.baseId+o.errSchemaPath,w=`required property "${g}" is not defined at "${y}" (strictRequired)`;dR.checkStrictMode(o,w,o.opts.strictRequired)}}function c(){if(l||i)e.block$data(zn.nil,p);else for(let m of r)Un.checkReportMissingProp(e,m)}function u(){let m=t.let("missing");if(l||i){let b=t.let("valid",!0);e.block$data(b,()=>h(m,b)),e.ok(b)}else t.if(Un.checkMissingProp(e,r,m)),Un.reportMissingProp(e,m),t.else()}function p(){t.forOf("prop",n,(m)=>{e.setParams({missingProperty:m}),t.if(Un.noPropertyInData(t,s,m,a.ownProperties),()=>e.error())})}function h(m,b){e.setParams({missingProperty:m}),t.forOf(m,n,()=>{t.assign(b,Un.propertyInData(t,s,m,a.ownProperties)),t.if(zn.not(b),()=>{e.error(),t.break()})},zn.nil)}}};pR.default=n8});var gR=N(function(hR){Object.defineProperty(hR,"__esModule",{value:!0});var Gn=we(),i8={message({keyword:e,schemaCode:t}){return Gn.str`must NOT have ${e==="maxItems"?"more":"fewer"} than ${t} items`},params:({schemaCode:e})=>Gn._`{limit: ${e}}`},o8={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:i8,code(e){let{keyword:t,data:r,schemaCode:n}=e,s=t==="maxItems"?Gn.operators.GT:Gn.operators.LT;e.fail$data(Gn._`${r}.length ${s} ${n}`)}};hR.default=o8});var gd=N(function(bR){Object.defineProperty(bR,"__esModule",{value:!0});var yR=Bg();yR.code='require("ajv/dist/runtime/equal").default';bR.default=yR});var wR=N(function($R){Object.defineProperty($R,"__esModule",{value:!0});var Ma=fc(),Le=we(),xR=Oe(),c8=gd(),u8={message:({params:{i:e,j:t}})=>Le.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>Le._`{i: ${e}, j: ${t}}`},f8={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:u8,code(e){let{gen:t,data:r,$data:n,schema:s,parentSchema:i,schemaCode:o,it:a}=e;if(!n&&!s)return;let l=t.let("valid"),c=i.items?Ma.getSchemaTypes(i.items):[];e.block$data(l,u,Le._`${o} === false`),e.ok(l);function u(){let b=t.let("i",Le._`${r}.length`),g=t.let("j");e.setParams({i:b,j:g}),t.assign(l,!0),t.if(Le._`${b} > 1`,()=>(p()?h:m)(b,g))}function p(){return c.length>0&&!c.some((b)=>b==="object"||b==="array")}function h(b,g){let y=t.name("item"),w=Ma.checkDataTypes(c,y,a.opts.strictNumbers,Ma.DataType.Wrong),j=t.const("indices",Le._`{}`);t.for(Le._`;${b}--;`,()=>{if(t.let(y,Le._`${r}[${b}]`),t.if(w,Le._`continue`),c.length>1)t.if(Le._`typeof ${y} == "string"`,Le._`${y} += "_"`);t.if(Le._`typeof ${j}[${y}] == "number"`,()=>{t.assign(g,Le._`${j}[${y}]`),e.error(),t.assign(l,!1).break()}).code(Le._`${j}[${y}] = ${b}`)})}function m(b,g){let y=xR.useFunc(t,c8.default),w=t.name("outer");t.label(w).for(Le._`;${b}--;`,()=>t.for(Le._`${g} = ${b}; ${g}--;`,()=>t.if(Le._`${y}(${r}[${b}], ${r}[${g}])`,()=>{e.error(),t.assign(l,!1).break(w)})))}}};$R.default=f8});var ER=N(function(SR){Object.defineProperty(SR,"__esModule",{value:!0});var Da=we(),vR=Oe(),p8=gd(),m8={message:"must be equal to constant",params:({schemaCode:e})=>Da._`{allowedValue: ${e}}`},h8={keyword:"const",$data:!0,error:m8,code(e){let{gen:t,data:r,$data:n,schemaCode:s,schema:i}=e;if(n||i&&typeof i=="object")e.fail$data(Da._`!${vR.useFunc(t,p8.default)}(${r}, ${s})`);else e.fail(Da._`${i} !== ${r}`)}};SR.default=h8});var kR=N(function(PR){Object.defineProperty(PR,"__esModule",{value:!0});var Kn=we(),jR=Oe(),y8=gd(),b8={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>Kn._`{allowedValues: ${e}}`},x8={keyword:"enum",schemaType:"array",$data:!0,error:b8,code(e){let{gen:t,data:r,$data:n,schema:s,schemaCode:i,it:o}=e;if(!n&&s.length===0)throw Error("enum must have non-empty array");let a=s.length>=o.opts.loopEnum,l,c=()=>l!==null&&l!==void 0?l:l=jR.useFunc(t,y8.default),u;if(a||n)u=t.let("valid"),e.block$data(u,p);else{if(!Array.isArray(s))throw Error("ajv implementation error");let m=t.const("vSchema",i);u=Kn.or(...s.map((b,g)=>h(m,g)))}e.pass(u);function p(){t.assign(u,!1),t.forOf("v",i,(m)=>t.if(Kn._`${c()}(${r}, ${m})`,()=>t.assign(u,!0).break()))}function h(m,b){let g=s[b];return typeof g==="object"&&g!==null?Kn._`${c()}(${r}, ${m}[${b}])`:Kn._`${r} === ${g}`}}};PR.default=x8});var uy=N(function(_R){Object.defineProperty(_R,"__esModule",{value:!0});var w8=XA(),v8=QA(),S8=iR(),E8=cR(),j8=fR(),P8=mR(),k8=gR(),_8=wR(),A8=ER(),R8=kR(),O8=[w8.default,v8.default,S8.default,E8.default,j8.default,P8.default,k8.default,_8.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},A8.default,R8.default];_R.default=O8});var fy=N(function(RR){Object.defineProperty(RR,"__esModule",{value:!0});RR.validateAdditionalItems=void 0;var Or=we(),La=Oe(),N8={message:({params:{len:e}})=>Or.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Or._`{limit: ${e}}`},T8={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:N8,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){La.checkStrictMode(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}AR(e,n)}};function AR(e,t){let{gen:r,schema:n,data:s,keyword:i,it:o}=e;o.items=!0;let a=r.const("len",Or._`${s}.length`);if(n===!1)e.setParams({len:t.length}),e.pass(Or._`${a} <= ${t.length}`);else if(typeof n=="object"&&!La.alwaysValidSchema(o,n)){let c=r.var("valid",Or._`${a} <= ${t.length}`);r.if(Or.not(c),()=>l(c)),e.ok(c)}function l(c){r.forRange("i",t.length,a,(u)=>{if(e.subschema({keyword:i,dataProp:u,dataPropType:La.Type.Num},c),!o.allErrors)r.if(Or.not(c),()=>r.break())})}}RR.validateAdditionalItems=AR;RR.default=T8});var dy=N(function(TR){Object.defineProperty(TR,"__esModule",{value:!0});TR.validateTuple=void 0;var yd=we(),xi=Oe(),CR=on(),J8={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return NR(e,"additionalItems",t);if(r.items=!0,xi.alwaysValidSchema(r,t))return;e.ok(CR.validateArray(e))}};function NR(e,t,r=e.schema){let{gen:n,parentSchema:s,data:i,keyword:o,it:a}=e;if(u(s),a.opts.unevaluated&&r.length&&a.items!==!0)a.items=xi.mergeEvaluated.items(n,r.length,a.items);let l=n.name("valid"),c=n.const("len",yd._`${i}.length`);r.forEach((p,h)=>{if(xi.alwaysValidSchema(a,p))return;n.if(yd._`${c} > ${h}`,()=>e.subschema({keyword:o,schemaProp:h,dataProp:h},l)),e.ok(l)});function u(p){let{opts:h,errSchemaPath:m}=a,b=r.length,g=b===p.minItems&&(b===p.maxItems||p[t]===!1);if(h.strictTuples&&!g){let y=`"${o}" is ${b}-tuple, but minItems or maxItems/${t} are not specified or different at path "${m}"`;xi.checkStrictMode(a,y,h.strictTuples)}}}TR.validateTuple=NR;TR.default=J8});var DR=N(function(MR){Object.defineProperty(MR,"__esModule",{value:!0});var JR=dy(),D8={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(e)=>JR.validateTuple(e,"items")};MR.default=D8});var WR=N(function(VR){Object.defineProperty(VR,"__esModule",{value:!0});var bd=we(),LR=Oe(),FR=on(),qR=fy(),F8={message:({params:{len:e}})=>bd.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>bd._`{limit: ${e}}`},q8={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:F8,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:s}=r;if(n.items=!0,LR.alwaysValidSchema(n,t))return;if(s)qR.validateAdditionalItems(e,s);else e.ok(FR.validateArray(e))}};VR.default=q8});var HR=N(function(BR){Object.defineProperty(BR,"__esModule",{value:!0});var ct=we(),$i=Oe(),W8={message:({params:{min:e,max:t}})=>t===void 0?ct.str`must contain at least ${e} valid item(s)`:ct.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?ct._`{minContains: ${e}}`:ct._`{minContains: ${e}, maxContains: ${t}}`},B8={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:W8,code(e){let{gen:t,schema:r,parentSchema:n,data:s,it:i}=e,o,a,{minContains:l,maxContains:c}=n;if(i.opts.next)o=l===void 0?1:l,a=c;else o=1;let u=t.const("len",ct._`${s}.length`);if(e.setParams({min:o,max:a}),a===void 0&&o===0){$i.checkStrictMode(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&o>a){$i.checkStrictMode(i,'"minContains" > "maxContains" is always invalid'),e.fail();return}if($i.alwaysValidSchema(i,r)){let g=ct._`${u} >= ${o}`;if(a!==void 0)g=ct._`${g} && ${u} <= ${a}`;e.pass(g);return}i.items=!0;let p=t.name("valid");if(a===void 0&&o===1)m(p,()=>t.if(p,()=>t.break()));else if(o===0){if(t.let(p,!0),a!==void 0)t.if(ct._`${s}.length > 0`,h)}else t.let(p,!1),h();e.result(p,()=>e.reset());function h(){let g=t.name("_valid"),y=t.let("count",0);m(g,()=>t.if(g,()=>b(y)))}function m(g,y){t.forRange("i",0,u,(w)=>{e.subschema({keyword:"contains",dataProp:w,dataPropType:$i.Type.Num,compositeRule:!0},g),y()})}function b(g){if(t.code(ct._`${g}++`),a===void 0)t.if(ct._`${g} >= ${o}`,()=>t.assign(p,!0).break());else if(t.if(ct._`${g} > ${a}`,()=>t.assign(p,!1).break()),o===1)t.assign(p,!0);else t.if(ct._`${g} >= ${o}`,()=>t.assign(p,!0))}}};BR.default=B8});var xd=N(function(KR){Object.defineProperty(KR,"__esModule",{value:!0});KR.validateSchemaDeps=KR.validatePropertyDeps=KR.error=void 0;var Fa=we(),UR=Oe(),Yn=on();KR.error={message:({params:{property:e,depsCount:t,deps:r}})=>Fa.str`must have ${t===1?"property":"properties"} ${r} when property ${e} is present`,params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>Fa._`{property: ${e},
624
+ || ${o} === "boolean" || ${s} === null`).assign(a,z._`[${s}]`)}}}function C4({gen:e,parentData:t,parentDataProperty:r},n){e.if(z._`${t} !== undefined`,()=>e.assign(z._`${t}[${r}]`,n))}function ay(e,t,r,n=Ta.Correct){let s=n===Ta.Correct?z.operators.EQ:z.operators.NEQ,i;switch(e){case"null":return z._`${t} ${s} null`;case"array":i=z._`Array.isArray(${t})`;break;case"object":i=z._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":i=o(z._`!(${t} % 1) && !isNaN(${t})`);break;case"number":i=o();break;default:return z._`typeof ${t} ${s} ${e}`}return n===Ta.Correct?i:z.not(i);function o(a=z.nil){return z.and(z._`typeof ${t} == "number"`,a,r?z._`isFinite(${t})`:z.nil)}}F_.checkDataType=ay;function ly(e,t,r,n){if(e.length===1)return ay(e[0],t,r,n);let s,i=md.toHash(e);if(i.array&&i.object){let o=z._`typeof ${t} != "object"`;s=i.null?o:z._`!${t} || ${o}`,delete i.null,delete i.array,delete i.object}else s=z.nil;if(i.number)delete i.integer;for(let o in i)s=z.and(s,ay(o,t,r,n));return s}F_.checkDataTypes=ly;var T4={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?z._`{type: ${e}}`:z._`{type: ${t}}`};function cy(e){let t=I4(e);M_.reportError(t,T4)}F_.reportTypeError=cy;function I4(e){let{gen:t,data:r,schema:n}=e,s=md.schemaRefOrVal(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:s,schemaValue:s,parentSchema:n,params:{},it:e}}});var H_=T(function(W_){Object.defineProperty(W_,"__esModule",{value:!0});W_.assignDefaults=void 0;var an=we(),B_=Oe();function V4(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let s in r)V_(e,s,r[s].default);else if(t==="array"&&Array.isArray(n))n.forEach((s,i)=>V_(e,i,s.default))}W_.assignDefaults=V4;function V_(e,t,r){let{gen:n,compositeRule:s,data:i,opts:o}=e;if(r===void 0)return;let a=an._`${i}${an.getProperty(t)}`;if(s){B_.checkStrictMode(e,`default is ignored for: ${a}`);return}let l=an._`${a} === undefined`;if(o.useDefaults==="empty")l=an._`${l} || ${a} === null || ${a} === ""`;n.if(l,an._`${a} = ${an.stringify(r)}`)}});var ln=T(function(X_){Object.defineProperty(X_,"__esModule",{value:!0});X_.validateUnion=X_.validateArray=X_.usePattern=X_.callValidateCode=X_.schemaProperties=X_.allSchemaProperties=X_.noPropertyInData=X_.propertyInData=X_.isOwnProperty=X_.hasPropFunc=X_.reportMissingProp=X_.checkMissingProp=X_.checkReportMissingProp=void 0;var he=we(),Ia=Oe(),hi=on(),z_=Oe();function B4(e,t){let{gen:r,data:n,it:s}=e;r.if(fy(r,n,t,s.opts.ownProperties),()=>{e.setParams({missingProperty:he._`${t}`},!0),e.error()})}X_.checkReportMissingProp=B4;function W4({gen:e,data:t,it:{opts:r}},n,s){return he.or(...n.map((i)=>he.and(fy(e,t,i,r.ownProperties),he._`${s} = ${i}`)))}X_.checkMissingProp=W4;function U4(e,t){e.setParams({missingProperty:t},!0),e.error()}X_.reportMissingProp=U4;function G_(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:he._`Object.prototype.hasOwnProperty`})}X_.hasPropFunc=G_;function uy(e,t,r){return he._`${G_(e)}.call(${t}, ${r})`}X_.isOwnProperty=uy;function H4(e,t,r,n){let s=he._`${t}${he.getProperty(r)} !== undefined`;return n?he._`${s} && ${uy(e,t,r)}`:s}X_.propertyInData=H4;function fy(e,t,r,n){let s=he._`${t}${he.getProperty(r)} === undefined`;return n?he.or(s,he.not(uy(e,t,r))):s}X_.noPropertyInData=fy;function K_(e){return e?Object.keys(e).filter((t)=>t!=="__proto__"):[]}X_.allSchemaProperties=K_;function z4(e,t){return K_(t).filter((r)=>!Ia.alwaysValidSchema(e,t[r]))}X_.schemaProperties=z4;function G4({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:s,errorPath:i},it:o},a,l,c){let u=c?he._`${e}, ${t}, ${n}${s}`:t,p=[[hi.default.instancePath,he.strConcat(hi.default.instancePath,i)],[hi.default.parentData,o.parentData],[hi.default.parentDataProperty,o.parentDataProperty],[hi.default.rootData,hi.default.rootData]];if(o.opts.dynamicRef)p.push([hi.default.dynamicAnchors,hi.default.dynamicAnchors]);let h=he._`${u}, ${r.object(...p)}`;return l!==he.nil?he._`${a}.call(${l}, ${h})`:he._`${a}(${h})`}X_.callValidateCode=G4;var K4=he._`new RegExp`;function X4({gen:e,it:{opts:t}},r){let n=t.unicodeRegExp?"u":"",{regExp:s}=t.code,i=s(r,n);return e.scopeValue("pattern",{key:i.toString(),ref:i,code:he._`${s.code==="new RegExp"?K4:z_.useFunc(e,s)}(${r}, ${n})`})}X_.usePattern=X4;function Y4(e){let{gen:t,data:r,keyword:n,it:s}=e,i=t.name("valid");if(s.allErrors){let a=t.let("valid",!0);return o(()=>t.assign(a,!1)),a}return t.var(i,!0),o(()=>t.break()),i;function o(a){let l=t.const("len",he._`${r}.length`);t.forRange("i",0,l,(c)=>{e.subschema({keyword:n,dataProp:c,dataPropType:Ia.Type.Num},i),t.if(he.not(i),a)})}}X_.validateArray=Y4;function Z4(e){let{gen:t,schema:r,keyword:n,it:s}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(r.some((l)=>Ia.alwaysValidSchema(s,l))&&!s.opts.unevaluated)return;let o=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((l,c)=>{let u=e.subschema({keyword:n,schemaProp:c,compositeRule:!0},a);if(t.assign(o,he._`${o} || ${a}`),!e.mergeValidEvaluated(u,a))t.if(he.not(o))})),e.result(o,()=>e.reset(),()=>e.error(!0))}X_.validateUnion=Z4});var sA=T(function(rA){Object.defineProperty(rA,"__esModule",{value:!0});rA.validateKeywordUsage=rA.validSchemaType=rA.funcKeywordCode=rA.macroKeywordCode=void 0;var He=we(),yo=on(),Q_=ln(),eA=Sc();function f8(e,t){let{gen:r,keyword:n,schema:s,parentSchema:i,it:o}=e,a=t.macro.call(o.self,s,i,o),l=tA(r,n,a);if(o.opts.validateSchema!==!1)o.self.validateSchema(a,!0);let c=r.name("valid");e.subschema({schema:a,schemaPath:He.nil,errSchemaPath:`${o.errSchemaPath}/${n}`,topSchemaRef:l,compositeRule:!0},c),e.pass(c,()=>e.error(!0))}rA.macroKeywordCode=f8;function d8(e,t){var r;let{gen:n,keyword:s,schema:i,parentSchema:o,$data:a,it:l}=e;m8(l,t);let c=!a&&t.compile?t.compile.call(l.self,i,o,l):t.validate,u=tA(n,s,c),p=n.let("valid");e.block$data(p,h),e.ok((r=t.valid)!==null&&r!==void 0?r:p);function h(){if(t.errors===!1){if(g(),t.modifying)Z_(e);b(()=>e.error())}else{let w=t.async?m():y();if(t.modifying)Z_(e);b(()=>p8(e,w))}}function m(){let w=n.let("ruleErrs",null);return n.try(()=>g(He._`await `),(j)=>n.assign(p,!1).if(He._`${j} instanceof ${l.ValidationError}`,()=>n.assign(w,He._`${j}.errors`),()=>n.throw(j))),w}function y(){let w=He._`${u}.errors`;return n.assign(w,null),g(He.nil),w}function g(w=t.async?He._`await `:He.nil){let j=l.opts.passContext?yo.default.this:yo.default.self,S=!(("compile"in t)&&!a||t.schema===!1);n.assign(p,He._`${w}${Q_.callValidateCode(e,u,j,S)}`,t.modifying)}function b(w){var j;n.if(He.not((j=t.valid)!==null&&j!==void 0?j:p),w)}}rA.funcKeywordCode=d8;function Z_(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,He._`${n.parentData}[${n.parentDataProperty}]`))}function p8(e,t){let{gen:r}=e;r.if(He._`Array.isArray(${t})`,()=>{r.assign(yo.default.vErrors,He._`${yo.default.vErrors} === null ? ${t} : ${yo.default.vErrors}.concat(${t})`).assign(yo.default.errors,He._`${yo.default.vErrors}.length`),eA.extendErrors(e)},()=>e.error())}function m8({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}function tA(e,t,r){if(r===void 0)throw Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:He.stringify(r)})}function h8(e,t,r=!1){return!t.length||t.some((n)=>n==="array"?Array.isArray(e):n==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==n||r&&typeof e>"u")}rA.validSchemaType=h8;function g8({schema:e,opts:t,self:r,errSchemaPath:n},s,i){if(Array.isArray(s.keyword)?!s.keyword.includes(i):s.keyword!==i)throw Error("ajv implementation error");let o=s.dependencies;if(o===null||o===void 0?void 0:o.some((a)=>!Object.prototype.hasOwnProperty.call(e,a)))throw Error(`parent schema must have dependencies of ${i}: ${o.join(",")}`);if(s.validateSchema){if(!s.validateSchema(e[i])){let l=`keyword "${i}" value is invalid at path "${n}": `+r.errorsText(s.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(l);else throw Error(l)}}}rA.validateKeywordUsage=g8});var aA=T(function(iA){Object.defineProperty(iA,"__esModule",{value:!0});iA.extendSubschemaMode=iA.extendSubschemaData=iA.getSubschema=void 0;var Rt=we(),hd=Oe();function $8(e,{keyword:t,schemaProp:r,schema:n,schemaPath:s,errSchemaPath:i,topSchemaRef:o}){if(t!==void 0&&n!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let a=e.schema[t];return r===void 0?{schema:a,schemaPath:Rt._`${e.schemaPath}${Rt.getProperty(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:Rt._`${e.schemaPath}${Rt.getProperty(t)}${Rt.getProperty(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${hd.escapeFragment(r)}`}}if(n!==void 0){if(s===void 0||i===void 0||o===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:s,topSchemaRef:o,errSchemaPath:i}}throw Error('either "keyword" or "schema" must be passed')}iA.getSubschema=$8;function w8(e,t,{dataProp:r,dataPropType:n,data:s,dataTypes:i,propertyName:o}){if(s!==void 0&&r!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(r!==void 0){let{errorPath:c,dataPathArr:u,opts:p}=t,h=a.let("data",Rt._`${t.data}${Rt.getProperty(r)}`,!0);l(h),e.errorPath=Rt.str`${c}${hd.getErrorPath(r,n,p.jsPropertySyntax)}`,e.parentDataProperty=Rt._`${r}`,e.dataPathArr=[...u,e.parentDataProperty]}if(s!==void 0){let c=s instanceof Rt.Name?s:a.let("data",s,!0);if(l(c),o!==void 0)e.propertyName=o}if(i)e.dataTypes=i;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]}}iA.extendSubschemaData=w8;function v8(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:s,allErrors:i}){if(n!==void 0)e.compositeRule=n;if(s!==void 0)e.createErrors=s;if(i!==void 0)e.allErrors=i;e.jtdDiscriminator=t,e.jtdMetadata=r}iA.extendSubschemaMode=v8});var dy=T(function(_ce,lA){lA.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,s,i;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(s=n;s--!==0;)if(!e(t[s],r[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(i=Object.keys(t),n=i.length,n!==Object.keys(r).length)return!1;for(s=n;s--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[s]))return!1;for(s=n;s--!==0;){var o=i[s];if(!e(t[o],r[o]))return!1}return!0}return t!==t&&r!==r}});var uA=T(function(Ace,cA){var gi=cA.exports=function(e,t,r){if(typeof t=="function")r=t,t={};r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},s=r.post||function(){};gd(t,n,s,e,"",e)};gi.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};gi.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};gi.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};gi.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 gd(e,t,r,n,s,i,o,a,l,c){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,s,i,o,a,l,c);for(var u in n){var p=n[u];if(Array.isArray(p)){if(u in gi.arrayKeywords)for(var h=0;h<p.length;h++)gd(e,t,r,p[h],s+"/"+u+"/"+h,i,s,u,n,h)}else if(u in gi.propsKeywords){if(p&&typeof p=="object")for(var m in p)gd(e,t,r,p[m],s+"/"+u+"/"+P8(m),i,s,u,n,m)}else if(u in gi.keywords||e.allKeys&&!(u in gi.skipKeywords))gd(e,t,r,p,s+"/"+u,i,s,u,n)}r(n,s,i,o,a,l,c)}}function P8(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Pc=T(function(hA){Object.defineProperty(hA,"__esModule",{value:!0});hA.getSchemaRefs=hA.resolveUrl=hA.normalizeId=hA._getFullPath=hA.getFullPath=hA.inlineRef=void 0;var fA=Oe(),j8=dy(),k8=uA(),_8=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function A8(e,t=!0){if(typeof e=="boolean")return!0;if(t===!0)return!py(e);if(!t)return!1;return dA(e)<=t}hA.inlineRef=A8;var R8=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function py(e){for(let t in e){if(R8.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(py))return!0;if(typeof r=="object"&&py(r))return!0}return!1}function dA(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,_8.has(r))continue;if(typeof e[r]=="object")fA.eachItem(e[r],(n)=>t+=dA(n));if(t===1/0)return 1/0}return t}function pA(e,t="",r){if(r!==!1)t=Ja(t);let n=e.parse(t);return mA(e,n)}hA.getFullPath=pA;function mA(e,t){return e.serialize(t).split("#")[0]+"#"}hA._getFullPath=mA;var O8=/#\/?$/;function Ja(e){return e?e.replace(O8,""):""}hA.normalizeId=Ja;function N8(e,t,r){return r=Ja(r),e.resolve(t,r)}hA.resolveUrl=N8;var C8=/^[a-z_][-a-z0-9._]*$/i;function T8(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,s=Ja(e[r]||t),i={"":s},o=pA(n,s,!1),a={},l=new Set;return k8(e,{allKeys:!0},(p,h,m,y)=>{if(y===void 0)return;let g=o+h,b=i[y];if(typeof p[r]=="string")b=w.call(this,p[r]);j.call(this,p.$anchor),j.call(this,p.$dynamicAnchor),i[h]=b;function w(S){let E=this.opts.uriResolver.resolve;if(S=Ja(b?E(b,S):S),l.has(S))throw u(S);l.add(S);let P=this.refs[S];if(typeof P=="string")P=this.refs[P];if(typeof P=="object")c(p,P.schema,S);else if(S!==Ja(g))if(S[0]==="#")c(p,a[S],S),a[S]=p;else this.refs[S]=g;return S}function j(S){if(typeof S=="string"){if(!C8.test(S))throw Error(`invalid anchor "${S}"`);w.call(this,`#${S}`)}}}),a;function c(p,h,m){if(h!==void 0&&!j8(p,h))throw u(m)}function u(p){return Error(`reference "${p}" resolves to more than one schema`)}}hA.getSchemaRefs=T8});var La=T(function(OA){Object.defineProperty(OA,"__esModule",{value:!0});OA.getData=OA.KeywordCxt=OA.validateFunctionCode=void 0;var bd=__(),yd=Ec(),Da=oy(),yi=Ec(),$A=H_(),Hn=sA(),Ma=aA(),F=we(),xe=on(),wA=Pc(),Ft=Oe(),Un=Sc();function F8(e){if(EA(e)){if(PA(e),SA(e)){B8(e);return}}vA(e,()=>bd.topBoolOrEmptySchema(e))}OA.validateFunctionCode=F8;function vA({gen:e,validateName:t,schema:r,schemaEnv:n,opts:s},i){if(s.code.es5)e.func(t,F._`${xe.default.data}, ${xe.default.valCxt}`,n.$async,()=>{e.code(F._`"use strict"; ${yA(r,s)}`),V8(e,s),e.code(i)});else e.func(t,F._`${xe.default.data}, ${q8(s)}`,n.$async,()=>e.code(yA(r,s)).code(i))}function q8(e){return F._`{${xe.default.instancePath}="", ${xe.default.parentData}, ${xe.default.parentDataProperty}, ${xe.default.rootData}=${xe.default.data}${e.dynamicRef?F._`, ${xe.default.dynamicAnchors}={}`:F.nil}}={}`}function V8(e,t){e.if(xe.default.valCxt,()=>{if(e.var(xe.default.instancePath,F._`${xe.default.valCxt}.${xe.default.instancePath}`),e.var(xe.default.parentData,F._`${xe.default.valCxt}.${xe.default.parentData}`),e.var(xe.default.parentDataProperty,F._`${xe.default.valCxt}.${xe.default.parentDataProperty}`),e.var(xe.default.rootData,F._`${xe.default.valCxt}.${xe.default.rootData}`),t.dynamicRef)e.var(xe.default.dynamicAnchors,F._`${xe.default.valCxt}.${xe.default.dynamicAnchors}`)},()=>{if(e.var(xe.default.instancePath,F._`""`),e.var(xe.default.parentData,F._`undefined`),e.var(xe.default.parentDataProperty,F._`undefined`),e.var(xe.default.rootData,xe.default.data),t.dynamicRef)e.var(xe.default.dynamicAnchors,F._`{}`)})}function B8(e){let{schema:t,opts:r,gen:n}=e;vA(e,()=>{if(r.$comment&&t.$comment)kA(e);if(G8(e),n.let(xe.default.vErrors,null),n.let(xe.default.errors,0),r.unevaluated)W8(e);jA(e),Y8(e)});return}function W8(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",F._`${r}.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 yA(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?F._`/*# sourceURL=${r} */`:F.nil}function U8(e,t){if(EA(e)){if(PA(e),SA(e)){H8(e,t);return}}bd.boolOrEmptySchema(e,t)}function SA({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function EA(e){return typeof e.schema!="boolean"}function H8(e,t){let{schema:r,gen:n,opts:s}=e;if(s.$comment&&r.$comment)kA(e);K8(e),X8(e);let i=n.const("_errs",xe.default.errors);jA(e,i),n.var(t,F._`${i} === ${xe.default.errors}`)}function PA(e){Ft.checkUnknownRules(e),z8(e)}function jA(e,t){if(e.opts.jtd)return bA(e,[],!1,t);let r=yd.getSchemaTypes(e.schema),n=yd.coerceAndCheckDataType(e,r);bA(e,r,!n,t)}function z8(e){let{schema:t,errSchemaPath:r,opts:n,self:s}=e;if(t.$ref&&n.ignoreKeywordsWithRef&&Ft.schemaHasRulesButRef(t,s.RULES))s.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function G8(e){let{schema:t,opts:r}=e;if(t.default!==void 0&&r.useDefaults&&r.strictSchema)Ft.checkStrictMode(e,"default is ignored in the schema root")}function K8(e){let t=e.schema[e.opts.schemaId];if(t)e.baseId=wA.resolveUrl(e.opts.uriResolver,e.baseId,t)}function X8(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function kA({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:s}){let i=r.$comment;if(s.$comment===!0)e.code(F._`${xe.default.self}.logger.log(${i})`);else if(typeof s.$comment=="function"){let o=F.str`${n}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code(F._`${xe.default.self}.opts.$comment(${i}, ${o}, ${a}.schema)`)}}function Y8(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:s,opts:i}=e;if(r.$async)t.if(F._`${xe.default.errors} === 0`,()=>t.return(xe.default.data),()=>t.throw(F._`new ${s}(${xe.default.vErrors})`));else{if(t.assign(F._`${n}.errors`,xe.default.vErrors),i.unevaluated)Z8(e);t.return(F._`${xe.default.errors} === 0`)}}function Z8({gen:e,evaluated:t,props:r,items:n}){if(r instanceof F.Name)e.assign(F._`${t}.props`,r);if(n instanceof F.Name)e.assign(F._`${t}.items`,n)}function bA(e,t,r,n){let{gen:s,schema:i,data:o,allErrors:a,opts:l,self:c}=e,{RULES:u}=c;if(i.$ref&&(l.ignoreKeywordsWithRef||!Ft.schemaHasRulesButRef(i,u))){s.block(()=>AA(e,"$ref",u.all.$ref.definition));return}if(!l.jtd)Q8(e,t);s.block(()=>{for(let h of u.rules)p(h);p(u.post)});function p(h){if(!Da.shouldUseGroup(i,h))return;if(h.type){if(s.if(yi.checkDataType(h.type,o,l.strictNumbers)),xA(e,h),t.length===1&&t[0]===h.type&&r)s.else(),yi.reportTypeError(e);s.endIf()}else xA(e,h);if(!a)s.if(F._`${xe.default.errors} === ${n||0}`)}}function xA(e,t){let{gen:r,schema:n,opts:{useDefaults:s}}=e;if(s)$A.assignDefaults(e,t.type);r.block(()=>{for(let i of t.rules)if(Da.shouldUseRule(n,i))AA(e,i.keyword,i.definition,t.type)})}function Q8(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;if(e6(e,t),!e.opts.allowUnionTypes)t6(e,t);r6(e,e.dataTypes)}function e6(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((r)=>{if(!_A(e.dataTypes,r))my(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),s6(e,t)}function t6(e,t){if(t.length>1&&!(t.length===2&&t.includes("null")))my(e,"use allowUnionTypes to allow union type keyword")}function r6(e,t){let r=e.self.RULES.all;for(let n in r){let s=r[n];if(typeof s=="object"&&Da.shouldUseRule(e.schema,s)){let{type:i}=s.definition;if(i.length&&!i.some((o)=>n6(t,o)))my(e,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function n6(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function _A(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function s6(e,t){let r=[];for(let n of e.dataTypes)if(_A(t,n))r.push(n);else if(t.includes("integer")&&n==="number")r.push("integer");e.dataTypes=r}function my(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,Ft.checkStrictMode(e,t,e.opts.strictTypes)}class hy{constructor(e,t,r){if(Hn.validateKeywordUsage(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=Ft.schemaRefOrVal(e,this.schema,r,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",RA(this.$data,e));else if(this.schemaCode=this.schemaValue,!Hn.validSchemaType(this.schema,t.schemaType,t.allowUndefined))throw Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);if("code"in t?t.trackErrors:t.errors!==!1)this.errsCount=e.gen.const("_errs",xe.default.errors)}result(e,t,r){this.failResult(F.not(e),t,r)}failResult(e,t,r){if(this.gen.if(e),r)r();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,r){if(t){this.setParams(t),this._error(e,r),this.setParams({});return}this._error(e,r)}_error(e,t){(e?Un.reportExtraError:Un.reportError)(this,this.def.error,t)}$dataError(){Un.reportError(this,this.def.$dataError||Un.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');Un.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,r=F.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=F.nil,t=F.nil){if(!this.$data)return;let{gen:r,schemaCode:n,schemaType:s,def:i}=this;if(r.if(F.or(F._`${n} === undefined`,t)),e!==F.nil)r.assign(e,!0);if(s.length||i.validateSchema){if(r.elseIf(this.invalid$data()),this.$dataError(),e!==F.nil)r.assign(e,!1)}r.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:r,def:n,it:s}=this;return F.or(i(),o());function i(){if(r.length){if(!(t instanceof F.Name))throw Error("ajv implementation error");let a=Array.isArray(r)?r:[r];return F._`${yi.checkDataTypes(a,t,s.opts.strictNumbers,yi.DataType.Wrong)}`}return F.nil}function o(){if(n.validateSchema){let a=e.scopeValue("validate$data",{ref:n.validateSchema});return F._`!${a}(${t})`}return F.nil}}subschema(e,t){let r=Ma.getSubschema(this.it,e);Ma.extendSubschemaData(r,this.it,e),Ma.extendSubschemaMode(r,e);let n={...this.it,...r,items:void 0,props:void 0};return U8(n,t),n}mergeEvaluated(e,t){let{it:r,gen:n}=this;if(!r.opts.unevaluated)return;if(r.props!==!0&&e.props!==void 0)r.props=Ft.mergeEvaluated.props(n,e.props,r.props,t);if(r.items!==!0&&e.items!==void 0)r.items=Ft.mergeEvaluated.items(n,e.items,r.items,t)}mergeValidEvaluated(e,t){let{it:r,gen:n}=this;if(r.opts.unevaluated&&(r.props!==!0||r.items!==!0))return n.if(t,()=>this.mergeEvaluated(e,F.Name)),!0}}OA.KeywordCxt=hy;function AA(e,t,r,n){let s=new hy(e,r,t);if("code"in r)r.code(s,n);else if(s.$data&&r.validate)Hn.funcKeywordCode(s,r);else if("macro"in r)Hn.macroKeywordCode(s,r);else if(r.compile||r.validate)Hn.funcKeywordCode(s,r)}var i6=/^\/(?:[^~]|~0|~1)*$/,o6=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function RA(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let s,i;if(e==="")return xe.default.rootData;if(e[0]==="/"){if(!i6.test(e))throw Error(`Invalid JSON-pointer: ${e}`);s=e,i=xe.default.rootData}else{let c=o6.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 n[t-u]}if(u>t)throw Error(l("data",u));if(i=r[t-u],!s)return i}let o=i,a=s.split("/");for(let c of a)if(c)i=F._`${i}${F.getProperty(Ft.unescapeJsonPointer(c))}`,o=F._`${o} && ${i}`;return o;function l(c,u){return`Cannot access ${c} ${u} levels up, current level is ${t}`}}OA.getData=RA});var jc=T(function(TA){Object.defineProperty(TA,"__esModule",{value:!0});class CA extends Error{constructor(e){super("validation failed");this.errors=e,this.ajv=this.validation=!0}}TA.default=CA});var qa=T(function(JA){Object.defineProperty(JA,"__esModule",{value:!0});var Fa=Pc();class IA extends Error{constructor(e,t,r,n){super(n||`can't resolve reference ${r} from id ${t}`);this.missingRef=Fa.resolveUrl(e,t,r),this.missingSchema=Fa.normalizeId(Fa.getFullPath(e,this.missingRef))}}JA.default=IA});var _c=T(function(LA){Object.defineProperty(LA,"__esModule",{value:!0});LA.resolveSchema=LA.getCompilingSchema=LA.resolveRef=LA.compileSchema=LA.SchemaEnv=void 0;var gt=we(),f6=jc(),bo=on(),yt=Pc(),xd=Oe(),MA=La();class kc{constructor(e){var t;this.refs={},this.dynamicAnchors={};let r;if(typeof e.schema=="object")r=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:yt.normalizeId(r===null||r===void 0?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=r===null||r===void 0?void 0:r.$async,this.refs={}}}LA.SchemaEnv=kc;function yy(e){let t=DA.call(this,e);if(t)return t;let r=yt.getFullPath(this.opts.uriResolver,e.root.baseId),{es5:n,lines:s}=this.opts.code,{ownProperties:i}=this.opts,o=new gt.CodeGen(this.scope,{es5:n,lines:s,ownProperties:i}),a;if(e.$async)a=o.scopeValue("Error",{ref:f6.default,code:gt._`require("ajv/dist/runtime/validation_error").default`});let l=o.scopeName("validate");e.validateName=l;let c={gen:o,allErrors:this.opts.allErrors,data:bo.default.data,parentData:bo.default.parentData,parentDataProperty:bo.default.parentDataProperty,dataNames:[bo.default.data],dataPathArr:[gt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:o.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:gt.stringify(e.schema)}:{ref:e.schema}),validateName:l,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:gt.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:gt._`""`,opts:this.opts,self:this},u;try{this._compilations.add(e),MA.validateFunctionCode(c),o.optimize(this.opts.code.optimize);let p=o.toString();if(u=`${o.scopeRefs(bo.default.scope)}return ${p}`,this.opts.code.process)u=this.opts.code.process(u,e);let m=Function(`${bo.default.self}`,`${bo.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:p,scopeValues:o._values};if(this.opts.unevaluated){let{props:y,items:g}=c;if(m.evaluated={props:y instanceof gt.Name?void 0:y,items:g instanceof gt.Name?void 0:g,dynamicProps:y instanceof gt.Name,dynamicItems:g instanceof gt.Name},m.source)m.source.evaluated=gt.stringify(m.evaluated)}return e.validate=m,e}catch(p){if(delete e.validate,delete e.validateName,u)this.logger.error("Error compiling schema, function code:",u);throw p}finally{this._compilations.delete(e)}}LA.compileSchema=yy;function d6(e,t,r){var n;r=yt.resolveUrl(this.opts.uriResolver,t,r);let s=e.refs[r];if(s)return s;let i=h6.call(this,e,r);if(i===void 0){let o=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;if(o)i=new kc({schema:o,schemaId:a,root:e,baseId:t})}if(i===void 0)return;return e.refs[r]=p6.call(this,i)}LA.resolveRef=d6;function p6(e){if(yt.inlineRef(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:yy.call(this,e)}function DA(e){for(let t of this._compilations)if(m6(t,e))return t}LA.getCompilingSchema=DA;function m6(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function h6(e,t){let r;while(typeof(r=this.refs[t])=="string")t=r;return r||this.schemas[t]||$d.call(this,e,t)}function $d(e,t){let r=this.opts.uriResolver.parse(t),n=yt._getFullPath(this.opts.uriResolver,r),s=yt.getFullPath(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===s)return gy.call(this,r,e);let i=yt.normalizeId(n),o=this.refs[i]||this.schemas[i];if(typeof o=="string"){let a=$d.call(this,e,o);if(typeof(a===null||a===void 0?void 0:a.schema)!=="object")return;return gy.call(this,r,a)}if(typeof(o===null||o===void 0?void 0:o.schema)!=="object")return;if(!o.validate)yy.call(this,o);if(i===yt.normalizeId(t)){let{schema:a}=o,{schemaId:l}=this.opts,c=a[l];if(c)s=yt.resolveUrl(this.opts.uriResolver,s,c);return new kc({schema:a,schemaId:l,root:e,baseId:s})}return gy.call(this,r,o)}LA.resolveSchema=$d;var g6=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function gy(e,{baseId:t,schema:r,root:n}){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 r==="boolean")return;let l=r[xd.unescapeFragment(a)];if(l===void 0)return;r=l;let c=typeof r==="object"&&r[this.opts.schemaId];if(!g6.has(a)&&c)t=yt.resolveUrl(this.opts.uriResolver,t,c)}let i;if(typeof r!="boolean"&&r.$ref&&!xd.schemaHasRulesButRef(r,this.RULES)){let a=yt.resolveUrl(this.opts.uriResolver,t,r.$ref);i=$d.call(this,n,a)}let{schemaId:o}=this.opts;if(i=i||new kc({schema:r,schemaId:o,root:n,baseId:t}),i.schema!==i.root.schema)return i;return}});var qA=T(function(Ice,w6){w6.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 Sy=T(function(Jce,KA){var v6=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),xy=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),S6=RegExp.prototype.test.bind(/^\d*$/u),xo=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),$y=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),BA=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),wy=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),E6=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),Rr=Array(256);for(let t=0;t<256;t++)Rr[t]="%"+"0123456789ABCDEF"[t>>4]+"0123456789ABCDEF"[t&15];function ir(e){if(e<2048)return Rr[192|e>>6]+Rr[128|e&63];if(e<65536)return Rr[224|e>>12]+Rr[128|e>>6&63]+Rr[128|e&63];return Rr[240|e>>18]+Rr[128|e>>12&63]+Rr[128|e>>6&63]+Rr[128|e&63]}function P6(e){let t="",r=0,n=0;for(n=0;n<e.length;n++){if(r=e[n].charCodeAt(0),r===48)continue;if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n];break}for(n+=1;n<e.length;n++){if(r=e[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n]}return t}var j6=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),k6=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),_6=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),A6=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function R6(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++){if(_6(e[t]))continue;if(e[t]==="%"&&t+2<e.length&&xo(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function VA(e){let t=-1,r=0,n=-1,s=0;for(let a=0;a<e.length;a++)if(e[a]==="0"){if(n===-1)n=a;if(s++,s>r)r=s,t=n}else n=-1,s=0;if(r<2)return e.join(":");let i=e.slice(0,t).join(":"),o=e.slice(t+r).join(":");return i+"::"+o}function O6(e){let t=e.indexOf("::");if(t!==-1&&e.indexOf("::",t+1)!==-1)return;let r=t===-1?e.split(":"):e.slice(0,t).split(":"),n=t===-1?[]:e.slice(t+2).split(":");if(t!==-1){if(r.length===1&&r[0]==="")r.length=0;if(n.length===1&&n[0]==="")n.length=0}let s=r.concat(n),i=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&&n.length===0||!xy(l))return;i+=2;continue}if(!j6(l))return;s[a]=parseInt(l,16).toString(16),i++}if(t===-1){if(i!==8)return;return VA(s)}if(i>=8)return;let o=s.slice(0,r.length);for(let a=i;a<8;a++)o.push("0");for(let a=r.length;a<s.length;a++)o.push(s[a]);return VA(o)}function by(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 n=t?e.slice(1,-1):e;if(t&&k6(n))return n=n.toLowerCase(),{host:`[${n}]`,escapedHost:n,isIPV6:!1,isIPVFuture:!0};if(N6(n,":")<2)return{host:e,isIPV6:!1,error:t};let s="",i=n.indexOf("%");if(i!==-1){let a=n.slice(i,i+3).toLowerCase()==="%25"?3:1;if(s=n.slice(i+a),!R6(s))return{host:e,isIPV6:!1,error:!0};n=n.slice(0,i)}let o=O6(n);if(o===void 0)return{host:e,isIPV6:!1,error:!0};return{host:o+(s?"%"+s:""),escapedHost:o+(s?"%25"+s:""),isIPV6:!0}}function N6(e,t){let r=0;for(let n=0;n<e.length;n++)if(e[n]===t)r++;return r}function WA(e){let t=e,r=[],n=-1,s=0;while(s=t.length){if(s===1)if(t===".")break;else if(t==="/"){r.push("/");break}else{r.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]==="/"){r.push("/");break}}}else if(s===3){if(t==="/.."){if(r.length!==0)r.pop();r.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),r.length!==0)r.pop();continue}}}}if((n=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,n)),t=t.slice(n)}return r.join("")}function C6(e){if(e===""||e[0]==="/")return WA(e);let t=e.split("/"),r=t.length-1,n=[],s=!1;for(let i=0;i<=r;i++){let o=t[i];if(o==="."||o===".."){if(o==="..")if(n.length!==0&&n[n.length-1]!=="..")n.pop();else n.push("..");s=i===r}else n.push(o)}if(s&&n[n.length-1]!=="..")n.push("");if(n.length===0||n[0]===""||n[0].includes(":"))n.unshift(".");return n.join("/")}var T6={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},I6=/[@/?#:]/g,J6=/[@/?#]/g;function UA(e,t){let r=t?J6:I6;return r.lastIndex=0,e.replace(r,(n)=>T6[n])}function HA(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let n=0;n<e.length;n++){if(e[n]==="%"&&n+2<e.length){let s=e.slice(n+1,n+3);if(xo(s)){let i=s.toUpperCase(),o=String.fromCharCode(parseInt(i,16));if(t&&$y(o))r+=o;else r+="%"+i;n+=2;continue}}r+=e[n]}return r}function M6(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let s=e.slice(r+1,r+3);if(xo(s)){let i=s.toUpperCase(),o=String.fromCharCode(parseInt(i,16));if(o!=="."&&$y(o))t+=o;else t+="%"+i;r+=2;continue}}if(BA(n))t+=n;else{let s=e.charCodeAt(r);if(s<128)t+=GA(s)?n:Rr[s];else if(s<55296||s>57343)t+=ir(s);else if(s<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);if(i>=56320&&i<=57343)t+=ir(65536+(s-55296<<10)+(i-56320)),r++;else t+=ir(65533)}else t+=ir(65533)}}return t}function D6(e,t=!1){let r="",n=t&&e[0]!=="/";for(let s=0;s<e.length;s++){let i=e[s];if(i==="%"&&s+2<e.length){let o=e.slice(s+1,s+3);if(xo(o)){r+="%"+o.toUpperCase(),s+=2;continue}}if(i==="/")n=!1;if(BA(i)&&(i!==":"||!n))r+=i;else{let o=e.charCodeAt(s);if(o<128)r+=Rr[o];else if(o<55296||o>57343)r+=ir(o);else if(o<=56319&&s+1<e.length){let a=e.charCodeAt(s+1);if(a>=56320&&a<=57343)r+=ir(65536+(o-55296<<10)+(a-56320)),s++;else r+=ir(65533)}else r+=ir(65533)}}return r}function vy(e,t){let r="";for(let n=0;n<e.length;n++){let s=e[n];if(s==="%"&&n+2<e.length){let i=e.slice(n+1,n+3);if(xo(i)){r+="%"+i.toUpperCase(),n+=2;continue}}if(t(s))r+=s;else{let i=e.charCodeAt(n);if(i<128)r+=Rr[i];else if(i<55296||i>57343)r+=ir(i);else if(i<=56319&&n+1<e.length){let o=e.charCodeAt(n+1);if(o>=56320&&o<=57343)r+=ir(65536+(i-55296<<10)+(o-56320)),n++;else r+=ir(65533)}else r+=ir(65533)}}return r}function zA(e){return vy(e,E6)}function L6(e){return vy(e,wy)}function F6(e){return vy(e,wy)}function GA(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 q6(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let s=e.slice(r+1,r+3);if(xo(s)){let i=s.toUpperCase(),o=String.fromCharCode(parseInt(i,16));if($y(o))t+=o;else t+="%"+i;r+=2;continue}}if(wy(n))t+=n;else{let s=e.charCodeAt(r);if(s<128)t+=GA(s)?n:Rr[s];else if(s<55296||s>57343)t+=ir(s);else if(s<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);if(i>=56320&&i<=57343)t+=ir(65536+(s-55296<<10)+(i-56320)),r++;else t+=ir(65533)}else t+=ir(65533)}}return t}function V6(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let n=e.slice(r+1,r+3);if(xo(n)){t+="%"+n.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function B6(e){let t=[];if(e.userinfo!==void 0)t.push(zA(e.userinfo)),t.push("@");if(e.host!==void 0){let r=e.host;if(!xy(r)){let n=by(r);if(n.isIPV6!==!0&&n.isIPVFuture!==!0)r=HA(r,!0),n=by(r);if(n.isIPV6===!0||n.isIPVFuture===!0)r=`[${n.escapedHost}]`;else r=UA(r,!1)}t.push(r)}if(typeof e.port==="number"||typeof e.port==="string"){let r=String(e.port);if(!S6(r))throw TypeError("URI port is malformed.");t.push(":"),t.push(r)}return t.length?t.join(""):void 0}KA.exports={nonSimpleDomain:A6,recomposeAuthority:B6,reescapeHostDelimiters:UA,normalizePercentEncoding:HA,normalizePathEncoding:M6,serializePathEncoding:D6,normalizeQueryFragmentEncoding:q6,encodeUserinfo:zA,encodeQuery:L6,encodeFragment:F6,escapePreservingEscapes:V6,removeDotSegments:WA,removeDotSegmentsRelative:C6,isIPv4:xy,isUUID:v6,normalizeIPv6:by,stringArrayToHexStripped:P6}});var eR=T(function(Mce,QA){var{isUUID:W6}=Sy(),U6=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,H6=["http","https","ws","wss","urn","urn:uuid"];function z6(e){return H6.indexOf(e)!==-1}function Ey(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 XA(e){if(!e.host)e.error=e.error||"HTTP URIs must have a host.";return e}function YA(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 G6(e){return e.secure=Ey(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function K6(e){if(e.port===(Ey(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("?"),r=t===-1?e.resourceName:e.resourceName.slice(0,t);e.path=r&&r!=="/"?r:void 0,e.query=t===-1?void 0:e.resourceName.slice(t+1),e.resourceName=void 0}return e.fragment=void 0,e}function X6(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(U6);if(r&&r[0]===e.path){let n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let s=`${n}:${t.nid||e.nid}`,i=Py(s);if(e.path=void 0,i)e=i.parse(e,t)}else e.error=e.error||"URN can not be parsed.";return e}function Y6(e,t){if(e.nid===void 0)throw Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),s=`${r}:${t.nid||n}`,i=Py(s);if(i)e=i.serialize(e,t);let o=e,a=e.nss;return o.path=`${n||t.nid}:${a}`,t.skipEscape=!0,o}function Z6(e,t){let r=e;if(r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!W6(r.uuid)))r.error=r.error||"UUID is not valid.";return r}function Q6(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var ZA={scheme:"http",domainHost:!0,parse:XA,serialize:YA},ez={scheme:"https",domainHost:ZA.domainHost,parse:XA,serialize:YA},wd={scheme:"ws",domainHost:!0,parse:G6,serialize:K6},tz={scheme:"wss",domainHost:wd.domainHost,parse:wd.parse,serialize:wd.serialize},rz={scheme:"urn",parse:X6,serialize:Y6,skipNormalize:!0},nz={scheme:"urn:uuid",parse:Z6,serialize:Q6,skipNormalize:!0},vd={http:ZA,https:ez,ws:wd,wss:tz,urn:rz,"urn:uuid":nz};Object.setPrototypeOf(vd,null);function Py(e){return e&&(vd[e]||vd[e.toLowerCase()])||void 0}QA.exports={wsIsSecure:Ey,SCHEMES:vd,isValidSchemeName:z6,getSchemeHandler:Py}});var mR=T(function(Dce,jd){var{normalizeIPv6:iR,removeDotSegments:Rc,removeDotSegmentsRelative:oR,recomposeAuthority:sz,normalizePercentEncoding:jy,normalizePathEncoding:iz,serializePathEncoding:tR,normalizeQueryFragmentEncoding:rR,encodeQuery:oz,encodeFragment:az,reescapeHostDelimiters:lz,isIPv4:aR,nonSimpleDomain:cz}=Sy(),{SCHEMES:lR,getSchemeHandler:ky}=eR(),cR=/^[A-Za-z][A-Za-z0-9+.-]*$/u,uz=/[\0-\x20"#/:<>?@[\\\]^`{|}\x7F]/u;function nR(e){let t=String(e);if(!cR.test(t))throw TypeError("URI scheme is malformed.");return t}function fz(e,t){if(typeof e==="string")e=$z(e,t);else if(typeof e==="object")e=Ed($o(e,t),t);return e}function dz(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:s,malformedAuthorityOrPort:i,malformedPercentEncoding:o,malformedSchemeSpecific:a,malformedHost:l,malformedScheme:c}=Sd(e,n),{parsed:u,malformedAuthorityOrPort:p,malformedPercentEncoding:h,malformedSchemeSpecific:m,malformedHost:y,malformedScheme:g}=Sd(t,n);if(i||p||o||h||a||m||l||y||c||g)throw Error(s.error||u.error||"URI is malformed.");let b=uR(s,u,n,!0),w=ky(r&&r.scheme||b.scheme),j=b.host,S=j!==void 0&&j!==""&&(aR(j)||iR(j).isIPV6);if(dR(b,r||{},w,S))throw Error("URI host is malformed.");fR(b,r||{},w,S);let E=j&&j.indexOf("%")!==-1&&!/\P{ASCII}/u.test(j);if(b.error&&!E)throw Error(b.error);return n.skipEscape=!0,$o(b,n)}function uR(e,t,r,n){let s={};if(!n)e=Ed($o(e,r),r),t=Ed($o(t,r),r);if(r=r||{},!r.tolerant&&t.scheme)s.scheme=t.scheme,s.userinfo=t.userinfo,s.host=t.host,s.port=t.port,s.path=Rc(t.path||""),s.query=t.query;else{if(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)s.userinfo=t.userinfo,s.host=t.host,s.port=t.port,s.path=Rc(t.path||""),s.query=t.query;else{if(!t.path)if(s.path=e.path,t.query!==void 0)s.query=t.query;else s.query=e.query;else{if(t.path[0]==="/")s.path=Rc(t.path);else{let i=e.userinfo!==void 0||e.host!==void 0||e.port!==void 0;if(i&&!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&&!i&&s.path[0]!=="/"?oR(s.path):Rc(s.path)}s.query=t.query}s.userinfo=e.userinfo,s.host=e.host,s.port=e.port}s.scheme=e.scheme}return s.fragment=t.fragment,s}function pz(e,t,r){let n=sR(e,r),s=sR(t,r);return n!==void 0&&s!==void 0&&n===s}function $o(e,t){let r={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:""},n=Object.assign({},t),s=[];if(r.scheme)r.scheme=nR(r.scheme);let i=ky(n.scheme||r.scheme);if(i&&i.serialize)i.serialize(r,n);let o=r.userinfo!==void 0||r.host!==void 0||r.port!==void 0,a=(r.scheme===void 0||n.reference==="suffix")&&!o,l=!n.skipEscape&&a;if(r.path!==void 0)if(!n.skipEscape)r.path=tR(r.path,l);else r.path=jy(r.path);if(n.reference!=="suffix"&&r.scheme)r.scheme=nR(r.scheme),s.push(r.scheme,":");let c=sz(r);if(c!==void 0){if(n.reference!=="suffix")s.push("//");if(s.push(c),r.path&&r.path[0]!=="/")s.push("/")}if(r.path!==void 0){let u=r.path;if(!n.absolutePath&&(!i||!i.absolutePath))u=a&&u[0]!=="/"?oR(u):Rc(u);if(a)u=tR(u,!0);if(c===void 0&&u[0]==="/"&&u[1]==="/")u="/%2F"+u.slice(2);s.push(u)}if(r.query!==void 0)s.push("?",oz(r.query));if(r.fragment!==void 0)s.push("#",az(r.fragment));return s.join("")}var mz=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,hz=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,gz=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function yz(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof e.port==="number"&&(e.port<0||e.port>65535))return"URI port is malformed.";return}function Ac(e){if(e===void 0)return!1;let t=e.indexOf("%");while(t!==-1){if(t+2>=e.length||!/^[\da-f]{2}$/iu.test(e.slice(t+1,t+3)))return!0;t=e.indexOf("%",t+3)}return!1}function Pd(e){return e[0]==="["&&e[e.length-1]==="]"}function bz(e){let t=e[4];return Ac(e[3])||t!==void 0&&!Pd(t)&&Ac(t)||Ac(e[6])||Ac(e[7])||Ac(e[8])}function fR(e,t,r,n){if(dR(e,t,r,n))return e.error=e.error||"URI host is malformed.",!0;if(!t.unicodeSupport&&(!r||!r.unicodeSupport)&&e.host&&!Pd(e.host)&&(t.domainHost||r&&r.domainHost)&&n===!1&&cz(e.host)){let s;try{s=new URL("http://"+e.host)}catch(i){return e.error=e.error||"Host's domain name can not be converted to ASCII: "+i,!0}if(!xz(s))return e.error=e.error||"URI host is malformed.",!0;e.host=s.hostname}return!1}function dR(e,t,r,n){return Boolean(e.host&&n===!1&&!Pd(e.host)&&(t.domainHost||r&&r.domainHost)&&uz.test(e.host))}function xz(e){return e.username===""&&e.password===""&&e.port===""&&e.pathname==="/"&&e.search===""&&e.hash===""&&e.hostname!==""}function Sd(e,t){let r=Object.assign({},t),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},s=!1,i=!1,o=!1,a=!1,l=!1,c=!1,u=!1;if(r.reference==="suffix")if(r.scheme)e=r.scheme+":"+e;else e="//"+e;let p=e.match(hz);if(p!==null&&p[1].indexOf("\\")!==-1)n.error="URI authority must not contain a literal backslash.",s=!0;let h=e.match(gz);if(h!==null){let y=h[1],g=y.replace(/[\t\n\r]/g,"");if(g.length>=2){if(g.slice(0,2)!=="//")n.error=n.error||"URI authority must not contain a literal backslash.",s=!0;else if(y.length!==g.length)n.error=n.error||"URI authority introducer must not contain whitespace.",s=!0}}let m=e.match(mz);if(m){if(n.scheme=m[1],n.userinfo=m[3],n.host=m[4],n.port=parseInt(m[5],10),n.path=m[6]||"",n.query=m[7],n.fragment=m[8],n.scheme!==void 0)if(cR.test(n.scheme))n.scheme=n.scheme.toLowerCase();else n.error=n.error||"URI scheme is malformed.",c=!0;if(i=bz(m),i)n.error=n.error||"URI contains malformed percent-encoding.";if(isNaN(n.port))n.port=m[5];let y=yz(n,m);if(y!==void 0)n.error=n.error||y,s=!0;if(n.host)if(aR(n.host)===!1){let w=Pd(n.host),j=n.host.indexOf("[")!==-1||n.host.indexOf("]")!==-1,S=iR(n.host);if(u=S.isIPV6||S.isIPVFuture===!0,l=j&&(!w||S.error===!0),n.host=u?S.host:S.host.toLowerCase(),l)n.error=n.error||"URI host is malformed.",s=!0}else u=!0;if(n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path)n.reference="same-document";else if(n.scheme===void 0)n.reference="relative";else if(n.fragment===void 0)n.reference="absolute";else n.reference="uri";if(r.reference&&r.reference!=="suffix"&&r.reference!==n.reference)n.error=n.error||"URI is not a "+r.reference+" reference.";let g=ky(r.scheme||n.scheme);if(!l)a=fR(n,r,g,u);if(e.indexOf("%")!==-1&&n.host!==void 0&&!l){let b=u?n.host:jy(n.host,!0);if(!u)b=jy(b.toLowerCase());n.host=u||r.scheme!=="null"?lz(b,u):b}if(!g||g&&!g.skipNormalize){if(n.path)n.path=iz(n.path);if(n.query)n.query=rR(n.query);if(n.fragment)n.fragment=rR(n.fragment)}if(g&&g.parse){if(g.parse(n,r),g===lR.urn&&n.nid===void 0)o=!0}}else n.error=n.error||"URI can not be parsed.";return{parsed:n,malformedAuthorityOrPort:s,malformedPercentEncoding:i,malformedSchemeSpecific:o,malformedHost:a,malformedScheme:c}}function Ed(e,t){return Sd(e,t).parsed}function $z(e,t){return pR(e,t).normalized}function pR(e,t){let{parsed:r,malformedAuthorityOrPort:n,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:o,malformedScheme:a}=Sd(e,t);return{normalized:n||s||i||o||a?e:$o(r,t),malformedAuthorityOrPort:n,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:o,malformedScheme:a}}function sR(e,t){if(typeof e!=="string"&&typeof e!=="object")return;let r;try{r=typeof e==="string"?e:$o(e,t)}catch{return}let{normalized:n,malformedAuthorityOrPort:s,malformedPercentEncoding:i,malformedSchemeSpecific:o,malformedHost:a,malformedScheme:l}=pR(r,t);return s||i||o||a||l?void 0:n}var _y={SCHEMES:lR,normalize:fz,resolve:dz,resolveComponent:uR,equal:pz,serialize:$o,parse:Ed};jd.exports=_y;jd.exports.default=_y;jd.exports.fastUri=_y});var yR=T(function(gR){Object.defineProperty(gR,"__esModule",{value:!0});var hR=mR();hR.code='require("ajv/dist/runtime/uri").default';gR.default=hR});var Ry=T(function(Ds){Object.defineProperty(Ds,"__esModule",{value:!0});Ds.CodeGen=Ds.Name=Ds.nil=Ds.stringify=Ds.str=Ds._=Ds.KeywordCxt=void 0;var vz=La();Object.defineProperty(Ds,"KeywordCxt",{enumerable:!0,get:function(){return vz.KeywordCxt}});var Ba=we();Object.defineProperty(Ds,"_",{enumerable:!0,get:function(){return Ba._}});Object.defineProperty(Ds,"str",{enumerable:!0,get:function(){return Ba.str}});Object.defineProperty(Ds,"stringify",{enumerable:!0,get:function(){return Ba.stringify}});Object.defineProperty(Ds,"nil",{enumerable:!0,get:function(){return Ba.nil}});Object.defineProperty(Ds,"Name",{enumerable:!0,get:function(){return Ba.Name}});Object.defineProperty(Ds,"CodeGen",{enumerable:!0,get:function(){return Ba.CodeGen}});var Sz=jc(),vR=qa(),SR=iy(),zn=_c(),ER=we(),Gn=Pc(),bi=Ec(),Va=Oe(),bR=qA(),Ez=yR(),PR=(e,t)=>new RegExp(e,t);PR.code="new RegExp";var Pz=["removeAdditional","useDefaults","coerceTypes"],jz=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),kz={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."},_z={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},xR=200;function Az(e){var t,r,n,s,i,o,a,l,c,u,p,h,m,y,g,b,w,j,S,E,P,R,N,_,q;let D=e.strict,O=(t=e.code)===null||t===void 0?void 0:t.optimize,L=O===!0||O===void 0?1:O||0,K=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:PR,ae=(s=e.uriResolver)!==null&&s!==void 0?s:Ez.default;return{strictSchema:(o=(i=e.strictSchema)!==null&&i!==void 0?i:D)!==null&&o!==void 0?o:!0,strictNumbers:(l=(a=e.strictNumbers)!==null&&a!==void 0?a:D)!==null&&l!==void 0?l:!0,strictTypes:(u=(c=e.strictTypes)!==null&&c!==void 0?c:D)!==null&&u!==void 0?u:"log",strictTuples:(h=(p=e.strictTuples)!==null&&p!==void 0?p:D)!==null&&h!==void 0?h:"log",strictRequired:(y=(m=e.strictRequired)!==null&&m!==void 0?m:D)!==null&&y!==void 0?y:!1,code:e.code?{...e.code,optimize:L,regExp:K}:{optimize:L,regExp:K},loopRequired:(g=e.loopRequired)!==null&&g!==void 0?g:xR,loopEnum:(b=e.loopEnum)!==null&&b!==void 0?b:xR,meta:(w=e.meta)!==null&&w!==void 0?w:!0,messages:(j=e.messages)!==null&&j!==void 0?j:!0,inlineRefs:(S=e.inlineRefs)!==null&&S!==void 0?S:!0,schemaId:(E=e.schemaId)!==null&&E!==void 0?E:"$id",addUsedSchema:(P=e.addUsedSchema)!==null&&P!==void 0?P:!0,validateSchema:(R=e.validateSchema)!==null&&R!==void 0?R:!0,validateFormats:(N=e.validateFormats)!==null&&N!==void 0?N:!0,unicodeRegExp:(_=e.unicodeRegExp)!==null&&_!==void 0?_:!0,int32range:(q=e.int32range)!==null&&q!==void 0?q:!0,uriResolver:ae}}class kd{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,...Az(e)};let{es5:t,lines:r}=this.opts.code;this.scope=new ER.ValueScope({scope:{},prefixes:jz,es5:t,lines:r}),this.logger=Iz(e.logger);let n=e.validateFormats;if(e.validateFormats=!1,this.RULES=SR.getRules(),$R.call(this,kz,e,"NOT SUPPORTED"),$R.call(this,_z,e,"DEPRECATED","warn"),this._metaOpts=Cz.call(this),e.formats)Oz.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords)Nz.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);Rz.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,n=bR;if(r==="id")n={...bR},n.id=n.$id,delete n.$id;if(t&&e)this.addMetaSchema(n,n[r],!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 r;if(typeof e=="string"){if(r=this.getSchema(e),!r)throw Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);let n=r(t);if(!("$async"in r))this.errors=r.errors;return n}compile(e,t){let r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:r}=this.opts;return n.call(this,e,t);async function n(c,u){await s.call(this,c.$schema);let p=this._addSchema(c,u);return p.validate||i.call(this,p)}async function s(c){if(c&&!this.getSchema(c))await n.call(this,{$ref:c},!0)}async function i(c){try{return this._compileSchemaEnv(c)}catch(u){if(!(u instanceof vR.default))throw u;return o.call(this,u),await a.call(this,u.missingSchema),i.call(this,c)}}function o({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]=r(c))}finally{delete this._loading[c]}}}addSchema(e,t,r,n=this.opts.validateSchema){if(Array.isArray(e)){for(let i of e)this.addSchema(i,void 0,r,n);return this}let s;if(typeof e==="object"){let{schemaId:i}=this.opts;if(s=e[i],s!==void 0&&typeof s!="string")throw Error(`schema ${i} must be string`)}return t=Gn.normalizeId(t||s),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,n,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){if(typeof e=="boolean")return!0;let r;if(r=e.$schema,r!==void 0&&typeof r!="string")throw Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let n=this.validate(r,e);if(!n&&t){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw Error(s)}return n}getSchema(e){let t;while(typeof(t=wR.call(this,e))=="string")e=t;if(t===void 0){let{schemaId:r}=this.opts,n=new zn.SchemaEnv({schema:{},schemaId:r});if(t=zn.resolveSchema.call(this,n,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=wR.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 r=e[this.opts.schemaId];if(r)r=Gn.normalizeId(r),delete this.schemas[r],delete this.refs[r];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 r;if(typeof e=="string"){if(r=e,typeof t=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r}else if(typeof e=="object"&&t===void 0){if(t=e,r=t.keyword,Array.isArray(r)&&!r.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(Mz.call(this,r,t),!t)return Va.eachItem(r,(s)=>Ay.call(this,s)),this;Lz.call(this,t);let n={...t,type:bi.getJSONTypes(t.type),schemaType:bi.getJSONTypes(t.schemaType)};return Va.eachItem(r,n.type.length===0?(s)=>Ay.call(this,s,n):(s)=>n.type.forEach((i)=>Ay.call(this,s,n,i))),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 r of t.rules){let n=r.rules.findIndex((s)=>s.keyword===e);if(n>=0)r.rules.splice(n,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:r="data"}={}){if(!e||e.length===0)return"No errors";return e.map((n)=>`${r}${n.instancePath} ${n.message}`).reduce((n,s)=>n+t+s)}$dataMetaSchema(e,t){let r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let n of t){let s=n.split("/").slice(1),i=e;for(let o of s)i=i[o];for(let o in r){let a=r[o];if(typeof a!="object")continue;let{$data:l}=a.definition,c=i[o];if(l&&c)i[o]=jR(c)}}return e}_removeAllSchemas(e,t){for(let r in e){let n=e[r];if(!t||t.test(r)){if(typeof n=="string")delete e[r];else if(n&&!n.meta)this._cache.delete(n.schema),delete e[r]}}}_addSchema(e,t,r,n=this.opts.validateSchema,s=this.opts.addUsedSchema){let i,{schemaId:o}=this.opts;if(typeof e=="object")i=e[o];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;r=Gn.normalizeId(i||r);let l=Gn.getSchemaRefs.call(this,e,r);if(a=new zn.SchemaEnv({schema:e,schemaId:o,meta:t,baseId:r,localRefs:l}),this._cache.set(a.schema,a),s&&!r.startsWith("#")){if(r)this._checkUnique(r);this.refs[r]=a}if(n)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 zn.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{zn.compileSchema.call(this,e)}finally{this.opts=t}}}kd.ValidationError=Sz.default;kd.MissingRefError=vR.default;Ds.default=kd;function $R(e,t,r,n="error"){for(let s in e){let i=s;if(i in t)this.logger[n](`${r}: option ${s}. ${e[i]}`)}}function wR(e){return e=Gn.normalizeId(e),this.schemas[e]||this.refs[e]}function Rz(){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 Oz(){for(let e in this.opts.formats){let t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function Nz(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 r=e[t];if(!r.keyword)r.keyword=t;this.addKeyword(r)}}function Cz(){let e={...this.opts};for(let t of Pz)delete e[t];return e}var Tz={log(){},warn(){},error(){}};function Iz(e){if(e===!1)return Tz;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 Jz=/^[a-z_$][a-z0-9_$:-]*$/i;function Mz(e,t){let{RULES:r}=this;if(Va.eachItem(e,(n)=>{if(r.keywords[n])throw Error(`Keyword ${n} is already defined`);if(!Jz.test(n))throw Error(`Keyword ${n} 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 Ay(e,t,r){var n;let s=t===null||t===void 0?void 0:t.post;if(r&&s)throw Error('keyword with "post" flag cannot have "type"');let{RULES:i}=this,o=s?i.post:i.rules.find(({type:l})=>l===r);if(!o)o={type:r,rules:[]},i.rules.push(o);if(i.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:bi.getJSONTypes(t.type),schemaType:bi.getJSONTypes(t.schemaType)}};if(t.before)Dz.call(this,o,a,t.before);else o.rules.push(a);i.all[e]=a,(n=t.implements)===null||n===void 0||n.forEach((l)=>this.addKeyword(l))}function Dz(e,t,r){let n=e.rules.findIndex((s)=>s.keyword===r);if(n>=0)e.rules.splice(n,0,t);else e.rules.push(t),this.logger.warn(`rule ${r} is not defined`)}function Lz(e){let{metaSchema:t}=e;if(t===void 0)return;if(e.$data&&this.opts.$data)t=jR(t);e.validateSchema=this.compile(t,!0)}var Fz={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function jR(e){return{anyOf:[e,Fz]}}});var _R=T(function(kR){Object.defineProperty(kR,"__esModule",{value:!0});var Bz={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};kR.default=Bz});var Od=T(function(RR){Object.defineProperty(RR,"__esModule",{value:!0});RR.callRef=RR.getValidate=void 0;var Uz=qa(),Ad=ln(),Xe=we(),Wa=on(),Rd=_c(),xi=Oe(),Hz={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:s,schemaEnv:i,validateName:o,opts:a,self:l}=n,{root:c}=i;if((r==="#"||r==="#/")&&s===c.baseId)return p();let u=Rd.resolveRef.call(l,c,s,r);if(u===void 0)throw new Uz.default(n.opts.uriResolver,s,r);if(u instanceof Rd.SchemaEnv)return h(u);return m(u);function p(){if(i===c)return _d(e,o,i,i.$async);let y=t.scopeValue("root",{ref:c});return _d(e,Xe._`${y}.validate`,c,c.$async)}function h(y){let g=AR(e,y);_d(e,g,y,y.$async)}function m(y){let g=t.scopeValue("schema",a.code.source===!0?{ref:y,code:Xe.stringify(y)}:{ref:y}),b=t.name("valid"),w=e.subschema({schema:y,dataTypes:[],schemaPath:Xe.nil,topSchemaRef:g,errSchemaPath:r},b);e.mergeEvaluated(w),e.ok(b)}}};function AR(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):Xe._`${r.scopeValue("wrapper",{ref:t})}.validate`}RR.getValidate=AR;function _d(e,t,r,n){let{gen:s,it:i}=e,{allErrors:o,schemaEnv:a,opts:l}=i,c=l.passContext?Wa.default.this:Xe.nil;if(n)u();else p();function u(){if(!a.$async)throw Error("async schema referenced by sync schema");let y=s.let("valid");s.try(()=>{if(s.code(Xe._`await ${Ad.callValidateCode(e,t,c)}`),m(t),!o)s.assign(y,!0)},(g)=>{if(s.if(Xe._`!(${g} instanceof ${i.ValidationError})`,()=>s.throw(g)),h(g),!o)s.assign(y,!1)}),e.ok(y)}function p(){e.result(Ad.callValidateCode(e,t,c),()=>m(t),()=>h(t))}function h(y){let g=Xe._`${y}.errors`;s.assign(Wa.default.vErrors,Xe._`${Wa.default.vErrors} === null ? ${g} : ${Wa.default.vErrors}.concat(${g})`),s.assign(Wa.default.errors,Xe._`${Wa.default.vErrors}.length`)}function m(y){var g;if(!i.opts.unevaluated)return;let b=(g=r===null||r===void 0?void 0:r.validate)===null||g===void 0?void 0:g.evaluated;if(i.props!==!0)if(b&&!b.dynamicProps){if(b.props!==void 0)i.props=xi.mergeEvaluated.props(s,b.props,i.props)}else{let w=s.var("props",Xe._`${y}.evaluated.props`);i.props=xi.mergeEvaluated.props(s,w,i.props,Xe.Name)}if(i.items!==!0)if(b&&!b.dynamicItems){if(b.items!==void 0)i.items=xi.mergeEvaluated.items(s,b.items,i.items)}else{let w=s.var("items",Xe._`${y}.evaluated.items`);i.items=xi.mergeEvaluated.items(s,w,i.items,Xe.Name)}}}RR.callRef=_d;RR.default=Hz});var Oy=T(function(NR){Object.defineProperty(NR,"__esModule",{value:!0});var Kz=_R(),Xz=Od(),Yz=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Kz.default,Xz.default];NR.default=Yz});var TR=T(function(CR){Object.defineProperty(CR,"__esModule",{value:!0});var wi=we(),$i=wi.operators,Nd={maximum:{okStr:"<=",ok:$i.LTE,fail:$i.GT},minimum:{okStr:">=",ok:$i.GTE,fail:$i.LT},exclusiveMaximum:{okStr:"<",ok:$i.LT,fail:$i.GTE},exclusiveMinimum:{okStr:">",ok:$i.GT,fail:$i.LTE}},Qz={message:({keyword:e,schemaCode:t})=>wi.str`must be ${Nd[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>wi._`{comparison: ${Nd[e].okStr}, limit: ${t}}`},e9={keyword:Object.keys(Nd),type:"number",schemaType:"number",$data:!0,error:Qz,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data(wi._`${r} ${Nd[t].fail} ${n} || isNaN(${r})`)}};CR.default=e9});var JR=T(function(IR){Object.defineProperty(IR,"__esModule",{value:!0});var Kn=we(),r9={message:({schemaCode:e})=>Kn.str`must be multiple of ${e}`,params:({schemaCode:e})=>Kn._`{multipleOf: ${e}}`},n9={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:r9,code(e){let{gen:t,data:r,schemaCode:n,it:s}=e,i=s.opts.multipleOfPrecision,o=t.let("res"),a=i?Kn._`Math.abs(Math.round(${o}) - ${o}) > 1e-${i}`:Kn._`${o} !== parseInt(${o})`;e.fail$data(Kn._`(${n} === 0 || (${o} = ${r}/${n}, ${a}))`)}};IR.default=n9});var LR=T(function(DR){Object.defineProperty(DR,"__esModule",{value:!0});function MR(e){let t=e.length,r=0,n=0,s;while(n<t)if(r++,s=e.charCodeAt(n++),s>=55296&&s<=56319&&n<t){if(s=e.charCodeAt(n),(s&64512)===56320)n++}return r}DR.default=MR;MR.code='require("ajv/dist/runtime/ucs2length").default'});var VR=T(function(qR){Object.defineProperty(qR,"__esModule",{value:!0});var Or=we(),FR=Oe(),o9=LR(),a9={message({keyword:e,schemaCode:t}){return Or.str`must NOT have ${e==="maxLength"?"more":"fewer"} than ${t} characters`},params:({schemaCode:e})=>Or._`{limit: ${e}}`},l9={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:a9,code(e){let{keyword:t,data:r,schemaCode:n,it:s}=e,i=t==="maxLength"?Or.operators.GT:Or.operators.LT,o=s.opts.unicode===!1?Or._`${r}.length`:Or._`${FR.useFunc(e.gen,o9.default)}(${r})`;e.fail$data(Or._`${o} ${i} ${n}`)}};qR.default=l9});var HR=T(function(UR){Object.defineProperty(UR,"__esModule",{value:!0});var BR=ln(),WR=Oe(),cn=we(),u9={message:({schemaCode:e})=>cn.str`must match pattern "${e}"`,params:({schemaCode:e})=>cn._`{pattern: ${e}}`},f9={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:u9,code(e){let{gen:t,data:r,$data:n,schema:s,schemaCode:i,it:o}=e,a=o.opts.unicodeRegExp?"u":"";if(n){let{regExp:l}=o.opts.code,c=l.code==="new RegExp"?cn._`new RegExp`:WR.useFunc(t,l),u=t.let("valid");t.try(()=>t.assign(u,cn._`${c}(${i}, ${a}).test(${r})`),()=>t.assign(u,!1)),e.fail$data(cn._`!${u}`)}else{let l=BR.usePattern(e,s);e.fail$data(cn._`!${l}.test(${r})`)}}};UR.default=f9});var GR=T(function(zR){Object.defineProperty(zR,"__esModule",{value:!0});var Xn=we(),p9={message({keyword:e,schemaCode:t}){return Xn.str`must NOT have ${e==="maxProperties"?"more":"fewer"} than ${t} properties`},params:({schemaCode:e})=>Xn._`{limit: ${e}}`},m9={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:p9,code(e){let{keyword:t,data:r,schemaCode:n}=e,s=t==="maxProperties"?Xn.operators.GT:Xn.operators.LT;e.fail$data(Xn._`Object.keys(${r}).length ${s} ${n}`)}};zR.default=m9});var YR=T(function(XR){Object.defineProperty(XR,"__esModule",{value:!0});var Yn=ln(),Zn=we(),KR=Oe(),g9={message:({params:{missingProperty:e}})=>Zn.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>Zn._`{missingProperty: ${e}}`},y9={keyword:"required",type:"object",schemaType:"array",$data:!0,error:g9,code(e){let{gen:t,schema:r,schemaCode:n,data:s,$data:i,it:o}=e,{opts:a}=o;if(!i&&r.length===0)return;let l=r.length>=a.loopRequired;if(o.allErrors)c();else u();if(a.strictRequired){let m=e.parentSchema.properties,{definedProperties:y}=e.it;for(let g of r)if((m===null||m===void 0?void 0:m[g])===void 0&&!y.has(g)){let b=o.schemaEnv.baseId+o.errSchemaPath,w=`required property "${g}" is not defined at "${b}" (strictRequired)`;KR.checkStrictMode(o,w,o.opts.strictRequired)}}function c(){if(l||i)e.block$data(Zn.nil,p);else for(let m of r)Yn.checkReportMissingProp(e,m)}function u(){let m=t.let("missing");if(l||i){let y=t.let("valid",!0);e.block$data(y,()=>h(m,y)),e.ok(y)}else t.if(Yn.checkMissingProp(e,r,m)),Yn.reportMissingProp(e,m),t.else()}function p(){t.forOf("prop",n,(m)=>{e.setParams({missingProperty:m}),t.if(Yn.noPropertyInData(t,s,m,a.ownProperties),()=>e.error())})}function h(m,y){e.setParams({missingProperty:m}),t.forOf(m,n,()=>{t.assign(y,Yn.propertyInData(t,s,m,a.ownProperties)),t.if(Zn.not(y),()=>{e.error(),t.break()})},Zn.nil)}}};XR.default=y9});var QR=T(function(ZR){Object.defineProperty(ZR,"__esModule",{value:!0});var Qn=we(),x9={message({keyword:e,schemaCode:t}){return Qn.str`must NOT have ${e==="maxItems"?"more":"fewer"} than ${t} items`},params:({schemaCode:e})=>Qn._`{limit: ${e}}`},$9={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:x9,code(e){let{keyword:t,data:r,schemaCode:n}=e,s=t==="maxItems"?Qn.operators.GT:Qn.operators.LT;e.fail$data(Qn._`${r}.length ${s} ${n}`)}};ZR.default=$9});var Cd=T(function(tO){Object.defineProperty(tO,"__esModule",{value:!0});var eO=dy();eO.code='require("ajv/dist/runtime/equal").default';tO.default=eO});var sO=T(function(nO){Object.defineProperty(nO,"__esModule",{value:!0});var Ua=Ec(),De=we(),rO=Oe(),S9=Cd(),E9={message:({params:{i:e,j:t}})=>De.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>De._`{i: ${e}, j: ${t}}`},P9={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:E9,code(e){let{gen:t,data:r,$data:n,schema:s,parentSchema:i,schemaCode:o,it:a}=e;if(!n&&!s)return;let l=t.let("valid"),c=i.items?Ua.getSchemaTypes(i.items):[];e.block$data(l,u,De._`${o} === false`),e.ok(l);function u(){let y=t.let("i",De._`${r}.length`),g=t.let("j");e.setParams({i:y,j:g}),t.assign(l,!0),t.if(De._`${y} > 1`,()=>(p()?h:m)(y,g))}function p(){return c.length>0&&!c.some((y)=>y==="object"||y==="array")}function h(y,g){let b=t.name("item"),w=Ua.checkDataTypes(c,b,a.opts.strictNumbers,Ua.DataType.Wrong),j=t.const("indices",De._`{}`);t.for(De._`;${y}--;`,()=>{if(t.let(b,De._`${r}[${y}]`),t.if(w,De._`continue`),c.length>1)t.if(De._`typeof ${b} == "string"`,De._`${b} += "_"`);t.if(De._`typeof ${j}[${b}] == "number"`,()=>{t.assign(g,De._`${j}[${b}]`),e.error(),t.assign(l,!1).break()}).code(De._`${j}[${b}] = ${y}`)})}function m(y,g){let b=rO.useFunc(t,S9.default),w=t.name("outer");t.label(w).for(De._`;${y}--;`,()=>t.for(De._`${g} = ${y}; ${g}--;`,()=>t.if(De._`${b}(${r}[${y}], ${r}[${g}])`,()=>{e.error(),t.assign(l,!1).break(w)})))}}};nO.default=P9});var aO=T(function(oO){Object.defineProperty(oO,"__esModule",{value:!0});var Ha=we(),iO=Oe(),k9=Cd(),_9={message:"must be equal to constant",params:({schemaCode:e})=>Ha._`{allowedValue: ${e}}`},A9={keyword:"const",$data:!0,error:_9,code(e){let{gen:t,data:r,$data:n,schemaCode:s,schema:i}=e;if(n||i&&typeof i=="object")e.fail$data(Ha._`!${iO.useFunc(t,k9.default)}(${r}, ${s})`);else e.fail(Ha._`${i} !== ${r}`)}};oO.default=A9});var uO=T(function(cO){Object.defineProperty(cO,"__esModule",{value:!0});var es=we(),lO=Oe(),O9=Cd(),N9={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>es._`{allowedValues: ${e}}`},C9={keyword:"enum",schemaType:"array",$data:!0,error:N9,code(e){let{gen:t,data:r,$data:n,schema:s,schemaCode:i,it:o}=e;if(!n&&s.length===0)throw Error("enum must have non-empty array");let a=s.length>=o.opts.loopEnum,l,c=()=>l!==null&&l!==void 0?l:l=lO.useFunc(t,O9.default),u;if(a||n)u=t.let("valid"),e.block$data(u,p);else{if(!Array.isArray(s))throw Error("ajv implementation error");let m=t.const("vSchema",i);u=es.or(...s.map((y,g)=>h(m,g)))}e.pass(u);function p(){t.assign(u,!1),t.forOf("v",i,(m)=>t.if(es._`${c()}(${r}, ${m})`,()=>t.assign(u,!0).break()))}function h(m,y){let g=s[y];return typeof g==="object"&&g!==null?es._`${c()}(${r}, ${m}[${y}])`:es._`${r} === ${g}`}}};cO.default=C9});var Ny=T(function(fO){Object.defineProperty(fO,"__esModule",{value:!0});var I9=TR(),J9=JR(),M9=VR(),D9=HR(),L9=GR(),F9=YR(),q9=QR(),V9=sO(),B9=aO(),W9=uO(),U9=[I9.default,J9.default,M9.default,D9.default,L9.default,F9.default,q9.default,V9.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},B9.default,W9.default];fO.default=U9});var Cy=T(function(pO){Object.defineProperty(pO,"__esModule",{value:!0});pO.validateAdditionalItems=void 0;var Nr=we(),za=Oe(),z9={message:({params:{len:e}})=>Nr.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Nr._`{limit: ${e}}`},G9={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:z9,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){za.checkStrictMode(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}dO(e,n)}};function dO(e,t){let{gen:r,schema:n,data:s,keyword:i,it:o}=e;o.items=!0;let a=r.const("len",Nr._`${s}.length`);if(n===!1)e.setParams({len:t.length}),e.pass(Nr._`${a} <= ${t.length}`);else if(typeof n=="object"&&!za.alwaysValidSchema(o,n)){let c=r.var("valid",Nr._`${a} <= ${t.length}`);r.if(Nr.not(c),()=>l(c)),e.ok(c)}function l(c){r.forRange("i",t.length,a,(u)=>{if(e.subschema({keyword:i,dataProp:u,dataPropType:za.Type.Num},c),!o.allErrors)r.if(Nr.not(c),()=>r.break())})}}pO.validateAdditionalItems=dO;pO.default=G9});var Ty=T(function(yO){Object.defineProperty(yO,"__esModule",{value:!0});yO.validateTuple=void 0;var Td=we(),vi=Oe(),hO=ln(),X9={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return gO(e,"additionalItems",t);if(r.items=!0,vi.alwaysValidSchema(r,t))return;e.ok(hO.validateArray(e))}};function gO(e,t,r=e.schema){let{gen:n,parentSchema:s,data:i,keyword:o,it:a}=e;if(u(s),a.opts.unevaluated&&r.length&&a.items!==!0)a.items=vi.mergeEvaluated.items(n,r.length,a.items);let l=n.name("valid"),c=n.const("len",Td._`${i}.length`);r.forEach((p,h)=>{if(vi.alwaysValidSchema(a,p))return;n.if(Td._`${c} > ${h}`,()=>e.subschema({keyword:o,schemaProp:h,dataProp:h},l)),e.ok(l)});function u(p){let{opts:h,errSchemaPath:m}=a,y=r.length,g=y===p.minItems&&(y===p.maxItems||p[t]===!1);if(h.strictTuples&&!g){let b=`"${o}" is ${y}-tuple, but minItems or maxItems/${t} are not specified or different at path "${m}"`;vi.checkStrictMode(a,b,h.strictTuples)}}}yO.validateTuple=gO;yO.default=X9});var wO=T(function($O){Object.defineProperty($O,"__esModule",{value:!0});var xO=Ty(),Z9={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(e)=>xO.validateTuple(e,"items")};$O.default=Z9});var jO=T(function(PO){Object.defineProperty(PO,"__esModule",{value:!0});var Id=we(),vO=Oe(),SO=ln(),EO=Cy(),eG={message:({params:{len:e}})=>Id.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Id._`{limit: ${e}}`},tG={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:eG,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:s}=r;if(n.items=!0,vO.alwaysValidSchema(n,t))return;if(s)EO.validateAdditionalItems(e,s);else e.ok(SO.validateArray(e))}};PO.default=tG});var _O=T(function(kO){Object.defineProperty(kO,"__esModule",{value:!0});var ct=we(),Si=Oe(),nG={message:({params:{min:e,max:t}})=>t===void 0?ct.str`must contain at least ${e} valid item(s)`:ct.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?ct._`{minContains: ${e}}`:ct._`{minContains: ${e}, maxContains: ${t}}`},sG={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:nG,code(e){let{gen:t,schema:r,parentSchema:n,data:s,it:i}=e,o,a,{minContains:l,maxContains:c}=n;if(i.opts.next)o=l===void 0?1:l,a=c;else o=1;let u=t.const("len",ct._`${s}.length`);if(e.setParams({min:o,max:a}),a===void 0&&o===0){Si.checkStrictMode(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&o>a){Si.checkStrictMode(i,'"minContains" > "maxContains" is always invalid'),e.fail();return}if(Si.alwaysValidSchema(i,r)){let g=ct._`${u} >= ${o}`;if(a!==void 0)g=ct._`${g} && ${u} <= ${a}`;e.pass(g);return}i.items=!0;let p=t.name("valid");if(a===void 0&&o===1)m(p,()=>t.if(p,()=>t.break()));else if(o===0){if(t.let(p,!0),a!==void 0)t.if(ct._`${s}.length > 0`,h)}else t.let(p,!1),h();e.result(p,()=>e.reset());function h(){let g=t.name("_valid"),b=t.let("count",0);m(g,()=>t.if(g,()=>y(b)))}function m(g,b){t.forRange("i",0,u,(w)=>{e.subschema({keyword:"contains",dataProp:w,dataPropType:Si.Type.Num,compositeRule:!0},g),b()})}function y(g){if(t.code(ct._`${g}++`),a===void 0)t.if(ct._`${g} >= ${o}`,()=>t.assign(p,!0).break());else if(t.if(ct._`${g} > ${a}`,()=>t.assign(p,!1).break()),o===1)t.assign(p,!0);else t.if(ct._`${g} >= ${o}`,()=>t.assign(p,!0))}}};kO.default=sG});var Jd=T(function(NO){Object.defineProperty(NO,"__esModule",{value:!0});NO.validateSchemaDeps=NO.validatePropertyDeps=NO.error=void 0;var Ga=we(),AO=Oe(),ts=ln();NO.error={message:({params:{property:e,depsCount:t,deps:r}})=>Ga.str`must have ${t===1?"property":"properties"} ${r} when property ${e} is present`,params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>Ga._`{property: ${e},
624
625
  missingProperty: ${n},
625
626
  depsCount: ${t},
626
- deps: ${r}}`};var U8={keyword:"dependencies",type:"object",schemaType:"object",error:KR.error,code(e){let[t,r]=z8(e);zR(e,t),GR(e,r)}};function z8({schema:e}){let t={},r={};for(let n in e){if(n==="__proto__")continue;let s=Array.isArray(e[n])?t:r;s[n]=e[n]}return[t,r]}function zR(e,t=e.schema){let{gen:r,data:n,it:s}=e;if(Object.keys(t).length===0)return;let i=r.let("missing");for(let o in t){let a=t[o];if(a.length===0)continue;let l=Yn.propertyInData(r,n,o,s.opts.ownProperties);if(e.setParams({property:o,depsCount:a.length,deps:a.join(", ")}),s.allErrors)r.if(l,()=>{for(let c of a)Yn.checkReportMissingProp(e,c)});else r.if(Fa._`${l} && (${Yn.checkMissingProp(e,a,i)})`),Yn.reportMissingProp(e,i),r.else()}}KR.validatePropertyDeps=zR;function GR(e,t=e.schema){let{gen:r,data:n,keyword:s,it:i}=e,o=r.name("valid");for(let a in t){if(UR.alwaysValidSchema(i,t[a]))continue;r.if(Yn.propertyInData(r,n,a,i.opts.ownProperties),()=>{let l=e.subschema({keyword:s,schemaProp:a},o);e.mergeValidEvaluated(l,o)},()=>r.var(o,!0)),e.ok(o)}}KR.validateSchemaDeps=GR;KR.default=U8});var eO=N(function(QR){Object.defineProperty(QR,"__esModule",{value:!0});var $d=we(),ZR=Oe(),Y8={message:"property name must be valid",params:({params:e})=>$d._`{propertyName: ${e.propertyName}}`},X8={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Y8,code(e){let{gen:t,schema:r,data:n,it:s}=e;if(ZR.alwaysValidSchema(s,r))return;let i=t.name("valid");t.forIn("key",n,(o)=>{e.setParams({propertyName:o}),e.subschema({keyword:"propertyNames",data:o,dataTypes:["string"],propertyName:o,compositeRule:!0},i),t.if($d.not(i),()=>{if(e.error(!0),!s.allErrors)t.break()})}),e.ok(i)}};QR.default=X8});var py=N(function(tO){Object.defineProperty(tO,"__esModule",{value:!0});var wi=on(),bt=we(),Q8=nn(),vi=Oe(),e9={message:"must NOT have additional properties",params:({params:e})=>bt._`{additionalProperty: ${e.additionalProperty}}`},t9={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:e9,code(e){let{gen:t,schema:r,parentSchema:n,data:s,errsCount:i,it:o}=e;if(!i)throw Error("ajv implementation error");let{allErrors:a,opts:l}=o;if(o.props=!0,l.removeAdditional!=="all"&&vi.alwaysValidSchema(o,r))return;let c=wi.allSchemaProperties(n.properties),u=wi.allSchemaProperties(n.patternProperties);p(),e.ok(bt._`${i} === ${Q8.default.errors}`);function p(){t.forIn("key",s,(y)=>{if(!c.length&&!u.length)b(y);else t.if(h(y),()=>b(y))})}function h(y){let w;if(c.length>8){let j=vi.schemaRefOrVal(o,n.properties,"properties");w=wi.isOwnProperty(t,j,y)}else if(c.length)w=bt.or(...c.map((j)=>bt._`${y} === ${j}`));else w=bt.nil;if(u.length)w=bt.or(w,...u.map((j)=>bt._`${wi.usePattern(e,j)}.test(${y})`));return bt.not(w)}function m(y){t.code(bt._`delete ${s}[${y}]`)}function b(y){if(l.removeAdditional==="all"||l.removeAdditional&&r===!1){m(y);return}if(r===!1){if(e.setParams({additionalProperty:y}),e.error(),!a)t.break();return}if(typeof r=="object"&&!vi.alwaysValidSchema(o,r)){let w=t.name("valid");if(l.removeAdditional==="failing")g(y,w,!1),t.if(bt.not(w),()=>{e.reset(),m(y)});else if(g(y,w),!a)t.if(bt.not(w),()=>t.break())}}function g(y,w,j){let S={keyword:"additionalProperties",dataProp:y,dataPropType:vi.Type.Str};if(j===!1)Object.assign(S,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(S,w)}}};tO.default=t9});var iO=N(function(sO){Object.defineProperty(sO,"__esModule",{value:!0});var nO=Oa(),wd=on(),qa=Oe(),rO=py(),n9={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:s,it:i}=e;if(i.opts.removeAdditional==="all"&&n.additionalProperties===void 0)rO.default.code(new nO.KeywordCxt(i,rO.default,"additionalProperties"));let o=wd.allSchemaProperties(r);for(let p of o)i.definedProperties.add(p);if(i.opts.unevaluated&&o.length&&i.props!==!0)i.props=qa.mergeEvaluated.props(t,qa.toHash(o),i.props);let a=o.filter((p)=>!qa.alwaysValidSchema(i,r[p]));if(a.length===0)return;let l=t.name("valid");for(let p of a){if(c(p))u(p);else{if(t.if(wd.propertyInData(t,s,p,i.opts.ownProperties)),u(p),!i.allErrors)t.else().var(l,!0);t.endIf()}e.it.definedProperties.add(p),e.ok(l)}function c(p){return i.opts.useDefaults&&!i.compositeRule&&r[p].default!==void 0}function u(p){e.subschema({keyword:"properties",schemaProp:p,dataProp:p},l)}}};sO.default=n9});var aO=N(function(oO){Object.defineProperty(oO,"__esModule",{value:!0});var vd=on(),Si=we(),Sd=Oe(),Ed=Oe(),i9={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:s,it:i}=e,{opts:o}=i,a=vd.allSchemaProperties(r),l=a.filter((g)=>Sd.alwaysValidSchema(i,r[g]));if(a.length===0||l.length===a.length&&(!i.opts.unevaluated||i.props===!0))return;let c=o.strictSchema&&!o.allowMatchingProperties&&s.properties,u=t.name("valid");if(i.props!==!0&&!(i.props instanceof Si.Name))i.props=Ed.evaluatedPropsToName(t,i.props);let{props:p}=i;h();function h(){for(let g of a){if(c)m(g);if(i.allErrors)b(g);else t.var(u,!0),b(g),t.if(u)}}function m(g){for(let y in c)if(new RegExp(g).test(y))Sd.checkStrictMode(i,`property ${y} matches pattern ${g} (use allowMatchingProperties)`)}function b(g){t.forIn("key",n,(y)=>{t.if(Si._`${vd.usePattern(e,g)}.test(${y})`,()=>{let w=l.includes(g);if(!w)e.subschema({keyword:"patternProperties",schemaProp:g,dataProp:y,dataPropType:Ed.Type.Str},u);if(i.opts.unevaluated&&p!==!0)t.assign(Si._`${p}[${y}]`,!0);else if(!w&&!i.allErrors)t.if(Si.not(u),()=>t.break())})})}}};oO.default=i9});var uO=N(function(cO){Object.defineProperty(cO,"__esModule",{value:!0});var lO=Oe(),a9={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if(lO.alwaysValidSchema(n,r)){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"}};cO.default=a9});var pO=N(function(dO){Object.defineProperty(dO,"__esModule",{value:!0});var fO=on(),c9={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:fO.validateUnion,error:{message:"must match a schema in anyOf"}};dO.default=c9});var gO=N(function(hO){Object.defineProperty(hO,"__esModule",{value:!0});var Ei=we(),mO=Oe(),f9={message:"must match exactly one schema in oneOf",params:({params:e})=>Ei._`{passingSchemas: ${e.passing}}`},d9={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:f9,code(e){let{gen:t,schema:r,parentSchema:n,it:s}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(s.opts.discriminator&&n.discriminator)return;let i=r,o=t.let("valid",!1),a=t.let("passing",null),l=t.name("_valid");e.setParams({passing:a}),t.block(c),e.result(o,()=>e.reset(),()=>e.error(!0));function c(){i.forEach((u,p)=>{let h;if(mO.alwaysValidSchema(s,u))t.var(l,!0);else h=e.subschema({keyword:"oneOf",schemaProp:p,compositeRule:!0},l);if(p>0)t.if(Ei._`${l} && ${o}`).assign(o,!1).assign(a,Ei._`[${a}, ${p}]`).else();t.if(l,()=>{if(t.assign(o,!0),t.assign(a,p),h)e.mergeEvaluated(h,Ei.Name)})})}}};hO.default=d9});var xO=N(function(bO){Object.defineProperty(bO,"__esModule",{value:!0});var yO=Oe(),m9={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");let s=t.name("valid");r.forEach((i,o)=>{if(yO.alwaysValidSchema(n,i))return;let a=e.subschema({keyword:"allOf",schemaProp:o},s);e.ok(s),e.mergeEvaluated(a)})}};bO.default=m9});var vO=N(function(wO){Object.defineProperty(wO,"__esModule",{value:!0});var ji=we(),jd=Oe(),g9={message:({params:e})=>ji.str`must match "${e.ifClause}" schema`,params:({params:e})=>ji._`{failingKeyword: ${e.ifClause}}`},y9={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:g9,code(e){let{gen:t,parentSchema:r,it:n}=e;if(r.then===void 0&&r.else===void 0)jd.checkStrictMode(n,'"if" without "then" and "else" is ignored');let s=$O(n,"then"),i=$O(n,"else");if(!s&&!i)return;let o=t.let("valid",!0),a=t.name("_valid");if(l(),e.reset(),s&&i){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(ji.not(a),c("else"));e.pass(o,()=>e.error(!0));function l(){let u=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(u)}function c(u,p){return()=>{let h=e.subschema({keyword:u},a);if(t.assign(o,a),e.mergeValidEvaluated(h,o),p)t.assign(p,ji._`${u}`);else e.setParams({ifClause:u})}}}};function $O(e,t){let r=e.schema[t];return r!==void 0&&!jd.alwaysValidSchema(e,r)}wO.default=y9});var jO=N(function(EO){Object.defineProperty(EO,"__esModule",{value:!0});var SO=Oe(),x9={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){if(t.if===void 0)SO.checkStrictMode(r,`"${e}" without "if" is ignored`)}};EO.default=x9});var my=N(function(PO){Object.defineProperty(PO,"__esModule",{value:!0});var w9=fy(),v9=DR(),S9=dy(),E9=WR(),j9=HR(),P9=xd(),k9=eO(),_9=py(),A9=iO(),R9=aO(),O9=uO(),C9=pO(),N9=gO(),T9=xO(),I9=vO(),J9=jO();function M9(e=!1){let t=[O9.default,C9.default,N9.default,T9.default,I9.default,J9.default,k9.default,_9.default,P9.default,A9.default,R9.default];if(e)t.push(v9.default,E9.default);else t.push(w9.default,S9.default);return t.push(j9.default),t}PO.default=M9});var hy=N(function(AO){Object.defineProperty(AO,"__esModule",{value:!0});AO.dynamicAnchor=void 0;var Va=we(),L9=nn(),Pd=hc(),kO=md(),F9={keyword:"$dynamicAnchor",schemaType:"string",code:(e)=>_O(e,e.schema)};function _O(e,t){let{gen:r,it:n}=e;n.schemaEnv.root.dynamicAnchors[t]=!0;let s=Va._`${L9.default.dynamicAnchors}${Va.getProperty(t)}`,i=n.errSchemaPath==="#"?n.validateName:q9(e);r.if(Va._`!${s}`,()=>r.assign(s,i))}AO.dynamicAnchor=_O;function q9(e){let{schemaEnv:t,schema:r,self:n}=e.it,{root:s,baseId:i,localRefs:o,meta:a}=t.root,{schemaId:l}=n.opts,c=new Pd.SchemaEnv({schema:r,schemaId:l,root:s,baseId:i,localRefs:o,meta:a});return Pd.compileSchema.call(n,c),kO.getValidate(e,c)}AO.default=F9});var gy=N(function(CO){Object.defineProperty(CO,"__esModule",{value:!0});CO.dynamicRef=void 0;var kd=we(),W9=nn(),_d=md(),B9={keyword:"$dynamicRef",schemaType:"string",code:(e)=>OO(e,e.schema)};function OO(e,t){let{gen:r,keyword:n,it:s}=e;if(t[0]!=="#")throw Error(`"${n}" only supports hash fragment reference`);let i=t.slice(1);if(s.allErrors)o();else{let l=r.let("valid",!1);o(l),e.ok(l)}function o(l){if(s.schemaEnv.root.dynamicAnchors[i]){let c=r.let("_v",kd._`${W9.default.dynamicAnchors}${kd.getProperty(i)}`);r.if(c,a(c,l),a(s.validateName,l))}else a(s.validateName,l)()}function a(l,c){return c?()=>r.block(()=>{_d.callRef(e,l),r.let(c,!0)}):()=>_d.callRef(e,l)}}CO.dynamicRef=OO;CO.default=B9});var MO=N(function(JO){Object.defineProperty(JO,"__esModule",{value:!0});var TO=hy(),IO=Oe(),U9={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){if(e.schema)TO.dynamicAnchor(e,"");else IO.checkStrictMode(e.it,"$recursiveAnchor: false is ignored")}};JO.default=U9});var FO=N(function(LO){Object.defineProperty(LO,"__esModule",{value:!0});var DO=gy(),G9={keyword:"$recursiveRef",schemaType:"string",code:(e)=>DO.dynamicRef(e,e.schema)};LO.default=G9});var VO=N(function(qO){Object.defineProperty(qO,"__esModule",{value:!0});var Y9=hy(),X9=gy(),Z9=MO(),Q9=FO(),eG=[Y9.default,X9.default,Z9.default,Q9.default];qO.default=eG});var BO=N(function(WO){Object.defineProperty(WO,"__esModule",{value:!0});var Ad=xd(),rG={keyword:"dependentRequired",type:"object",schemaType:"object",error:Ad.error,code:(e)=>Ad.validatePropertyDeps(e)};WO.default=rG});var zO=N(function(UO){Object.defineProperty(UO,"__esModule",{value:!0});var HO=xd(),sG={keyword:"dependentSchemas",type:"object",schemaType:"object",code:(e)=>HO.validateSchemaDeps(e)};UO.default=sG});var YO=N(function(KO){Object.defineProperty(KO,"__esModule",{value:!0});var GO=Oe(),oG={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:e,parentSchema:t,it:r}){if(t.contains===void 0)GO.checkStrictMode(r,`"${e}" without "contains" is ignored`)}};KO.default=oG});var ZO=N(function(XO){Object.defineProperty(XO,"__esModule",{value:!0});var lG=BO(),cG=zO(),uG=YO(),fG=[lG.default,cG.default,uG.default];XO.default=fG});var eC=N(function(QO){Object.defineProperty(QO,"__esModule",{value:!0});var or=we(),Rd=Oe(),pG=nn(),mG={message:"must NOT have unevaluated properties",params:({params:e})=>or._`{unevaluatedProperty: ${e.unevaluatedProperty}}`},hG={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:mG,code(e){let{gen:t,schema:r,data:n,errsCount:s,it:i}=e;if(!s)throw Error("ajv implementation error");let{allErrors:o,props:a}=i;if(a instanceof or.Name)t.if(or._`${a} !== true`,()=>t.forIn("key",n,(p)=>t.if(c(a,p),()=>l(p))));else if(a!==!0)t.forIn("key",n,(p)=>a===void 0?l(p):t.if(u(a,p),()=>l(p)));i.props=!0,e.ok(or._`${s} === ${pG.default.errors}`);function l(p){if(r===!1){if(e.setParams({unevaluatedProperty:p}),e.error(),!o)t.break();return}if(!Rd.alwaysValidSchema(i,r)){let h=t.name("valid");if(e.subschema({keyword:"unevaluatedProperties",dataProp:p,dataPropType:Rd.Type.Str},h),!o)t.if(or.not(h),()=>t.break())}}function c(p,h){return or._`!${p} || !${p}[${h}]`}function u(p,h){let m=[];for(let b in p)if(p[b]===!0)m.push(or._`${h} !== ${b}`);return or.and(...m)}}};QO.default=hG});var rC=N(function(tC){Object.defineProperty(tC,"__esModule",{value:!0});var Cr=we(),Od=Oe(),yG={message:({params:{len:e}})=>Cr.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Cr._`{limit: ${e}}`},bG={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:yG,code(e){let{gen:t,schema:r,data:n,it:s}=e,i=s.items||0;if(i===!0)return;let o=t.const("len",Cr._`${n}.length`);if(r===!1)e.setParams({len:i}),e.fail(Cr._`${o} > ${i}`);else if(typeof r=="object"&&!Od.alwaysValidSchema(s,r)){let l=t.var("valid",Cr._`${o} <= ${i}`);t.if(Cr.not(l),()=>a(l,i)),e.ok(l)}s.items=!0;function a(l,c){t.forRange("i",c,o,(u)=>{if(e.subschema({keyword:"unevaluatedItems",dataProp:u,dataPropType:Od.Type.Num},l),!s.allErrors)t.if(Cr.not(l),()=>t.break())})}}};tC.default=bG});var sC=N(function(nC){Object.defineProperty(nC,"__esModule",{value:!0});var $G=eC(),wG=rC(),vG=[$G.default,wG.default];nC.default=vG});var oC=N(function(iC){Object.defineProperty(iC,"__esModule",{value:!0});var Pe=we(),EG={message:({schemaCode:e})=>Pe.str`must match format "${e}"`,params:({schemaCode:e})=>Pe._`{format: ${e}}`},jG={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:EG,code(e,t){let{gen:r,data:n,$data:s,schema:i,schemaCode:o,it:a}=e,{opts:l,errSchemaPath:c,schemaEnv:u,self:p}=a;if(!l.validateFormats)return;if(s)h();else m();function h(){let b=r.scopeValue("formats",{ref:p.formats,code:l.code.formats}),g=r.const("fDef",Pe._`${b}[${o}]`),y=r.let("fType"),w=r.let("format");r.if(Pe._`typeof ${g} == "object" && !(${g} instanceof RegExp)`,()=>r.assign(y,Pe._`${g}.type || "string"`).assign(w,Pe._`${g}.validate`),()=>r.assign(y,Pe._`"string"`).assign(w,g)),e.fail$data(Pe.or(j(),S()));function j(){if(l.strictSchema===!1)return Pe.nil;return Pe._`${o} && !${w}`}function S(){let E=u.$async?Pe._`(${g}.async ? await ${w}(${n}) : ${w}(${n}))`:Pe._`${w}(${n})`,P=Pe._`(typeof ${w} == "function" ? ${E} : ${w}.test(${n}))`;return Pe._`${w} && ${w} !== true && ${y} === ${t} && !${P}`}}function m(){let b=p.formats[i];if(!b){j();return}if(b===!0)return;let[g,y,w]=S(b);if(g===t)e.pass(E());function j(){if(l.strictSchema===!1){p.logger.warn(P());return}throw Error(P());function P(){return`unknown format "${i}" ignored in schema at path "${c}"`}}function S(P){let A=P instanceof RegExp?Pe.regexpCode(P):l.code.formats?Pe._`${l.code.formats}${Pe.getProperty(i)}`:void 0,R=r.scopeValue("formats",{key:i,ref:P,code:A});if(typeof P=="object"&&!(P instanceof RegExp))return[P.type||"string",P.validate,Pe._`${R}.validate`];return["string",P,R]}function E(){if(typeof b=="object"&&!(b instanceof RegExp)&&b.async){if(!u.$async)throw Error("async format in sync schema");return Pe._`await ${w}(${n})`}return typeof y=="function"?Pe._`${w}(${n})`:Pe._`${w}.test(${n})`}}}};iC.default=jG});var yy=N(function(aC){Object.defineProperty(aC,"__esModule",{value:!0});var kG=oC(),_G=[kG.default];aC.default=_G});var by=N(function(lC){Object.defineProperty(lC,"__esModule",{value:!0});lC.contentVocabulary=lC.metadataVocabulary=void 0;lC.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];lC.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var fC=N(function(uC){Object.defineProperty(uC,"__esModule",{value:!0});var OG=cy(),CG=uy(),NG=my(),TG=VO(),IG=ZO(),JG=sC(),MG=yy(),Cd=by(),DG=[TG.default,OG.default,CG.default,(0,NG.default)(!0),MG.default,Cd.metadataVocabulary,Cd.contentVocabulary,IG.default,JG.default];uC.default=DG});var hC=N(function(pC){Object.defineProperty(pC,"__esModule",{value:!0});pC.DiscrError=void 0;var dC;(function(e){e.Tag="tag",e.Mapping="mapping"})(dC||(pC.DiscrError=dC={}))});var xy=N(function(yC){Object.defineProperty(yC,"__esModule",{value:!0});var ln=we(),Wa=hC(),Nd=hc(),FG=Na(),gC=Oe(),qG={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:r}})=>ln._`{error: ${e}, tag: ${r}, tagValue: ${t}}`},VG={keyword:"discriminator",type:"object",schemaType:"object",error:qG,code(e){let{gen:t,data:r,schema:n,parentSchema:s,it:i}=e,{oneOf:o}=s;if(!i.opts.discriminator)throw Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw Error("discriminator: requires propertyName");if(n.mapping)throw Error("discriminator: mapping is not supported");if(!o)throw Error("discriminator: requires oneOf keyword");let l=t.let("valid",!1),c=t.const("tag",ln._`${r}${ln.getProperty(a)}`);t.if(ln._`typeof ${c} == "string"`,()=>u(),()=>e.error(!1,{discrError:Wa.DiscrError.Tag,tag:c,tagName:a})),e.ok(l);function u(){let m=h();t.if(!1);for(let b in m)t.elseIf(ln._`${c} === ${b}`),t.assign(l,p(m[b]));t.else(),e.error(!1,{discrError:Wa.DiscrError.Mapping,tag:c,tagName:a}),t.endIf()}function p(m){let b=t.name("valid"),g=e.subschema({keyword:"oneOf",schemaProp:m},b);return e.mergeEvaluated(g,ln.Name),b}function h(){var m;let b={},g=w(s),y=!0;for(let E=0;E<o.length;E++){let P=o[E];if((P===null||P===void 0?void 0:P.$ref)&&!gC.schemaHasRulesButRef(P,i.self.RULES)){let R=P.$ref;if(P=Nd.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,R),P instanceof Nd.SchemaEnv)P=P.schema;if(P===void 0)throw new FG.default(i.opts.uriResolver,i.baseId,R)}let A=(m=P===null||P===void 0?void 0:P.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}"`);y=y&&(g||w(P)),j(A,E)}if(!y)throw Error(`discriminator: "${a}" must be required`);return b;function w({required:E}){return Array.isArray(E)&&E.includes(a)}function j(E,P){if(E.const)S(E.const,P);else if(E.enum)for(let A of E.enum)S(A,P);else throw Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function S(E,P){if(typeof E!="string"||E in b)throw Error(`discriminator: "${a}" values must be unique strings`);b[E]=P}}}};yC.default=VG});var bC=N(function(dce,BG){BG.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 xC=N(function(pce,HG){HG.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 $C=N(function(mce,UG){UG.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 wC=N(function(hce,zG){zG.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 vC=N(function(gce,GG){GG.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 SC=N(function(yce,KG){KG.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 EC=N(function(bce,YG){YG.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 jC=N(function(xce,XG){XG.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 kC=N(function(PC){Object.defineProperty(PC,"__esModule",{value:!0});var ZG=bC(),QG=xC(),eK=$C(),tK=wC(),rK=vC(),nK=SC(),sK=EC(),iK=jC(),oK=["/properties"];function aK(e){return[ZG,QG,eK,tK,rK,t(this,nK),sK,t(this,iK)].forEach((r)=>this.addMetaSchema(r,void 0,!1)),this;function t(r,n){return e?r.$dataMetaSchema(n,oK):n}}PC.default=aK});var vy=N(function(Nr,wy){Object.defineProperty(Nr,"__esModule",{value:!0});Nr.MissingRefError=Nr.ValidationError=Nr.CodeGen=Nr.Name=Nr.nil=Nr.stringify=Nr.str=Nr._=Nr.KeywordCxt=Nr.Ajv2020=void 0;var cK=ly(),uK=fC(),fK=xy(),dK=kC(),$y="https://json-schema.org/draft/2020-12/schema";class bc extends cK.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){if(super._addVocabularies(),uK.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(fK.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:t}=this.opts;if(!t)return;dK.default.call(this,e),this.refs["http://json-schema.org/schema"]=$y}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema($y)?$y:void 0)}}Nr.Ajv2020=bc;wy.exports=Nr=bc;wy.exports.Ajv2020=bc;Object.defineProperty(Nr,"__esModule",{value:!0});Nr.default=bc;var pK=Oa();Object.defineProperty(Nr,"KeywordCxt",{enumerable:!0,get:function(){return pK.KeywordCxt}});var Ba=we();Object.defineProperty(Nr,"_",{enumerable:!0,get:function(){return Ba._}});Object.defineProperty(Nr,"str",{enumerable:!0,get:function(){return Ba.str}});Object.defineProperty(Nr,"stringify",{enumerable:!0,get:function(){return Ba.stringify}});Object.defineProperty(Nr,"nil",{enumerable:!0,get:function(){return Ba.nil}});Object.defineProperty(Nr,"Name",{enumerable:!0,get:function(){return Ba.Name}});Object.defineProperty(Nr,"CodeGen",{enumerable:!0,get:function(){return Ba.CodeGen}});var mK=pc();Object.defineProperty(Nr,"ValidationError",{enumerable:!0,get:function(){return mK.default}});var hK=Na();Object.defineProperty(Nr,"MissingRefError",{enumerable:!0,get:function(){return hK.default}})});import{existsSync as Id,readFileSync as RC}from"node:fs";import{createRequire as _C}from"node:module";import{basename as bK,isAbsolute as xK,relative as $K,resolve as Sy}from"node:path";import{fileURLToPath as AC,pathToFileURL as wK}from"node:url";function Td(e){return JSON.parse(RC(e,"utf8"))}async function OC(e){let t=Sy(e),r=kn(t),n=Sy(t,"project.schema.json");if(!Id(r))throw Error(`No project.jxn or project.json in ${t}`);if(!Id(n))throw Error(`project.schema.json not found in ${t} — run \`jx schema\` to generate it from `+"the project file's extensions");let s=nu(RC(r,"utf8"),r),i=Td(n);i.$id=wK(n).href;let o;try{({default:o}=await Promise.resolve().then(() => br(vy(),1)))}catch(p){throw Error("Project validation requires ajv: bun add ajv",{cause:p})}let l=await new o({allErrors:!0,loadSchema:(p)=>EK(p,t),strict:!1}).compileAsync(i),c=l(s),u=l.errors??null;return{errors:u&&ms(r)?SK(u,s):u,file:bK(r),valid:c}}function vK(e,t){let r=e;for(let n of t.split("/").slice(1)){let s=n.replaceAll("~1","/").replaceAll("~0","~");r=Array.isArray(r)?r[Number(s)]:W(r)?r[s]:void 0}return r}function SK(e,t){return e.map((r)=>{if(!V(r)||!("keyword"in r)||r.keyword!=="type"||!("params"in r)||!V(r.params)||!("type"in r.params)||r.params.type!=="array"||!("instancePath"in r)||!O(r.instancePath))return r;let n=vK(t,r.instancePath),s=Dt(n,"",r.instancePath),i=r.instancePath.split("/").at(-1)??"";if(s===null||s.includes(`
627
- `)||i==="")return r;return{...r,message:`must be a list, written as ${i} { - ${s} }`}})}async function EK(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 r=AC(e),n=$K(t,r);if(n.startsWith("..")||xK(n))throw Error(`Schema ref "${e}" escapes the project root ${t}`);if(Id(r))return Td(r);let s=n.split("\\").join("/"),i="node_modules/",o=s.lastIndexOf(i);if(o===-1)throw Error(`Schema ref "${e}" does not exist`);let a=s.slice(o+i.length),l="@jxsuite/schema/",c;try{c=_C(Sy(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=_C(import.meta.url).resolve(a)}catch(p){let h=AC(new URL(`../${a.slice(l.length)}`,import.meta.url));if(Id(h))return Td(h);throw Error(`Schema ref "${e}" does not exist and "${a}" is not resolvable from the project or this host's core`,{cause:p})}}return Td(c)}var CC=D(()=>{ye();Kc();tu();su();Vo()});function Zn(e){return W(e.attributes)?e.attributes:{}}function ar(e,t){let r=Zn(e)[t];return O(r)?r:null}function Et(e){return O(e.tagName)?e.tagName.toLowerCase():""}function gr(e,t="the popover"){let r=O(e.id)?e.id:ar(e,"id");if(r)return`#${r}`;let n=Et(e);return n===""?t:`the <${n}>`}function kK(e){let t=Zn(e).popover;return O(t)?t:null}function TC(e){let t=new Set,r=new Set;for(let n of e){let s=n!==null&&O(n.tagName)?n.tagName:"";if(n===null||!s.includes("-"))continue;if(Ey(n))t.add(s);let i=n.observedAttributes;if(Array.isArray(i)&&_K.every((o)=>i.includes(o)))r.add(s)}return{invokerTags:r,popoverTags:t}}function Ey(e){return"popover"in Zn(e)||"popover"in e}function xc(e,t){return Ey(e)||(t?.popoverTags?.has(Et(e))??!1)}function Pi(e){if(O(e.id)&&e.id!=="")return e.id;let t=ar(e,"id");return t===""?null:t}function*Xn(e,t=[],r=null,n){yield{enclosing:r,node:e,path:t};let s=xc(e,n)?e:r,{children:i}=e;if(Array.isArray(i)){for(let[l,c]of i.entries())if(V(c))yield*Xn(c,[...t,"children",l],s,n)}else if(W(i)&&xr(i.map))yield*Xn(i.map,[...t,"children","map"],s,n);let o=xr(e.map)?e.map:null;if(o)yield*Xn(o,[...t,"map"],s,n);let a=W(e.cases)?e.cases:{};for(let[l,c]of Object.entries(a))if(V(c))yield*Xn(c,[...t,"cases",l],s,n)}function jy(e,t){let r=[];for(let{node:n}of Xn(e,[],null,t)){if(!xc(n,t))continue;let s=Pi(n);if(s!==null&&!r.includes(s))r.push(s)}return r}function Jd(e){return e.startsWith("@")}function IC(e){return e.startsWith(":")||e.startsWith("&")||e.startsWith(".")||e.startsWith("[")}function hr(e,t){let r=e?.[t];if(r===void 0||Ni(r)||Array.isArray(r))return null;return String(r)}function JC(e){for(let[t,r]of Object.entries(e??{})){if(!Ni(r))continue;if(IC(t)&&t.includes(":popover-open")&&hr(r,"display")!==null)return!0;if(Jd(t)&&JC(r))return!0}return!1}function MC(e){for(let[t,r]of Object.entries(e??{})){if(!Ni(r))continue;if(IC(t)&&t.includes(":popover-open"))return!0;if(Jd(t)&&MC(r))return!0}return!1}function RK(e){return AK.some((t)=>hr(e,t)!==null)}function OK(e){if(!e)return[];let t=[];for(let[r,n]of Object.entries(e))if(Jd(r)&&Ni(n)&&hr(n,"display")!==null)t.push(r);return t}function DC(e){if(!e)return[];let t=[],r=hr(e,"transition");if(r!==null)t.push(r);for(let[n,s]of Object.entries(e))if(Jd(n)&&Ni(s))t.push(...DC(s));return t}function CK(e){if(!e)return!1;if(hr(e,"positionAnchor")!==null||hr(e,"position-anchor")!==null)return!0;return["top","left","right","bottom","inset","insetBlockStart","insetInlineStart"].some((t)=>(hr(e,t)??"").includes("anchor("))}function NK(e){if(!e)return!1;if(hr(e,"positionArea")!==null||hr(e,"position-area")!==null||hr(e,"positionTryFallbacks")!==null||hr(e,"position-try-fallbacks")!==null)return!0;return Object.keys(e).some((t)=>t.startsWith("@supports"))}function LC(e,t){let r=[...Xn(e,[],null,t)],n=jy(e,t),s=r.some(({node:a})=>xc(a,t)),i=new Set;for(let{node:a}of r)if(NC.has(Et(a))){let l=ar(a,"popovertarget");if(l!==null)i.add(l)}let o=[];for(let{enclosing:a,node:l,path:c}of r)if(o.push(...TK(l,c,a,n,s,t)),Ey(l))o.push(...IK(l,c,i));return o}function TK(e,t,r,n,s,i){let o=[],a=Et(e),l=ar(e,"popovertarget"),c=NC.has(a)||(i?.invokerTags?.has(a)??!1);if(l!==null&&!c)return o.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. ${it}`,fix:"invoker",message:`<${a||"element"}> carries popovertarget, which only <button> and <input> support.`,path:t,rule:"invoker-not-button",severity:"error"}),o;if(l!==null){if(s&&!n.includes(l)){let u=n.length>0?`The popovers here are: ${n.map((p)=>`"${p}"`).join(", ")}. `:"";o.push({detail:`No element in this document declares \`popover\` with the id "${l}". ${u}A target that names nothing does nothing, silently. ${it}`,message:`popovertarget="${l}" names no popover in this document.`,path:t,rule:"target-missing",severity:"error"})}else if(r!==null&&Pi(r)!==null&&Pi(r)!==l)o.push({detail:`This control is inside ${gr(r)} 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. ${it}`,message:`A control inside ${gr(r)} targets "${l}" instead.`,path:t,rule:"target-mismatch",severity:"warn"})}if(a==="a"&&r!==null&&l===null){let u=ar(e,"href")??(O(e.href)?e.href:null),p=ar(e,"target")==="_blank",h=u!==null&&u.includes("#");if(p||h){let m=p?"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. ";o.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. ${it}`,message:`A link inside ${gr(r)} does not dismiss it.`,path:t,rule:"link-does-not-dismiss",severity:"warn"})}}return o}function IK(e,t,r){let n=[],{style:s}=e,i=gr(e),o=kK(e);if(o!==null&&o!==""&&!PK.some((c)=>c===o))n.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". ${it}`,fix:"mode",message:`${i} declares popover="${o}", which is not one of auto, manual or hint.`,path:t,rule:"invalid-mode",severity:"error"});else if(Qt(Zn(e).popover))n.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". ${it}`,fix:"mode",message:`${i} writes popover as a boolean.`,path:t,rule:"invalid-mode",severity:"error"});let a=hr(s,"display");if(a!==null&&a!=="revert"&&a!=="revert-layer")n.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. ${it}`,fix:"display",message:`${i} sets display in its base rule.`,path:t,rule:"base-display",severity:"error"});for(let c of OK(s))n.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. ${it}`,fix:"display",message:`${i} sets display inside ${c}.`,path:t,rule:"breakpoint-display",severity:"error"});if(hr(s,"visibility")!==null)n.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. ${it}`,fix:"display",message:`${i} also hides itself with visibility.`,path:t,rule:"base-visibility",severity:"warn"});if(!MC(s))n.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. ${it}`,message:`${i} has no :popover-open rule.`,path:t,rule:"no-open-rule",severity:"warn"});else if(!JC(s)&&a===null&&RK(s))n.push({detail:`${i} 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\`. ${it}`,fix:"open-display",message:`${i} is laid out with flex or grid but never sets display.`,path:t,rule:"no-open-display",severity:"error"});for(let c of DC(s))if(c.includes("display")&&!c.includes("overlay")){n.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. ${it}`,message:`${i} transitions display but not overlay.`,path:t,rule:"cut-exit",severity:"warn"});break}if(CK(s)&&!NK(s))n.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. ${it}`,message:`${i} is anchor-positioned with no fallback.`,path:t,rule:"unsafe-anchor",severity:"warn"});let l=Pi(e);if(l!==null&&!r.has(l))n.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. ${it}`,message:`${i} has no invoker in this document.`,path:t,rule:"no-invoker",severity:"warn"});return n}var PK,NC,_K,AK,it="See docs/framework/concepts/overlays.";var Md=D(()=>{ye();PK=["auto","manual","hint"],NC=new Set(["button","input"]);_K=["popovertarget","popovertargetaction","command","commandfor"];AK=["flexDirection","flex-direction","alignItems","align-items","justifyContent","justify-content","flexWrap","flex-wrap","gridTemplateColumns","grid-template-columns","gridTemplateRows","grid-template-rows","gap"]});function Ga(e,t){let r=Zn(e),n=t in r?r[t]:e[t];if(n===void 0||n===null)return{kind:"absent"};if(Be(n)||W(n))return{kind:"bound"};if(O(n))return n.includes("${")?{kind:"bound"}:{kind:"text",text:n};return{isTrue:n===!0,kind:"other"}}function Ua(e,t){let r=Ga(e,t);return r.kind==="text"&&r.text.trim()!==""?r.text:null}function lr(e,t){return Ga(e,t).kind!=="absent"}function ki(e){let t=Ga(e,"role");if(t.kind==="bound")return za;return t.kind==="text"?t.text.trim().toLowerCase().split(/\s+/)[0]:null}function Dd(e){let t=Ga(e,"id");if(t.kind==="bound")return za;return t.kind==="text"&&t.text!==""?t.text:null}function cn(e,t){let r=Ga(e,t);return r.kind==="bound"||r.kind==="text"&&r.text.trim()!==""}function Ld(e){let t=e.textContent;if(O(t)){if(t.trim()!=="")return!0}else if(t!==void 0&&t!==null)return!0;if(cn(e,"aria-label")||lr(e,"aria-labelledby"))return!0;if(Et(e)==="img"&&(cn(e,"alt")||cn(e,"title")))return!0;if(Et(e)==="slot")return!0;let{children:r}=e;if(Array.isArray(r)){for(let s of r)if(O(s)){if(s.trim()!=="")return!0}else if(V(s)&&Ld(s))return!0}else if(r!=null)return!0;if(W(e.map))return!0;return(W(e.cases)?Object.values(e.cases):[]).some((s)=>xr(s)&&Ld(s))}function*Ha(e,t=[],r=[],n=[]){yield{node:e,path:t,roles:r,tags:n};let s=[...r,ki(e)],i=[...n,Et(e)],{children:o}=e;if(Array.isArray(o)){for(let[a,l]of o.entries())if(V(l))yield*Ha(l,[...t,"children",a],s,i)}else if(W(o)&&xr(o.map))yield*Ha(o.map,[...t,"children","map"],s,i);if(xr(e.map))yield*Ha(e.map,[...t,"map"],s,i);if(W(e.cases)){for(let[a,l]of Object.entries(e.cases))if(V(l))yield*Ha(l,[...t,"cases",a],s,i)}}function qK(e){return e.some((t)=>t.includes("-"))}function Qn(e,t,r,n,s,i="error"){return{criterion:s,detail:`${n} ${JK}`,message:r,path:t,rule:e,severity:i}}function FC(e,t,r){if(r.includes("label"))return!0;if(e===za||t.bound)return!0;return e!==null&&t.ids.has(e)}function VK(e,t){let{node:r,path:n,tags:s}=e,i=Et(r),o=ki(r);if(o==="bound")return null;if(cn(r,"aria-label")||lr(r,"aria-labelledby")||cn(r,"title"))return null;let l=gr(r,"the control"),c=(p)=>Qn("interactive-unnamed",n,`${l} has no accessible name.`,`A control with no name is announced as its role alone, so a reader hears "button" and nothing else. ${p}`,"4.1.2"),u=WK(r,i,t,s);if(u==="named"||u==="exempt")return null;if(o!==null&&MK.has(o))return Ld(r)?null:c("Give it text content, or an aria-label.");if(o!==null&&DK.has(o))return c("Give it an aria-label, or aria-labelledby naming its visible label.");if(o!==null)return null;if(i==="button"||i==="summary"||i==="a"&&lr(r,"href"))return Ld(r)?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 WK(e,t,r,n){if(t==="area"){if(!lr(e,"href"))return"none";return cn(e,"alt")?"named":"unnamed-alt"}if(t==="select"||t==="textarea")return FC(Dd(e),r,n)||cn(e,"placeholder")?"named":"unnamed";if(t!=="input")return"none";let s=(Ua(e,"type")??"text").toLowerCase();if(s==="hidden"||lr(e,"type")&&Ua(e,"type")===null)return"exempt";if(LK.has(s))return cn(e,"value")?"named":"unnamed-value";if(s==="image")return cn(e,"alt")?"named":"unnamed-alt";return FC(Dd(e),r,n)||cn(e,"placeholder")?"named":"unnamed"}function HK(e){let{node:t,path:r,tags:n}=e,s=Et(t);if(!s.includes("-")||!n.some((i)=>BK.has(i)))return null;return Qn("custom-element-in-select",r,`<${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 UK(e){let{node:t,path:r}=e;if(Et(t)!=="img")return null;let n=ki(t);if(n==="bound"||n==="presentation"||n==="none")return null;if(lr(t,"alt")||cn(t,"aria-label")||lr(t,"aria-labelledby"))return null;return Qn("img-alt-missing",r,`${gr(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 GK(e,t){let{node:r,path:n}=e,s=[];for(let i of zK){let o=Ua(r,i);if(o===null)continue;for(let a of o.split(/\s+/))if(a!==""&&!t.has(a))s.push(Qn("aria-target-missing",n,`${gr(r,"the element")} points ${i} 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 KK(e,t,r){for(let n of qC.get(t)??[]){let s=r.get(n);if(s===void 0)continue;if(s.bound)return!0;if(e===za&&s.ids.size>0)return!0;if(e!==null&&e!==za&&s.ids.has(e))return!0}return!1}function YK(e,t){let{node:r,path:n,roles:s,tags:i}=e,o=ki(r);if(o===null||o==="bound"||n.length===0||qK(i))return null;if(s.includes("bound")||KK(Dd(r),o,t))return null;let a=gr(r,"the element");if(o==="tab"&&!s.includes("tablist"))return Qn("tab-outside-tablist",n,`${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((o==="menuitem"||o==="menuitemcheckbox"||o==="menuitemradio")&&!s.includes("menu")&&!s.includes("menubar"))return Qn("menuitem-outside-menu",n,`${a} is a ${o} 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(o==="option"&&!s.includes("listbox")&&!i.includes("select")&&!i.includes("datalist"))return Qn("option-outside-listbox",n,`${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 XK(e){let t=[];for(let{node:r}of Ha(e)){if(ki(r)!=="tab")continue;let n=Ga(r,"aria-selected");if(n.kind==="bound")return null;t.push(n.kind==="other"&&n.isTrue||n.kind==="text"&&n.text==="true")}return t}function ZK(e){let{node:t,path:r}=e;if(ki(t)!=="tablist")return null;let n=XK(t);if(n===null||n.length===0||n.includes(!0))return null;return Qn("tablist-none-selected",r,`${gr(t,"the tablist")} has ${n.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 QK(e){let{node:t,path:r}=e,n=ki(t);if(!(Et(t)==="dialog"||n==="dialog"||n==="alertdialog")||n==="bound")return null;if(cn(t,"aria-label")||lr(t,"aria-labelledby"))return null;return Qn("dialog-unnamed",r,`${gr(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 t7(e){let{node:t,path:r}=e;if(!lr(t,"aria-activedescendant"))return null;let n=Et(t);if(e7.has(n)||n==="a"&&lr(t,"href")||lr(t,"tabIndex")||lr(t,"tabindex")||lr(t,"contenteditable"))return null;return Qn("activedescendant-not-focusable",r,`${gr(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 VC(e){let t=[...Ha(e)],r=new Set,n={bound:!1,ids:new Set},s=new Map,i=!1;for(let{node:a}of t){let l=ki(a);if(l!==null&&FK.has(l)){let u=s.get(l)??{bound:!1,ids:new Set},p=Ua(a,"aria-owns");if(p===null)u.bound||=lr(a,"aria-owns");else for(let h of p.split(/\s+/))if(h!=="")u.ids.add(h);s.set(l,u)}let c=Dd(a);if(c===za)i=!0;else if(c!==null)r.add(c);if(Et(a)==="label"){let u=Ua(a,"for")??Ua(a,"htmlFor");if(u===null)n.bound||=lr(a,"for")||lr(a,"htmlFor");else n.ids.add(u)}}let o=[];for(let a of t){let l=[VK(a,n),UK(a),YK(a,s),HK(a),ZK(a),QK(a),t7(a)];for(let c of l)if(c)o.push(c);if(!i)o.push(...GK(a,r))}return o}var JK="See docs/framework/concepts/accessibility.",za="bound",MK,DK,LK,qC,FK,BK,zK,e7;var WC=D(()=>{ye();Md();MK=new Set(["button","checkbox","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","switch","tab","treeitem"]),DK=new Set(["combobox","listbox","searchbox","slider","spinbutton","textbox"]),LK=new Set(["button","reset","submit"]),qC=new Map([["menuitem",["menu","menubar"]],["menuitemcheckbox",["menu","menubar"]],["menuitemradio",["menu","menubar"]],["option",["listbox"]],["tab",["tablist"]]]),FK=new Set([...qC.values()].flat());BK=new Set(["select","jx-select"]);zK=["aria-activedescendant","aria-controls","aria-describedby","aria-details","aria-errormessage","aria-flowto","aria-labelledby","aria-owns"];e7=new Set(["button","input","select","textarea"])});function Py(e){return Et(e)==="dialog"}function BC(e){return e.startsWith("--")}function l7(e){let t=[];for(let{node:r}of Xn(e)){let n=Pi(r);if(Py(r)&&n!==null&&!t.includes(n))t.push(n)}return t}function c7(e){let t=e.oncommand;return t!==void 0&&t!==null}function u7(e,t){for(let{node:r}of Xn(e)){if(r===e)continue;let n=Et(r);if(n==="button"){let s=ar(r,"command"),i=ar(r,"commandfor");if(s!==null&&(s==="close"||s==="request-close")&&(i===null||i===t))return!0}if(n==="form"&&ar(r,"method")?.toLowerCase()==="dialog")return!0}return!1}function UC(e,t){let r=[...Xn(e,[],null,t)],n=l7(e),s=jy(e,t),i=n.length>0||s.length>0,o=new Map,a=new Map;for(let{node:c}of r){let u=Pi(c);if(u!==null&&!o.has(u))o.set(u,c);if(Et(c)==="button"){let p=ar(c,"commandfor"),h=ar(c,"command");if(p!==null){let m=a.get(p)??new Set;m.add(h??""),a.set(p,m)}}}let l=[];for(let{node:c,path:u}of r)if(l.push(...f7(c,u,o,n,s,i,t)),Py(c))l.push(...d7(c,u,a));return l}function f7(e,t,r,n,s,i,o){let a=[],l=Et(e),c=o?.invokerTags?.has(l)??!1,u=ar(e,"command"),p=ar(e,"commandfor");if(!(u!==null||p!==null||("command"in Zn(e))||("commandfor"in Zn(e))))return a;let m=gr(e,"the element");if(!a7.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. ${it}`,fix:"invoker",message:`<${l||"element"}> carries command/commandfor, which only <button> supports.`,path:t,rule:"invoker-not-button",severity:"error"}),a;if(u!==null&&!i7.has(u)&&!BC(u))return a.push({detail:`\`command\` is an enumerated attribute taking ${HC.map((b)=>`\`${b}\``).join(", ")}, or a custom command starting with \`--\`. Anything else is the invalid-value state, and a button in that state does nothing when clicked. ${it}`,message:`${m} declares command="${u}", which is not a built-in or --custom command.`,path:t,rule:"command-invalid",severity:"error"}),a;if(p!==null){let b=r.get(p),g=n.includes(p),y=s.includes(p);if(!b&&i){let w=[...n,...s].map((j)=>`"${j}"`).join(", ");return a.push({detail:`No element in this document has the id "${p}". The dialogs and popovers here are: ${w}. A commandfor that names nothing does nothing, silently. ${it}`,message:`commandfor="${p}" names nothing in this document.`,path:t,rule:"command-target-missing",severity:"error"}),a}if(u!==null&&b){if(r7.has(u)&&!Py(b))a.push({detail:`\`${u}\` acts on a <dialog>, and "${p}" is ${y?"a popover":`a <${Et(b)||"element"}>`}. The click is ignored. ${y?"Use `toggle-popover`, `show-popover` or `hide-popover` for a popover.":"Point it at a dialog, or make the target one."} ${it}`,message:`${m} sends ${u} to "${p}", which is not a dialog.`,path:t,rule:"command-target-mismatch",severity:"error"});else if(n7.has(u)&&!xc(b,o))a.push({detail:`\`${u}\` acts on a popover, and "${p}" is ${g?"a dialog":`a <${Et(b)||"element"}>`} that declares no \`popover\`. The click is ignored. ${g?"Use `show-modal`, `close` or `request-close` for a dialog.":"Give the target a `popover` attribute, or point the button elsewhere."} ${it}`,message:`${m} sends ${u} to "${p}", which is not a popover.`,path:t,rule:"command-target-mismatch",severity:"error"});else if(BC(u)&&!c7(b))a.push({detail:`A custom command is a \`CommandEvent\` dispatched at its target, and "${p}" 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. ${it}`,message:`${m} sends ${u} to "${p}", which handles no command.`,path:t,rule:"custom-command-unhandled",severity:"warn"})}}return a}function d7(e,t,r){let n=[],s=gr(e,"the dialog"),i=Pi(e),{style:o}=e,a=ar(e,"closedby");if(a!==null&&!o7.has(a))n.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. ${it}`,message:`${s} declares closedby="${a}", which is not any, closerequest or none.`,path:t,rule:"dialog-closedby-invalid",severity:"error"});if(hr(o,"display")!==null)n.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. ${it}`,fix:"display",message:`${s} sets display in its base rule.`,path:t,rule:"dialog-display",severity:"error"});let l=i===null?void 0:r.get(i),c=ar(e,"open")!==null||Zn(e).open===!0||e.open===!0;if(i!==null&&!l?.has("show-modal")&&!c)n.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. ${it}`,message:`${s} has no invoker in this document.`,path:t,rule:"dialog-no-invoker",severity:"warn"});if(l?.has("show-modal")&&a==="none"&&!u7(e,i))n.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"\`. ${it}`,message:`${s} opens modally, closes on nothing, and has no close button.`,path:t,rule:"modal-without-close",severity:"error"});return n}var HC,r7,n7,s7,i7,o7,a7;var zC=D(()=>{ye();Md();HC=["toggle-popover","show-popover","hide-popover","show-modal","close","request-close"],r7=new Set(["show-modal","close","request-close"]),n7=new Set(["toggle-popover","show-popover","hide-popover"]),s7=["any","closerequest","none"],i7=new Set(HC),o7=new Set(s7),a7=new Set(["button"])});var nN=N(function(tN){Object.defineProperty(tN,"__esModule",{value:!0});tN.formatNames=tN.fastFormats=tN.fullFormats=void 0;function es(e,t){return{validate:e,compare:t}}tN.fullFormats={date:es(XC,Ry),time:es(_y(!0),Oy),"date-time":es(GC(!0),QC),"iso-time":es(_y(),ZC),"iso-date-time":es(GC(),eN),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:b7,"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:j7,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:x7,int32:{type:"number",validate:v7},int64:{type:"number",validate:S7},float:{type:"number",validate:YC},double:{type:"number",validate:YC},password:!0,binary:!0};tN.fastFormats={...tN.fullFormats,date:es(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Ry),time:es(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Oy),"date-time":es(/^\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,QC),"iso-time":es(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,ZC),"iso-date-time":es(/^\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,eN),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};tN.formatNames=Object.keys(tN.fullFormats);function p7(e){return e%4===0&&(e%100!==0||e%400===0)}var m7=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,h7=[0,31,28,31,30,31,30,31,31,30,31,30,31];function XC(e){let t=m7.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],s=+t[3];return n>=1&&n<=12&&s>=1&&s<=(n===2&&p7(r)?29:h7[n])}function Ry(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var ky=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function _y(e){return function(r){let n=ky.exec(r);if(!n)return!1;let s=+n[1],i=+n[2],o=+n[3],a=n[4],l=n[5]==="-"?-1:1,c=+(n[6]||0),u=+(n[7]||0);if(c>23||u>59||e&&!a)return!1;if(s<=23&&i<=59&&o<60)return!0;let p=i-u*l,h=s-c*l-(p<0?1:0);return(h===23||h===-1)&&(p===59||p===-1)&&o<61}}function Oy(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),n=new Date("2020-01-01T"+t).valueOf();if(!(r&&n))return;return r-n}function ZC(e,t){if(!(e&&t))return;let r=ky.exec(e),n=ky.exec(t);if(!(r&&n))return;if(e=r[1]+r[2]+r[3],t=n[1]+n[2]+n[3],e>t)return 1;if(e<t)return-1;return 0}var Ay=/t|\s/i;function GC(e){let t=_y(e);return function(n){let s=n.split(Ay);return s.length===2&&XC(s[0])&&t(s[1])}}function QC(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),n=new Date(t).valueOf();if(!(r&&n))return;return r-n}function eN(e,t){if(!(e&&t))return;let[r,n]=e.split(Ay),[s,i]=t.split(Ay),o=Ry(r,s);if(o===void 0)return;return o||Oy(n,i)}var g7=/\/|:/,y7=/^(?:[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 b7(e){return g7.test(e)&&y7.test(e)}var KC=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function x7(e){return KC.lastIndex=0,KC.test(e)}var $7=-2147483648,w7=2147483647;function v7(e){return Number.isInteger(e)&&e<=w7&&e>=$7}function S7(e){return Number.isInteger(e)}function YC(){return!0}var E7=/[^\\]\\Z/;function j7(e){if(E7.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var iN=N(function(sN){Object.defineProperty(sN,"__esModule",{value:!0});var k7=cy(),_7=uy(),A7=my(),R7=yy(),Fd=by(),O7=[k7.default,_7.default,(0,A7.default)(),R7.default,Fd.metadataVocabulary,Fd.contentVocabulary];sN.default=O7});var oN=N(function(Kce,N7){N7.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 lN=N(function(Tr,Ny){Object.defineProperty(Tr,"__esModule",{value:!0});Tr.MissingRefError=Tr.ValidationError=Tr.CodeGen=Tr.Name=Tr.nil=Tr.stringify=Tr.str=Tr._=Tr.KeywordCxt=Tr.Ajv=void 0;var T7=ly(),I7=iN(),J7=xy(),aN=oN(),M7=["/properties"],qd="http://json-schema.org/draft-07/schema";class $c extends T7.default{_addVocabularies(){if(super._addVocabularies(),I7.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(J7.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(aN,M7):aN;this.addMetaSchema(e,qd,!1),this.refs["http://json-schema.org/schema"]=qd}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(qd)?qd:void 0)}}Tr.Ajv=$c;Ny.exports=Tr=$c;Ny.exports.Ajv=$c;Object.defineProperty(Tr,"__esModule",{value:!0});Tr.default=$c;var D7=Oa();Object.defineProperty(Tr,"KeywordCxt",{enumerable:!0,get:function(){return D7.KeywordCxt}});var Ka=we();Object.defineProperty(Tr,"_",{enumerable:!0,get:function(){return Ka._}});Object.defineProperty(Tr,"str",{enumerable:!0,get:function(){return Ka.str}});Object.defineProperty(Tr,"stringify",{enumerable:!0,get:function(){return Ka.stringify}});Object.defineProperty(Tr,"nil",{enumerable:!0,get:function(){return Ka.nil}});Object.defineProperty(Tr,"Name",{enumerable:!0,get:function(){return Ka.Name}});Object.defineProperty(Tr,"CodeGen",{enumerable:!0,get:function(){return Ka.CodeGen}});var L7=pc();Object.defineProperty(Tr,"ValidationError",{enumerable:!0,get:function(){return L7.default}});var F7=Na();Object.defineProperty(Tr,"MissingRefError",{enumerable:!0,get:function(){return F7.default}})});var fN=N(function(uN){Object.defineProperty(uN,"__esModule",{value:!0});uN.formatLimitDefinition=void 0;var cN=lN(),xt=we(),_i=xt.operators,Vd={formatMaximum:{okStr:"<=",ok:_i.LTE,fail:_i.GT},formatMinimum:{okStr:">=",ok:_i.GTE,fail:_i.LT},formatExclusiveMaximum:{okStr:"<",ok:_i.LT,fail:_i.GTE},formatExclusiveMinimum:{okStr:">",ok:_i.GT,fail:_i.LTE}},W7={message:({keyword:e,schemaCode:t})=>xt.str`should be ${Vd[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>xt._`{comparison: ${Vd[e].okStr}, limit: ${t}}`};uN.formatLimitDefinition={keyword:Object.keys(Vd),type:"string",schemaType:"string",$data:!0,error:W7,code(e){let{gen:t,data:r,schemaCode:n,keyword:s,it:i}=e,{opts:o,self:a}=i;if(!o.validateFormats)return;let l=new cN.KeywordCxt(i,a.RULES.all.format.definition,"format");if(l.$data)c();else u();function c(){let h=t.scopeValue("formats",{ref:a.formats,code:o.code.formats}),m=t.const("fmt",xt._`${h}[${l.schemaCode}]`);e.fail$data(xt.or(xt._`typeof ${m} != "object"`,xt._`${m} instanceof RegExp`,xt._`typeof ${m}.compare != "function"`,p(m)))}function u(){let h=l.schema,m=a.formats[h];if(!m||m===!0)return;if(typeof m!="object"||m instanceof RegExp||typeof m.compare!="function")throw Error(`"${s}": format "${h}" does not define "compare" function`);let b=t.scopeValue("formats",{key:h,ref:m,code:o.code.formats?xt._`${o.code.formats}${xt.getProperty(h)}`:void 0});e.fail$data(p(b))}function p(h){return xt._`${h}.compare(${r}, ${n}) ${Vd[s].fail} 0`}},dependencies:["format"]};var B7=(e)=>(e.addKeyword(uN.formatLimitDefinition),e);uN.default=B7});var hN=N(function(wc,mN){Object.defineProperty(wc,"__esModule",{value:!0});var un=nN(),U7=fN(),Ya=we(),dN=new Ya.Name("fullFormats"),z7=new Ya.Name("fastFormats"),Iy=(e,t={keywords:!0})=>{if(Array.isArray(t))return pN(e,t,un.fullFormats,dN),e;let[r,n]=t.mode==="fast"?[un.fastFormats,z7]:[un.fullFormats,dN],s=t.formats||un.formatNames;if(pN(e,s,r,n),t.keywords)(0,U7.default)(e);return e};Iy.get=(e,t="full")=>{let n=(t==="fast"?un.fastFormats:un.fullFormats)[e];if(!n)throw Error(`Unknown format "${e}"`);return n};function pN(e,t,r,n){var s,i;(s=(i=e.opts.code).formats)!==null&&s!==void 0||(i.formats=Ya._`require("ajv-formats/dist/formats").${n}`);for(let o of t)e.addFormat(o,r[o])}mN.exports=wc=Iy;Object.defineProperty(wc,"__esModule",{value:!0});wc.default=Iy});import{existsSync as bN,readFileSync as Dy,readdirSync as xN,statSync as $N}from"node:fs";import{createRequire as G7}from"node:module";import{join as wN,relative as Xa,resolve as Jy}from"node:path";async function Z7(){try{let{default:e}=await Promise.resolve().then(() => br(vy(),1)),{default:t}=await Promise.resolve().then(() => br(hN(),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 vN(e,t={}){let r=Jy(e),n=[],s=[],i=0;for(let S of["project.schema.json","document.schema.json"]){let E=Jy(r,S);if(!bN(E))continue;i+=1;let P=vc(E),A=rY(P);if(A.length>0)n.push({errors:A.map(({reason:R,ref:_})=>({message:`$ref "${_}" ${R} — committed entry documents must be self-contained `+"single-resource schemas; regenerate with `jx schema`"})),file:S})}if(n.length>0)return{checked:i,issues:n,lint:s,valid:!1};let o=await OC(r);if(i+=1,!o.valid)n.push({errors:o.errors??[],file:o.file});let{addFormats:a,Ajv:l}=await Z7(),{document:c}=await uP(r,{write:!1}),u=new l({allErrors:!0,ownProperties:!0,strict:!1});a(u);let p=u.compile(c),h=TC(yN(r).flatMap((S)=>{try{return[JSON.parse(Dy(S,"utf8"))]}catch{return[]}}));for(let S of K7)for(let E of jN(Jy(r,S))){if(E.endsWith(".class.json"))continue;i+=1;let P=Q7(E,Xa(r,E));if(s.push(...P.warnings),P.failure!==null){n.push(P.failure);continue}let A=P.document,R=gN(A,Xa(r,E));if(s.push(...R.warnings),R.failure!==null){n.push(R.failure);continue}if(p(A))s.push(...tY(A,Xa(r,E),h));else n.push({errors:p.errors??[],file:Xa(r,E)})}let m=new l({allErrors:!0,ownProperties:!0,strict:!1});a(m);let b=m.compile(Sg());for(let S of yN(r)){i+=1;let E=vc(S),P=gN(E,Xa(r,S));if(s.push(...P.warnings),P.failure!==null)n.push(P.failure);else if(!b(E))n.push({errors:b.errors??[],file:Xa(r,S)})}let{config:g}=Hs(r),y=await Bs(r,g),w=G7(import.meta.url);for(let S of y.extensions)for(let E of["project","document","fields"]){let P=S.schemas[E];if(!P)continue;i+=1;let A=new l({allErrors:!0,ownProperties:!0,strict:!1});a(A);for(let R of X7){let _=w.resolve(R);A.addSchema(vc(_))}try{A.compile(vc(P))}catch(R){n.push({errors:[{message:R instanceof Error?R.message:String(R)}],file:`${S.specifier} (${E} fragment)`})}}let j=t.strict===!0&&s.some((S)=>S.severity==="error");return{checked:i,issues:n,lint:s,valid:n.length===0&&!j}}function Q7(e,t){if(!ms(e))return{document:vc(e),failure:null,warnings:[]};let r=Dy(e,"utf8"),n=xp(r).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:eY(r),failure:null,warnings:n}}catch(s){return{document:null,failure:{errors:[{message:je(s)}],file:t},warnings:n}}}function gN(e,t){let r=[];try{El(e,t,r)}catch(s){return{failure:{errors:[{message:je(s)}],file:t},warnings:[]}}return{failure:null,warnings:r.map(({pointer:s,problem:i})=>({detail:i.message,file:t,message:`${s} (line ${i.line}, column ${i.column}): ${i.message}`,path:s.split("/").slice(1),rule:"typescript-reading",severity:"warn",source:"function-body"}))}}function eY(e){let t=Vi(e);return W(t)?t:null}function vc(e){return JSON.parse(Dy(e,"utf8"))}function tY(e,t,r){let n=[];for(let s of LC(e,r))n.push({...My(s),file:t,source:"popover"});for(let s of UC(e,r))n.push({...My(s),file:t,source:"dialog"});for(let s of VC(e))n.push({...My(s),criterion:s.criterion,file:t,source:"accessibility"});return n}function My(e){return{detail:e.detail,message:e.message,path:e.path,rule:e.rule,severity:e.severity}}function SN(e){return e.lint.map((t)=>{let r=t.criterion===void 0?`${t.source}/${t.rule}`:`${t.source}/${t.rule}, WCAG ${t.criterion}`;return`${t.file}: ${t.severity}: ${t.message} [${r}]`})}function rY(e){let t=[],r=new Set,n=(i)=>{let o=e;for(let a of i.slice(1).split("/")){if(a==="")continue;let l=a.replaceAll("~1","/").replaceAll("~0","~");if(!V(o))return!1;if(o=o[l],o===void 0)return!1}return!0},s=(i)=>{if(!W(i)||r.has(i))return;r.add(i);let o=i.$ref;if(O(o)){if(/^[a-zA-Z][a-zA-Z\d+.-]*:/.test(o))t.push({reason:"is an absolute URI editors resolve over the network",ref:o});else if(!o.startsWith("#"))t.push({reason:"is a relative path only Node module resolution can follow",ref:o});else if(o.length>1&&!o.startsWith("#/"))t.push({reason:"is an $anchor reference, which has no root-pointer form",ref:o});else if(o.length>1&&!n(o.slice(1)))t.push({reason:"points at no node in this document",ref:o})}for(let[a,l]of Object.entries(i)){if(!nY.has(a))continue;if(Array.isArray(l))for(let c of l)s(c);else if(W(l)){if(s(l),EN.has(a))for(let c of Object.values(l))s(c)}}};return s(e),t}function jN(e){if(!bN(e))return[];let t=[];for(let r of xN(e)){let n=wN(e,r);if($N(n).isDirectory())t.push(...jN(n));else if(hs(r))t.push(n)}return t.toSorted()}function yN(e){let t=[],r=(n)=>{for(let s of xN(n)){if(Y7.has(s))continue;let i=wN(n,s);if($N(i).isDirectory())r(i);else if(s.endsWith(".class.json"))t.push(i)}};return r(e),t.toSorted()}function PN(e){let t=[];for(let r of e.issues){t.push(`${r.file}:`);for(let n of r.errors){let s=W(n)?n:{},{instancePath:i,message:o}=s;t.push(` - ${i||"/"}: ${o??JSON.stringify(n)}`)}}return t}var K7,Y7,X7,EN,nY;var kN=D(()=>{Wi();er();rm();tk();CC();WC();zC();Md();ye();bs();bl();ug();K7=["components","pages","layouts"],Y7=new Set(["node_modules","dist",".git"]),X7=["@jxsuite/schema/schemas/project.core.schema.json","@jxsuite/schema/schemas/project.fields.schema.json","@jxsuite/schema/schemas/document.paths.schema.json"];EN=new Set(["$defs","definitions","dependencies","dependentSchemas","patternProperties","properties"]),nY=new Set([...EN,"additionalItems","additionalProperties","allOf","anyOf","contains","contentSchema","else","if","items","not","oneOf","prefixItems","propertyNames","then","unevaluatedItems","unevaluatedProperties"])});er();import{relative as Ly,resolve as _N}from"node:path";async function sY(){let e=process.argv.slice(2),[t]=e;if(!t||t==="--help"||t==="-h")console.log(`Usage: jx <command> [options]
627
+ deps: ${r}}`};var oG={keyword:"dependencies",type:"object",schemaType:"object",error:NO.error,code(e){let[t,r]=aG(e);RO(e,t),OO(e,r)}};function aG({schema:e}){let t={},r={};for(let n in e){if(n==="__proto__")continue;let s=Array.isArray(e[n])?t:r;s[n]=e[n]}return[t,r]}function RO(e,t=e.schema){let{gen:r,data:n,it:s}=e;if(Object.keys(t).length===0)return;let i=r.let("missing");for(let o in t){let a=t[o];if(a.length===0)continue;let l=ts.propertyInData(r,n,o,s.opts.ownProperties);if(e.setParams({property:o,depsCount:a.length,deps:a.join(", ")}),s.allErrors)r.if(l,()=>{for(let c of a)ts.checkReportMissingProp(e,c)});else r.if(Ga._`${l} && (${ts.checkMissingProp(e,a,i)})`),ts.reportMissingProp(e,i),r.else()}}NO.validatePropertyDeps=RO;function OO(e,t=e.schema){let{gen:r,data:n,keyword:s,it:i}=e,o=r.name("valid");for(let a in t){if(AO.alwaysValidSchema(i,t[a]))continue;r.if(ts.propertyInData(r,n,a,i.opts.ownProperties),()=>{let l=e.subschema({keyword:s,schemaProp:a},o);e.mergeValidEvaluated(l,o)},()=>r.var(o,!0)),e.ok(o)}}NO.validateSchemaDeps=OO;NO.default=oG});var MO=T(function(JO){Object.defineProperty(JO,"__esModule",{value:!0});var Md=we(),IO=Oe(),uG={message:"property name must be valid",params:({params:e})=>Md._`{propertyName: ${e.propertyName}}`},fG={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:uG,code(e){let{gen:t,schema:r,data:n,it:s}=e;if(IO.alwaysValidSchema(s,r))return;let i=t.name("valid");t.forIn("key",n,(o)=>{e.setParams({propertyName:o}),e.subschema({keyword:"propertyNames",data:o,dataTypes:["string"],propertyName:o,compositeRule:!0},i),t.if(Md.not(i),()=>{if(e.error(!0),!s.allErrors)t.break()})}),e.ok(i)}};JO.default=fG});var Iy=T(function(DO){Object.defineProperty(DO,"__esModule",{value:!0});var Ei=ln(),bt=we(),pG=on(),Pi=Oe(),mG={message:"must NOT have additional properties",params:({params:e})=>bt._`{additionalProperty: ${e.additionalProperty}}`},hG={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:mG,code(e){let{gen:t,schema:r,parentSchema:n,data:s,errsCount:i,it:o}=e;if(!i)throw Error("ajv implementation error");let{allErrors:a,opts:l}=o;if(o.props=!0,l.removeAdditional!=="all"&&Pi.alwaysValidSchema(o,r))return;let c=Ei.allSchemaProperties(n.properties),u=Ei.allSchemaProperties(n.patternProperties);p(),e.ok(bt._`${i} === ${pG.default.errors}`);function p(){t.forIn("key",s,(b)=>{if(!c.length&&!u.length)y(b);else t.if(h(b),()=>y(b))})}function h(b){let w;if(c.length>8){let j=Pi.schemaRefOrVal(o,n.properties,"properties");w=Ei.isOwnProperty(t,j,b)}else if(c.length)w=bt.or(...c.map((j)=>bt._`${b} === ${j}`));else w=bt.nil;if(u.length)w=bt.or(w,...u.map((j)=>bt._`${Ei.usePattern(e,j)}.test(${b})`));return bt.not(w)}function m(b){t.code(bt._`delete ${s}[${b}]`)}function y(b){if(l.removeAdditional==="all"||l.removeAdditional&&r===!1){m(b);return}if(r===!1){if(e.setParams({additionalProperty:b}),e.error(),!a)t.break();return}if(typeof r=="object"&&!Pi.alwaysValidSchema(o,r)){let w=t.name("valid");if(l.removeAdditional==="failing")g(b,w,!1),t.if(bt.not(w),()=>{e.reset(),m(b)});else if(g(b,w),!a)t.if(bt.not(w),()=>t.break())}}function g(b,w,j){let S={keyword:"additionalProperties",dataProp:b,dataPropType:Pi.Type.Str};if(j===!1)Object.assign(S,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(S,w)}}};DO.default=hG});var VO=T(function(qO){Object.defineProperty(qO,"__esModule",{value:!0});var FO=La(),Dd=ln(),Ka=Oe(),LO=Iy(),yG={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:s,it:i}=e;if(i.opts.removeAdditional==="all"&&n.additionalProperties===void 0)LO.default.code(new FO.KeywordCxt(i,LO.default,"additionalProperties"));let o=Dd.allSchemaProperties(r);for(let p of o)i.definedProperties.add(p);if(i.opts.unevaluated&&o.length&&i.props!==!0)i.props=Ka.mergeEvaluated.props(t,Ka.toHash(o),i.props);let a=o.filter((p)=>!Ka.alwaysValidSchema(i,r[p]));if(a.length===0)return;let l=t.name("valid");for(let p of a){if(c(p))u(p);else{if(t.if(Dd.propertyInData(t,s,p,i.opts.ownProperties)),u(p),!i.allErrors)t.else().var(l,!0);t.endIf()}e.it.definedProperties.add(p),e.ok(l)}function c(p){return i.opts.useDefaults&&!i.compositeRule&&r[p].default!==void 0}function u(p){e.subschema({keyword:"properties",schemaProp:p,dataProp:p},l)}}};qO.default=yG});var WO=T(function(BO){Object.defineProperty(BO,"__esModule",{value:!0});var Ld=ln(),ji=we(),Fd=Oe(),qd=Oe(),xG={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:s,it:i}=e,{opts:o}=i,a=Ld.allSchemaProperties(r),l=a.filter((g)=>Fd.alwaysValidSchema(i,r[g]));if(a.length===0||l.length===a.length&&(!i.opts.unevaluated||i.props===!0))return;let c=o.strictSchema&&!o.allowMatchingProperties&&s.properties,u=t.name("valid");if(i.props!==!0&&!(i.props instanceof ji.Name))i.props=qd.evaluatedPropsToName(t,i.props);let{props:p}=i;h();function h(){for(let g of a){if(c)m(g);if(i.allErrors)y(g);else t.var(u,!0),y(g),t.if(u)}}function m(g){for(let b in c)if(new RegExp(g).test(b))Fd.checkStrictMode(i,`property ${b} matches pattern ${g} (use allowMatchingProperties)`)}function y(g){t.forIn("key",n,(b)=>{t.if(ji._`${Ld.usePattern(e,g)}.test(${b})`,()=>{let w=l.includes(g);if(!w)e.subschema({keyword:"patternProperties",schemaProp:g,dataProp:b,dataPropType:qd.Type.Str},u);if(i.opts.unevaluated&&p!==!0)t.assign(ji._`${p}[${b}]`,!0);else if(!w&&!i.allErrors)t.if(ji.not(u),()=>t.break())})})}}};BO.default=xG});var zO=T(function(HO){Object.defineProperty(HO,"__esModule",{value:!0});var UO=Oe(),wG={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if(UO.alwaysValidSchema(n,r)){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"}};HO.default=wG});var XO=T(function(KO){Object.defineProperty(KO,"__esModule",{value:!0});var GO=ln(),SG={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:GO.validateUnion,error:{message:"must match a schema in anyOf"}};KO.default=SG});var QO=T(function(ZO){Object.defineProperty(ZO,"__esModule",{value:!0});var ki=we(),YO=Oe(),PG={message:"must match exactly one schema in oneOf",params:({params:e})=>ki._`{passingSchemas: ${e.passing}}`},jG={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:PG,code(e){let{gen:t,schema:r,parentSchema:n,it:s}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(s.opts.discriminator&&n.discriminator)return;let i=r,o=t.let("valid",!1),a=t.let("passing",null),l=t.name("_valid");e.setParams({passing:a}),t.block(c),e.result(o,()=>e.reset(),()=>e.error(!0));function c(){i.forEach((u,p)=>{let h;if(YO.alwaysValidSchema(s,u))t.var(l,!0);else h=e.subschema({keyword:"oneOf",schemaProp:p,compositeRule:!0},l);if(p>0)t.if(ki._`${l} && ${o}`).assign(o,!1).assign(a,ki._`[${a}, ${p}]`).else();t.if(l,()=>{if(t.assign(o,!0),t.assign(a,p),h)e.mergeEvaluated(h,ki.Name)})})}}};ZO.default=jG});var rN=T(function(tN){Object.defineProperty(tN,"__esModule",{value:!0});var eN=Oe(),_G={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");let s=t.name("valid");r.forEach((i,o)=>{if(eN.alwaysValidSchema(n,i))return;let a=e.subschema({keyword:"allOf",schemaProp:o},s);e.ok(s),e.mergeEvaluated(a)})}};tN.default=_G});var iN=T(function(sN){Object.defineProperty(sN,"__esModule",{value:!0});var _i=we(),Vd=Oe(),RG={message:({params:e})=>_i.str`must match "${e.ifClause}" schema`,params:({params:e})=>_i._`{failingKeyword: ${e.ifClause}}`},OG={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:RG,code(e){let{gen:t,parentSchema:r,it:n}=e;if(r.then===void 0&&r.else===void 0)Vd.checkStrictMode(n,'"if" without "then" and "else" is ignored');let s=nN(n,"then"),i=nN(n,"else");if(!s&&!i)return;let o=t.let("valid",!0),a=t.name("_valid");if(l(),e.reset(),s&&i){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(_i.not(a),c("else"));e.pass(o,()=>e.error(!0));function l(){let u=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(u)}function c(u,p){return()=>{let h=e.subschema({keyword:u},a);if(t.assign(o,a),e.mergeValidEvaluated(h,o),p)t.assign(p,_i._`${u}`);else e.setParams({ifClause:u})}}}};function nN(e,t){let r=e.schema[t];return r!==void 0&&!Vd.alwaysValidSchema(e,r)}sN.default=OG});var lN=T(function(aN){Object.defineProperty(aN,"__esModule",{value:!0});var oN=Oe(),CG={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){if(t.if===void 0)oN.checkStrictMode(r,`"${e}" without "if" is ignored`)}};aN.default=CG});var Jy=T(function(cN){Object.defineProperty(cN,"__esModule",{value:!0});var IG=Cy(),JG=wO(),MG=Ty(),DG=jO(),LG=_O(),FG=Jd(),qG=MO(),VG=Iy(),BG=VO(),WG=WO(),UG=zO(),HG=XO(),zG=QO(),GG=rN(),KG=iN(),XG=lN();function YG(e=!1){let t=[UG.default,HG.default,zG.default,GG.default,KG.default,XG.default,qG.default,VG.default,FG.default,BG.default,WG.default];if(e)t.push(JG.default,DG.default);else t.push(IG.default,MG.default);return t.push(LG.default),t}cN.default=YG});var My=T(function(dN){Object.defineProperty(dN,"__esModule",{value:!0});dN.dynamicAnchor=void 0;var Xa=we(),QG=on(),Bd=_c(),uN=Od(),eK={keyword:"$dynamicAnchor",schemaType:"string",code:(e)=>fN(e,e.schema)};function fN(e,t){let{gen:r,it:n}=e;n.schemaEnv.root.dynamicAnchors[t]=!0;let s=Xa._`${QG.default.dynamicAnchors}${Xa.getProperty(t)}`,i=n.errSchemaPath==="#"?n.validateName:tK(e);r.if(Xa._`!${s}`,()=>r.assign(s,i))}dN.dynamicAnchor=fN;function tK(e){let{schemaEnv:t,schema:r,self:n}=e.it,{root:s,baseId:i,localRefs:o,meta:a}=t.root,{schemaId:l}=n.opts,c=new Bd.SchemaEnv({schema:r,schemaId:l,root:s,baseId:i,localRefs:o,meta:a});return Bd.compileSchema.call(n,c),uN.getValidate(e,c)}dN.default=eK});var Dy=T(function(hN){Object.defineProperty(hN,"__esModule",{value:!0});hN.dynamicRef=void 0;var Wd=we(),nK=on(),Ud=Od(),sK={keyword:"$dynamicRef",schemaType:"string",code:(e)=>mN(e,e.schema)};function mN(e,t){let{gen:r,keyword:n,it:s}=e;if(t[0]!=="#")throw Error(`"${n}" only supports hash fragment reference`);let i=t.slice(1);if(s.allErrors)o();else{let l=r.let("valid",!1);o(l),e.ok(l)}function o(l){if(s.schemaEnv.root.dynamicAnchors[i]){let c=r.let("_v",Wd._`${nK.default.dynamicAnchors}${Wd.getProperty(i)}`);r.if(c,a(c,l),a(s.validateName,l))}else a(s.validateName,l)()}function a(l,c){return c?()=>r.block(()=>{Ud.callRef(e,l),r.let(c,!0)}):()=>Ud.callRef(e,l)}}hN.dynamicRef=mN;hN.default=sK});var $N=T(function(xN){Object.defineProperty(xN,"__esModule",{value:!0});var yN=My(),bN=Oe(),oK={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){if(e.schema)yN.dynamicAnchor(e,"");else bN.checkStrictMode(e.it,"$recursiveAnchor: false is ignored")}};xN.default=oK});var SN=T(function(vN){Object.defineProperty(vN,"__esModule",{value:!0});var wN=Dy(),lK={keyword:"$recursiveRef",schemaType:"string",code:(e)=>wN.dynamicRef(e,e.schema)};vN.default=lK});var PN=T(function(EN){Object.defineProperty(EN,"__esModule",{value:!0});var uK=My(),fK=Dy(),dK=$N(),pK=SN(),mK=[uK.default,fK.default,dK.default,pK.default];EN.default=mK});var kN=T(function(jN){Object.defineProperty(jN,"__esModule",{value:!0});var Hd=Jd(),gK={keyword:"dependentRequired",type:"object",schemaType:"object",error:Hd.error,code:(e)=>Hd.validatePropertyDeps(e)};jN.default=gK});var RN=T(function(AN){Object.defineProperty(AN,"__esModule",{value:!0});var _N=Jd(),bK={keyword:"dependentSchemas",type:"object",schemaType:"object",code:(e)=>_N.validateSchemaDeps(e)};AN.default=bK});var CN=T(function(NN){Object.defineProperty(NN,"__esModule",{value:!0});var ON=Oe(),$K={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:e,parentSchema:t,it:r}){if(t.contains===void 0)ON.checkStrictMode(r,`"${e}" without "contains" is ignored`)}};NN.default=$K});var IN=T(function(TN){Object.defineProperty(TN,"__esModule",{value:!0});var vK=kN(),SK=RN(),EK=CN(),PK=[vK.default,SK.default,EK.default];TN.default=PK});var MN=T(function(JN){Object.defineProperty(JN,"__esModule",{value:!0});var or=we(),zd=Oe(),kK=on(),_K={message:"must NOT have unevaluated properties",params:({params:e})=>or._`{unevaluatedProperty: ${e.unevaluatedProperty}}`},AK={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:_K,code(e){let{gen:t,schema:r,data:n,errsCount:s,it:i}=e;if(!s)throw Error("ajv implementation error");let{allErrors:o,props:a}=i;if(a instanceof or.Name)t.if(or._`${a} !== true`,()=>t.forIn("key",n,(p)=>t.if(c(a,p),()=>l(p))));else if(a!==!0)t.forIn("key",n,(p)=>a===void 0?l(p):t.if(u(a,p),()=>l(p)));i.props=!0,e.ok(or._`${s} === ${kK.default.errors}`);function l(p){if(r===!1){if(e.setParams({unevaluatedProperty:p}),e.error(),!o)t.break();return}if(!zd.alwaysValidSchema(i,r)){let h=t.name("valid");if(e.subschema({keyword:"unevaluatedProperties",dataProp:p,dataPropType:zd.Type.Str},h),!o)t.if(or.not(h),()=>t.break())}}function c(p,h){return or._`!${p} || !${p}[${h}]`}function u(p,h){let m=[];for(let y in p)if(p[y]===!0)m.push(or._`${h} !== ${y}`);return or.and(...m)}}};JN.default=AK});var LN=T(function(DN){Object.defineProperty(DN,"__esModule",{value:!0});var Cr=we(),Gd=Oe(),OK={message:({params:{len:e}})=>Cr.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Cr._`{limit: ${e}}`},NK={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:OK,code(e){let{gen:t,schema:r,data:n,it:s}=e,i=s.items||0;if(i===!0)return;let o=t.const("len",Cr._`${n}.length`);if(r===!1)e.setParams({len:i}),e.fail(Cr._`${o} > ${i}`);else if(typeof r=="object"&&!Gd.alwaysValidSchema(s,r)){let l=t.var("valid",Cr._`${o} <= ${i}`);t.if(Cr.not(l),()=>a(l,i)),e.ok(l)}s.items=!0;function a(l,c){t.forRange("i",c,o,(u)=>{if(e.subschema({keyword:"unevaluatedItems",dataProp:u,dataPropType:Gd.Type.Num},l),!s.allErrors)t.if(Cr.not(l),()=>t.break())})}}};DN.default=NK});var qN=T(function(FN){Object.defineProperty(FN,"__esModule",{value:!0});var TK=MN(),IK=LN(),JK=[TK.default,IK.default];FN.default=JK});var BN=T(function(VN){Object.defineProperty(VN,"__esModule",{value:!0});var je=we(),DK={message:({schemaCode:e})=>je.str`must match format "${e}"`,params:({schemaCode:e})=>je._`{format: ${e}}`},LK={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:DK,code(e,t){let{gen:r,data:n,$data:s,schema:i,schemaCode:o,it:a}=e,{opts:l,errSchemaPath:c,schemaEnv:u,self:p}=a;if(!l.validateFormats)return;if(s)h();else m();function h(){let y=r.scopeValue("formats",{ref:p.formats,code:l.code.formats}),g=r.const("fDef",je._`${y}[${o}]`),b=r.let("fType"),w=r.let("format");r.if(je._`typeof ${g} == "object" && !(${g} instanceof RegExp)`,()=>r.assign(b,je._`${g}.type || "string"`).assign(w,je._`${g}.validate`),()=>r.assign(b,je._`"string"`).assign(w,g)),e.fail$data(je.or(j(),S()));function j(){if(l.strictSchema===!1)return je.nil;return je._`${o} && !${w}`}function S(){let E=u.$async?je._`(${g}.async ? await ${w}(${n}) : ${w}(${n}))`:je._`${w}(${n})`,P=je._`(typeof ${w} == "function" ? ${E} : ${w}.test(${n}))`;return je._`${w} && ${w} !== true && ${b} === ${t} && !${P}`}}function m(){let y=p.formats[i];if(!y){j();return}if(y===!0)return;let[g,b,w]=S(y);if(g===t)e.pass(E());function j(){if(l.strictSchema===!1){p.logger.warn(P());return}throw Error(P());function P(){return`unknown format "${i}" ignored in schema at path "${c}"`}}function S(P){let R=P instanceof RegExp?je.regexpCode(P):l.code.formats?je._`${l.code.formats}${je.getProperty(i)}`:void 0,N=r.scopeValue("formats",{key:i,ref:P,code:R});if(typeof P=="object"&&!(P instanceof RegExp))return[P.type||"string",P.validate,je._`${N}.validate`];return["string",P,N]}function E(){if(typeof y=="object"&&!(y instanceof RegExp)&&y.async){if(!u.$async)throw Error("async format in sync schema");return je._`await ${w}(${n})`}return typeof b=="function"?je._`${w}(${n})`:je._`${w}.test(${n})`}}}};VN.default=LK});var Ly=T(function(WN){Object.defineProperty(WN,"__esModule",{value:!0});var qK=BN(),VK=[qK.default];WN.default=VK});var Fy=T(function(UN){Object.defineProperty(UN,"__esModule",{value:!0});UN.contentVocabulary=UN.metadataVocabulary=void 0;UN.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];UN.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var GN=T(function(zN){Object.defineProperty(zN,"__esModule",{value:!0});var UK=Oy(),HK=Ny(),zK=Jy(),GK=PN(),KK=IN(),XK=qN(),YK=Ly(),Kd=Fy(),ZK=[GK.default,UK.default,HK.default,(0,zK.default)(!0),YK.default,Kd.metadataVocabulary,Kd.contentVocabulary,KK.default,XK.default];zN.default=ZK});var ZN=T(function(XN){Object.defineProperty(XN,"__esModule",{value:!0});XN.DiscrError=void 0;var KN;(function(e){e.Tag="tag",e.Mapping="mapping"})(KN||(XN.DiscrError=KN={}))});var qy=T(function(eC){Object.defineProperty(eC,"__esModule",{value:!0});var un=we(),Ya=ZN(),Xd=_c(),e7=qa(),QN=Oe(),t7={message:({params:{discrError:e,tagName:t}})=>e===Ya.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>un._`{error: ${e}, tag: ${r}, tagValue: ${t}}`},r7={keyword:"discriminator",type:"object",schemaType:"object",error:t7,code(e){let{gen:t,data:r,schema:n,parentSchema:s,it:i}=e,{oneOf:o}=s;if(!i.opts.discriminator)throw Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw Error("discriminator: requires propertyName");if(n.mapping)throw Error("discriminator: mapping is not supported");if(!o)throw Error("discriminator: requires oneOf keyword");let l=t.let("valid",!1),c=t.const("tag",un._`${r}${un.getProperty(a)}`);t.if(un._`typeof ${c} == "string"`,()=>u(),()=>e.error(!1,{discrError:Ya.DiscrError.Tag,tag:c,tagName:a})),e.ok(l);function u(){let m=h();t.if(!1);for(let y in m)t.elseIf(un._`${c} === ${y}`),t.assign(l,p(m[y]));t.else(),e.error(!1,{discrError:Ya.DiscrError.Mapping,tag:c,tagName:a}),t.endIf()}function p(m){let y=t.name("valid"),g=e.subschema({keyword:"oneOf",schemaProp:m},y);return e.mergeEvaluated(g,un.Name),y}function h(){var m;let y={},g=w(s),b=!0;for(let E=0;E<o.length;E++){let P=o[E];if((P===null||P===void 0?void 0:P.$ref)&&!QN.schemaHasRulesButRef(P,i.self.RULES)){let N=P.$ref;if(P=Xd.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,N),P instanceof Xd.SchemaEnv)P=P.schema;if(P===void 0)throw new e7.default(i.opts.uriResolver,i.baseId,N)}let R=(m=P===null||P===void 0?void 0:P.properties)===null||m===void 0?void 0:m[a];if(typeof R!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);b=b&&(g||w(P)),j(R,E)}if(!b)throw Error(`discriminator: "${a}" must be required`);return y;function w({required:E}){return Array.isArray(E)&&E.includes(a)}function j(E,P){if(E.const)S(E.const,P);else if(E.enum)for(let R of E.enum)S(R,P);else throw Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function S(E,P){if(typeof E!="string"||E in y)throw Error(`discriminator: "${a}" values must be unique strings`);y[E]=P}}}};eC.default=r7});var tC=T(function(Wue,s7){s7.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 rC=T(function(Uue,i7){i7.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 nC=T(function(Hue,o7){o7.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 sC=T(function(zue,a7){a7.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 iC=T(function(Gue,l7){l7.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 oC=T(function(Kue,c7){c7.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 aC=T(function(Xue,u7){u7.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 lC=T(function(Yue,f7){f7.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 uC=T(function(cC){Object.defineProperty(cC,"__esModule",{value:!0});var d7=tC(),p7=rC(),m7=nC(),h7=sC(),g7=iC(),y7=oC(),b7=aC(),x7=lC(),$7=["/properties"];function w7(e){return[d7,p7,m7,h7,g7,t(this,y7),b7,t(this,x7)].forEach((r)=>this.addMetaSchema(r,void 0,!1)),this;function t(r,n){return e?r.$dataMetaSchema(n,$7):n}}cC.default=w7});var Wy=T(function(Tr,By){Object.defineProperty(Tr,"__esModule",{value:!0});Tr.MissingRefError=Tr.ValidationError=Tr.CodeGen=Tr.Name=Tr.nil=Tr.stringify=Tr.str=Tr._=Tr.KeywordCxt=Tr.Ajv2020=void 0;var S7=Ry(),E7=GN(),P7=qy(),j7=uC(),Vy="https://json-schema.org/draft/2020-12/schema";class Oc extends S7.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){if(super._addVocabularies(),E7.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(P7.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:t}=this.opts;if(!t)return;j7.default.call(this,e),this.refs["http://json-schema.org/schema"]=Vy}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Vy)?Vy:void 0)}}Tr.Ajv2020=Oc;By.exports=Tr=Oc;By.exports.Ajv2020=Oc;Object.defineProperty(Tr,"__esModule",{value:!0});Tr.default=Oc;var k7=La();Object.defineProperty(Tr,"KeywordCxt",{enumerable:!0,get:function(){return k7.KeywordCxt}});var Za=we();Object.defineProperty(Tr,"_",{enumerable:!0,get:function(){return Za._}});Object.defineProperty(Tr,"str",{enumerable:!0,get:function(){return Za.str}});Object.defineProperty(Tr,"stringify",{enumerable:!0,get:function(){return Za.stringify}});Object.defineProperty(Tr,"nil",{enumerable:!0,get:function(){return Za.nil}});Object.defineProperty(Tr,"Name",{enumerable:!0,get:function(){return Za.Name}});Object.defineProperty(Tr,"CodeGen",{enumerable:!0,get:function(){return Za.CodeGen}});var _7=jc();Object.defineProperty(Tr,"ValidationError",{enumerable:!0,get:function(){return _7.default}});var A7=qa();Object.defineProperty(Tr,"MissingRefError",{enumerable:!0,get:function(){return A7.default}})});import{existsSync as Zd,readFileSync as pC}from"node:fs";import{createRequire as fC}from"node:module";import{basename as N7,isAbsolute as C7,relative as T7,resolve as Uy}from"node:path";import{fileURLToPath as dC,pathToFileURL as I7}from"node:url";function Yd(e){return JSON.parse(pC(e,"utf8"))}async function mC(e){let t=Uy(e),r=On(t),n=Uy(t,"project.schema.json");if(!Zd(r))throw Error(`No project.jxn or project.json in ${t}`);if(!Zd(n))throw Error(`project.schema.json not found in ${t} — run \`jx schema\` to generate it from `+"the project file's extensions");let s=yu(pC(r,"utf8"),r),i=Yd(n);i.$id=I7(n).href;let o;try{({default:o}=await Promise.resolve().then(() => xr(Wy(),1)))}catch(p){throw Error("Project validation requires ajv: bun add ajv",{cause:p})}let l=await new o({allErrors:!0,loadSchema:(p)=>D7(p,t),strict:!1}).compileAsync(i),c=l(s),u=l.errors??null;return{errors:u&&bs(r)?M7(u,s):u,file:N7(r),valid:c}}function J7(e,t){let r=e;for(let n of t.split("/").slice(1)){let s=n.replaceAll("~1","/").replaceAll("~0","~");r=Array.isArray(r)?r[Number(s)]:B(r)?r[s]:void 0}return r}function M7(e,t){return e.map((r)=>{if(!V(r)||!("keyword"in r)||r.keyword!=="type"||!("params"in r)||!V(r.params)||!("type"in r.params)||r.params.type!=="array"||!("instancePath"in r)||!A(r.instancePath))return r;let n=J7(t,r.instancePath),s=Dt(n,"",r.instancePath),i=r.instancePath.split("/").at(-1)??"";if(s===null||s.includes(`
628
+ `)||i==="")return r;return{...r,message:`must be a list, written as ${i} { - ${s} }`}})}async function D7(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 r=dC(e),n=T7(t,r);if(n.startsWith("..")||C7(n))throw Error(`Schema ref "${e}" escapes the project root ${t}`);if(Zd(r))return Yd(r);let s=n.split("\\").join("/"),i="node_modules/",o=s.lastIndexOf(i);if(o===-1)throw Error(`Schema ref "${e}" does not exist`);let a=s.slice(o+i.length),l="@jxsuite/schema/",c;try{c=fC(Uy(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=fC(import.meta.url).resolve(a)}catch(p){let h=dC(new URL(`../${a.slice(l.length)}`,import.meta.url));if(Zd(h))return Yd(h);throw Error(`Schema ref "${e}" does not exist and "${a}" is not resolvable from the project or this host's core`,{cause:p})}}return Yd(c)}var hC=M(()=>{ye();cu();hu();bu();Ho()});function ns(e){return B(e.attributes)?e.attributes:{}}function ar(e,t){let r=ns(e)[t];return A(r)?r:null}function Et(e){return A(e.tagName)?e.tagName.toLowerCase():""}function yr(e,t="the popover"){let r=A(e.id)?e.id:ar(e,"id");if(r)return`#${r}`;let n=Et(e);return n===""?t:`the <${n}>`}function q7(e){let t=ns(e).popover;return A(t)?t:null}function yC(e){let t=new Set,r=new Set;for(let n of e){let s=n!==null&&A(n.tagName)?n.tagName:"";if(n===null||!s.includes("-"))continue;if(Hy(n))t.add(s);let i=n.observedAttributes;if(Array.isArray(i)&&V7.every((o)=>i.includes(o)))r.add(s)}return{invokerTags:r,popoverTags:t}}function Hy(e){return"popover"in ns(e)||"popover"in e}function Nc(e,t){return Hy(e)||(t?.popoverTags?.has(Et(e))??!1)}function Ai(e){if(A(e.id)&&e.id!=="")return e.id;let t=ar(e,"id");return t===""?null:t}function*rs(e,t=[],r=null,n){yield{enclosing:r,node:e,path:t};let s=Nc(e,n)?e:r,{children:i}=e;if(Array.isArray(i)){for(let[l,c]of i.entries())if(V(c))yield*rs(c,[...t,"children",l],s,n)}else if(B(i)&&$r(i.map))yield*rs(i.map,[...t,"children","map"],s,n);let o=$r(e.map)?e.map:null;if(o)yield*rs(o,[...t,"map"],s,n);let a=B(e.cases)?e.cases:{};for(let[l,c]of Object.entries(a))if(V(c))yield*rs(c,[...t,"cases",l],s,n)}function zy(e,t){let r=[];for(let{node:n}of rs(e,[],null,t)){if(!Nc(n,t))continue;let s=Ai(n);if(s!==null&&!r.includes(s))r.push(s)}return r}function Qd(e){return e.startsWith("@")}function bC(e){return e.startsWith(":")||e.startsWith("&")||e.startsWith(".")||e.startsWith("[")}function gr(e,t){let r=e?.[t];if(r===void 0||Ii(r)||Array.isArray(r))return null;return String(r)}function xC(e){for(let[t,r]of Object.entries(e??{})){if(!Ii(r))continue;if(bC(t)&&t.includes(":popover-open")&&gr(r,"display")!==null)return!0;if(Qd(t)&&xC(r))return!0}return!1}function $C(e){for(let[t,r]of Object.entries(e??{})){if(!Ii(r))continue;if(bC(t)&&t.includes(":popover-open"))return!0;if(Qd(t)&&$C(r))return!0}return!1}function W7(e){return B7.some((t)=>gr(e,t)!==null)}function U7(e){if(!e)return[];let t=[];for(let[r,n]of Object.entries(e))if(Qd(r)&&Ii(n)&&gr(n,"display")!==null)t.push(r);return t}function wC(e){if(!e)return[];let t=[],r=gr(e,"transition");if(r!==null)t.push(r);for(let[n,s]of Object.entries(e))if(Qd(n)&&Ii(s))t.push(...wC(s));return t}function H7(e){if(!e)return!1;if(gr(e,"positionAnchor")!==null||gr(e,"position-anchor")!==null)return!0;return["top","left","right","bottom","inset","insetBlockStart","insetInlineStart"].some((t)=>(gr(e,t)??"").includes("anchor("))}function z7(e){if(!e)return!1;if(gr(e,"positionArea")!==null||gr(e,"position-area")!==null||gr(e,"positionTryFallbacks")!==null||gr(e,"position-try-fallbacks")!==null)return!0;return Object.keys(e).some((t)=>t.startsWith("@supports"))}function vC(e,t){let r=[...rs(e,[],null,t)],n=zy(e,t),s=r.some(({node:a})=>Nc(a,t)),i=new Set;for(let{node:a}of r)if(gC.has(Et(a))){let l=ar(a,"popovertarget");if(l!==null)i.add(l)}let o=[];for(let{enclosing:a,node:l,path:c}of r)if(o.push(...G7(l,c,a,n,s,t)),Hy(l))o.push(...K7(l,c,i));return o}function G7(e,t,r,n,s,i){let o=[],a=Et(e),l=ar(e,"popovertarget"),c=gC.has(a)||(i?.invokerTags?.has(a)??!1);if(l!==null&&!c)return o.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. ${it}`,fix:"invoker",message:`<${a||"element"}> carries popovertarget, which only <button> and <input> support.`,path:t,rule:"invoker-not-button",severity:"error"}),o;if(l!==null){if(s&&!n.includes(l)){let u=n.length>0?`The popovers here are: ${n.map((p)=>`"${p}"`).join(", ")}. `:"";o.push({detail:`No element in this document declares \`popover\` with the id "${l}". ${u}A target that names nothing does nothing, silently. ${it}`,message:`popovertarget="${l}" names no popover in this document.`,path:t,rule:"target-missing",severity:"error"})}else if(r!==null&&Ai(r)!==null&&Ai(r)!==l)o.push({detail:`This control is inside ${yr(r)} 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. ${it}`,message:`A control inside ${yr(r)} targets "${l}" instead.`,path:t,rule:"target-mismatch",severity:"warn"})}if(a==="a"&&r!==null&&l===null){let u=ar(e,"href")??(A(e.href)?e.href:null),p=ar(e,"target")==="_blank",h=u!==null&&u.includes("#");if(p||h){let m=p?"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. ";o.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. ${it}`,message:`A link inside ${yr(r)} does not dismiss it.`,path:t,rule:"link-does-not-dismiss",severity:"warn"})}}return o}function K7(e,t,r){let n=[],{style:s}=e,i=yr(e),o=q7(e);if(o!==null&&o!==""&&!F7.some((c)=>c===o))n.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". ${it}`,fix:"mode",message:`${i} declares popover="${o}", which is not one of auto, manual or hint.`,path:t,rule:"invalid-mode",severity:"error"});else if(Qt(ns(e).popover))n.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". ${it}`,fix:"mode",message:`${i} writes popover as a boolean.`,path:t,rule:"invalid-mode",severity:"error"});let a=gr(s,"display");if(a!==null&&a!=="revert"&&a!=="revert-layer")n.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. ${it}`,fix:"display",message:`${i} sets display in its base rule.`,path:t,rule:"base-display",severity:"error"});for(let c of U7(s))n.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. ${it}`,fix:"display",message:`${i} sets display inside ${c}.`,path:t,rule:"breakpoint-display",severity:"error"});if(gr(s,"visibility")!==null)n.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. ${it}`,fix:"display",message:`${i} also hides itself with visibility.`,path:t,rule:"base-visibility",severity:"warn"});if(!$C(s))n.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. ${it}`,message:`${i} has no :popover-open rule.`,path:t,rule:"no-open-rule",severity:"warn"});else if(!xC(s)&&a===null&&W7(s))n.push({detail:`${i} 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\`. ${it}`,fix:"open-display",message:`${i} is laid out with flex or grid but never sets display.`,path:t,rule:"no-open-display",severity:"error"});for(let c of wC(s))if(c.includes("display")&&!c.includes("overlay")){n.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. ${it}`,message:`${i} transitions display but not overlay.`,path:t,rule:"cut-exit",severity:"warn"});break}if(H7(s)&&!z7(s))n.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. ${it}`,message:`${i} is anchor-positioned with no fallback.`,path:t,rule:"unsafe-anchor",severity:"warn"});let l=Ai(e);if(l!==null&&!r.has(l))n.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. ${it}`,message:`${i} has no invoker in this document.`,path:t,rule:"no-invoker",severity:"warn"});return n}var F7,gC,V7,B7,it="See docs/framework/concepts/overlays.";var ep=M(()=>{ye();F7=["auto","manual","hint"],gC=new Set(["button","input"]);V7=["popovertarget","popovertargetaction","command","commandfor"];B7=["flexDirection","flex-direction","alignItems","align-items","justifyContent","justify-content","flexWrap","flex-wrap","gridTemplateColumns","grid-template-columns","gridTemplateRows","grid-template-rows","gap"]});function rl(e,t){let r=ns(e),n=t in r?r[t]:e[t];if(n===void 0||n===null)return{kind:"absent"};if(qe(n)||B(n))return{kind:"bound"};if(A(n))return n.includes("${")?{kind:"bound"}:{kind:"text",text:n};return{isTrue:n===!0,kind:"other"}}function el(e,t){let r=rl(e,t);return r.kind==="text"&&r.text.trim()!==""?r.text:null}function lr(e,t){return rl(e,t).kind!=="absent"}function Ri(e){let t=rl(e,"role");if(t.kind==="bound")return tl;return t.kind==="text"?t.text.trim().toLowerCase().split(/\s+/)[0]:null}function tp(e){let t=rl(e,"id");if(t.kind==="bound")return tl;return t.kind==="text"&&t.text!==""?t.text:null}function fn(e,t){let r=rl(e,t);return r.kind==="bound"||r.kind==="text"&&r.text.trim()!==""}function rp(e){let t=e.textContent;if(A(t)){if(t.trim()!=="")return!0}else if(t!==void 0&&t!==null)return!0;if(fn(e,"aria-label")||lr(e,"aria-labelledby"))return!0;if(Et(e)==="img"&&(fn(e,"alt")||fn(e,"title")))return!0;if(Et(e)==="slot")return!0;let{children:r}=e;if(Array.isArray(r)){for(let s of r)if(A(s)){if(s.trim()!=="")return!0}else if(V(s)&&rp(s))return!0}else if(r!=null)return!0;if(B(e.map))return!0;return(B(e.cases)?Object.values(e.cases):[]).some((s)=>$r(s)&&rp(s))}function*Qa(e,t=[],r=[],n=[]){yield{node:e,path:t,roles:r,tags:n};let s=[...r,Ri(e)],i=[...n,Et(e)],{children:o}=e;if(Array.isArray(o)){for(let[a,l]of o.entries())if(V(l))yield*Qa(l,[...t,"children",a],s,i)}else if(B(o)&&$r(o.map))yield*Qa(o.map,[...t,"children","map"],s,i);if($r(e.map))yield*Qa(e.map,[...t,"map"],s,i);if(B(e.cases)){for(let[a,l]of Object.entries(e.cases))if(V(l))yield*Qa(l,[...t,"cases",a],s,i)}}function tX(e){return e.some((t)=>t.includes("-"))}function ss(e,t,r,n,s,i="error"){return{criterion:s,detail:`${n} ${X7}`,message:r,path:t,rule:e,severity:i}}function SC(e,t,r){if(r.includes("label"))return!0;if(e===tl||t.bound)return!0;return e!==null&&t.ids.has(e)}function rX(e,t){let{node:r,path:n,tags:s}=e,i=Et(r),o=Ri(r);if(o==="bound")return null;if(fn(r,"aria-label")||lr(r,"aria-labelledby")||fn(r,"title"))return null;let l=yr(r,"the control"),c=(p)=>ss("interactive-unnamed",n,`${l} has no accessible name.`,`A control with no name is announced as its role alone, so a reader hears "button" and nothing else. ${p}`,"4.1.2"),u=nX(r,i,t,s);if(u==="named"||u==="exempt")return null;if(o!==null&&Y7.has(o))return rp(r)?null:c("Give it text content, or an aria-label.");if(o!==null&&Z7.has(o))return c("Give it an aria-label, or aria-labelledby naming its visible label.");if(o!==null)return null;if(i==="button"||i==="summary"||i==="a"&&lr(r,"href"))return rp(r)?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 nX(e,t,r,n){if(t==="area"){if(!lr(e,"href"))return"none";return fn(e,"alt")?"named":"unnamed-alt"}if(t==="select"||t==="textarea")return SC(tp(e),r,n)||fn(e,"placeholder")?"named":"unnamed";if(t!=="input")return"none";let s=(el(e,"type")??"text").toLowerCase();if(s==="hidden"||lr(e,"type")&&el(e,"type")===null)return"exempt";if(Q7.has(s))return fn(e,"value")?"named":"unnamed-value";if(s==="image")return fn(e,"alt")?"named":"unnamed-alt";return SC(tp(e),r,n)||fn(e,"placeholder")?"named":"unnamed"}function iX(e){let{node:t,path:r,tags:n}=e,s=Et(t);if(!s.includes("-")||!n.some((i)=>sX.has(i)))return null;return ss("custom-element-in-select",r,`<${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 oX(e){let{node:t,path:r}=e;if(Et(t)!=="img")return null;let n=Ri(t);if(n==="bound"||n==="presentation"||n==="none")return null;if(lr(t,"alt")||fn(t,"aria-label")||lr(t,"aria-labelledby"))return null;return ss("img-alt-missing",r,`${yr(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 lX(e,t){let{node:r,path:n}=e,s=[];for(let i of aX){let o=el(r,i);if(o===null)continue;for(let a of o.split(/\s+/))if(a!==""&&!t.has(a))s.push(ss("aria-target-missing",n,`${yr(r,"the element")} points ${i} 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 cX(e,t,r){for(let n of EC.get(t)??[]){let s=r.get(n);if(s===void 0)continue;if(s.bound)return!0;if(e===tl&&s.ids.size>0)return!0;if(e!==null&&e!==tl&&s.ids.has(e))return!0}return!1}function uX(e,t){let{node:r,path:n,roles:s,tags:i}=e,o=Ri(r);if(o===null||o==="bound"||n.length===0||tX(i))return null;if(s.includes("bound")||cX(tp(r),o,t))return null;let a=yr(r,"the element");if(o==="tab"&&!s.includes("tablist"))return ss("tab-outside-tablist",n,`${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((o==="menuitem"||o==="menuitemcheckbox"||o==="menuitemradio")&&!s.includes("menu")&&!s.includes("menubar"))return ss("menuitem-outside-menu",n,`${a} is a ${o} 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(o==="option"&&!s.includes("listbox")&&!i.includes("select")&&!i.includes("datalist"))return ss("option-outside-listbox",n,`${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 fX(e){let t=[];for(let{node:r}of Qa(e)){if(Ri(r)!=="tab")continue;let n=rl(r,"aria-selected");if(n.kind==="bound")return null;t.push(n.kind==="other"&&n.isTrue||n.kind==="text"&&n.text==="true")}return t}function dX(e){let{node:t,path:r}=e;if(Ri(t)!=="tablist")return null;let n=fX(t);if(n===null||n.length===0||n.includes(!0))return null;return ss("tablist-none-selected",r,`${yr(t,"the tablist")} has ${n.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 pX(e){let{node:t,path:r}=e,n=Ri(t);if(!(Et(t)==="dialog"||n==="dialog"||n==="alertdialog")||n==="bound")return null;if(fn(t,"aria-label")||lr(t,"aria-labelledby"))return null;return ss("dialog-unnamed",r,`${yr(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 hX(e){let{node:t,path:r}=e;if(!lr(t,"aria-activedescendant"))return null;let n=Et(t);if(mX.has(n)||n==="a"&&lr(t,"href")||lr(t,"tabIndex")||lr(t,"tabindex")||lr(t,"contenteditable"))return null;return ss("activedescendant-not-focusable",r,`${yr(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 PC(e){let t=[...Qa(e)],r=new Set,n={bound:!1,ids:new Set},s=new Map,i=!1;for(let{node:a}of t){let l=Ri(a);if(l!==null&&eX.has(l)){let u=s.get(l)??{bound:!1,ids:new Set},p=el(a,"aria-owns");if(p===null)u.bound||=lr(a,"aria-owns");else for(let h of p.split(/\s+/))if(h!=="")u.ids.add(h);s.set(l,u)}let c=tp(a);if(c===tl)i=!0;else if(c!==null)r.add(c);if(Et(a)==="label"){let u=el(a,"for")??el(a,"htmlFor");if(u===null)n.bound||=lr(a,"for")||lr(a,"htmlFor");else n.ids.add(u)}}let o=[];for(let a of t){let l=[rX(a,n),oX(a),uX(a,s),iX(a),dX(a),pX(a),hX(a)];for(let c of l)if(c)o.push(c);if(!i)o.push(...lX(a,r))}return o}var X7="See docs/framework/concepts/accessibility.",tl="bound",Y7,Z7,Q7,EC,eX,sX,aX,mX;var jC=M(()=>{ye();ep();Y7=new Set(["button","checkbox","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","switch","tab","treeitem"]),Z7=new Set(["combobox","listbox","searchbox","slider","spinbutton","textbox"]),Q7=new Set(["button","reset","submit"]),EC=new Map([["menuitem",["menu","menubar"]],["menuitemcheckbox",["menu","menubar"]],["menuitemradio",["menu","menubar"]],["option",["listbox"]],["tab",["tablist"]]]),eX=new Set([...EC.values()].flat());sX=new Set(["select","jx-select"]);aX=["aria-activedescendant","aria-controls","aria-describedby","aria-details","aria-errormessage","aria-flowto","aria-labelledby","aria-owns"];mX=new Set(["button","input","select","textarea"])});function Gy(e){return Et(e)==="dialog"}function kC(e){return e.startsWith("--")}function vX(e){let t=[];for(let{node:r}of rs(e)){let n=Ai(r);if(Gy(r)&&n!==null&&!t.includes(n))t.push(n)}return t}function SX(e){let t=e.oncommand;return t!==void 0&&t!==null}function EX(e,t){for(let{node:r}of rs(e)){if(r===e)continue;let n=Et(r);if(n==="button"){let s=ar(r,"command"),i=ar(r,"commandfor");if(s!==null&&(s==="close"||s==="request-close")&&(i===null||i===t))return!0}if(n==="form"&&ar(r,"method")?.toLowerCase()==="dialog")return!0}return!1}function AC(e,t){let r=[...rs(e,[],null,t)],n=vX(e),s=zy(e,t),i=n.length>0||s.length>0,o=new Map,a=new Map;for(let{node:c}of r){let u=Ai(c);if(u!==null&&!o.has(u))o.set(u,c);if(Et(c)==="button"){let p=ar(c,"commandfor"),h=ar(c,"command");if(p!==null){let m=a.get(p)??new Set;m.add(h??""),a.set(p,m)}}}let l=[];for(let{node:c,path:u}of r)if(l.push(...PX(c,u,o,n,s,i,t)),Gy(c))l.push(...jX(c,u,a));return l}function PX(e,t,r,n,s,i,o){let a=[],l=Et(e),c=o?.invokerTags?.has(l)??!1,u=ar(e,"command"),p=ar(e,"commandfor");if(!(u!==null||p!==null||("command"in ns(e))||("commandfor"in ns(e))))return a;let m=yr(e,"the element");if(!wX.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. ${it}`,fix:"invoker",message:`<${l||"element"}> carries command/commandfor, which only <button> supports.`,path:t,rule:"invoker-not-button",severity:"error"}),a;if(u!==null&&!xX.has(u)&&!kC(u))return a.push({detail:`\`command\` is an enumerated attribute taking ${_C.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. ${it}`,message:`${m} declares command="${u}", which is not a built-in or --custom command.`,path:t,rule:"command-invalid",severity:"error"}),a;if(p!==null){let y=r.get(p),g=n.includes(p),b=s.includes(p);if(!y&&i){let w=[...n,...s].map((j)=>`"${j}"`).join(", ");return a.push({detail:`No element in this document has the id "${p}". The dialogs and popovers here are: ${w}. A commandfor that names nothing does nothing, silently. ${it}`,message:`commandfor="${p}" names nothing in this document.`,path:t,rule:"command-target-missing",severity:"error"}),a}if(u!==null&&y){if(gX.has(u)&&!Gy(y))a.push({detail:`\`${u}\` acts on a <dialog>, and "${p}" is ${b?"a popover":`a <${Et(y)||"element"}>`}. The click is ignored. ${b?"Use `toggle-popover`, `show-popover` or `hide-popover` for a popover.":"Point it at a dialog, or make the target one."} ${it}`,message:`${m} sends ${u} to "${p}", which is not a dialog.`,path:t,rule:"command-target-mismatch",severity:"error"});else if(yX.has(u)&&!Nc(y,o))a.push({detail:`\`${u}\` acts on a popover, and "${p}" is ${g?"a dialog":`a <${Et(y)||"element"}>`} that declares no \`popover\`. The click is ignored. ${g?"Use `show-modal`, `close` or `request-close` for a dialog.":"Give the target a `popover` attribute, or point the button elsewhere."} ${it}`,message:`${m} sends ${u} to "${p}", which is not a popover.`,path:t,rule:"command-target-mismatch",severity:"error"});else if(kC(u)&&!SX(y))a.push({detail:`A custom command is a \`CommandEvent\` dispatched at its target, and "${p}" 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. ${it}`,message:`${m} sends ${u} to "${p}", which handles no command.`,path:t,rule:"custom-command-unhandled",severity:"warn"})}}return a}function jX(e,t,r){let n=[],s=yr(e,"the dialog"),i=Ai(e),{style:o}=e,a=ar(e,"closedby");if(a!==null&&!$X.has(a))n.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. ${it}`,message:`${s} declares closedby="${a}", which is not any, closerequest or none.`,path:t,rule:"dialog-closedby-invalid",severity:"error"});if(gr(o,"display")!==null)n.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. ${it}`,fix:"display",message:`${s} sets display in its base rule.`,path:t,rule:"dialog-display",severity:"error"});let l=i===null?void 0:r.get(i),c=ar(e,"open")!==null||ns(e).open===!0||e.open===!0;if(i!==null&&!l?.has("show-modal")&&!c)n.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. ${it}`,message:`${s} has no invoker in this document.`,path:t,rule:"dialog-no-invoker",severity:"warn"});if(l?.has("show-modal")&&a==="none"&&!EX(e,i))n.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"\`. ${it}`,message:`${s} opens modally, closes on nothing, and has no close button.`,path:t,rule:"modal-without-close",severity:"error"});return n}var _C,gX,yX,bX,xX,$X,wX;var RC=M(()=>{ye();ep();_C=["toggle-popover","show-popover","hide-popover","show-modal","close","request-close"],gX=new Set(["show-modal","close","request-close"]),yX=new Set(["toggle-popover","show-popover","hide-popover"]),bX=["any","closerequest","none"],xX=new Set(_C),$X=new Set(bX),wX=new Set(["button"])});var FC=T(function(DC){Object.defineProperty(DC,"__esModule",{value:!0});DC.formatNames=DC.fastFormats=DC.fullFormats=void 0;function is(e,t){return{validate:e,compare:t}}DC.fullFormats={date:is(TC,Zy),time:is(Xy(!0),Qy),"date-time":is(OC(!0),JC),"iso-time":is(Xy(),IC),"iso-date-time":is(OC(),MC),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:NX,"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:LX,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:CX,int32:{type:"number",validate:JX},int64:{type:"number",validate:MX},float:{type:"number",validate:CC},double:{type:"number",validate:CC},password:!0,binary:!0};DC.fastFormats={...DC.fullFormats,date:is(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Zy),time:is(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Qy),"date-time":is(/^\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,JC),"iso-time":is(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,IC),"iso-date-time":is(/^\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,MC),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};DC.formatNames=Object.keys(DC.fullFormats);function kX(e){return e%4===0&&(e%100!==0||e%400===0)}var _X=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,AX=[0,31,28,31,30,31,30,31,31,30,31,30,31];function TC(e){let t=_X.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],s=+t[3];return n>=1&&n<=12&&s>=1&&s<=(n===2&&kX(r)?29:AX[n])}function Zy(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var Ky=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Xy(e){return function(r){let n=Ky.exec(r);if(!n)return!1;let s=+n[1],i=+n[2],o=+n[3],a=n[4],l=n[5]==="-"?-1:1,c=+(n[6]||0),u=+(n[7]||0);if(c>23||u>59||e&&!a)return!1;if(s<=23&&i<=59&&o<60)return!0;let p=i-u*l,h=s-c*l-(p<0?1:0);return(h===23||h===-1)&&(p===59||p===-1)&&o<61}}function Qy(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),n=new Date("2020-01-01T"+t).valueOf();if(!(r&&n))return;return r-n}function IC(e,t){if(!(e&&t))return;let r=Ky.exec(e),n=Ky.exec(t);if(!(r&&n))return;if(e=r[1]+r[2]+r[3],t=n[1]+n[2]+n[3],e>t)return 1;if(e<t)return-1;return 0}var Yy=/t|\s/i;function OC(e){let t=Xy(e);return function(n){let s=n.split(Yy);return s.length===2&&TC(s[0])&&t(s[1])}}function JC(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),n=new Date(t).valueOf();if(!(r&&n))return;return r-n}function MC(e,t){if(!(e&&t))return;let[r,n]=e.split(Yy),[s,i]=t.split(Yy),o=Zy(r,s);if(o===void 0)return;return o||Qy(n,i)}var RX=/\/|:/,OX=/^(?:[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 NX(e){return RX.test(e)&&OX.test(e)}var NC=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function CX(e){return NC.lastIndex=0,NC.test(e)}var TX=-2147483648,IX=2147483647;function JX(e){return Number.isInteger(e)&&e<=IX&&e>=TX}function MX(e){return Number.isInteger(e)}function CC(){return!0}var DX=/[^\\]\\Z/;function LX(e){if(DX.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var VC=T(function(qC){Object.defineProperty(qC,"__esModule",{value:!0});var qX=Oy(),VX=Ny(),BX=Jy(),WX=Ly(),np=Fy(),UX=[qX.default,VX.default,(0,BX.default)(),WX.default,np.metadataVocabulary,np.contentVocabulary];qC.default=UX});var BC=T(function(kfe,zX){zX.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 UC=T(function(Ir,tb){Object.defineProperty(Ir,"__esModule",{value:!0});Ir.MissingRefError=Ir.ValidationError=Ir.CodeGen=Ir.Name=Ir.nil=Ir.stringify=Ir.str=Ir._=Ir.KeywordCxt=Ir.Ajv=void 0;var GX=Ry(),KX=VC(),XX=qy(),WC=BC(),YX=["/properties"],sp="http://json-schema.org/draft-07/schema";class Cc extends GX.default{_addVocabularies(){if(super._addVocabularies(),KX.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(XX.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(WC,YX):WC;this.addMetaSchema(e,sp,!1),this.refs["http://json-schema.org/schema"]=sp}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(sp)?sp:void 0)}}Ir.Ajv=Cc;tb.exports=Ir=Cc;tb.exports.Ajv=Cc;Object.defineProperty(Ir,"__esModule",{value:!0});Ir.default=Cc;var ZX=La();Object.defineProperty(Ir,"KeywordCxt",{enumerable:!0,get:function(){return ZX.KeywordCxt}});var nl=we();Object.defineProperty(Ir,"_",{enumerable:!0,get:function(){return nl._}});Object.defineProperty(Ir,"str",{enumerable:!0,get:function(){return nl.str}});Object.defineProperty(Ir,"stringify",{enumerable:!0,get:function(){return nl.stringify}});Object.defineProperty(Ir,"nil",{enumerable:!0,get:function(){return nl.nil}});Object.defineProperty(Ir,"Name",{enumerable:!0,get:function(){return nl.Name}});Object.defineProperty(Ir,"CodeGen",{enumerable:!0,get:function(){return nl.CodeGen}});var QX=jc();Object.defineProperty(Ir,"ValidationError",{enumerable:!0,get:function(){return QX.default}});var eY=qa();Object.defineProperty(Ir,"MissingRefError",{enumerable:!0,get:function(){return eY.default}})});var GC=T(function(zC){Object.defineProperty(zC,"__esModule",{value:!0});zC.formatLimitDefinition=void 0;var HC=UC(),xt=we(),Oi=xt.operators,ip={formatMaximum:{okStr:"<=",ok:Oi.LTE,fail:Oi.GT},formatMinimum:{okStr:">=",ok:Oi.GTE,fail:Oi.LT},formatExclusiveMaximum:{okStr:"<",ok:Oi.LT,fail:Oi.GTE},formatExclusiveMinimum:{okStr:">",ok:Oi.GT,fail:Oi.LTE}},nY={message:({keyword:e,schemaCode:t})=>xt.str`should be ${ip[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>xt._`{comparison: ${ip[e].okStr}, limit: ${t}}`};zC.formatLimitDefinition={keyword:Object.keys(ip),type:"string",schemaType:"string",$data:!0,error:nY,code(e){let{gen:t,data:r,schemaCode:n,keyword:s,it:i}=e,{opts:o,self:a}=i;if(!o.validateFormats)return;let l=new HC.KeywordCxt(i,a.RULES.all.format.definition,"format");if(l.$data)c();else u();function c(){let h=t.scopeValue("formats",{ref:a.formats,code:o.code.formats}),m=t.const("fmt",xt._`${h}[${l.schemaCode}]`);e.fail$data(xt.or(xt._`typeof ${m} != "object"`,xt._`${m} instanceof RegExp`,xt._`typeof ${m}.compare != "function"`,p(m)))}function u(){let h=l.schema,m=a.formats[h];if(!m||m===!0)return;if(typeof m!="object"||m instanceof RegExp||typeof m.compare!="function")throw Error(`"${s}": format "${h}" does not define "compare" function`);let y=t.scopeValue("formats",{key:h,ref:m,code:o.code.formats?xt._`${o.code.formats}${xt.getProperty(h)}`:void 0});e.fail$data(p(y))}function p(h){return xt._`${h}.compare(${r}, ${n}) ${ip[s].fail} 0`}},dependencies:["format"]};var sY=(e)=>(e.addKeyword(zC.formatLimitDefinition),e);zC.default=sY});var ZC=T(function(Tc,YC){Object.defineProperty(Tc,"__esModule",{value:!0});var dn=FC(),oY=GC(),sl=we(),KC=new sl.Name("fullFormats"),aY=new sl.Name("fastFormats"),nb=(e,t={keywords:!0})=>{if(Array.isArray(t))return XC(e,t,dn.fullFormats,KC),e;let[r,n]=t.mode==="fast"?[dn.fastFormats,aY]:[dn.fullFormats,KC],s=t.formats||dn.formatNames;if(XC(e,s,r,n),t.keywords)(0,oY.default)(e);return e};nb.get=(e,t="full")=>{let n=(t==="fast"?dn.fastFormats:dn.fullFormats)[e];if(!n)throw Error(`Unknown format "${e}"`);return n};function XC(e,t,r,n){var s,i;(s=(i=e.opts.code).formats)!==null&&s!==void 0||(i.formats=sl._`require("ajv-formats/dist/formats").${n}`);for(let o of t)e.addFormat(o,r[o])}YC.exports=Tc=nb;Object.defineProperty(Tc,"__esModule",{value:!0});Tc.default=nb});import{existsSync as tT,readFileSync as ob,readdirSync as rT,statSync as nT}from"node:fs";import{createRequire as lY}from"node:module";import{join as sT,relative as il,resolve as sb}from"node:path";async function dY(){try{let{default:e}=await Promise.resolve().then(() => xr(Wy(),1)),{default:t}=await Promise.resolve().then(() => xr(ZC(),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 iT(e,t={}){let r=sb(e),n=[],s=[],i=0;for(let S of["project.schema.json","document.schema.json"]){let E=sb(r,S);if(!tT(E))continue;i+=1;let P=Ic(E),R=gY(P);if(R.length>0)n.push({errors:R.map(({reason:N,ref:_})=>({message:`$ref "${_}" ${N} — committed entry documents must be self-contained `+"single-resource schemas; regenerate with `jx schema`"})),file:S})}if(n.length>0)return{checked:i,issues:n,lint:s,valid:!1};let o=await mC(r);if(i+=1,!o.valid)n.push({errors:o.errors??[],file:o.file});let{addFormats:a,Ajv:l}=await dY(),{document:c}=await zP(r,{write:!1}),u=new l({allErrors:!0,ownProperties:!0,strict:!1});a(u);let p=u.compile(c),h=yC(eT(r).flatMap((S)=>{try{return[JSON.parse(ob(S,"utf8"))]}catch{return[]}}));for(let S of cY)for(let E of lT(sb(r,S))){if(E.endsWith(".class.json"))continue;i+=1;let P=pY(E,il(r,E));if(s.push(...P.warnings),P.failure!==null){n.push(P.failure);continue}let R=P.document,N=QC(R,il(r,E));if(s.push(...N.warnings),N.failure!==null){n.push(N.failure);continue}if(p(R))s.push(...hY(R,il(r,E),h));else n.push({errors:p.errors??[],file:il(r,E)})}let m=new l({allErrors:!0,ownProperties:!0,strict:!1});a(m);let y=m.compile(Ug());for(let S of eT(r)){i+=1;let E=Ic(S),P=QC(E,il(r,S));if(s.push(...P.warnings),P.failure!==null)n.push(P.failure);else if(!y(E))n.push({errors:y.errors??[],file:il(r,S)})}let{config:g}=Gs(r),b=await zs(r,g),w=lY(import.meta.url);for(let S of b.extensions)for(let E of["project","document","fields"]){let P=S.schemas[E];if(!P)continue;i+=1;let R=new l({allErrors:!0,ownProperties:!0,strict:!1});a(R);for(let N of fY){let _=w.resolve(N);R.addSchema(Ic(_))}try{R.compile(Ic(P))}catch(N){n.push({errors:[{message:N instanceof Error?N.message:String(N)}],file:`${S.specifier} (${E} fragment)`})}}let j=t.strict===!0&&s.some((S)=>S.severity==="error");return{checked:i,issues:n,lint:s,valid:n.length===0&&!j}}function pY(e,t){if(!bs(e))return{document:Ic(e),failure:null,warnings:[]};let r=ob(e,"utf8"),n=Mp(r).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:mY(r),failure:null,warnings:n}}catch(s){return{document:null,failure:{errors:[{message:Pe(s)}],file:t},warnings:n}}}function QC(e,t){let r=[];try{Nl(e,t,r)}catch(s){return{failure:{errors:[{message:Pe(s)}],file:t},warnings:[]}}return{failure:null,warnings:r.map(({pointer:s,problem:i})=>({detail:i.message,file:t,message:`${s} (line ${i.line}, column ${i.column}): ${i.message}`,path:s.split("/").slice(1),rule:"typescript-reading",severity:"warn",source:"function-body"}))}}function mY(e){let t=Wi(e);return B(t)?t:null}function Ic(e){return JSON.parse(ob(e,"utf8"))}function hY(e,t,r){let n=[];for(let s of vC(e,r))n.push({...ib(s),file:t,source:"popover"});for(let s of AC(e,r))n.push({...ib(s),file:t,source:"dialog"});for(let s of PC(e))n.push({...ib(s),criterion:s.criterion,file:t,source:"accessibility"});return n}function ib(e){return{detail:e.detail,message:e.message,path:e.path,rule:e.rule,severity:e.severity}}function oT(e){return e.lint.map((t)=>{let r=t.criterion===void 0?`${t.source}/${t.rule}`:`${t.source}/${t.rule}, WCAG ${t.criterion}`;return`${t.file}: ${t.severity}: ${t.message} [${r}]`})}function gY(e){let t=[],r=new Set,n=(i)=>{let o=e;for(let a of i.slice(1).split("/")){if(a==="")continue;let l=a.replaceAll("~1","/").replaceAll("~0","~");if(!V(o))return!1;if(o=o[l],o===void 0)return!1}return!0},s=(i)=>{if(!B(i)||r.has(i))return;r.add(i);let o=i.$ref;if(A(o)){if(/^[a-zA-Z][a-zA-Z\d+.-]*:/.test(o))t.push({reason:"is an absolute URI editors resolve over the network",ref:o});else if(!o.startsWith("#"))t.push({reason:"is a relative path only Node module resolution can follow",ref:o});else if(o.length>1&&!o.startsWith("#/"))t.push({reason:"is an $anchor reference, which has no root-pointer form",ref:o});else if(o.length>1&&!n(o.slice(1)))t.push({reason:"points at no node in this document",ref:o})}for(let[a,l]of Object.entries(i)){if(!yY.has(a))continue;if(Array.isArray(l))for(let c of l)s(c);else if(B(l)){if(s(l),aT.has(a))for(let c of Object.values(l))s(c)}}};return s(e),t}function lT(e){if(!tT(e))return[];let t=[];for(let r of rT(e)){let n=sT(e,r);if(nT(n).isDirectory())t.push(...lT(n));else if(xs(r))t.push(n)}return t.toSorted()}function eT(e){let t=[],r=(n)=>{for(let s of rT(n)){if(uY.has(s))continue;let i=sT(n,s);if(nT(i).isDirectory())r(i);else if(s.endsWith(".class.json"))t.push(i)}};return r(e),t.toSorted()}function cT(e){let t=[];for(let r of e.issues){t.push(`${r.file}:`);for(let n of r.errors){let s=B(n)?n:{},{instancePath:i,message:o}=s;t.push(` - ${i||"/"}: ${o??JSON.stringify(n)}`)}}return t}var cY,uY,fY,aT,yY;var uT=M(()=>{Ui();er();$m();Dk();hC();jC();RC();ep();ye();vs();jl();Ng();cY=["components","pages","layouts"],uY=new Set(["node_modules","dist",".git"]),fY=["@jxsuite/schema/schemas/project.core.schema.json","@jxsuite/schema/schemas/project.fields.schema.json","@jxsuite/schema/schemas/document.paths.schema.json"];aT=new Set(["$defs","definitions","dependencies","dependentSchemas","patternProperties","properties"]),yY=new Set([...aT,"additionalItems","additionalProperties","allOf","anyOf","contains","contentSchema","else","if","items","not","oneOf","prefixItems","propertyNames","then","unevaluatedItems","unevaluatedProperties"])});er();import{relative as ab,resolve as fT}from"node:path";async function bY(){let e=process.argv.slice(2),[t]=e;if(!t||t==="--help"||t==="-h")console.log(`Usage: jx <command> [options]
628
629
 
629
630
  Commands:
630
631
  build [root] Build a Jx site to dist/
@@ -644,8 +645,8 @@ Options:
644
645
  --connection db push: restrict to one connection name
645
646
  --strict validate: fail on an overlay or accessibility lint error, not only a schema error
646
647
  --to <format> convert: jxn or json
647
- --drop-comments convert: convert a .jxn file to .json even though it has comments`),process.exit(0);if(t==="convert"){try{await Promise.resolve().then(() => nb());rb(process.cwd(),e.slice(1))}catch(p){console.error(je(p)),process.exit(1)}return}let r=t==="db",n=r?e[1]:null,s=e.slice(r?2:1),i=new Set,o=[],a,l;for(let p=0;p<s.length;p+=1){let h=s[p];if(h==="--connection")p+=1,a=s[p];else if(h==="--port"){p+=1;let m=Math.trunc(Number(s[p]??""));if(Number.isFinite(m)&&m>=0)l=m}else if(h.startsWith("--"))i.add(h);else o.push(h)}let[c]=o,u=_N(c??".");if(r){if(n!=="push")console.error(`Unknown db subcommand: ${n??"(none)"}
648
- Usage: jx db push [root] [--dry-run] [--connection <name>]`),process.exit(1);let p=i.has("--dry-run");try{await Promise.resolve().then(() => Ax());let m={dryRun:p};if(a!==void 0)m.connection=a;let{results:b,bindingsPatched:g,wranglerPath:y}=await _x(u,m);for(let w of b){let j=w.applied?"applied":"dry-run";console.log(`${w.connection} (${w.provider}) — ${w.tables.length} table(s), ${w.statements.length} statement(s) [${j}]`);for(let S of w.statements)console.log(` ${S}`);for(let S of w.warnings)console.warn(` warning: ${S}`)}if(g&&y)console.log(`Updated bindings in ${Ly(u,y)}`)}catch(h){console.error(`db push failed: ${je(h)}`),process.exit(1)}return}if(t==="build"){let p=i.has("--verbose"),h=!i.has("--no-clean"),m=i.has("--include-held");console.log(`Building site from ${u}...`);try{await Promise.resolve().then(() => Bj());let g=await Dj(u,{clean:h,includeHeld:m,verbose:p});if(g.errors.length>0){console.error(`
649
- Build completed with ${g.errors.length} error(s):`);for(let y of g.errors)console.error(` - ${y}`);process.exit(1)}console.log(`
650
- Done: ${g.routes} routes → ${g.files} files`)}catch(b){console.error(`Build failed: ${je(b)}`),process.exit(1)}}else if(t==="dev")try{await Promise.resolve().then(() => Uj());Hj(u,l)}catch(p){console.error(je(p)),process.exit(1)}else if(t==="preview"){let{existsSync:p}=await import("node:fs"),h=_N(u,"dist");if(!p(h))console.error(`No build output at ${h} — run \`jx build\` first.`),process.exit(1);await Promise.resolve().then(() => Yj());let b=l??4173;Kj(h,b),console.log(`Previewing ${h} at http://localhost:${b}`)}else if(t==="schema")try{await Promise.resolve().then(() => ug());let{projectSchemaPath:h,documentSchemaPath:m}=await cP(u);console.log(`Wrote ${Ly(u,h)}`),console.log(`Wrote ${Ly(u,m)}`)}catch(p){console.error(`Schema generation failed: ${je(p)}`),process.exit(1)}else if(t==="validate")try{await Promise.resolve().then(() => kN());let b=await vN(u,{strict:i.has("--strict")}),g=SN(b);if(b.valid){console.log(`Project is valid (${b.checked} files checked in ${u})`);for(let y of g)console.log(y)}else{console.error(`Project is INVALID (${u}):`);for(let y of[...PN(b),...g])console.error(y);process.exit(1)}}catch(p){console.error(`Validation failed: ${je(p)}`),process.exit(1)}else console.error(`Unknown command: ${t}
651
- Run "jx --help" for usage.`),process.exit(1)}var Sue=sY();export{Sue as ready};
648
+ --drop-comments convert: convert a .jxn file to .json even though it has comments`),process.exit(0);if(t==="convert"){try{await Promise.resolve().then(() => jb());Pb(process.cwd(),e.slice(1))}catch(p){console.error(Pe(p)),process.exit(1)}return}let r=t==="db",n=r?e[1]:null,s=e.slice(r?2:1),i=new Set,o=[],a,l;for(let p=0;p<s.length;p+=1){let h=s[p];if(h==="--connection")p+=1,a=s[p];else if(h==="--port"){p+=1;let m=Math.trunc(Number(s[p]??""));if(Number.isFinite(m)&&m>=0)l=m}else if(h.startsWith("--"))i.add(h);else o.push(h)}let[c]=o,u=fT(c??".");if(r){if(n!=="push")console.error(`Unknown db subcommand: ${n??"(none)"}
649
+ Usage: jx db push [root] [--dry-run] [--connection <name>]`),process.exit(1);let p=i.has("--dry-run");try{await Promise.resolve().then(() => Zx());let m={dryRun:p};if(a!==void 0)m.connection=a;let{results:y,bindingsPatched:g,wranglerPath:b}=await Yx(u,m);for(let w of y){let j=w.applied?"applied":"dry-run";console.log(`${w.connection} (${w.provider}) — ${w.tables.length} table(s), ${w.statements.length} statement(s) [${j}]`);for(let S of w.statements)console.log(` ${S}`);for(let S of w.warnings)console.warn(` warning: ${S}`)}if(g&&b)console.log(`Updated bindings in ${ab(u,b)}`)}catch(h){console.error(`db push failed: ${Pe(h)}`),process.exit(1)}return}if(t==="build"){let p=i.has("--verbose"),h=!i.has("--no-clean"),m=i.has("--include-held");console.log(`Building site from ${u}...`);try{await Promise.resolve().then(() => kP());let g=await wP(u,{clean:h,includeHeld:m,verbose:p});if(g.errors.length>0){console.error(`
650
+ Build completed with ${g.errors.length} error(s):`);for(let b of g.errors)console.error(` - ${b}`);process.exit(1)}console.log(`
651
+ Done: ${g.routes} routes → ${g.files} files`)}catch(y){console.error(`Build failed: ${Pe(y)}`),process.exit(1)}}else if(t==="dev")try{await Promise.resolve().then(() => AP());_P(u,l)}catch(p){console.error(Pe(p)),process.exit(1)}else if(t==="preview"){let{existsSync:p}=await import("node:fs"),h=fT(u,"dist");if(!p(h))console.error(`No build output at ${h} — run \`jx build\` first.`),process.exit(1);await Promise.resolve().then(() => CP());let y=l??4173;NP(h,y),console.log(`Previewing ${h} at http://localhost:${y}`)}else if(t==="schema")try{await Promise.resolve().then(() => Ng());let{projectSchemaPath:h,documentSchemaPath:m}=await HP(u);console.log(`Wrote ${ab(u,h)}`),console.log(`Wrote ${ab(u,m)}`)}catch(p){console.error(`Schema generation failed: ${Pe(p)}`),process.exit(1)}else if(t==="validate")try{await Promise.resolve().then(() => uT());let y=await iT(u,{strict:i.has("--strict")}),g=oT(y);if(y.valid){console.log(`Project is valid (${y.checked} files checked in ${u})`);for(let b of g)console.log(b)}else{console.error(`Project is INVALID (${u}):`);for(let b of[...cT(y),...g])console.error(b);process.exit(1)}}catch(p){console.error(`Validation failed: ${Pe(p)}`),process.exit(1)}else console.error(`Unknown command: ${t}
652
+ Run "jx --help" for usage.`),process.exit(1)}var tde=bY();export{tde as ready};