@jxsuite/compiler 9.0.1 → 10.0.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 +269 -254
- package/dist/compiler.js +181 -162
- package/package.json +19 -18
- package/src/cli.ts +13 -3
- package/src/compiler.ts +38 -20
- package/src/shadow.ts +6 -33
- package/src/shared.ts +1850 -283
- package/src/site/base-path.ts +88 -2
- package/src/site/bundler-backend.bun.ts +36 -2
- package/src/site/bundler-backend.node.ts +42 -2
- package/src/site/bundler-backend.ts +12 -0
- package/src/site/bundler.ts +40 -4
- package/src/site/client-runtime.ts +13 -14
- package/src/site/external-class.ts +290 -0
- package/src/site/format-host.ts +49 -10
- package/src/site/headers-emitter.ts +6 -5
- package/src/site/image-cache.ts +34 -3
- package/src/site/image-optimizer.ts +51 -11
- package/src/site/image-transform.ts +219 -88
- package/src/site/pages-discovery.ts +8 -1
- package/src/site/prototype-resolver.ts +91 -195
- package/src/site/service-worker.ts +4 -3
- package/src/site/site-build.ts +425 -105
- package/src/site/site-loader.ts +9 -0
- package/src/targets/compile-class.ts +42 -3
- package/src/targets/compile-client.ts +319 -91
- package/src/targets/compile-element.ts +696 -94
- package/src/targets/compile-pack.ts +234 -0
- package/src/targets/compile-static.ts +33 -83
package/dist/cli.js
CHANGED
|
@@ -1,70 +1,71 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{createRequire as
|
|
3
|
-
`)return-1;if(s==="\\")r+=1;else if(s==="[")n=!0;else if(s==="]")n=!1;else if(s==="/"&&!n)return r+1}return-1}function
|
|
4
|
-
`)n[
|
|
5
|
-
`)r(
|
|
6
|
-
`){if(e.charAt(
|
|
7
|
-
`,"\r"]);
|
|
8
|
-
`],["r","\r"],["t","\t"]])});function
|
|
9
|
-
`,patched:!0}}function
|
|
2
|
+
import{createRequire as LN}from"node:module";var NN=Object.create;var{getPrototypeOf:TN,defineProperty:Tb,getOwnPropertyNames:JN}=Object;var Jb=Object.prototype.hasOwnProperty;function MN(e){return this[e]}var IN,DN,Sr=(e,t,n)=>{var r=e!=null&&typeof e==="object";if(r){var s=t?IN??=new WeakMap:DN??=new WeakMap,o=s.get(e);if(o)return o}n=e!=null?NN(TN(e)):{};let i=t||!e||!e.__esModule||!Jb.call(e,"default")?Tb(n,"default",{value:e,enumerable:!0}):n;if(e&&typeof e==="object"||typeof e==="function"){for(let a of JN(e))if(!Jb.call(i,a))Tb(i,a,{get:MN.bind(e,a),enumerable:!0})}if(r)s.set(e,i);return i};var W=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var J=(e,t,n)=>()=>{if(e)try{t=e(e=0)}catch(r){n=[r]}if(n)throw n[0];return t};var pt=LN(import.meta.url);function k(e){return typeof e==="string"}function Ie(e){return typeof e==="number"}function Ge(e){return typeof e==="boolean"}function _t(e){return typeof e==="function"}function D(e){return typeof e==="object"&&e!==null}function L(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function me(e){return L(e)&&typeof e.$ref==="string"}function kt(e){return L(e)&&e.$prototype==="Function"}function fn(e){return L(e)&&L(e.$expression)}function wr(e){return fn(e)&&Array.isArray(e.parameters)&&e.parameters.length>0}function vr(e){return kt(e)&&Array.isArray(e.body)}function Pn(e){return L(e)&&typeof e.$prototype==="string"&&e.$prototype!=="Function"}function Zr(e){return L(e)&&e.timing==="server"&&typeof e.$src==="string"&&typeof e.$export==="string"&&!e.$prototype}function jc(e){return L(e)&&!e.$prototype&&!e.$expression&&"default"in e}function $s(e){if(!L(e))return!1;for(let t of Object.keys(e))if(!hp.has(t))return!1;return!0}function Db(e){if(!L(e))return!1;for(let t of Object.keys(e))if(hp.has(t))return!0;return!1}function Le(e){return L(e)&&e.$prototype==="Array"}function Lb(e){return(Array.isArray(e)?e:[e]).some((n)=>Le(n))}function Fb(e){return L(e)&&e.$prototype==="Class"}function Ot(e){return L(e)}function le(e){return typeof e==="string"&&e.includes("${")}function Vb(e){return/\breturn\b[^\S\n]*(?![;}\s]|$)/.test(po(e))}function gp(e){return e.$prototype==="Function"||k(e.role)&&e.role!=="field"}function po(e){if(!/[/'"`]/u.test(e))return e;let t=vc.get(e);if(t!==void 0)return t;let n=Wb(e);if(vc.size>=qb)vc.clear();return vc.set(e,n),n}function Hb(e){if(!e.includes("${"))return FN;let t=Ec.get(e);if(t!==void 0)return t;let n=[],r=0;while(r<e.length){let s=[];Wb(e.slice(r),s);let o=-1;for(let a=0;a<s.length;a+=2){let l=r+(s[a]??0),c=s[a+1]??-1;if(c===-1){o=l;break}n.push(Mb(e,l,r+c))}if(o===-1)break;let i=VN(e,o);if(i===-1)r=o+2;else n.push(Mb(e,o,i)),r=i}if(Ec.size>=qb)Ec.clear();return Ec.set(e,n),n}function Mb(e,t,n){return{end:n,expr:e.slice(t+2,n-1),start:t}}function VN(e,t){let n=0;for(let r=t+1;r<e.length;r+=1){let s=e.charAt(r);if(s==="{")n+=1;else if(s==="}"){if(n-=1,n===0)return r+1}}return-1}function HN(e,t,n){return(t==="+"||t==="-")&&e.charAt(n-1)===t}function Ib(e,t){let n=!1;for(let r=t+1;r<e.length;r+=1){let s=e.charAt(r);if(s===`
|
|
3
|
+
`)return-1;if(s==="\\")r+=1;else if(s==="[")n=!0;else if(s==="]")n=!1;else if(s==="/"&&!n)return r+1}return-1}function Wb(e,t){let n=e.split(""),r=(c)=>{if(n[c]!==void 0&&n[c]!==`
|
|
4
|
+
`)n[c]=" "},s=[],o=t!==void 0,i="",a=-1,l=0;while(l<e.length){let c=e.charAt(l);if(o)if(c==="\\")r(l),r(l+1),l+=2;else if(c==="`"&&!(t&&s.length===0))o=!1,i=c,l+=1;else if(c==="$"&&e.charAt(l+1)==="{"){if(s.length===0)t?.push(l,-1);s.push(0),o=!1,i="{",l+=2}else r(l),l+=1;else if(c==="/"&&e.charAt(l+1)==="/")while(l<e.length&&e.charAt(l)!==`
|
|
5
|
+
`)r(l),l+=1;else if(c==="/"&&e.charAt(l+1)==="*"){let u=e.indexOf("*/",l+2),d=u===-1?e.length:u+2;for(;l<d;l+=1)r(l)}else if(c==="'"||c==='"'){l+=1;while(l<e.length&&e.charAt(l)!==c&&e.charAt(l)!==`
|
|
6
|
+
`){if(e.charAt(l)==="\\")r(l),l+=1;r(l),l+=1}i=c,l+=1}else if(c==="`")o=!0,l+=1;else if(t&&c==="/"&&qN.has(i)&&!HN(e,i,a)&&Ib(e,l)>0){let u=Ib(e,l);for(l+=1;l<u-1;l+=1)r(l);i="/",l=u}else{let u=s.length-1;if(u>=0&&c==="{")s[u]=(s[u]??0)+1;else if(u>=0&&c==="}")if(s[u]===0){if(s.pop(),o=!0,t&&s.length===0)t[t.length-1]=l+1}else s[u]=(s[u]??1)-1;if(c.trim()!=="")i=c,a=l;l+=1}}return n.join("")}function mo(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Pc(e){if(!e)return[];return e.map((t)=>k(t)?t:t.name)}function WN(e){return typeof e==="string"}function rr(e){if(typeof e!=="object"||e===null||Array.isArray(e)||!L(e.$expression))return!1;let t=e.$expression;if(t.operator==="?:")return typeof t.value==="string"&&typeof t.initial==="string";if(t.operator==="switch")return L(t.cases)&&Object.values(t.cases).every((n)=>k(n))&&typeof t.default==="string";return!1}function Yo(e){if(WN(e))return[e];if(!rr(e))return[];let t=e.$expression;if(t.operator==="?:")return[...new Set([t.value,t.initial])];return[...new Set([...Object.values(t.cases),t.default])]}function Zo(e){return e.startsWith("#")}function Qo(e){return e.replaceAll(/-([a-z])/g,(t,n)=>n.toUpperCase())}var hp,vc,qb=2048,FN,Ec,qN;var ce=J(()=>{hp=new Set(["type","enum","minimum","maximum","minLength","maxLength","pattern","format","items","properties","required","description","title","$comment"]);vc=new Map;FN=[],Ec=new Map;qN=new Set("(,=:[!&|?{;+-*%<>~^")});function Ub(e){let t=[],n=[],r=null,s=0,o=()=>n.at(-1)?.path??"",i=()=>r===null?o():zN(o(),r),a=()=>{s+=1;let l="";while(s<e.length){let c=e[s];if(c==="\\"){let u=e[s+1]??"";if(u==="u")l+=String.fromCodePoint(Number.parseInt(e.slice(s+2,s+6),16)),s+=6;else l+=BN.get(u)??u,s+=2;continue}if(c==='"')return s+=1,l;l+=c,s+=1}return l};while(s<e.length){let l=e[s];if(Bb.has(l)||l===","||l===":"){s+=1;continue}if(l==="{"||l==="["){n.push(l==="{"?{keys:new Set,kind:"object",path:i()}:{kind:"array",path:i()}),r=null,s+=1;continue}if(l==="}"||l==="]"){n.pop(),r=null,s+=1;continue}if(l==='"'){let u=a(),d=n.at(-1);if(d?.kind==="object"&&UN(e,s)===":"){if(d.keys.has(u))t.push({detail:u,kind:"duplicate-key",path:d.path});d.keys.add(u),r=u}else r=null;continue}if(l==="-"||l>="0"&&l<="9"){let u=s;while(s<e.length&&/[\d+.eE-]/.test(e[s]))s+=1;let d=e.slice(u,s);if(!KN(d))t.push({detail:d,kind:"unsafe-number",path:i()});r=null;continue}let c=s;while(s<e.length&&/[A-Za-z]/.test(e[s]))s+=1;if(s===c)s+=1;r=null}return t}function UN(e,t){let n=t;while(n<e.length&&Bb.has(e[n]))n+=1;return e[n]??""}function zN(e,t){return e===""?t:`${e}.${t}`}function KN(e){if(/[.eE]/.test(e))return!0;let t=Number(e);if(!Number.isFinite(t))return!1;return String(t)===e.replace(/^\+/,"")}function zb(e){let t=e.path===""?"the document root":`"${e.path}"`;return e.kind==="duplicate-key"?`duplicate key "${e.detail}" in ${t} — JSON.parse keeps the last one and `+"silently discards the first (RFC 7493 §2.3)":`number ${e.detail} in ${t} cannot be represented exactly and will change when `+"the document is written back (RFC 7493 §2.2)"}var Bb,BN;var Kb=J(()=>{Bb=new Set([" ","\t",`
|
|
7
|
+
`,"\r"]);BN=new Map([["b","\b"],["f","\f"],["n",`
|
|
8
|
+
`],["r","\r"],["t","\t"]])});function be(e){return e instanceof Error?e.message:String(e)}function Xb(e){if(k(e))return Gb.test(e)?e.normalize("NFC"):e;if(Array.isArray(e))return e.map((t)=>Xb(t));if(L(e))return ei(e);return e}function ei(e){let t={};for(let[n,r]of Object.entries(e))t[Gb.test(n)?n.normalize("NFC"):n]=Xb(r);return t}function yp(e,t,n){let r;try{r=JSON.parse(e)}catch(o){throw Error(`Failed to parse ${n} at ${t}: ${be(o)}`,{cause:o})}if(!L(r))throw Error(`Invalid ${n} at ${t}: expected a JSON object`);let s=Ub(e);if(s.length>0){let o=s.map((i)=>zb(i)).join("; ");throw Error(`Invalid ${n} at ${t}: ${o}`)}return ei(r)}function Yb(e,t){return yp(e,t,"Jx document")}function Zb(e,t){return yp(e,t,"project config")}function Qb(e,t){return yp(e,t,"class definition")}var Gb;var Lt=J(()=>{ce();Kb();Gb=/[^\p{ASCII}]/u});import{spawn as GN}from"node:child_process";import{createRequire as XN}from"node:module";import{join as YN}from"node:path";function e$(e,t){try{return XN(YN(e,"package.json")).resolve(`@jxsuite/server/${t}`)}catch{throw Error(`@jxsuite/server is not installed in ${e}. Add it to devDependencies (e.g. \`bun add -d @jxsuite/server\`) and retry.`)}}function _c(e,t,n,r=GN,s=process){let o=e$(t,e),i=r("bun",[o,"--root",t,...n],{stdio:"inherit"});return i.on("error",(a)=>{console.error(a.code==="ENOENT"?`jx ${e} runs on Bun, which was not found on your PATH. Install it from https://bun.sh and retry.`:`Failed to start jx ${e}: ${a.message}`),s.exitCode=1}),i.on("exit",(a)=>{s.exitCode=a??0}),i}var xp=()=>{};import{spawn as ZN}from"node:child_process";function t$(e,t,n=ZN,r=process){return _c("convert",e,t,n,r)}var n$=J(()=>{xp()});import{spawn as QN}from"node:child_process";function r$(e,t,n=QN,r=process){return _c("format",e,t,n,r)}var s$=J(()=>{xp()});function eT(e){return JSON.parse(e)}function ti(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function tT(e){return ti(e)&&typeof e.binding==="string"}function nT(e){try{let t=eT(e);return ti(t)?t:void 0}catch{return}}function o$(e,t){if(t.length===0)return{content:e??"",patched:!1};let n={};if(e){let r=nT(e);if(r===void 0)return{content:e,patched:!1};n=r}for(let r of t)i$(n,r);return{content:`${JSON.stringify(n,null,"\t")}
|
|
9
|
+
`,patched:!0}}function i$(e,t){for(let[n,r]of Object.entries(t)){let s=n in e?e[n]:void 0;if(Array.isArray(r)){e[n]=rT(Array.isArray(s)?s:[],r);continue}if(ti(r)){if(ti(s))i$(s,r);else if(s===void 0)e[n]=structuredClone(r);continue}if(s===void 0)e[n]=r}}function rT(e,t){let n=[...e];for(let r of t){if(!tT(r)){if(!n.some((a)=>JSON.stringify(a)===JSON.stringify(r)))n.push(structuredClone(r));continue}let s=n.findIndex((i)=>ti(i)&&i.binding===r.binding),o=n[s];if(ti(o))n[s]={...o,...r};else n.push(structuredClone(r))}return n}var a$=()=>{};function f$(e){if(!k(e))return null;let[t,...n]=e.split(";"),r=(t??"").indexOf("/");if(r===-1)return null;let s=(t??"").slice(0,r).trim().toLowerCase(),o=(t??"").slice(r+1).trim().toLowerCase();if(!l$.test(s)||!l$.test(o))return null;let i=o.lastIndexOf("+"),a=i===-1?null:o.slice(i+1),l=i===-1?o:o.slice(0,i);if(a==="")return null;let c=l.indexOf("."),u=c===-1?null:l.slice(0,c),d=u!==null&&sT.has(u)?u:null,p=d===null?l:l.slice(d.length+1);if(p==="")return null;let m={};for(let y of n){let S=y.indexOf("=");if(S===-1)return null;let g=y.slice(0,S).trim().toLowerCase(),x=y.slice(S+1).trim();if(g==="")return null;if(x.startsWith('"')&&x.endsWith('"')&&x.length>=2)x=x.slice(1,-1);m[g]=x}return{parameters:m,subtype:p,suffix:a,tree:d,type:s}}function d$(e){if(!k(e)||e.trim()==="")return"expected a media type string";if(!e.includes("/"))return`"${e}" has no "/" — a media type is type/subtype (RFC 6838 §4.2)`;if(f$(e)===null)return`"${e}" is not a well-formed media type (RFC 6838 §4.2)`;return null}function p$(e){let t=f$(e);if(t===null)return null;let n=t.tree===null?"":`${t.tree}.`,r=t.suffix===null?"":`+${t.suffix}`;return`${t.type}/${n}${t.subtype}${r}`}var l$,sT,c$="text/markdown; variant=GFM",u$="application/yaml",m$;var bp=J(()=>{ce();l$=/^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}$/,sT=new Set(["vnd","prs","x"]);m$={".jxn":"text/plain; charset=utf-8",".markdown":`${c$}; charset=utf-8`,".md":`${c$}; charset=utf-8`,".yaml":`${u$}; charset=utf-8`,".yml":`${u$}; charset=utf-8`}});class h${index;text;constructor(e){this.text=e,this.index=e.codePointAt(0)===65279?1:0}get done(){return this.index>=this.text.length}startsWith(e){return this.text.startsWith(e,this.index)}skipLine(){let e=this.text.indexOf(`
|
|
10
10
|
`,this.index);this.index=e===-1?this.text.length:e}skipBlock(){let e=1;this.index+=2;while(!this.done&&e>0)if(this.startsWith("/*"))e+=1,this.index+=2;else if(this.startsWith("*/"))e-=1,this.index+=2;else this.index+=1}skipTrivia(){for(;;){while(!this.done&&/[\s;]/u.test(this.text.charAt(this.index)))this.index+=1;if(this.startsWith("//"))this.skipLine();else if(this.startsWith("/*"))this.skipBlock();else if(this.startsWith("/-"))this.index+=2,this.skipNode();else return}}skipString(){let e=0,t=this.index;while(this.text.charAt(t)==="#")e+=1,t+=1;let n=this.text.startsWith('"""',t),r=n?'"""':'"',s=r+"#".repeat(e);t+=r.length;while(t<this.text.length)if(e===0&&this.text.charAt(t)==="\\")t+=2;else if(this.text.startsWith(s,t))return this.index=t+s.length,!0;else if(!n&&this.text.charAt(t)===`
|
|
11
11
|
`)return!1;else t+=1;return!1}skipNode(){let e=0;while(!this.done){let t=this.text.charAt(this.index);if(t==='"'||t==="#"&&/^#+"/u.test(this.text.slice(this.index,this.index+16))){if(!this.skipString())return!1}else if(this.startsWith("//"))this.skipLine();else if(this.startsWith("/*"))this.skipBlock();else if(t==="{")e+=1,this.index+=1;else if(t==="}"){if(e===0)return!1;e-=1,this.index+=1}else if((t===`
|
|
12
|
-
`||t===";")&&e===0)return this.index+=1,!0;else this.index+=1}return e===0}}function zo(e){if(RR.test(e))return"unreadable";let t=new my(e);for(;;){if(t.skipTrivia(),t.done)return"document";if(t.startsWith("(")){let n=e.indexOf(")",t.index);if(n===-1)return"unreadable";t.index=n+1}else{let[n]=CR.exec(e.slice(t.index,t.index+256))??[];if(!n)return t.startsWith('"')||t.startsWith("#")?"document":"unreadable";if(!n.startsWith("$"))return n==="project"?"project":"document";if(t.index+=n.length,!t.skipNode())return"unreadable"}}}var RR,CR;var Sa=T(()=>{RR=/\0/u,CR=/^[^\s\\/(){};[\]"#=]+/u});function ja(e){switch(e){case 9:case 32:case 160:case 5760:case 8192:case 8193:case 8194:case 8195:case 8196:case 8197:case 8198:case 8199:case 8200:case 8201:case 8202:case 8239:case 8287:case 12288:return!0}return!1}function as(e){return e===13||e===10||e===133||e===11||e===12||e===8232||e===8233||!1}function Yc(e){return e<8||e>=14&&e<=25||e===127||e>=55296&&e<=57343||e>1114111||e===8206||e===8207||e>=8234&&e<=8238||e>=8294&&e<=8297||e===65279}function ze(e){return!isNaN(e)&&!ja(e)&&!as(e)&&e!==61&&e!==92&&e!==47&&e!==40&&e!==41&&e!==123&&e!==125&&e!==59&&e!==91&&e!==93&&e!==34&&e!==35&&!0}function hy(e){return e>=65&&e<91||e>=97&&e<123||!1}function od(e){return e>=48&&e<64||e>=65&&e<71||e>=97&&e<103||!1}function id(e){return od(e)||e===95}function Fr(e){return e>=48&&e<58}function io(e){return Fr(e)||e===95}function ad(e){return e>=48&&e<56}function gy(e){return ad(e)||e===95}function cd(e){return e===48||e===49}function yy(e){return cd(e)||e===95}function xy(e){return e===45||e===43}var ss=1,Ko=2,ro=3,Vc=4,qc=5,va=6,Wc=7,Hc=8,Ea=9,os=10,Ft=11,Go=12,Xo=13,Uc=14,Dr=15,Bc=16,zc=17,so=18,is=19,Kc=20,Gc=21,Xc=22,Yo=23,oo=24,ir=28;function*TR(e){for(let t of(NR??=new Intl.Segmenter("en")).segment(e))yield t.segment}function JR(e){return e[Symbol.iterator]()}function by(e,{flags:t,graphemeLocations:n=!1}){let r=n?TR(e):JR(e),s=r.next();return{text:e,graphemeLocations:n,line:1,column:1,offset:0,length:e.length,iterator:r,currentIter:s,current:s.done?NaN:s.value.codePointAt(0),start:{line:1,column:1,offset:0},errorsInToken:null,flags:t}}function*$y(e){if(Ae(e,65279))e.column=1,yield Se(e,Ko);if(Yc(e.current))throw ar(e,`Invalid character \\u${e.current.toString(16)}`)}function mt(e){e.offset+=e.currentIter.value.length,e.column++;let t=e.currentIter=e.iterator.next(),n=e.current=t.done?NaN:t.value.codePointAt(0);if(Yc(n))if(n>=55296&&n<=57343||n>1114111)Pa(e,`Invalid character \\u${n.toString(16)}`);else Pa(e,`Invalid character \\u${n.toString(16)}, this character is not allowed but can be included in strings as \\u{${n.toString(16)}}`);return n}function Hn(e,t){if(t(e.current)){let n=e.current;return mt(e),n}}function Ae(e,t){if(e.current===t)return mt(e),t}function Zo(e){if(!as(e.current))return!1;if(!e.graphemeLocations&&e.current===13&&e.text.codePointAt(e.offset+1)===10)e.iterator.next(),e.offset++;return mt(e),e.column=1,e.line++,!0}function ld(e,t){while(e.current===t)mt(e)}function Ve(e,t){while(t(e.current))mt(e)}function Se(e,t,n){let{line:r,column:s,offset:o}=e,i={line:r,column:s,offset:o},a=e.start;e.start=i;let c=e.errorsInToken;e.errorsInToken=null;let l={type:t,text:e.text.slice(a.offset,i.offset),start:a,end:i,errors:c};if(n){if(!l.errors)l.errors=[];l.errors.push(new Re(n,{token:l}))}return l}function ar(e,t){if(t instanceof Re)return t;let{line:n,column:r,offset:s}=e,o={line:n,column:r,offset:s},i;if(s<e.length)if(as(e.current))i={line:n+1,column:1,offset:s+1};else i={line:n,column:r+1,offset:s+1};return new Re(`${t}`,{start:o,end:i})}function Pa(e,t){(e.errorsInToken??=[]).push(ar(e,t))}var NR;var wy=T(()=>{ao()});function co(e){return(t)=>(mt(t),Se(t,e))}function _a(e){return Ve(e,ja),Se(e,so)}function lo(e){return Zo(e),Se(e,is)}function IR(e){mt(e);let t=!1,n=!1;if(Ae(e,34)){if(!Ae(e,34))return Se(e,Ea);if(n=!0,e.current===34)throw ar(e,"Multiline strings must start with exactly three quotes");while(!t&&e.offset<e.length)if(Ae(e,34)){if(Ae(e,34)&&Ae(e,34))t=!0}else Ae(e,92),Zo(e)||mt(e)}else while(!t&&e.offset<e.length)if(Ae(e,34))t=!0;else Ae(e,92),Zo(e)||mt(e);if(!t)throw ar(e,"Unexpected EOF inside string");return Se(e,n?Yo:Ea)}function Sy(e){if(mt(e),e.current===35||e.current===34){let t=1;while(Ae(e,35))t++;if(!Ae(e,34))throw ar(e,`Expected a quote after ${"#".repeat(t)}`);let n=!1;if(Ae(e,34))if(Ae(e,34)){if(e.current===34)throw ar(e,"Multiline strings must start with exactly three quotes");n=!0}else{let r=0;while(Ae(e,35))r++;if(r===t)return Se(e,os)}while(!0){if(e.offset>=e.length)throw ar(e,"Unexpected EOF while parsing raw string");if(Ae(e,34)){if(n){if(!Ae(e,34)||!Ae(e,34))continue}let r=0;while(r<t&&Ae(e,35))r++;if(r===t)return Se(e,n?oo:os)}else Zo(e)||mt(e)}}else{let t;if(e.current<255){let n=je[e.current];t=n(e)}else if(ja(e.current))t=_a(e);else if(as(e.current))t=lo(e);else t=fd(e);if(t.type!==Ft)(t.errors??=[]).push(new Re("Expected a valid identifier",{token:t}));return t.type=Xo,t}}function MR(e){if(mt(e),Hn(e,Fr))return Ve(e,ze),Se(e,Ft,"Invalid identifier, identifiers that start with a sign and a dot must be quoted if the next character is a digit to prevent confusion with decimal numbers");return Ve(e,ze),Se(e,Ft)}function DR(e){if(mt(e),Ae(e,45))return Se(e,ro);else if(Ae(e,47)){while(e.offset<e.length&&!as(e.current))mt(e);return Se(e,Gc)}else if(Ae(e,42)){let t=1;while(e.offset<e.length)if(Ae(e,42)){if(Ae(e,47)){if(t--,t===0)return Se(e,Xc)}}else if(Ae(e,47)){if(Ae(e,42))t++}else Zo(e)||mt(e);throw ar(e,"Unexpected EOF in multiline comment")}else Qc(e)}function vy(e){return mt(e),FR(e)}function FR(e){if(Fr(e.current))return Un(e);else if(Ae(e,46)){if(Hn(e,Fr))return Ve(e,ze),Se(e,Ft,"Invalid identifier or number, surround with quotes to make it an identifier or add a zero between the sign and the decimal point");return Ve(e,ze),Se(e,Ft)}else return Ve(e,ze),Se(e,Ft)}function ud(e,t,n,r){return(s)=>{let o=mt(s);if(Hn(s,n))return Ve(s,r),Se(s,t);else if(!s.flags.experimentalSuffixedNumbers){if(Ae(s,95)){if(Ve(s,r),!ze(s.current))return Se(s,t,`Invalid ${e} number, the first character after 0${String.fromCodePoint(o)} cannot be an underscore`)}return Ve(s,ze),Se(s,Ft,`Invalid ${e} number`)}else if(Ae(s,95)){if(ld(s,95),n(s.current)){if(Ve(s,r),!ze(s.current))return Se(s,t,`Invalid ${e} number, the first character after 0${String.fromCodePoint(o)} cannot be an underscore`)}return Ve(s,ze),Se(s,Ft,"Invalid number with suffix, a suffix cannot start with a letter followed by an underscore")}else if(Fr(s.current))return Se(s,Ft,"Invalid number with suffix, a suffix cannot start with a letter followed by a number");else return Ve(s,ze),Se(s,ir)}}function Un(e){if(Ae(e,48)){let t=Zc[e.current];if(t)return t(e)}if(Ve(e,io),Ae(e,46)){if(!Hn(e,Fr))if(e.current===95)Pa(e,"Invalid decimal number, the part after the decimal point mustn't start on an underscore");else Pa(e,"Invalid decimal number, a decimal point must be followed by a digit");Ve(e,io)}if(Ae(e,101)||Ae(e,69))if(Hn(e,xy),Hn(e,Fr)){if(Ve(e,io),ze(e.current))return Ve(e,ze),Se(e,Ft,"Invalid number with suffix, a number with an exponent cannot have a suffix");return Se(e,Dr)}else if(!e.flags.experimentalSuffixedNumbers)if(e.current===95)return Ve(e,io),Se(e,Dr,"Invalid decimal number, the number after the exponent mustn't start on an underscore");else return Ve(e,ze),Se(e,Dr,"Invalid decimal number, missing a number after the exponent");else if(Ae(e,95)){if(ld(e,95),Fr(e.current)){if(Ve(e,io),!ze(e.current))return Se(e,Dr,"Invalid decimal number, the number after the exponent mustn't start on an underscore")}return Ve(e,ze),Se(e,Ft,"Invalid number with suffix, a suffix cannot start with a letter followed by an underscore")}else return Ve(e,ze),Se(e,ir);else if(e.flags.experimentalSuffixedNumbers)if(e.current===88||e.current===120){mt(e);let t=null;if(Hn(e,id))t="Invalid number with suffix, a suffix cannot start with an x followed by a hexidecimal number";return Ve(e,ze),Se(e,ir,t)}else if(Hn(e,hy)){let t=null;if(Hn(e,io))t="Invalid number with suffix, a suffix cannot start with a letter followed by a digit";return Ve(e,ze),Se(e,ir,t)}else if(Ae(e,44))return Ve(e,ze),Se(e,ir,"Invalid number with suffix, a suffix cannot start with a comma");else if(Ae(e,46))return Ve(e,ze),Se(e,ir,"Invalid number with suffix, a suffix cannot start with a dot");else if(Hn(e,ze))return Ve(e,ze),Se(e,ir);else return Se(e,Dr);else return Se(e,Dr)}function LR(e){if(mt(e),e.current!=35)return Ve(e,ze),Se(e,Ft);let t=Sy(e);t.start.offset--,t.start.column--;let n;switch(t.type){case os:case oo:n='Invalid raw string, the correct syntax is #" "#, not r#" "#';break;default:n="Invalid token, did you forget a whitespace after this r?"}return(t.errors??=[]).push(new Re(n,{token:t})),t}function fd(e){return mt(e),Ve(e,ze),Se(e,Ft)}function Qc(e){throw ar(e,`Unexpected character ${JSON.stringify(String.fromCodePoint(e.current))}, did you forget to quote an identifier?`)}function*ka(e,t){let n=by(e,t);yield*$y(n);while(!n.currentIter.done){if(n.current<255){let r=je[n.current];yield r(n);continue}if(ja(n.current)){yield _a(n);continue}if(as(n.current)){yield lo(n);continue}yield fd(n)}yield Se(n,ss)}var Zc,je;var Ey=T(()=>{ao();wy();Zc=Array(256).fill(null);Zc[98]=ud("binary",zc,cd,yy);Zc[111]=ud("octal",Bc,ad,gy);Zc[120]=ud("hexadecimal",Uc,od,id);je=Array(255);je.fill(fd);for(let e=0;e<32;e++)je[e]=Qc;je[9]=_a;je[10]=lo;je[11]=lo;je[12]=lo;je[13]=lo;je[32]=_a;je[34]=IR;je[35]=Sy;je[40]=co(Vc);je[41]=co(va);je[43]=vy;je[45]=vy;je[46]=MR;je[47]=DR;je[48]=Un;je[49]=Un;je[50]=Un;je[51]=Un;je[52]=Un;je[53]=Un;je[54]=Un;je[55]=Un;je[56]=Un;je[57]=Un;je[59]=co(Hc);je[61]=co(Go);je[91]=Qc;je[92]=co(Kc);je[93]=Qc;je[114]=LR;je[123]=co(qc);je[125]=co(Wc);je[133]=lo;je[160]=_a});var Qo=T(()=>{Ey()});var Re;var ao=T(()=>{Qo();Re=class Re extends Error{name="InvalidKdlError";start;end;token;errors;constructor(e,{token:t,start:n=t?.start,end:r=t?.end,errors:s,...o}={}){if(t?.type===ss)e=`${e} at end of input`;else if(n)e=`${e} at ${n.line}:${n.column}`;super(e,o);this.token=t,this.start=n,this.end=r,this.errors=s}*flat(){if(this.errors==null){yield this;return}for(let e of this.errors)yield*e.flat()}}});function ei(e){return jy.get(e)}function Py(e,{start:t},{end:n}){jy.set(e,{start:t,end:n})}var jy;var dd=T(()=>{jy=new WeakMap});function _y({experimentalSuffixedNumbers:e=!1}={}){return{experimentalSuffixedNumbers:e}}class Bn{type="identifier";static type="identifier";representation;constructor(e){this.name=e}getName(){return this.name}setName(e){if(e!==this.name)this.name=e,this.representation=void 0}clone(){let e=new Bn(this.name);return e.representation=this.representation,e}}class cr{type="tag";static type="tag";representation;leading;trailing;suffix;constructor(e){this.name,Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!1,value:e})}getName(){return this.name}setName(e){if(e!==this.name)this.name=e,this.representation=void 0}clone(){let e=new cr(this.name);return e.representation=this.representation,e.leading=this.leading,e.trailing=this.trailing,e.suffix=this.suffix,e}}class zn{type="value";static type="value";representation;tag=null;betweenTagAndValue;constructor(e){this.value=e}clone(){let e=new zn(this.value);return e.tag=this.tag?.clone()??null,e.betweenTagAndValue=this.betweenTagAndValue,e.representation=this.representation,e}getValue(){return this.value}setValue(e){if(e!==this.value)this.value=e,this.representation=void 0}getTag(){return this.tag?this.tag.name:null}setTag(e){if(e==null)this.tag=null;else if(this.tag!=null)this.tag.setName(e);else this.tag=new cr(e)}}var pd=()=>{};class xn{static createArgument(e){return new xn(new zn(e),null)}static createProperty(e,t){return new xn(new zn(t),new Bn(e))}type="entry";static type="entry";name;value;leading;trailing;equals;constructor(e,t){this.value=e,this.name=t}clone(){let e=new xn(this.value.clone(),this.name?.clone()??null);return e.leading=this.leading,e.trailing=this.trailing,e.equals=this.equals,e}getTag(){return this.value.getTag()}setTag(e){this.value.setTag(e)}getName(){return this.name?this.name.name:null}setName(e){this.name=e!=null?new Bn(e):null}getValue(){return this.value.value}setValue(e){this.value=new zn(e)}isArgument(){return this.name==null}isProperty(){return this.name!=null}}var md=T(()=>{pd()});function*ti(e){for(let t=e.length-1;t>=0;t--)yield e[t]}function hd(e){return e.children??(e.children=new cs)}class ni{static create(e){return new ni(new Bn(e))}type="node";static type="node";name;tag=null;entries;children;leading;trailing;beforeChildren;betweenTagAndName;constructor(e,t=[],n=null){this.name=e,this.entries=t,this.children=n}clone({shallow:e=!1}={}){let t=new ni(this.name.clone(),e?[]:this.entries.map((n)=>n.clone()),this.children?.clone({shallow:e}));if(this.tag)t.tag=this.tag.clone();return t.leading=this.leading,t.betweenTagAndName=this.betweenTagAndName,t.beforeChildren=this.beforeChildren,t.trailing=this.trailing,t}getTag(){return this.tag?this.tag.name:null}setTag(e){this.tag=e!=null?new cr(e):null}getName(){return this.name.name}setName(e){this.name.setName(e)}hasArguments(){return this.entries.some((e)=>e.isArgument())}getArguments(){return this.getArgumentEntries().map((e)=>e.getValue())}getArgumentEntries(){return this.entries.filter((e)=>e.isArgument())}hasArgument(e){return this.getArgumentEntry(e)!=null}getArgument(e){return this.getArgumentEntry(e)?.getValue()}getArgumentEntry(e){for(let t of this.entries){if(!t.isArgument())continue;if(e===0)return t;e--}}addArgument(e,t,n){let r=xn.createArgument(e);if(r.value.setTag(t),n!=null)for(let[s,o]of this.entries.entries()){if(!o.isArgument())continue;if(n===0){this.entries.splice(s,0,o);return}n--}this.entries.push(r)}removeArgument(e){for(let[t,n]of this.entries.entries()){if(!n.isArgument())continue;if(e===0){this.entries.splice(t,1);return}e--}}hasProperties(){return this.entries.some((e)=>e.isProperty())}getProperties(){return new Map(this.getPropertyEntries().map((e)=>[e.getName(),e.getValue()]))}getPropertyEntries(){return this.entries.filter((e)=>e.isProperty())}getPropertyEntryMap(){return new Map(this.getPropertyEntries().map((e)=>[e.getName(),e]))}hasProperty(e){return this.getPropertyEntry(e)!=null}getProperty(e){return this.getPropertyEntry(e)?.getValue()}getPropertyEntry(e){for(let t of ti(this.entries))if(t.getName()===e)return t;return}setProperty(e,t,n){for(let s of ti(this.entries))if(s.getName()===e){s.setValue(t),s.value.setTag(n);return}let r=xn.createProperty(e,t);r.value.setTag(n),this.entries.push(r)}deleteProperty(e){this.entries=this.entries.filter((t)=>t.getName()!==e)}hasChildren(){return this.children!=null&&!this.children.isEmpty()}appendNode(e){hd(this).appendNode(e)}insertNodeBefore(e,t){hd(this).insertNodeBefore(e,t)}insertNodeAfter(e,t){hd(this).insertNodeAfter(e,t)}removeNode(e){if(this.children==null)throw Error("Node to remove is not in document");this.children.removeNode(e)}replaceNode(e,t){if(this.children==null)throw Error("Node to remove is not in document");this.children.replaceNode(e,t)}findNodesByName(e){return this.children!=null?this.children.findNodesByName(e):[]}findNodeByName(e){return this.children?.findNodeByName(e)}findParameterizedNode(e,t){return this.children?.findParameterizedNode(e,t)}removeNodesByName(e){this.children?.removeNodesByName(e)}}var ky=T(()=>{gd();md()});function*ri(e){if(e instanceof cs)yield*e.nodes;else yield e}class cs{type="document";static type="document";nodes;trailing;constructor(e=[]){this.nodes=e}clone({shallow:e}={}){let t=new cs(e?[]:this.nodes.map((n)=>n.clone()));return t.trailing=this.trailing,t}appendNode(e){this.nodes.push(...ri(e))}insertNodeBefore(e,t){if(t==null){this.nodes.push(...ri(e));return}let n=this.nodes.indexOf(t);if(n===-1)throw Error("Reference node is not in document");this.nodes.splice(n,0,...ri(e))}insertNodeAfter(e,t){if(t==null){this.nodes.unshift(...ri(e));return}let n=this.nodes.indexOf(t);if(n===-1)throw Error("Reference node is not in document");this.nodes.splice(n+1,0,...ri(e))}removeNode(e){let t=this.nodes.indexOf(e);if(t===-1)throw Error("Node to remove is not in document");this.nodes.splice(t,1)}replaceNode(e,t){let n=this.nodes.indexOf(e);if(n===-1)throw Error("Node to replace is not in document");this.nodes.splice(n,1,...ri(t))}findNodesByName(e){return this.nodes.filter((t)=>t.name.name===e)}findNodeByName(e){for(let t of ti(this.nodes))if(t.name.name===e)return t;return}findParameterizedNode(e,t){for(let n of ti(this.nodes)){if(n.name.name!==e)continue;let r=n.getArguments();if(r.length!==1||t!==void 0&&r[0]!==t)continue;return n}return}removeNodesByName(e){this.nodes=this.nodes.filter((t)=>t.name.name!==e)}isEmpty(){return this.nodes.length===0}}var gd=()=>{};var Oy=T(()=>{gd();md();ky();pd()});function Ay(e,t,n){let r;while(r=qR.exec(t)){let s=Oa(n,t,r.index);e.push(new Re("Raw strings with single quotes cannot contain any unescaped newlines, use triple-quotes for multiline strings",{token:n,start:s,end:{offset:s.offset+r[0].length,line:s.line+1,column:1}}))}return t}function Ry(e,t,n){if(!si.test(t))return e.push(new Re("Raw strings with three quotes must be multiline strings",{token:n})),t;if(!si.test(t[0]))return e.push(new Re("Multi-line strings must start with a newline",{token:n})),t;let r=UR.exec(t)?.[1];if(r==null)return e.push(new Re("The final line in a multiline string may only contain whitespace",{token:n})),t;return t.replace(zR,(s,o,i,a,c)=>{if(!a)return`
|
|
13
|
-
`;if(!i.startsWith(r)){let
|
|
12
|
+
`||t===";")&&e===0)return this.index+=1,!0;else this.index+=1}return e===0}}function ni(e){if(oT.test(e))return"unreadable";let t=new h$(e);for(;;){if(t.skipTrivia(),t.done)return"document";if(t.startsWith("(")){let n=e.indexOf(")",t.index);if(n===-1)return"unreadable";t.index=n+1}else{let[n]=iT.exec(e.slice(t.index,t.index+256))??[];if(!n)return t.startsWith('"')||t.startsWith("#")?"document":"unreadable";if(!n.startsWith("$"))return n==="project"?"project":"document";if(t.index+=n.length,!t.skipNode())return"unreadable"}}}var oT,iT;var Ta=J(()=>{oT=/\0/u,iT=/^[^\s\\/(){};[\]"#=]+/u});function Ia(e){switch(e){case 9:case 32:case 160:case 5760:case 8192:case 8193:case 8194:case 8195:case 8196:case 8197:case 8198:case 8199:case 8200:case 8201:case 8202:case 8239:case 8287:case 12288:return!0}return!1}function Es(e){return e===13||e===10||e===133||e===11||e===12||e===8232||e===8233||!1}function Dc(e){return e<8||e>=14&&e<=25||e===127||e>=55296&&e<=57343||e>1114111||e===8206||e===8207||e>=8234&&e<=8238||e>=8294&&e<=8297||e===65279}function Qe(e){return!isNaN(e)&&!Ia(e)&&!Es(e)&&e!==61&&e!==92&&e!==47&&e!==40&&e!==41&&e!==123&&e!==125&&e!==59&&e!==91&&e!==93&&e!==34&&e!==35&&!0}function g$(e){return e>=65&&e<91||e>=97&&e<123||!1}function $p(e){return e>=48&&e<58||e>=65&&e<71||e>=97&&e<103||!1}function Sp(e){return $p(e)||e===95}function es(e){return e>=48&&e<58}function xo(e){return es(e)||e===95}function wp(e){return e>=48&&e<56}function y$(e){return wp(e)||e===95}function vp(e){return e===48||e===49}function x$(e){return vp(e)||e===95}function b$(e){return e===45||e===43}var Ss=1,ri=2,ho=3,kc=4,Oc=5,Ja=6,Ac=7,Cc=8,Ma=9,ws=10,zt=11,si=12,oi=13,Rc=14,Qr=15,Nc=16,Tc=17,go=18,vs=19,Jc=20,Mc=21,Ic=22,ii=23,yo=24,Er=28;function*lT(e){for(let t of(aT??=new Intl.Segmenter("en")).segment(e))yield t.segment}function cT(e){return e[Symbol.iterator]()}function $$(e,{flags:t,graphemeLocations:n=!1}){let r=n?lT(e):cT(e),s=r.next();return{text:e,graphemeLocations:n,line:1,column:1,offset:0,length:e.length,iterator:r,currentIter:s,current:s.done?NaN:s.value.codePointAt(0),start:{line:1,column:1,offset:0},errorsInToken:null,flags:t}}function*S$(e){if(Ae(e,65279))e.column=1,yield Ee(e,ri);if(Dc(e.current))throw jr(e,`Invalid character \\u${e.current.toString(16)}`)}function St(e){e.offset+=e.currentIter.value.length,e.column++;let t=e.currentIter=e.iterator.next(),n=e.current=t.done?NaN:t.value.codePointAt(0);if(Dc(n))if(n>=55296&&n<=57343||n>1114111)Da(e,`Invalid character \\u${n.toString(16)}`);else Da(e,`Invalid character \\u${n.toString(16)}, this character is not allowed but can be included in strings as \\u{${n.toString(16)}}`);return n}function sr(e,t){if(t(e.current)){let n=e.current;return St(e),n}}function Ae(e,t){if(e.current===t)return St(e),t}function ai(e){if(!Es(e.current))return!1;if(!e.graphemeLocations&&e.current===13&&e.text.codePointAt(e.offset+1)===10)e.iterator.next(),e.offset++;return St(e),e.column=1,e.line++,!0}function Ep(e,t){while(e.current===t)St(e)}function Be(e,t){while(t(e.current))St(e)}function Ee(e,t,n){let{line:r,column:s,offset:o}=e,i={line:r,column:s,offset:o},a=e.start;e.start=i;let l=e.errorsInToken;e.errorsInToken=null;let c={type:t,text:e.text.slice(a.offset,i.offset),start:a,end:i,errors:l};if(n){if(!c.errors)c.errors=[];c.errors.push(new Ce(n,{token:c}))}return c}function jr(e,t){if(t instanceof Ce)return t;let{line:n,column:r,offset:s}=e,o={line:n,column:r,offset:s},i;if(s<e.length)if(Es(e.current))i={line:n+1,column:1,offset:s+1};else i={line:n,column:r+1,offset:s+1};return new Ce(`${t}`,{start:o,end:i})}function Da(e,t){(e.errorsInToken??=[]).push(jr(e,t))}var aT;var w$=J(()=>{bo()});function $o(e){return(t)=>(St(t),Ee(t,e))}function La(e){return Be(e,Ia),Ee(e,go)}function So(e){return ai(e),Ee(e,vs)}function uT(e){St(e);let t=!1,n=!1;if(Ae(e,34)){if(!Ae(e,34))return Ee(e,Ma);if(n=!0,e.current===34)throw jr(e,"Multiline strings must start with exactly three quotes");while(!t&&e.offset<e.length)if(Ae(e,34)){if(Ae(e,34)&&Ae(e,34))t=!0}else Ae(e,92),ai(e)||St(e)}else while(!t&&e.offset<e.length)if(Ae(e,34))t=!0;else Ae(e,92),ai(e)||St(e);if(!t)throw jr(e,"Unexpected EOF inside string");return Ee(e,n?ii:Ma)}function v$(e){if(St(e),e.current===35||e.current===34){let t=1;while(Ae(e,35))t++;if(!Ae(e,34))throw jr(e,`Expected a quote after ${"#".repeat(t)}`);let n=!1;if(Ae(e,34))if(Ae(e,34)){if(e.current===34)throw jr(e,"Multiline strings must start with exactly three quotes");n=!0}else{let r=0;while(Ae(e,35))r++;if(r===t)return Ee(e,ws)}while(!0){if(e.offset>=e.length)throw jr(e,"Unexpected EOF while parsing raw string");if(Ae(e,34)){if(n){if(!Ae(e,34)||!Ae(e,34))continue}let r=0;while(r<t&&Ae(e,35))r++;if(r===t)return Ee(e,n?yo:ws)}else ai(e)||St(e)}}else{let t;if(e.current<255){let n=Pe[e.current];t=n(e)}else if(Ia(e.current))t=La(e);else if(Es(e.current))t=So(e);else t=Pp(e);if(t.type!==zt)(t.errors??=[]).push(new Ce("Expected a valid identifier",{token:t}));return t.type=oi,t}}function fT(e){if(St(e),sr(e,es))return Be(e,Qe),Ee(e,zt,"Invalid identifier, identifiers that start with a sign and a dot must be quoted if the next character is a digit to prevent confusion with decimal numbers");return Be(e,Qe),Ee(e,zt)}function dT(e){if(St(e),Ae(e,45))return Ee(e,ho);else if(Ae(e,47)){while(e.offset<e.length&&!Es(e.current))St(e);return Ee(e,Mc)}else if(Ae(e,42)){let t=1;while(e.offset<e.length)if(Ae(e,42)){if(Ae(e,47)){if(t--,t===0)return Ee(e,Ic)}}else if(Ae(e,47)){if(Ae(e,42))t++}else ai(e)||St(e);throw jr(e,"Unexpected EOF in multiline comment")}else Fc(e)}function E$(e){return St(e),pT(e)}function pT(e){if(es(e.current))return or(e);else if(Ae(e,46)){if(sr(e,es))return Be(e,Qe),Ee(e,zt,"Invalid identifier or number, surround with quotes to make it an identifier or add a zero between the sign and the decimal point");return Be(e,Qe),Ee(e,zt)}else return Be(e,Qe),Ee(e,zt)}function jp(e,t,n,r){return(s)=>{let o=St(s);if(sr(s,n))return Be(s,r),Ee(s,t);else if(!s.flags.experimentalSuffixedNumbers){if(Ae(s,95)){if(Be(s,r),!Qe(s.current))return Ee(s,t,`Invalid ${e} number, the first character after 0${String.fromCodePoint(o)} cannot be an underscore`)}return Be(s,Qe),Ee(s,zt,`Invalid ${e} number`)}else if(Ae(s,95)){if(Ep(s,95),n(s.current)){if(Be(s,r),!Qe(s.current))return Ee(s,t,`Invalid ${e} number, the first character after 0${String.fromCodePoint(o)} cannot be an underscore`)}return Be(s,Qe),Ee(s,zt,"Invalid number with suffix, a suffix cannot start with a letter followed by an underscore")}else if(es(s.current))return Ee(s,zt,"Invalid number with suffix, a suffix cannot start with a letter followed by a number");else return Be(s,Qe),Ee(s,Er)}}function or(e){if(Ae(e,48)){let t=Lc[e.current];if(t)return t(e)}if(Be(e,xo),Ae(e,46)){if(!sr(e,es))if(e.current===95)Da(e,"Invalid decimal number, the part after the decimal point mustn't start on an underscore");else Da(e,"Invalid decimal number, a decimal point must be followed by a digit");Be(e,xo)}if(Ae(e,101)||Ae(e,69))if(sr(e,b$),sr(e,es)){if(Be(e,xo),Qe(e.current))return Be(e,Qe),Ee(e,zt,"Invalid number with suffix, a number with an exponent cannot have a suffix");return Ee(e,Qr)}else if(!e.flags.experimentalSuffixedNumbers)if(e.current===95)return Be(e,xo),Ee(e,Qr,"Invalid decimal number, the number after the exponent mustn't start on an underscore");else return Be(e,Qe),Ee(e,Qr,"Invalid decimal number, missing a number after the exponent");else if(Ae(e,95)){if(Ep(e,95),es(e.current)){if(Be(e,xo),!Qe(e.current))return Ee(e,Qr,"Invalid decimal number, the number after the exponent mustn't start on an underscore")}return Be(e,Qe),Ee(e,zt,"Invalid number with suffix, a suffix cannot start with a letter followed by an underscore")}else return Be(e,Qe),Ee(e,Er);else if(e.flags.experimentalSuffixedNumbers)if(e.current===88||e.current===120){St(e);let t=null;if(sr(e,Sp))t="Invalid number with suffix, a suffix cannot start with an x followed by a hexidecimal number";return Be(e,Qe),Ee(e,Er,t)}else if(sr(e,g$)){let t=null;if(sr(e,xo))t="Invalid number with suffix, a suffix cannot start with a letter followed by a digit";return Be(e,Qe),Ee(e,Er,t)}else if(Ae(e,44))return Be(e,Qe),Ee(e,Er,"Invalid number with suffix, a suffix cannot start with a comma");else if(Ae(e,46))return Be(e,Qe),Ee(e,Er,"Invalid number with suffix, a suffix cannot start with a dot");else if(sr(e,Qe))return Be(e,Qe),Ee(e,Er);else return Ee(e,Qr);else return Ee(e,Qr)}function mT(e){if(St(e),e.current!=35)return Be(e,Qe),Ee(e,zt);let t=v$(e);t.start.offset--,t.start.column--;let n;switch(t.type){case ws:case yo:n='Invalid raw string, the correct syntax is #" "#, not r#" "#';break;default:n="Invalid token, did you forget a whitespace after this r?"}return(t.errors??=[]).push(new Ce(n,{token:t})),t}function Pp(e){return St(e),Be(e,Qe),Ee(e,zt)}function Fc(e){throw jr(e,`Unexpected character ${JSON.stringify(String.fromCodePoint(e.current))}, did you forget to quote an identifier?`)}function*Fa(e,t){let n=$$(e,t);yield*S$(n);while(!n.currentIter.done){if(n.current<255){let r=Pe[n.current];yield r(n);continue}if(Ia(n.current)){yield La(n);continue}if(Es(n.current)){yield So(n);continue}yield Pp(n)}yield Ee(n,Ss)}var Lc,Pe;var j$=J(()=>{bo();w$();Lc=Array(256).fill(null);Lc[98]=jp("binary",Tc,vp,x$);Lc[111]=jp("octal",Nc,wp,y$);Lc[120]=jp("hexadecimal",Rc,$p,Sp);Pe=Array(255);Pe.fill(Pp);for(let e=0;e<32;e++)Pe[e]=Fc;Pe[9]=La;Pe[10]=So;Pe[11]=So;Pe[12]=So;Pe[13]=So;Pe[32]=La;Pe[34]=uT;Pe[35]=v$;Pe[40]=$o(kc);Pe[41]=$o(Ja);Pe[43]=E$;Pe[45]=E$;Pe[46]=fT;Pe[47]=dT;Pe[48]=or;Pe[49]=or;Pe[50]=or;Pe[51]=or;Pe[52]=or;Pe[53]=or;Pe[54]=or;Pe[55]=or;Pe[56]=or;Pe[57]=or;Pe[59]=$o(Cc);Pe[61]=$o(si);Pe[91]=Fc;Pe[92]=$o(Jc);Pe[93]=Fc;Pe[114]=mT;Pe[123]=$o(Oc);Pe[125]=$o(Ac);Pe[133]=So;Pe[160]=La});var li=J(()=>{j$()});var Ce;var bo=J(()=>{li();Ce=class Ce extends Error{name="InvalidKdlError";start;end;token;errors;constructor(e,{token:t,start:n=t?.start,end:r=t?.end,errors:s,...o}={}){if(t?.type===Ss)e=`${e} at end of input`;else if(n)e=`${e} at ${n.line}:${n.column}`;super(e,o);this.token=t,this.start=n,this.end=r,this.errors=s}*flat(){if(this.errors==null){yield this;return}for(let e of this.errors)yield*e.flat()}}});function ci(e){return P$.get(e)}function _$(e,{start:t},{end:n}){P$.set(e,{start:t,end:n})}var P$;var _p=J(()=>{P$=new WeakMap});function k$({experimentalSuffixedNumbers:e=!1}={}){return{experimentalSuffixedNumbers:e}}class ir{type="identifier";static type="identifier";representation;constructor(e){this.name=e}getName(){return this.name}setName(e){if(e!==this.name)this.name=e,this.representation=void 0}clone(){let e=new ir(this.name);return e.representation=this.representation,e}}class Pr{type="tag";static type="tag";representation;leading;trailing;suffix;constructor(e){this.name,Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!1,value:e})}getName(){return this.name}setName(e){if(e!==this.name)this.name=e,this.representation=void 0}clone(){let e=new Pr(this.name);return e.representation=this.representation,e.leading=this.leading,e.trailing=this.trailing,e.suffix=this.suffix,e}}class ar{type="value";static type="value";representation;tag=null;betweenTagAndValue;constructor(e){this.value=e}clone(){let e=new ar(this.value);return e.tag=this.tag?.clone()??null,e.betweenTagAndValue=this.betweenTagAndValue,e.representation=this.representation,e}getValue(){return this.value}setValue(e){if(e!==this.value)this.value=e,this.representation=void 0}getTag(){return this.tag?this.tag.name:null}setTag(e){if(e==null)this.tag=null;else if(this.tag!=null)this.tag.setName(e);else this.tag=new Pr(e)}}var kp=()=>{};class _n{static createArgument(e){return new _n(new ar(e),null)}static createProperty(e,t){return new _n(new ar(t),new ir(e))}type="entry";static type="entry";name;value;leading;trailing;equals;constructor(e,t){this.value=e,this.name=t}clone(){let e=new _n(this.value.clone(),this.name?.clone()??null);return e.leading=this.leading,e.trailing=this.trailing,e.equals=this.equals,e}getTag(){return this.value.getTag()}setTag(e){this.value.setTag(e)}getName(){return this.name?this.name.name:null}setName(e){this.name=e!=null?new ir(e):null}getValue(){return this.value.value}setValue(e){this.value=new ar(e)}isArgument(){return this.name==null}isProperty(){return this.name!=null}}var Op=J(()=>{kp()});function*ui(e){for(let t=e.length-1;t>=0;t--)yield e[t]}function Ap(e){return e.children??(e.children=new js)}class fi{static create(e){return new fi(new ir(e))}type="node";static type="node";name;tag=null;entries;children;leading;trailing;beforeChildren;betweenTagAndName;constructor(e,t=[],n=null){this.name=e,this.entries=t,this.children=n}clone({shallow:e=!1}={}){let t=new fi(this.name.clone(),e?[]:this.entries.map((n)=>n.clone()),this.children?.clone({shallow:e}));if(this.tag)t.tag=this.tag.clone();return t.leading=this.leading,t.betweenTagAndName=this.betweenTagAndName,t.beforeChildren=this.beforeChildren,t.trailing=this.trailing,t}getTag(){return this.tag?this.tag.name:null}setTag(e){this.tag=e!=null?new Pr(e):null}getName(){return this.name.name}setName(e){this.name.setName(e)}hasArguments(){return this.entries.some((e)=>e.isArgument())}getArguments(){return this.getArgumentEntries().map((e)=>e.getValue())}getArgumentEntries(){return this.entries.filter((e)=>e.isArgument())}hasArgument(e){return this.getArgumentEntry(e)!=null}getArgument(e){return this.getArgumentEntry(e)?.getValue()}getArgumentEntry(e){for(let t of this.entries){if(!t.isArgument())continue;if(e===0)return t;e--}}addArgument(e,t,n){let r=_n.createArgument(e);if(r.value.setTag(t),n!=null)for(let[s,o]of this.entries.entries()){if(!o.isArgument())continue;if(n===0){this.entries.splice(s,0,o);return}n--}this.entries.push(r)}removeArgument(e){for(let[t,n]of this.entries.entries()){if(!n.isArgument())continue;if(e===0){this.entries.splice(t,1);return}e--}}hasProperties(){return this.entries.some((e)=>e.isProperty())}getProperties(){return new Map(this.getPropertyEntries().map((e)=>[e.getName(),e.getValue()]))}getPropertyEntries(){return this.entries.filter((e)=>e.isProperty())}getPropertyEntryMap(){return new Map(this.getPropertyEntries().map((e)=>[e.getName(),e]))}hasProperty(e){return this.getPropertyEntry(e)!=null}getProperty(e){return this.getPropertyEntry(e)?.getValue()}getPropertyEntry(e){for(let t of ui(this.entries))if(t.getName()===e)return t;return}setProperty(e,t,n){for(let s of ui(this.entries))if(s.getName()===e){s.setValue(t),s.value.setTag(n);return}let r=_n.createProperty(e,t);r.value.setTag(n),this.entries.push(r)}deleteProperty(e){this.entries=this.entries.filter((t)=>t.getName()!==e)}hasChildren(){return this.children!=null&&!this.children.isEmpty()}appendNode(e){Ap(this).appendNode(e)}insertNodeBefore(e,t){Ap(this).insertNodeBefore(e,t)}insertNodeAfter(e,t){Ap(this).insertNodeAfter(e,t)}removeNode(e){if(this.children==null)throw Error("Node to remove is not in document");this.children.removeNode(e)}replaceNode(e,t){if(this.children==null)throw Error("Node to remove is not in document");this.children.replaceNode(e,t)}findNodesByName(e){return this.children!=null?this.children.findNodesByName(e):[]}findNodeByName(e){return this.children?.findNodeByName(e)}findParameterizedNode(e,t){return this.children?.findParameterizedNode(e,t)}removeNodesByName(e){this.children?.removeNodesByName(e)}}var O$=J(()=>{Cp();Op()});function*di(e){if(e instanceof js)yield*e.nodes;else yield e}class js{type="document";static type="document";nodes;trailing;constructor(e=[]){this.nodes=e}clone({shallow:e}={}){let t=new js(e?[]:this.nodes.map((n)=>n.clone()));return t.trailing=this.trailing,t}appendNode(e){this.nodes.push(...di(e))}insertNodeBefore(e,t){if(t==null){this.nodes.push(...di(e));return}let n=this.nodes.indexOf(t);if(n===-1)throw Error("Reference node is not in document");this.nodes.splice(n,0,...di(e))}insertNodeAfter(e,t){if(t==null){this.nodes.unshift(...di(e));return}let n=this.nodes.indexOf(t);if(n===-1)throw Error("Reference node is not in document");this.nodes.splice(n+1,0,...di(e))}removeNode(e){let t=this.nodes.indexOf(e);if(t===-1)throw Error("Node to remove is not in document");this.nodes.splice(t,1)}replaceNode(e,t){let n=this.nodes.indexOf(e);if(n===-1)throw Error("Node to replace is not in document");this.nodes.splice(n,1,...di(t))}findNodesByName(e){return this.nodes.filter((t)=>t.name.name===e)}findNodeByName(e){for(let t of ui(this.nodes))if(t.name.name===e)return t;return}findParameterizedNode(e,t){for(let n of ui(this.nodes)){if(n.name.name!==e)continue;let r=n.getArguments();if(r.length!==1||t!==void 0&&r[0]!==t)continue;return n}return}removeNodesByName(e){this.nodes=this.nodes.filter((t)=>t.name.name!==e)}isEmpty(){return this.nodes.length===0}}var Cp=()=>{};var A$=J(()=>{Cp();Op();O$();kp()});function C$(e,t,n){let r;while(r=gT.exec(t)){let s=Va(n,t,r.index);e.push(new Ce("Raw strings with single quotes cannot contain any unescaped newlines, use triple-quotes for multiline strings",{token:n,start:s,end:{offset:s.offset+r[0].length,line:s.line+1,column:1}}))}return t}function R$(e,t,n){if(!pi.test(t))return e.push(new Ce("Raw strings with three quotes must be multiline strings",{token:n})),t;if(!pi.test(t[0]))return e.push(new Ce("Multi-line strings must start with a newline",{token:n})),t;let r=bT.exec(t)?.[1];if(r==null)return e.push(new Ce("The final line in a multiline string may only contain whitespace",{token:n})),t;return t.replace(ST,(s,o,i,a,l)=>{if(!a)return`
|
|
13
|
+
`;if(!i.startsWith(r)){let c=Va(n,t,l+o.length);return e.push(new Ce("Every non-blank line of a multi-line string must start with the offset defined by the last line of the string",{token:n,start:c,end:{offset:c.offset+r.length,line:c.line,column:c.column+r.length}})),`
|
|
14
14
|
`}return`
|
|
15
|
-
`+i.slice(r.length)+a}).slice(1,-1)}function
|
|
16
|
-
`;if(!i.startsWith(r)){let p=
|
|
15
|
+
`+i.slice(r.length)+a}).slice(1,-1)}function N$(e,t,n){let r;while(r=xT.exec(t)){let s=Va(n,t,r.indices[1][0]);e.push(new Ce("Strings with single quotes cannot contain any unescaped newlines, use triple-quotes for multiline strings",{token:n,start:s,end:{offset:s.offset+r[1].length,line:s.line+1,column:1}}))}return t.replace(vT,(s,o,i,a,l)=>J$(e,t,n,s,o,i,a,l))}function T$(e,t,n){if(!yT.test(t))return e.push(new Ce("Strings with three quotes must be multiline strings",{token:n})),t;if(!pi.test(t[0]))return e.push(new Ce("Multi-line strings must start with a newline",{token:n})),t;let r=$T.exec(t)?.[1];if(r==null){let s=wT.exec(t),o=s?Va(n,t,s.index):void 0,i="The final line in a multiline string may only contain whitespace";if(s?.[0][0]==="\\")i+=" after removing escaped whitespace";return e.push(new Ce(i,{token:n,start:o,end:o&&{offset:o.offset,line:o.line,column:o.column+1}})),t}return t.replace(ET,(s,o,i,a,l,c,u)=>{if(!o)return J$(e,t,n,s,a,l,c,u);let d=t[u+o.length+(i?i.length:0)];if(pi.test(d))return`
|
|
16
|
+
`;if(!i.startsWith(r)){let p=Va(n,t,u+o.length);return e.push(new Ce("Every non-blank line of a multi-line string must start with the offset defined by the last line of the string",{token:n,start:p,end:{offset:p.offset+r.length,line:p.line,column:p.column+r.length}})),`
|
|
17
17
|
`}return`
|
|
18
|
-
`+i.slice(r.length)}).slice(1,-1)}function
|
|
19
|
-
`],["\\r","\r"],["\\t","\t"],["\\\\","\\"],["\\\"",'"'],["\\b","\b"],["\\f","\f"],["\\s"," "]]),si=/\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029]/,qR=/\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029]/g,WR=/(?:^|[^\\\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000\x0A\x0B\x0C\x0D\x85\u2028\u2029])(?:\\\\)*[\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000\x0A\x0B\x0C\x0D\x85\u2028\u2029]*(\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029])/s,HR=/(?:^|[^\\\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000\x0A\x0B\x0C\x0D\x85\u2028\u2029])(?:\\\\)*[\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000\x0A\x0B\x0C\x0D\x85\u2028\u2029]*(\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029])/dgs;UR=/[\x0A\x0B\x0C\x0D\x85\u2028\u2029]([\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)$/,BR=/(?:^|[^\\\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000])(?:\\\\)*[\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*[\x0A\x0B\x0C\x0D\x85\u2028\u2029]([\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)(?:\\[\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)*$/,zR=/(\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029])([\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)([^\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]?)/g,KR=/([^\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000])[\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*$/;GR=/\\(?:$|u\{(0[0-9a-fA-F]{0,5}|10[0-9a-fA-F]{4}|[1-9a-fA-F][0-9a-fA-F]{0,4})\}|u(\{[^}]{1,6}\}?|[0-9a-fA-F]{1,5}|10[0-9a-fA-F]{4})|([\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]+)|.)/g;XR=/(\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029])([\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)|\\(?:$|u\{(0[0-9a-fA-F]{0,5}|10[0-9a-fA-F]{4}|[1-9a-fA-F][0-9a-fA-F]{0,4})\}|u(\{[^}]{1,6}\}?|[0-9a-fA-F]{1,5}|10[0-9a-fA-F]{4})|([\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]+)|.)/g});function Lr(e){if(!e.current.done)e.lastToken=e.current.value;e.current=e.tokens.next();let t=!e.current.done&&e.current.value.errors;if(t)e.errors.push(...t)}function qe(e,t){if(!e.current.done&&e.current.value.type===t){let n=e.current.value;return Lr(e),n}}function Pe(e,t){let n="current"in e?e.current.value??e.lastToken:e;return new Re(t,{token:n})}function rn(e,t,n,r=n){if(e.storeLocations)Py(t,n,r)}function Lt(e="",t="",n=""){return e+t+n||void 0}function nl(e,t,{storeLocations:n=!1,flags:r}){let s={type:-1,text:"",start:{offset:0,line:1,column:1},end:{offset:0,line:1,column:1},errors:null},o={text:e,tokens:t[Symbol.iterator](),current:{done:!1,value:s},storeLocations:n,lastToken:s,errors:[],flags:r};return Lr(o),o}function xd(e,t){if(!t&&!e.current.done&&e.current.value.type!==ss)t=Pe(e,`Unexpected token ${JSON.stringify(e.current.value.text)}, did you forget to quote an identifier?`);let n=e.errors??[];if(t!=null)if(t instanceof Re)if(t.errors)n.push(...t.errors);else n.push(t);else n.push(new Re(`An unexpected error occurred, ${String(t)}, this is likely a bug in the KDL parser`,{cause:t}));if(n.length)if(n.length===1)throw n[0];else throw new Re("Encountered multiple errors",{errors:n})}function el(e){switch(e){case"#null":return null;case"#true":return!0;case"#false":return!1;case"#inf":return 1/0;case"#-inf":return-1/0;case"#nan":return NaN}}function Iy(e){return e==="inf"||e==="-inf"||e==="nan"||e==="true"||e==="false"||e==="null"||!1}function bd(e){let{value:t}=e.current,n,r,s,o,i,a=!1;if(t?.text[0]==="-"||t?.text[0]==="+")i=t.text[0];switch(t?.type){case ir:{if(!e.flags.experimentalSuffixedNumbers)throw new Re("Unreachable code: got a suffixed number from the tokenizer but the suffixed number flag is not set",{token:t});let u=i?t.text.slice(1):t.text,d=u.search(/[^0-9._]/);if(r=(i??"")+u.slice(0,d),n=Number.parseFloat(r.replaceAll("_","")),o=s=u.slice(d),Iy(s))e.errors.push(Pe(e,`Invalid suffix ${s}, values that look like keywords cannot be used as suffix`))}break;case zc:a=!0,n=(i==="-"?-1:1)*Number.parseInt(t.text.slice(i?3:2).replaceAll("_",""),2);break;case Bc:a=!0,n=(i==="-"?-1:1)*Number.parseInt(t.text.slice(i?3:2).replaceAll("_",""),8);break;case Dr:a=!0,n=Number.parseFloat(t.text.replaceAll("_",""));break;case Uc:a=!0,n=(i==="-"?-1:1)*Number.parseInt(t.text.slice(i?3:2).replaceAll("_",""),16);break;case Xo:if(n=el(t.text),n===void 0)if(n=null,el(t.text.toLowerCase())!==void 0)e.errors.push(Pe(e,`Invalid keyword ${t.text}, keywords are case sensitive, write ${t.text.toLowerCase()} instead`));else switch(t.text.toLowerCase()){case"#nul":case"#nill":e.errors.push(Pe(e,`Invalid keyword ${t.text}, did you mean #null?`));break;case"#fals":case"#fasle":e.errors.push(Pe(e,`Invalid keyword ${t.text}, did you mean #false?`));break;case"#ture":case"#treu":e.errors.push(Pe(e,`Invalid keyword ${t.text}, did you mean #true?`));break;case"#ifn":e.errors.push(Pe(e,`Invalid keyword ${t.text}, did you mean #inf?`));break;case"#-ifn":e.errors.push(Pe(e,`Invalid keyword ${t.text}, did you mean #-inf?`));break;default:e.errors.push(Pe(e,`Invalid keyword ${t.text}, surround it with quotes to use a string`))}break;default:return}Lr(e);let c=e.flags.experimentalSuffixedNumbers&&qe(e,Xo);if(c)if(a){if(o=c.text,el(o)!==void 0)e.errors.push(Pe(c,`Invalid number suffix ${o}, did you forget a space between the number and the keyword?`));s=o.slice(1)}else if(s)e.errors.push(Pe(c,"Unexpected hashed suffix, a number can only have one suffix"));else if(typeof n==="number")e.errors.push(Pe(c,"Unexpected hashed suffix, you cannot place suffixes on number keywords"));else e.errors.push(Pe(c,"Unexpected hashed suffix, you can only place suffixes on numbers"));let l=new zn(n);if(l.representation=r??t.text,rn(e,l,t),s){let u=new cr(s);u.representation=o,u.suffix=!0,rn(e,u,e.lastToken),l.tag=u}return l}function Aa(e){if(e.current.done)return;let{value:t}=e.current,n;switch(t.type){case Ft:if(Lr(e),Iy(t.text))e.errors.push(Pe(e,`Invalid keyword "${t.text}", add a leading # to use the keyword or surround with quotes to make it a string`));n=[t.text,t.text,t];break;case Ea:Lr(e),n=[Cy(e.errors,t.text.slice(1,-1),t),t.text,t];break;case Yo:Lr(e),n=[Ny(e.errors,t.text.slice(3,-3),t),t.text,t];break;case os:{Lr(e);let r=t.text,s=r.indexOf('"');n=[Ay(e.errors,r.slice(s+1,-(s+1)),t),r,t];break}case oo:{Lr(e);let r=t.text,s=r.indexOf('"');n=[Ry(e.errors,r.slice(s+3,-(s+3)),t),r,t];break}default:return}if(qe(e,Xo))e.errors.push(Pe(e.lastToken,el(e.lastToken.text)===void 0?"Unexpected hashed suffix on a string, you can only place suffixes on numbers":"Unexpected keyword, did you forget to add whitespace?"));return n}function $d(e){let t=Aa(e);if(!t)return;let n=new Bn(t[0]);return n.representation=t[1],rn(e,n,t[2],e.lastToken),n}function tl(e){let t=bd(e);if(t)return t;let n=Aa(e);if(!n)return;let r=new zn(n[0]);return r.representation=n[1],rn(e,r,n[2],e.lastToken),r}function Ra(e){let t=qe(e,Gc);if(!t)return;let{value:n}=e.current;return Lr(e),t.text+(n?.text??"")}function rl(e){return qe(e,Xc)?.text}function wd(e){return qe(e,so)??rl(e)}function sl(e){let t=qe(e,Kc);if(!t)return;while(wd(e));if(!Ra(e)&&!qe(e,is)&&!qe(e,ss))e.errors.push(Pe(e,`Expected newline or single-line comment after backslash but got ${e.current.value?.text??"EOF"}`));return e.text.slice(t.start.offset,e.lastToken.end.offset)}function ls(e){let t=e.lastToken.end;while(qe(e,is)?.text??Ra(e)??wd(e)??sl(e));if(e.lastToken.end===t)return;return e.text.slice(t.offset,e.lastToken.end.offset)}function xt(e){let t=e.lastToken.end;while(wd(e)??sl(e));if(e.lastToken.end===t)return;return e.text.slice(t.offset,e.lastToken.end.offset)}function yd(e){let t=qe(e,Vc);if(!t)return;let n=xt(e),r=Aa(e);if(!r&&e.current.value){let a=e.current.value;if(ls(e))e.errors.push(Pe(a,"This type of whitespace is not allowed inside a tag"));r=Aa(e)}if(!r){if(bd(e))e.errors.push(Pe(e,"Invalid tag, did you forget to quote a string?")),r=["error","error"]}if(!r)throw Pe(e,"Invalid tag, did you forget to quote a string?");let s=xt(e),o=qe(e,va);if(!o&&e.current.value){let a=e.current.value;if(ls(e))e.errors.push(Pe(a,"This type of whitespace is not allowed inside a tag"));o=qe(e,va)}if(!o)throw Pe(e,"Invalid tag, did you forget to quote a string?");let i=new cr(r[0]);return i.representation=r[1],i.leading=n,i.trailing=s,rn(e,i,t,e.lastToken),i}function ol(e){return Ra(e)??qe(e,is)?.text??qe(e,Hc)?.text??qe(e,ss)?.text}function Sd(e){if(!qe(e,qc))return;let t=Ly(e);if(!qe(e,Wc))throw Pe(e,"Invalid node children");return t}function oi(e){let t=e.current.value;{let d=yd(e);if(d){let p=xt(e),m=tl(e);if(!m)throw Pe(e,"Invalid argument");if(m.tag)e.errors.push(Pe(e.lastToken,"A number suffix cannot be combined with a regular tag"));m.tag=d,m.betweenTagAndValue=p;let x=new xn(m,null);rn(e,m,t,e.lastToken),rn(e,x,t,e.lastToken);let h=xt(e);if(qe(e,Go))e.errors.push(Pe(e.lastToken,typeof m.value==="string"?"Unexpected equals sign, properties are name=(tag)value not (tag)name=value":"Unexpected equals sign")),h=Lt(h,xt(e))||" ";return[x,h]}}{let d=bd(e);if(d){let p=new xn(d,null);rn(e,p,t,e.lastToken);let m=xt(e);if(qe(e,Go))e.errors.push(Pe(e.lastToken,"Unexpected equals sign, did you forget to quote the property name?")),m=Lt(m,xt(e))||" ";return[p,m]}}let n=Aa(e);if(!n)return;let r=xt(e),s=qe(e,Go);if(!s){let d=new zn(n[0]);d.representation=n[1],rn(e,d,n[2]);let p=new xn(d,null);return rn(e,p,t,e.lastToken),[p,r]}let o=new Bn(n[0]);o.representation=n[1],rn(e,o,n[2]);let i=xt(e),a=yd(e),c=a&&xt(e),l=tl(e);if(!l)throw Pe(e,"Expected a value");if(a){if(l.tag)e.errors.push(Pe(e.lastToken,"A number suffix cannot be combined with a regular tag"));l.tag=a,l.betweenTagAndValue=c}let u=new xn(l,o);return rn(e,u,t,e.lastToken),u.equals=Lt(r,s.text,i),[u,void 0]}function My(e){let t=xt(e)??"",n;while(n=uo(e)){let i=e.lastToken.end,a=oi(e);if(!a)throw Pe(e,"Expected a property or argument");if(!(a[1]??xt(e)))throw Pe(e,"Expected space after slashdashed property or argument");t=t+n+e.text.slice(i.offset,e.lastToken.end.offset)}let r=oi(e);if(!r)return;let s=r[1]??xt(e)??"";while(n=uo(e)){let i=e.lastToken.end,a=oi(e);if(!a)throw Pe(e,"Expected a property or argument");if(!(a[1]??xt(e)))break;s=s+n+e.text.slice(i.offset,e.lastToken.end.offset)}let o=r[0];return o.leading=t,o.trailing=s,o}function uo(e){let t=qe(e,ro)?.text;if(!t)return;return Lt(t,ls(e))}function il(e){let t=e.current.value,n=yd(e),r=n&&xt(e),s=$d(e);if(!s)if(n)throw Pe(e,"Couldn't find node name");else return;let o=xt(e),i=o!=null,a=uo(e),c=[];while(i||a){let p=e.lastToken.end,m=oi(e);if(!m)break;if(a)i=(m[1]||xt(e))!=null,o=Lt(o,a,e.text.slice(p.offset,e.lastToken.end.offset)),a=uo(e);else{let x=m[0];x.leading=o,c.push(x),o=m[1]||xt(e),i=o!=null,a=uo(e)}}let l,u;while(!0){a??=uo(e);let p=e.lastToken.end,m=Sd(e);if(!m){if(a)throw Pe(e,"Unexpected slashdash");break}if(a)o=Lt(o,a,e.text.slice(p.offset,e.lastToken.end.offset)),a=void 0;else{if(l)e.errors.push(Pe(e,"A node can only have one children block"));l=m,u=o??"",o=void 0}o=Lt(o,xt(e))}let d=new ni(s,c,l);return d.tag=n??null,d.betweenTagAndName=r,d.beforeChildren=u,d.trailing=o??"",rn(e,d,t,e.lastToken),d}function Dy(e){let t=ls(e),n=il(e);if(!n)return;let r=Lt(ol(e),ls(e));return n.leading=Lt(t,n.leading),n.trailing=Lt(n.trailing,r),n}function Fy(e){let t=qe(e,Ko)?.text,n=Ly(e);if(!t)return n;if(n.nodes[0])n.nodes[0].leading=Lt(t,n.nodes[0].leading);else n.trailing=Lt(t,n.trailing);return n}function Ly(e){let t=e.current.value,n=[],r=!0,s=ls(e);while(r){let i=e.lastToken.end,a=uo(e),c=il(e);if(!c){if(a)throw Pe(e,"Unexpected slashdash");break}let l=xt(e),u=ol(e);if(a)s=Lt(s,e.text.slice(i.offset,e.lastToken.end.offset),ls(e));else c.trailing=Lt(c.trailing,l,u)??"",n.push(c),c.leading=s??"",s=ls(e);r=u!=null}let o=new cs(n);return rn(e,o,t,e.lastToken),o.trailing=s??"",o}var vd=T(()=>{ao();dd();Oy();Jy();Qo()});function Vy(e,t){let n=[],r;while(r=t(e))n.push(r);return n.length>0?n:void 0}function YR(e){{let t=qe(e,Ko);if(t)return{type:"bom",text:t.text}}{let t=qe(e,is);if(t)return{type:"newline",text:t.text}}{let t=qe(e,so);if(t)return{type:"space",text:t.text}}{let t=Ra(e);if(t)return{type:"singleline",text:t}}{let t=rl(e);if(t)return{type:"multiline",text:t}}return}function al(e){{let t=sl(e);if(t)return{type:"line-escape",text:t}}{let t=qe(e,so);if(t)return{type:"space",text:t.text}}{let t=rl(e);if(t)return{type:"multiline",text:t}}return}function qy(e){let t=[];while(!0){{let n=YR(e);if(n){t.push(n);continue}}if(qe(e,ro)?.text){let r,s=Vy(e,al)??[],o=il(e);if(!o)throw Pe(e,"Invalid slashdash, expected a commented node");o.trailing=Lt(o.trailing,Vy(e,al)?.map((i)=>i.text).join(""),ol(e)),t.push({type:"slashdash",preface:s,value:o});continue}break}return t}function ZR(e){let t=qe(e,ro);if(t==null)return;let n,r=[];while(n=al(e))r.push(n);let s,o,i="";if(o=oi(e)){if(s=o[0],o[1])i=o[1]}else if(o=Sd(e))s=o;else throw Pe(t,"Couldn't find argument, property, or children that were commented by slashdash");return[{type:"slashdash",preface:r,value:s},i]}function Ed(e){let t=[];while(!0){let n=al(e);if(!n)break;let r=!0;t.push(n);while(r){let s=ZR(e);if(!s)break;if(t.push(s[0]),s[1][0])t.push(...Ed(nl(s[1][0],ka(s[1][0],{flags:e.flags}),{flags:e.flags})));r=!!s[1][0]}}return t}var Wy=T(()=>{Qo();vd()});function us(e,{as:t="document",flags:n,...r}={}){let s=QR[t];if(s==null)throw TypeError(`Invalid "as" target passed: ${JSON.stringify(t)}`);if(typeof e!=="string"){if(typeof TextDecoder!=="function")throw TypeError("Uint8Array input is only supported on platforms that include TextDecoder");e=new TextDecoder("utf-8",{fatal:!0}).decode(e)}let o=_y(n),i=ka(e,{...r,flags:o}),a=nl(e,i,{...r,flags:o}),c;try{c=s(a)}catch(l){xd(a,l)}if(xd(a),!c)throw new Re(`Expected ${/^[aeiouy]/.exec(t)?"an":"a"} ${t}`);return c}var QR;var Hy=T(()=>{ao();Qo();vd();Wy();QR={value:tl,identifier:$d,node:Dy,entry:My,document:Fy,"whitespace in document":qy,"whitespace in node":Ed}});var cl=T(()=>{ao();dd();Hy()});function ii(e,t){let n=e.slice(0,t),r=n.split(`
|
|
18
|
+
`+i.slice(r.length)}).slice(1,-1)}function J$(e,t,n,r,s,o,i,a){if(i)return"";if(o){let l=n.text.startsWith('"""'),c=t.slice(0,a).split(pi),u={offset:n.start.offset+(l?3:1)+a,line:n.start.line+(c.length-1),column:c.length===1?n.start.column+(l?3:1)+a:c.at(-1).length},d={offset:u.offset+r.length,line:u.line,column:u.column+r.length};if(!o.startsWith("{"))e.push(new Ce(String.raw`Invalid unicode escape "\u${o}", did you forget to use {}? "\u{${o}}"`,{token:n,start:u,end:d}));else e.push(new Ce(String.raw`Invalid unicode escape "\u${o.endsWith("}")?o:`${o}...`}"`,{token:n,start:u,end:d}));return""}else if(s){let l=parseInt(s,16);if(l>=55296&&l<=57343)e.push(new Ce(String.raw`Invalid unicode escape "\u{${s}}, only scalar values can be added using an escape`,{token:n}));return String.fromCodePoint(l)}else{let l=hT.get(r);if(l==null)return e.push(new Ce(r.length<2?"Invalid whitespace escape at the end of a string":`Invalid escape "${r}"`,{token:n})),"";return l}}function Va(e,t,n){let r=1;switch(e.type){case ii:r=3;break;case ws:r=e.text.indexOf('"')+1;break;case yo:r=e.text.indexOf('"')+3;break}let s=t.slice(0,n).split(pi);return{offset:e.start.offset+r+n,line:e.start.line+(s.length-1),column:s.length===1?e.start.column+r+n:1+s[s.length-1].length}}var w6,hT,pi,gT,yT,xT,bT,$T,ST,wT,vT,ET;var M$=J(()=>{bo();li();w6=new Map([...Array.from({length:32},(e,t)=>[t,`\\u{${t.toString(16).padStart(2,"0")}}`]),[127,"\\u{7f}"],[8206,"\\u{200e}"],[8207,"\\u{200f}"],[8234,"\\u{202a}"],[8235,"\\u{202b}"],[8236,"\\u{202c}"],[8237,"\\u{202d}"],[8238,"\\u{202e}"],[8294,"\\u{2066}"],[8295,"\\u{2067}"],[8296,"\\u{2068}"],[8297,"\\u{2069}"],[65279,"\\u{feff}"],[34,"\\\""],[92,"\\\\"],[10,"\\n"],[11,"\\u{0b}"],[12,"\\f"],[13,"\\r"],[133,"\\u{85}"],[8232,"\\u{2028}"],[8233,"\\u{2029}"],[8,"\\b"],[9,"\\t"]]),hT=new Map([["\\n",`
|
|
19
|
+
`],["\\r","\r"],["\\t","\t"],["\\\\","\\"],["\\\"",'"'],["\\b","\b"],["\\f","\f"],["\\s"," "]]),pi=/\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029]/,gT=/\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029]/g,yT=/(?:^|[^\\\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000\x0A\x0B\x0C\x0D\x85\u2028\u2029])(?:\\\\)*[\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000\x0A\x0B\x0C\x0D\x85\u2028\u2029]*(\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029])/s,xT=/(?:^|[^\\\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000\x0A\x0B\x0C\x0D\x85\u2028\u2029])(?:\\\\)*[\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000\x0A\x0B\x0C\x0D\x85\u2028\u2029]*(\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029])/dgs;bT=/[\x0A\x0B\x0C\x0D\x85\u2028\u2029]([\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)$/,$T=/(?:^|[^\\\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000])(?:\\\\)*[\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*[\x0A\x0B\x0C\x0D\x85\u2028\u2029]([\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)(?:\\[\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)*$/,ST=/(\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029])([\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)([^\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]?)/g,wT=/([^\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000])[\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*$/;vT=/\\(?:$|u\{(0[0-9a-fA-F]{0,5}|10[0-9a-fA-F]{4}|[1-9a-fA-F][0-9a-fA-F]{0,4})\}|u(\{[^}]{1,6}\}?|[0-9a-fA-F]{1,5}|10[0-9a-fA-F]{4})|([\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]+)|.)/g;ET=/(\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029])([\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)|\\(?:$|u\{(0[0-9a-fA-F]{0,5}|10[0-9a-fA-F]{4}|[1-9a-fA-F][0-9a-fA-F]{0,4})\}|u(\{[^}]{1,6}\}?|[0-9a-fA-F]{1,5}|10[0-9a-fA-F]{4})|([\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]+)|.)/g});function ts(e){if(!e.current.done)e.lastToken=e.current.value;e.current=e.tokens.next();let t=!e.current.done&&e.current.value.errors;if(t)e.errors.push(...t)}function Ue(e,t){if(!e.current.done&&e.current.value.type===t){let n=e.current.value;return ts(e),n}}function _e(e,t){let n="current"in e?e.current.value??e.lastToken:e;return new Ce(t,{token:n})}function dn(e,t,n,r=n){if(e.storeLocations)_$(t,n,r)}function Kt(e="",t="",n=""){return e+t+n||void 0}function Hc(e,t,{storeLocations:n=!1,flags:r}){let s={type:-1,text:"",start:{offset:0,line:1,column:1},end:{offset:0,line:1,column:1},errors:null},o={text:e,tokens:t[Symbol.iterator](),current:{done:!1,value:s},storeLocations:n,lastToken:s,errors:[],flags:r};return ts(o),o}function Np(e,t){if(!t&&!e.current.done&&e.current.value.type!==Ss)t=_e(e,`Unexpected token ${JSON.stringify(e.current.value.text)}, did you forget to quote an identifier?`);let n=e.errors??[];if(t!=null)if(t instanceof Ce)if(t.errors)n.push(...t.errors);else n.push(t);else n.push(new Ce(`An unexpected error occurred, ${String(t)}, this is likely a bug in the KDL parser`,{cause:t}));if(n.length)if(n.length===1)throw n[0];else throw new Ce("Encountered multiple errors",{errors:n})}function Vc(e){switch(e){case"#null":return null;case"#true":return!0;case"#false":return!1;case"#inf":return 1/0;case"#-inf":return-1/0;case"#nan":return NaN}}function I$(e){return e==="inf"||e==="-inf"||e==="nan"||e==="true"||e==="false"||e==="null"||!1}function Tp(e){let{value:t}=e.current,n,r,s,o,i,a=!1;if(t?.text[0]==="-"||t?.text[0]==="+")i=t.text[0];switch(t?.type){case Er:{if(!e.flags.experimentalSuffixedNumbers)throw new Ce("Unreachable code: got a suffixed number from the tokenizer but the suffixed number flag is not set",{token:t});let u=i?t.text.slice(1):t.text,d=u.search(/[^0-9._]/);if(r=(i??"")+u.slice(0,d),n=Number.parseFloat(r.replaceAll("_","")),o=s=u.slice(d),I$(s))e.errors.push(_e(e,`Invalid suffix ${s}, values that look like keywords cannot be used as suffix`))}break;case Tc:a=!0,n=(i==="-"?-1:1)*Number.parseInt(t.text.slice(i?3:2).replaceAll("_",""),2);break;case Nc:a=!0,n=(i==="-"?-1:1)*Number.parseInt(t.text.slice(i?3:2).replaceAll("_",""),8);break;case Qr:a=!0,n=Number.parseFloat(t.text.replaceAll("_",""));break;case Rc:a=!0,n=(i==="-"?-1:1)*Number.parseInt(t.text.slice(i?3:2).replaceAll("_",""),16);break;case oi:if(n=Vc(t.text),n===void 0)if(n=null,Vc(t.text.toLowerCase())!==void 0)e.errors.push(_e(e,`Invalid keyword ${t.text}, keywords are case sensitive, write ${t.text.toLowerCase()} instead`));else switch(t.text.toLowerCase()){case"#nul":case"#nill":e.errors.push(_e(e,`Invalid keyword ${t.text}, did you mean #null?`));break;case"#fals":case"#fasle":e.errors.push(_e(e,`Invalid keyword ${t.text}, did you mean #false?`));break;case"#ture":case"#treu":e.errors.push(_e(e,`Invalid keyword ${t.text}, did you mean #true?`));break;case"#ifn":e.errors.push(_e(e,`Invalid keyword ${t.text}, did you mean #inf?`));break;case"#-ifn":e.errors.push(_e(e,`Invalid keyword ${t.text}, did you mean #-inf?`));break;default:e.errors.push(_e(e,`Invalid keyword ${t.text}, surround it with quotes to use a string`))}break;default:return}ts(e);let l=e.flags.experimentalSuffixedNumbers&&Ue(e,oi);if(l)if(a){if(o=l.text,Vc(o)!==void 0)e.errors.push(_e(l,`Invalid number suffix ${o}, did you forget a space between the number and the keyword?`));s=o.slice(1)}else if(s)e.errors.push(_e(l,"Unexpected hashed suffix, a number can only have one suffix"));else if(typeof n==="number")e.errors.push(_e(l,"Unexpected hashed suffix, you cannot place suffixes on number keywords"));else e.errors.push(_e(l,"Unexpected hashed suffix, you can only place suffixes on numbers"));let c=new ar(n);if(c.representation=r??t.text,dn(e,c,t),s){let u=new Pr(s);u.representation=o,u.suffix=!0,dn(e,u,e.lastToken),c.tag=u}return c}function qa(e){if(e.current.done)return;let{value:t}=e.current,n;switch(t.type){case zt:if(ts(e),I$(t.text))e.errors.push(_e(e,`Invalid keyword "${t.text}", add a leading # to use the keyword or surround with quotes to make it a string`));n=[t.text,t.text,t];break;case Ma:ts(e),n=[N$(e.errors,t.text.slice(1,-1),t),t.text,t];break;case ii:ts(e),n=[T$(e.errors,t.text.slice(3,-3),t),t.text,t];break;case ws:{ts(e);let r=t.text,s=r.indexOf('"');n=[C$(e.errors,r.slice(s+1,-(s+1)),t),r,t];break}case yo:{ts(e);let r=t.text,s=r.indexOf('"');n=[R$(e.errors,r.slice(s+3,-(s+3)),t),r,t];break}default:return}if(Ue(e,oi))e.errors.push(_e(e.lastToken,Vc(e.lastToken.text)===void 0?"Unexpected hashed suffix on a string, you can only place suffixes on numbers":"Unexpected keyword, did you forget to add whitespace?"));return n}function Jp(e){let t=qa(e);if(!t)return;let n=new ir(t[0]);return n.representation=t[1],dn(e,n,t[2],e.lastToken),n}function qc(e){let t=Tp(e);if(t)return t;let n=qa(e);if(!n)return;let r=new ar(n[0]);return r.representation=n[1],dn(e,r,n[2],e.lastToken),r}function Ha(e){let t=Ue(e,Mc);if(!t)return;let{value:n}=e.current;return ts(e),t.text+(n?.text??"")}function Wc(e){return Ue(e,Ic)?.text}function Mp(e){return Ue(e,go)??Wc(e)}function Bc(e){let t=Ue(e,Jc);if(!t)return;while(Mp(e));if(!Ha(e)&&!Ue(e,vs)&&!Ue(e,Ss))e.errors.push(_e(e,`Expected newline or single-line comment after backslash but got ${e.current.value?.text??"EOF"}`));return e.text.slice(t.start.offset,e.lastToken.end.offset)}function Ps(e){let t=e.lastToken.end;while(Ue(e,vs)?.text??Ha(e)??Mp(e)??Bc(e));if(e.lastToken.end===t)return;return e.text.slice(t.offset,e.lastToken.end.offset)}function At(e){let t=e.lastToken.end;while(Mp(e)??Bc(e));if(e.lastToken.end===t)return;return e.text.slice(t.offset,e.lastToken.end.offset)}function Rp(e){let t=Ue(e,kc);if(!t)return;let n=At(e),r=qa(e);if(!r&&e.current.value){let a=e.current.value;if(Ps(e))e.errors.push(_e(a,"This type of whitespace is not allowed inside a tag"));r=qa(e)}if(!r){if(Tp(e))e.errors.push(_e(e,"Invalid tag, did you forget to quote a string?")),r=["error","error"]}if(!r)throw _e(e,"Invalid tag, did you forget to quote a string?");let s=At(e),o=Ue(e,Ja);if(!o&&e.current.value){let a=e.current.value;if(Ps(e))e.errors.push(_e(a,"This type of whitespace is not allowed inside a tag"));o=Ue(e,Ja)}if(!o)throw _e(e,"Invalid tag, did you forget to quote a string?");let i=new Pr(r[0]);return i.representation=r[1],i.leading=n,i.trailing=s,dn(e,i,t,e.lastToken),i}function Uc(e){return Ha(e)??Ue(e,vs)?.text??Ue(e,Cc)?.text??Ue(e,Ss)?.text}function Ip(e){if(!Ue(e,Oc))return;let t=V$(e);if(!Ue(e,Ac))throw _e(e,"Invalid node children");return t}function mi(e){let t=e.current.value;{let d=Rp(e);if(d){let p=At(e),m=qc(e);if(!m)throw _e(e,"Invalid argument");if(m.tag)e.errors.push(_e(e.lastToken,"A number suffix cannot be combined with a regular tag"));m.tag=d,m.betweenTagAndValue=p;let y=new _n(m,null);dn(e,m,t,e.lastToken),dn(e,y,t,e.lastToken);let S=At(e);if(Ue(e,si))e.errors.push(_e(e.lastToken,typeof m.value==="string"?"Unexpected equals sign, properties are name=(tag)value not (tag)name=value":"Unexpected equals sign")),S=Kt(S,At(e))||" ";return[y,S]}}{let d=Tp(e);if(d){let p=new _n(d,null);dn(e,p,t,e.lastToken);let m=At(e);if(Ue(e,si))e.errors.push(_e(e.lastToken,"Unexpected equals sign, did you forget to quote the property name?")),m=Kt(m,At(e))||" ";return[p,m]}}let n=qa(e);if(!n)return;let r=At(e),s=Ue(e,si);if(!s){let d=new ar(n[0]);d.representation=n[1],dn(e,d,n[2]);let p=new _n(d,null);return dn(e,p,t,e.lastToken),[p,r]}let o=new ir(n[0]);o.representation=n[1],dn(e,o,n[2]);let i=At(e),a=Rp(e),l=a&&At(e),c=qc(e);if(!c)throw _e(e,"Expected a value");if(a){if(c.tag)e.errors.push(_e(e.lastToken,"A number suffix cannot be combined with a regular tag"));c.tag=a,c.betweenTagAndValue=l}let u=new _n(c,o);return dn(e,u,t,e.lastToken),u.equals=Kt(r,s.text,i),[u,void 0]}function D$(e){let t=At(e)??"",n;while(n=wo(e)){let i=e.lastToken.end,a=mi(e);if(!a)throw _e(e,"Expected a property or argument");if(!(a[1]??At(e)))throw _e(e,"Expected space after slashdashed property or argument");t=t+n+e.text.slice(i.offset,e.lastToken.end.offset)}let r=mi(e);if(!r)return;let s=r[1]??At(e)??"";while(n=wo(e)){let i=e.lastToken.end,a=mi(e);if(!a)throw _e(e,"Expected a property or argument");if(!(a[1]??At(e)))break;s=s+n+e.text.slice(i.offset,e.lastToken.end.offset)}let o=r[0];return o.leading=t,o.trailing=s,o}function wo(e){let t=Ue(e,ho)?.text;if(!t)return;return Kt(t,Ps(e))}function zc(e){let t=e.current.value,n=Rp(e),r=n&&At(e),s=Jp(e);if(!s)if(n)throw _e(e,"Couldn't find node name");else return;let o=At(e),i=o!=null,a=wo(e),l=[];while(i||a){let p=e.lastToken.end,m=mi(e);if(!m)break;if(a)i=(m[1]||At(e))!=null,o=Kt(o,a,e.text.slice(p.offset,e.lastToken.end.offset)),a=wo(e);else{let y=m[0];y.leading=o,l.push(y),o=m[1]||At(e),i=o!=null,a=wo(e)}}let c,u;while(!0){a??=wo(e);let p=e.lastToken.end,m=Ip(e);if(!m){if(a)throw _e(e,"Unexpected slashdash");break}if(a)o=Kt(o,a,e.text.slice(p.offset,e.lastToken.end.offset)),a=void 0;else{if(c)e.errors.push(_e(e,"A node can only have one children block"));c=m,u=o??"",o=void 0}o=Kt(o,At(e))}let d=new fi(s,l,c);return d.tag=n??null,d.betweenTagAndName=r,d.beforeChildren=u,d.trailing=o??"",dn(e,d,t,e.lastToken),d}function L$(e){let t=Ps(e),n=zc(e);if(!n)return;let r=Kt(Uc(e),Ps(e));return n.leading=Kt(t,n.leading),n.trailing=Kt(n.trailing,r),n}function F$(e){let t=Ue(e,ri)?.text,n=V$(e);if(!t)return n;if(n.nodes[0])n.nodes[0].leading=Kt(t,n.nodes[0].leading);else n.trailing=Kt(t,n.trailing);return n}function V$(e){let t=e.current.value,n=[],r=!0,s=Ps(e);while(r){let i=e.lastToken.end,a=wo(e),l=zc(e);if(!l){if(a)throw _e(e,"Unexpected slashdash");break}let c=At(e),u=Uc(e);if(a)s=Kt(s,e.text.slice(i.offset,e.lastToken.end.offset),Ps(e));else l.trailing=Kt(l.trailing,c,u)??"",n.push(l),l.leading=s??"",s=Ps(e);r=u!=null}let o=new js(n);return dn(e,o,t,e.lastToken),o.trailing=s??"",o}var Dp=J(()=>{bo();_p();A$();M$();li()});function q$(e,t){let n=[],r;while(r=t(e))n.push(r);return n.length>0?n:void 0}function jT(e){{let t=Ue(e,ri);if(t)return{type:"bom",text:t.text}}{let t=Ue(e,vs);if(t)return{type:"newline",text:t.text}}{let t=Ue(e,go);if(t)return{type:"space",text:t.text}}{let t=Ha(e);if(t)return{type:"singleline",text:t}}{let t=Wc(e);if(t)return{type:"multiline",text:t}}return}function Kc(e){{let t=Bc(e);if(t)return{type:"line-escape",text:t}}{let t=Ue(e,go);if(t)return{type:"space",text:t.text}}{let t=Wc(e);if(t)return{type:"multiline",text:t}}return}function H$(e){let t=[];while(!0){{let n=jT(e);if(n){t.push(n);continue}}if(Ue(e,ho)?.text){let r,s=q$(e,Kc)??[],o=zc(e);if(!o)throw _e(e,"Invalid slashdash, expected a commented node");o.trailing=Kt(o.trailing,q$(e,Kc)?.map((i)=>i.text).join(""),Uc(e)),t.push({type:"slashdash",preface:s,value:o});continue}break}return t}function PT(e){let t=Ue(e,ho);if(t==null)return;let n,r=[];while(n=Kc(e))r.push(n);let s,o,i="";if(o=mi(e)){if(s=o[0],o[1])i=o[1]}else if(o=Ip(e))s=o;else throw _e(t,"Couldn't find argument, property, or children that were commented by slashdash");return[{type:"slashdash",preface:r,value:s},i]}function Lp(e){let t=[];while(!0){let n=Kc(e);if(!n)break;let r=!0;t.push(n);while(r){let s=PT(e);if(!s)break;if(t.push(s[0]),s[1][0])t.push(...Lp(Hc(s[1][0],Fa(s[1][0],{flags:e.flags}),{flags:e.flags})));r=!!s[1][0]}}return t}var W$=J(()=>{li();Dp()});function _s(e,{as:t="document",flags:n,...r}={}){let s=_T[t];if(s==null)throw TypeError(`Invalid "as" target passed: ${JSON.stringify(t)}`);if(typeof e!=="string"){if(typeof TextDecoder!=="function")throw TypeError("Uint8Array input is only supported on platforms that include TextDecoder");e=new TextDecoder("utf-8",{fatal:!0}).decode(e)}let o=k$(n),i=Fa(e,{...r,flags:o}),a=Hc(e,i,{...r,flags:o}),l;try{l=s(a)}catch(c){Np(a,c)}if(Np(a),!l)throw new Ce(`Expected ${/^[aeiouy]/.exec(t)?"an":"a"} ${t}`);return l}var _T;var B$=J(()=>{bo();li();Dp();W$();_T={value:qc,identifier:Jp,node:L$,entry:D$,document:F$,"whitespace in document":H$,"whitespace in node":Lp}});var Gc=J(()=>{bo();_p();B$()});function hi(e,t){let n=e.slice(0,t),r=n.split(`
|
|
20
20
|
`).length;return{column:t-n.lastIndexOf(`
|
|
21
|
-
`),line:r,offset:t}}var Rt;var ai=T(()=>{Rt=class Rt extends Error{column;line;offset;reason;constructor(e,t=null){super(t?`${e} (line ${t.line}, column ${t.column})`:e);this.name="JxnError",this.column=t?.column??null,this.line=t?.line??null,this.offset=t?.offset??null,this.reason=e}inFile(e){let t=this.line!==null&&this.column!==null&&this.offset!==null?{column:this.column,line:this.line,offset:this.offset}:null;return new Rt(`${e}: ${this.reason}`,t)}}});var Uy;var By=T(()=>{Uy=new Set(["onabort","onactivate","onaddsourcebuffer","onaddtrack","onadvertisementreceived","onafterprint","onanimationcancel","onanimationend","onanimationiteration","onanimationstart","onappinstalled","onaudioend","onaudioprocess","onaudiostart","onauxclick","onavailabilitychanged","onbackgroundfetchabort","onbackgroundfetchclick","onbackgroundfetchfail","onbackgroundfetchsuccess","onbeforeinput","onbeforeinstallprompt","onbeforematch","onbeforeprint","onbeforetoggle","onbeforexrselect","onbegin","onblocked","onblur","onboundary","onbufferedamountlow","onbufferedchange","oncancel","oncanmakepayment","oncanplay","oncanplaythrough","oncaptureaction","oncapturedmousechange","oncapturehandlechange","onchange","oncharacterboundsupdate","oncharacteristicvaluechanged","onchargingchange","onchargingtimechange","onclick","onclose","onclosing","oncommand","oncomplete","oncompositionend","oncompositionstart","onconfigurationchange","onconnect","onconnecting","onconnectionavailable","onconnectionstatechange","oncontentdelete","oncontextlost","oncontextmenu","oncontextoverflow","oncontextrestored","oncontrollerchange","oncookiechange","oncopy","oncuechange","oncurrententrychange","oncurrentscreenchange","oncut","ondataavailable","ondatachannel","ondblclick","ondequeue","ondevicechange","ondevicemotion","ondeviceorientation","ondeviceorientationabsolute","ondischargingtimechange","ondisconnect","ondispose","ondownloadprogress","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onencrypted","onend","onended","onendstreaming","onenter","onenterpictureinpicture","onerror","onexit","onfencedtreeclick","onfetch","onfinish","onfocus","onformdata","onframeratechange","onfreeze","onfullscreenchange","onfullscreenerror","ongamepadconnected","ongamepaddisconnected","ongatheringstatechange","ongattserverdisconnected","ongeometrychange","ongotpointercapture","onhashchange","onicecandidate","onicecandidateerror","oniceconnectionstatechange","onicegatheringstatechange","oninput","oninputreport","oninputsourceschange","oninstall","oninstallresult","oninvalid","onisolationchange","onkeydown","onkeyframerequest","onkeypress","onkeystatuseschange","onkeyup","onlanguagechange","onlayoutchange","onleavepictureinpicture","onlevelchange","onload","onloadeddata","onloadedmetadata","onloadend","onloading","onloadingdone","onloadingerror","onloadstart","onlocation","onlostpointercapture","onmanagedconfigurationchange","onmark","onmessage","onmessageerror","onmidimessage","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onmute","onnavigate","onnavigateerror","onnavigatesuccess","onnegotiationneeded","onnomatch","onnotificationclick","onnotificationclose","onoffline","ononline","onopen","onorientationchange","onpagehide","onpagereveal","onpageshow","onpageswap","onpaste","onpause","onpayerdetailchange","onpaymentmethodchange","onpaymentrequest","onperiodicsync","onplay","onplaying","onpointercancel","onpointerdown","onpointerenter","onpointerleave","onpointerlockchange","onpointerlockerror","onpointermove","onpointerout","onpointerover","onpointerrawupdate","onpointerup","onpopstate","onportalactivate","onprerenderingchange","onprioritychange","onprocessorerror","onprogress","onpromptaction","onpromptdismiss","onpush","onpushsubscriptionchange","onquotaoverflow","onratechange","onreading","onreadingerror","onreadystatechange","onredraw","onreflectionchange","onrejectionhandled","onrelease","onremove","onremovesourcebuffer","onremovetrack","onrepeat","onreset","onresize","onresourcetimingbufferfull","onresult","onresume","onrtctransform","onscreenschange","onscroll","onscrollend","onsecuritypolicyviolation","onseeked","onseeking","onselect","onselectedcandidatepairchange","onselectend","onselectionchange","onselectstart","onserviceadded","onservicechanged","onserviceremoved","onshippingaddresschange","onshippingoptionchange","onshow","onsignalingstatechange","onsinkchange","onslotchange","onsnapchanged","onsnapchanging","onsoundend","onsoundstart","onsourceclose","onsourceended","onsourceopen","onspeechend","onspeechstart","onsqueeze","onsqueezeend","onsqueezestart","onstalled","onstart","onstartstreaming","onstatechange","onstop","onstorage","onstream","onsubmit","onsuccess","onsuspend","onsync","onterminate","ontextformatupdate","ontextupdate","ontimeout","ontimeupdate","ontoggle","ontonechange","ontoolactivated","ontoolcancel","ontoolchange","ontouchcancel","ontouchend","ontouchmove","ontouchstart","ontrack","ontransitioncancel","ontransitionend","ontransitionrun","ontransitionstart","onuncapturederror","onunhandledrejection","onunload","onunmute","onupdate","onupdateend","onupdatefound","onupdatestart","onupgradeneeded","onvalidationstatuschange","onversionchange","onvisibilitychange","onvoiceschanged","onvolumechange","onwaiting","onwaitingforkey","onwebkitanimationend","onwebkitanimationiteration","onwebkitanimationstart","onwebkittransitionend","onwheel","onzoomlevelchange"])});function ve(e,t,n,r,s){let o=t.normalize("NFC");if(o==="__proto__")throw _e(r,s,'"__proto__" cannot be a key: it would not be data');if(Object.hasOwn(e,o))throw _e(r,s,`"${o}" is written twice, and one of them would be lost`);e[o]=n}function _e(e,t,n){let r=ul(t)?.start;return new Rt(n,r===void 0?null:ii(e.text,r))}function ul(e){let t=ei(e);return t?{end:t.end.offset,start:t.start.offset}:null}function ht(e,t,n){let r=e.spans?ul(n):null;if(r)e.spans?.set(t,r)}function zy(e,t,n){let r=e.tokens&&n?ul(n):null;if(r)e.tokens?.names.set(t,r)}function Pt(e,t,n){let r=e.tokens&&n?ul(n.value):null;if(r){let s=n?.value.representation,o=s===void 0?r.start:r.end-s.length;e.tokens?.values.set(t,{end:r.end,start:o})}}function fs(e){return e.entries.filter((t)=>!t.name)}function Xe(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function ci(e,t){let n=t.getTag();if(n!==null&&!Xy.has(n))throw _e(e,t,`(${n}) is not an annotation Jx Notation has`);if(n==="ref")throw _e(e,t,"(ref) annotates a value, and this is a name");return n}function Vr(e,t){let n=t.getTag(),r=t.getValue();if(n!==null&&n!=="ref")throw _e(e,t,`(${n}) cannot annotate a value here; only (ref) can`);if(St(r)){if(!Number.isFinite(r))throw _e(e,t,"JSON has no way to hold #inf or #nan");if(Number.isInteger(r)&&!Number.isSafeInteger(r))throw _e(e,t,"This number is too large to survive being read as JSON")}if(n==="ref"){if(!k(r))throw _e(e,t,"(ref) needs a string");return{$ref:r}}return r}function On(e,t){return t.entries.filter((n)=>!n.name).map((n)=>Vr(e,n))}function An(e){return e.entries.filter((t)=>t.name)}function Ct(e){return e.children?.nodes??[]}function lr(e){return e.getName()??""}function nC(e,t,n){let r={$prototype:"Function"},s=On(e,t),o=Ct(t);for(let a of An(t))ve(r,lr(a),Vr(e,a),e,a),Pt(e,`${n}/${Xe(lr(a))}`,a);let i=e.tokens?fs(t):[];if(o.length>0){if(s.length>0)ve(r,"parameters",s,e,t);ve(r,"body",jd(e,o,`${n}/body`),e,t)}else if(s.length>0){let a=s.at(-1)??null,c=s.slice(0,-1);if(c.length>0)ve(r,"parameters",c,e,t);ve(r,"body",a,e,t),Pt(e,`${n}/body`,i.pop())}for(let[a,c]of i.entries())Pt(e,`${n}/parameters/${a}`,c);return ht(e,n,t),r}function rC(e,t,n){let r={$prototype:"Function",$src:"#client"};if(On(e,t).length>0||Ct(t).length>0)throw _e(e,t,"(export) names a function the document's script exports, and holds no body of its own");for(let s of An(t))ve(r,lr(s),Vr(e,s),e,s),Pt(e,`${n}/${Xe(lr(s))}`,s);if(!Object.hasOwn(r,"$export"))r.$export=t.getName().normalize("NFC");return ht(e,n,t),r}function sC(e,t,n){if(On(e,t).length>0||Ct(t).length>0)throw _e(e,t,"(server) names a function the document's server script exports. Its arguments are written name=value");let r={$export:t.getName().normalize("NFC"),$src:"#server",timing:"server"},s=An(t);if(s.length>0){let o={};for(let i of s){let a=lr(i);ve(o,a,Vr(e,i),e,i),ht(e,`${n}/arguments/${Xe(a)}`,i),Pt(e,`${n}/arguments/${Xe(a)}`,i)}r.arguments=o}return ht(e,n,t),r}function oC(e,t,n){let r={};for(let c of An(t)){let l=lr(c);if(ve(r,l,Vr(e,c),e,c),l!=="timing"||r[l]!=="server")throw _e(e,c,"A script takes timing=server, and nothing else")}let s=On(e,t),[o]=s;if(s.length!==1||!k(o)||Ct(t).length>0)throw _e(e,t,"A script holds one string, which is the text of its module");let i=Object.hasOwn(r,"timing")?"server":"client",a=n.$script;if(!V(a)||!Ky.has(a))a={},Ky.add(a),ve(n,"$script",a,e,t);ve(a,i,o,e,t),ht(e,`/$script/${i}`,t),Pt(e,`/$script/${i}`,fs(t)[0])}function Gy(e,t,n){for(let[r,s]of(e.tokens?fs(n):[]).entries())Pt(e,`${t}/${r}`,s)}function jd(e,t,n,r=0){return t.map((s,o)=>{if(s.getName()!=="-")throw _e(e,s,`A list holds only "-" items, and this is "${s.getName()}"`);return kn(e,s,`${n}/${r+o}`)})}function kn(e,t,n){let r=ci(e,t);if(ht(e,n,t),r==="fn")return nC(e,t,n);if(r==="export")return rC(e,t,n);if(r==="server")return sC(e,t,n);let s=On(e,t),o=An(t),i=Ct(t);if(r==="array"){if(o.length>0)throw _e(e,t,"(array) holds items, and these are named");return Gy(e,n,t),[...s,...jd(e,i,n,s.length)]}if(r!=="object"){if(s.length>1){if(o.length>0||i.length>0)throw _e(e,t,"A list of values cannot also have names or a block");return Gy(e,n,t),s}if(s.length===1){if(o.length>0||i.length>0)throw _e(e,t,"A value cannot also have names or a block");return Pt(e,n,fs(t)[0]),s[0]??null}if(i.length>0&&o.length===0&&i.every((c)=>c.getName()==="-"))return jd(e,i,n)}else if(s.length>0)throw _e(e,t,"(object) holds names, and this is a value");let a={};for(let c of o){let l=lr(c);ve(a,l,Vr(e,c),e,c),ht(e,`${n}/${Xe(l)}`,c),zy(e,`${n}/${Xe(l)}`,c.name),Pt(e,`${n}/${Xe(l)}`,c)}for(let c of i){let l=c.getName();ve(a,l,kn(e,c,`${n}/${Xe(l)}`),e,c),zy(e,`${n}/${Xe(l)}`,c.name)}return a}function fl(e,t,n){let r={};if(ht(e,n,t),On(e,t).length>0)throw _e(e,t,"A style block holds declarations, and this is a value");for(let s of An(t)){let o=lr(s);ve(r,o,Vr(e,s),e,s),ht(e,`${n}/${Xe(o)}`,s),Pt(e,`${n}/${Xe(o)}`,s)}for(let s of Ct(t)){let o=s.getName(),i=`${n}/${Xe(o)}`,a=Ct(s);if(s.getTag()==="array"||a.length>0&&a.every((l)=>l.getName()==="-")){ve(r,o,kn(e,s,i),e,s);continue}let c=On(e,s);if(c.length>1)throw _e(e,s,`"${o}" has more than one value. A selector with a space in it needs quotes`);if(c.length===1){if(An(s).length>0||Ct(s).length>0)throw _e(e,s,`"${o}" has a value and names. A selector with a space in it needs quotes`);ve(r,o,c[0]??null,e,s),ht(e,i,s),Pt(e,i,fs(s)[0])}else ve(r,o,fl(e,s,i),e,s)}return r}function ll(e,t,n){let r=Ct(t);if(r.length!==1||!r[0])throw _e(e,t,`"${t.getName()}" holds one element`);return Zy(e,r[0],n)}function Yy(e,t,n){let r={$prototype:"Array"};if(ht(e,n,t),On(e,t).length>0)throw _e(e,t,"$array holds names and one element, and this is a value");for(let s of An(t)){let o=lr(s),i=o.startsWith(".")?o.slice(1):o;ve(r,i,Vr(e,s),e,s),Pt(e,`${n}/${Xe(i)}`,s)}if(Ct(t).length>0)ve(r,"map",ll(e,t,`${n}/map`),e,t);return r}function Zy(e,t,n){let r=t.getName();if(r==="-"){let s=On(e,t);if(s.length!==1||An(t).length>0||Ct(t).length>0)throw _e(e,t,'"-" is one piece of text or one (ref)');return ht(e,n,t),Pt(e,n,fs(t)[0]),s[0]??null}if(r==="$array")return Yy(e,t,n);return Pd(e,t,n)}function iC(e,t,n,r){let s=ci(e,n);if(t==="map")return ll(e,n,r);if(t==="cases"){let o={};for(let i of Ct(n)){let a=i.getName();ve(o,a,ll(e,i,`${r}/${Xe(a)}`),e,i)}return o}if(t==="children"&&s!=="array"&&Ct(n).length>0)return ll(e,n,r);return kn(e,n,r)}function Pd(e,t,n){let r={},s=t.getName(),o=ci(e,t);if(ht(e,n,t),o!==null)throw _e(e,t,`(${o}) cannot annotate an element`);let i=On(e,t);if(s==="$element"){let[c,l,...u]=i;if(u.length>0)throw _e(e,t,"$element takes at most a tag and a text value");if(c!==void 0)ve(r,"tagName",c,e,t);if(l!==void 0)ve(r,"textContent",l,e,t),Pt(e,`${n}/textContent`,fs(t)[1])}else{if(s.startsWith("$"))throw _e(e,t,`"${s}" is not a kind of element`);if(ve(r,"tagName",s,e,t),i.length>1)throw _e(e,t,"An element has one text value. A list of them needs a block");if(i[0]!==void 0)ve(r,"textContent",i[0],e,t),ht(e,`${n}/textContent`,t),Pt(e,`${n}/textContent`,fs(t)[0])}aC(e,t,r,n);let a=[];for(let c of Ct(t))cC(e,c,r,a,n);if(a.length>0)ve(r,"children",a,e,t);return r}function Qy(e){let{attributes:t}=e;if(V(t))return t;let n={};return e.attributes=n,n}function aC(e,t,n,r){for(let s of An(t)){let o=lr(s),i=s.getTag();if(i==="fn")throw _e(e,s,"A function has a block form: (fn)name, on a line of its own");let a=Vr(e,s);if(o.startsWith(".")||o.startsWith("$")){let c=o.startsWith(".")?o.slice(1):o;ve(n,c,a,e,s),ht(e,`${r}/${Xe(c)}`,s),Pt(e,`${r}/${Xe(c)}`,s)}else if(o.startsWith("on")&&i==="ref")ve(n,o,a,e,s),ht(e,`${r}/${Xe(o)}`,s),Pt(e,`${r}/${Xe(o)}`,s);else if(o.startsWith("on")&&Uy.has(o))throw _e(e,s,`${o} needs (ref)"pointer", or a function on a line of its own: (fn)${o} "…"`);else ve(Qy(n),o,a,e,s),ht(e,`${r}/attributes/${Xe(o)}`,s),Pt(e,`${r}/attributes/${Xe(o)}`,s)}}function cC(e,t,n,r,s){let o=t.getName(),i=ci(e,t),a=(c)=>`${s}/${Xe(c)}`;if(i==="fn"||i==="on"){if(!o.startsWith("on"))throw _e(e,t,`(${i}) in an element marks a handler, and "${o}" is not one`);ve(n,o,kn(e,t,a(o)),e,t)}else if(o==="script"){if(s!=="")throw _e(e,t,`"script" is the document's module, and is written in its root element. A <script> element is $element "script"`);if(i!==null)throw _e(e,t,`(${i}) cannot annotate a script`);oC(e,t,n)}else if(o==="state")ve(n,"state",kn(e,t,a("state")),e,t);else if(o==="style")ve(n,"style",fl(e,t,a("style")),e,t);else if(o==="attributes"){let c=kn(e,t,a("attributes"));if(V(c))for(let[l,u]of Object.entries(c))ve(Qy(n),l,u,e,t);else ve(n,"attributes",c,e,t)}else if(o.startsWith(".")){let c=o.slice(1);ve(n,c,iC(e,c,t,a(c)),e,t)}else if(o.startsWith("$")&&o!=="$array"&&o!=="$element")ve(n,o,kn(e,t,a(o)),e,t);else{if(tC.has(o))throw _e(e,t,`"${o}" is reserved here`);r.push(Zy(e,t,`${s}/children/${r.length}`))}}function _d(e,t){return Ct(t).map((n,r)=>{let s=`/$head/${r}`;return n.getName()==="-"?kn(e,n,s):Pd(e,n,s)})}function kd(e){let t=eC.exec(e);if(t)throw new Rt(`A raw control character (U+${t[0].codePointAt(0)?.toString(16).toUpperCase().padStart(4,"0")}) cannot be in a Jx Notation file. Escape it, as \\u{1b}`,ii(e,t.index));try{return us(e,{storeLocations:!0})}catch(n){let s=(n instanceof Re?n.errors?.[0]??n:null)?.start,o=n instanceof Error?n.message:String(n);throw new Rt(o.split(`
|
|
22
|
-
`)[0]??o,s?
|
|
23
|
-
`,n);n=r===-1?e.length:r}else if(e.startsWith("/*",n)){t.comments+=1;let r=e.indexOf("*/",n+2);n=r===-1?e.length:r+2}else if(e.startsWith("/-",n))t.comments+=1,n+=2;else if(e.charAt(n)==="#"&&/^#+"/u.test(e.slice(n,n+16))){let[r=""]=/^#+/u.exec(e.slice(n))??[],s=n+r.length,o=e.startsWith('"""',s)?'"""':'"',i=e.indexOf(o+r,s+o.length);n=i===-1?e.length:i+o.length+r.length}else if(e.charAt(n)==='"'){let r=e.startsWith('"""',n)?'"""':'"';n+=r.length;while(n<e.length&&!e.startsWith(r,n))if(e.charAt(n)==="\\")t.escapes.push(n),n+=2;else n+=1;n+=r.length}else n+=1;return t}function
|
|
24
|
-
`)+1)}function
|
|
21
|
+
`),line:r,offset:t}}var Ft;var gi=J(()=>{Ft=class Ft extends Error{column;line;offset;reason;constructor(e,t=null){super(t?`${e} (line ${t.line}, column ${t.column})`:e);this.name="JxnError",this.column=t?.column??null,this.line=t?.line??null,this.offset=t?.offset??null,this.reason=e}inFile(e){let t=this.line!==null&&this.column!==null&&this.offset!==null?{column:this.column,line:this.line,offset:this.offset}:null;return new Ft(`${e}: ${this.reason}`,t)}}});var U$;var z$=J(()=>{U$=new Set(["onabort","onactivate","onaddsourcebuffer","onaddtrack","onadvertisementreceived","onafterprint","onanimationcancel","onanimationend","onanimationiteration","onanimationstart","onappinstalled","onaudioend","onaudioprocess","onaudiostart","onauxclick","onavailabilitychanged","onbackgroundfetchabort","onbackgroundfetchclick","onbackgroundfetchfail","onbackgroundfetchsuccess","onbeforeinput","onbeforeinstallprompt","onbeforematch","onbeforeprint","onbeforetoggle","onbeforexrselect","onbegin","onblocked","onblur","onboundary","onbufferedamountlow","onbufferedchange","oncancel","oncanmakepayment","oncanplay","oncanplaythrough","oncaptureaction","oncapturedmousechange","oncapturehandlechange","onchange","oncharacterboundsupdate","oncharacteristicvaluechanged","onchargingchange","onchargingtimechange","onclick","onclose","onclosing","oncommand","oncomplete","oncompositionend","oncompositionstart","onconfigurationchange","onconnect","onconnecting","onconnectionavailable","onconnectionstatechange","oncontentdelete","oncontextlost","oncontextmenu","oncontextoverflow","oncontextrestored","oncontrollerchange","oncookiechange","oncopy","oncsrcchange","oncuechange","oncurrententrychange","oncurrentscreenchange","oncut","ondataavailable","ondatachannel","ondblclick","ondequeue","ondevicechange","ondevicemotion","ondeviceorientation","ondeviceorientationabsolute","ondischargingtimechange","ondisconnect","ondispose","ondownloadprogress","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onencrypted","onend","onended","onendstreaming","onenter","onenterpictureinpicture","onerror","onexit","onfencedtreeclick","onfetch","onfinish","onfocus","onformdata","onframeratechange","onfreeze","onfullscreenchange","onfullscreenerror","ongamepadconnected","ongamepaddisconnected","ongatheringstatechange","ongattserverdisconnected","ongeometrychange","ongotpointercapture","onhashchange","onicecandidate","onicecandidateerror","onicecandidatepairadd","onicecandidatepairnominate","onicecandidatepairremove","oniceconnectionstatechange","onicegatheringstatechange","oninput","oninputreport","oninputsourceschange","oninstall","oninstallresult","oninvalid","onisolationchange","onkeydown","onkeyframerequest","onkeypress","onkeystatuseschange","onkeyup","onlanguagechange","onlayoutchange","onleavepictureinpicture","onlevelchange","onload","onloadeddata","onloadedmetadata","onloadend","onloading","onloadingdone","onloadingerror","onloadstart","onlocation","onlostpointercapture","onmanagedconfigurationchange","onmark","onmessage","onmessageerror","onmidimessage","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onmute","onnavigate","onnavigateerror","onnavigatesuccess","onnegotiationneeded","onnomatch","onnotificationclick","onnotificationclose","onoffline","ononline","onopen","onorientationchange","onpagehide","onpagereveal","onpageshow","onpageswap","onpaste","onpause","onpayerdetailchange","onpaymentmethodchange","onpaymentrequest","onperiodicsync","onplay","onplaying","onpointercancel","onpointerdown","onpointerenter","onpointerleave","onpointerlockchange","onpointerlockerror","onpointermove","onpointerout","onpointerover","onpointerrawupdate","onpointerup","onpopstate","onportalactivate","onprerenderingchange","onprioritychange","onprocessorerror","onprogress","onpromptaction","onpromptdismiss","onpush","onpushsubscriptionchange","onquotaoverflow","onratechange","onreading","onreadingerror","onreadystatechange","onredraw","onreflectionchange","onrejectionhandled","onrelease","onremove","onremovesourcebuffer","onremovetrack","onrepeat","onreset","onresize","onresourcetimingbufferfull","onresult","onresume","onrtctransform","onscreenschange","onscroll","onscrollend","onsecuritypolicyviolation","onseeked","onseeking","onselect","onselectedcandidatepairchange","onselectend","onselectionchange","onselectstart","onserviceadded","onservicechanged","onserviceremoved","onshippingaddresschange","onshippingoptionchange","onshow","onsignalingstatechange","onsinkchange","onslotchange","onsnapchanged","onsnapchanging","onsoundend","onsoundstart","onsourceclose","onsourceended","onsourceopen","onspeechend","onspeechstart","onsqueeze","onsqueezeend","onsqueezestart","onssrcchange","onstalled","onstart","onstartstreaming","onstatechange","onstop","onstorage","onstream","onsubmit","onsuccess","onsuspend","onsync","onterminate","ontextformatupdate","ontextupdate","ontimeout","ontimeupdate","ontoggle","ontonechange","ontoolactivated","ontoolcancel","ontoolchange","ontouchcancel","ontouchend","ontouchmove","ontouchstart","ontrack","ontransitioncancel","ontransitionend","ontransitionrun","ontransitionstart","onuncapturederror","onunhandledrejection","onunload","onunmute","onupdate","onupdateend","onupdatefound","onupdatestart","onupgradeneeded","onvalidationstatuschange","onversionchange","onvisibilitychange","onvoiceschanged","onvolumechange","onwaiting","onwaitingforkey","onwebkitanimationend","onwebkitanimationiteration","onwebkitanimationstart","onwebkittransitionend","onwheel","onzoomlevelchange"])});function je(e,t,n,r,s){let o=t.normalize("NFC");if(o==="__proto__")throw ke(r,s,'"__proto__" cannot be a key: it would not be data');if(Object.hasOwn(e,o))throw ke(r,s,`"${o}" is written twice, and one of them would be lost`);e[o]=n}function ke(e,t,n){let r=Yc(t)?.start;return new Ft(n,r===void 0?null:hi(e.text,r))}function Yc(e){let t=ci(e);return t?{end:t.end.offset,start:t.start.offset}:null}function wt(e,t,n){let r=e.spans?Yc(n):null;if(r)e.spans?.set(t,r)}function K$(e,t,n){let r=e.tokens&&n?Yc(n):null;if(r)e.tokens?.names.set(t,r)}function Jt(e,t,n){let r=e.tokens&&n?Yc(n.value):null;if(r){let s=n?.value.representation,o=s===void 0?r.start:r.end-s.length;e.tokens?.values.set(t,{end:r.end,start:o})}}function ks(e){return e.entries.filter((t)=>!t.name)}function nt(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function yi(e,t){let n=t.getTag();if(n!==null&&!Y$.has(n))throw ke(e,t,`(${n}) is not an annotation Jx Notation has`);if(n==="ref")throw ke(e,t,"(ref) annotates a value, and this is a name");return n}function ns(e,t){let n=t.getTag(),r=t.getValue();if(n!==null&&n!=="ref")throw ke(e,t,`(${n}) cannot annotate a value here; only (ref) can`);if(Ie(r)){if(!Number.isFinite(r))throw ke(e,t,"JSON has no way to hold #inf or #nan");if(Number.isInteger(r)&&!Number.isSafeInteger(r))throw ke(e,t,"This number is too large to survive being read as JSON")}if(n==="ref"){if(!k(r))throw ke(e,t,"(ref) needs a string");return{$ref:r}}return r}function Ln(e,t){return t.entries.filter((n)=>!n.name).map((n)=>ns(e,n))}function Fn(e){return e.entries.filter((t)=>t.name)}function Vt(e){return e.children?.nodes??[]}function _r(e){return e.getName()??""}function AT(e,t,n){let r={$prototype:"Function"},s=Ln(e,t),o=Vt(t);for(let a of Fn(t))je(r,_r(a),ns(e,a),e,a),Jt(e,`${n}/${nt(_r(a))}`,a);let i=e.tokens?ks(t):[];if(o.length>0){if(s.length>0)je(r,"parameters",s,e,t);je(r,"body",Fp(e,o,`${n}/body`),e,t)}else if(s.length>0){let a=s.at(-1)??null,l=s.slice(0,-1);if(l.length>0)je(r,"parameters",l,e,t);je(r,"body",a,e,t),Jt(e,`${n}/body`,i.pop())}for(let[a,l]of i.entries())Jt(e,`${n}/parameters/${a}`,l);return wt(e,n,t),r}function CT(e,t,n){let r={$prototype:"Function",$src:"#client"};if(Ln(e,t).length>0||Vt(t).length>0)throw ke(e,t,"(export) names a function the document's script exports, and holds no body of its own");for(let s of Fn(t))je(r,_r(s),ns(e,s),e,s),Jt(e,`${n}/${nt(_r(s))}`,s);if(!Object.hasOwn(r,"$export"))r.$export=t.getName().normalize("NFC");return wt(e,n,t),r}function RT(e,t,n){if(Ln(e,t).length>0||Vt(t).length>0)throw ke(e,t,"(server) names a function the document's server script exports. Its arguments are written name=value");let r={$export:t.getName().normalize("NFC"),$src:"#server",timing:"server"},s=Fn(t);if(s.length>0){let o={};for(let i of s){let a=_r(i);je(o,a,ns(e,i),e,i),wt(e,`${n}/arguments/${nt(a)}`,i),Jt(e,`${n}/arguments/${nt(a)}`,i)}r.arguments=o}return wt(e,n,t),r}function NT(e,t,n){let r={};for(let l of Fn(t)){let c=_r(l);if(je(r,c,ns(e,l),e,l),c!=="timing"||r[c]!=="server")throw ke(e,l,"A script takes timing=server, and nothing else")}let s=Ln(e,t),[o]=s;if(s.length!==1||!k(o)||Vt(t).length>0)throw ke(e,t,"A script holds one string, which is the text of its module");let i=Object.hasOwn(r,"timing")?"server":"client",a=n.$script;if(!L(a)||!G$.has(a))a={},G$.add(a),je(n,"$script",a,e,t);je(a,i,o,e,t),wt(e,`/$script/${i}`,t),Jt(e,`/$script/${i}`,ks(t)[0])}function X$(e,t,n){for(let[r,s]of(e.tokens?ks(n):[]).entries())Jt(e,`${t}/${r}`,s)}function Fp(e,t,n,r=0){return t.map((s,o)=>{if(s.getName()!=="-")throw ke(e,s,`A list holds only "-" items, and this is "${s.getName()}"`);return Dn(e,s,`${n}/${r+o}`)})}function Dn(e,t,n){let r=yi(e,t);if(wt(e,n,t),r==="fn")return AT(e,t,n);if(r==="export")return CT(e,t,n);if(r==="server")return RT(e,t,n);let s=Ln(e,t),o=Fn(t),i=Vt(t);if(r==="array"){if(o.length>0)throw ke(e,t,"(array) holds items, and these are named");return X$(e,n,t),[...s,...Fp(e,i,n,s.length)]}if(r!=="object"){if(s.length>1){if(o.length>0||i.length>0)throw ke(e,t,"A list of values cannot also have names or a block");return X$(e,n,t),s}if(s.length===1){if(o.length>0||i.length>0)throw ke(e,t,"A value cannot also have names or a block");return Jt(e,n,ks(t)[0]),s[0]??null}if(i.length>0&&o.length===0&&i.every((l)=>l.getName()==="-"))return Fp(e,i,n)}else if(s.length>0)throw ke(e,t,"(object) holds names, and this is a value");let a={};for(let l of o){let c=_r(l);je(a,c,ns(e,l),e,l),wt(e,`${n}/${nt(c)}`,l),K$(e,`${n}/${nt(c)}`,l.name),Jt(e,`${n}/${nt(c)}`,l)}for(let l of i){let c=l.getName();je(a,c,Dn(e,l,`${n}/${nt(c)}`),e,l),K$(e,`${n}/${nt(c)}`,l.name)}return a}function Zc(e,t,n){let r={};if(wt(e,n,t),Ln(e,t).length>0)throw ke(e,t,"A style block holds declarations, and this is a value");for(let s of Fn(t)){let o=_r(s);je(r,o,ns(e,s),e,s),wt(e,`${n}/${nt(o)}`,s),Jt(e,`${n}/${nt(o)}`,s)}for(let s of Vt(t)){let o=s.getName(),i=`${n}/${nt(o)}`,a=Vt(s);if(s.getTag()==="array"||a.length>0&&a.every((c)=>c.getName()==="-")){je(r,o,Dn(e,s,i),e,s);continue}let l=Ln(e,s);if(l.length>1)throw ke(e,s,`"${o}" has more than one value. A selector with a space in it needs quotes`);if(l.length===1){if(Fn(s).length>0||Vt(s).length>0)throw ke(e,s,`"${o}" has a value and names. A selector with a space in it needs quotes`);je(r,o,l[0]??null,e,s),wt(e,i,s),Jt(e,i,ks(s)[0])}else je(r,o,Zc(e,s,i),e,s)}return r}function Xc(e,t,n){let r=Vt(t);if(r.length!==1||!r[0])throw ke(e,t,`"${t.getName()}" holds one element`);return Q$(e,r[0],n)}function Z$(e,t,n){let r={$prototype:"Array"};if(wt(e,n,t),Ln(e,t).length>0)throw ke(e,t,"$array holds names and one element, and this is a value");for(let s of Fn(t)){let o=_r(s),i=o.startsWith(".")?o.slice(1):o;je(r,i,ns(e,s),e,s),Jt(e,`${n}/${nt(i)}`,s)}if(Vt(t).length>0)je(r,"map",Xc(e,t,`${n}/map`),e,t);return r}function Q$(e,t,n){let r=t.getName();if(r==="-"){let s=Ln(e,t);if(s.length!==1||Fn(t).length>0||Vt(t).length>0)throw ke(e,t,'"-" is one piece of text or one (ref)');return wt(e,n,t),Jt(e,n,ks(t)[0]),s[0]??null}if(r==="$array")return Z$(e,t,n);return Vp(e,t,n)}function TT(e,t,n,r){let s=yi(e,n);if(t==="map")return Xc(e,n,r);if(t==="cases"){let o={};for(let i of Vt(n)){let a=i.getName();je(o,a,Xc(e,i,`${r}/${nt(a)}`),e,i)}return o}if(t==="children"&&s!=="array"&&Vt(n).length>0)return Xc(e,n,r);return Dn(e,n,r)}function Vp(e,t,n){let r={},s=t.getName(),o=yi(e,t);if(wt(e,n,t),o!==null)throw ke(e,t,`(${o}) cannot annotate an element`);let i=Ln(e,t);if(s==="$element"){let[l,c,...u]=i;if(u.length>0)throw ke(e,t,"$element takes at most a tag and a text value");if(l!==void 0)je(r,"tagName",l,e,t);if(c!==void 0)je(r,"textContent",c,e,t),Jt(e,`${n}/textContent`,ks(t)[1])}else{if(s.startsWith("$"))throw ke(e,t,`"${s}" is not a kind of element`);if(je(r,"tagName",s,e,t),i.length>1)throw ke(e,t,"An element has one text value. A list of them needs a block");if(i[0]!==void 0)je(r,"textContent",i[0],e,t),wt(e,`${n}/textContent`,t),Jt(e,`${n}/textContent`,ks(t)[0])}JT(e,t,r,n);let a=[];for(let l of Vt(t))MT(e,l,r,a,n);if(a.length>0)je(r,"children",a,e,t);return r}function eS(e){let{attributes:t}=e;if(L(t))return t;let n={};return e.attributes=n,n}function JT(e,t,n,r){for(let s of Fn(t)){let o=_r(s),i=s.getTag();if(i==="fn")throw ke(e,s,"A function has a block form: (fn)name, on a line of its own");let a=ns(e,s);if(o.startsWith(".")||o.startsWith("$")){let l=o.startsWith(".")?o.slice(1):o;je(n,l,a,e,s),wt(e,`${r}/${nt(l)}`,s),Jt(e,`${r}/${nt(l)}`,s)}else if(o.startsWith("on")&&i==="ref")je(n,o,a,e,s),wt(e,`${r}/${nt(o)}`,s),Jt(e,`${r}/${nt(o)}`,s);else if(o.startsWith("on")&&U$.has(o))throw ke(e,s,`${o} needs (ref)"pointer", or a function on a line of its own: (fn)${o} "…"`);else je(eS(n),o,a,e,s),wt(e,`${r}/attributes/${nt(o)}`,s),Jt(e,`${r}/attributes/${nt(o)}`,s)}}function MT(e,t,n,r,s){let o=t.getName(),i=yi(e,t),a=(l)=>`${s}/${nt(l)}`;if(i==="fn"||i==="on"){if(!o.startsWith("on"))throw ke(e,t,`(${i}) in an element marks a handler, and "${o}" is not one`);je(n,o,Dn(e,t,a(o)),e,t)}else if(o==="script"){if(s!=="")throw ke(e,t,`"script" is the document's module, and is written in its root element. A <script> element is $element "script"`);if(i!==null)throw ke(e,t,`(${i}) cannot annotate a script`);NT(e,t,n)}else if(o==="state")je(n,"state",Dn(e,t,a("state")),e,t);else if(o==="style")je(n,"style",Zc(e,t,a("style")),e,t);else if(o==="attributes"){let l=Dn(e,t,a("attributes"));if(L(l))for(let[c,u]of Object.entries(l))je(eS(n),c,u,e,t);else je(n,"attributes",l,e,t)}else if(o.startsWith(".")){let l=o.slice(1);je(n,l,TT(e,l,t,a(l)),e,t)}else if(o.startsWith("$")&&o!=="$array"&&o!=="$element")je(n,o,Dn(e,t,a(o)),e,t);else{if(OT.has(o))throw ke(e,t,`"${o}" is reserved here`);r.push(Q$(e,t,`${s}/children/${r.length}`))}}function qp(e,t){return Vt(t).map((n,r)=>{let s=`/$head/${r}`;return n.getName()==="-"?Dn(e,n,s):Vp(e,n,s)})}function Hp(e){let t=kT.exec(e);if(t)throw new Ft(`A raw control character (U+${t[0].codePointAt(0)?.toString(16).toUpperCase().padStart(4,"0")}) cannot be in a Jx Notation file. Escape it, as \\u{1b}`,hi(e,t.index));try{return _s(e,{storeLocations:!0})}catch(n){let s=(n instanceof Ce?n.errors?.[0]??n:null)?.start,o=n instanceof Error?n.message:String(n);throw new Ft(o.split(`
|
|
22
|
+
`)[0]??o,s?hi(e,s.offset):null)}}function tS(e){if(ni(e.text)==="project")throw new Ft('This is a project file: its first node is "project". A document has an element there, and a <project> element is $element "project"');let n=Hp(e.text),r={},s=null;for(let o of n.nodes){let i=o.getName();if(i==="$head"&&o.getTag()===null)je(r,i,qp(e,o),e,o);else if(i.startsWith("$")&&i!=="$array"&&i!=="$element")je(r,i,Dn(e,o,`/${nt(i)}`),e,o),wt(e,`/${nt(i)}`,o);else if(s)throw ke(e,o,"A document has one root element, and this is a second");else s=o}if(s){let o=s.getName()==="$array"?Z$(e,s,""):Vp(e,s,"");for(let[i,a]of Object.entries(o))je(r,i,a,e,s)}return ei(r)}function vo(e,t){try{return tS({spans:null,text:e})}catch(n){throw t!==void 0&&n instanceof Ft?n.inFile(t):n}}function Wp(e){let t=new Map;return{document:tS({spans:t,text:e}),spans:t}}var kT,Y$,OT,G$;var Wa=J(()=>{Gc();ce();Lt();Ta();gi();z$();kT=/(?![\t\n\v\f\r])\p{Cc}/u,Y$=new Set(["array","export","fn","object","on","ref","server"]),OT=new Set(["attributes","script","state","style"]);G$=new WeakSet});function rs(e){return e.toLowerCase().endsWith(".jxn")}function Vn(e){return e.endsWith(".json")||rs(e)}function kn(e,t){return rs(t)?vo(e,t):Yb(e,t)}var Qc=J(()=>{Lt();Wa()});function LT(e){let t={comments:0,escapes:[]},n=DT.exec(e)?.[0].length??0;while(n<e.length)if(e.startsWith("//",n)){t.comments+=1;let r=e.indexOf(`
|
|
23
|
+
`,n);n=r===-1?e.length:r}else if(e.startsWith("/*",n)){t.comments+=1;let r=e.indexOf("*/",n+2);n=r===-1?e.length:r+2}else if(e.startsWith("/-",n))t.comments+=1,n+=2;else if(e.charAt(n)==="#"&&/^#+"/u.test(e.slice(n,n+16))){let[r=""]=/^#+/u.exec(e.slice(n))??[],s=n+r.length,o=e.startsWith('"""',s)?'"""':'"',i=e.indexOf(o+r,s+o.length);n=i===-1?e.length:i+o.length+r.length}else if(e.charAt(n)==='"'){let r=e.startsWith('"""',n)?'"""':'"';n+=r.length;while(n<e.length&&!e.startsWith(r,n))if(e.charAt(n)==="\\")t.escapes.push(n),n+=2;else n+=1;n+=r.length}else n+=1;return t}function Bp(e){return LT(e).escapes.flatMap((t)=>{let n=IT.get(e.charAt(t+1));return n?[{...hi(e,t),message:n}]:[]})}var IT,DT;var nS=J(()=>{gi();IT=new Map([["b",String.raw`\b in a quoted string is a backspace, not a word boundary. Use a raw string, like #"…"#, if this is a pattern.`],["s",String.raw`\s in a quoted string is a space, not whitespace. Use a raw string, like #"…"#, if this is a pattern.`]]),DT=/^\uFEFF?\s*\/-[^\S\n]*kdl-version[^\S\n]+\d+[^\S\n]*(?:\n|$)/u});function xi(e,t=!1){if(Array.isArray(e))return`[${e.map((s)=>xi(s,t)).join(",")}]`;if(!L(e))return e===void 0?"null":JSON.stringify(e);return`{${(t?Object.keys(e):Object.keys(e).toSorted()).map((s)=>`${JSON.stringify(s)}:${xi(e[s],t||s==="style")}`).join(",")}}`}function FT(e,t){let n=e;for(let r of t.split("/").slice(1)){let s=r.replaceAll("~1","/").replaceAll("~0","~");if(Array.isArray(n))n=n[Number(s)];else n=L(n)?n[s]:void 0}return n}function VT({spans:e}){let t=new Map;for(let[n,r]of e){let s=t.get(r.start);if(s===void 0||n.length<s.length)t.set(r.start,n)}return t}function rS(e,t){let n=VT(e),r=new Map;for(let[s,o]of n)r.set(s,xi(FT(e.document,o)));return{meanings:r,pointers:n,text:t}}function ss(e){let t=ci(e);return{end:t?.end.offset??0,start:t?.start.offset??0}}function tu(e,t){let{end:n,start:r}=ss(e);return t.slice(r,n).trimEnd()}function eu(e,t){let{end:n,start:r}=ss(e);return`${e.leading??" "}${t.slice(r,n).trimEnd()}`}function Gp(e){return e.children?.nodes??[]}function Up(e){let t=e.entries.map((o)=>`${o.getName()??""}=(${o.getTag()??""})${JSON.stringify(o.getValue())}`),n=t.filter((o)=>!o.startsWith("=")).toSorted(),r=t.filter((o)=>o.startsWith("=")),s=Gp(e).map((o)=>Up(o));return`(${e.getTag()??""})${e.getName()} ${[...n,...r].join(" ")} {${s.join(";")}}`}function zp(e,t,n){if(Up(t)===Up(n))return!0;let r=e.previous.meanings.get(ss(t).start);return r!==void 0&&r===e.next.meanings.get(ss(n).start)}function sS(e){let n=e.entries.filter((r)=>["$id","key"].includes(r.getName()??"")).map((r)=>JSON.stringify(r.getValue()));return`(${e.getTag()??""})${e.getName()} ${n.join(" ")}`}function oS(e,t,n){let r=e.length+1,s=t.length+1,o=new Int32Array(r*s);for(let c=e.length-1;c>=0;c-=1)for(let u=t.length-1;u>=0;u-=1){let d=e[c],p=t[u];o[c*s+u]=d!==void 0&&p!==void 0&&n(d,p)?(o[(c+1)*s+u+1]??0)+1:Math.max(o[(c+1)*s+u]??0,o[c*s+u+1]??0)}let i=[],a=0,l=0;while(a<e.length&&l<t.length){let c=e[a],u=t[l];if(c!==void 0&&u!==void 0&&n(c,u))i.push([a,l]),a+=1,l+=1;else if((o[(a+1)*s+l]??0)>=(o[a*s+l+1]??0))a+=1;else l+=1}return i}function qT(e,t,n){let r=new Map,s=new Set,o=(c,u)=>{let d=t[c];if(d)r.set(u,d),s.add(c)},i=oS(t,n,(c,u)=>zp(e,c,u)),a=0,l=0;for(let[c,u]of[...i,[t.length,n.length]]){let d=oS(t.slice(a,c),n.slice(l,u),(p,m)=>sS(p)===sS(m));for(let[p,m]of d)o(a+p,l+m);if(c<t.length)o(c,u);a=c+1,l=u+1}for(let[c,u]of n.entries())if(!r.has(c)){let d=t.findIndex((p,m)=>!s.has(m)&&zp(e,p,u));if(d!==-1)o(d,c)}return r}function Xp(e){let t=e.leading??"";return t.slice(t.lastIndexOf(`
|
|
24
|
+
`)+1)}function HT(e,t,n){return e.split(`
|
|
25
25
|
`).map((r,s)=>s>0&&r.startsWith(t)?n+r.slice(t.length):r).join(`
|
|
26
|
-
`)}function
|
|
27
|
-
${p.join("")}${r}}`}function
|
|
26
|
+
`)}function WT(e,t,n){let r=[...n],s=(i)=>{let a=i.getName(),l=r.findIndex((c)=>c.getName()===a);return l===-1?void 0:r.splice(l,1)[0]},o="";for(let i of t.entries){let a=s(i);if(a){let l=a.getTag()===i.getTag()&&a.getValue()===i.getValue();o+=l?eu(i,e.previous.text):`${i.leading??" "}${eu(a,e.next.text).trimStart()}`}}for(let i of r)o+=` ${eu(i,e.next.text).trimStart()}`;return o}function BT(e,t,n){let r=new Map;for(let o of Gp(t)){let i=e.previous.pointers.get(ss(o).start);if(i!==void 0)r.set(i,o)}let s=new Map;for(let o of n.entries){let i=e.next.pointers.get(ss(o).start),a=i===void 0?void 0:r.get(i);if(a&&o.getName()!==null)s.set(a,o)}return s}function UT(e,t,n){let{text:r}=e.previous,s=eu(n,e.next.text).trimStart().slice(`${n.getName()}=`.length),[o]=t.entries;if(o?.getName()===null&&t.entries.length===1&&!t.children){if(o.getValue()===n.getValue()&&o.getTag()===n.getTag())return tu(t,r);return`${Kp(t,r)}${o.leading??" "}${s}`}return`${Kp(t,r)} ${s}`}function Kp(e,t){let{start:n}=ss(e),[r]=e.entries;if(r)return t.slice(n,ss(r).start-(r.leading??"").length);let s=e.children&&ci(e.children);if(s)return t.slice(n,s.start.offset-1).trimEnd();return tu(e,t)}function zT(e,t,n,r){let s=BT(e,t,n),o=new Set(s.values()),i=n.entries.filter((m)=>!o.has(m)),a=`${Kp(t,e.previous.text)}${WT(e,t,i)}`,l=Gp(n);if(l.length===0&&s.size===0)return a;let c=l[0]?Xp(l[0]):`${r} `,u=t.children,d=t.beforeChildren===""?" ":t.beforeChildren??" ";if(u&&u.nodes.length>0&>(u,e.previous.text,t)){let m=`${r}${KT(u,r)}`;return`${a}${d}{${aS(e,u,l,m,c,s)}}`}let p=l.map((m)=>iS(e,m,c,`${r} `));return`${a}${d}{
|
|
27
|
+
${p.join("")}${r}}`}function KT(e,t){let[n]=e.nodes,r=n?Xp(n):"";return r.startsWith(t)?r.slice(t.length):" "}function GT(e,t,n){let{end:r,start:s}=ss(n),[o]=e.nodes;return o!==void 0&&(o.leading??"").includes(`
|
|
28
28
|
`)&&t.slice(s,r).includes(`
|
|
29
|
-
`)}function
|
|
30
|
-
`}function
|
|
31
|
-
`),u=
|
|
29
|
+
`)}function iS(e,t,n,r){return`${r}${HT(tu(t,e.next.text),n,r)}
|
|
30
|
+
`}function aS(e,t,n,r,s,o){let i=t.nodes.filter((g)=>!o.has(g)),a=qT(e,i,n),l=t.nodes[0]?.leading??"",c=l.indexOf(`
|
|
31
|
+
`),u=c===-1?"":l.slice(0,c+1),d=u,p=-1,m=()=>{if(d!==""&&!d.endsWith(`
|
|
32
32
|
`)&&!d.endsWith(";"))d+=`
|
|
33
|
-
`},
|
|
34
|
-
`)||d===u||d.endsWith(";"))){d+=`${
|
|
33
|
+
`},y=(g,x)=>{let P=t.nodes.indexOf(g),w=P===p+1||P>p;p=Math.max(p,P);let E=g===t.nodes[0]?l.slice(u.length):g.leading??"";if(w&&(E.includes(`
|
|
34
|
+
`)||d===u||d.endsWith(";"))){d+=`${E}${x}${g.trailing??""}`;return}if(!d.endsWith(`
|
|
35
35
|
`))d+=`
|
|
36
|
-
`;let
|
|
37
|
-
`)?
|
|
38
|
-
`)t+=String.raw`\n`;else if(n==="\t")t+=String.raw`\t`;else if(n==="\r")t+=String.raw`\r`;else if(
|
|
36
|
+
`;let j=(g.trailing??"").replace(/^;/u,"");d+=`${E.includes(`
|
|
37
|
+
`)?E:r}${x}${j}`},S=(g)=>{for(let[x,P]of t.nodes.entries()){let w=o.get(P);if(w&&x<g&&x>p)m(),y(P,UT(e,P,w))}};for(let[g,x]of n.entries()){let P=a.get(g);if(P){S(t.nodes.indexOf(P)),m();let w=zp(e,P,x)?tu(P,e.previous.text):zT(e,P,x,Xp(P));y(P,w)}else m(),d+=iS(e,x,s,r)}return S(t.nodes.length),`${d}${t.trailing??""}`}function nu(e,t,n){let r;try{r=n(e)}catch{return t}let s=n(t),o=xi(s.document);if(xi(r.document)===o)return e;let i={next:rS(s,t),previous:rS(r,e)},a=aS(i,_s(e,{storeLocations:!0}),_s(t,{storeLocations:!0}).nodes,"","",new Map);try{return xi(n(a).document)===o?a:t}catch{return t}}var ru=J(()=>{Gc();ce()});function fS(e){return!/\p{Cs}/u.test(e)}function dS(e,t){try{return _s(`x ${e}`).nodes[0]?.entries[0]?.getValue()===t}catch{return!1}}function ou(e){let t='"';for(let n of e)if(n==='"')t+=String.raw`\"`;else if(n==="\\")t+=String.raw`\\`;else if(n===`
|
|
38
|
+
`)t+=String.raw`\n`;else if(n==="\t")t+=String.raw`\t`;else if(n==="\r")t+=String.raw`\r`;else if(uS.test(n))t+=`\\u{${n.codePointAt(0)?.toString(16)}}`;else t+=n;return`${t}"`}function pS(e,t){let n="#";while(e.includes(t+n))n+="#";return n}function ZT(e,t){if(XT.test(e))return null;let n=pS(e,'"""'),r=`${t}${qt}`,s=e.split(`
|
|
39
39
|
`).map((i)=>i===""?"":r+i),o=`${n}"""
|
|
40
40
|
${s.join(`
|
|
41
41
|
`)}
|
|
42
|
-
${r}"""${n}`;return
|
|
43
|
-
`)){let r=
|
|
44
|
-
`))){let p=`${o} ${u.join(" ")}`;if(p.length<=
|
|
45
|
-
`)?null:`${
|
|
46
|
-
`))break;i.push(`${
|
|
47
|
-
`)})}function
|
|
48
|
-
`)&&!e.startsWith("on")&&!e.startsWith("$")&&!e.startsWith(".")}function
|
|
49
|
-
`))i.push(...
|
|
50
|
-
`))t.push(...
|
|
51
|
-
`)}`);else if(i.startsWith("$"))n.push(...
|
|
42
|
+
${r}"""${n}`;return dS(o,e)?o:null}function su(e,t,n){if(!fS(e))throw new Ft(`${n} holds a lone surrogate, which Jx Notation has no way to spell`);if(cS.test(e))return e;if(e.includes(`
|
|
43
|
+
`)){let r=ZT(e,t);if(r)return r}else if((e.includes("\\")||e.includes('"'))&&!uS.test(e)){let r=pS(e,'"'),s=`${r}"${e}"${r}`;if(dS(s,e))return s}return ou(e)}function Mt(e,t){if(!fS(e))throw new Ft(`${t} is a key with a lone surrogate, which Jx Notation cannot spell`);return cS.test(e)?e:ou(e)}function ft(e,t,n){if(e===null)return"#null";if(e===!0)return"#true";if(e===!1)return"#false";if(Ie(e))return Object.is(e,-0)?"-0":String(e);if(k(e))return su(e,t,n);return Ua(e)?`(ref)${ou(e.$ref)}`:null}function mS(e){if(!Ht(e)||e.$prototype!=="Function")return!1;let{$prototype:t,body:n,parameters:r,...s}=e,o=Object.values(s).every((c)=>ft(c,"","")!==null),i=r===void 0||Array.isArray(r)&&r.length>0&&r.every((c)=>k(c))&&n!==void 0,a=n===void 0||k(n)||Array.isArray(n),l=Array.isArray(n)&&n.length===0;return o&&i&&a&&!l}function hS(e,t,n,r){let{$prototype:s,body:o,parameters:i,...a}=t,l=[`${n}(fn)${Mt(e,r)}`];for(let[c,u]of Object.entries(a))l.push(`${Mt(c,r)}=${ft(u,n,et(r,c))}`);if(Array.isArray(i))for(let c of i)l.push(su(String(c),n,et(r,"parameters")));if(k(o))l.push(su(o,n,et(r,"body")));else if(Array.isArray(o))return[`${l.join(" ")} {`,...o.flatMap((c,u)=>On("-",c,n+qt,et(et(r,"body"),u))),`${n}}`];return[l.join(" ")]}function QT(e){if(!Ht(e)||e.$prototype!=="Function"||e.$src!=="#client"||!k(e.$export)||Object.hasOwn(e,"body")||Object.hasOwn(e,"parameters"))return!1;return Object.values(e).every((t)=>ft(t,"","")!==null)}function eJ(e,t,n,r){let{$export:s,$prototype:o,$src:i,...a}=t,l=[`${n}(export)${Mt(e,r)}`];if(s!==e)l.push(`$export=${ft(s,n,et(r,"$export"))}`);for(let[c,u]of Object.entries(a))l.push(`${Mt(c,r)}=${ft(u,n,et(r,c))}`);return[l.join(" ")]}function nJ(e,t){if(!Ht(t)||t.timing!=="server"||t.$src!=="#server"||t.$export!==e||!Object.keys(t).every((s)=>tJ.has(s)))return!1;let{arguments:n}=t;if(n===void 0)return!0;let r=Ht(n)?Object.values(n):[];return r.length>0&&r.every((s)=>ft(s,"","")!==null)}function rJ(e,t,n,r){let s=[`${n}(server)${Mt(e,r)}`],o=et(r,"arguments"),i=Ht(t.arguments)?t.arguments:{};for(let[a,l]of Object.entries(i))s.push(`${Mt(a,o)}=${ft(l,n,et(o,a))}`);return[s.join(" ")]}function On(e,t,n,r){let s=Mt(e,r),o=n+s,i=ft(t,n,r);if(i!==null)return[`${o} ${i}`];if(QT(t))return eJ(e,t,n,r);if(nJ(e,t))return rJ(e,t,n,r);if(mS(t))return hS(e,t,n,r);if(Array.isArray(t)){if(t.length===0)return[`${n}(array)${s}`];let u=t.map((p,m)=>ft(p,n,et(r,m)));if(t.length>1&&u.every((p)=>p!==null&&!p.includes(`
|
|
44
|
+
`))){let p=`${o} ${u.join(" ")}`;if(p.length<=Yp)return[p]}return[`${o} {`,...t.flatMap((p,m)=>On("-",p,n+qt,et(r,m))),`${n}}`]}let a=Ht(t)?Object.entries(t):[];if(a.length===0)return[`${o} {}`];let l=a.every(([u])=>u==="-")?`${n}(object)${s}`:o,c=a.map(([u,d])=>{let p=ft(d,n,et(r,u));return p===null||p.includes(`
|
|
45
|
+
`)?null:`${Mt(u,r)}=${p}`});if(c.every((u)=>u!==null)){let u=`${l} ${c.join(" ")}`;if(u.length<=Yp)return[u]}return[`${l} {`,...a.flatMap(([u,d])=>On(u,d,n+qt,et(r,u))),`${n}}`]}function gS(e,t,n,r){let s=Object.entries(t),o=n+Mt(e,r);if(s.length===0)return[`${o} {}`];let i=[],a=0;for(let[p,m]of s){let y=ft(m,n,et(r,p));if(y===null||y.includes(`
|
|
46
|
+
`))break;i.push(`${Mt(p,r)}=${y}`),a+=1}let l=`${o} ${i.join(" ")}`,c=i.length>0&&l.length<=Yp,u=c?a:0,d=s.slice(u).flatMap(([p,m])=>{if(Ht(m)&&!Ua(m))return gS(p,m,n+qt,et(r,p));return On(p,m,n+qt,et(r,p))});if(c&&d.length===0)return[l];return[`${c?l:o} {`,...d,`${n}}`]}function sJ(e){if(!Ht(e)||e.$prototype!=="Array"||!Ht(e.map))return!1;let{$prototype:t,map:n,...r}=e;return Object.values(r).every((s)=>{let o=ft(s,"","");return o!==null&&!o.includes(`
|
|
47
|
+
`)})}function oJ(e,t,n){let{$prototype:r,map:s,...o}=e,i=[`${t}$array`];for(let[a,l]of Object.entries(o))i.push(`${Mt(a,n)}=${ft(l,t,et(n,a))}`);return[`${i.join(" ")} {`,...Ba(s??null,t+qt,et(n,"map")),`${t}}`]}function Ba(e,t,n){let r=ft(e,t,n);if(r!==null)return[`${t}- ${r}`];if(sJ(e))return oJ(e,t,n);if(Ht(e))return Zp(e,t,n);throw new Ft(`${n} is a list inside a list of children, which has no spelling`)}function iJ(e,t,n){let{tagName:r}=e;if(!k(r))return`${t}$element`;if(YT.has(r)||r.startsWith("$")||r.startsWith("."))return`${t}$element ${ou(r)}`;return t+Mt(r,n)}function aJ(e,t){return t!==null&&!t.includes(`
|
|
48
|
+
`)&&!e.startsWith("on")&&!e.startsWith("$")&&!e.startsWith(".")}function lJ(e,t){let n=Ht(e)?Object.entries(e):[],r=[];for(let[s,o]of n){if(s!=="client"&&s!=="server"||!k(o))return null;let i=s==="server"?"timing=server ":"";r.push(`${t}script ${i}${su(o,t,`/$script/${s}`)}`)}return r.length>0?r:null}function Zp(e,t,n,r=[]){let s=[iJ(e,t,n)],o=t+qt,i=[...r],a={},l=null;for(let[c,u]of Object.entries(e)){let d=et(n,c);if(c==="tagName"&&k(u))continue;if(c==="children")continue;if(c==="textContent"){let p=ft(u,t,d);if(p===null||!k(e.tagName))lS(s,i,c,u,o,t,d);else l=p}else if(c==="attributes"&&Ht(u))for(let[p,m]of Object.entries(u)){let y=ft(m,t,et(d,p));if(aJ(p,y))s.push(`${Mt(p,d)}=${y}`);else a[p]=m}else if(c==="state")i.push(...On("state",u,o,d));else if(c==="style"&&Ht(u))i.push(...gS("style",u,o,d));else if(c.startsWith("on")&&Ua(u))s.push(`${Mt(c,d)}=${ft(u,t,d)}`);else if(c.startsWith("on"))i.push(...mS(u)?hS(c,u,o,d):On(c,u,o,d).map((p,m)=>m===0?p.replace(o,`${o}(on)`):p));else if(c.startsWith("$")){let p=ft(u,t,d);if(p===null||p.includes(`
|
|
49
|
+
`))i.push(...On(c,u,o,d));else s.push(`${Mt(c,d)}=${p}`)}else lS(s,i,c,u,o,t,d)}if(Object.keys(a).length>0)i.push(...On("attributes",a,o,et(n,"attributes")));if(i.push(...cJ(e.children,o,et(n,"children"))),l!==null)s.push(l);return i.length===0?[s.join(" ")]:[`${s.join(" ")} {`,...i,`${t}}`]}function cJ(e,t,n){if(e===void 0)return[];if(Array.isArray(e)){if(e.length===0)return[`${t}(array).children`];return e.flatMap((s,o)=>Ba(s,t,et(n,o)))}let r=ft(e,t,n);if(r!==null)return[`${t}.children ${r}`];return[`${t}.children {`,...Ba(e,t+qt,n),`${t}}`]}function lS(e,t,n,r,s,o,i){let a=Mt(`.${n}`,i);if(n==="map"&&Ht(r)){t.push(`${s}${a} {`,...Ba(r,s+qt,i),`${s}}`);return}if(n==="cases"&&Ht(r)){t.push(`${s}${a} {`);for(let[c,u]of Object.entries(r))t.push(`${s}${qt}${Mt(c,i)} {`,...Ba(u,s+qt+qt,et(i,c)),`${s}${qt}}`);t.push(`${s}}`);return}let l=ft(r,o,i);if(l===null||l.includes(`
|
|
50
|
+
`))t.push(...On(`.${n}`,r,s,i));else e.push(`${a}=${l}`)}function yS(e,t){return["$head {",...e.flatMap((n,r)=>Ht(n)&&!Ua(n)&&k(n.tagName)&&!n.$ref?Zp(n,t,`/$head/${r}`):On("-",n,t,`/$head/${r}`)),"}"]}function uJ(e){let{document:t,spans:n}=Wp(e);return{document:L(t)?t:null,spans:n}}function Qp(e,t){let n=fJ(e);return t===void 0?n:nu(t,n,uJ)}function fJ(e){if(!L(e))throw new Ft("A document is an object");let t=e,n=["/- kdl-version 2"],r={},s=Object.keys(t).some((i)=>!i.startsWith("$")),o=[];for(let[i,a]of Object.entries(t)){let l=i==="$script"&&s?lJ(a,qt):null;if(l)o=l;else if(i==="$head"&&Array.isArray(a))n.push(...yS(a,qt));else if(i==="$head")n.push(`(object)${On(i,a,"","/$head").join(`
|
|
51
|
+
`)}`);else if(i.startsWith("$"))n.push(...On(i,a,"",et("",i)));else r[i]=a}if(Object.keys(r).length>0)n.push("",...Zp(r,"","",o));return`${n.join(`
|
|
52
52
|
`)}
|
|
53
|
-
`}var Nt=" ",Id=100,cx,lx,SC,vC,Tt=(e)=>V(e),Ta=(e)=>Tt(e)&&k(e.$ref)&&Object.keys(e).length===1,Ke=(e,t)=>`${e}/${String(t).replaceAll("~","~0").replaceAll("/","~1")}`,_C;var bl=T(()=>{cl();le();ai();Ca();gl();cx=/^(?![-+]?\.?\d)(?!(?:true|false|null|inf|-inf|nan)$)[^\s\\/(){};[\]"#=,\p{Cc}\p{Cf}\p{Zl}\p{Zp}]+$/u,lx=/[\p{Cc}\p{Zl}\p{Zp}--]/u,SC=/(?!\n)\p{Cc}|[\p{Zl}\p{Zp}--]/u,vC=new Set(["-","attributes","script","state","style"]);_C=new Set(["$export","$src","arguments","timing"])});function LC(e,t,n){if(ci(e,t)!==null)throw _e(e,t,`"project" names the file's kind, and takes no annotation`);let r=On(e,t);if(r.length>1||An(t).length>0||Ct(t).length>0)throw _e(e,t,`"project" holds one value, the project's name, and nothing else`);if(r[0]!==void 0)ve(n,"name",r[0],e,t),ht(e,"/name",t)}function VC(e,t,n){let r=t.getName(),s=`/${Xe(r)}`,o=t.getTag()===null,i;if(r==="$head"&&o)i=_d(e,t),ht(e,s,t);else if(FC.has(r)&&o)i=fl(e,t,s);else i=kn(e,t,s);ve(n,r,i,e,t)}function qC(e){if(zo(e.text)==="document")throw new Rt('A project file declares itself: its first node, after any $ metadata, is project "<name>"');let t=kd(e.text),n={},r=!1;for(let s of t.nodes)if(s.getName()===DC){if(r)throw _e(e,s,'"project" is written twice, and a file declares one project');LC(e,s,n),r=!0}else VC(e,s,n);return Uo(n)}function Fd(e,t){try{return qC({spans:null,text:e})}catch(n){throw t!==void 0&&n instanceof Rt?n.inFile(t):n}}var DC="project",FC;var Ld=T(()=>{le();Dt();Sa();ai();Ca();gl();bl();FC=new Set(["$media","style"])});var ds=T(()=>{Sa();dl();ai();tx();Ca();gl();bl();Ld()});function $x(e){if(e===null)throw TypeError("A class descriptor cannot be null");return V(e)?e:{}}class Ja{name;classPath;classDef;extensions;mediaType;mediaTypeEssence;documentKinds;exportTarget;remote;studio;project;server;connector;capabilities;#t;#e=null;constructor(e,t,n,r){this.name=e,this.classPath=t,this.classDef=n,this.#t=r;let{format:s}=n;this.extensions=(s?.extensions??[]).map((o)=>o.toLowerCase()),this.mediaType=s?.mediaType??null,this.mediaTypeEssence=dy(this.mediaType),this.documentKinds=s?.documentKinds??[],this.exportTarget=s?.exportTarget===!0,this.remote=s?.remote===!0,this.studio=n.$studio??null,this.project=n.project??null,this.server=n.server??null,this.connector=n.connector??null,this.capabilities=UC(n)}implementation(){if(!this.#e){let e=this.classDef.$implementation;if(!e)return Promise.reject(Error(`Format class "${this.name}" has no $implementation to import`));this.#e=this.#t.importModule(this.#t.resolvePath(this.classPath,e))}return this.#e}async implementationExport(){return this.#n(await this.implementation())}#n(e){let t=this.classDef.title??this.name;return e[t]??e.default?.[t]??e.default}async call(e,...t){let n=this.capabilities[e];if(!n)throw Error(`Format class "${this.name}" does not declare a "${e}" capability`);let r=this.#n(await this.implementation()),s=r?.[n.identifier];if(!At(s)){let i=this.classDef.title??this.name;throw TypeError(`Format class "${this.name}": implementation export "${i}" has no static "${n.identifier}" method`)}return await s.call(r,...t)}async parseDocument(e,t){return await this.call("parse",e,t)}}class $l{#t;get#e(){return[...this.#t,GC]}constructor(e){this.#t=e;for(let t of e)if(t.extensions.includes(".jxn"))throw Error(`Format "${t.name}" claims ".jxn", which is built in`);for(let t of e){if(t.mediaType===null)continue;let n=fy(t.mediaType);if(n!==null)throw Error(`Format "${t.name}" declares an invalid mediaType: ${n}`)}for(let t of xx){let n=new Map;for(let r of e){if(!r.capabilities[t])continue;for(let s of r.extensions){let o=n.get(s);if(o)throw Error(`Format conflict: "${o.name}" and "${r.name}" both claim "${s}" with the "${t}" capability`);n.set(s,r)}}}}get entries(){return this.#t}byExtension(e,t){let n=yx(e);return this.#e.find((r)=>r.extensions.includes(n)&&(!t||r.capabilities[t]))}byName(e){return this.#t.find((t)=>t.name===e)}withCapability(e){return this.#e.filter((t)=>t.capabilities[e])}documentExtensions(e){let t=new Set;for(let n of this.#e){if(e&&!n.documentKinds.includes(e))continue;for(let r of n.extensions)t.add(r)}return t.delete(".json"),[...t]}has(e){let t=yx(e);return this.#e.some((n)=>n.extensions.includes(t))}}function UC(e){let t={},n=e.$defs?.methods??{};for(let[r,s]of Object.entries(n)){let{role:o}=s;if(!zC(o))continue;let i={identifier:s.identifier??r,timing:s.timing??HC};if(k(s.discriminator))i.discriminator=s.discriminator;t[o]=i}return t}function zC(e){return e!==void 0&&BC.has(e)}function yx(e){let t=e.toLowerCase();return t.startsWith(".")?t:`.${t}`}var xx,bx,HC,BC,KC,GC;var Vd=T(()=>{le();sd();xx=["parse","serialize","rewrite","discover","load"],bx=[...xx,"projectData","resolvePaths","lower","emit","head","assets","mount","dialect","deploySchema","bindings","testConnection"];HC=["compiler","server"];BC=new Set(bx);KC={importModule:async()=>{await Promise.resolve().then(() => ds());return{JxNotation:{parse:(n)=>fo(n),serialize:(n)=>Dd(n)}}},loadJson:()=>Promise.reject(Error("Jx Notation reads no file of its own")),resolvePath:(e,t)=>t},GC=new Ja("jxn","",{$defs:{methods:{parse:{role:"parse"},serialize:{role:"serialize"}}},$implementation:"jxn",format:{documentKinds:["page","component"],extensions:[".jxn"]},title:"JxNotation"},KC)});class wx{#t;#e;#n;constructor(e){this.#t=e,this.#e=e.flatMap((s)=>s.classes);let t=new Map;for(let s of e)for(let o of s.classes){let i=t.get(o.name);if(i&&i!==s.specifier)throw Error(`Extension conflict: "${i}" and "${s.specifier}" both provide a class named "${o.name}"`);t.set(o.name,s.specifier)}let n=new Map;for(let s of this.#e){if(!s.project)continue;let o=n.get(s.project.key);if(o)throw Error(`Extension conflict: "${o.name}" and "${s.name}" both claim the project section "${s.project.key}"`);n.set(s.project.key,s)}let r=new Map;for(let s of this.#e){if(!s.server)continue;let{basePath:o}=s.server;if(!o.startsWith("/_jx/"))throw Error(`Extension "${s.name}": server basePath "${o}" must be under /_jx/`);let i=r.get(o);if(i)throw Error(`Extension conflict: "${i.name}" and "${s.name}" both mount "${o}"`);r.set(o,s)}this.#n=new $l(this.#e.filter((s)=>s.extensions.length>0))}get extensions(){return this.#t}get classes(){return this.#e}get formats(){return this.#n}byName(e){return this.#e.find((t)=>t.name===e)}projectContributions(){return this.#e.filter((e)=>e.project!==null)}byProjectKey(e){return this.#e.find((t)=>t.project?.key===e)}byPathsDiscriminator(e){return this.#e.find((t)=>t.capabilities.resolvePaths?.discriminator===e)}emitters(){return this.#e.filter((e)=>e.capabilities.emit!==void 0)}headProviders(){return this.#e.filter((e)=>e.capabilities.head!==void 0)}assetProviders(){return this.#e.filter((e)=>e.capabilities.assets!==void 0)}serverMounts(){return this.#e.filter((e)=>e.server!==null).toSorted((e,t)=>(e.server?.order??100)-(t.server?.order??100)||e.name.localeCompare(t.name))}connectors(){return this.#e.filter((e)=>e.connector!==null)}schemaFragments(e){return this.#t.map((t)=>t.schemas[e]).filter((t)=>typeof t==="string")}}async function Sx(e,t,n){let r=[];for(let s of e??[])r.push(await XC(s,t,n));return new wx(r)}async function XC(e,t,n){let r;if(e.startsWith("./")||e.startsWith("../")){let c=t.resolvePath(n,e);r=t.resolvePath(`${c}/package.json`,`./${Ia}`)}else try{r=t.resolvePath(n,`${e}/${Ia}`)}catch(c){throw Error(`Extension "${e}" is not resolvable: it must export ${Ia} (is the package installed, and does its exports map include it?): ${qd(c)}`,{cause:c})}let s;try{s=await t.loadJson(r)}catch(c){throw Error(`Extension "${e}": cannot read manifest ${r}: ${qd(c)}`,{cause:c})}if(!V(s)||!k(s.name))throw Error(`Extension "${e}": ${Ia} must declare a "name"`);let o=s;if(!e.startsWith(".")&&o.name!==e)throw Error(`Extension "${e}": manifest name "${o.name}" does not match the specifier`);let i=[];for(let[c,l]of Object.entries(o.classes??{})){let u=t.resolvePath(r,l),d;try{d=await t.loadJson(u)}catch(p){throw Error(`Extension "${e}": cannot read class "${c}" at ${u}: ${qd(p)}`,{cause:p})}i.push(new Ja(c,u,$x(d),t))}let a={};if(o.schemas?.project)a.project=t.resolvePath(r,o.schemas.project);if(o.schemas?.document)a.document=t.resolvePath(r,o.schemas.document);if(o.schemas?.fields)a.fields=t.resolvePath(r,o.schemas.fields);return{specifier:e,manifestPath:r,manifest:o,classes:i,schemas:a}}function qd(e){return e instanceof Error?e.message:String(e)}var Ia="jx-extension.json";var vx=T(()=>{Vd();le();Vd()});var Ex=T(()=>{le()});function ZC(e){return`${e} holds both project.jxn and project.json, and a project has one. Keep the one you edit and delete the other`}function Px(e){let t=YC.filter((n)=>e(n));if(t.length>1)return"conflict";return t[0]??null}function wl(e,t){return qr(t)?Fd(e,t):Yg(e,t)}var YC,jx="project.jxn",Wd;var Sl=T(()=>{le();Ex();Sa();dl();Ld();Dt();YC=["project.jxn","project.json"];Wd=class Wd extends Error{constructor(e){super(ZC(e));this.name="ProjectFileConflictError"}}});import{accessSync as z3,closeSync as K3,constants as G3,existsSync as QC,fstatSync as X3,lstatSync as Y3,openSync as Z3,readFileSync as Q3,statSync as eK}from"node:fs";import{dirname as nK,join as _x}from"node:path";function eN(e){return Px((t)=>QC(_x(e,t)))}function Rn(e){let t=eN(e);if(t==="conflict")throw new Wd(e);return _x(e,t??jx)}var po=T(()=>{Sl()});import{readFileSync as tN}from"node:fs";import{dirname as nN,isAbsolute as rN,resolve as kx,sep as vl}from"node:path";import{pathToFileURL as sN}from"node:url";import{createRequire as oN}from"node:module";async function Hd(e){let t=[e],n=`${vl}src${vl}`,r=`${vl}dist${vl}`;if(e.includes(n)){let o=e.replace(n,r);if(t.push(o),o.endsWith(".ts"))t.push(`${o.slice(0,-3)}.js`)}if(e.endsWith(".js"))t.push(`${e.slice(0,-3)}.ts`);let s;for(let o of t)try{return await import(sN(o).href)}catch(i){s=i}throw s instanceof Error?s:Error(String(s))}function Ud(e,t){return oN(kx(e,"package.json")).resolve(t)}function Bd(e){return{importModule:(t)=>Hd(t),loadJson:async(t)=>JSON.parse(tN(t,"utf8")),resolvePath:(t,n)=>{if(n.startsWith("./")||n.startsWith("../"))return kx(nN(t),n);if(rN(n))return n;return Ud(e,n)}}}async function ps(e,t){return Sx(t?.extensions,Bd(e),Rn(e))}function El(e,t){return Error(`No format class registered for "${t}" (${e}). Enable an extension providing this format in project.json "extensions", e.g. "@jxsuite/parser".`)}var Ur=T(()=>{vx();le();po()});import{existsSync as iN,readFileSync as aN}from"node:fs";import{basename as cN,resolve as lN}from"node:path";function ms(e){let t=Rn(e);if(!iN(t))throw Error(`No project.jxn or project.json in ${e}`);let n;try{n=wl(aN(t,"utf8"),t)}catch(i){throw Error(`Invalid ${cN(t)}: ${$e(i)}`,{cause:i})}let r={...Ma,...n,build:{...Ma.build,...n.build},defaults:{...Ma.defaults,...n.defaults},images:{...Ma.images,...n.images},url:n.url??Ma.url};if(n.$head)r.$head=n.$head;if(n.$media)r.$media=n.$media;if(n.style)r.style=n.style;if(n.state)r.state=n.state;if(n.redirects)r.redirects=n.redirects;if(n.imports)r.imports=n.imports;let s=["cloudflare-workers","cloudflare-pages","node","bun"];if(r.build.adapter==="static")delete r.build.adapter;if(r.build.adapter&&!s.includes(r.build.adapter))throw Error(`Unknown build adapter "${r.build.adapter}" in project.json. Valid adapters: ${s.join(", ")}`);let o=["build","cloudflare"];if(!o.includes(r.images.service))throw Error(`Unknown images.service "${r.images.service}" in project.json. Valid services: ${o.join(", ")}`);return{config:r,configPath:t,projectRoot:lN(e)}}var Ma;var Da=T(()=>{Dt();Sl();po();Ma={$head:[],$media:{},build:{format:"directory",outDir:"./dist",provider:null,trailingSlash:"always"},defaults:{charset:"utf8",lang:"en",layout:null},images:{formats:["avif","jpeg"],lazyLoad:!0,optimize:!0,picture:!0,quality:{avif:65,jpeg:80},service:"build",sizes:"(max-width: 768px) 100vw, 50vw",widths:[320,640,960,1280,1920]},imports:{},name:"Jx Site",redirects:{},state:{},style:{},url:""}});import{existsSync as zd,readFileSync as Ox,writeFileSync as uN}from"node:fs";import{resolve as Ax}from"node:path";async function Rx(e,t={}){let{dryRun:n=!1,connection:r}=t,{config:s}=ms(e),o=await ps(e,s),i=V(s.connections)?s.connections:{},a=V(s.data)?s.data:{},c=Object.keys(i).filter((x)=>!r||x===r);if(r&&c.length===0)throw Error(`Unknown connection "${r}" (no such connections entry in project.json)`);if(c.length===0)throw Error('project.json has no "connections" section — nothing to push. Declare a connection and '+'its tables in the "data" section first.');let l={...process.env,...dN(e),JX_PROJECT_ROOT:e},u=[],d=[];for(let x of c){let h=i[x],g=V(h)?{...h,$name:x}:{$name:x},b=String(g.provider??""),j=fN(o.connectors(),b);if(!j)throw Error(`Connection "${x}" names provider "${b}", but no enabled extension provides it (enable the extension in project.json "extensions")`);let v={};for(let[S,_]of Object.entries(a))if(V(_)&&_.connection===x)v[S]=_;let P=await j.call("deploySchema",v,g,{dryRun:n,env:l});if(u.push({applied:P.applied??!n,connection:x,provider:b,statements:P.statements??[],tables:Object.keys(v),warnings:P.warnings??[]}),j.capabilities.bindings){let S=await j.call("bindings",g);if(V(S)&&Object.keys(S).length>0)d.push(S)}}let p=Ax(e,"wrangler.jsonc"),m=!1;if(!n&&d.length>0&&zd(p)){let x=Ox(p,"utf8"),{content:h,patched:g}=sy(x,d);if(g&&h!==x)uN(p,h,"utf8"),m=!0}return{bindingsPatched:m,results:u,wranglerPath:zd(p)?p:null}}function fN(e,t){return e.find((n)=>n.connector?.provider===t)}function dN(e){let t=Ax(e,".dev.vars");if(!zd(t))return{};let n=new Map;for(let r of Ox(t,"utf8").split(`
|
|
54
|
-
`)){let s=r.trim();if(s===""||s.startsWith("#"))continue;let o=s.indexOf("=");if(o===-1)continue;let i=s.slice(0,o).trim(),a=s.slice(o+1).trim();if(a.startsWith('"')&&a.endsWith('"')||a.startsWith("'")&&a.endsWith("'"))a=a.slice(1,-1);if(i!=="")n.set(i,a)}return Object.fromEntries(n)}var
|
|
53
|
+
`}var qt=" ",Yp=100,cS,uS,XT,YT,Ht=(e)=>L(e),Ua=(e)=>Ht(e)&&k(e.$ref)&&Object.keys(e).length===1,et=(e,t)=>`${e}/${String(t).replaceAll("~","~0").replaceAll("/","~1")}`,tJ;var iu=J(()=>{Gc();ce();gi();Wa();ru();cS=/^(?![-+]?\.?\d)(?!(?:true|false|null|inf|-inf|nan)$)[^\s\\/(){};[\]"#=,\p{Cc}\p{Cf}\p{Zl}\p{Zp}]+$/u,uS=/[\p{Cc}\p{Zl}\p{Zp}--]/u,XT=/(?!\n)\p{Cc}|[\p{Zl}\p{Zp}--]/u,YT=new Set(["-","attributes","script","state","style"]);tJ=new Set(["$export","$src","arguments","timing"])});function mJ(e,t,n){if(yi(e,t)!==null)throw ke(e,t,`"project" names the file's kind, and takes no annotation`);let r=Ln(e,t);if(r.length>1||Fn(t).length>0||Vt(t).length>0)throw ke(e,t,`"project" holds one value, the project's name, and nothing else`);if(r[0]!==void 0)je(n,"name",r[0],e,t),wt(e,"/name",t)}function hJ(e,t,n){let r=t.getName(),s=`/${nt(r)}`,o=t.getTag()===null,i;if(r==="$head"&&o)i=qp(e,t),wt(e,s,t);else if(pJ.has(r)&&o)i=Zc(e,t,s);else i=Dn(e,t,s);je(n,r,i,e,t)}function gJ(e){if(ni(e.text)==="document")throw new Ft('A project file declares itself: its first node, after any $ metadata, is project "<name>"');let t=Hp(e.text),n={},r=!1;for(let s of t.nodes)if(s.getName()===dJ){if(r)throw ke(e,s,'"project" is written twice, and a file declares one project');mJ(e,s,n),r=!0}else hJ(e,s,n);return ei(n)}function em(e,t){try{return gJ({spans:null,text:e})}catch(n){throw t!==void 0&&n instanceof Ft?n.inFile(t):n}}var dJ="project",pJ;var tm=J(()=>{ce();Lt();Ta();gi();Wa();ru();iu();pJ=new Set(["$media","style"])});var os=J(()=>{Ta();Qc();gi();nS();Wa();ru();iu();tm()});function SS(e){if(e===null)throw TypeError("A class descriptor cannot be null");return L(e)?e:{}}class za{name;classPath;classDef;extensions;mediaType;mediaTypeEssence;documentKinds;exportTarget;remote;studio;project;server;connector;capabilities;#t;#e=null;constructor(e,t,n,r){this.name=e,this.classPath=t,this.classDef=n,this.#t=r;let{format:s}=n;this.extensions=(s?.extensions??[]).map((o)=>o.toLowerCase()),this.mediaType=s?.mediaType??null,this.mediaTypeEssence=p$(this.mediaType),this.documentKinds=s?.documentKinds??[],this.exportTarget=s?.exportTarget===!0,this.remote=s?.remote===!0,this.studio=n.$studio??null,this.project=n.project??null,this.server=n.server??null,this.connector=n.connector??null,this.capabilities=bJ(n)}implementation(){if(!this.#e){let e=this.classDef.$implementation;if(!e)return Promise.reject(Error(`Format class "${this.name}" has no $implementation to import`));this.#e=this.#t.importModule(this.#t.resolvePath(this.classPath,e))}return this.#e}async implementationExport(){return this.#n(await this.implementation())}#n(e){let t=this.classDef.title??this.name;return e[t]??e.default?.[t]??e.default}async call(e,...t){let n=this.capabilities[e];if(!n)throw Error(`Format class "${this.name}" does not declare a "${e}" capability`);let r=this.#n(await this.implementation()),s=r?.[n.identifier];if(!_t(s)){let i=this.classDef.title??this.name;throw TypeError(`Format class "${this.name}": implementation export "${i}" has no static "${n.identifier}" method`)}return await s.call(r,...t)}async parseDocument(e,t){return await this.call("parse",e,t)}}class au{#t;get#e(){return[...this.#t,vJ]}constructor(e){this.#t=e;for(let t of e)if(t.extensions.includes(".jxn"))throw Error(`Format "${t.name}" claims ".jxn", which is built in`);for(let t of e){if(t.mediaType===null)continue;let n=d$(t.mediaType);if(n!==null)throw Error(`Format "${t.name}" declares an invalid mediaType: ${n}`)}for(let t of bS){let n=new Map;for(let r of e){if(!r.capabilities[t])continue;for(let s of r.extensions){let o=n.get(s);if(o)throw Error(`Format conflict: "${o.name}" and "${r.name}" both claim "${s}" with the "${t}" capability`);n.set(s,r)}}}}get entries(){return this.#t}byExtension(e,t){let n=xS(e);return this.#e.find((r)=>r.extensions.includes(n)&&(!t||r.capabilities[t]))}byName(e){return this.#t.find((t)=>t.name===e)}withCapability(e){return this.#e.filter((t)=>t.capabilities[e])}documentExtensions(e){let t=new Set;for(let n of this.#e){if(e&&!n.documentKinds.includes(e))continue;for(let r of n.extensions)t.add(r)}return t.delete(".json"),[...t]}has(e){let t=xS(e);return this.#e.some((n)=>n.extensions.includes(t))}}function bJ(e){let t={},n=e.$defs?.methods??{};for(let[r,s]of Object.entries(n)){let{role:o}=s;if(!SJ(o))continue;let i={identifier:s.identifier??r,timing:s.timing??xJ};if(k(s.discriminator))i.discriminator=s.discriminator;t[o]=i}return t}function SJ(e){return e!==void 0&&$J.has(e)}function xS(e){let t=e.toLowerCase();return t.startsWith(".")?t:`.${t}`}var bS,$S,xJ,$J,wJ,vJ;var nm=J(()=>{ce();bp();bS=["parse","serialize","rewrite","discover","load"],$S=[...bS,"projectData","resolvePaths","lower","emit","head","assets","mount","dialect","deploySchema","bindings","testConnection"];xJ=["compiler","server"];$J=new Set($S);wJ={importModule:async()=>{await Promise.resolve().then(() => os());return{JxNotation:{parse:(n)=>vo(n),serialize:(n)=>Qp(n)}}},loadJson:()=>Promise.reject(Error("Jx Notation reads no file of its own")),resolvePath:(e,t)=>t},vJ=new za("jxn","",{$defs:{methods:{parse:{role:"parse"},serialize:{role:"serialize"}}},$implementation:"jxn",format:{documentKinds:["page","component"],extensions:[".jxn"]},title:"JxNotation"},wJ)});class wS{#t;#e;#n;constructor(e){this.#t=e,this.#e=e.flatMap((s)=>s.classes);let t=new Map;for(let s of e)for(let o of s.classes){let i=t.get(o.name);if(i&&i!==s.specifier)throw Error(`Extension conflict: "${i}" and "${s.specifier}" both provide a class named "${o.name}"`);t.set(o.name,s.specifier)}let n=new Map;for(let s of this.#e){if(!s.project)continue;let o=n.get(s.project.key);if(o)throw Error(`Extension conflict: "${o.name}" and "${s.name}" both claim the project section "${s.project.key}"`);n.set(s.project.key,s)}let r=new Map;for(let s of this.#e){if(!s.server)continue;let{basePath:o}=s.server;if(!o.startsWith("/_jx/"))throw Error(`Extension "${s.name}": server basePath "${o}" must be under /_jx/`);let i=r.get(o);if(i)throw Error(`Extension conflict: "${i.name}" and "${s.name}" both mount "${o}"`);r.set(o,s)}this.#n=new au(this.#e.filter((s)=>s.extensions.length>0))}get extensions(){return this.#t}get classes(){return this.#e}get formats(){return this.#n}byName(e){return this.#e.find((t)=>t.name===e)}projectContributions(){return this.#e.filter((e)=>e.project!==null)}byProjectKey(e){return this.#e.find((t)=>t.project?.key===e)}byPathsDiscriminator(e){return this.#e.find((t)=>t.capabilities.resolvePaths?.discriminator===e)}emitters(){return this.#e.filter((e)=>e.capabilities.emit!==void 0)}headProviders(){return this.#e.filter((e)=>e.capabilities.head!==void 0)}assetProviders(){return this.#e.filter((e)=>e.capabilities.assets!==void 0)}serverMounts(){return this.#e.filter((e)=>e.server!==null).toSorted((e,t)=>(e.server?.order??100)-(t.server?.order??100)||e.name.localeCompare(t.name))}connectors(){return this.#e.filter((e)=>e.connector!==null)}schemaFragments(e){return this.#t.map((t)=>t.schemas[e]).filter((t)=>typeof t==="string")}}async function vS(e,t,n){let r=[];for(let s of e??[])r.push(await EJ(s,t,n));return new wS(r)}async function EJ(e,t,n){let r;if(e.startsWith("./")||e.startsWith("../")){let l=t.resolvePath(n,e);r=t.resolvePath(`${l}/package.json`,`./${Ka}`)}else try{r=t.resolvePath(n,`${e}/${Ka}`)}catch(l){throw Error(`Extension "${e}" is not resolvable: it must export ${Ka} (is the package installed, and does its exports map include it?): ${rm(l)}`,{cause:l})}let s;try{s=await t.loadJson(r)}catch(l){throw Error(`Extension "${e}": cannot read manifest ${r}: ${rm(l)}`,{cause:l})}if(!L(s)||!k(s.name))throw Error(`Extension "${e}": ${Ka} must declare a "name"`);let o=s;if(!e.startsWith(".")&&o.name!==e)throw Error(`Extension "${e}": manifest name "${o.name}" does not match the specifier`);let i=[];for(let[l,c]of Object.entries(o.classes??{})){let u=t.resolvePath(r,c),d;try{d=await t.loadJson(u)}catch(p){throw Error(`Extension "${e}": cannot read class "${l}" at ${u}: ${rm(p)}`,{cause:p})}i.push(new za(l,u,SS(d),t))}let a={};if(o.schemas?.project)a.project=t.resolvePath(r,o.schemas.project);if(o.schemas?.document)a.document=t.resolvePath(r,o.schemas.document);if(o.schemas?.fields)a.fields=t.resolvePath(r,o.schemas.fields);return{specifier:e,manifestPath:r,manifest:o,classes:i,schemas:a}}function rm(e){return e instanceof Error?e.message:String(e)}var Ka="jx-extension.json";var ES=J(()=>{nm();ce();nm()});var jS=J(()=>{ce()});function PJ(e){return`${e} holds both project.jxn and project.json, and a project has one. Keep the one you edit and delete the other`}function _S(e){let t=jJ.filter((n)=>e(n));if(t.length>1)return"conflict";return t[0]??null}function lu(e,t){return rs(t)?em(e,t):Zb(e,t)}var jJ,PS="project.jxn",sm;var cu=J(()=>{ce();jS();Ta();Qc();tm();Lt();jJ=["project.jxn","project.json"];sm=class sm extends Error{constructor(e){super(PJ(e));this.name="ProjectFileConflictError"}}});import{accessSync as dG,closeSync as pG,constants as mG,existsSync as _J,fstatSync as hG,lstatSync as gG,openSync as yG,readFileSync as xG,statSync as bG}from"node:fs";import{dirname as SG,join as kS}from"node:path";function kJ(e){return _S((t)=>_J(kS(e,t)))}function qn(e){let t=kJ(e);if(t==="conflict")throw new sm(e);return kS(e,t??PS)}var Eo=J(()=>{cu()});import{existsSync as OJ,readFileSync as AJ}from"node:fs";import{dirname as fu,isAbsolute as CJ,resolve as OS,sep as uu}from"node:path";import{pathToFileURL as RJ}from"node:url";import{createRequire as NJ}from"node:module";function AS(e){let t=[e],n=`${uu}src${uu}`,r=`${uu}dist${uu}`;if(e.includes(n)){let s=e.replace(n,r);if(t.push(s),s.endsWith(".ts"))t.push(`${s.slice(0,-3)}.js`)}if(e.endsWith(".js"))t.push(`${e.slice(0,-3)}.ts`);return t}function CS(e){let t=AS(e),n=fu(e),r=[...t.filter((o)=>fu(o)===n),...t.filter((o)=>fu(o)!==n)],s=r.find((o)=>OJ(o));if(s===void 0)throw Error(`no module at ${e} (tried ${r.join(", ")})`);return s}async function om(e){let t=AS(e),n;for(let r of t)try{return await import(RJ(r).href)}catch(s){n=s}throw n instanceof Error?n:Error(String(n))}function im(e,t){return NJ(OS(e,"package.json")).resolve(t)}function am(e){return{importModule:(t)=>om(t),loadJson:async(t)=>JSON.parse(AJ(t,"utf8")),resolvePath:(t,n)=>{if(n.startsWith("./")||n.startsWith("../"))return OS(fu(t),n);if(CJ(n))return n;return im(e,n)}}}async function Os(e,t){return vS(t?.extensions,am(e),qn(e))}function du(e,t){return Error(`No format class registered for "${t}" (${e}). Enable an extension providing this format in project.json "extensions", e.g. "@jxsuite/parser".`)}var is=J(()=>{ES();ce();Eo()});import{existsSync as TJ,readFileSync as JJ}from"node:fs";import{basename as MJ,resolve as IJ}from"node:path";function As(e){let t=qn(e);if(!TJ(t))throw Error(`No project.jxn or project.json in ${e}`);let n;try{n=lu(JJ(t,"utf8"),t)}catch(i){throw Error(`Invalid ${MJ(t)}: ${be(i)}`,{cause:i})}let r={...Ga,...n,build:{...Ga.build,...n.build},defaults:{...Ga.defaults,...n.defaults},images:{...Ga.images,...n.images},url:n.url??Ga.url};if(n.$head)r.$head=n.$head;if(n.$media)r.$media=n.$media;if(n.style)r.style=n.style;if(n.state)r.state=n.state;if(n.redirects)r.redirects=n.redirects;if(n.imports)r.imports=n.imports;let s=["cloudflare-workers","cloudflare-pages","node","bun"];if(r.build.adapter==="static")delete r.build.adapter;if(r.build.adapter&&!s.includes(r.build.adapter))throw Error(`Unknown build adapter "${r.build.adapter}" in project.json. Valid adapters: ${s.join(", ")}`);let o=["build","cloudflare"];if(!o.includes(r.images.service))throw Error(`Unknown images.service "${r.images.service}" in project.json. Valid services: ${o.join(", ")}`);return{config:r,configPath:t,projectRoot:IJ(e)}}function RS(e){return["0","false","no","off"].includes((e??"").trim().toLowerCase())}var Ga;var bi=J(()=>{Lt();cu();Eo();Ga={$head:[],$media:{},build:{format:"directory",outDir:"./dist",provider:null,trailingSlash:"always"},defaults:{charset:"utf8",lang:"en",layout:null},images:{formats:["avif","jpeg"],lazyLoad:!0,optimize:!0,picture:!0,quality:{avif:65,jpeg:80},service:"build",sizes:"(max-width: 768px) 100vw, 50vw",widths:[320,640,960,1280,1920]},imports:{},name:"Jx Site",redirects:{},state:{},style:{},url:""}});import{existsSync as lm,readFileSync as NS,writeFileSync as DJ}from"node:fs";import{resolve as TS}from"node:path";async function JS(e,t={}){let{dryRun:n=!1,connection:r}=t,{config:s}=As(e),o=await Os(e,s),i=L(s.connections)?s.connections:{},a=L(s.data)?s.data:{},l=Object.keys(i).filter((y)=>!r||y===r);if(r&&l.length===0)throw Error(`Unknown connection "${r}" (no such connections entry in project.json)`);if(l.length===0)throw Error('project.json has no "connections" section — nothing to push. Declare a connection and '+'its tables in the "data" section first.');let c={...process.env,...FJ(e),JX_PROJECT_ROOT:e},u=[],d=[];for(let y of l){let S=i[y],g=L(S)?{...S,$name:y}:{$name:y},x=String(g.provider??""),P=LJ(o.connectors(),x);if(!P)throw Error(`Connection "${y}" names provider "${x}", but no enabled extension provides it (enable the extension in project.json "extensions")`);let w={};for(let[j,A]of Object.entries(a))if(L(A)&&A.connection===y)w[j]=A;let E=await P.call("deploySchema",w,g,{dryRun:n,env:c});if(u.push({applied:E.applied??!n,connection:y,provider:x,statements:E.statements??[],tables:Object.keys(w),warnings:E.warnings??[]}),P.capabilities.bindings){let j=await P.call("bindings",g);if(L(j)&&Object.keys(j).length>0)d.push(j)}}let p=TS(e,"wrangler.jsonc"),m=!1;if(!n&&d.length>0&&lm(p)){let y=NS(p,"utf8"),{content:S,patched:g}=o$(y,d);if(g&&S!==y)DJ(p,S,"utf8"),m=!0}return{bindingsPatched:m,results:u,wranglerPath:lm(p)?p:null}}function LJ(e,t){return e.find((n)=>n.connector?.provider===t)}function FJ(e){let t=TS(e,".dev.vars");if(!lm(t))return{};let n=new Map;for(let r of NS(t,"utf8").split(`
|
|
54
|
+
`)){let s=r.trim();if(s===""||s.startsWith("#"))continue;let o=s.indexOf("=");if(o===-1)continue;let i=s.slice(0,o).trim(),a=s.slice(o+1).trim();if(a.startsWith('"')&&a.endsWith('"')||a.startsWith("'")&&a.endsWith("'"))a=a.slice(1,-1);if(i!=="")n.set(i,a)}return Object.fromEntries(n)}var MS=J(()=>{a$();is();bi();ce()});function cm(e,t=[]){if(!L(e))return t;let{children:n}=e;if(e.tagName==="slot"){let r=e.attributes,s=L(r)?r.name:void 0,o={name:k(s)?s.trim():""};if(Array.isArray(n)&&n.length>0)o.fallback=n;t.push(o)}if(Array.isArray(n))for(let r of n)cm(r,t);return t}var IS=J(()=>{ce()});function VJ(e){let t=new Set,n=new Set,r=(o)=>{if(o.startsWith("#/state/"))t.add(o.slice(8).split("/")[0])},s=(o)=>{if(k(o)){for(let i of o.matchAll(/\bstate\.([A-Za-z_$][\w$]*)\s*\(/gu))t.add(i[1]);return}if(Array.isArray(o)){if(!n.has(o)){n.add(o);for(let i of o)s(i)}return}if(!L(o)||n.has(o))return;if(n.add(o),o.operator==="call"&&me(o.target))r(o.target.$ref);if(o.$prototype==="Array"){for(let i of[o.filter,o.sort])if(me(i))r(i.$ref)}for(let[i,a]of Object.entries(o)){if(i==="$defs")continue;if(i.startsWith("on")&&me(a))r(a.$ref);s(a)}};s(e);for(let o of um)if(L(e.state)&&o in e.state)t.add(o);return t}function fm(e){return"body"in e&&"$src"in e}function Xa(e){return Pc(e.parameters??e.arguments).length>0}function kr(e){let t=["state"];for(let n of Pc(e.parameters??e.arguments))if(n!=="state")t.push(n);return t}function qJ(e,t,n){if(vr(t))return"callable";if(Pc(t.parameters??t.arguments).length>0)return"callable";if(k(t.body))return Vb(t.body)?"computed":"callable";if(t.$src)return n().has(e)?"callable":"computed";return"callable"}function Or(e){let t=new Map,n=null,r=()=>n??=VJ(e);for(let[s,o]of Object.entries(e.state??{}))if(kt(o))t.set(s,qJ(s,o,r));return t}var um;var $i=J(()=>{ce();um=new Set(["onMount","onUnmount","onAdopted"])});function DS(e){if(e===null||e===void 0)return"null";if(Array.isArray(e))return"array";if(k(e))return"string";if(Ie(e))return"number";return Ge(e)?"boolean":"object"}function HJ(e){if(k(e))return e;if(!L(e))return;if(k(e.text))return e.text;if(k(e.type))return e.type;if(Array.isArray(e.type))return e.type.filter((t)=>k(t)).join(" | ");return k(e.$ref)?e.$ref.slice(e.$ref.lastIndexOf("/")+1):void 0}function Ya(e){let t=HJ(e);return t===void 0||t===""?void 0:{text:t}}function FS(e){if(k(e)&&e!=="")return e;return e===!0?!0:void 0}function WJ(e,t){let n={kind:"field",name:e};if(jc(t)){let r=Ya(t.type)??Ya(k(t.$ref)?{$ref:t.$ref}:void 0);if(n.type=r??{text:DS(t.default)},n.default=JSON.stringify(t.default),k(t.description))n.description=t.description;let s=FS(t.deprecated);if(s!==void 0)n.deprecated=s;return n}if(L(t)){if(Object.keys(t).some((s)=>s.startsWith("$"))||Db(t))return null}else if(le(t))return null;return n.type={text:DS(t)},n.default=JSON.stringify(t),n}function BJ(e){if(k(e))return{name:e};if(!L(e)||!k(e.name))return null;let t={name:e.name},n=Ya(e.type);if(n)t.type=n;if(k(e.description))t.description=e.description;if(Ge(e.optional))t.optional=e.optional;if(e.default!==void 0)t.default=JSON.stringify(e.default);return t}function UJ(e,t){let n={kind:"method",name:e};if(k(t.description))n.description=t.description;let s=(t.parameters??t.arguments??[]).map((i)=>BJ(i)).filter((i)=>i!==null&&i.name!=="state");if(s.length>0)n.parameters=s;let o=Ya(t.type);if(o)n.return={type:o};return n}function LS(e,t){if(!Array.isArray(e))return;for(let n of e){if(!L(n)||!k(n.name)||t.has(n.name))continue;let r={name:n.name,type:Ya(n.type)??{text:"Event"}};if(k(n.description))r.description=n.description;let s=FS(n.deprecated);if(s!==void 0)r.deprecated=s;t.set(n.name,r)}}function zJ(e){let t=new Set,n=(s)=>{if(!L(s))return;let o=L(s.attributes)?s.attributes.part:void 0;if(k(o)){for(let i of o.split(/\s+/u))if(i!=="")t.add(i)}r(s)},r=(s)=>{if(Array.isArray(s.children))for(let o of s.children)n(o)};return r(e),[...t]}function KJ(e){let t=e.doc,n=L(t.state)?t.state:{},r=Or(e.doc),s=[],o=[],i=new Map,a=new Map;LS(t.emits,a);for(let[x,P]of Object.entries(n)){if(Zo(x))continue;if(kt(P)){if(LS(P.emits,a),!um.has(x)&&r.get(x)!=="computed")o.push(UJ(x,P));continue}let w=WJ(x,P);if(w)o.push(w),i.set(x,w)}let l=[],c=new Set,u=Array.isArray(t.observedAttributes)?t.observedAttributes:[];for(let x of new Set(u.filter((P)=>k(P)))){let P={name:x},w=Qo(x),E=i.get(w);if(E){P.fieldName=w;for(let j of["type","default","description","deprecated"])if(E[j]!==void 0)Object.assign(P,{[j]:E[j]});if(!c.has(w)){c.add(w),E.attribute=x;let j=n[w];if(L(j)&&j.reflects===!0)E.reflects=!0}}l.push(P)}for(let[x,P]of Object.entries(n)){if(Zo(x)||!L(P)||!k(P.attribute))continue;if(i.get(x)?.attribute!==P.attribute)s.push(`${e.tagName}: state entry "${x}" declares attribute "${P.attribute}", but the `+"element does not observe it into that entry (spec.md §16.5); add it to "+"observedAttributes or remove it")}let d={customElement:!0,kind:"class",members:o,name:e.className,tagName:e.tagName},p=k(t.description)?t.description:t.$description;if(k(p))d.description=p;if(l.length>0)d.attributes=l;if(a.size>0)d.events=[...a.values()];let m=cm(t).map((x)=>({name:x.name}));if(m.length>0)d.slots=m;let y=L(t.style)?t.style:{},S=Object.entries(y).filter(([x])=>x.startsWith("--")).map(([x,P])=>({default:String(P),name:x}));if(S.length>0)d.cssProperties=S;let g=e.shadow?zJ(e.doc).map((x)=>({name:x})):[];if(g.length>0)d.cssParts=g;return{module:{declarations:[d],exports:[{declaration:{name:e.className},kind:"custom-element-definition",name:e.tagName}],kind:"javascript-module",path:e.modulePath},warnings:s}}function pu(e){let n=e.toSorted((r,s)=>r.tagName<s.tagName?-1:1).map((r)=>KJ(r));return{manifest:{modules:n.map((r)=>r.module),schemaVersion:"2.1.0"},warnings:n.flatMap((r)=>r.warnings)}}function mu(e){return`${JSON.stringify(e,null,2)}
|
|
55
|
+
`}var dm=J(()=>{IS();$i();ce()});function jo(e){return e.startsWith(hu)}function gu(e){let t=e;if(jo(t))t=t.slice(hu.length);return t=t.replace(/^\.\//,"").replace(/\.(js|ts|mjs|mts)$/,"").replaceAll("@","").replaceAll(/[/\\]+/g,"-").replaceAll(/[^\w.-]/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,""),`${pm}${t}.js`}function VS(e){let t=/\.(\w+)$/.exec(e)?.[1]??"",n=e.replace(/\.\w+$/,"").replaceAll("@","").replaceAll(/[/\\]+/g,"-").replaceAll(/[^\w.-]/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,"");return t===""?`${pm}${n}`:`${pm}${n}.${t}`}function qS(e){let t=e.replaceAll("\\","/");return t.length>1&&t.endsWith("/")?t.slice(0,-1):t}function yu(e){let t=qS(e);return t.startsWith("/")?t:`/${t}`}function GJ(e,t){return[...e].toSorted((n,r)=>r[t].length-n[t].length)}function xu(e,t){let n=t.split("#")[0].split("?")[0];if(!n.startsWith("/"))return null;let r;try{r=decodeURIComponent(n)}catch{return null}if(/%2e|%2f/i.test(r))return null;for(let s of GJ(e,"urlPrefix")){let o=yu(s.urlPrefix);if(!r.startsWith(`${o}/`))continue;let a=r.slice(o.length+1).split("/");if(a.some((c)=>c===""||c==="."||c===".."))return null;let{filter:l}=s;if(l&&!l(a.join("/")))return null;return`${qS(s.dir)}/${a.join("/")}`}return null}function HS(e,t){let n=new Set;for(let r of t){let s=yu(r.urlPrefix),o=new RegExp(`${s.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}/[^${XJ}]+`,"g");for(let i of e.matchAll(o)){let a=i[0].split("#")[0].split("?")[0];if(!a.endsWith("/"))n.add(a)}}return[...n].filter(Boolean)}function mm(e){let t=[],n=0;while(n<e.length){while(n<e.length&&(/\s/.test(e[n])||e[n]===","))n+=1;if(n>=e.length)break;let r=n;while(n<e.length&&!/\s/.test(e[n]))n+=1;let s=e.slice(r,n);if(s.endsWith(",")){t.push({descriptor:"",url:s.replace(/,+$/,"")});continue}while(n<e.length&&/\s/.test(e[n]))n+=1;let o=n;while(n<e.length&&e[n]!==",")n+=1;let i=e.slice(o,n).trim();if(n+=1,s=s.replace(/,+$/,""),s!=="")t.push({descriptor:i,url:s})}return t}function hm(e){return e.map(({url:t,descriptor:n})=>n?`${t} ${n}`:t).join(", ")}function Po(e){if(!k(e)||e==="")return"";let t;try{({pathname:t}=new URL(e))}catch{return""}let n=t.replace(/\/+$/,"");if(n===""||n==="/")return"";return n.startsWith("/")?n:`/${n}`}function Fe(e,t){if(e===""||!t.startsWith("/")||t.startsWith("//"))return t;if(t===e||t.startsWith(`${e}/`))return t;return e+t}function Cs(e,t){let n=new URL(t);if(!n.pathname.endsWith("/"))n.pathname+="/";return new URL(e.replace(/^\/+/,""),n).href}var hu="npm:",pm="/assets/",XJ;var An=J(()=>{ce();XJ=String.raw`"'\s<>()\\`});function Qa(e,t){return e.replaceAll(QJ,(n,r,s)=>{let o=s.trim(),i=sM.exec(o),a=i?i[2]:o,l=Fe(t,a);if(l===a)return n;return`url(${r}${i?`${i[1]}${l}${i[1]}`:l}${r})`})}function gm(e,t,n,r,s){let o=n.toLowerCase();if(WS.has(o))return Fe(s,r);if(BS.has(o)){let i=mm(r);return i.length===0?r:hm(i.map((a)=>({descriptor:a.descriptor,url:Fe(s,a.url)})))}if(o==="style")return Qa(r,s);if(o==="content"&&e==="meta"&&rM.test(t))return Fe(s,r);return r}function ym(e,t){if(t==="")return e;let n=e.replaceAll(tM,(r,s,o,i)=>{let a=o.replaceAll(eM,(l,c)=>`"${Fe(t,c)}"`);return s+a+i});return n=n.replaceAll(nM,(r,s,o,i)=>s+Qa(o,t)+i),n.replaceAll(YJ,(r,s,o)=>{if(o==="")return r;let i=s.toLowerCase(),a=o.replaceAll(ZJ,(l,c,u,d,p)=>{let m=d===void 0?"'":'"',y=d??p??"",S=gm(i,o,c,y,t);return S===y?l:`${c}=${m}${S}${m}`});return a===o?r:`<${s}${a}>`})}function oM(e,t){let n=k(e.tagName)?e.tagName.toLowerCase():"",{attributes:r}=e;if(D(r)){for(let[s,o]of Object.entries(r))if(k(o))r[s]=gm(n,"",s,o,t)}for(let s of Object.keys(e)){let o=s.toLowerCase(),i=e[s];if(k(i)&&(WS.has(o)||BS.has(o)))e[s]=gm(n,"",o,i,t)}if(k(e.innerHTML))e.innerHTML=ym(e.innerHTML,t)}function Za(e,t){if(!D(e)||Array.isArray(e))return;if(Le(e)){Za(e.map,t);return}let n=e;oM(n,t);let{cases:r,children:s}=n;if(Array.isArray(s))for(let o of s)Za(o,t);else Za(s,t);if(D(r))for(let o of Object.values(r))Za(o,t)}function US(e,t){if(t!=="")Za(e,t)}var WS,BS,YJ,ZJ,QJ,eM,tM,nM,rM,sM;var zS=J(()=>{An();ce();WS=new Set(["href","src","poster","action","formaction","data"]),BS=new Set(["srcset","imagesrcset"]),YJ=/<([a-zA-Z][a-zA-Z0-9-]*)((?:"[^"]*"|'[^']*'|[^>"'])*)>/g,ZJ=/([a-zA-Z_:][\w:.-]*)\s*=\s*("([^"]*)"|'([^']*)')/g,QJ=/url\(\s*(['"]?)([^'")]+)\1\s*\)/g,eM=/"(\/[^"/][^"]*)"/g,tM=/(<script\b[^>]*\btype\s*=\s*["']importmap["'][^>]*>)([\s\S]*?)(<\/script>)/gi,nM=/(<style\b[^>]*>)([\s\S]*?)(<\/style>)/gi,rM=/\b(?:property|name)\s*=\s*["'](?:og:|twitter:)[\w:.-]*(?:image|url|video|audio|player)[\w:.-]*["']/i,sM=/^("|"|'|')([\s\S]*)\1$/});var ol=W(function(sX,xw){var __dirname="/home/runner/work/jx/jx/node_modules/esbuild/lib",__filename="/home/runner/work/jx/jx/node_modules/esbuild/lib/main.js",{defineProperty:wm,getOwnPropertyDescriptor:iM,getOwnPropertyNames:aM}=Object,lM=Object.prototype.hasOwnProperty,cM=(e,t)=>{for(var n in t)wm(e,n,{get:t[n],enumerable:!0})},uM=(e,t,n,r)=>{if(t&&typeof t==="object"||typeof t==="function"){for(let s of aM(t))if(!lM.call(e,s)&&s!==n)wm(e,s,{get:()=>t[s],enumerable:!(r=iM(t,s))||r.enumerable})}return e},fM=(e)=>uM(wm({},"__esModule",{value:!0}),e),rl={};cM(rl,{analyzeMetafile:()=>qM,analyzeMetafileSync:()=>UM,build:()=>DM,buildSync:()=>HM,context:()=>LM,default:()=>XM,formatMessages:()=>VM,formatMessagesSync:()=>BM,initialize:()=>KM,stop:()=>zM,transform:()=>FM,transformSync:()=>WM,version:()=>IM});xw.exports=fM(rl);function KS(e){let t=(r)=>{if(r===null)n.write8(0);else if(typeof r==="boolean")n.write8(1),n.write8(+r);else if(typeof r==="number")n.write8(2),n.write32(r|0);else if(typeof r==="string")n.write8(3),n.write(lr(r));else if(r instanceof Uint8Array)n.write8(4),n.write(r);else if(r instanceof Array){n.write8(5),n.write32(r.length);for(let s of r)t(s)}else{let s=Object.keys(r);n.write8(6),n.write32(s.length);for(let o of s)n.write(lr(o)),t(r[o])}},n=new sw;return n.write32(0),n.write32(e.id<<1|+!e.isRequest),t(e.value),bm(n.buf,n.len-4,0),n.buf.subarray(0,n.len)}function dM(e){let t=()=>{switch(n.read8()){case 0:return null;case 1:return!!n.read8();case 2:return n.read32();case 3:return Co(n.read());case 4:return n.read();case 5:{let i=n.read32(),a=[];for(let l=0;l<i;l++)a.push(t());return a}case 6:{let i=n.read32(),a={};for(let l=0;l<i;l++)a[Co(n.read())]=t();return a}default:throw Error("Invalid packet")}},n=new sw(e),r=n.read32(),s=(r&1)===0;r>>>=1;let o=t();if(n.ptr!==e.length)throw Error("Invalid packet");return{id:r,isRequest:s,value:o}}var sw=class{constructor(e=new Uint8Array(1024)){this.buf=e,this.len=0,this.ptr=0}_write(e){if(this.len+e>this.buf.length){let t=new Uint8Array((this.len+e)*2);t.set(this.buf),this.buf=t}return this.len+=e,this.len-e}write8(e){let t=this._write(1);this.buf[t]=e}write32(e){let t=this._write(4);bm(this.buf,e,t)}write(e){let t=this._write(4+e.length);bm(this.buf,e.length,t),this.buf.set(e,t+4)}_read(e){if(this.ptr+e>this.buf.length)throw Error("Invalid packet");return this.ptr+=e,this.ptr-e}read8(){return this.buf[this._read(1)]}read32(){return ow(this.buf,this._read(4))}read(){let e=this.read32(),t=new Uint8Array(e),n=this._read(t.length);return t.set(this.buf.subarray(n,n+e)),t}},lr,Co,xm;if(typeof TextEncoder<"u"&&typeof TextDecoder<"u"){let e=new TextEncoder,t=new TextDecoder;lr=(n)=>e.encode(n),Co=(n)=>t.decode(n),xm='new TextEncoder().encode("")'}else if(typeof Buffer<"u")lr=(e)=>Buffer.from(e),Co=(e)=>{let{buffer:t,byteOffset:n,byteLength:r}=e;return Buffer.from(t,n,r).toString()},xm='Buffer.from("")';else throw Error("No UTF-8 codec found");if(!(lr("")instanceof Uint8Array))throw Error(`Invariant violation: "${xm} instanceof Uint8Array" is incorrectly false
|
|
55
56
|
|
|
56
57
|
This indicates that your JavaScript environment is broken. You cannot use
|
|
57
58
|
esbuild in this environment because esbuild relies on this invariant. This
|
|
58
59
|
is not a problem with esbuild. You need to fix your environment instead.
|
|
59
|
-
`);function
|
|
60
|
-
`;break;case 114:u+="\r";break;case 116:u+="\t";break;case 117:{let d=0;for(let p=0;p<4;p++)if(l=e[c++],d<<=4,l>=48&&l<=57)d|=l-48;else if(l>=97&&l<=102)d|=l+-87;else if(l>=65&&l<=70)d|=l+-55;else Cn(e,--c);u+=Br(d);break}default:Cn(e,--c);break}else if(l<=127)u+=Br(l);else if((l&224)===192)u+=Br((l&31)<<6|e[c++]&63);else if((l&240)===224)u+=Br((l&15)<<12|(e[c++]&63)<<6|e[c++]&63);else if((l&248)==240){let d=(l&7)<<18|(e[c++]&63)<<12|(e[c++]&63)<<6|e[c++]&63;if(d>65535)d-=65536,u+=Br(d>>10&1023|55296),d=56320|d&1023;u+=Br(d)}}u[0];break}case 91:{u=[],t.push(o),n.push(a),r.push(i),o=null,a=u,i=1;continue}case 123:{u={},t.push(o),n.push(a),r.push(i),o=null,a=u,i=2;continue}case 93:{if(i!==1)Cn(e,--c);u=a,o=t.pop(),a=n.pop(),i=r.pop();break}case 125:{if(i!==2)Cn(e,--c);u=a,o=t.pop(),a=n.pop(),i=r.pop();break}default:Cn(e,--c)}l=e[c];while(l<=32)l=e[++c];switch(i){case 0:{if(c===s)return u;break}case 1:{if(a.push(u),l===44){c++;continue}if(l===93)continue;break}case 2:{if(o===null){if(o=u,l===58){c++;continue}}else{if(a[o]=u,o=null,l===44){c++;continue}if(l===125)continue}break}}break}Cn(e,c)}var bt=JSON.stringify,Lx="warning",Vx="silent";function fi(e,t){let n=[];for(let r of e){if(sn(r,t),r.indexOf(",")>=0)throw Error(`Invalid ${t}: ${r}`);n.push(r)}return n.join(",")}var Al=()=>null,et=(e)=>typeof e==="boolean"?null:"a boolean",re=(e)=>typeof e==="string"?null:"a string",Rl=(e)=>e instanceof RegExp?null:"a RegExp object",yo=(e)=>typeof e==="number"&&e===(e|0)?null:"an integer",TN=(e)=>typeof e==="number"&&e===(e|0)&&e>=0&&e<=65535?null:"a valid port number",Yx=(e)=>typeof e==="function"?null:"a function",zr=(e)=>Array.isArray(e)?null:"an array",on=(e)=>Array.isArray(e)&&e.every((t)=>typeof t==="string")?null:"an array of strings",wn=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)?null:"an object",JN=(e)=>typeof e==="object"&&e!==null?null:"an array or an object",IN=(e)=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",qx=(e)=>typeof e==="object"&&!Array.isArray(e)?null:"an object or null",Zx=(e)=>typeof e==="string"||typeof e==="boolean"?null:"a string or a boolean",MN=(e)=>typeof e==="string"||typeof e==="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",Qx=(e)=>typeof e==="string"||Array.isArray(e)&&e.every((t)=>typeof t==="string")?null:"a string or an array of strings",eb=(e)=>typeof e==="string"||e instanceof Uint8Array?null:"a string or a Uint8Array",DN=(e)=>typeof e==="string"||e instanceof URL?null:"a string or a URL";function R(e,t,n,r){let s=e[n];if(t[n+""]=!0,s===void 0)return;let o=r(s);if(o!==null)throw Error(`${bt(n)} must be ${o}`);return s}function gt(e,t,n){for(let r in e)if(!(r in t))throw Error(`Invalid option ${n}: ${bt(r)}`)}function FN(e){let t=Object.create(null),n=R(e,t,"wasmURL",DN),r=R(e,t,"wasmModule",IN),s=R(e,t,"worker",et);return gt(e,t,"in initialize() call"),{wasmURL:n,wasmModule:r,worker:s}}function tb(e){let t;if(e!==void 0){t=Object.create(null);for(let n in e){let r=e[n];if(typeof r==="string"||r===!1)t[n]=r;else throw Error(`Expected ${bt(n)} in mangle cache to map to either a string or false`)}}return t}function Il(e,t,n,r,s){let o=R(t,n,"color",et),i=R(t,n,"logLevel",re),a=R(t,n,"logLimit",yo),c=R(t,n,"logStyle",re);if(o!==void 0)e.push(`--color=${o}`);else if(r)e.push("--color=true");if(e.push(`--log-level=${i||s}`),e.push(`--log-limit=${a||0}`),c)e.push(`--log-style=${c}`)}function sn(e,t,n){if(typeof e!=="string")throw Error(`Expected value for ${t}${n!==void 0?" "+bt(n):""} to be a string, got ${typeof e} instead`);return e}function nb(e,t,n){let r=R(t,n,"legalComments",re),s=R(t,n,"sourceRoot",re),o=R(t,n,"sourcesContent",et),i=R(t,n,"target",Qx),a=R(t,n,"format",re),c=R(t,n,"globalName",re),l=R(t,n,"mangleProps",Rl),u=R(t,n,"reserveProps",Rl),d=R(t,n,"mangleQuoted",et),p=R(t,n,"minify",et),m=R(t,n,"minifySyntax",et),x=R(t,n,"minifyWhitespace",et),h=R(t,n,"minifyIdentifiers",et),g=R(t,n,"lineLimit",yo),b=R(t,n,"drop",on),j=R(t,n,"dropLabels",on),v=R(t,n,"charset",re),P=R(t,n,"treeShaking",et),S=R(t,n,"ignoreAnnotations",et),_=R(t,n,"jsx",re),N=R(t,n,"jsxFactory",re),F=R(t,n,"jsxFragment",re),K=R(t,n,"jsxImportSource",re),J=R(t,n,"jsxDev",et),C=R(t,n,"jsxSideEffects",et),L=R(t,n,"define",wn),G=R(t,n,"logOverride",wn),te=R(t,n,"supported",wn),de=R(t,n,"pure",on),ae=R(t,n,"keepNames",et),ne=R(t,n,"platform",re),se=R(t,n,"tsconfigRaw",MN),xe=R(t,n,"absPaths",on);if(r)e.push(`--legal-comments=${r}`);if(s!==void 0)e.push(`--source-root=${s}`);if(o!==void 0)e.push(`--sources-content=${o}`);if(i)e.push(`--target=${fi(Array.isArray(i)?i:[i],"target")}`);if(a)e.push(`--format=${a}`);if(c)e.push(`--global-name=${c}`);if(ne)e.push(`--platform=${ne}`);if(se)e.push(`--tsconfig-raw=${typeof se==="string"?se:JSON.stringify(se)}`);if(p)e.push("--minify");if(m)e.push("--minify-syntax");if(x)e.push("--minify-whitespace");if(h)e.push("--minify-identifiers");if(g)e.push(`--line-limit=${g}`);if(v)e.push(`--charset=${v}`);if(P!==void 0)e.push(`--tree-shaking=${P}`);if(S)e.push("--ignore-annotations");if(b)for(let z of b)e.push(`--drop:${sn(z,"drop")}`);if(j)e.push(`--drop-labels=${fi(j,"drop label")}`);if(xe)e.push(`--abs-paths=${fi(xe,"abs paths")}`);if(l)e.push(`--mangle-props=${Cl(l)}`);if(u)e.push(`--reserve-props=${Cl(u)}`);if(d!==void 0)e.push(`--mangle-quoted=${d}`);if(_)e.push(`--jsx=${_}`);if(N)e.push(`--jsx-factory=${N}`);if(F)e.push(`--jsx-fragment=${F}`);if(K)e.push(`--jsx-import-source=${K}`);if(J)e.push("--jsx-dev");if(C)e.push("--jsx-side-effects");if(L)for(let z in L){if(z.indexOf("=")>=0)throw Error(`Invalid define: ${z}`);e.push(`--define:${z}=${sn(L[z],"define",z)}`)}if(G)for(let z in G){if(z.indexOf("=")>=0)throw Error(`Invalid log override: ${z}`);e.push(`--log-override:${z}=${sn(G[z],"log override",z)}`)}if(te)for(let z in te){if(z.indexOf("=")>=0)throw Error(`Invalid supported: ${z}`);let ye=te[z];if(typeof ye!=="boolean")throw Error(`Expected value for supported ${bt(z)} to be a boolean, got ${typeof ye} instead`);e.push(`--supported:${z}=${ye}`)}if(de)for(let z of de)e.push(`--pure:${sn(z,"pure")}`);if(ae)e.push("--keep-names")}function LN(e,t,n,r,s){var o;let i=[],a=[],c=Object.create(null),l=null,u=null;Il(i,t,c,n,r),nb(i,t,c);let d=R(t,c,"sourcemap",Zx),p=R(t,c,"bundle",et),m=R(t,c,"splitting",et),x=R(t,c,"preserveSymlinks",et),h=R(t,c,"metafile",et),g=R(t,c,"outfile",re),b=R(t,c,"outdir",re),j=R(t,c,"outbase",re),v=R(t,c,"tsconfig",re),P=R(t,c,"resolveExtensions",on),S=R(t,c,"nodePaths",on),_=R(t,c,"mainFields",on),N=R(t,c,"conditions",on),F=R(t,c,"external",on),K=R(t,c,"packages",re),J=R(t,c,"alias",wn),C=R(t,c,"loader",wn),L=R(t,c,"outExtension",wn),G=R(t,c,"publicPath",re),te=R(t,c,"entryNames",re),de=R(t,c,"chunkNames",re),ae=R(t,c,"assetNames",re),ne=R(t,c,"inject",on),se=R(t,c,"banner",wn),xe=R(t,c,"footer",wn),z=R(t,c,"entryPoints",JN),ye=R(t,c,"absWorkingDir",re),pe=R(t,c,"stdin",wn),ee=(o=R(t,c,"write",et))!=null?o:s,Qe=R(t,c,"allowOverwrite",et),Me=R(t,c,"mangleCache",wn);if(c.plugins=!0,gt(t,c,`in ${e}() call`),d)i.push(`--sourcemap${d===!0?"":`=${d}`}`);if(p)i.push("--bundle");if(Qe)i.push("--allow-overwrite");if(m)i.push("--splitting");if(x)i.push("--preserve-symlinks");if(h)i.push("--metafile");if(g)i.push(`--outfile=${g}`);if(b)i.push(`--outdir=${b}`);if(j)i.push(`--outbase=${j}`);if(v)i.push(`--tsconfig=${v}`);if(K)i.push(`--packages=${K}`);if(P)i.push(`--resolve-extensions=${fi(P,"resolve extension")}`);if(G)i.push(`--public-path=${G}`);if(te)i.push(`--entry-names=${te}`);if(de)i.push(`--chunk-names=${de}`);if(ae)i.push(`--asset-names=${ae}`);if(_)i.push(`--main-fields=${fi(_,"main field")}`);if(N)i.push(`--conditions=${fi(N,"condition")}`);if(F)for(let X of F)i.push(`--external:${sn(X,"external")}`);if(J)for(let X in J){if(X.indexOf("=")>=0)throw Error(`Invalid package name in alias: ${X}`);i.push(`--alias:${X}=${sn(J[X],"alias",X)}`)}if(se)for(let X in se){if(X.indexOf("=")>=0)throw Error(`Invalid banner file type: ${X}`);i.push(`--banner:${X}=${sn(se[X],"banner",X)}`)}if(xe)for(let X in xe){if(X.indexOf("=")>=0)throw Error(`Invalid footer file type: ${X}`);i.push(`--footer:${X}=${sn(xe[X],"footer",X)}`)}if(ne)for(let X of ne)i.push(`--inject:${sn(X,"inject")}`);if(C)for(let X in C){if(X.indexOf("=")>=0)throw Error(`Invalid loader extension: ${X}`);i.push(`--loader:${X}=${sn(C[X],"loader",X)}`)}if(L)for(let X in L){if(X.indexOf("=")>=0)throw Error(`Invalid out extension: ${X}`);i.push(`--out-extension:${X}=${sn(L[X],"out extension",X)}`)}if(z)if(Array.isArray(z))for(let X=0,Bt=z.length;X<Bt;X++){let Et=z[X];if(typeof Et==="object"&&Et!==null){let ce=Object.create(null),be=R(Et,ce,"in",re),Fe=R(Et,ce,"out",re);if(gt(Et,ce,"in entry point at index "+X),be===void 0)throw Error('Missing property "in" for entry point at index '+X);if(Fe===void 0)throw Error('Missing property "out" for entry point at index '+X);a.push([Fe,be])}else a.push(["",sn(Et,"entry point at index "+X)])}else for(let X in z)a.push([X,sn(z[X],"entry point",X)]);if(pe){let X=Object.create(null),Bt=R(pe,X,"contents",eb),Et=R(pe,X,"resolveDir",re),ce=R(pe,X,"sourcefile",re),be=R(pe,X,"loader",re);if(gt(pe,X,'in "stdin" object'),ce)i.push(`--sourcefile=${ce}`);if(be)i.push(`--loader=${be}`);if(Et)u=Et;if(typeof Bt==="string")l=Gn(Bt);else if(Bt instanceof Uint8Array)l=Bt}let Ge=[];if(S)for(let X of S)X+="",Ge.push(X);return{entries:a,flags:i,write:ee,stdinContents:l,stdinResolveDir:u,absWorkingDir:ye,nodePaths:Ge,mangleCache:tb(Me)}}function VN(e,t,n,r){let s=[],o=Object.create(null);Il(s,t,o,n,r),nb(s,t,o);let i=R(t,o,"sourcemap",Zx),a=R(t,o,"sourcefile",re),c=R(t,o,"loader",re),l=R(t,o,"banner",re),u=R(t,o,"footer",re),d=R(t,o,"mangleCache",wn);if(gt(t,o,`in ${e}() call`),i)s.push(`--sourcemap=${i===!0?"external":i}`);if(a)s.push(`--sourcefile=${a}`);if(c)s.push(`--loader=${c}`);if(l)s.push(`--banner=${l}`);if(u)s.push(`--footer=${u}`);return{flags:s,mangleCache:tb(d)}}function rb(e){let t={},n={didClose:!1,reason:""},r={},s=0,o=0,i=new Uint8Array(16384),a=0,c=(v)=>{let P=a+v.length;if(P>i.length){let _=new Uint8Array(P*2);_.set(i),i=_}i.set(v,a),a+=v.length;let S=0;while(S+4<=a){let _=Xx(i,S);if(S+4+_>a)break;S+=4,x(i.subarray(S,S+_)),S+=_}if(S>0)i.copyWithin(0,S,a),a-=S},l=(v)=>{if(n.didClose=!0,v)n.reason=": "+(v.message||v);let P="The service was stopped"+n.reason;for(let S in r)r[S](P,null);r={}},u=(v,P,S)=>{if(n.didClose)return S("The service is no longer running"+n.reason,null);let _=s++;if(r[_]=(N,F)=>{try{S(N,F)}finally{if(v)v.unref()}},v)v.ref();e.writeToStdin(Fx({id:_,isRequest:!0,value:P}))},d=(v,P)=>{if(n.didClose)throw Error("The service is no longer running"+n.reason);e.writeToStdin(Fx({id:v,isRequest:!1,value:P}))},p=async(v,P)=>{try{if(P.command==="ping"){d(v,{});return}if(typeof P.key==="number"){let S=t[P.key];if(!S)return;let _=S[P.command];if(_){await _(v,P);return}}throw Error("Invalid command: "+P.command)}catch(S){let _=[go(S,e,null,void 0,"")];try{d(v,{errors:_})}catch{}}},m=!0,x=(v)=>{if(m){m=!1;let S=String.fromCharCode(...v);if(S!=="0.28.2")throw Error(`Cannot start service: Host version "0.28.2" does not match binary version ${bt(S)}`);return}let P=CN(v);if(P.isRequest)p(P.id,P.value);else{let S=r[P.id];if(delete r[P.id],P.value.error)S(P.value.error,{});else S(null,P.value)}};return{readFromStdout:c,afterClose:l,service:{buildOrContext:({callName:v,refs:P,options:S,isTTY:_,defaultWD:N,callback:F})=>{let K=0,J=o++,C={},L={ref(){if(++K===1){if(P)P.ref()}},unref(){if(--K===0){if(delete t[J],P)P.unref()}}};t[J]=C,L.ref(),qN(v,J,u,d,L,e,C,S,_,N,(G,te)=>{try{F(G,te)}finally{L.unref()}})},transform:({callName:v,refs:P,input:S,options:_,isTTY:N,fs:F,callback:K})=>{let J=sb(),C=(L)=>{try{if(typeof S!=="string"&&!(S instanceof Uint8Array))throw Error('The input to "transform" must be a string or a Uint8Array');let{flags:G,mangleCache:te}=VN(v,_,N,Vx),de={command:"transform",flags:G,inputFS:L!==null,input:L!==null?Gn(L):typeof S==="string"?Gn(S):S};if(te)de.mangleCache=te;u(P,de,(ae,ne)=>{if(ae)return K(Error(ae),null);let se=di(ne.errors,J),xe=di(ne.warnings,J),z=1,ye=()=>{if(--z===0){let pe={warnings:xe,code:ne.code,map:ne.map,mangleCache:void 0,legalComments:void 0};if("legalComments"in ne)pe.legalComments=ne==null?void 0:ne.legalComments;if(ne.mangleCache)pe.mangleCache=ne==null?void 0:ne.mangleCache;K(null,pe)}};if(se.length>0)return K(La("Transform failed",se,xe),null);if(ne.codeFS)z++,F.readFile(ne.code,(pe,ee)=>{if(pe!==null)K(pe,null);else ne.code=ee,ye()});if(ne.mapFS)z++,F.readFile(ne.map,(pe,ee)=>{if(pe!==null)K(pe,null);else ne.map=ee,ye()});ye()})}catch(G){let te=[];try{Il(te,_,{},N,Vx)}catch{}let de=go(G,e,J,void 0,"");u(P,{command:"error",flags:te,error:de},()=>{de.detail=J.load(de.detail),K(La("Transform failed",[de],[]),null)})}};if((typeof S==="string"||S instanceof Uint8Array)&&S.length>1048576){let L=C;C=()=>F.writeFile(S,L)}C(null)},formatMessages:({callName:v,refs:P,messages:S,options:_,callback:N})=>{if(!_)throw Error(`Missing second argument in ${v}() call`);let F={},K=R(_,F,"kind",re),J=R(_,F,"color",et),C=R(_,F,"terminalWidth",yo),L=R(_,F,"logStyle",re);if(gt(_,F,`in ${v}() call`),K===void 0)throw Error(`Missing "kind" in ${v}() call`);if(K!=="error"&&K!=="warning")throw Error(`Expected "kind" to be "error" or "warning" in ${v}() call`);let G={command:"format-msgs",messages:Kr(S,"messages",null,"",C),isWarning:K==="warning"};if(J!==void 0)G.color=J;if(C!==void 0)G.terminalWidth=C;if(L!==void 0)G.logStyle=L;u(P,G,(te,de)=>{if(te)return N(Error(te),null);N(null,de.messages)})},analyzeMetafile:({callName:v,refs:P,metafile:S,options:_,callback:N})=>{if(_===void 0)_={};let F={},K=R(_,F,"color",et),J=R(_,F,"verbose",et);gt(_,F,`in ${v}() call`);let C={command:"analyze-metafile",metafile:S};if(K!==void 0)C.color=K;if(J!==void 0)C.verbose=J;u(P,C,(L,G)=>{if(L)return N(Error(L),null);N(null,G.result)})}}}}function qN(e,t,n,r,s,o,i,a,c,l,u){let d=sb(),p=e==="context",m=(g,b)=>{let j=[];try{Il(j,a,{},c,Lx)}catch{}let v=go(g,o,d,void 0,b);n(s,{command:"error",flags:j,error:v},()=>{v.detail=d.load(v.detail),u(La(p?"Context failed":"Build failed",[v],[]),null)})},x;if(typeof a==="object"){let g=a.plugins;if(g!==void 0){if(!Array.isArray(g))return m(Error('"plugins" must be an array'),"");x=g}}if(x&&x.length>0){if(o.isSync)return m(Error("Cannot use plugins in synchronous API calls"),"");WN(t,n,r,s,o,i,a,x,d).then((g)=>{if(!g.ok)return m(g.error,g.pluginName);try{h(g.requestPlugins,g.runOnEndCallbacks,g.scheduleOnDisposeCallbacks)}catch(b){m(b,"")}},(g)=>m(g,""));return}try{h(null,(g,b)=>b([],[]),()=>{})}catch(g){m(g,"")}function h(g,b,j){let v=o.hasFS,{entries:P,flags:S,write:_,stdinContents:N,stdinResolveDir:F,absWorkingDir:K,nodePaths:J,mangleCache:C}=LN(e,a,c,Lx,v);if(_&&!o.hasFS)throw Error('The "write" option is unavailable in this environment');let L={command:"build",key:t,entries:P,flags:S,write:_,stdinContents:N,stdinResolveDir:F,absWorkingDir:K||l,nodePaths:J,context:p};if(g)L.plugins=g;if(C)L.mangleCache=C;let G=(ae,ne)=>{let se={errors:di(ae.errors,d),warnings:di(ae.warnings,d),outputFiles:void 0,metafile:void 0,mangleCache:void 0},xe=se.errors.slice(),z=se.warnings.slice();if(ae.outputFiles)se.outputFiles=ae.outputFiles.map(UN);if(ae.metafile&&ae.metafile.length)se.metafile=BN(ae.metafile);if(ae.mangleCache)se.mangleCache=ae.mangleCache;if(ae.writeToStdout!==void 0)console.log($o(ae.writeToStdout).replace(/\n$/,""));b(se,(ye,pe)=>{if(xe.length>0||ye.length>0){let ee=La("Build failed",xe.concat(ye),z.concat(pe));return ne(ee,null,ye,pe)}ne(null,se,ye,pe)})},te,de;if(p)i["on-end"]=(ae,ne)=>new Promise((se)=>{G(ne,(xe,z,ye,pe)=>{let ee={errors:ye,warnings:pe};if(de)de(xe,z);te=void 0,de=void 0,r(ae,ee),se()})});n(s,L,(ae,ne)=>{if(ae)return u(Error(ae),null);if(!p)return G(ne,(z,ye)=>(j(),u(z,ye)));if(ne.errors.length>0)return u(La("Context failed",ne.errors,ne.warnings),null);let se=!1,xe={rebuild:()=>{if(!te)te=new Promise((z,ye)=>{let pe;de=(Qe,Me)=>{if(!pe)pe=()=>Qe?ye(Qe):z(Me)};let ee=()=>{n(s,{command:"rebuild",key:t},(Me,Ge)=>{if(Me)ye(Error(Me));else if(pe)pe();else ee()})};ee()});return te},watch:(z={})=>new Promise((ye,pe)=>{if(!o.hasFS)throw Error('Cannot use the "watch" API in this environment');let ee={},Qe=R(z,ee,"delay",yo);gt(z,ee,"in watch() call");let Me={command:"watch",key:t};if(Qe)Me.delay=Qe;n(s,Me,(Ge)=>{if(Ge)pe(Error(Ge));else ye(void 0)})}),serve:(z={})=>new Promise((ye,pe)=>{if(!o.hasFS)throw Error('Cannot use the "serve" API in this environment');let ee={},Qe=R(z,ee,"port",TN),Me=R(z,ee,"host",re),Ge=R(z,ee,"servedir",re),X=R(z,ee,"keyfile",re),Bt=R(z,ee,"certfile",re),Et=R(z,ee,"fallback",re),ce=R(z,ee,"cors",wn),be=R(z,ee,"onRequest",Yx);gt(z,ee,"in serve() call");let Fe={command:"serve",key:t,onRequest:!!be};if(Qe!==void 0)Fe.port=Qe;if(Me!==void 0)Fe.host=Me;if(Ge!==void 0)Fe.servedir=Ge;if(X!==void 0)Fe.keyfile=X;if(Bt!==void 0)Fe.certfile=Bt;if(Et!==void 0)Fe.fallback=Et;if(ce){let Le={},ot=R(ce,Le,"origin",Qx);if(gt(ce,Le,'on "cors" object'),Array.isArray(ot))Fe.corsOrigin=ot;else if(ot!==void 0)Fe.corsOrigin=[ot]}n(s,Fe,(Le,ot)=>{if(Le)return pe(Error(Le));if(be)i["serve-request"]=(Nr,nr)=>{be(nr.args),r(Nr,{})};ye(ot)})}),cancel:()=>new Promise((z)=>{if(se)return z();n(s,{command:"cancel",key:t},()=>{z()})}),dispose:()=>new Promise((z)=>{if(se)return z();se=!0,n(s,{command:"dispose",key:t},()=>{z(),j(),s.unref()})})};s.ref(),u(null,xe)})}}var WN=async(e,t,n,r,s,o,i,a,c)=>{let l=[],u=[],d={},p={},m=[],x=0,h=0,g=[],b=!1;a=[...a];for(let P of a){let S={};if(typeof P!=="object")throw Error(`Plugin at index ${h} must be an object`);let _=R(P,S,"name",re);if(typeof _!=="string"||_==="")throw Error(`Plugin at index ${h} is missing a name`);try{let N=R(P,S,"setup",Yx);if(typeof N!=="function")throw Error("Plugin is missing a setup function");gt(P,S,`on plugin ${bt(_)}`);let F={name:_,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};h++;let J=N({initialOptions:i,resolve:(C,L={})=>{if(!b)throw Error('Cannot call "resolve" before plugin setup has completed');if(typeof C!=="string")throw Error("The path to resolve must be a string");let G=Object.create(null),te=R(L,G,"pluginName",re),de=R(L,G,"importer",re),ae=R(L,G,"namespace",re),ne=R(L,G,"resolveDir",re),se=R(L,G,"kind",re),xe=R(L,G,"pluginData",Al),z=R(L,G,"with",wn);return gt(L,G,"in resolve() call"),new Promise((ye,pe)=>{let ee={command:"resolve",path:C,key:e,pluginName:_};if(te!=null)ee.pluginName=te;if(de!=null)ee.importer=de;if(ae!=null)ee.namespace=ae;if(ne!=null)ee.resolveDir=ne;if(se!=null)ee.kind=se;else throw Error('Must specify "kind" when calling "resolve"');if(xe!=null)ee.pluginData=c.store(xe);if(z!=null)ee.with=HN(z,"with");t(r,ee,(Qe,Me)=>{if(Qe!==null)pe(Error(Qe));else ye({errors:di(Me.errors,c),warnings:di(Me.warnings,c),path:Me.path,external:Me.external,sideEffects:Me.sideEffects,namespace:Me.namespace,suffix:Me.suffix,pluginData:c.load(Me.pluginData)})})})},onStart(C){let G=kl(Error('This error came from the "onStart" callback registered here:'),s,"onStart");l.push({name:_,callback:C,note:G}),F.onStart=!0},onEnd(C){let G=kl(Error('This error came from the "onEnd" callback registered here:'),s,"onEnd");u.push({name:_,callback:C,note:G}),F.onEnd=!0},onResolve(C,L){let te=kl(Error('This error came from the "onResolve" callback registered here:'),s,"onResolve"),de={},ae=R(C,de,"filter",Rl),ne=R(C,de,"namespace",re);if(gt(C,de,`in onResolve() call for plugin ${bt(_)}`),ae==null)throw Error("onResolve() call is missing a filter");let se=x++;d[se]={name:_,callback:L,note:te},F.onResolve.push({id:se,filter:Cl(ae),namespace:ne||""})},onLoad(C,L){let te=kl(Error('This error came from the "onLoad" callback registered here:'),s,"onLoad"),de={},ae=R(C,de,"filter",Rl),ne=R(C,de,"namespace",re);if(gt(C,de,`in onLoad() call for plugin ${bt(_)}`),ae==null)throw Error("onLoad() call is missing a filter");let se=x++;p[se]={name:_,callback:L,note:te},F.onLoad.push({id:se,filter:Cl(ae),namespace:ne||""})},onDispose(C){m.push(C)},esbuild:s.esbuild});if(J)await J;g.push(F)}catch(N){return{ok:!1,error:N,pluginName:_}}}o["on-start"]=async(P,S)=>{c.clear();let _={errors:[],warnings:[]};await Promise.all(l.map(async({name:N,callback:F,note:K})=>{try{let J=await F();if(J!=null){if(typeof J!=="object")throw Error(`Expected onStart() callback in plugin ${bt(N)} to return an object`);let C={},L=R(J,C,"errors",zr),G=R(J,C,"warnings",zr);if(gt(J,C,`from onStart() callback in plugin ${bt(N)}`),L!=null)_.errors.push(...Kr(L,"errors",c,N,void 0));if(G!=null)_.warnings.push(...Kr(G,"warnings",c,N,void 0))}}catch(J){_.errors.push(go(J,s,c,K&&K(),N))}})),n(P,_)},o["on-resolve"]=async(P,S)=>{let _={},N="",F,K;for(let J of S.ids)try{({name:N,callback:F,note:K}=d[J]);let C=await F({path:S.path,importer:S.importer,namespace:S.namespace,resolveDir:S.resolveDir,kind:S.kind,pluginData:c.load(S.pluginData),with:S.with});if(C!=null){if(typeof C!=="object")throw Error(`Expected onResolve() callback in plugin ${bt(N)} to return an object`);let L={},G=R(C,L,"pluginName",re),te=R(C,L,"path",re),de=R(C,L,"namespace",re),ae=R(C,L,"suffix",re),ne=R(C,L,"external",et),se=R(C,L,"sideEffects",et),xe=R(C,L,"pluginData",Al),z=R(C,L,"errors",zr),ye=R(C,L,"warnings",zr),pe=R(C,L,"watchFiles",on),ee=R(C,L,"watchDirs",on);if(gt(C,L,`from onResolve() callback in plugin ${bt(N)}`),_.id=J,G!=null)_.pluginName=G;if(te!=null)_.path=te;if(de!=null)_.namespace=de;if(ae!=null)_.suffix=ae;if(ne!=null)_.external=ne;if(se!=null)_.sideEffects=se;if(xe!=null)_.pluginData=c.store(xe);if(z!=null)_.errors=Kr(z,"errors",c,N,void 0);if(ye!=null)_.warnings=Kr(ye,"warnings",c,N,void 0);if(pe!=null)_.watchFiles=Ol(pe,"watchFiles");if(ee!=null)_.watchDirs=Ol(ee,"watchDirs");break}}catch(C){_={id:J,errors:[go(C,s,c,K&&K(),N)]};break}n(P,_)},o["on-load"]=async(P,S)=>{let _={},N="",F,K;for(let J of S.ids)try{({name:N,callback:F,note:K}=p[J]);let C=await F({path:S.path,namespace:S.namespace,suffix:S.suffix,pluginData:c.load(S.pluginData),with:S.with});if(C!=null){if(typeof C!=="object")throw Error(`Expected onLoad() callback in plugin ${bt(N)} to return an object`);let L={},G=R(C,L,"pluginName",re),te=R(C,L,"contents",eb),de=R(C,L,"resolveDir",re),ae=R(C,L,"pluginData",Al),ne=R(C,L,"loader",re),se=R(C,L,"errors",zr),xe=R(C,L,"warnings",zr),z=R(C,L,"watchFiles",on),ye=R(C,L,"watchDirs",on);if(gt(C,L,`from onLoad() callback in plugin ${bt(N)}`),_.id=J,G!=null)_.pluginName=G;if(te instanceof Uint8Array)_.contents=te;else if(te!=null)_.contents=Gn(te);if(de!=null)_.resolveDir=de;if(ae!=null)_.pluginData=c.store(ae);if(ne!=null)_.loader=ne;if(se!=null)_.errors=Kr(se,"errors",c,N,void 0);if(xe!=null)_.warnings=Kr(xe,"warnings",c,N,void 0);if(z!=null)_.watchFiles=Ol(z,"watchFiles");if(ye!=null)_.watchDirs=Ol(ye,"watchDirs");break}}catch(C){_={id:J,errors:[go(C,s,c,K&&K(),N)]};break}n(P,_)};let j=(P,S)=>S([],[]);if(u.length>0)j=(P,S)=>{(async()=>{let _=[],N=[];for(let{name:F,callback:K,note:J}of u){let C,L;try{let G=await K(P);if(G!=null){if(typeof G!=="object")throw Error(`Expected onEnd() callback in plugin ${bt(F)} to return an object`);let te={},de=R(G,te,"errors",zr),ae=R(G,te,"warnings",zr);if(gt(G,te,`from onEnd() callback in plugin ${bt(F)}`),de!=null)C=Kr(de,"errors",c,F,void 0);if(ae!=null)L=Kr(ae,"warnings",c,F,void 0)}}catch(G){C=[go(G,s,c,J&&J(),F)]}if(C){_.push(...C);try{P.errors.push(...C)}catch{}}if(L){N.push(...L);try{P.warnings.push(...L)}catch{}}}S(_,N)})()};let v=()=>{for(let P of m)setTimeout(()=>P(),0)};return b=!0,{ok:!0,requestPlugins:g,runOnEndCallbacks:j,scheduleOnDisposeCallbacks:v}};function sb(){let e=new Map,t=0;return{clear(){e.clear()},load(n){return e.get(n)},store(n){if(n===void 0)return-1;let r=t++;return e.set(r,n),r}}}function kl(e,t,n){let r,s=!1;return()=>{if(s)return r;s=!0;try{let o=(e.stack+"").split(`
|
|
61
|
-
`);o.splice(1,1);let i=
|
|
62
|
-
`),"")}catch{}return{id:"",pluginName:s,text:o,location:i,notes:r?[r]:[],detail:n?n.store(e):-1}}function
|
|
60
|
+
`);function ow(e,t){return(e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)>>>0}function bm(e,t,n){e[n++]=t,e[n++]=t>>8,e[n++]=t>>16,e[n++]=t>>24}var as=String.fromCharCode;function Hn(e,t,n){let r=e[t],s=1,o=0;for(let i=0;i<t;i++)if(e[i]===10)s++,o=0;else o++;throw SyntaxError(n?n:t===e.length?"Unexpected end of input while parsing JSON":r>=32&&r<=126?`Unexpected character ${as(r)} in JSON at position ${t} (line ${s}, column ${o})`:`Unexpected byte 0x${r.toString(16)} in JSON at position ${t} (line ${s}, column ${o})`)}function pM(e){if(!(e instanceof Uint8Array))throw Error("JSON input must be a Uint8Array");let t=[],n=[],r=[],s=e.length,o=null,i=0,a,l=0;while(l<s){let c=e[l++];if(c<=32)continue;let u;if(i===2&&o===null&&c!==34&&c!==125)Hn(e,--l);switch(c){case 116:{if(e[l++]!==114||e[l++]!==117||e[l++]!==101)Hn(e,--l);u=!0;break}case 102:{if(e[l++]!==97||e[l++]!==108||e[l++]!==115||e[l++]!==101)Hn(e,--l);u=!1;break}case 110:{if(e[l++]!==117||e[l++]!==108||e[l++]!==108)Hn(e,--l);u=null;break}case 45:case 46:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:{let d=l;u=as(c),c=e[l];while(!0){switch(c){case 43:case 45:case 46:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 101:case 69:{u+=as(c),c=e[++l];continue}}break}if(u=+u,isNaN(u))Hn(e,--d,"Invalid number");break}case 34:{u="";while(!0){if(l>=s)Hn(e,s);if(c=e[l++],c===34)break;else if(c===92)switch(e[l++]){case 34:u+='"';break;case 47:u+="/";break;case 92:u+="\\";break;case 98:u+="\b";break;case 102:u+="\f";break;case 110:u+=`
|
|
61
|
+
`;break;case 114:u+="\r";break;case 116:u+="\t";break;case 117:{let d=0;for(let p=0;p<4;p++)if(c=e[l++],d<<=4,c>=48&&c<=57)d|=c-48;else if(c>=97&&c<=102)d|=c+-87;else if(c>=65&&c<=70)d|=c+-55;else Hn(e,--l);u+=as(d);break}default:Hn(e,--l);break}else if(c<=127)u+=as(c);else if((c&224)===192)u+=as((c&31)<<6|e[l++]&63);else if((c&240)===224)u+=as((c&15)<<12|(e[l++]&63)<<6|e[l++]&63);else if((c&248)==240){let d=(c&7)<<18|(e[l++]&63)<<12|(e[l++]&63)<<6|e[l++]&63;if(d>65535)d-=65536,u+=as(d>>10&1023|55296),d=56320|d&1023;u+=as(d)}}u[0];break}case 91:{u=[],t.push(o),n.push(a),r.push(i),o=null,a=u,i=1;continue}case 123:{u={},t.push(o),n.push(a),r.push(i),o=null,a=u,i=2;continue}case 93:{if(i!==1)Hn(e,--l);u=a,o=t.pop(),a=n.pop(),i=r.pop();break}case 125:{if(i!==2)Hn(e,--l);u=a,o=t.pop(),a=n.pop(),i=r.pop();break}default:Hn(e,--l)}c=e[l];while(c<=32)c=e[++l];switch(i){case 0:{if(l===s)return u;break}case 1:{if(a.push(u),c===44){l++;continue}if(c===93)continue;break}case 2:{if(o===null){if(o=u,c===58){l++;continue}}else{if(a[o]=u,o=null,c===44){l++;continue}if(c===125)continue}break}}break}Hn(e,l)}var Ct=JSON.stringify,GS="warning",XS="silent";function wi(e,t){let n=[];for(let r of e){if(pn(r,t),r.indexOf(",")>=0)throw Error(`Invalid ${t}: ${r}`);n.push(r)}return n.join(",")}var Su=()=>null,ot=(e)=>typeof e==="boolean"?null:"a boolean",se=(e)=>typeof e==="string"?null:"a string",wu=(e)=>e instanceof RegExp?null:"a RegExp object",ko=(e)=>typeof e==="number"&&e===(e|0)?null:"an integer",mM=(e)=>typeof e==="number"&&e===(e|0)&&e>=0&&e<=65535?null:"a valid port number",iw=(e)=>typeof e==="function"?null:"a function",ls=(e)=>Array.isArray(e)?null:"an array",mn=(e)=>Array.isArray(e)&&e.every((t)=>typeof t==="string")?null:"an array of strings",Cn=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)?null:"an object",hM=(e)=>typeof e==="object"&&e!==null?null:"an array or an object",gM=(e)=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",YS=(e)=>typeof e==="object"&&!Array.isArray(e)?null:"an object or null",aw=(e)=>typeof e==="string"||typeof e==="boolean"?null:"a string or a boolean",yM=(e)=>typeof e==="string"||typeof e==="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",lw=(e)=>typeof e==="string"||Array.isArray(e)&&e.every((t)=>typeof t==="string")?null:"a string or an array of strings",cw=(e)=>typeof e==="string"||e instanceof Uint8Array?null:"a string or a Uint8Array",xM=(e)=>typeof e==="string"||e instanceof URL?null:"a string or a URL";function R(e,t,n,r){let s=e[n];if(t[n+""]=!0,s===void 0)return;let o=r(s);if(o!==null)throw Error(`${Ct(n)} must be ${o}`);return s}function vt(e,t,n){for(let r in e)if(!(r in t))throw Error(`Invalid option ${n}: ${Ct(r)}`)}function bM(e){let t=Object.create(null),n=R(e,t,"wasmURL",xM),r=R(e,t,"wasmModule",gM),s=R(e,t,"worker",ot);return vt(e,t,"in initialize() call"),{wasmURL:n,wasmModule:r,worker:s}}function uw(e){let t;if(e!==void 0){t=Object.create(null);for(let n in e){let r=e[n];if(typeof r==="string"||r===!1)t[n]=r;else throw Error(`Expected ${Ct(n)} in mangle cache to map to either a string or false`)}}return t}function _u(e,t,n,r,s){let o=R(t,n,"color",ot),i=R(t,n,"logLevel",se),a=R(t,n,"logLimit",ko),l=R(t,n,"logStyle",se);if(o!==void 0)e.push(`--color=${o}`);else if(r)e.push("--color=true");if(e.push(`--log-level=${i||s}`),e.push(`--log-limit=${a||0}`),l)e.push(`--log-style=${l}`)}function pn(e,t,n){if(typeof e!=="string")throw Error(`Expected value for ${t}${n!==void 0?" "+Ct(n):""} to be a string, got ${typeof e} instead`);return e}function fw(e,t,n){let r=R(t,n,"legalComments",se),s=R(t,n,"sourceRoot",se),o=R(t,n,"sourcesContent",ot),i=R(t,n,"target",lw),a=R(t,n,"format",se),l=R(t,n,"globalName",se),c=R(t,n,"mangleProps",wu),u=R(t,n,"reserveProps",wu),d=R(t,n,"mangleQuoted",ot),p=R(t,n,"minify",ot),m=R(t,n,"minifySyntax",ot),y=R(t,n,"minifyWhitespace",ot),S=R(t,n,"minifyIdentifiers",ot),g=R(t,n,"lineLimit",ko),x=R(t,n,"drop",mn),P=R(t,n,"dropLabels",mn),w=R(t,n,"charset",se),E=R(t,n,"treeShaking",ot),j=R(t,n,"ignoreAnnotations",ot),A=R(t,n,"jsx",se),T=R(t,n,"jsxFactory",se),I=R(t,n,"jsxFragment",se),V=R(t,n,"jsxImportSource",se),H=R(t,n,"jsxDev",ot),O=R(t,n,"jsxSideEffects",ot),N=R(t,n,"define",Cn),G=R(t,n,"logOverride",Cn),Q=R(t,n,"supported",Cn),re=R(t,n,"pure",mn),ue=R(t,n,"keepNames",ot),ne=R(t,n,"platform",se),fe=R(t,n,"tsconfigRaw",yM),xe=R(t,n,"absPaths",mn);if(r)e.push(`--legal-comments=${r}`);if(s!==void 0)e.push(`--source-root=${s}`);if(o!==void 0)e.push(`--sources-content=${o}`);if(i)e.push(`--target=${wi(Array.isArray(i)?i:[i],"target")}`);if(a)e.push(`--format=${a}`);if(l)e.push(`--global-name=${l}`);if(ne)e.push(`--platform=${ne}`);if(fe)e.push(`--tsconfig-raw=${typeof fe==="string"?fe:JSON.stringify(fe)}`);if(p)e.push("--minify");if(m)e.push("--minify-syntax");if(y)e.push("--minify-whitespace");if(S)e.push("--minify-identifiers");if(g)e.push(`--line-limit=${g}`);if(w)e.push(`--charset=${w}`);if(E!==void 0)e.push(`--tree-shaking=${E}`);if(j)e.push("--ignore-annotations");if(x)for(let X of x)e.push(`--drop:${pn(X,"drop")}`);if(P)e.push(`--drop-labels=${wi(P,"drop label")}`);if(xe)e.push(`--abs-paths=${wi(xe,"abs paths")}`);if(c)e.push(`--mangle-props=${vu(c)}`);if(u)e.push(`--reserve-props=${vu(u)}`);if(d!==void 0)e.push(`--mangle-quoted=${d}`);if(A)e.push(`--jsx=${A}`);if(T)e.push(`--jsx-factory=${T}`);if(I)e.push(`--jsx-fragment=${I}`);if(V)e.push(`--jsx-import-source=${V}`);if(H)e.push("--jsx-dev");if(O)e.push("--jsx-side-effects");if(N)for(let X in N){if(X.indexOf("=")>=0)throw Error(`Invalid define: ${X}`);e.push(`--define:${X}=${pn(N[X],"define",X)}`)}if(G)for(let X in G){if(X.indexOf("=")>=0)throw Error(`Invalid log override: ${X}`);e.push(`--log-override:${X}=${pn(G[X],"log override",X)}`)}if(Q)for(let X in Q){if(X.indexOf("=")>=0)throw Error(`Invalid supported: ${X}`);let B=Q[X];if(typeof B!=="boolean")throw Error(`Expected value for supported ${Ct(X)} to be a boolean, got ${typeof B} instead`);e.push(`--supported:${X}=${B}`)}if(re)for(let X of re)e.push(`--pure:${pn(X,"pure")}`);if(ue)e.push("--keep-names")}function $M(e,t,n,r,s){var o;let i=[],a=[],l=Object.create(null),c=null,u=null;_u(i,t,l,n,r),fw(i,t,l);let d=R(t,l,"sourcemap",aw),p=R(t,l,"bundle",ot),m=R(t,l,"splitting",ot),y=R(t,l,"preserveSymlinks",ot),S=R(t,l,"metafile",ot),g=R(t,l,"outfile",se),x=R(t,l,"outdir",se),P=R(t,l,"outbase",se),w=R(t,l,"tsconfig",se),E=R(t,l,"resolveExtensions",mn),j=R(t,l,"nodePaths",mn),A=R(t,l,"mainFields",mn),T=R(t,l,"conditions",mn),I=R(t,l,"external",mn),V=R(t,l,"packages",se),H=R(t,l,"alias",Cn),O=R(t,l,"loader",Cn),N=R(t,l,"outExtension",Cn),G=R(t,l,"publicPath",se),Q=R(t,l,"entryNames",se),re=R(t,l,"chunkNames",se),ue=R(t,l,"assetNames",se),ne=R(t,l,"inject",mn),fe=R(t,l,"banner",Cn),xe=R(t,l,"footer",Cn),X=R(t,l,"entryPoints",hM),B=R(t,l,"absWorkingDir",se),q=R(t,l,"stdin",Cn),z=(o=R(t,l,"write",ot))!=null?o:s,We=R(t,l,"allowOverwrite",ot),qe=R(t,l,"mangleCache",Cn);if(l.plugins=!0,vt(t,l,`in ${e}() call`),d)i.push(`--sourcemap${d===!0?"":`=${d}`}`);if(p)i.push("--bundle");if(We)i.push("--allow-overwrite");if(m)i.push("--splitting");if(y)i.push("--preserve-symlinks");if(S)i.push("--metafile");if(g)i.push(`--outfile=${g}`);if(x)i.push(`--outdir=${x}`);if(P)i.push(`--outbase=${P}`);if(w)i.push(`--tsconfig=${w}`);if(V)i.push(`--packages=${V}`);if(E)i.push(`--resolve-extensions=${wi(E,"resolve extension")}`);if(G)i.push(`--public-path=${G}`);if(Q)i.push(`--entry-names=${Q}`);if(re)i.push(`--chunk-names=${re}`);if(ue)i.push(`--asset-names=${ue}`);if(A)i.push(`--main-fields=${wi(A,"main field")}`);if(T)i.push(`--conditions=${wi(T,"condition")}`);if(I)for(let te of I)i.push(`--external:${pn(te,"external")}`);if(H)for(let te in H){if(te.indexOf("=")>=0)throw Error(`Invalid package name in alias: ${te}`);i.push(`--alias:${te}=${pn(H[te],"alias",te)}`)}if(fe)for(let te in fe){if(te.indexOf("=")>=0)throw Error(`Invalid banner file type: ${te}`);i.push(`--banner:${te}=${pn(fe[te],"banner",te)}`)}if(xe)for(let te in xe){if(te.indexOf("=")>=0)throw Error(`Invalid footer file type: ${te}`);i.push(`--footer:${te}=${pn(xe[te],"footer",te)}`)}if(ne)for(let te of ne)i.push(`--inject:${pn(te,"inject")}`);if(O)for(let te in O){if(te.indexOf("=")>=0)throw Error(`Invalid loader extension: ${te}`);i.push(`--loader:${te}=${pn(O[te],"loader",te)}`)}if(N)for(let te in N){if(te.indexOf("=")>=0)throw Error(`Invalid out extension: ${te}`);i.push(`--out-extension:${te}=${pn(N[te],"out extension",te)}`)}if(X)if(Array.isArray(X))for(let te=0,Ut=X.length;te<Ut;te++){let Je=X[te];if(typeof Je==="object"&&Je!==null){let jt=Object.create(null),bt=R(Je,jt,"in",se),pe=R(Je,jt,"out",se);if(vt(Je,jt,"in entry point at index "+te),bt===void 0)throw Error('Missing property "in" for entry point at index '+te);if(pe===void 0)throw Error('Missing property "out" for entry point at index '+te);a.push([pe,bt])}else a.push(["",pn(Je,"entry point at index "+te)])}else for(let te in X)a.push([te,pn(X[te],"entry point",te)]);if(q){let te=Object.create(null),Ut=R(q,te,"contents",cw),Je=R(q,te,"resolveDir",se),jt=R(q,te,"sourcefile",se),bt=R(q,te,"loader",se);if(vt(q,te,'in "stdin" object'),jt)i.push(`--sourcefile=${jt}`);if(bt)i.push(`--loader=${bt}`);if(Je)u=Je;if(typeof Ut==="string")c=lr(Ut);else if(Ut instanceof Uint8Array)c=Ut}let Ye=[];if(j)for(let te of j)te+="",Ye.push(te);return{entries:a,flags:i,write:z,stdinContents:c,stdinResolveDir:u,absWorkingDir:B,nodePaths:Ye,mangleCache:uw(qe)}}function SM(e,t,n,r){let s=[],o=Object.create(null);_u(s,t,o,n,r),fw(s,t,o);let i=R(t,o,"sourcemap",aw),a=R(t,o,"sourcefile",se),l=R(t,o,"loader",se),c=R(t,o,"banner",se),u=R(t,o,"footer",se),d=R(t,o,"mangleCache",Cn);if(vt(t,o,`in ${e}() call`),i)s.push(`--sourcemap=${i===!0?"external":i}`);if(a)s.push(`--sourcefile=${a}`);if(l)s.push(`--loader=${l}`);if(c)s.push(`--banner=${c}`);if(u)s.push(`--footer=${u}`);return{flags:s,mangleCache:uw(d)}}function dw(e){let t={},n={didClose:!1,reason:""},r={},s=0,o=0,i=new Uint8Array(16384),a=0,l=(w)=>{let E=a+w.length;if(E>i.length){let A=new Uint8Array(E*2);A.set(i),i=A}i.set(w,a),a+=w.length;let j=0;while(j+4<=a){let A=ow(i,j);if(j+4+A>a)break;j+=4,y(i.subarray(j,j+A)),j+=A}if(j>0)i.copyWithin(0,j,a),a-=j},c=(w)=>{if(n.didClose=!0,w)n.reason=": "+(w.message||w);let E="The service was stopped"+n.reason;for(let j in r)r[j](E,null);r={}},u=(w,E,j)=>{if(n.didClose)return j("The service is no longer running"+n.reason,null);let A=s++;if(r[A]=(T,I)=>{try{j(T,I)}finally{if(w)w.unref()}},w)w.ref();e.writeToStdin(KS({id:A,isRequest:!0,value:E}))},d=(w,E)=>{if(n.didClose)throw Error("The service is no longer running"+n.reason);e.writeToStdin(KS({id:w,isRequest:!1,value:E}))},p=async(w,E)=>{try{if(E.command==="ping"){d(w,{});return}if(typeof E.key==="number"){let j=t[E.key];if(!j)return;let A=j[E.command];if(A){await A(w,E);return}}throw Error("Invalid command: "+E.command)}catch(j){let A=[_o(j,e,null,void 0,"")];try{d(w,{errors:A})}catch{}}},m=!0,y=(w)=>{if(m){m=!1;let j=String.fromCharCode(...w);if(j!=="0.28.2")throw Error(`Cannot start service: Host version "0.28.2" does not match binary version ${Ct(j)}`);return}let E=dM(w);if(E.isRequest)p(E.id,E.value);else{let j=r[E.id];if(delete r[E.id],E.value.error)j(E.value.error,{});else j(null,E.value)}};return{readFromStdout:l,afterClose:c,service:{buildOrContext:({callName:w,refs:E,options:j,isTTY:A,defaultWD:T,callback:I})=>{let V=0,H=o++,O={},N={ref(){if(++V===1){if(E)E.ref()}},unref(){if(--V===0){if(delete t[H],E)E.unref()}}};t[H]=O,N.ref(),wM(w,H,u,d,N,e,O,j,A,T,(G,Q)=>{try{I(G,Q)}finally{N.unref()}})},transform:({callName:w,refs:E,input:j,options:A,isTTY:T,fs:I,callback:V})=>{let H=pw(),O=(N)=>{try{if(typeof j!=="string"&&!(j instanceof Uint8Array))throw Error('The input to "transform" must be a string or a Uint8Array');let{flags:G,mangleCache:Q}=SM(w,A,T,XS),re={command:"transform",flags:G,inputFS:N!==null,input:N!==null?lr(N):typeof j==="string"?lr(j):j};if(Q)re.mangleCache=Q;u(E,re,(ue,ne)=>{if(ue)return V(Error(ue),null);let fe=vi(ne.errors,H),xe=vi(ne.warnings,H),X=1,B=()=>{if(--X===0){let q={warnings:xe,code:ne.code,map:ne.map,mangleCache:void 0,legalComments:void 0};if("legalComments"in ne)q.legalComments=ne==null?void 0:ne.legalComments;if(ne.mangleCache)q.mangleCache=ne==null?void 0:ne.mangleCache;V(null,q)}};if(fe.length>0)return V(tl("Transform failed",fe,xe),null);if(ne.codeFS)X++,I.readFile(ne.code,(q,z)=>{if(q!==null)V(q,null);else ne.code=z,B()});if(ne.mapFS)X++,I.readFile(ne.map,(q,z)=>{if(q!==null)V(q,null);else ne.map=z,B()});B()})}catch(G){let Q=[];try{_u(Q,A,{},T,XS)}catch{}let re=_o(G,e,H,void 0,"");u(E,{command:"error",flags:Q,error:re},()=>{re.detail=H.load(re.detail),V(tl("Transform failed",[re],[]),null)})}};if((typeof j==="string"||j instanceof Uint8Array)&&j.length>1048576){let N=O;O=()=>I.writeFile(j,N)}O(null)},formatMessages:({callName:w,refs:E,messages:j,options:A,callback:T})=>{if(!A)throw Error(`Missing second argument in ${w}() call`);let I={},V=R(A,I,"kind",se),H=R(A,I,"color",ot),O=R(A,I,"terminalWidth",ko),N=R(A,I,"logStyle",se);if(vt(A,I,`in ${w}() call`),V===void 0)throw Error(`Missing "kind" in ${w}() call`);if(V!=="error"&&V!=="warning")throw Error(`Expected "kind" to be "error" or "warning" in ${w}() call`);let G={command:"format-msgs",messages:cs(j,"messages",null,"",O),isWarning:V==="warning"};if(H!==void 0)G.color=H;if(O!==void 0)G.terminalWidth=O;if(N!==void 0)G.logStyle=N;u(E,G,(Q,re)=>{if(Q)return T(Error(Q),null);T(null,re.messages)})},analyzeMetafile:({callName:w,refs:E,metafile:j,options:A,callback:T})=>{if(A===void 0)A={};let I={},V=R(A,I,"color",ot),H=R(A,I,"verbose",ot);vt(A,I,`in ${w}() call`);let O={command:"analyze-metafile",metafile:j};if(V!==void 0)O.color=V;if(H!==void 0)O.verbose=H;u(E,O,(N,G)=>{if(N)return T(Error(N),null);T(null,G.result)})}}}}function wM(e,t,n,r,s,o,i,a,l,c,u){let d=pw(),p=e==="context",m=(g,x)=>{let P=[];try{_u(P,a,{},l,GS)}catch{}let w=_o(g,o,d,void 0,x);n(s,{command:"error",flags:P,error:w},()=>{w.detail=d.load(w.detail),u(tl(p?"Context failed":"Build failed",[w],[]),null)})},y;if(typeof a==="object"){let g=a.plugins;if(g!==void 0){if(!Array.isArray(g))return m(Error('"plugins" must be an array'),"");y=g}}if(y&&y.length>0){if(o.isSync)return m(Error("Cannot use plugins in synchronous API calls"),"");vM(t,n,r,s,o,i,a,y,d).then((g)=>{if(!g.ok)return m(g.error,g.pluginName);try{S(g.requestPlugins,g.runOnEndCallbacks,g.scheduleOnDisposeCallbacks)}catch(x){m(x,"")}},(g)=>m(g,""));return}try{S(null,(g,x)=>x([],[]),()=>{})}catch(g){m(g,"")}function S(g,x,P){let w=o.hasFS,{entries:E,flags:j,write:A,stdinContents:T,stdinResolveDir:I,absWorkingDir:V,nodePaths:H,mangleCache:O}=$M(e,a,l,GS,w);if(A&&!o.hasFS)throw Error('The "write" option is unavailable in this environment');let N={command:"build",key:t,entries:E,flags:j,write:A,stdinContents:T,stdinResolveDir:I,absWorkingDir:V||c,nodePaths:H,context:p};if(g)N.plugins=g;if(O)N.mangleCache=O;let G=(ue,ne)=>{let fe={errors:vi(ue.errors,d),warnings:vi(ue.warnings,d),outputFiles:void 0,metafile:void 0,mangleCache:void 0},xe=fe.errors.slice(),X=fe.warnings.slice();if(ue.outputFiles)fe.outputFiles=ue.outputFiles.map(jM);if(ue.metafile&&ue.metafile.length)fe.metafile=PM(ue.metafile);if(ue.mangleCache)fe.mangleCache=ue.mangleCache;if(ue.writeToStdout!==void 0)console.log(Co(ue.writeToStdout).replace(/\n$/,""));x(fe,(B,q)=>{if(xe.length>0||B.length>0){let z=tl("Build failed",xe.concat(B),X.concat(q));return ne(z,null,B,q)}ne(null,fe,B,q)})},Q,re;if(p)i["on-end"]=(ue,ne)=>new Promise((fe)=>{G(ne,(xe,X,B,q)=>{let z={errors:B,warnings:q};if(re)re(xe,X);Q=void 0,re=void 0,r(ue,z),fe()})});n(s,N,(ue,ne)=>{if(ue)return u(Error(ue),null);if(!p)return G(ne,(X,B)=>(P(),u(X,B)));if(ne.errors.length>0)return u(tl("Context failed",ne.errors,ne.warnings),null);let fe=!1,xe={rebuild:()=>{if(!Q)Q=new Promise((X,B)=>{let q;re=(We,qe)=>{if(!q)q=()=>We?B(We):X(qe)};let z=()=>{n(s,{command:"rebuild",key:t},(qe,Ye)=>{if(qe)B(Error(qe));else if(q)q();else z()})};z()});return Q},watch:(X={})=>new Promise((B,q)=>{if(!o.hasFS)throw Error('Cannot use the "watch" API in this environment');let z={},We=R(X,z,"delay",ko);vt(X,z,"in watch() call");let qe={command:"watch",key:t};if(We)qe.delay=We;n(s,qe,(Ye)=>{if(Ye)q(Error(Ye));else B(void 0)})}),serve:(X={})=>new Promise((B,q)=>{if(!o.hasFS)throw Error('Cannot use the "serve" API in this environment');let z={},We=R(X,z,"port",mM),qe=R(X,z,"host",se),Ye=R(X,z,"servedir",se),te=R(X,z,"keyfile",se),Ut=R(X,z,"certfile",se),Je=R(X,z,"fallback",se),jt=R(X,z,"cors",Cn),bt=R(X,z,"onRequest",iw);vt(X,z,"in serve() call");let pe={command:"serve",key:t,onRequest:!!bt};if(We!==void 0)pe.port=We;if(qe!==void 0)pe.host=qe;if(Ye!==void 0)pe.servedir=Ye;if(te!==void 0)pe.keyfile=te;if(Ut!==void 0)pe.certfile=Ut;if(Je!==void 0)pe.fallback=Je;if(jt){let ct={},Se=R(jt,ct,"origin",lw);if(vt(jt,ct,'on "cors" object'),Array.isArray(Se))pe.corsOrigin=Se;else if(Se!==void 0)pe.corsOrigin=[Se]}n(s,pe,(ct,Se)=>{if(ct)return q(Error(ct));if(bt)i["serve-request"]=(Ze,Nt)=>{bt(Nt.args),r(Ze,{})};B(Se)})}),cancel:()=>new Promise((X)=>{if(fe)return X();n(s,{command:"cancel",key:t},()=>{X()})}),dispose:()=>new Promise((X)=>{if(fe)return X();fe=!0,n(s,{command:"dispose",key:t},()=>{X(),P(),s.unref()})})};s.ref(),u(null,xe)})}}var vM=async(e,t,n,r,s,o,i,a,l)=>{let c=[],u=[],d={},p={},m=[],y=0,S=0,g=[],x=!1;a=[...a];for(let E of a){let j={};if(typeof E!=="object")throw Error(`Plugin at index ${S} must be an object`);let A=R(E,j,"name",se);if(typeof A!=="string"||A==="")throw Error(`Plugin at index ${S} is missing a name`);try{let T=R(E,j,"setup",iw);if(typeof T!=="function")throw Error("Plugin is missing a setup function");vt(E,j,`on plugin ${Ct(A)}`);let I={name:A,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};S++;let H=T({initialOptions:i,resolve:(O,N={})=>{if(!x)throw Error('Cannot call "resolve" before plugin setup has completed');if(typeof O!=="string")throw Error("The path to resolve must be a string");let G=Object.create(null),Q=R(N,G,"pluginName",se),re=R(N,G,"importer",se),ue=R(N,G,"namespace",se),ne=R(N,G,"resolveDir",se),fe=R(N,G,"kind",se),xe=R(N,G,"pluginData",Su),X=R(N,G,"with",Cn);return vt(N,G,"in resolve() call"),new Promise((B,q)=>{let z={command:"resolve",path:O,key:e,pluginName:A};if(Q!=null)z.pluginName=Q;if(re!=null)z.importer=re;if(ue!=null)z.namespace=ue;if(ne!=null)z.resolveDir=ne;if(fe!=null)z.kind=fe;else throw Error('Must specify "kind" when calling "resolve"');if(xe!=null)z.pluginData=l.store(xe);if(X!=null)z.with=EM(X,"with");t(r,z,(We,qe)=>{if(We!==null)q(Error(We));else B({errors:vi(qe.errors,l),warnings:vi(qe.warnings,l),path:qe.path,external:qe.external,sideEffects:qe.sideEffects,namespace:qe.namespace,suffix:qe.suffix,pluginData:l.load(qe.pluginData)})})})},onStart(O){let G=bu(Error('This error came from the "onStart" callback registered here:'),s,"onStart");c.push({name:A,callback:O,note:G}),I.onStart=!0},onEnd(O){let G=bu(Error('This error came from the "onEnd" callback registered here:'),s,"onEnd");u.push({name:A,callback:O,note:G}),I.onEnd=!0},onResolve(O,N){let Q=bu(Error('This error came from the "onResolve" callback registered here:'),s,"onResolve"),re={},ue=R(O,re,"filter",wu),ne=R(O,re,"namespace",se);if(vt(O,re,`in onResolve() call for plugin ${Ct(A)}`),ue==null)throw Error("onResolve() call is missing a filter");let fe=y++;d[fe]={name:A,callback:N,note:Q},I.onResolve.push({id:fe,filter:vu(ue),namespace:ne||""})},onLoad(O,N){let Q=bu(Error('This error came from the "onLoad" callback registered here:'),s,"onLoad"),re={},ue=R(O,re,"filter",wu),ne=R(O,re,"namespace",se);if(vt(O,re,`in onLoad() call for plugin ${Ct(A)}`),ue==null)throw Error("onLoad() call is missing a filter");let fe=y++;p[fe]={name:A,callback:N,note:Q},I.onLoad.push({id:fe,filter:vu(ue),namespace:ne||""})},onDispose(O){m.push(O)},esbuild:s.esbuild});if(H)await H;g.push(I)}catch(T){return{ok:!1,error:T,pluginName:A}}}o["on-start"]=async(E,j)=>{l.clear();let A={errors:[],warnings:[]};await Promise.all(c.map(async({name:T,callback:I,note:V})=>{try{let H=await I();if(H!=null){if(typeof H!=="object")throw Error(`Expected onStart() callback in plugin ${Ct(T)} to return an object`);let O={},N=R(H,O,"errors",ls),G=R(H,O,"warnings",ls);if(vt(H,O,`from onStart() callback in plugin ${Ct(T)}`),N!=null)A.errors.push(...cs(N,"errors",l,T,void 0));if(G!=null)A.warnings.push(...cs(G,"warnings",l,T,void 0))}}catch(H){A.errors.push(_o(H,s,l,V&&V(),T))}})),n(E,A)},o["on-resolve"]=async(E,j)=>{let A={},T="",I,V;for(let H of j.ids)try{({name:T,callback:I,note:V}=d[H]);let O=await I({path:j.path,importer:j.importer,namespace:j.namespace,resolveDir:j.resolveDir,kind:j.kind,pluginData:l.load(j.pluginData),with:j.with});if(O!=null){if(typeof O!=="object")throw Error(`Expected onResolve() callback in plugin ${Ct(T)} to return an object`);let N={},G=R(O,N,"pluginName",se),Q=R(O,N,"path",se),re=R(O,N,"namespace",se),ue=R(O,N,"suffix",se),ne=R(O,N,"external",ot),fe=R(O,N,"sideEffects",ot),xe=R(O,N,"pluginData",Su),X=R(O,N,"errors",ls),B=R(O,N,"warnings",ls),q=R(O,N,"watchFiles",mn),z=R(O,N,"watchDirs",mn);if(vt(O,N,`from onResolve() callback in plugin ${Ct(T)}`),A.id=H,G!=null)A.pluginName=G;if(Q!=null)A.path=Q;if(re!=null)A.namespace=re;if(ue!=null)A.suffix=ue;if(ne!=null)A.external=ne;if(fe!=null)A.sideEffects=fe;if(xe!=null)A.pluginData=l.store(xe);if(X!=null)A.errors=cs(X,"errors",l,T,void 0);if(B!=null)A.warnings=cs(B,"warnings",l,T,void 0);if(q!=null)A.watchFiles=$u(q,"watchFiles");if(z!=null)A.watchDirs=$u(z,"watchDirs");break}}catch(O){A={id:H,errors:[_o(O,s,l,V&&V(),T)]};break}n(E,A)},o["on-load"]=async(E,j)=>{let A={},T="",I,V;for(let H of j.ids)try{({name:T,callback:I,note:V}=p[H]);let O=await I({path:j.path,namespace:j.namespace,suffix:j.suffix,pluginData:l.load(j.pluginData),with:j.with});if(O!=null){if(typeof O!=="object")throw Error(`Expected onLoad() callback in plugin ${Ct(T)} to return an object`);let N={},G=R(O,N,"pluginName",se),Q=R(O,N,"contents",cw),re=R(O,N,"resolveDir",se),ue=R(O,N,"pluginData",Su),ne=R(O,N,"loader",se),fe=R(O,N,"errors",ls),xe=R(O,N,"warnings",ls),X=R(O,N,"watchFiles",mn),B=R(O,N,"watchDirs",mn);if(vt(O,N,`from onLoad() callback in plugin ${Ct(T)}`),A.id=H,G!=null)A.pluginName=G;if(Q instanceof Uint8Array)A.contents=Q;else if(Q!=null)A.contents=lr(Q);if(re!=null)A.resolveDir=re;if(ue!=null)A.pluginData=l.store(ue);if(ne!=null)A.loader=ne;if(fe!=null)A.errors=cs(fe,"errors",l,T,void 0);if(xe!=null)A.warnings=cs(xe,"warnings",l,T,void 0);if(X!=null)A.watchFiles=$u(X,"watchFiles");if(B!=null)A.watchDirs=$u(B,"watchDirs");break}}catch(O){A={id:H,errors:[_o(O,s,l,V&&V(),T)]};break}n(E,A)};let P=(E,j)=>j([],[]);if(u.length>0)P=(E,j)=>{(async()=>{let A=[],T=[];for(let{name:I,callback:V,note:H}of u){let O,N;try{let G=await V(E);if(G!=null){if(typeof G!=="object")throw Error(`Expected onEnd() callback in plugin ${Ct(I)} to return an object`);let Q={},re=R(G,Q,"errors",ls),ue=R(G,Q,"warnings",ls);if(vt(G,Q,`from onEnd() callback in plugin ${Ct(I)}`),re!=null)O=cs(re,"errors",l,I,void 0);if(ue!=null)N=cs(ue,"warnings",l,I,void 0)}}catch(G){O=[_o(G,s,l,H&&H(),I)]}if(O){A.push(...O);try{E.errors.push(...O)}catch{}}if(N){T.push(...N);try{E.warnings.push(...N)}catch{}}}j(A,T)})()};let w=()=>{for(let E of m)setTimeout(()=>E(),0)};return x=!0,{ok:!0,requestPlugins:g,runOnEndCallbacks:P,scheduleOnDisposeCallbacks:w}};function pw(){let e=new Map,t=0;return{clear(){e.clear()},load(n){return e.get(n)},store(n){if(n===void 0)return-1;let r=t++;return e.set(r,n),r}}}function bu(e,t,n){let r,s=!1;return()=>{if(s)return r;s=!0;try{let o=(e.stack+"").split(`
|
|
62
|
+
`);o.splice(1,1);let i=mw(t,o,n);if(i)return r={text:e.message,location:i},r}catch{}}}function _o(e,t,n,r,s){let o="Internal error",i=null;try{o=(e&&e.message||e)+""}catch{}try{i=mw(t,(e.stack+"").split(`
|
|
63
|
+
`),"")}catch{}return{id:"",pluginName:s,text:o,location:i,notes:r?[r]:[],detail:n?n.store(e):-1}}function mw(e,t,n){let r=" at ";if(e.readFileSync&&!t[0].startsWith(r)&&t[1].startsWith(r))for(let s=1;s<t.length;s++){let o=t[s];if(!o.startsWith(r))continue;o=o.slice(r.length);while(!0){let i=/^(?:new |async )?\S+ \((.*)\)$/.exec(o);if(i){o=i[1];continue}if(i=/^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec(o),i){o=i[1];continue}if(i=/^(\S+):(\d+):(\d+)$/.exec(o),i){let a;try{a=e.readFileSync(i[1],"utf8")}catch{break}let l=a.split(/\r\n|\r|\n|\u2028|\u2029/)[+i[2]-1]||"",c=+i[3]-1,u=l.slice(c,c+n.length)===n?n.length:0;return{file:i[1],namespace:"file",line:+i[2],column:lr(l.slice(0,c)).length,length:lr(l.slice(c,c+u)).length,lineText:l+`
|
|
63
64
|
`+t.slice(1).join(`
|
|
64
|
-
`),suggestion:""}}break}}return null}function
|
|
65
|
+
`),suggestion:""}}break}}return null}function tl(e,t,n){let r=5;e+=t.length<1?"":` with ${t.length} error${t.length<2?"":"s"}:`+t.slice(0,r+1).map((o,i)=>{if(i===r)return`
|
|
65
66
|
...`;if(!o.location)return`
|
|
66
|
-
error: ${o.text}`;let{file:a,line:
|
|
67
|
-
${a}:${
|
|
67
|
+
error: ${o.text}`;let{file:a,line:l,column:c}=o.location,u=o.pluginName?`[plugin: ${o.pluginName}] `:"";return`
|
|
68
|
+
${a}:${l}:${c}: ERROR: ${u}${o.text}`}).join("");let s=Error(e);for(let[o,i]of[["errors",t],["warnings",n]])Object.defineProperty(s,o,{configurable:!0,enumerable:!0,get:()=>i,set:(a)=>Object.defineProperty(s,o,{configurable:!0,enumerable:!0,value:a})});return s}function vi(e,t){for(let n of e)n.detail=t.load(n.detail);return e}function ZS(e,t,n){if(e==null)return null;let r={},s=R(e,r,"file",se),o=R(e,r,"namespace",se),i=R(e,r,"line",ko),a=R(e,r,"column",ko),l=R(e,r,"length",ko),c=R(e,r,"lineText",se),u=R(e,r,"suggestion",se);if(vt(e,r,t),c){let d=c.slice(0,(a&&a>0?a:0)+(l&&l>0?l:0)+(n&&n>0?n:80));if(!/[\x7F-\uFFFF]/.test(d)&&!/\n/.test(c))c=d}return{file:s||"",namespace:o||"",line:i||0,column:a||0,length:l||0,lineText:c||"",suggestion:u||""}}function cs(e,t,n,r,s){let o=[],i=0;for(let a of e){let l={},c=R(a,l,"id",se),u=R(a,l,"pluginName",se),d=R(a,l,"text",se),p=R(a,l,"location",YS),m=R(a,l,"notes",ls),y=R(a,l,"detail",Su),S=`in element ${i} of "${t}"`;vt(a,l,S);let g=[];if(m)for(let x of m){let P={},w=R(x,P,"text",se),E=R(x,P,"location",YS);vt(x,P,S),g.push({text:w||"",location:ZS(E,S,s)})}o.push({id:c||"",pluginName:u||r,text:d||"",location:ZS(p,S,s),notes:g,detail:n?n.store(y):-1}),i++}return o}function $u(e,t){let n=[];for(let r of e){if(typeof r!=="string")throw Error(`${Ct(t)} must be an array of strings`);n.push(r)}return n}function EM(e,t){let n=Object.create(null);for(let r in e){let s=e[r];if(typeof s!=="string")throw Error(`key ${Ct(r)} in object ${Ct(t)} must be a string`);n[r]=s}return n}function jM({path:e,contents:t,hash:n}){let r=null;return{path:e,contents:t,hash:n,get text(){let s=this.contents;if(r===null||s!==t)t=s,r=Co(s);return r}}}function vu(e){let t=e.source;if(e.flags)t=`(?${e.flags})${t}`;return t}function PM(e){let t;try{t=Co(e)}catch{return pM(e)}return JSON.parse(t)}var Rs=pt("fs"),QS=pt("os"),Wn=pt("path"),Si=process.env.ESBUILD_BINARY_PATH||Si,_M=(e)=>!!e&&e!=="/usr/bin/esbuild",ew="@esbuild/darwin-arm64",tw="@esbuild/darwin-x64",Eu={"win32 arm64 LE":"@esbuild/win32-arm64","win32 ia32 LE":"@esbuild/win32-ia32","win32 x64 LE":"@esbuild/win32-x64"},ju={"aix ppc64 BE":"@esbuild/aix-ppc64","android arm64 LE":"@esbuild/android-arm64","darwin arm64 LE":"@esbuild/darwin-arm64","darwin x64 LE":"@esbuild/darwin-x64","freebsd arm64 LE":"@esbuild/freebsd-arm64","freebsd x64 LE":"@esbuild/freebsd-x64","linux arm LE":"@esbuild/linux-arm","linux arm64 LE":"@esbuild/linux-arm64","linux ia32 LE":"@esbuild/linux-ia32","linux mips64el LE":"@esbuild/linux-mips64el","linux ppc64 LE":"@esbuild/linux-ppc64","linux riscv64 LE":"@esbuild/linux-riscv64","linux s390x BE":"@esbuild/linux-s390x","linux x64 LE":"@esbuild/linux-x64","linux loong64 LE":"@esbuild/linux-loong64","netbsd arm64 LE":"@esbuild/netbsd-arm64","netbsd x64 LE":"@esbuild/netbsd-x64","openbsd arm64 LE":"@esbuild/openbsd-arm64","openbsd x64 LE":"@esbuild/openbsd-x64","sunos x64 LE":"@esbuild/sunos-x64"},nw={"android arm LE":"@esbuild/android-arm","android x64 LE":"@esbuild/android-x64","openharmony arm64 LE":"@esbuild/openharmony-arm64"};function kM(){let e,t,n=!1,r=`${process.platform} ${QS.arch()} ${QS.endianness()}`;if(r in Eu)e=Eu[r],t="esbuild.exe";else if(r in ju)e=ju[r],t="bin/esbuild";else if(r in nw)e=nw[r],t="bin/esbuild",n=!0;else throw Error(`Unsupported platform: ${r}`);return{pkg:e,subpath:t,isWASM:n}}function OM(){let e=pt.resolve("esbuild"),t=Wn.dirname(Wn.dirname(Wn.dirname(e)));if(Wn.basename(t)==="node_modules"){for(let n in ju)try{let r=ju[n];if(Rs.existsSync(Wn.join(t,r)))return r}catch{}for(let n in Eu)try{let r=Eu[n];if(Rs.existsSync(Wn.join(t,r)))return r}catch{}}return null}function AM(e,t){let n=Wn.dirname(pt.resolve("esbuild"));return Wn.join(n,`downloaded-${e.replace("/","-")}-${Wn.basename(t)}`)}function CM(){if(_M(Si))if(!Rs.existsSync(Si))console.warn(`[esbuild] Ignoring bad configuration: ESBUILD_BINARY_PATH=${Si}`);else return{binPath:Si,isWASM:!1};let{pkg:e,subpath:t,isWASM:n}=kM(),r;try{r=pt.resolve(`${e}/${t}`)}catch(s){if(r=AM(e,t),!Rs.existsSync(r)){try{pt.resolve(e)}catch{let o=OM();if(o){let i=`
|
|
68
69
|
Specifically the "${o}" package is present but this platform
|
|
69
70
|
needs the "${e}" package instead. People often get into this
|
|
70
71
|
situation by installing esbuild on Windows or macOS and copying "node_modules"
|
|
@@ -81,7 +82,7 @@ If you are installing with yarn, you can try listing both this platform and the
|
|
|
81
82
|
other platform in your ".yarnrc.yml" file using the "supportedArchitectures"
|
|
82
83
|
feature: https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
|
|
83
84
|
Keep in mind that this means multiple copies of esbuild will be present.
|
|
84
|
-
`;if(e===
|
|
85
|
+
`;if(e===tw&&o===ew||e===ew&&o===tw)i=`
|
|
85
86
|
Specifically the "${o}" package is present but this platform
|
|
86
87
|
needs the "${e}" package instead. People often get into this
|
|
87
88
|
situation by installing esbuild with npm running inside of Rosetta 2 and then
|
|
@@ -113,162 +114,187 @@ want to do that.
|
|
|
113
114
|
If you are installing esbuild with npm, make sure that you don't specify the
|
|
114
115
|
"--no-optional" or "--omit=optional" flags. The "optionalDependencies" feature
|
|
115
116
|
of "package.json" is used by esbuild to install the correct binary executable
|
|
116
|
-
for your current platform.`)}throw s}}if(/\.zip\//.test(r)){let s;try{s=(()=>{throw new Error("Cannot require module "+"pnpapi");})()}catch(o){}if(s){let o=s.getPackageInformation(s.topLevel).packageLocation,i=
|
|
117
|
+
for your current platform.`)}throw s}}if(/\.zip\//.test(r)){let s;try{s=(()=>{throw new Error("Cannot require module "+"pnpapi");})()}catch(o){}if(s){let o=s.getPackageInformation(s.topLevel).packageLocation,i=Wn.join(o,"node_modules",".cache","esbuild",`pnpapi-${e.replace("/","-")}-0.28.2-${Wn.basename(t)}`);if(!Rs.existsSync(i))Rs.mkdirSync(Wn.dirname(i),{recursive:!0}),Rs.copyFileSync(r,i),Rs.chmodSync(i,493);return{binPath:i,isWASM:n}}}return{binPath:r,isWASM:n}}var hw=pt("child_process"),RM=pt("crypto"),$m=pt("path"),Oo=pt("fs"),NM=pt("os"),TM=pt("tty"),nn;if(process.env.ESBUILD_WORKER_THREADS!=="0"){try{nn=pt("worker_threads")}catch{}let[e,t]=process.versions.node.split(".");if(+e<12||+e===12&&+t<17||+e===13&&+t<13)nn=void 0}var rw,sl=((rw=nn==null?void 0:nn.workerData)==null?void 0:rw.esbuildVersion)==="0.28.2",gw=()=>{if((!Si||!1)&&($m.basename(__filename)!=="main.js"||$m.basename(__dirname)!=="lib"))throw Error(`The esbuild JavaScript API cannot be bundled. Please mark the "esbuild" package as external so it's not included in the bundle.
|
|
117
118
|
|
|
118
|
-
More information: The file containing the code for esbuild's JavaScript API (${__filename}) does not appear to be inside the esbuild package on the file system, which usually means that the esbuild package was bundled into another file. This is problematic because the API needs to run a binary executable inside the esbuild package which is located using a relative path from the API code to the executable. If the esbuild package is bundled, the relative path will be incorrect and the executable won't be found.`);{let{binPath:e,isWASM:t}=
|
|
119
|
-
error: ${
|
|
120
|
-
`,{outfile:s,resolveDir:t},{...n,minify:!1,onFileLoaded:(o)=>r.push(o)})}catch{return}finally{
|
|
119
|
+
More information: The file containing the code for esbuild's JavaScript API (${__filename}) does not appear to be inside the esbuild package on the file system, which usually means that the esbuild package was bundled into another file. This is problematic because the API needs to run a binary executable inside the esbuild package which is located using a relative path from the API code to the executable. If the esbuild package is bundled, the relative path will be incorrect and the executable won't be found.`);{let{binPath:e,isWASM:t}=CM();if(t)return["node",[e]];else return[e,[]]}},nl=()=>TM.isatty(2),JM={readFile(e,t){try{let n=Oo.readFileSync(e,"utf8");try{Oo.unlinkSync(e)}catch{}t(null,n)}catch(n){t(n,null)}},writeFile(e,t){try{let n=yw();Oo.writeFileSync(n,e),t(n)}catch{t(null)}}},MM={readFile(e,t){try{Oo.readFile(e,"utf8",(n,r)=>{try{Oo.unlink(e,()=>t(n,r))}catch{t(n,r)}})}catch(n){t(n,null)}},writeFile(e,t){try{let n=yw();Oo.writeFile(n,e,(r)=>r!==null?t(null):t(n))}catch{t(null)}}},IM="0.28.2",DM=(e)=>Ro().build(e),LM=(e)=>Ro().context(e),FM=(e,t)=>Ro().transform(e,t),VM=(e,t)=>Ro().formatMessages(e,t),qM=(e,t)=>Ro().analyzeMetafile(e,t),HM=(e)=>{if(nn&&!sl){if(!rn)rn=Ou(nn);return rn.buildSync(e)}let t;return ku((n)=>n.buildOrContext({callName:"buildSync",refs:null,options:e,isTTY:nl(),defaultWD:Ao,callback:(r,s)=>{if(r)throw r;t=s}})),t},WM=(e,t)=>{if(nn&&!sl){if(!rn)rn=Ou(nn);return rn.transformSync(e,t)}let n;return ku((r)=>r.transform({callName:"transformSync",refs:null,input:e,options:t||{},isTTY:nl(),fs:JM,callback:(s,o)=>{if(s)throw s;n=o}})),n},BM=(e,t)=>{if(nn&&!sl){if(!rn)rn=Ou(nn);return rn.formatMessagesSync(e,t)}let n;return ku((r)=>r.formatMessages({callName:"formatMessagesSync",refs:null,messages:e,options:t,callback:(s,o)=>{if(s)throw s;n=o}})),n},UM=(e,t)=>{if(nn&&!sl){if(!rn)rn=Ou(nn);return rn.analyzeMetafileSync(e,t)}let n;return ku((r)=>r.analyzeMetafile({callName:"analyzeMetafileSync",refs:null,metafile:typeof e==="string"?e:JSON.stringify(e),options:t,callback:(s,o)=>{if(s)throw s;n=o}})),n},zM=()=>{if(Pu)Pu();if(rn)rn.stop();return Promise.resolve()},Sm=!1,KM=(e)=>{if(e=bM(e||{}),e.wasmURL)throw Error('The "wasmURL" option only works in the browser');if(e.wasmModule)throw Error('The "wasmModule" option only works in the browser');if(e.worker)throw Error('The "worker" option only works in the browser');if(Sm)throw Error('Cannot call "initialize" more than once');return Ro(),Sm=!0,Promise.resolve()},Ao=process.cwd(),el,Pu,Ro=()=>{if(el)return el;let[e,t]=gw(),n=hw.spawn(e,t.concat("--service=0.28.2","--ping"),{windowsHide:!0,stdio:["pipe","pipe","inherit"],cwd:Ao}),{readFromStdout:r,afterClose:s,service:o}=dw({writeToStdin(u){n.stdin.write(u,(d)=>{if(d)s(d)})},readFileSync:Oo.readFileSync,isSync:!1,hasFS:!0,esbuild:rl});n.stdin.on("error",s),n.on("error",s);let{stdin:i,stdout:a}=n;a.on("data",r),a.on("end",s),Pu=()=>{i.destroy(),a.destroy(),n.kill(),Sm=!1,el=void 0,Pu=void 0};let l=0;if(n.unref(),i.unref)i.unref();if(a.unref)a.unref();let c={ref(){if(++l===1)n.ref()},unref(){if(--l===0)n.unref()}};return el={build:(u)=>new Promise((d,p)=>{o.buildOrContext({callName:"build",refs:c,options:u,isTTY:nl(),defaultWD:Ao,callback:(m,y)=>m?p(m):d(y)})}),context:(u)=>new Promise((d,p)=>o.buildOrContext({callName:"context",refs:c,options:u,isTTY:nl(),defaultWD:Ao,callback:(m,y)=>m?p(m):d(y)})),transform:(u,d)=>new Promise((p,m)=>o.transform({callName:"transform",refs:c,input:u,options:d||{},isTTY:nl(),fs:MM,callback:(y,S)=>y?m(y):p(S)})),formatMessages:(u,d)=>new Promise((p,m)=>o.formatMessages({callName:"formatMessages",refs:c,messages:u,options:d,callback:(y,S)=>y?m(y):p(S)})),analyzeMetafile:(u,d)=>new Promise((p,m)=>o.analyzeMetafile({callName:"analyzeMetafile",refs:c,metafile:typeof u==="string"?u:JSON.stringify(u),options:d,callback:(y,S)=>y?m(y):p(S)}))},el},ku=(e)=>{let[t,n]=gw(),r=new Uint8Array,{readFromStdout:s,afterClose:o,service:i}=dw({writeToStdin(l){if(r.length!==0)throw Error("Must run at most one command");r=l},isSync:!0,hasFS:!0,esbuild:rl});e(i);let a=hw.execFileSync(t,n.concat("--service=0.28.2"),{cwd:Ao,windowsHide:!0,input:r,maxBuffer:+process.env.ESBUILD_MAX_BUFFER||16777216});s(a),o(null)},yw=()=>$m.join(NM.tmpdir(),`esbuild-${RM.randomBytes(32).toString("hex")}`),rn=null,Ou=(e)=>{let{port1:t,port2:n}=new e.MessageChannel,r=new e.Worker(__filename,{workerData:{workerPort:n,defaultWD:Ao,esbuildVersion:"0.28.2"},transferList:[n],execArgv:[]}),s=0,o=(c)=>{let u=Error(`Build failed with 1 error:
|
|
120
|
+
error: ${c}`),d=[{id:"",pluginName:"",text:c,location:null,notes:[],detail:void 0}];return u.errors=d,u.warnings=[],u},i=(c)=>{if(!c)return;let u=c.plugins;if(u&&u.length>0)throw o("Cannot use plugins in synchronous API calls")},a=(c,u)=>{for(let d in u)c[d]=u[d]},l=(c,u)=>{let d=s++,p=new SharedArrayBuffer(8),m=new Int32Array(p),y={sharedBuffer:p,id:d,command:c,args:u};r.postMessage(y);let S=Atomics.wait(m,0,0);if(S!=="ok"&&S!=="not-equal")throw Error("Internal error: Atomics.wait() failed: "+S);let{message:{id:g,resolve:x,reject:P,properties:w}}=e.receiveMessageOnPort(t);if(d!==g)throw Error(`Internal error: Expected id ${d} but got id ${g}`);if(P)throw a(P,w),P;return x};return r.unref(),{buildSync(c){return i(c),l("build",[c])},transformSync(c,u){return l("transform",[c,u])},formatMessagesSync(c,u){return l("formatMessages",[c,u])},analyzeMetafileSync(c,u){return l("analyzeMetafile",[c,u])},stop(){r.terminate(),rn=null}}},GM=()=>{let e=nn.workerData.workerPort,t=nn.parentPort,n=(r)=>{let s={};if(r&&typeof r==="object")for(let o in r)s[o]=r[o];return s};try{let r=Ro();Ao=nn.workerData.defaultWD,t.on("message",(s)=>{(async()=>{let{sharedBuffer:o,id:i,command:a,args:l}=s,c=new Int32Array(o);try{switch(a){case"build":e.postMessage({id:i,resolve:await r.build(l[0])});break;case"transform":e.postMessage({id:i,resolve:await r.transform(l[0],l[1])});break;case"formatMessages":e.postMessage({id:i,resolve:await r.formatMessages(l[0],l[1])});break;case"analyzeMetafile":e.postMessage({id:i,resolve:await r.analyzeMetafile(l[0],l[1])});break;default:throw Error(`Invalid command: ${a}`)}}catch(u){e.postMessage({id:i,reject:u,properties:n(u)})}Atomics.add(c,0,1),Atomics.notify(c,0,1/0)})()})}catch(r){t.on("message",(s)=>{let{sharedBuffer:o,id:i}=s,a=new Int32Array(o);e.postMessage({id:i,reject:r,properties:n(r)}),Atomics.add(a,0,1),Atomics.notify(a,0,1/0)})}};if(sl)GM();var XM=rl});import{createRequire as YM}from"node:module";import{mkdirSync as ZM,writeFileSync as QM}from"node:fs";import{dirname as eI,join as tI}from"node:path";function vm(e,t){return YM(tI(t,"package.json")).resolve(e)}function bw(e){return e==="node"||e==="bun"?"node":"browser"}function nI(e){return new RegExp(`^${e.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}$`)}function rI(e,t){let n=nI(e);return{name:"jx-in-memory-entry",setup:(r)=>{r.onResolve({filter:n},()=>({path:e})),r.onLoad({filter:n},()=>({contents:t,loader:"ts"}))}}}async function Em(e){let t=await Promise.resolve().then(() => Sr(ol(),1)),{entry:n}=e,r={bundle:!0,external:e.external,format:"esm",logLevel:"silent",minify:e.minify,platform:bw(e.target),plugins:e.plugins,write:!1};if(e.conditions)r.conditions=e.conditions;if(e.define)r.define=e.define;if("path"in n){if(r.entryPoints=[n.path],n.contents!==void 0)r.plugins=[rI(n.path,n.contents),...e.plugins]}else r.stdin={contents:n.source,loader:"js",resolveDir:n.resolveDir,sourcefile:"jx-entry.js"};return(await t.build({...r,write:!1})).outputFiles[0].text}async function $w(e){let t=await Promise.resolve().then(() => Sr(ol(),1)),n={bundle:!0,chunkNames:"chunk-[hash]",entryNames:"[name]",entryPoints:e.entries,external:e.external,format:"esm",logLevel:"silent",minify:e.minify,outdir:e.outdir,platform:bw(e.target),plugins:e.plugins,splitting:!0};if(e.conditions)n.conditions=e.conditions;if(e.define)n.define=e.define;return(await t.build({...n,write:!1})).outputFiles.map((s)=>(ZM(eI(s.path),{recursive:!0}),QM(s.path,s.contents),s.path))}var Sw=()=>{};var ww=".jx-entry-";import{rmSync as oI,writeFileSync as vw}from"node:fs";import{builtinModules as iI}from"node:module";import{tmpdir as aI}from"node:os";import{basename as lI,join as cI,resolve as uI}from"node:path";function Ew(e){return jo(e)||e.startsWith("./")||e.startsWith("../")}function Pm(e,t,n){if(jo(e))return vm(e.slice(hu.length),n);return uI(t,e)}function jw(e,t){return vm(e,t)}function fI(e){let{onFileLoaded:t,resolver:n}=e,r=e.plugins??[];if(n===void 0&&t===void 0)return[...r];return[{name:"jx-bundle-hooks",setup:(o)=>{if(n!==void 0)o.onResolve({filter:n.filter},(i)=>n.resolve(i));if(t!==void 0)o.onLoad({filter:/.*/},(i)=>{t(i.path)})}},...r]}function pI(e){if(e==="cloudflare-workers"||e==="cloudflare-pages")return{conditions:["workerd","worker"],external:["cloudflare:*","node:*"],plugins:[dI],target:"workerd"};return{target:e==="bun"?"bun":"node"}}function hI(e){return e.minify??e.target==="browser"}function gI(e){let t={};if(e.conditions)t.conditions=e.conditions;if(e.target==="browser")t.define={...mI};return t}function _m(e){return{...gI(e),external:e.external??[],minify:hI(e),plugins:fI(e),target:e.target}}async function Pw(e,t){let n={path:e.entryPath};if(e.contents!==void 0)n.contents=e.contents;let r=await Em({entry:n,..._m(t)});vw(e.outfile,r,"utf8")}async function _w(e,t,n){return $w({entries:e,outdir:t,..._m(n)})}function km(e){return e==="<stdin>"||lI(e).startsWith(ww)}async function kw(e,t,n){let r=[],s=cI(aI(),`jx-resolve-${process.pid}.js`);try{await No(`export * from ${JSON.stringify(e)};
|
|
121
|
+
`,{outfile:s,resolveDir:t},{...n,minify:!1,onFileLoaded:(o)=>r.push(o)})}catch{return}finally{oI(s,{force:!0})}return r.find((o)=>!km(o))}async function No(e,{resolveDir:t,outfile:n},r){let s=await Em({entry:{resolveDir:t,source:e},..._m(r)});vw(n,s,"utf8")}async function Ow(e,{projectRoot:t,outfile:n,adapter:r,plugins:s}){let o=pI(r);if(s!==void 0)o.plugins=[...o.plugins??[],...s];await No(e,{outfile:n,resolveDir:t},o)}var jm,dI,mI;var Om=J(()=>{An();Sw();jm=["@vue/reactivity","lit-html"];dI={name:"jx-bare-node-builtins",setup(e){let t=iI.filter((r)=>!r.startsWith("_")&&!r.includes(":")),n=new RegExp(`^(${t.map((r)=>r.replaceAll("/",String.raw`\/`)).join("|")})$`);e.onResolve({filter:n},(r)=>({external:!0,path:`node:${r.path}`}))}};mI={"process.env.NODE_ENV":'"production"'}});function yI(e,t){let n=e.slice(0,t),r=n.split(`
|
|
121
122
|
`).length;return{column:t-n.lastIndexOf(`
|
|
122
|
-
`),line:r}}function
|
|
123
|
+
`),line:r}}function Cm(e,t,n,r){return{...yI(e,t),kind:n,message:r,offset:t}}function xI(e,t){let n=t;while(n<e.length&&/\s/u.test(e.charAt(n)))n+=1;return n}function Nw(e){for(let t of[e,`return async function () {
|
|
123
124
|
${e}
|
|
124
|
-
}`])try{return Reflect.construct(Function,[t])!==null}catch{}return!1}function
|
|
125
|
+
}`])try{return Reflect.construct(Function,[t])!==null}catch{}return!1}function Tw(e){Rm=e,Au=null}function $I(e,t){if(!Au){if(!Rm)throw Error("@jxsuite/erase was imported without an entry that loads its stripper");Au=Rm()}return Au(e,t)}function Jw(e,t,n){return $I(e,(r)=>{let s=xI(e,r.pos),[o="this"]=/^[\w$]+/u.exec(e.slice(s))??[];n.push(Cm(e,s,"unsupported",`\`${o}\` is TypeScript that has to be compiled rather than erased. ${t} may use only types that can be removed: no enum, value namespace or parameter property`))})}function SI(e){return po(e).includes("<")||!Nw(e)}function wI(e){let t=Am.get(e);if(t)return t;if(!SI(e)){let i={code:e,problems:[]};return Am.set(e,i),i}let n=[],r=Jw(e,"A function body",n),s=po(r);for(let i of s.matchAll(bI)){let a=i.index+(i[1]?.length??0)+(i[2]?.length??0);n.push(Cm(e,a,"unsupported",`A function body cannot ${i[3]??"import"}. Move code that needs a module into one of its own, named by $src`))}if(r!==e&&n.length===0&&Nw(e)){let i=[...e].findIndex((a,l)=>a!==r[l]);n.push(Cm(e,Math.max(i,0),"meaning","This was already JavaScript, and reading it as TypeScript changes it: `a < b > (c)` is a generic call in TypeScript and two comparisons in JavaScript. Add parentheses if a comparison is meant"))}let o={code:r,problems:n};return Am.set(e,o),o}function Mw(e){let t=Aw.get(e);if(t)return t;let n=[],s={code:Jw(e,"A script",n),problems:n};return Aw.set(e,s),s}function vI(e){return String(e).replaceAll("~","~0").replaceAll("/","~1")}function Cw(e,t,n){if(k(e))return Rw(e,t,n);if(Array.isArray(e)&&e.length>0&&e.every((r)=>k(r)))return Rw(e.join(`
|
|
125
126
|
`),t,n).split(`
|
|
126
|
-
`);return e}function Sb(e,t,n){let{code:r,problems:s}=DT(e),[o,...i]=s.filter((a)=>a.kind==="unsupported");if(o)throw new Vl(t,[o,...i]);for(let a of s)n.push({...t,problem:a});return r}function fp(e,t,n){if(Array.isArray(e))return e.map((i,a)=>fp(i,{...t,pointer:`${t.pointer}/${a}`},n));if(!V(e))return e;let r=td(e),s=[],o={set:(i,a)=>{s.push([i,a])}};for(let[i,a]of Object.entries(e)){let c={...t,pointer:`${t.pointer}/${FT(i)}`};if(r&&i==="body")o.set(i,wb(a,c,n));else if(r&&(i==="getter"||i==="setter")&&V(a)){let l={...a};if(a.body!==void 0)l.body=wb(a.body,{...c,pointer:`${c.pointer}/body`},n);o.set(i,l)}else o.set(i,fp(a,c,n))}return Object.fromEntries(s)}function Ha(e,t,n=[]){return fp(e,{path:t,pointer:""},n)}function _b(e,t,n=[]){return Ha(e,t,n)}var JT,cp,Ll=null,up=null,$b,Vl;var dp=T(()=>{le();JT=/(^|[\n;{}])(\s*)(import|export)(?=[\s{*"'])/gu;cp=new Map;$b=new Map;Vl=class Vl extends Error{problems;site;constructor(e,t){let[n]=t;super(`${e.path}${e.pointer}: ${n.message} (line ${n.line}, column ${n.column})`);this.name="EraseError",this.problems=t,this.site=e}}});import{createRequire as LT}from"node:module";var ql=T(()=>{dp();dp();Eb(()=>LT(import.meta.url)("ts-blank-space").default)});function Ob(e){for(let{path:t,pointer:n,problem:r}of e){let s=`${t}${n} (line ${r.line}, column ${r.column}): ${r.message}`;if(!kb.has(s))kb.add(s),console.warn(`Warning: ${s}`)}}function ur(e,t){let n=[],r=Ha(e,t,n);return Ob(n),r}function Ab(e,t){let n=[],r=_b(e,t,n);return Ob(n),r}var kb;var pi=T(()=>{ql();kb=new Set});function qT(e){return e.split("\\").join("/").replace(/^\.\//,"").replace(/^\//,"").replace(/^pages\//,"")}function Rb(e){let t=qT(e),n=t.slice(t.lastIndexOf("/")+1),r=n.lastIndexOf(".");if(r>0)t=t.slice(0,t.length-(n.length-r));if(t.endsWith("/index"))t=t.slice(0,-6)||"/";else if(t==="index")t="/";if(!t.startsWith("/"))t=`/${t}`;let s=[],o=!1,i=!1,a=t.replaceAll(VT,(c,l,u)=>{if(o=!0,l)return i=!0,s.push(l),"*";return s.push(u),`:${u}`});return{isCatchAll:i,isDynamic:o,params:s,urlPattern:a}}function Cb(e,t){if(e.isDynamic!==t.isDynamic)return e.isDynamic?1:-1;if(e.isCatchAll!==t.isCatchAll)return e.isCatchAll?1:-1;return e.urlPattern.localeCompare(t.urlPattern)}var VT;var Nb=T(()=>{VT=/\[\.\.\.(\w+)\]|\[(\w+)\]/g});function HT(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function Tb(e){if(!V(e)||!("paginate"in e))return null;let{each:t,pageSize:n,paginate:r}=e,s=V(r)?r.$ref:void 0,o=k(s)?WT.exec(s)?.[1]:void 0;if(o===void 0)throw TypeError('$paths.paginate must be { "$ref": "#/state/<key>" }');if(!St(n)||!Number.isInteger(n)||n<1)throw TypeError("$paths.pageSize must be a positive integer");let i={key:HT(o),pageSize:n};if(t!==void 0){if(!V(t)&&!Array.isArray(t))throw TypeError("$paths.each must be a $paths source");if(V(t)&&"paginate"in t)throw TypeError("$paths.each cannot itself be paged");i.each=t}return i}function pp(e,t){return Math.max(1,Math.ceil(e/t))}function Jb(e,t,n){let r=(t-1)*n;return e.slice(r,r+n)}function vo(e,t){if(e.endsWith("*")){if(t===1){let n=e.slice(0,-1).replace(/\/$/,"");return n===""?"/":n}return`${e.slice(0,-1)}${t}`}return e.replace(/:[^/]+/,String(t))}function Ib(e,t,n,r){let s=pp(r,n),o=[];for(let i=1;i<=s;i++)o.push({current:i===t,number:i,url:vo(e,i)});return{first:vo(e,1),itemCount:r,last:vo(e,s),next:t<s?vo(e,t+1):null,number:t,pageCount:s,pageSize:n,pages:o,prev:t>1?vo(e,t-1):null}}var WT;var Mb=T(()=>{le();WT=/^#\/state\/([^/]+)$/});function Tn(e){if(!k(e)||e.trim()==="")return null;try{return new Intl.Locale(e.trim()).toString()}catch{return null}}function Ua(e){let t=Tn(e);if(t===null)return"ltr";let n=new Intl.Locale(t),r=n.script??n.maximize().script;return r!==void 0&&UT.has(r)?"rtl":"ltr"}function Db(e){let t=Tn(e);if(t===null)return k(e)?e:"";return new Intl.DisplayNames([t],{type:"language"}).of(t)??t}function mp(e){let t=e.i18n,n=[];if(!D(t))return{errors:n,i18n:null};let r=Array.isArray(t.locales)?t.locales:[],s=[];for(let a of r){let c=Tn(a);if(c===null){n.push(`i18n.locales: "${String(a)}" is not a well-formed BCP 47 language tag.`);continue}if(!s.includes(c))s.push(c)}let o=Tn(t.defaultLocale)??s[0]??null;if(t.defaultLocale!==void 0&&Tn(t.defaultLocale)===null)n.push(`i18n.defaultLocale: "${String(t.defaultLocale)}" is not a well-formed BCP 47 language tag.`);if(o===null)return n.push("i18n is declared with no usable locale — set `defaultLocale` or `locales`."),{errors:n,i18n:null};if(!s.includes(o))s.unshift(o);let i=t.routing==="prefix-always"||t.routing==="prefix-except-default"?t.routing:BT;return{errors:n,i18n:{defaultLocale:o,locales:s,routing:i}}}function Xn(e,t){if(t===null)return null;let n=e.split("/").find(Boolean);if(n===void 0)return t.defaultLocale;let r=Tn(n);return r!==null&&t.locales.includes(r)?r:t.defaultLocale}var UT,Wl="^[A-Za-z]{2,8}(-[A-Za-z0-9]{1,8})*$",BT="prefix-except-default";var Eo=T(()=>{le();UT=new Set(["Adlm","Arab","Aran","Armi","Avst","Cprt","Egyd","Egyh","Elym","Gara","Hatr","Hebr","Hluw","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogd","Sogo","Syrc","Thaa","Todr","Yezi"])});function KT(e){let t=new Set,n=new Set,r=(o)=>{if(o.startsWith("#/state/"))t.add(o.slice(8).split("/")[0])},s=(o)=>{if(k(o)){for(let i of o.matchAll(/\bstate\.([A-Za-z_$][\w$]*)\s*\(/gu))t.add(i[1]);return}if(Array.isArray(o)){if(!n.has(o)){n.add(o);for(let i of o)s(i)}return}if(!V(o)||n.has(o))return;if(n.add(o),o.operator==="call"&&Ne(o.target))r(o.target.$ref);for(let[i,a]of Object.entries(o)){if(i==="$defs")continue;if(i.startsWith("on")&&Ne(a))r(a.$ref);s(a)}};s(e);for(let o of zT)if(V(e.state)&&o in e.state)t.add(o);return t}function hp(e){return"body"in e&&"$src"in e}function Ba(e){return Fc(e.parameters??e.arguments).length>0}function fr(e){let t=["state"];for(let n of Fc(e.parameters??e.arguments))if(n!=="state")t.push(n);return t}function GT(e,t,n){if(sr(t))return"callable";if(Fc(t.parameters??t.arguments).length>0)return"callable";if(k(t.body))return Lg(t.body)?"computed":"callable";if(t.$src)return n().has(e)?"callable":"computed";return"callable"}function jo(e){let t=new Map,n=null,r=()=>n??=KT(e);for(let[s,o]of Object.entries(e.state??{}))if(jt(o))t.set(s,GT(s,o,r));return t}var zT;var za=T(()=>{le();zT=new Set(["onMount","onUnmount","onAdopted"])});function an(e){return e.replaceAll(/[A-Z]/g,(t)=>`-${t.toLowerCase()}`)}function Fb(e,t){if(e.startsWith("@--"))return t[e.slice(1)]??e.slice(1);if(e.startsWith("@(")){let n=e.slice(2,-1).trim();return XT.has(n.toLowerCase())?n:e.slice(1)}return null}function Ka(e){return e.startsWith("@position-try")||e.startsWith("@property")||e.startsWith("@font-face")||e.startsWith("@counter-style")}function Xa(e){return e.startsWith("@keyframes")}function Lb(e,t){let n=[];for(let r of Ga(e))for(let s of Ga(t))n.push(YT(r,s));return n.join(", ")}function YT(e,t){let n=Ul(t,e);if(n!==null)return n;if(t.startsWith("[")||t.startsWith(":")||t.startsWith("."))return`${e}${t}`;return`${e} ${t}`}function gp(e){let t=[],n=null,r=0;for(let s=0;s<e.length;s+=1){let o=e[s];if(n){if(o==="\\")s+=1;else if(o===n)n=null;continue}if(o==="\\")s+=1;else if(o==='"'||o==="'")n=o;else if(o==="[")r+=1;else if(o==="]")r=Math.max(0,r-1);else if(o==="&"&&r===0)t.push(s)}return t}function Ul(e,t){return gp(e).length>0?ZT(e,t):null}function ZT(e,t){let n="",r=0;for(let s of gp(e))n+=e.slice(r,s)+t,r=s+1;return n+e.slice(r)}function Ga(e){let t=[],n=0,r=null,s=0;for(let i=0;i<e.length;i+=1){let a=e[i];if(r){if(a==="\\")i+=1;else if(a===r)r=null;continue}if(a==='"'||a==="'")r=a;else if(a==="("||a==="[")n+=1;else if(a===")"||a==="]")n=Math.max(0,n-1);else if(a===","&&n===0)t.push(e.slice(s,i)),s=i+1}t.push(e.slice(s));let o=t.flatMap((i)=>{let a=i.trim();return a===""?[]:[a]});return o.length>0?o:[e]}function Zn(e){let t=/^\(\s*prefers-color-scheme\s*:\s*(light|dark)\s*\)$/.exec(e.trim())?.[1];return t==="light"||t==="dark"?t:null}function yp(e,t){if(e===":root"||e==="html")return{auto:`${e}:where(:not([${Yn}]))`,forced:`${e}:where([${Yn}="${t}"])`};return{auto:`:where(:root:not([${Yn}])) ${e}`,forced:`:where(:root[${Yn}="${t}"]) ${e}`}}function ys(e){return e.startsWith(":")||e.startsWith(".")||e.startsWith("&")||e.startsWith("[")}function xp(e){return e.startsWith("--")?e:an(e)}function Hl(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function Vb(e,t,n){let r=n.map(([o,i])=>`${o}: ${i}`).join("; "),s=t===null?r:`${t} { ${r} }`;for(let o=e.length-1;o>=0;o-=1)s=`${e[o]} { ${s} }`;return s}function QT(e,t,n){let r=n.map(({selector:o,declarations:i})=>`${o} { ${i.map(([a,c])=>`${a}: ${c}`).join("; ")} }`).join(" "),s=`@keyframes ${t} { ${r} }`;for(let o=e.length-1;o>=0;o-=1)s=`${e[o]} { ${s} }`;return s}function eJ(e){let t=Object.keys(e).filter((r)=>Xa(r));if(t.length===0)return e;let n={...e};for(let r of t)delete n[r];return n}function tJ(e){let n=gp(e).at(-1),r=n===void 0?e:e.slice(n+1);return r===""||r.startsWith(":")||r.startsWith(".")||r.startsWith("[")}function mi(e,t={}){let{scope:n=null,mediaQueries:r={},transposeValue:s=(g)=>g,transposeSelector:o=(g)=>g,resolveValue:i}=t,a=[],c=(g)=>g!==null&&typeof g==="object"&&!Array.isArray(g)&&!Ne(g),l=(g,b)=>{if(c(b))return[b];if(!Ka(g)||!Array.isArray(b)||b.length===0)return[];return b.every((j)=>c(j))?b:[]},u=(g,b,j,v)=>{if(b===void 0||b===null)return null;if(Ne(b))return j?i?.(g,b,v)??null:null;if(D(b))return null;let P=String(b);if(me(P))return j?i?.(g,P,v)??null:null;return s(P)},d=(g,b,j=!0,v="self")=>{let P=[];for(let[S,_]of Object.entries(g)){if(l(S,_).length>0)continue;if(b&&(S.startsWith("@")||ys(S)))continue;if(S.startsWith("$"))continue;let N=u(S,_,j,v);if(N!==null)P.push([xp(S),N])}return P},p=(g,b,j,v,P)=>{if(j.length===0)return;let S=b;if(S!==null){let F=o(S);if(F===null)return;S=F}let _=Vb(g,S,j),N={text:_,conditions:[...g],selector:S,declarations:j,target:v,key:Hl(_)};if(k(P)&&P!=="")N.description=P;a.push(N)},m=(g,b,j)=>{let v=g.slice(10).trim();if(v==="")return;let P=[];for(let[_,N]of Object.entries(b)){if(!c(N))continue;let F=d(N,!0,!1,"unscoped");if(F.length>0)P.push({declarations:F,selector:_.trim()})}if(P.length===0)return;let S=QT(j,v,P);a.push({blocks:P,conditions:[...j],declarations:[],key:Hl(S),selector:null,target:"unscoped",text:S})},x=(g,b,j,v,P)=>{if(g==="@--")return;if(Ka(g)){p([...v,g],null,d(b,!1,!0,"unscoped"),"unscoped",b.$description);return}if(Xa(g)){m(g,b,v);return}let S=Fb(g,r),_=S===null?g:`@media ${S}`,N=S===null?null:Zn(S);if(N!==null&&j!==null){let{auto:F,forced:K}=yp(j,N);h(b,F,[...v,_],P),h(eJ(b),K,v,P);return}h(b,j,[...v,_],P)};function h(g,b,j,v){p(j,b,d(g,!0,!0,v),v,g.$description);for(let[P,S]of Object.entries(g))for(let _ of l(P,S))if(P.startsWith("@"))x(P,_,b,j,v);else if(b!==null)h(_,Lb(b,P),j,tJ(P)?v:"descendant")}return h(e,n,[],"self"),a}var XT,Yn="data-color-scheme",Bl="jx-color-scheme";var Ya=T(()=>{le();XT=new Set(["all","print","screen","speech"])});function Hb(){return`the Intl helpers ${$p.join(", ")}`}var dr="en-US",bp="UTC",qb,$p,Wb;var wp=T(()=>{qb=[{api:"Intl.NumberFormat",params:["value","locale","options"],path:"Intl/formatNumber",summary:"Format a number for a locale — grouping, decimals, currency, percent, units."},{api:"Intl.DateTimeFormat",params:["value","locale","options"],path:"Intl/formatDate",summary:"Format a date or timestamp for a locale. Pass `timeZone` in options."},{api:"Intl.RelativeTimeFormat",params:["value","unit","locale","options"],path:"Intl/formatRelativeTime",summary:'Format a relative time — `-3, "day"` becomes "3 days ago".'},{api:"Intl.ListFormat",params:["values","locale","options"],path:"Intl/formatList",summary:'Join a list the way a locale does — "a, b, and c", not a hand-written comma join.'},{api:"Intl.PluralRules",params:["value","locale","options"],path:"Intl/plural",summary:'Which plural category a number falls in ("one", "few", "other") — many languages have '+"more than two, so a ternary on `n === 1` is wrong outside English."},{api:"Intl.Collator",params:["a","b","locale","options"],path:"Intl/compare",summary:'Compare two strings for sorting. `<` and `sort()` order by UTF-16 code unit, which puts "Zebra" before "apple" and sorts every accented word into the wrong place.'},{api:"Intl.DisplayNames",params:["code","type","locale","options"],path:"Intl/displayName",summary:'The name of a language, region, script or currency in a locale — "de" as "German" or '+'"Deutsch", from CLDR rather than a hand-kept table.'},{api:"Intl.Segmenter",params:["value","granularity","locale"],path:"Intl/segment",summary:"Split text into graphemes, words or sentences (UAX #29). `[...str]` splits code points, so it cuts an emoji with a skin-tone modifier in half."}],$p=qb.map((e)=>e.path),Wb=Object.fromEntries(qb.map((e)=>[e.path,e.params.indexOf("locale")]))});function nJ(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function Xt(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function pr(e){if(e==="")return[];return e.split("/").map((t)=>nJ(t))}function Jt(e,t){let n=e;for(let r of pr(t))n=n?.[r];return n}function Je(e,t){let n=e;for(let r of pr(t))n+=Sp.test(r)?`.${r}`:`[${JSON.stringify(r)}]`;return n}function Ub(e,t){let n=e;for(let[r,s]of pr(t).entries()){let o=r===0?"":"?.";n+=Sp.test(s)?`${r===0?".":o}${s}`:`${o}[${JSON.stringify(s)}]`}return n}function Gr(e){return Sp.test(e)?e:JSON.stringify(e)}function Bb(e){let t=e.replaceAll(/[^A-Za-z0-9_$]/g,"_");if(t==="")return"ref";return/^\d/.test(t)?`_${t}`:t}var Sp;var hi=T(()=>{Sp=/^[A-Za-z_$][A-Za-z0-9_$]*$/});function vp(e){let t=e.$map;return D(t)?t:void 0}function Gl(e){return D(e)&&!Array.isArray(e)&&"operator"in e}function gi(e){return D(e)&&!Array.isArray(e)&&"$ref"in e}function iJ(e,t,n){let r=Wb[e];if(r===void 0||r<0||t[r]!=null)return t;let s=Jt(n.$page,"locale");if(!k(s)||s==="")return t;let o=[...t];return o[r]=s,o}function Qb(){return globalThis.window??globalThis}function e$(e){return e.startsWith("window#/")&&sJ.has(e.slice(8))}function mr(e){return Xb.has(e)}function zl(e){if(Array.isArray(e))return e.some((t)=>zl(t));if(e===void 0||!Gl(e))return!1;return mr(e.operator)||[e.target,e.value,e.initial,e.default].some((t)=>zl(t))||Object.values(e.cases??{}).some((t)=>zl(t))}function Po(e){return Ir(e)&&!zl(e.$expression)}function Ep(e,t){if(Array.isArray(e)){for(let n of e)Ep(n,t);return}if(e===void 0||!D(e))return;if(gi(e)){if(!aJ.test(e.$ref)){let n=e.$ref.replace(/^(?:#\/state\/|parent#\/)/,"");t.add(pr(n)[0]??"")}return}if(Gl(e)){let n=[e.target,e.value,e.initial,e.default];for(let r of[...n,...Object.values(e.cases??{})])Ep(r,t)}}function Ap(e){let t=new Set;return Ep(e.$expression,t),[...t]}function Rp(e){let t=new Map;for(let[r,s]of Object.entries(e??{}))if(!r.startsWith("$")&&Po(s))t.set(r,s);let n=!1;while(!n){n=!0;for(let[r,s]of t)if(Ap(s).some((o)=>!t.has(o)))t.delete(r),n=!1}return Object.fromEntries(t)}function tt(e,t){if(!e)return;let n=(e.depth??0)+1;if(n>cJ)return;return{depth:n,path:[...e.path??[],...Array.isArray(t)?t:[t]],report:e.report}}function Ye(e,t,n,r,s){if(e===null||e===void 0)return e;if(Gl(e))return Sn(e,t,n,r,s);if(gi(e)){let o=Kl(e.$ref,t,n,r);return s?.report(s.path??[],o),o}if(Array.isArray(e))return t$(e,t,n,r,s);return s?.report(s.path??[],e),e}function t$(e,t,n,r,s){return e.map((o,i)=>Ye(o,t,n,r,tt(s,i)))}function lJ(e,t,n,r){let s=(o)=>{if(!e.slice(o.length).includes("/"))return t;return Kl(e.slice(0,e.lastIndexOf("/")),t,n,r)};if(e.startsWith("#/state/"))return s("#/state/");if(e.startsWith("parent#/"))return s("parent#/");if(e.startsWith("$map/")||e.startsWith("$args/"))return e.split("/").length>2?Kl(e.slice(0,e.lastIndexOf("/")),t,n,r):void 0;return}function Kl(e,t,n,r){if(e==="$reduce/acc")return r?.acc;if(e.startsWith("$reduce/"))return r?.acc;if(e.startsWith("$args/")){let s=e.slice(6).split("/"),o=r?.args?.[s[0]];return s.length>1?Jt(o,s.slice(1).join("/")):o}if(e.startsWith("event#/")){let s=e.slice(7);return Jt(n,s)}if(e.startsWith("$map/")){let s=e.split("/"),[,o]=s,i,a=vp(t);if(o==="item")i=r?.item??a?.item??t["$map/item"];else if(o==="index")i=r?.index??a?.index??t["$map/index"];else i=a?.[o]??t[`$map/${o}`];return s.length>2?Jt(i,s.slice(2).join("/")):i}if(e.startsWith("#/state/"))return Jt(t,e.slice(8));if(e.startsWith("parent#/"))return Jt(t,e.slice(8));if(e.startsWith("window#/"))return Jt(Qb(),e.slice(8));if(e.startsWith("document#/"))return Jt(globalThis.document,e.slice(10));return Jt(t,e)??null}function uJ(e,t,n,r){if(e.startsWith("$map/")){let s=e.split("/"),[,o]=s,i,a=vp(t);if(o==="item")i=r?.item??a?.item??t["$map/item"];else if(o==="index")i=r?.index??a?.index??t["$map/index"];else i=a?.[o]??t[`$map/${o}`];if(s.length>2){let c=s.slice(2),l=c.pop(),u=c.length>0?Jt(i,c.join("/")):i;return{key:l,obj:u}}return{key:o==="item"?"$map/item":"$map/index",obj:vp(t)??t}}if(e.startsWith("#/state/")){let s=e.slice(8);if(s.indexOf("/")===-1)return{key:s,obj:t};let i=pr(s),a=i.pop(),c=t;for(let l of i)c=c[l];return{key:a,obj:c}}return{key:e,obj:t}}function Sn(e,t,n,r,s){let o=fJ(e,t,n,r,s);return s?.report(s.path??[],o),o}function Kb(e,t,n){switch(e){case"+":return t+n;case"-":return t-n;case"*":return t*n;case"/":return t/n;case"%":return t%n;case"<":return t<n;case"<=":return t<=n;case">":return t>n;default:return t>=n}}function fJ(e,t,n,r,s){let{operator:o,target:i,value:a,initial:c}=e;if(!rJ.has(o))throw Error(`$expression: unknown operator "${o}"`);if(jp.has(o)&&!("value"in e)){let l=Ye(i,t,n,r,tt(s,"target"));if(o==="!")return!l;if(o==="-")return-l}if(o==="call"){let l=gi(i)?i.$ref:void 0;if(!k(l))throw TypeError("$expression: call target must be a $ref pointer");let u=(r?.callDepth??0)+1;if(u>zb)throw Error(`$expression: call depth exceeded (${zb})`);let d=Array.isArray(a)?a.map((m,x)=>Ye(m,t,n,r,tt(s,["value",x]))):[];if(l.startsWith("window#/")){if(!e$(l))throw Error(`$expression: "${l}" is not a blessed pure global`);let m=l.slice(8),x=oJ.get(m);if(x)return x(...iJ(m,d,t));let h=Qb(),g=Jt(h,m),b=m.lastIndexOf("/"),j=b===-1?h:Jt(h,m.slice(0,b));return g.apply(j,d)}let p=Kl(l,t,n,r);if(At(p))return p.apply(lJ(l,t,n,r),d);if(D(p)&&"$expression"in p){let m=p,x={};for(let[h,g]of(m.parameters??[]).entries()){let b=k(g)?g:g?.name??"";if(!b)continue;x[b]=d[h]===void 0&&D(g)&&"default"in g?g.default:d[h]}return Sn(m.$expression,t,n,{args:x,callDepth:u})}throw TypeError(`$expression: call target "${l}" is not callable`)}if(kp.has(o)){if(o==="?:"){let m=Ye(i,t,n,r,tt(s,"target"));if(s){let x=Ye(a,t,n,r,tt(s,"value")),h=Ye(c,t,n,r,tt(s,"initial"));return m?x:h}return m?Ye(a,t,n,r):Ye(c,t,n,r)}let l=Ye(i,t,n,r,tt(s,"target")),u=String(l),d=e.cases??{},p=Object.hasOwn(d,u);if(s){let m;for(let[h,g]of Object.entries(d)){let b=Ye(g,t,n,r,tt(s,["cases",h]));if(h===u)m=b}let x=Ye(e.default,t,n,r,tt(s,"default"));return p?m:x}return p?Ye(d[u],t,n,r):Ye(e.default,t,n,r)}if(Pp.has(o)){let l=Ye(i,t,n,r,tt(s,"target")),u=Ye(a,t,n,r,tt(s,"value"));switch(o){case"===":return l===u;case"!==":return l!==u;case"&&":return l&&u;case"||":return l||u;case"??":return l??u;default:return Kb(o,l,u)}}if(Yb.has(o)){let l=Ye(a,t,n,r,tt(s,"value")),{obj:u,key:d}=uJ(i.$ref,t,n,r);u[d]=o==="="?l:Kb(o.slice(0,-1),u[d],l);return}if(Zb.has(o)){let l=Ye(i,t,n,r,tt(s,"target"));switch(o){case"push":return l.push(Ye(a,t,n,r,tt(s,"value")));case"unshift":return l.unshift(Ye(a,t,n,r,tt(s,"value")));case"pop":return l.pop();case"shift":return l.shift();case"splice":{let u=Ye(a,t,n,r,tt(s,"value"));return l.splice(...u)}default:break}}if(Op.has(o)){let l=Ye(i,t,n,r,tt(s,"target")),u=a===void 0?[]:Array.isArray(a)?t$(a,t,n,r,tt(s,"value")):[Ye(a,t,n,r,tt(s,"value"))],d=Jt(l,o);if(!At(d))return;return d.apply(l,u)}if(_p.has(o)){let l=Ye(i,t,n,r,tt(s,"target")),u=a;if(o==="reduce"){let d=Ye(c,t,n,r,tt(s,"initial"));for(let[p,m]of l.entries())d=Sn(u,t,n,{acc:d,index:p,item:m},p===0?tt(s,"value"):void 0);return d}if(o==="map")return l.map((d,p)=>Sn(u,t,n,{...r,index:p,item:d},p===0?tt(s,"value"):void 0));if(o==="filter")return l.filter((d,p)=>Sn(u,t,n,{...r,index:p,item:d},p===0?tt(s,"value"):void 0))}return}function st(e,t){if(e===null)return"null";if(e===void 0)return"undefined";if(Gl(e))return Yt(e,t);if(gi(e))return Cp(e.$ref,t);if(Array.isArray(e))return e.map((n)=>st(n,t)).join(", ");return JSON.stringify(e)}function dJ(e){return`_fx_${e.replaceAll(/[^A-Za-z0-9_$]/g,"_")}`}function Cp(e,t){let n=t.statePrefix??"state",r=t.eventParam??"event";if(e==="$reduce/acc")return"_acc";if(e.startsWith("$reduce/"))return"_acc";if(e.startsWith("$args/"))return Je("_args",e.slice(6));if(e.startsWith("event#/"))return Je(r,e.slice(7));if(e.startsWith("$map/")){let s=e.split("/"),[,o]=s;if(o==="item")return s.length>2?Je("_item",s.slice(2).join("/")):"_item";if(o==="index")return"_index";return`_${o}`}if(e.startsWith("#/state/"))return Je(n,e.slice(8));if(e.startsWith("parent#/"))return Je(n,e.slice(8));if(e.startsWith("window#/"))return Je("window",e.slice(8));if(e.startsWith("document#/"))return Je("document",e.slice(10));return Je(n,e)}function Gb(e,t){if(gi(e))return Cp(e.$ref,t);return st(e,t)}function pJ(e,t,n){let r=(i)=>t[i]??"undefined",s=`(${n.statePrefix??"state"}?.$page?.locale ?? ${JSON.stringify(dr)})`,o=JSON.stringify(bp);switch(e){case"Intl/formatNumber":return`new Intl.NumberFormat(${r(1)} ?? ${s}, ${r(2)}).format(${r(0)})`;case"Intl/formatDate":return`new Intl.DateTimeFormat(${r(1)} ?? ${s}, {timeZone: ${o}, ...${r(2)}}).format(new Date(${r(0)}))`;case"Intl/formatRelativeTime":return`new Intl.RelativeTimeFormat(${r(2)} ?? ${s}, ${r(3)}).format(${r(0)}, ${r(1)})`;case"Intl/formatList":return`new Intl.ListFormat(${r(1)} ?? ${s}, ${r(2)}).format(${r(0)})`;case"Intl/plural":return`new Intl.PluralRules(${r(1)} ?? ${s}, ${r(2)}).select(${r(0)})`;case"Intl/compare":return`new Intl.Collator(${r(2)} ?? ${s}, ${r(3)}).compare(${r(0)}, ${r(1)})`;case"Intl/displayName":return`new Intl.DisplayNames(${r(2)} ?? ${s}, {...${r(3)}, type: ${r(1)} ?? 'language'}).of(${r(0)})`;case"Intl/segment":return`[...new Intl.Segmenter(${r(2)} ?? ${s}, {granularity: ${r(1)} ?? 'grapheme'}).segment(${r(0)})].map((p) => p.segment)`;default:return null}}function Yt(e,t={}){let{operator:n,target:r,value:s,initial:o}=e;if(jp.has(n)&&!("value"in e)){let i=st(r,t);if(n==="!")return`!(${i})`;if(n==="-")return`-(${i})`}if(n==="call"){let i=(gi(r)?r.$ref:void 0)??"",a=Array.isArray(s)?s.map((c)=>st(c,t)):[];if(i.startsWith("window#/")){if(!e$(i))throw Error(`$expression: "${i}" is not a blessed pure global`);let c=pJ(i.slice(8),a,t);if(c)return c;return`window.${i.slice(8).replaceAll("/",".")}(${a.join(", ")})`}if(i.startsWith("#/state/")){let c=i.slice(8),l=t.formulaParams?.[c];if(l){let u=l.map((d,p)=>`${JSON.stringify(d)}: ${a[p]??"undefined"}`).join(", ");return`${dJ(c)}(${t.statePrefix??"state"}, { ${u} })`}}return`${Cp(i,t)}(${a.join(", ")})`}if(kp.has(n)){if(n==="?:"){let l=st(r,t),u=st(s,t),d=st(o,t);return`(${l} ? ${u} : ${d})`}let i=st(r,t),a=Object.entries(e.cases??{}).map(([l,u])=>`_d === ${JSON.stringify(l)} ? ${st(u,t)} : `).join(""),c="default"in e?st(e.default,t):"undefined";return`((_d) => ${a}${c})(String(${i}))`}if(Pp.has(n)){let i=st(r,t),a=st(s,t);return`(${i} ${n} ${a})`}if(Yb.has(n)){let i=Gb(r,t),a=st(s,t);return`${i} ${n} ${a}`}if(Zb.has(n)){let i=Gb(r,t);switch(n){case"push":return`${i}.push(${st(s,t)})`;case"unshift":return`${i}.unshift(${st(s,t)})`;case"pop":return`${i}.pop()`;case"shift":return`${i}.shift()`;case"splice":{let a=Array.isArray(s)?s.map((c)=>st(c,t)).join(", "):st(s,t);return`${i}.splice(${a})`}default:break}}if(Op.has(n)){let i=st(r,t),a=s===void 0?"":Array.isArray(s)?s.map((c)=>st(c,t)).join(", "):st(s,t);return`(${i})?.${n}?.(${a})`}if(_p.has(n)){let i=st(r,t),a=Yt(s,t);if(n==="reduce"){let c=st(o,t);return`${i}.reduce((_acc, _item, _index) => ${a}, ${c})`}if(n==="map")return`${i}.map((_item, _index) => ${a})`;if(n==="filter")return`${i}.filter((_item, _index) => ${a})`}return"undefined"}function yi(e,t,n,r){return Ye(e,t,n,r)}function Xr(e,t={}){return st(e,t)}var Xb,jp,Pp,Yb,Zb,_p,kp,Op,rJ,sJ,oJ,aJ,zb=64,cJ=64;var xi=T(()=>{wp();le();hi();Xb=new Set(["=","+=","-=","*=","/=","push","pop","shift","unshift","splice"]),jp=new Set(["!","-"]),Pp=new Set(["+","-","*","/","%","===","!==","<","<=",">",">=","&&","||","??"]),Yb=new Set(["=","+=","-=","*=","/="]),Zb=new Set(["push","pop","shift","unshift","splice"]),_p=new Set(["reduce","map","filter"]),kp=new Set(["?:","switch"]),Op=new Set(["includes","indexOf","lastIndexOf","join","slice","concat","at","flat","toSorted","toReversed","toSpliced","with","toUpperCase","toLowerCase","trim","trimStart","trimEnd","split","startsWith","endsWith","padStart","padEnd","replaceAll","repeat","charAt","normalize","toLocaleUpperCase","toLocaleLowerCase","toFixed","toPrecision","toLocaleString"]),rJ=new Set([...Xb,...jp,...Pp,..._p,...kp,...Op,"call"]),sJ=new Set(["isNaN","isFinite","parseFloat","parseInt","encodeURIComponent","decodeURIComponent","structuredClone","Math/abs","Math/ceil","Math/floor","Math/round","Math/trunc","Math/sign","Math/sqrt","Math/cbrt","Math/pow","Math/exp","Math/log","Math/log2","Math/log10","Math/min","Math/max","Math/hypot","Number/isInteger","Number/isFinite","Number/isNaN","Number/parseFloat","Number/parseInt","JSON/parse","JSON/stringify","Object/keys","Object/values","Object/entries","Object/fromEntries","Array/from","Array/isArray","Array/of","String/fromCharCode","String/fromCodePoint",...$p]),oJ=new Map([["Intl/compare",(e,t,n,r)=>new Intl.Collator(n??dr,r).compare(e,t)],["Intl/displayName",(e,t,n,r)=>new Intl.DisplayNames(n??dr,{...r,type:t??"language"}).of(e)],["Intl/formatDate",(e,t,n)=>new Intl.DateTimeFormat(t??dr,{timeZone:bp,...n}).format(new Date(e))],["Intl/formatList",(e,t,n)=>new Intl.ListFormat(t??dr,n).format(e)],["Intl/formatNumber",(e,t,n)=>new Intl.NumberFormat(t??dr,n).format(e)],["Intl/formatRelativeTime",(e,t,n,r)=>new Intl.RelativeTimeFormat(n??dr,r).format(e,t)],["Intl/plural",(e,t,n)=>new Intl.PluralRules(t??dr,n).select(e)],["Intl/segment",(e,t,n)=>[...new Intl.Segmenter(n??dr,{granularity:t??"grapheme"}).segment(e)].map((r)=>r.segment)]]);aJ=/^(?:\$args\/|\$reduce\/|\$map\/|window#\/|document#\/|event#\/)/});function n$(e){if("operator"in e)return{kind:"expression",node:e};if("if"in e)return{kind:"if",node:e};if("$switch"in e)return{kind:"switch",node:e};if("stopPropagation"in e)return{kind:"stopPropagation"};if("preventDefault"in e)return{kind:"preventDefault"};return{kind:"dispatch",node:e}}function mJ(e){return(D(e)||At(e))&&"then"in e&&At(e.then)}async function bi(e,t,n,r={}){let s=r.args?{args:r.args}:void 0;for(let o of e){let i=n$(o);switch(i.kind){case"expression":{let a=Sn(i.node,t,n,s);if(mJ(a))await a;break}case"if":{let a=i.node,c=yi(a.if,t,n,s)?a.then:a.else;if(Array.isArray(c))await bi(c,t,n,r);break}case"switch":{let a=i.node,c=String(yi(a.$switch,t,n,s)),l=a.cases??{},u=Object.hasOwn(l,c)?l[c]:a.default;if(Array.isArray(u))await bi(u,t,n,r);break}case"dispatch":{let a=i.node,c=At(r.target)?r.target():r.target,l=n?.currentTarget??c;if(!l)break;let u={};if("detail"in a)u.detail=yi(a.detail,t,n,s);if(a.bubbles!==void 0)u.bubbles=a.bubbles;if(a.composed!==void 0)u.composed=a.composed;l.dispatchEvent(new CustomEvent(a.dispatchEvent,u));break}case"stopPropagation":{n?.stopPropagation();break}case"preventDefault":{n?.preventDefault();break}default:break}}}function Jn(e,t={}){let n=t.indent??"",r=[];for(let s of e){let o=n$(s);switch(o.kind){case"expression":{r.push(`${n}${Yt(o.node,t)};`);break}case"if":{let i=o.node,a=Xr(i.if,t),c={...t,indent:`${n} `};if(r.push(`${n}if (${a}) {`,Jn(i.then??[],c)),i.else)r.push(`${n}} else {`,Jn(i.else,c));r.push(`${n}}`);break}case"switch":{let i=o.node,a=Xr(i.$switch,t),c={...t,indent:`${n} `};r.push(`${n}switch (String(${a})) {`);for(let[l,u]of Object.entries(i.cases??{}))r.push(`${n} case ${JSON.stringify(l)}: {`,Jn(u,c),`${n} break;`,`${n} }`);if(i.default)r.push(`${n} default: {`,Jn(i.default,c),`${n} }`);r.push(`${n}}`);break}case"dispatch":{let i=o.node,a=t.eventParam??"event",c=t.dispatchTarget??`(${a} && ${a}.currentTarget)`,l=[];if("detail"in i)l.push(`detail: ${Xr(i.detail,t)}`);if(i.bubbles!==void 0)l.push(`bubbles: ${JSON.stringify(i.bubbles)}`);if(i.composed!==void 0)l.push(`composed: ${JSON.stringify(i.composed)}`);let u=l.length>0?`, { ${l.join(", ")} }`:"";r.push(`${n}${c}?.dispatchEvent(new CustomEvent(${JSON.stringify(i.dispatchEvent)}${u}));`);break}case"stopPropagation":{r.push(`${n}${t.eventParam??"event"}?.stopPropagation();`);break}case"preventDefault":{r.push(`${n}${t.eventParam??"event"}?.preventDefault();`);break}default:break}}return r.join(`
|
|
127
|
-
`)}var Xl=T(()=>{le();xi()});var Np=T(()=>{le()});function $i(e){if(e===hJ)return"client";if(e===gJ)return"server";return null}function yJ(e){return e.replaceAll("\\","/").replace(/^(?:\.\/)+/,"")}function s$(e,t){return`${Ip}${yJ(e)}#${t}`}function Yl(e){return e.startsWith(Ip)}function wi(e){if(!Yl(e))return null;let t=e.slice(Ip.length),n=t.lastIndexOf("#");if(n<=0)return null;let r=t.slice(n+1);if(r!=="client"&&r!=="server")return null;return{path:t.slice(0,n),side:r}}function Tp(e,t){if(Array.isArray(e)){let r=e.map((s)=>Tp(s,t));return r.some((s,o)=>s!==e[o])?r:e}if(!V(e))return e;let n=null;for(let[r,s]of Object.entries(e)){let o=s;if(r==="$src"&&k(s)){let i=$i(s);o=i===null?s:s$(t,i)}else if(r!=="$script")o=Tp(s,t);if(o!==s)n??={...e},n[r]=o}return n===null?e:n}function Za(e,t){return Tp(e,t)}function $J(e){return xJ.test(e)&&!bJ.test(e)}function r$(e){return $i(e)==="client"||wi(e)?.side==="client"}function Jp(e,t,n){if(Array.isArray(e)){for(let[r,s]of e.entries())Jp(s,[...t,r],n);return n}if(!V(e))return n;if(k(e.$src))n.push({lazy:e.$lazy===!0,path:t,src:e.$src});for(let[r,s]of Object.entries(e))if(r!=="$script")Jp(s,[...t,r],n);return n}function wJ(e){let t=e.at(-1);return k(t)?`"${t}"`:"this entry"}function o$(e){let t=Jp(e,[],[]),n=t.some((s)=>!s.lazy&&r$(s.src)),r=[];for(let s of t){let o=wJ(s.path);if(!s.lazy&&$J(s.src))r.push({detail:'A module only this document uses can be the document\'s own script: move the code into the client script (the server script for a `timing: "server"` entry) and name it with `$src: "#client"` or `$src: "#server"`. A module several documents import stays a file, and this one keeps working as it is.',message:`${o} imports ${s.src}, which the document could carry as its own script`,path:s.path,rule:"relative-src"});else if(s.lazy&&n&&r$(s.src))r.push({detail:"A document has one client script, and another entry imports it as the page loads, so `$lazy` defers nothing here. Move this export to a `$src` module of its own to load it on its first call.",message:`${o} is $lazy, but the script it is in loads with the page`,path:s.path,rule:"lazy-shares-script"})}return r}var Ip="jx-script:",hJ="#client",gJ="#server",xJ,bJ;var Si=T(()=>{le();xJ=/^\.{1,2}\//u,bJ=/\.json$/iu});function vi(e){if(!e.startsWith("${")||!e.endsWith("}"))return!1;let[t,...n]=qg(e);return t!==void 0&&n.length===0&&t.start===0&&t.end===e.length}function a$(){return[...i$].toSorted()}function _o(e,t){let n=e.toLowerCase();if(n.startsWith("aria-")||i$.has(n))return String(t);return t?"":null}var Yr,i$,q6,Mp=32,Zl,Ql="jx-slot",Qa="data-jx-slots",Dp="jx.slot.group",W6;var Ei=T(()=>{Ya();xi();hi();le();za();$n();Xl();Np();Si();Np();Ya();Yr=new Set(["$schema","$id","$defs","state","$ref","$props","$elements","$title","$description","$switch","$prototype","$src","$export","$script","$media","$map","timing","default","description","body","parameters","arguments","name","tagName","children","style","attributes","items","map","filter","sort","cases","observedAttributes"]),i$=new Set(["contenteditable","draggable","spellcheck"]);q6=Object.freeze({emptyRow:!0}),Zl=/^[\t\n\f\r ]+$/u,W6=(()=>{let e=Symbol.for(Dp),t=globalThis;return t[e]??=new WeakMap,t[e]})()});function c$(e,t,n,r,s=EJ){let o=[],i=(d,p)=>{let m={mediaQueries:t,scope:p,transposeValue:n};if(r)m.resolveValue=(x,h)=>r(x,h,p);for(let x of mi(d,m))o.push(x.text)},a={},c={},l=[],u=[];for(let[d,p]of Object.entries(e)){if(D(p)&&!Array.isArray(p)){if(d.startsWith("@"))l.push([d,p]);else if(!d.startsWith("--"))u.push([d,p]);continue}if(ys(d)||d.startsWith("@"))continue;if(d.startsWith("--")||d==="colorScheme"||d==="color-scheme")a[d]=p;else c[d]=p}i(a,s.root),i(c,s.body);for(let[d,p]of u)if(d.startsWith("&"))i({[d]:p},s.root);else i(p,d);for(let[d,p]of l){if(Ka(d)||Xa(d)){i({[d]:p},null);continue}let m={},x={},h=[];for(let[g,b]of Object.entries(p)){if(D(b)&&!Array.isArray(b)){if(!g.startsWith("@"))h.push([g,b]);continue}if(g.startsWith("--"))m[g]=b;else x[g]=b}i({[d]:m},s.root),i({[d]:x},s.body);for(let[g,b]of h)i({[d]:b},g)}if(Object.values(t).some((d)=>Zn(d)!==null)&&!("colorScheme"in e))o.push(`${s.root} { color-scheme: light dark }`,`${s.root}:where([${Yn}="light"]) { color-scheme: light }`,`${s.root}:where([${Yn}="dark"]) { color-scheme: dark }`);return o.join(`
|
|
128
|
-
`)}var EJ;var l$=T(()=>{Ya();le();EJ={body:"body",root:":root"}});function u$(e){return e===!1||e==="open"||e==="closed"}function ko(e,t){let n=e?.$shadow;if(u$(n))return n===!1?null:n;let r=t?.shadow;return u$(r)&&r!==!1?r:null}function f$(e,t){return t===null?e:":host"}function nc(e,t){let n=[];for(let[r,s]of(e.parameters??[]).entries()){let o=d$(s);if(!o)continue;let i=p$(s)?`_a[${r}] === undefined ? ${JSON.stringify(s.default)} : _a[${r}]`:`_a[${r}]`;n.push(`${JSON.stringify(o)}: ${i}`)}return`(..._a) => { const _args = { ${n.join(", ")} }; return ${t}; }`}function d$(e){return k(e)?e:e?.name??""}function p$(e){return D(e)&&"default"in e}function jJ(e,t){let n=m$(e,t);return n===e?e:`${n} as ${e}`}function m$(e,t){let n=t?.$export;return k(n)&&n!==""?n:e}function nu(e,t,n={}){let{statePrefix:r="state",indent:s="",collect:o}=n,{url:i}=t,a=me(i),c=t.method??"GET";if(t.manual)return`${s}// ${e}: manual Request — fetch triggered by user action`;let l=[`// ${e}: auto-fetch from ${a?"(dynamic URL)":i}`,o?`${o}.push(effect(() => {`:"effect(() => {"];if(a)l.push(` const url = \`${_J(i,r)}\`;`,' if (!url || url === "undefined" || url.includes("undefined")) return;');else l.push(` const url = ${JSON.stringify(i)};`);let u=[];if(c!=="GET")u.push(`method: ${JSON.stringify(c)}`);if(t.headers)u.push(`headers: ${JSON.stringify(t.headers)}`);if(t.body){let p=D(t.body)?JSON.stringify(JSON.stringify(t.body)):JSON.stringify(t.body);u.push(`body: ${p}`)}let d=u.length>0?`, { ${u.join(", ")} }`:"";return l.push(` fetch(url${d})`," .then(r => r.ok ? r.json() : Promise.reject(r.statusText))",` .then(d => { ${r}.${e} = d; })`,` .catch(e => { ${r}.${e} = { error: String(e) }; });`,o?"}));":"});"),l.map((p)=>`${s}${p}`).join(`
|
|
129
|
-
`)}
|
|
130
|
-
`)}function
|
|
131
|
-
|
|
132
|
-
|
|
127
|
+
`);return e}function Rw(e,t,n){let{code:r,problems:s}=wI(e),[o,...i]=s.filter((a)=>a.kind==="unsupported");if(o)throw new Cu(t,[o,...i]);for(let a of s)n.push({...t,problem:a});return r}function Nm(e,t,n){if(Array.isArray(e))return e.map((i,a)=>Nm(i,{...t,pointer:`${t.pointer}/${a}`},n));if(!L(e))return e;let r=gp(e),s=[],o={set:(i,a)=>{s.push([i,a])}};for(let[i,a]of Object.entries(e)){let l={...t,pointer:`${t.pointer}/${vI(i)}`};if(r&&i==="body")o.set(i,Cw(a,l,n));else if(r&&(i==="getter"||i==="setter")&&L(a)){let c={...a};if(a.body!==void 0)c.body=Cw(a.body,{...l,pointer:`${l.pointer}/body`},n);o.set(i,c)}else o.set(i,Nm(a,l,n))}return Object.fromEntries(s)}function il(e,t,n=[]){return Nm(e,{path:t,pointer:""},n)}function Iw(e,t,n=[]){return il(e,t,n)}var bI,Am,Au=null,Rm=null,Aw,Cu;var Tm=J(()=>{ce();bI=/(^|[\n;{}])(\s*)(import|export)(?=[\s{*"'])/gu;Am=new Map;Aw=new Map;Cu=class Cu extends Error{problems;site;constructor(e,t){let[n]=t;super(`${e.path}${e.pointer}: ${n.message} (line ${n.line}, column ${n.column})`);this.name="EraseError",this.problems=t,this.site=e}}});import{createRequire as EI}from"node:module";var Ru=J(()=>{Tm();Tm();Tw(()=>EI(import.meta.url)("ts-blank-space").default)});function Lw(e){for(let{path:t,pointer:n,problem:r}of e){let s=`${t}${n} (line ${r.line}, column ${r.column}): ${r.message}`;if(!Dw.has(s))Dw.add(s),console.warn(`Warning: ${s}`)}}function Ar(e,t){let n=[],r=il(e,t,n);return Lw(n),r}function Fw(e,t){let n=[],r=Iw(e,t,n);return Lw(n),r}var Dw;var Ei=J(()=>{Ru();Dw=new Set});function PI(e){return e.split("\\").join("/").replace(/^\.\//,"").replace(/^\//,"").replace(/^pages\//,"")}function Vw(e){let t=PI(e),n=t.slice(t.lastIndexOf("/")+1),r=n.lastIndexOf(".");if(r>0)t=t.slice(0,t.length-(n.length-r));if(t.endsWith("/index"))t=t.slice(0,-6)||"/";else if(t==="index")t="/";if(!t.startsWith("/"))t=`/${t}`;let s=[],o=!1,i=!1,a=t.replaceAll(jI,(l,c,u)=>{if(o=!0,c)return i=!0,s.push(c),"*";return s.push(u),`:${u}`});return{isCatchAll:i,isDynamic:o,params:s,urlPattern:a}}function qw(e,t){if(e.isDynamic!==t.isDynamic)return e.isDynamic?1:-1;if(e.isCatchAll!==t.isCatchAll)return e.isCatchAll?1:-1;return e.urlPattern.localeCompare(t.urlPattern)}var jI;var Hw=J(()=>{jI=/\[\.\.\.(\w+)\]|\[(\w+)\]/g});function kI(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function Ww(e){if(!L(e)||!("paginate"in e))return null;let{each:t,pageSize:n,paginate:r}=e,s=L(r)?r.$ref:void 0,o=k(s)?_I.exec(s)?.[1]:void 0;if(o===void 0)throw TypeError('$paths.paginate must be { "$ref": "#/state/<key>" }');if(!Ie(n)||!Number.isInteger(n)||n<1)throw TypeError("$paths.pageSize must be a positive integer");let i={key:kI(o),pageSize:n};if(t!==void 0){if(!L(t)&&!Array.isArray(t))throw TypeError("$paths.each must be a $paths source");if(L(t)&&"paginate"in t)throw TypeError("$paths.each cannot itself be paged");i.each=t}return i}function Jm(e,t){return Math.max(1,Math.ceil(e/t))}function Bw(e,t,n){let r=(t-1)*n;return e.slice(r,r+n)}function To(e,t){if(e.endsWith("*")){if(t===1){let n=e.slice(0,-1).replace(/\/$/,"");return n===""?"/":n}return`${e.slice(0,-1)}${t}`}return e.replace(/:[^/]+/,String(t))}function Uw(e,t,n,r){let s=Jm(r,n),o=[];for(let i=1;i<=s;i++)o.push({current:i===t,number:i,url:To(e,i)});return{first:To(e,1),itemCount:r,last:To(e,s),next:t<s?To(e,t+1):null,number:t,pageCount:s,pageSize:n,pages:o,prev:t>1?To(e,t-1):null}}var _I;var zw=J(()=>{ce();_I=/^#\/state\/([^/]+)$/});function Bn(e){if(!k(e)||e.trim()==="")return null;try{return new Intl.Locale(e.trim()).toString()}catch{return null}}function al(e){let t=Bn(e);if(t===null)return"ltr";let n=new Intl.Locale(t),r=n.script??n.maximize().script;return r!==void 0&&OI.has(r)?"rtl":"ltr"}function Kw(e){let t=Bn(e);if(t===null)return k(e)?e:"";return new Intl.DisplayNames([t],{type:"language"}).of(t)??t}function Mm(e){let t=e.i18n,n=[];if(!D(t))return{errors:n,i18n:null};let r=Array.isArray(t.locales)?t.locales:[],s=[];for(let a of r){let l=Bn(a);if(l===null){n.push(`i18n.locales: "${String(a)}" is not a well-formed BCP 47 language tag.`);continue}if(!s.includes(l))s.push(l)}let o=Bn(t.defaultLocale)??s[0]??null;if(t.defaultLocale!==void 0&&Bn(t.defaultLocale)===null)n.push(`i18n.defaultLocale: "${String(t.defaultLocale)}" is not a well-formed BCP 47 language tag.`);if(o===null)return n.push("i18n is declared with no usable locale — set `defaultLocale` or `locales`."),{errors:n,i18n:null};if(!s.includes(o))s.unshift(o);let i=t.routing==="prefix-always"||t.routing==="prefix-except-default"?t.routing:AI;return{errors:n,i18n:{defaultLocale:o,locales:s,routing:i}}}function cr(e,t){if(t===null)return null;let n=e.split("/").find(Boolean);if(n===void 0)return t.defaultLocale;let r=Bn(n);return r!==null&&t.locales.includes(r)?r:t.defaultLocale}var OI,Nu="^[A-Za-z]{2,8}(-[A-Za-z0-9]{1,8})*$",AI="prefix-except-default";var Jo=J(()=>{ce();OI=new Set(["Adlm","Arab","Aran","Armi","Avst","Cprt","Egyd","Egyh","Elym","Gara","Hatr","Hebr","Hluw","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogd","Sogo","Syrc","Thaa","Todr","Yezi"])});function hn(e){return e.replaceAll(/[A-Z]/g,(t)=>`-${t.toLowerCase()}`)}function Xw(e,t){if(e.startsWith("@--"))return t[e.slice(1)]??e.slice(1);if(e.startsWith("@(")){let n=e.slice(2,-1).trim();return CI.has(n.toLowerCase())?n:e.slice(1)}return null}function ll(e){return e.startsWith("@position-try")||e.startsWith("@property")||e.startsWith("@font-face")||e.startsWith("@counter-style")}function cl(e){return e.startsWith("@keyframes")}function Yw(e,t){let n=[];for(let r of ji(e))for(let s of ji(t))n.push(Im(r,s));return n.join(", ")}function Im(e,t){let n=NI(e,t);if(n!==null)return n;let r=rv(t,e);if(r!==null)return r;if(t.startsWith("[")||t.startsWith(":")||t.startsWith("."))return`${e}${t}`;return`${e} ${t}`}function Zw(e,t){let n=0,r=null;for(let s=t;s<e.length;s+=1){let o=e[s];if(o==="\\")s+=1;else if(r)r=o===r?null:r;else if(o==='"'||o==="'")r=o;else if(o==="(")n+=1;else if(o===")"){if(n-=1,n===0)return s+1}}return-1}function Qw(e){if(e.endsWith(":host"))return{inner:"",prefix:e.slice(0,-5)};let t=e.lastIndexOf(":host(");if(t===-1||Zw(e,t+5)!==e.length)return null;return{inner:e.slice(t+6,-1),prefix:e.slice(0,t)}}function ev(e){if(!e.startsWith(":host"))return null;let t=e.slice(5);if(t.startsWith("(")){let n=Zw(t,0);return n===-1?null:{inner:t.slice(1,n-1),rest:t.slice(n)}}return/^[\w-]/u.test(t)?null:{inner:null,rest:t}}function tv(e){let t=0,n=null;for(let r=0;r<e.length;r+=1){let s=e[r];if(s==="\\")r+=1;else if(n)n=s===n?null:n;else if(s==='"'||s==="'")n=s;else if(s==="("||s==="[")t+=1;else if(s===")"||s==="]")t-=1;else if(t===0){if(/[\s>+~]/u.test(s)||e.startsWith("::",r))return r;if(s===":"&&RI.test(e.slice(r)))return r}}return e.length}function NI(e,t){let n=Qw(e);if(n===null||!Fm(t))return null;let r=Ju(t);if(r.length>1||r.length===1&&r[0]!==0)return null;let s=r.length===1?t.slice(1):t,o=tv(s);if(o===0)return`${e}${s}`;return`${n.prefix}:host(${n.inner}${s.slice(0,o)})${s.slice(o)}`}function JI(e,t,n){let r=ev(e);if(r===null)return n==="shadow"&&TI.test(e)?e:Im(t,e);let{inner:s,rest:o}=r;if(n==="light")return`${t}${s??""}${o}`;let a=`${Qw(t)?.prefix??""}:host${s===null?"":`(${s})`}`;if(o==="")return a;return/^[\s>+~]/u.test(o)?`${a}${o}`:Im(a,o)}function nv(e,t,n){let r=[];for(let s of ji(t))for(let o of ji(e))r.push(JI(o,s,n));return r.join(", ")}function MI(e){return ji(e).every((t)=>{let n=ev(t);if(n===null)return Fm(t);let r=tv(n.rest);return n.rest.slice(r).replace(/^::?[\w-]+(?:\([^)]*\))?/u,"")===""})}function Ju(e){let t=[],n=null,r=0;for(let s=0;s<e.length;s+=1){let o=e[s];if(n){if(o==="\\")s+=1;else if(o===n)n=null;continue}if(o==="\\")s+=1;else if(o==='"'||o==="'")n=o;else if(o==="[")r+=1;else if(o==="]")r=Math.max(0,r-1);else if(o==="&"&&r===0)t.push(s)}return t}function rv(e,t){return Ju(e).length>0?II(e,t):null}function II(e,t){let n="",r=0;for(let s of Ju(e))n+=e.slice(r,s)+t,r=s+1;return n+e.slice(r)}function ji(e){let t=[],n=0,r=null,s=0;for(let i=0;i<e.length;i+=1){let a=e[i];if(r){if(a==="\\")i+=1;else if(a===r)r=null;continue}if(a==='"'||a==="'")r=a;else if(a==="("||a==="[")n+=1;else if(a===")"||a==="]")n=Math.max(0,n-1);else if(a===","&&n===0)t.push(e.slice(s,i)),s=i+1}t.push(e.slice(s));let o=t.flatMap((i)=>{let a=i.trim();return a===""?[]:[a]});return o.length>0?o:[e]}function fr(e){let t=/^\(\s*prefers-color-scheme\s*:\s*(light|dark)\s*\)$/.exec(e.trim())?.[1];return t==="light"||t==="dark"?t:null}function Dm(e,t){if(e===":root"||e==="html")return{auto:`${e}:where(:not([${ur}]))`,forced:`${e}:where([${ur}="${t}"])`};return{auto:`:where(:root:not([${ur}])) ${e}`,forced:`:where(:root[${ur}="${t}"]) ${e}`}}function ul(e){return e.startsWith(":")||e.startsWith(".")||e.startsWith("&")||e.startsWith("[")}function Lm(e){return e.startsWith("--")?e:hn(e)}function Tu(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function sv(e,t,n){let r=n.map(([o,i])=>`${o}: ${i}`).join("; "),s=t===null?r:`${t} { ${r} }`;for(let o=e.length-1;o>=0;o-=1)s=`${e[o]} { ${s} }`;return s}function fl(e){if(e.description===void 0)return e.text;return`/* ${e.description.replaceAll("*/","* /")} */
|
|
128
|
+
${e.text}`}function DI(e,t,n){let r=n.map(({selector:o,declarations:i})=>`${o} { ${i.map(([a,l])=>`${a}: ${l}`).join("; ")} }`).join(" "),s=`@keyframes ${t} { ${r} }`;for(let o=e.length-1;o>=0;o-=1)s=`${e[o]} { ${s} }`;return s}function LI(e){let t=Object.keys(e).filter((r)=>cl(r));if(t.length===0)return e;let n={...e};for(let r of t)delete n[r];return n}function Fm(e){let n=Ju(e).at(-1),r=n===void 0?e:e.slice(n+1);return r===""||r.startsWith(":")||r.startsWith(".")||r.startsWith("[")}function Pi(e,t={}){let{scope:n=null,mediaQueries:r={},transposeValue:s=(w)=>w,transposeSelector:o=(w)=>w,resolveValue:i,host:a,shadowTree:l=!1}=t,c=[],u=(w)=>w!==null&&typeof w==="object"&&!Array.isArray(w)&&!me(w),d=(w,E)=>{if(u(E))return[E];if(!ll(w)||!Array.isArray(E)||E.length===0)return[];return E.every((j)=>u(j))?E:[]},p=(w,E,j,A)=>{if(E===void 0||E===null)return null;if(me(E))return j?i?.(w,E,A)??null:null;if(D(E))return null;let T=String(E);if(le(T))return j?i?.(w,T,A)??null:null;return s(T)},m=(w,E,j=!0,A="self")=>{let T=[];for(let[I,V]of Object.entries(w)){if(d(I,V).length>0)continue;if(E&&(I.startsWith("@")||ul(I)))continue;if(I.startsWith("$"))continue;let H=p(I,V,j,A);if(H!==null)T.push([Lm(I),H])}return T},y=(w)=>k(w)&&w!==""?{description:w}:{},S=(w,E,j,A,T)=>{if(j.length===0)return;let I=E;if(I!==null){let O=o(I);if(O===null)return;I=O}let V=sv(w,I,j),H={text:V,conditions:[...w],selector:I,declarations:j,target:A,key:Tu(V)};c.push({...H,...y(T)})},g=(w,E,j)=>{let A=w.slice(10).trim();if(A==="")return;let T=[];for(let[V,H]of Object.entries(E)){if(!u(H))continue;let O=m(H,!0,!1,"unscoped");if(O.length>0)T.push({declarations:O,selector:V.trim()})}if(T.length===0)return;let I=DI(j,A,T);c.push({blocks:T,conditions:[...j],declarations:[],key:Tu(I),selector:null,target:"unscoped",text:I,...y(E.$description)})},x=(w,E,j,A,T,I)=>{if(w==="@--")return;if(ll(w)){S([...A,w],null,m(E,!1,!0,"unscoped"),"unscoped",E.$description);return}if(cl(w)){g(w,E,A);return}let V=Xw(w,r),H=V===null?w:`@media ${V}`,O=V===null?null:fr(V);if(O!==null&&j!==null&&!l){let{auto:N,forced:G}=Dm(j,O);P(E,N,[...A,H],T,I),P(LI(E),G,A,T,I);return}P(E,j,[...A,H],T,I)};function P(w,E,j,A,T){S(j,E,m(w,!0,!0,A),A,w.$description);for(let[I,V]of Object.entries(w))for(let H of d(I,V))if(I.startsWith("@"))x(I,H,E,j,A,T);else if(E!==null&&T&&a!==void 0)P(H,nv(I,E,a),j,MI(I)?A:"descendant",!1);else if(E!==null)P(H,Yw(E,I),j,Fm(I)?A:"descendant",!1)}return P(e,n,[],"self",!0),c}function Gw(e){return e===!1||e==="open"||e==="closed"}function Rn(e,t){let n=e?.$shadow;if(Gw(n))return n===!1?null:n;let r=t?.shadow;return Gw(r)&&r!==!1?r:null}var CI,RI,TI,ur="data-color-scheme",Mu="jx-color-scheme";var dl=J(()=>{ce();CI=new Set(["all","print","screen","speech"]);RI=/^:(?:before|after|first-line|first-letter)(?![\w-])/u;TI=/^::(?:slotted|part)\(/u});function av(){return`the Intl helpers ${qm.join(", ")}`}var Cr="en-US",Vm="UTC",ov,qm,iv;var Hm=J(()=>{ov=[{api:"Intl.NumberFormat",params:["value","locale","options"],path:"Intl/formatNumber",summary:"Format a number for a locale — grouping, decimals, currency, percent, units."},{api:"Intl.DateTimeFormat",params:["value","locale","options"],path:"Intl/formatDate",summary:"Format a date or timestamp for a locale. Pass `timeZone` in options."},{api:"Intl.RelativeTimeFormat",params:["value","unit","locale","options"],path:"Intl/formatRelativeTime",summary:'Format a relative time — `-3, "day"` becomes "3 days ago".'},{api:"Intl.ListFormat",params:["values","locale","options"],path:"Intl/formatList",summary:'Join a list the way a locale does — "a, b, and c", not a hand-written comma join.'},{api:"Intl.PluralRules",params:["value","locale","options"],path:"Intl/plural",summary:'Which plural category a number falls in ("one", "few", "other") — many languages have '+"more than two, so a ternary on `n === 1` is wrong outside English."},{api:"Intl.Collator",params:["a","b","locale","options"],path:"Intl/compare",summary:'Compare two strings for sorting. `<` and `sort()` order by UTF-16 code unit, which puts "Zebra" before "apple" and sorts every accented word into the wrong place.'},{api:"Intl.DisplayNames",params:["code","type","locale","options"],path:"Intl/displayName",summary:'The name of a language, region, script or currency in a locale — "de" as "German" or '+'"Deutsch", from CLDR rather than a hand-kept table.'},{api:"Intl.Segmenter",params:["value","granularity","locale"],path:"Intl/segment",summary:"Split text into graphemes, words or sentences (UAX #29). `[...str]` splits code points, so it cuts an emoji with a skin-tone modifier in half."}],qm=ov.map((e)=>e.path),iv=Object.fromEntries(ov.map((e)=>[e.path,e.params.indexOf("locale")]))});function FI(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function Wt(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function sn(e){return e.startsWith("#/$map/")?e.slice(2):e}function Un(e){if(e==="")return[];return e.split("/").map((t)=>FI(t))}function Bt(e,t){let n=e;for(let r of Un(t))n=n?.[r];return n}function Re(e,t){let n=e;for(let r of Un(t))n+=Wm.test(r)?`.${r}`:`[${JSON.stringify(r)}]`;return n}function lv(e,t){let n=e;for(let[r,s]of Un(t).entries()){let o=r===0?"":"?.";n+=Wm.test(s)?`${r===0?".":o}${s}`:`${o}[${JSON.stringify(s)}]`}return n}function us(e){return Wm.test(e)?e:JSON.stringify(e)}function cv(e){let t=e.replaceAll(/[^A-Za-z0-9_$]/g,"_");if(t==="")return"ref";return/^\d/.test(t)?`_${t}`:t}var Wm;var _i=J(()=>{Wm=/^[A-Za-z_$][A-Za-z0-9_$]*$/});function Bm(e){let t=e.$map;return D(t)?t:void 0}function Lu(e){return D(e)&&!Array.isArray(e)&&"operator"in e}function ki(e){return D(e)&&!Array.isArray(e)&&"$ref"in e}function WI(e,t,n){let r=iv[e];if(r===void 0||r<0||t[r]!=null)return t;let s=Bt(n.$page,"locale");if(!k(s)||s==="")return t;let o=[...t];return o[r]=s,o}function gv(){return globalThis.window??globalThis}function yv(e){return e.startsWith("window#/")&&qI.has(e.slice(8))}function dr(e){return pv.has(e)}function Iu(e){if(Array.isArray(e))return e.some((t)=>Iu(t));if(e===void 0||!Lu(e))return!1;return dr(e.operator)||[e.target,e.value,e.initial,e.default].some((t)=>Iu(t))||Object.values(e.cases??{}).some((t)=>Iu(t))}function Mo(e){return wr(e)&&!Iu(e.$expression)}function Um(e,t){if(Array.isArray(e)){for(let n of e)Um(n,t);return}if(e===void 0||!D(e))return;if(ki(e)){if(!BI.test(e.$ref)){let n=e.$ref.replace(/^(?:#\/state\/|parent#\/)/,"");t.add(Un(n)[0]??"")}return}if(Lu(e)){let n=[e.target,e.value,e.initial,e.default];for(let r of[...n,...Object.values(e.cases??{})])Um(r,t)}}function Zm(e){let t=new Set;return Um(e.$expression,t),[...t]}function Qm(e){let t=new Map;for(let[r,s]of Object.entries(e??{}))if(!r.startsWith("$")&&Mo(s))t.set(r,s);let n=!1;while(!n){n=!0;for(let[r,s]of t)if(Zm(s).some((o)=>!t.has(o)))t.delete(r),n=!1}return Object.fromEntries(t)}function it(e,t){if(!e)return;let n=(e.depth??0)+1;if(n>UI)return;return{depth:n,path:[...e.path??[],...Array.isArray(t)?t:[t]],report:e.report}}function rt(e,t,n,r,s){if(e===null||e===void 0)return e;if(Lu(e))return Nn(e,t,n,r,s);if(ki(e)){let o=Du(e.$ref,t,n,r);return s?.report(s.path??[],o),o}if(Array.isArray(e))return xv(e,t,n,r,s);return s?.report(s.path??[],e),e}function xv(e,t,n,r,s){return e.map((o,i)=>rt(o,t,n,r,it(s,i)))}function zI(e,t,n,r){let s=sn(e),o=(i)=>{if(!s.slice(i.length).includes("/"))return t;return Du(s.slice(0,s.lastIndexOf("/")),t,n,r)};if(s.startsWith("#/state/"))return o("#/state/");if(s.startsWith("parent#/"))return o("parent#/");if(s.startsWith("$map/")||s.startsWith("$args/"))return s.split("/").length>2?Du(s.slice(0,s.lastIndexOf("/")),t,n,r):void 0;return}function Du(e,t,n,r){let s=sn(e);if(s==="$reduce/acc")return r?.acc;if(s.startsWith("$reduce/"))return r?.acc;if(s.startsWith("$args/")){let o=s.slice(6).split("/"),i=r?.args?.[o[0]];return o.length>1?Bt(i,o.slice(1).join("/")):i}if(s.startsWith("event#/")){let o=s.slice(7);return Bt(n,o)}if(s.startsWith("$map/")){let o=s.split("/"),[,i]=o,a,l=Bm(t);if(i==="item")a=r?.item??l?.item??t["$map/item"];else if(i==="index")a=r?.index??l?.index??t["$map/index"];else a=l?.[i]??t[`$map/${i}`];return o.length>2?Bt(a,o.slice(2).join("/")):a}if(s.startsWith("#/state/"))return Bt(t,s.slice(8));if(s.startsWith("parent#/"))return Bt(t,s.slice(8));if(s.startsWith("window#/"))return Bt(gv(),s.slice(8));if(s.startsWith("document#/"))return Bt(globalThis.document,s.slice(10));return Bt(t,s)??null}function KI(e,t,n,r){let s=sn(e);if(s.startsWith("$map/")){let o=s.split("/"),[,i]=o,a,l=Bm(t);if(i==="item")a=r?.item??l?.item??t["$map/item"];else if(i==="index")a=r?.index??l?.index??t["$map/index"];else a=l?.[i]??t[`$map/${i}`];if(o.length>2){let c=o.slice(2),u=c.pop(),d=c.length>0?Bt(a,c.join("/")):a;return{key:u,obj:d}}return{key:i==="item"?"$map/item":"$map/index",obj:Bm(t)??t}}if(s.startsWith("#/state/")){let o=s.slice(8);if(o.indexOf("/")===-1)return{key:o,obj:t};let a=Un(o),l=a.pop(),c=t;for(let u of a)c=c[u];return{key:l,obj:c}}return{key:s,obj:t}}function Nn(e,t,n,r,s){let o=GI(e,t,n,r,s);return s?.report(s.path??[],o),o}function fv(e,t,n){switch(e){case"+":return t+n;case"-":return t-n;case"*":return t*n;case"/":return t/n;case"%":return t%n;case"<":return t<n;case"<=":return t<=n;case">":return t>n;default:return t>=n}}function GI(e,t,n,r,s){let{operator:o,target:i,value:a,initial:l}=e;if(!VI.has(o))throw Error(`$expression: unknown operator "${o}"`);if(zm.has(o)&&!("value"in e)){let c=rt(i,t,n,r,it(s,"target"));if(o==="!")return!c;if(o==="-")return-c}if(o==="call"){let c=ki(i)?i.$ref:void 0;if(!k(c))throw TypeError("$expression: call target must be a $ref pointer");let u=(r?.callDepth??0)+1;if(u>uv)throw Error(`$expression: call depth exceeded (${uv})`);let d=Array.isArray(a)?a.map((m,y)=>rt(m,t,n,r,it(s,["value",y]))):[];if(c.startsWith("window#/")){if(!yv(c))throw Error(`$expression: "${c}" is not a blessed pure global`);let m=c.slice(8),y=HI.get(m);if(y)return y(...WI(m,d,t));let S=gv(),g=Bt(S,m),x=m.lastIndexOf("/"),P=x===-1?S:Bt(S,m.slice(0,x));return g.apply(P,d)}let p=Du(c,t,n,r);if(_t(p))return p.apply(zI(c,t,n,r),d);if(D(p)&&"$expression"in p){let m=p,y={};for(let[S,g]of(m.parameters??[]).entries()){let x=k(g)?g:g?.name??"";if(!x)continue;y[x]=d[S]===void 0&&D(g)&&"default"in g?g.default:d[S]}return Nn(m.$expression,t,n,{args:y,callDepth:u})}throw TypeError(`$expression: call target "${c}" is not callable`)}if(Xm.has(o)){if(o==="?:"){let m=rt(i,t,n,r,it(s,"target"));if(s){let y=rt(a,t,n,r,it(s,"value")),S=rt(l,t,n,r,it(s,"initial"));return m?y:S}return m?rt(a,t,n,r):rt(l,t,n,r)}let c=rt(i,t,n,r,it(s,"target")),u=String(c),d=e.cases??{},p=Object.hasOwn(d,u);if(s){let m;for(let[S,g]of Object.entries(d)){let x=rt(g,t,n,r,it(s,["cases",S]));if(S===u)m=x}let y=rt(e.default,t,n,r,it(s,"default"));return p?m:y}return p?rt(d[u],t,n,r):rt(e.default,t,n,r)}if(Km.has(o)){let c=rt(i,t,n,r,it(s,"target")),u=rt(a,t,n,r,it(s,"value"));switch(o){case"===":return c===u;case"!==":return c!==u;case"&&":return c&&u;case"||":return c||u;case"??":return c??u;default:return fv(o,c,u)}}if(mv.has(o)){let c=rt(a,t,n,r,it(s,"value")),{obj:u,key:d}=KI(i.$ref,t,n,r);u[d]=o==="="?c:fv(o.slice(0,-1),u[d],c);return}if(hv.has(o)){let c=rt(i,t,n,r,it(s,"target"));switch(o){case"push":return c.push(rt(a,t,n,r,it(s,"value")));case"unshift":return c.unshift(rt(a,t,n,r,it(s,"value")));case"pop":return c.pop();case"shift":return c.shift();case"splice":{let u=rt(a,t,n,r,it(s,"value"));return c.splice(...u)}default:break}}if(Ym.has(o)){let c=rt(i,t,n,r,it(s,"target")),u=a===void 0?[]:Array.isArray(a)?xv(a,t,n,r,it(s,"value")):[rt(a,t,n,r,it(s,"value"))],d=Bt(c,o);if(!_t(d))return;return d.apply(c,u)}if(Gm.has(o)){let c=rt(i,t,n,r,it(s,"target")),u=a;if(o==="reduce"){let d=rt(l,t,n,r,it(s,"initial"));for(let[p,m]of c.entries())d=Nn(u,t,n,{acc:d,index:p,item:m},p===0?it(s,"value"):void 0);return d}if(o==="map")return c.map((d,p)=>Nn(u,t,n,{...r,index:p,item:d},p===0?it(s,"value"):void 0));if(o==="filter")return c.filter((d,p)=>Nn(u,t,n,{...r,index:p,item:d},p===0?it(s,"value"):void 0))}return}function dt(e,t){if(e===null)return"null";if(e===void 0)return"undefined";if(Lu(e))return gn(e,t);if(ki(e))return eh(e.$ref,t);if(Array.isArray(e))return e.map((n)=>dt(n,t)).join(", ");return JSON.stringify(e)}function XI(e){return`_fx_${e.replaceAll(/[^A-Za-z0-9_$]/g,"_")}`}function eh(e,t){let n=sn(e),r=t.statePrefix??"state",s=t.eventParam??"event";if(n==="$reduce/acc")return"_acc";if(n.startsWith("$reduce/"))return"_acc";if(n.startsWith("$args/"))return Re("_args",n.slice(6));if(n.startsWith("event#/"))return Re(s,n.slice(7));if(n.startsWith("$map/")){let o=n.split("/"),[,i]=o;if(i==="item")return o.length>2?Re("_item",o.slice(2).join("/")):"_item";if(i==="index")return"_index";return`_${i}`}if(n.startsWith("#/state/"))return Re(r,n.slice(8));if(n.startsWith("parent#/"))return Re(r,n.slice(8));if(n.startsWith("window#/"))return Re("window",n.slice(8));if(n.startsWith("document#/"))return Re("document",n.slice(10));return Re(r,n)}function dv(e,t){if(ki(e))return eh(e.$ref,t);return dt(e,t)}function YI(e,t,n){let r=(i)=>t[i]??"undefined",s=`(${n.statePrefix??"state"}?.$page?.locale ?? ${JSON.stringify(Cr)})`,o=JSON.stringify(Vm);switch(e){case"Intl/formatNumber":return`new Intl.NumberFormat(${r(1)} ?? ${s}, ${r(2)}).format(${r(0)})`;case"Intl/formatDate":return`new Intl.DateTimeFormat(${r(1)} ?? ${s}, {timeZone: ${o}, ...${r(2)}}).format(new Date(${r(0)}))`;case"Intl/formatRelativeTime":return`new Intl.RelativeTimeFormat(${r(2)} ?? ${s}, ${r(3)}).format(${r(0)}, ${r(1)})`;case"Intl/formatList":return`new Intl.ListFormat(${r(1)} ?? ${s}, ${r(2)}).format(${r(0)})`;case"Intl/plural":return`new Intl.PluralRules(${r(1)} ?? ${s}, ${r(2)}).select(${r(0)})`;case"Intl/compare":return`new Intl.Collator(${r(2)} ?? ${s}, ${r(3)}).compare(${r(0)}, ${r(1)})`;case"Intl/displayName":return`new Intl.DisplayNames(${r(2)} ?? ${s}, {...${r(3)}, type: ${r(1)} ?? 'language'}).of(${r(0)})`;case"Intl/segment":return`[...new Intl.Segmenter(${r(2)} ?? ${s}, {granularity: ${r(1)} ?? 'grapheme'}).segment(${r(0)})].map((p) => p.segment)`;default:return null}}function gn(e,t={}){let{operator:n,target:r,value:s,initial:o}=e;if(zm.has(n)&&!("value"in e)){let i=dt(r,t);if(n==="!")return`!(${i})`;if(n==="-")return`-(${i})`}if(n==="call"){let i=(ki(r)?r.$ref:void 0)??"",a=Array.isArray(s)?s.map((l)=>dt(l,t)):[];if(i.startsWith("window#/")){if(!yv(i))throw Error(`$expression: "${i}" is not a blessed pure global`);let l=YI(i.slice(8),a,t);if(l)return l;return`window.${i.slice(8).replaceAll("/",".")}(${a.join(", ")})`}if(i.startsWith("#/state/")){let l=i.slice(8),c=t.formulaParams?.[l];if(c){let u=c.map((d,p)=>`${JSON.stringify(d)}: ${a[p]??"undefined"}`).join(", ");return`${XI(l)}(${t.statePrefix??"state"}, { ${u} })`}}return`${eh(i,t)}(${a.join(", ")})`}if(Xm.has(n)){if(n==="?:"){let c=dt(r,t),u=dt(s,t),d=dt(o,t);return`(${c} ? ${u} : ${d})`}let i=dt(r,t),a=Object.entries(e.cases??{}).map(([c,u])=>`_d === ${JSON.stringify(c)} ? ${dt(u,t)} : `).join(""),l="default"in e?dt(e.default,t):"undefined";return`((_d) => ${a}${l})(String(${i}))`}if(Km.has(n)){let i=dt(r,t),a=dt(s,t);return`(${i} ${n} ${a})`}if(mv.has(n)){let i=dv(r,t),a=dt(s,t);return`${i} ${n} ${a}`}if(hv.has(n)){let i=dv(r,t);switch(n){case"push":return`${i}.push(${dt(s,t)})`;case"unshift":return`${i}.unshift(${dt(s,t)})`;case"pop":return`${i}.pop()`;case"shift":return`${i}.shift()`;case"splice":{let a=Array.isArray(s)?s.map((l)=>dt(l,t)).join(", "):dt(s,t);return`${i}.splice(${a})`}default:break}}if(Ym.has(n)){let i=dt(r,t),a=s===void 0?"":Array.isArray(s)?s.map((l)=>dt(l,t)).join(", "):dt(s,t);return`(${i})?.${n}?.(${a})`}if(Gm.has(n)){let i=dt(r,t),a=gn(s,t);if(n==="reduce"){let l=dt(o,t);return`${i}.reduce((_acc, _item, _index) => ${a}, ${l})`}if(n==="map")return`${i}.map((_item, _index) => ${a})`;if(n==="filter")return`${i}.filter((_item, _index) => ${a})`}return"undefined"}function Oi(e,t,n,r){return rt(e,t,n,r)}function fs(e,t={}){return dt(e,t)}var pv,zm,Km,mv,hv,Gm,Xm,Ym,VI,qI,HI,BI,uv=64,UI=64;var Ai=J(()=>{Hm();ce();_i();pv=new Set(["=","+=","-=","*=","/=","push","pop","shift","unshift","splice"]),zm=new Set(["!","-"]),Km=new Set(["+","-","*","/","%","===","!==","<","<=",">",">=","&&","||","??"]),mv=new Set(["=","+=","-=","*=","/="]),hv=new Set(["push","pop","shift","unshift","splice"]),Gm=new Set(["reduce","map","filter"]),Xm=new Set(["?:","switch"]),Ym=new Set(["includes","indexOf","lastIndexOf","join","slice","concat","at","flat","toSorted","toReversed","toSpliced","with","toUpperCase","toLowerCase","trim","trimStart","trimEnd","split","startsWith","endsWith","padStart","padEnd","replaceAll","repeat","charAt","normalize","toLocaleUpperCase","toLocaleLowerCase","toFixed","toPrecision","toLocaleString"]),VI=new Set([...pv,...zm,...Km,...Gm,...Xm,...Ym,"call"]),qI=new Set(["isNaN","isFinite","parseFloat","parseInt","encodeURIComponent","decodeURIComponent","structuredClone","Math/abs","Math/ceil","Math/floor","Math/round","Math/trunc","Math/sign","Math/sqrt","Math/cbrt","Math/pow","Math/exp","Math/log","Math/log2","Math/log10","Math/min","Math/max","Math/hypot","Number/isInteger","Number/isFinite","Number/isNaN","Number/parseFloat","Number/parseInt","JSON/parse","JSON/stringify","Object/keys","Object/values","Object/entries","Object/fromEntries","Array/from","Array/isArray","Array/of","String/fromCharCode","String/fromCodePoint",...qm]),HI=new Map([["Intl/compare",(e,t,n,r)=>new Intl.Collator(n??Cr,r).compare(e,t)],["Intl/displayName",(e,t,n,r)=>new Intl.DisplayNames(n??Cr,{...r,type:t??"language"}).of(e)],["Intl/formatDate",(e,t,n)=>new Intl.DateTimeFormat(t??Cr,{timeZone:Vm,...n}).format(new Date(e))],["Intl/formatList",(e,t,n)=>new Intl.ListFormat(t??Cr,n).format(e)],["Intl/formatNumber",(e,t,n)=>new Intl.NumberFormat(t??Cr,n).format(e)],["Intl/formatRelativeTime",(e,t,n,r)=>new Intl.RelativeTimeFormat(n??Cr,r).format(e,t)],["Intl/plural",(e,t,n)=>new Intl.PluralRules(t??Cr,n).select(e)],["Intl/segment",(e,t,n)=>[...new Intl.Segmenter(n??Cr,{granularity:t??"grapheme"}).segment(e)].map((r)=>r.segment)]]);BI=/^(?:\$args\/|\$reduce\/|\$map\/|window#\/|document#\/|event#\/)/});function bv(e){if("operator"in e)return{kind:"expression",node:e};if("if"in e)return{kind:"if",node:e};if("$switch"in e)return{kind:"switch",node:e};if("stopPropagation"in e)return{kind:"stopPropagation"};if("preventDefault"in e)return{kind:"preventDefault"};return{kind:"dispatch",node:e}}function ZI(e){return(D(e)||_t(e))&&"then"in e&&_t(e.then)}async function Ci(e,t,n,r={}){let s=r.args?{args:r.args}:void 0;for(let o of e){let i=bv(o);switch(i.kind){case"expression":{let a=Nn(i.node,t,n,s);if(ZI(a))await a;break}case"if":{let a=i.node,l=Oi(a.if,t,n,s)?a.then:a.else;if(Array.isArray(l))await Ci(l,t,n,r);break}case"switch":{let a=i.node,l=String(Oi(a.$switch,t,n,s)),c=a.cases??{},u=Object.hasOwn(c,l)?c[l]:a.default;if(Array.isArray(u))await Ci(u,t,n,r);break}case"dispatch":{let a=i.node,l=_t(r.target)?r.target():r.target,c=n?.currentTarget??l;if(!c)break;let u={};if("detail"in a)u.detail=Oi(a.detail,t,n,s);if(a.bubbles!==void 0)u.bubbles=a.bubbles;if(a.composed!==void 0)u.composed=a.composed;c.dispatchEvent(new CustomEvent(a.dispatchEvent,u));break}case"stopPropagation":{n?.stopPropagation();break}case"preventDefault":{n?.preventDefault();break}default:break}}}function zn(e,t={}){let n=t.indent??"",r=[];for(let s of e){let o=bv(s);switch(o.kind){case"expression":{r.push(`${n}${gn(o.node,t)};`);break}case"if":{let i=o.node,a=fs(i.if,t),l={...t,indent:`${n} `};if(r.push(`${n}if (${a}) {`,zn(i.then??[],l)),i.else)r.push(`${n}} else {`,zn(i.else,l));r.push(`${n}}`);break}case"switch":{let i=o.node,a=fs(i.$switch,t),l={...t,indent:`${n} `};r.push(`${n}switch (String(${a})) {`);for(let[c,u]of Object.entries(i.cases??{}))r.push(`${n} case ${JSON.stringify(c)}: {`,zn(u,l),`${n} break;`,`${n} }`);if(i.default)r.push(`${n} default: {`,zn(i.default,l),`${n} }`);r.push(`${n}}`);break}case"dispatch":{let i=o.node,a=t.eventParam??"event",l=t.dispatchTarget??`(${a} && ${a}.currentTarget)`,c=[];if("detail"in i)c.push(`detail: ${fs(i.detail,t)}`);if(i.bubbles!==void 0)c.push(`bubbles: ${JSON.stringify(i.bubbles)}`);if(i.composed!==void 0)c.push(`composed: ${JSON.stringify(i.composed)}`);let u=c.length>0?`, { ${c.join(", ")} }`:"";r.push(`${n}${l}?.dispatchEvent(new CustomEvent(${JSON.stringify(i.dispatchEvent)}${u}));`);break}case"stopPropagation":{r.push(`${n}${t.eventParam??"event"}?.stopPropagation();`);break}case"preventDefault":{r.push(`${n}${t.eventParam??"event"}?.preventDefault();`);break}default:break}}return r.join(`
|
|
129
|
+
`)}var Fu=J(()=>{ce();Ai()});var th=J(()=>{ce()});function Ri(e){if(e===QI)return"client";if(e===e1)return"server";return null}function t1(e){return e.replaceAll("\\","/").replace(/^(?:\.\/)+/,"")}function Sv(e,t){return`${sh}${t1(e)}#${t}`}function Vu(e){return e.startsWith(sh)}function Ni(e){if(!Vu(e))return null;let t=e.slice(sh.length),n=t.lastIndexOf("#");if(n<=0)return null;let r=t.slice(n+1);if(r!=="client"&&r!=="server")return null;return{path:t.slice(0,n),side:r}}function nh(e,t){if(Array.isArray(e)){let r=e.map((s)=>nh(s,t));return r.some((s,o)=>s!==e[o])?r:e}if(!L(e))return e;let n=null;for(let[r,s]of Object.entries(e)){let o=s;if(r==="$src"&&k(s)){let i=Ri(s);o=i===null?s:Sv(t,i)}else if(r!=="$script")o=nh(s,t);if(o!==s)n??={...e},n[r]=o}return n===null?e:n}function pl(e,t){return nh(e,t)}function s1(e){return n1.test(e)&&!r1.test(e)}function $v(e){return Ri(e)==="client"||Ni(e)?.side==="client"}function rh(e,t,n){if(Array.isArray(e)){for(let[r,s]of e.entries())rh(s,[...t,r],n);return n}if(!L(e))return n;if(k(e.$src))n.push({lazy:e.$lazy===!0,path:t,src:e.$src});for(let[r,s]of Object.entries(e))if(r!=="$script")rh(s,[...t,r],n);return n}function o1(e){let t=e.at(-1);return k(t)?`"${t}"`:"this entry"}function wv(e){let t=rh(e,[],[]),n=t.some((s)=>!s.lazy&&$v(s.src)),r=[];for(let s of t){let o=o1(s.path);if(!s.lazy&&s1(s.src))r.push({detail:'A module only this document uses can be the document\'s own script: move the code into the client script (the server script for a `timing: "server"` entry) and name it with `$src: "#client"` or `$src: "#server"`. A module several documents import stays a file, and this one keeps working as it is.',message:`${o} imports ${s.src}, which the document could carry as its own script`,path:s.path,rule:"relative-src"});else if(s.lazy&&n&&$v(s.src))r.push({detail:"A document has one client script, and another entry imports it as the page loads, so `$lazy` defers nothing here. Move this export to a `$src` module of its own to load it on its first call.",message:`${o} is $lazy, but the script it is in loads with the page`,path:s.path,rule:"lazy-shares-script"})}return r}var sh="jx-script:",QI="#client",e1="#server",n1,r1;var Ti=J(()=>{ce();n1=/^\.{1,2}\//u,r1=/\.json$/iu});function u1(e){for(let t of Object.keys(e))if(c1.has(t))return!0;return!1}function Ji(e){if(!e.startsWith("${")||!e.endsWith("}"))return!1;let[t,...n]=Hb(e);return t!==void 0&&n.length===0&&t.start===0&&t.end===e.length}function jv(){return[...Ev].toSorted()}function Rr(e,t){let n=e.toLowerCase();if(n.startsWith("aria-")||Ev.has(n))return String(t);return t?"":null}function Pv(e,t,n){if(!Array.isArray(e))return[];let r=e;if(_t(t))r=r.filter(t);if(_t(n))r=[...r].toSorted(n);return r}function _v(e,t,n,r){let s=Qo(t);if(r?.has(s)&&r.get(s)===void 0)return;let o=e[s];if(Ge(o)){e[s]=n!==null&&n!=="false";return}if(n===null){let i=r?.get(s);e[s]=i===void 0?Ie(o)?0:"":i;return}e[s]=Ie(o)?Number(n):n}function oh(e){let t=vv.get(e);if(t)return t;let n=new Set,r=Or(e);for(let[s,o]of Object.entries(e.state??{}))if(k(o)?le(o):fn(o)?!wr(o)&&!dr(o.$expression.operator):r.get(s)==="computed")n.add(s);return vv.set(e,n),n}function kv(e){let t=e.state??{},n=oh(e),r=(s)=>(s in t)&&!n.has(s);return{checked:r("checked"),disabled:r("disabled"),required:r("required"),value:r("value")}}function ih(e){let t=new Map;for(let[n,r]of Object.entries(e.state??{})){if(k(r)&&le(r)){t.set(n,void 0);continue}if(D(r)&&!Array.isArray(r)){if("default"in r){t.set(n,r.default);continue}if(f1.some((s)=>(s in r))){t.set(n,void 0);continue}if(u1(r))continue}t.set(n,r)}return t}var c1,pr,Ev,yY,vv,f1,ah=32,qu,Hu="jx-slot",ml="data-jx-slots",lh="jx.slot.group",xY;var Mi=J(()=>{dl();Ai();_i();ce();$i();An();Fu();th();Ti();th();dl();c1=new Set(["type","properties","items","enum","minimum","maximum","minLength","maxLength","pattern","required","examples"]);pr=new Set(["$schema","$shadow","formAssociated","formValue","$id","$defs","state","$ref","$props","$elements","$title","$description","$switch","$prototype","$src","$export","$script","$media","$map","timing","default","description","body","parameters","arguments","tagName","children","style","attributes","items","map","filter","sort","cases","observedAttributes"]),Ev=new Set(["contenteditable","draggable","spellcheck"]);yY=Object.freeze({emptyRow:!0});vv=new WeakMap;f1=["$expression","$prototype","$ref","$src"],qu=/^[\t\n\f\r ]+$/u,xY=(()=>{let e=Symbol.for(lh),t=globalThis;return t[e]??=new WeakMap,t[e]})()});function m1(){if(!hl){hl=new Map;for(let[e,t,n]of p1){let r=hl.get(e);if(!r)r=new Map,hl.set(e,r);for(let s of t.split(" "))r.set(s,n)}}return hl}function Bu(e,t){return Ov??=new Map(d1),Ov.get(t)??m1().get(t)?.get(e.toLowerCase())??null}function ch(e,t){if(t==="innerText")return!0;if(t==="value"||t==="defaultValue")return h1.has(e.toLowerCase());return t==="text"&&g1.has(e.toLowerCase())}var C=(e,t={})=>({attribute:e,kind:"text",...t}),we=(e,t={})=>({attribute:e,kind:"boolean",...t}),Wu,d1,p1,Ov,hl,h1,g1;var uh=J(()=>{Wu={live:!0},d1=[["accessKey",C("accesskey")],["ariaAtomic",C("aria-atomic")],["ariaAutoComplete",C("aria-autocomplete")],["ariaBrailleLabel",C("aria-braillelabel")],["ariaBrailleRoleDescription",C("aria-brailleroledescription")],["ariaBusy",C("aria-busy")],["ariaChecked",C("aria-checked")],["ariaColCount",C("aria-colcount")],["ariaColIndex",C("aria-colindex")],["ariaColIndexText",C("aria-colindextext")],["ariaColSpan",C("aria-colspan")],["ariaCurrent",C("aria-current")],["ariaDescription",C("aria-description")],["ariaDisabled",C("aria-disabled")],["ariaExpanded",C("aria-expanded")],["ariaHasPopup",C("aria-haspopup")],["ariaHidden",C("aria-hidden")],["ariaInvalid",C("aria-invalid")],["ariaKeyShortcuts",C("aria-keyshortcuts")],["ariaLabel",C("aria-label")],["ariaLevel",C("aria-level")],["ariaLive",C("aria-live")],["ariaModal",C("aria-modal")],["ariaMultiLine",C("aria-multiline")],["ariaMultiSelectable",C("aria-multiselectable")],["ariaOrientation",C("aria-orientation")],["ariaPlaceholder",C("aria-placeholder")],["ariaPosInSet",C("aria-posinset")],["ariaPressed",C("aria-pressed")],["ariaReadOnly",C("aria-readonly")],["ariaRelevant",C("aria-relevant")],["ariaRequired",C("aria-required")],["ariaRoleDescription",C("aria-roledescription")],["ariaRowCount",C("aria-rowcount")],["ariaRowIndex",C("aria-rowindex")],["ariaRowIndexText",C("aria-rowindextext")],["ariaRowSpan",C("aria-rowspan")],["ariaSelected",C("aria-selected")],["ariaSetSize",C("aria-setsize")],["ariaSort",C("aria-sort")],["ariaValueMax",C("aria-valuemax")],["ariaValueMin",C("aria-valuemin")],["ariaValueNow",C("aria-valuenow")],["ariaValueText",C("aria-valuetext")],["autocapitalize",C("autocapitalize")],["autocorrect",we("autocorrect",{keywords:["on","off"]})],["autofocus",we("autofocus")],["className",C("class")],["contentEditable",C("contenteditable")],["dir",C("dir")],["draggable",we("draggable")],["enterKeyHint",C("enterkeyhint")],["headingOffset",C("headingoffset")],["headingReset",we("headingreset")],["hidden",{attribute:"hidden",kind:"hidden"}],["id",C("id")],["inert",we("inert")],["inputMode",C("inputmode")],["lang",C("lang")],["popover",C("popover")],["role",C("role")],["slot",C("slot")],["spellcheck",we("spellcheck")],["tabIndex",C("tabindex")],["title",C("title")],["translate",we("translate",{keywords:["yes","no"]})],["writingSuggestions",C("writingsuggestions")]],p1=[["aLink","body",C("alink")],["abbr","td th",C("abbr")],["accept","input",C("accept")],["acceptCharset","form",C("accept-charset")],["action","form",C("action")],["align","caption col colgroup div embed h1 h2 h3 h4 h5 h6 hr iframe img input legend object p table tbody td tfoot th thead tr",C("align")],["allow","iframe",C("allow")],["allowFullscreen","iframe",we("allowfullscreen")],["alpha","input",we("alpha")],["alt","area img input",C("alt")],["archive","object",C("archive")],["as","link",C("as")],["async","script",we("async")],["autocomplete","form input select textarea",C("autocomplete")],["autoplay","audio video",we("autoplay")],["axis","td th",C("axis")],["background","body",C("background")],["behavior","marquee",C("behavior")],["bgColor","body marquee table td th tr",C("bgcolor")],["border","img object table",C("border")],["cellPadding","table",C("cellpadding")],["cellSpacing","table",C("cellspacing")],["ch","col colgroup tbody td tfoot th thead tr",C("char")],["chOff","col colgroup tbody td tfoot th thead tr",C("charoff")],["charset","a link script",C("charset")],["checked","input",we("checked",Wu)],["cite","blockquote del ins q",C("cite")],["clear","br",C("clear")],["closedBy","dialog",C("closedby")],["code","object",C("code")],["codeBase","object",C("codebase")],["codeType","object",C("codetype")],["colSpan","td th",C("colspan")],["color","font hr",C("color")],["colorSpace","input",C("colorspace")],["cols","frameset textarea",C("cols")],["command","button",C("command")],["compact","dir dl menu ol ul",we("compact")],["content","meta",C("content")],["controls","audio img video",we("controls")],["coords","a area",C("coords")],["crossOrigin","audio img link script video",C("crossorigin")],["data","object",C("data")],["dateTime","del ins time",C("datetime")],["declare","object",we("declare")],["decoding","img",C("decoding")],["default","track",we("default")],["defaultChecked","input",we("checked")],["defaultMuted","audio video",we("muted")],["defaultSelected","option",we("selected")],["defaultValue","input",C("value")],["defer","script",we("defer")],["dirName","input textarea",C("dirname")],["direction","marquee",C("direction")],["disabled","button fieldset input link optgroup option select textarea",we("disabled")],["download","a area",C("download")],["encoding","form",C("enctype")],["enctype","form",C("enctype")],["event","script",C("event")],["face","font",C("face")],["fetchPriority","img link script",C("fetchpriority")],["formAction","button input",C("formaction")],["formEnctype","button input",C("formenctype")],["formMethod","button input",C("formmethod")],["formNoValidate","button input",we("formnovalidate")],["formTarget","button input",C("formtarget")],["frame","table",C("frame")],["frameBorder","frame iframe",C("frameborder")],["headers","td th",C("headers")],["height","canvas embed iframe img input marquee object source td th video",C("height")],["high","meter",C("high")],["href","a area base link",C("href")],["hreflang","a area link",C("hreflang")],["hspace","embed img input marquee object",C("hspace")],["htmlFor","label script template",C("for")],["httpEquiv","meta",C("http-equiv")],["imageSizes","link",C("imagesizes")],["imageSrcset","link",C("imagesrcset")],["integrity","link script",C("integrity")],["isMap","img",we("ismap")],["kind","track",C("kind")],["label","optgroup option track",C("label")],["link","body",C("link")],["loading","audio iframe img video",C("loading")],["longDesc","frame iframe img",C("longdesc")],["loop","audio video",we("loop")],["low","meter",C("low")],["lowsrc","img",C("lowsrc")],["marginHeight","frame iframe",C("marginheight")],["marginWidth","frame iframe",C("marginwidth")],["max","input meter progress",C("max")],["maxLength","input textarea",C("maxlength")],["media","link meta source style",C("media")],["method","form",C("method")],["min","input meter",C("min")],["minLength","input textarea",C("minlength")],["multiple","input select",we("multiple")],["muted","audio video",we("muted",Wu)],["name","a button details embed fieldset form frame iframe img input map meta object output param select slot textarea",C("name")],["noHref","area",we("nohref")],["noModule","script",we("nomodule")],["noResize","frame",we("noresize")],["noShade","hr",we("noshade")],["noValidate","form",we("novalidate")],["noWrap","td th",we("nowrap")],["open","details dialog",we("open")],["optimum","meter",C("optimum")],["pattern","input",C("pattern")],["ping","a area",C("ping")],["placeholder","input textarea",C("placeholder")],["playsInline","video",we("playsinline")],["popoverTargetAction","button input",C("popovertargetaction")],["poster","video",C("poster")],["preload","audio video",C("preload")],["readOnly","input textarea",we("readonly")],["referrerPolicy","a area iframe img link script",C("referrerpolicy")],["rel","a area form link",C("rel")],["required","input select textarea",we("required")],["rev","a link",C("rev")],["reversed","ol",we("reversed")],["rowSpan","td th",C("rowspan")],["rows","frameset textarea",C("rows")],["rules","table",C("rules")],["scheme","meta",C("scheme")],["scope","td th",C("scope")],["scrollAmount","marquee",C("scrollamount")],["scrollDelay","marquee",C("scrolldelay")],["scrolling","frame iframe",C("scrolling")],["selected","option",we("selected",Wu)],["shadowRootClonable","template",we("shadowrootclonable")],["shadowRootCustomElementRegistry","template",C("shadowrootcustomelementregistry")],["shadowRootDelegatesFocus","template",we("shadowrootdelegatesfocus")],["shadowRootMode","template",C("shadowrootmode")],["shadowRootSerializable","template",we("shadowrootserializable")],["shadowRootSlotAssignment","template",C("shadowrootslotassignment")],["shape","a area",C("shape")],["size","font hr input select",C("size")],["sizes","img source",C("sizes")],["span","col colgroup",C("span")],["src","audio embed frame iframe img input source track video",C("src")],["srcdoc","iframe",C("srcdoc")],["srclang","track",C("srclang")],["srcset","img source",C("srcset")],["standby","object",C("standby")],["start","ol",C("start")],["step","input",C("step")],["summary","table",C("summary")],["target","a area base form link",C("target")],["text","body",C("text")],["trueSpeed","marquee",we("truespeed")],["type","a area button embed input li link object ol param script source style ul",C("type")],["useMap","img input object",C("usemap")],["vAlign","col colgroup tbody td tfoot th thead tr",C("valign")],["vLink","body",C("vlink")],["value","button data li meter option param progress",C("value")],["value","input",C("value",Wu)],["valueType","param",C("valuetype")],["version","html",C("version")],["vspace","embed img input marquee object",C("vspace")],["width","canvas col colgroup embed hr iframe img input listing marquee object pre source table td th video xmp",C("width")],["wrap","textarea",C("wrap")]];h1=new Set(["output","textarea"]),g1=new Set(["a","option","title"])});var fh,dh;var ph=J(()=>{fh={anyOf:[{additionalProperties:!1,description:"Two-way: `target` is the test, `value` the tag when it is truthy, `initial` the tag when it is not.",properties:{initial:{$ref:"#/$defs/TagName"},operator:{const:"?:",type:"string"},target:{$ref:"#/$defs/ExpressionOperand"},value:{$ref:"#/$defs/TagName"}},required:["operator","target","value","initial"],title:"?: — the tag when the test holds, and the tag when it does not"},{additionalProperties:!1,description:"Multiway: `target` is the discriminant, matched against case keys by its string form. "+"`default` is required — an element with no tag cannot exist.",properties:{cases:{additionalProperties:{$ref:"#/$defs/TagName"},type:"object"},default:{$ref:"#/$defs/TagName"},operator:{const:"switch",type:"string"},target:{$ref:"#/$defs/ExpressionOperand"}},required:["operator","target","cases","default"],title:"switch — one tag per discriminant value, with a required fallback"}],description:"A tag name chosen at element creation. Every branch resolves to a `TagName`, so the candidate set is enumerable without evaluating anything."},dh={anyOf:[{$ref:"#/$defs/TagName"},{additionalProperties:!1,properties:{$expression:{$ref:"#/$defs/TagExpression"}},required:["$expression"],type:"object"}]}});var mh;var hh=J(()=>{mh={description:"HTML element tag name or custom element name (must contain a hyphen per Web Components spec). "+"A NAME, never an expression: no `${…}` position in the pipeline evaluates a tagName. Use "+"`$switch`/`cases` to vary the element.",minLength:1,pattern:"^[a-zA-Z][a-zA-Z0-9._-]*$",type:"string"}});var gh,yh,xh;var bh=J(()=>{gh={oneOf:[{type:"string"},{$ref:"#/$defs/RefObject"}]},yh={oneOf:[{type:"boolean"},{$ref:"#/$defs/RefObject"}]},xh={oneOf:[{type:"number"},{$ref:"#/$defs/RefObject"}]}});var $h;var Sh=J(()=>{$h={additionalProperties:!0,description:"A page-level <head> entry. Defines meta tags, link tags, script tags, etc.",properties:{attributes:{additionalProperties:{oneOf:[{type:"string"},{type:"boolean"}]},type:"object"},children:{items:{$ref:"#/$defs/HeadEntry"},type:"array"},tagName:{type:"string"},textContent:{description:"Element content. An object is serialized to JSON inside the tag — that is how a "+'JSON-LD block (`<script type="application/ld+json">`) is authored.',oneOf:[{type:"string"},{type:"object"}]}},required:["tagName"],type:"object"}});var wh,vh;var Eh=J(()=>{wh={description:"A CEM-compatible parameter definition for a function. Follows the Custom Elements Manifest Parameter shape.",properties:{default:{description:"Default value for the parameter."},description:{description:"Parameter documentation.",type:"string"},name:{description:"Parameter name.",type:"string"},optional:{description:"Whether the parameter is optional.",type:"boolean"},type:{description:"Parameter type (JSON Schema or CEM { text } format)."}},required:["name"],type:"object"},vh={description:"A CEM-compatible event definition. Describes a CustomEvent the function dispatches.",properties:{deprecated:{description:"Deprecation notice.",oneOf:[{type:"boolean"},{type:"string"}]},description:{description:"Event documentation.",type:"string"},name:{description:"Event name (e.g. 'task-toggled').",type:"string"},type:{description:"Event type (e.g. { text: 'CustomEvent' })."}},required:["name"],type:"object"}});var gl;var jh=J(()=>{gl={description:"Image optimization configuration for the project.",properties:{formats:{description:'Output formats, each one of "avif", "jpeg", "png" or "webp" (default ["avif", "jpeg"]). AVIF and JPEG are lossy; PNG and WebP are written losslessly, so listing WebP produces larger files than either. A source with transparency is written as PNG wherever JPEG is listed.',items:{type:"string"},type:"array"},lazyLoad:{type:"boolean"},optimize:{type:"boolean"},picture:{description:"Wrap a multi-format image in a <picture> with one <source> per format (default true). With it off the <img> carries a srcset in the preferred format alone, which browsers that cannot decode that format will still select from.",type:"boolean"},quality:{description:"Lossy quality per format, 1 to 100 (defaults: avif 65, jpeg 80). The build writes png and webp losslessly, so png is never read and webp is read only by the cloudflare service, as the quality of its transform URLs (default 80).",properties:{avif:{type:"number"},jpeg:{type:"number"},png:{type:"number"},webp:{type:"number"}},type:"object"},remoteDomains:{description:'Hostnames whose remote (https) images are optimized through /cdn-cgi/image transform URLs (cloudflare service only), e.g. ["drive.usercontent.google.com"]. Remote sources from other hosts are left untouched.',items:{type:"string"},type:"array"},service:{description:'How images are optimized: "build" encodes variants at build time; "cloudflare" emits /cdn-cgi/image transform URLs served by Cloudflare Image Transformations (requires the feature to be enabled on the serving zone).',enum:["build","cloudflare"],type:"string"},sizes:{type:"string"},widths:{items:{type:"number"},type:"array"}},type:"object"}});var Ph;var _h=J(()=>{Ph={enum:["string","number","integer","boolean","array","object","null"],type:"string"}});var kh,Oh,Ah,Ch,Rh,Nh,Th,Jh,Mh;var Ih=J(()=>{kh={description:"Reference to a $defs type definition in the current component.",examples:["#/$defs/Count","#/$defs/TodoItem","#/$defs/Status"],pattern:String.raw`^#/\$defs/`,type:"string"},Oh={description:"Reference to a state entry (runtime variable) in the current component.",examples:["#/state/count","#/state/addTask","#/state/items"],pattern:"^#/state/",type:"string"},Ah={description:"Reference to an external Jx component file.",examples:["./card.json","https://cdn.example.com/button.json"],pattern:String.raw`^(\./|\.\./).*\.json$|^https?://`,type:"string"},Ch={description:"Reference to a window or document global.",examples:["window#/currentUser","document#/appConfig"],pattern:"^(window|document)#/",type:"string"},Rh={description:"Reference to a named state entry passed via $props from a parent component.",examples:["parent#/sharedState","parent#/theme"],pattern:"^parent#/",type:"string"},Nh={description:"Reference to the current Array map iteration context.",examples:["$map/item","$map/index","$map/item/text","$map/item/done","#/$map/item/text"],pattern:String.raw`^(#/)?\$map/(item|index)(/.*)?$`,type:"string"},Th={oneOf:[{$ref:"#/$defs/InternalRef"},{$ref:"#/$defs/StateRef"},{$ref:"#/$defs/ExternalRef"},{$ref:"#/$defs/GlobalRef"},{$ref:"#/$defs/ParentRef"},{$ref:"#/$defs/MapRef"}],type:"string"},Jh={additionalProperties:!1,description:"A $ref binding. Resolves to a state entry (reactive) or plain value (static).",properties:{$ref:{$ref:"#/$defs/AnyRef"}},required:["$ref"],type:"object"},Mh={properties:{$props:{$ref:"#/$defs/PropsObject"},$ref:{$ref:"#/$defs/ExternalRef"}},required:["$ref"],type:"object"}});var yl;var Dh=J(()=>{yl={additionalProperties:{anyOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/RefObject"},{$ref:"#/$defs/StyleObject"}]},description:"CSS style definition. camelCase property names follow CSSOM convention. Keys starting with :, ., &, or [ are treated as nested CSS selectors. Keys matching $media breakpoint names (or other @-prefixed at-rules) group nested rules. Nesting is recursive: selector and at-rule groups may nest to arbitrary depth "+"(e.g. breakpoint → selector → pseudo-class), mirroring the compiler's recursive emission. "+"An object carrying $ref is a reactive VALUE, and the runtime reads it as one. It also matches the nested-block branch vacuously, since a block admits a string under any key, which is why these branches are anyOf rather than oneOf. A DECLARATION at-rule (@font-face, @property, @position-try, @counter-style) may hold an ARRAY of blocks, which is that key written more than once, in order: an object's keys are "+"unique, so @font-face — the at-rule whose identity is not in its key — could not otherwise "+"state a family's second weight at all.",patternProperties:{"^@(font-face|property|position-try|counter-style)":{anyOf:[{$ref:"#/$defs/StyleObject"},{items:{$ref:"#/$defs/StyleObject"},minItems:1,type:"array"}]}},properties:{$description:{description:"Why this rule exists. Emitted as a comment by static builds, ignored at runtime.",type:"string"}},type:"object"}});var Lh,Fh;var Vh=J(()=>{Lh={additionalProperties:!1,description:"Dynamic mapped list. Re-renders when the items state entry changes.",properties:{$prototype:{const:"Array",type:"string"},filter:{$ref:"#/$defs/RefObject"},items:{oneOf:[{$ref:"#/$defs/RefObject"},{type:"array"}]},key:{additionalProperties:!1,description:"The identity of each rendered row: a $map/item pointer read per item, in either spelling ($map/item/id or #/$map/item/id). A row whose key survives a change keeps its DOM node and its effects across reorders, insertions and "+"removals; without a key, rows are keyed by index. $map/index is not a key — an index "+"names a position, not a row.",properties:{$ref:{pattern:String.raw`^(#/)?\$map/item(/.+)?$`,type:"string"}},required:["$ref"],type:"object"},map:{$ref:"#/$defs/ElementDef"},sort:{$ref:"#/$defs/RefObject"}},required:["$prototype","items","map"],type:"object"},Fh={description:"Array of child definitions — elements, text, or Array namespaces (dynamic lists) mixed "+"freely. A bare Array namespace (the whole children slot is one dynamic list) is also "+"accepted for backward compatibility, as is a ${…} template string that resolves at build "+"time to an array of child definitions.",oneOf:[{items:{anyOf:[{$ref:"#/$defs/ElementDef"},{$ref:"#/$defs/SwitchNode"},{$ref:"#/$defs/ArrayNamespace"},{type:"string"},{type:"number"}]},type:"array"},{$ref:"#/$defs/ArrayNamespace"},{description:"Computed children — a ${…} template that resolves at build time to an array of child "+'definitions (e.g. "${state.entry.$children}" for parsed content). A bare plain-text string is NOT a valid children value; text children must be array items.',pattern:String.raw`\$\{`,type:"string"}]}});var qh,Hh,Wh,Bh,Uh,Uu;var zh=J(()=>{qh={additionalProperties:{oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{$ref:"#/$defs/RefObject"}]},description:"HTML attributes and ARIA attributes set via element.setAttribute().",type:"object"},Hh={additionalProperties:{anyOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"array"},{type:"object"},{$ref:"#/$defs/RefObject"}]},description:"Explicit prop passing at a component boundary.",type:"object"},Wh={oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"null"},{$ref:"#/$defs/RefObject"}]},Bh={additionalProperties:!1,description:"Reactive $ref that drives which case to render: a state entry, or inside a mapped array's template the row's $map/item or $map/index (spec §14.1).",properties:{$ref:{oneOf:[{$ref:"#/$defs/StateRef"},{$ref:"#/$defs/MapRef"}],type:"string"}},required:["$ref"],type:"object"},Uh={properties:{$switch:{$ref:"#/$defs/SwitchDef"},cases:{additionalProperties:{oneOf:[{$ref:"#/$defs/ElementDef"},{$ref:"#/$defs/ExternalComponentRef"}]},type:"object"},tagName:{$ref:"#/$defs/TagName"}},required:["$switch","cases"],type:"object"},Uu={additionalProperties:{$ref:"#/$defs/ElementPropertyValue"},description:"A Jx element definition. Maps directly to a DOM element.",properties:{"$map/index":{$ref:"#/$defs/RefObject"},"$map/item":{$ref:"#/$defs/RefObject"},$props:{$ref:"#/$defs/PropsObject"},$ref:{$ref:"#/$defs/ExternalRef"},$switch:{$ref:"#/$defs/SwitchDef"},alt:{$ref:"#/$defs/StringOrRef"},attributes:{$ref:"#/$defs/AttributesObject"},cases:{additionalProperties:{oneOf:[{$ref:"#/$defs/ElementDef"},{$ref:"#/$defs/ExternalComponentRef"}]},description:"Switch cases for this element. Maps case values to element definitions or external component refs, rendered according to the reactive $switch discriminant.",type:"object"},checked:{$ref:"#/$defs/BoolOrRef"},children:{$ref:"#/$defs/ChildrenValue"},className:{$ref:"#/$defs/StringOrRef"},dir:{enum:["ltr","rtl","auto"],type:"string"},disabled:{$ref:"#/$defs/BoolOrRef"},hidden:{$ref:"#/$defs/BoolOrRef"},href:{$ref:"#/$defs/StringOrRef"},id:{type:"string"},innerHTML:{$ref:"#/$defs/StringOrRef"},innerText:{$ref:"#/$defs/StringOrRef"},lang:{$ref:"#/$defs/StringOrRef"},name:{$ref:"#/$defs/StringOrRef"},placeholder:{$ref:"#/$defs/StringOrRef"},selected:{$ref:"#/$defs/BoolOrRef"},src:{$ref:"#/$defs/StringOrRef"},style:{$ref:"#/$defs/StyleObject"},tabIndex:{$ref:"#/$defs/NumberOrRef"},tagName:{$ref:"#/$defs/ElementTagName"},textContent:{$ref:"#/$defs/StringOrRef"},title:{$ref:"#/$defs/StringOrRef"},type:{$ref:"#/$defs/StringOrRef"},value:{$ref:"#/$defs/StringOrRef"}},required:["tagName"],type:"object"}});var Kh;var Gh=J(()=>{Kh={description:"A typed reactive state variable with explicit type and default value. The type property is a JSON Schema or $ref to a $defs type definition. The default property is the initial runtime value.",not:{required:["$prototype"]},properties:{$ref:{description:"Reference to a shared type definition.",type:"string"},attribute:{description:"Linked HTML attribute name for CEM extraction.",type:"string"},default:{description:"Initial state value."},deprecated:{description:"Deprecation notice for CEM extraction.",oneOf:[{type:"boolean"},{type:"string"}]},description:{type:"string"},examples:{type:"array"},reflects:{description:"Whether property changes reflect back to the HTML attribute.",type:"boolean"},type:{description:"JSON Schema type definition, $ref to a $defs type, or JSON Schema type string.",oneOf:[{type:"string"},{type:"object"}]}},required:["default"],type:"object"}});var Xh;var Yh=J(()=>{Xh={additionalProperties:!1,description:'A function declaration. $prototype must be "Function". body (inline) and $src (external) are mutually exclusive; declaring both is an error. First parameter is always state (the reactive scope).',not:{required:["body","$src"]},properties:{$export:{description:"Named export in $src module. Defaults to the state key name.",type:"string"},$lazy:{description:"Load $src on first call instead of importing it up front. The function then returns a "+"promise, so it may only be called from a handler or lifecycle hook — never bound as a "+"computed value. Use it for code most visitors never reach.",type:"boolean"},$prototype:{const:"Function",type:"string"},$src:{description:"External module specifier. Mutually exclusive with body.",examples:["./counter.js","npm:@myorg/validators"],type:"string"},arguments:{description:"Legacy alias for parameters: bare string parameter names (state may be listed explicitly as the first name). Superseded by parameters.",examples:[["state","event"]],items:{type:"string"},type:"array"},body:{description:"Inline function body: a source string in erasable TypeScript, which plain JavaScript already is (spec §23.1; types are erased before it is analysed or run; first implicit parameter is state), or a structured statement array (spec §20) — explicit structured function declaration, analyzable by tooling and editable visually. The escalation ladder within the shape is structured statements → source string.",examples:["state.count++",'state.items.push({ id: Date.now(), text: "", done: false })','return state.score >= 90 ? "gold" : "silver"',"const input = event.target as HTMLInputElement; state.label = input.value",[{operator:"push",target:{$ref:"#/state/cart"},value:1},{dispatchEvent:"cart-changed",detail:{$ref:"#/state/cart"}}]],oneOf:[{type:"string"},{$ref:"#/$defs/StatementList"}]},description:{type:"string"},emits:{description:"Array of CEM-compatible Event objects this function dispatches. Used for CEM extraction and studio event discovery.",items:{$ref:"#/$defs/CemEvent"},type:"array"},name:{description:"Explicit function name. Defaults to the state key name.",type:"string"},parameters:{description:"Function parameters (after the implicit state parameter). Accepts CEM-compatible parameter objects or bare string names for backward compatibility.",examples:[["event"],[{name:"event",type:{text:"Event"}}],[{description:"Item identifier",name:"id",type:{text:"number"}}]],items:{oneOf:[{type:"string"},{$ref:"#/$defs/CemParameter"}]},type:"array"},type:{description:"Return type for tooling (JSON Schema or CEM { text } format)."}},required:["$prototype"],type:"object"}});var Zh,Qh;var eg=J(()=>{Zh={description:"One statement of a structured function body. Either a bare expression node in statement position (a mutation like =/push, or a call — its result discarded unless captured by an assignment), an if/then/else branch (JSON Schema conditional keywords; if holds a pure expression, then/else hold statement lists), a $switch multiway branch (discriminant matched by string form against cases keys, like element-level $switch), a dispatchEvent statement (WHATWG DOM: dispatches a CustomEvent from the handler's current target, with CustomEventInit members detail/bubbles/composed), or the two WHATWG event verbs stopPropagation and preventDefault, each spelled as the member set to true.",oneOf:[{$ref:"#/$defs/ExpressionNode"},{additionalProperties:!1,properties:{else:{items:{$ref:"#/$defs/Statement"},type:"array"},if:{$ref:"#/$defs/ExpressionOperand"},then:{items:{$ref:"#/$defs/Statement"},type:"array"}},required:["if","then"],title:"if / then / else — conditional branch (JSON Schema keyword triple)",type:"object"},{additionalProperties:!1,properties:{$switch:{$ref:"#/$defs/ExpressionOperand"},cases:{additionalProperties:{items:{$ref:"#/$defs/Statement"},type:"array"},type:"object"},default:{items:{$ref:"#/$defs/Statement"},type:"array"}},required:["$switch","cases"],title:"$switch / cases — multiway branch (element-level convention, ECMA switch semantics)",type:"object"},{additionalProperties:!1,properties:{bubbles:{type:"boolean"},composed:{type:"boolean"},detail:{$ref:"#/$defs/ExpressionOperand"},dispatchEvent:{description:"The CustomEvent type to dispatch (WHATWG DOM dispatchEvent).",type:"string"}},required:["dispatchEvent"],title:"dispatchEvent — emit a CustomEvent (WHATWG naming, CustomEventInit members)",type:"object"},{additionalProperties:!1,properties:{stopPropagation:{const:!0,description:"Stop the handler's event at the current target (WHATWG DOM stopPropagation), so an ancestor's handler for the same event does not run. A body run without an event has nothing to stop."}},required:["stopPropagation"],title:"stopPropagation — stop the event here (WHATWG DOM)",type:"object"},{additionalProperties:!1,properties:{preventDefault:{const:!0,description:"Cancel the handler's event's default action (WHATWG DOM preventDefault): a link's navigation, a form's submission, a key's scroll."}},required:["preventDefault"],title:"preventDefault — cancel the event's default action (WHATWG DOM)",type:"object"}]},Qh={description:"A structured function body: statements executed sequentially (one yielding a promise is awaited before the next, per ECMA async/await semantics).",items:{$ref:"#/$defs/Statement"},type:"array"}});var tg,ng;var rg=J(()=>{tg=["Function","Request","URLSearchParams","FormData","LocalStorage","SessionStorage","Cookie","IndexedDB","Array","Set","Map","Blob","ReadableStream"],ng={description:'An external class / data source. $prototype is a constructor name (not "Function"). When $prototype is not in the built-in registry, $src is required. All state entries are reactive by default.',properties:{$export:{description:"Named export in $src module. Defaults to the $prototype value.",type:"string"},$prototype:{description:"Constructor name — built-in Web API class or external class name.",examples:["Request","URLSearchParams","FormData","LocalStorage","SessionStorage","Cookie","IndexedDB","Array","Set","Map","Blob","ReadableStream","MarkdownCollection","MyParser"],not:{const:"Function"},type:"string"},$src:{description:"External module specifier. Required when $prototype is not a built-in.",examples:["@jxsuite/md","./lib/my-parser.js","npm:@myorg/data"],type:"string"},autoIncrement:{type:"boolean"},body:{},database:{type:"string"},debounce:{minimum:0,type:"integer"},default:{},description:{type:"string"},domain:{type:"string"},filter:{anyOf:[{$ref:"#/$defs/RefObject"},{description:"A single filter object, e.g. an equality shorthand.",type:"object"},{description:'Ordered filter rules, e.g. [{ field: "Slug", op: "not empty" }].',items:{type:"object"},type:"array"}],description:"Filter configuration: a reactive $ref binding, a single filter object, or an ordered array of rules."},headers:{additionalProperties:{type:"string"},type:"object"},indexes:{items:{properties:{keyPath:{oneOf:[{type:"string"},{items:{type:"string"},type:"array"}]},name:{type:"string"},unique:{type:"boolean"}},required:["name","keyPath"],type:"object"},type:"array"},items:{},key:{type:"string"},keyPath:{type:"string"},manual:{type:"boolean"},map:{$ref:"#/$defs/ElementDef"},maxAge:{type:"integer"},method:{enum:["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],type:"string"},name:{type:"string"},path:{type:"string"},responseType:{enum:["json","text","blob","arraybuffer","document",""],type:"string"},sameSite:{enum:["strict","lax","none"],type:"string"},secure:{type:"boolean"},sort:{anyOf:[{$ref:"#/$defs/RefObject"},{description:"A single sort rule, e.g. { field, order }.",type:"object"},{description:'Ordered sort rules, e.g. [{ field: "date", order: "desc" }].',items:{type:"object"},type:"array"}],description:"Sort configuration: a reactive $ref binding, a single { field, order } rule, or an ordered array of rules."},src:{description:"Configuration property passed to external class constructor.",type:"string"},store:{type:"string"},timing:{enum:["compiler","server","client"],type:"string"},url:{$ref:"#/$defs/StringOrRef"},version:{minimum:1,type:"integer"}},required:["$prototype"],type:"object"}});var sg;var og=J(()=>{sg={description:"A reusable JSON Schema type definition for tooling only. No function, no runtime artifact. Referenced from state entries via $ref. Naming convention: PascalCase.",not:{anyOf:[{required:["default"]},{required:["$prototype"]}]},properties:{description:{type:"string"},enum:{type:"array"},examples:{type:"array"},items:{},maxLength:{minimum:0,type:"integer"},maximum:{type:"number"},minLength:{minimum:0,type:"integer"},minimum:{type:"number"},pattern:{type:"string"},properties:{type:"object"},required:{items:{type:"string"},type:"array"},type:{$ref:"#/$defs/JsonSchemaType"}},required:["type"],type:"object"}});var ig,ag,lg,cg,ug,fg,dg,pg,mg,hg,gg,yg,xg,bg,$g,Sg,wg;var vg=J(()=>{Hm();ig={additionalProperties:!1,description:"A JSON Pointer $ref operand within an expression node. $args/<name> resolves a named formula's parameter (callable entries only).",properties:{$ref:{pattern:String.raw`^(\$map/|\$reduce/|\$args/|event#/|#/|parent#/|window#/|document#/)`,type:"string"}},required:["$ref"],type:"object"},ag={anyOf:[{not:{pattern:String.raw`\$\{`},type:"string"},{type:"number"},{type:"boolean"},{type:"null"},{items:{$ref:"#/$defs/ExpressionOperand"},type:"array"},{description:"Plain-object literal (e.g. an Intl options bag). Objects carrying $ref or operator keys are pointers/nodes, never literals.",not:{anyOf:[{required:["$ref"]},{required:["operator"]}]},type:"object"}],description:"A non-reactive operand: scalar, plain-object literal, or array of operands."},lg={anyOf:[{$ref:"#/$defs/ExpressionPointer"},{$ref:"#/$defs/ExpressionNode"},{$ref:"#/$defs/ExpressionLiteral"}],description:"Anything that may appear in target or value: a pointer, a literal, or a nested expression node."},cg={enum:["!","-"]},ug={enum:["+","-","*","/","%","===","!==","<","<=",">",">=","&&","||","??"]},fg={const:"?:"},dg={const:"switch"},pg={const:"call"},mg={description:"A genuine pure String.prototype / Array.prototype / Number.prototype method (spec §19.4d). The ES2023 change-by-copy family (toSorted, toReversed, toSpliced, with) stands in where mutation would otherwise occur. Receiver in target; value carries the argument (bare scalar) or argument list (array).",enum:["includes","indexOf","lastIndexOf","join","slice","concat","at","flat","toSorted","toReversed","toSpliced","with","toUpperCase","toLowerCase","trim","trimStart","trimEnd","split","startsWith","endsWith","padStart","padEnd","replaceAll","repeat","charAt","normalize","toLocaleUpperCase","toLocaleLowerCase","toFixed","toPrecision","toLocaleString"]},hg={enum:["=","+=","-=","*=","/="]},gg={enum:["pop","shift"]},yg={enum:["push","unshift"]},xg={const:"splice"},bg={const:"reduce"},$g={enum:["map","filter"]},Sg={additionalProperties:!1,description:"The core expression node. operator + target, with value gated by arity.",oneOf:[{not:{anyOf:[{required:["value"]},{required:["initial"]}]},properties:{operator:{$ref:"#/$defs/UnaryOperator"}},required:["operator"],title:"Unary — target only, no value"},{not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/BinaryOperator"}},required:["operator","value"],title:"Binary — left in target, right in value"},{not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/AssignmentOperator"},target:{$ref:"#/$defs/ExpressionPointer"}},required:["operator","value"],title:"Assignment — writable target, value required"},{not:{anyOf:[{required:["value"]},{required:["initial"]}]},properties:{operator:{$ref:"#/$defs/NoArgMethod"},target:{$ref:"#/$defs/ExpressionPointer"}},required:["operator"],title:"pop / shift — array receiver, no value"},{not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/OneArgMethod"},target:{$ref:"#/$defs/ExpressionPointer"}},required:["operator","value"],title:"push / unshift — array receiver, single value argument"},{not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/SpliceMethod"},target:{$ref:"#/$defs/ExpressionPointer"},value:{items:{$ref:"#/$defs/ExpressionOperand"},minItems:1,type:"array"}},required:["operator","value"],title:"splice — array receiver, [start, deleteCount, ...items]"},{properties:{operator:{$ref:"#/$defs/ReduceMethod"},target:{anyOf:[{$ref:"#/$defs/ExpressionPointer"},{$ref:"#/$defs/ExpressionNode"}]},value:{$ref:"#/$defs/ExpressionNode"}},required:["operator","value","initial"],title:"reduce — pure fold over a pointer or derived array; seed in initial"},{not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/MapFilterMethod"},target:{anyOf:[{$ref:"#/$defs/ExpressionPointer"},{$ref:"#/$defs/ExpressionNode"}]},value:{$ref:"#/$defs/ExpressionNode"}},required:["operator","value"],title:"map / filter — pure over a pointer or derived array; per-item expression in value"},{description:"The ECMAScript conditional (ternary) operator, pure: target is the test, value the consequent, initial the alternate (the reduce precedent for repurposing initial). Chain else-if by nesting another ?: node in initial.",properties:{operator:{$ref:"#/$defs/ConditionalOperator"}},required:["operator","value","initial"],title:"?: — pure conditional; test in target, consequent in value, alternate in initial"},{description:"Value-keyed multiway selection, pure: target is the discriminant (matched against case keys by its string form, like element-level $switch), cases maps matched values to result operands, default is the operand when no case matches (result is undefined without it). Condition-chain branching composes from nested ?: nodes instead.",not:{anyOf:[{required:["value"]},{required:["initial"]}]},properties:{cases:{additionalProperties:{$ref:"#/$defs/ExpressionOperand"},type:"object"},default:{$ref:"#/$defs/ExpressionOperand"},operator:{$ref:"#/$defs/SwitchOperator"}},required:["operator","cases"],title:"switch — pure value-keyed selection; discriminant in target, results in cases/default"},{description:"A pure standard-library method call: target is the receiver (any operand — never mutated; change-by-copy names replace the mutating originals), value the optional argument (bare scalar) or argument list (array). A missing receiver or method yields undefined, matching null-safe path reads.",not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/PureMethod"}},required:["operator"],title:"Pure method — genuine prototype methods; receiver in target, args in value"},{description:"Invoke a callable, pure in formula position: target is the callee pointer — a named formula entry (#/state/…) or a blessed pure global via window#/ (Math.*, JSON.*, Object.keys/values/entries, and "+`${av()}) — and value is the positional argument list (the splice args-in-value precedent). Argument order follows the callee's declared parameters.`,not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/CallOperator"},target:{$ref:"#/$defs/ExpressionPointer"},value:{items:{$ref:"#/$defs/ExpressionOperand"},type:"array"}},required:["operator"],title:"call — invoke a named formula or blessed global; callee in target, args in value"}],properties:{cases:{additionalProperties:{$ref:"#/$defs/ExpressionOperand"},description:"switch only: matched discriminant value (string form) → result operand.",type:"object"},default:{$ref:"#/$defs/ExpressionOperand",description:"switch only: result operand when no case key matches."},initial:{$ref:"#/$defs/ExpressionOperand"},operator:{type:"string"},target:{$ref:"#/$defs/ExpressionOperand"},value:{$ref:"#/$defs/ExpressionOperand"}},required:["operator","target"],type:"object"},wg={additionalProperties:!1,description:"A declarative expression entry (Shape 5). Used as a state entry or inline event handler. With parameters it is a named formula: a pure, reusable computation invoked via the call operator, its parameters resolved through $args/<name> refs in the body.",properties:{$description:{type:"string"},$expression:{$ref:"#/$defs/ExpressionNode"},$title:{type:"string"},parameters:{description:"Named-formula parameters (CEM convention, as on Function entries): bare names or CEM parameter objects. Present ⇒ the entry is callable, not a computed value.",items:{anyOf:[{type:"string"},{$ref:"#/$defs/CemParameter"}]},type:"array"}},required:["$expression"],type:"object"}});var Eg,jg,Pg,_g;var kg=J(()=>{Eg={description:"A single state entry. Shape is determined by value type: "+"scalar/array → naked reactive property, string with ${} → computed, "+'object with $prototype: "Function" → function, '+"object with $prototype: <other> → data source, "+"object with type and default → typed reactive property, "+"plain object → naked object reactive property.",oneOf:[{type:"number"},{type:"boolean"},{type:"null"},{type:"string"},{type:"array"},{$ref:"#/$defs/TypedStateDef"},{$ref:"#/$defs/FunctionDef"},{$ref:"#/$defs/ExternalClassDef"},{$ref:"#/$defs/ExpressionEntry"},{not:{anyOf:[{required:["$prototype"]},{required:["default"]},{required:["type"]},{required:["$expression"]}]},type:"object"}]},jg={additionalProperties:{$ref:"#/$defs/StateEntry"},description:"Map of runtime variables. Keys are camelCase (public) or #-prefixed (private). All entries are reactive by default.",type:"object"},Pg={additionalProperties:{$ref:"#/$defs/TypeDefEntry"},description:"Map of reusable JSON Schema type definitions. Keys are PascalCase type names. No runtime artifacts are produced.",type:"object"},_g={description:"A $defs type definition entry. Must be a pure JSON Schema type definition or a class definition (.class.json format).",oneOf:[{$ref:"#/$defs/PureTypeDef"},{$ref:"#/$defs/ClassDef"}]}});var Av,zu,Ku,Gu,Xu,Yu,Zu,Qu,ef,tf,Og;var Ag=J(()=>{Av=["method","accessor","parse","serialize","rewrite","discover","load","projectData","resolvePaths","lower","emit","head","assets","mount","dialect","deploySchema","bindings","testConnection"],zu={description:"A typed parameter definition for a class.",properties:{default:{},description:{type:"string"},examples:{type:"array"},format:{description:`When "json-schema", this parameter's value is itself a JSON Schema.`,type:"string"},identifier:{type:"string"},type:{}},required:["identifier"],type:"object"},Ku={description:"A class field definition with access control and scope.",properties:{$prototype:{description:'Data source prototype for this field (e.g., "Request").',type:"string"},access:{enum:["public","private","protected"],type:"string"},default:{},description:{type:"string"},examples:{type:"array"},identifier:{type:"string"},initializer:{},role:{const:"field",type:"string"},scope:{enum:["instance","static"],type:"string"},type:{}},type:"object"},Gu={description:"Class constructor definition.",properties:{$prototype:{const:"Function",type:"string"},body:{description:"The member's body in erasable TypeScript, which plain JavaScript already is (spec §23.1), as one string or as an array of lines.",oneOf:[{type:"string"},{items:{type:"string"},type:"array"}]},description:{type:"string"},parameters:{items:{oneOf:[{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"},{$ref:"#/$defs/ClassParameterDef"}]},type:"array"},role:{const:"constructor",type:"string"},superCall:{properties:{arguments:{items:{type:"string"},type:"array"}},type:"object"}},type:"object"},Xu={description:"A class method or accessor definition. Capability roles (parse, serialize, rewrite, discover, load) mark static methods that hosts (compiler, server, studio) invoke for format dispatch.",properties:{$prototype:{const:"Function",type:"string"},access:{enum:["public","private","protected"],type:"string"},body:{description:"The member's body in erasable TypeScript, which plain JavaScript already is (spec §23.1), as one string or as an array of lines.",oneOf:[{type:"string"},{items:{type:"string"},type:"array"}]},description:{type:"string"},getter:{properties:{body:{type:"string"}},type:"object"},identifier:{type:"string"},parameters:{items:{oneOf:[{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"},{$ref:"#/$defs/ClassParameterDef"}]},type:"array"},returnType:{},role:{enum:Av,type:"string"},scope:{enum:["instance","static"],type:"string"},setter:{properties:{body:{type:"string"},parameters:{type:"array"}},type:"object"},timing:{description:"Execution environments allowed to call this capability directly. Hosts outside the list round-trip through the dev server.",items:{enum:["compiler","server","client"],type:"string"},type:"array"}},type:"object"},Yu={description:"Format participation marker. A class carrying this block is auto-discovered from the project imports map and used for file-extension dispatch by the compiler, server, and studio.",properties:{documentKinds:{description:'"page"/"component" allow the extension in pages/components discovery; "content" allows it as a content-type source.',items:{enum:["page","component","content"],type:"string"},type:"array"},exportTarget:{description:"When true, site builds emit a serialized sidecar per page in this format.",type:"boolean"},extensions:{description:'File extensions this format claims, with leading dot (e.g. [".md"]).',items:{pattern:String.raw`^\.`,type:"string"},minItems:1,type:"array"},mediaType:{description:"MIME type for the format (icons, labels, HTTP).",type:"string"},remote:{description:"When true, the load capability accepts http(s) URLs as sources.",type:"boolean"}},required:["extensions"],type:"object"},Zu={additionalProperties:!1,description:"Project-section admission block (specs/extensions.md §9). A class carrying this block owns "+"the project.json section named by `key`; hosts dispatch that section's data through the class's projectData/resolvePaths capabilities.",properties:{description:{type:"string"},key:{description:"The project.json top-level section this class owns (exclusive per project).",type:"string"},referenceable:{description:"Whether section entries can be referenced from documents (e.g. content types).",type:"boolean"},title:{type:"string"}},required:["key"],type:"object"},Qu={additionalProperties:!1,description:"Server-mount admission block (specs/extensions.md §11). A class carrying this block mounts "+"routes under its /_jx/ basePath in the site worker and dev server.",properties:{basePath:{description:"Route subtree this class mounts — must be under /_jx/ (exclusive per project).",examples:["/_jx/data","/_jx/auth"],type:"string"},module:{description:"Module specifier exporting the mount handler.",type:"string"},order:{description:"Mount order (ascending; default 100).",type:"number"}},required:["basePath"],type:"object"},ef={description:"Connection-provider admission block (specs/extensions.md §12). A class carrying this block "+"provides database connections of the given provider/kind.",properties:{kind:{description:"SQL dialect family the provider speaks.",enum:["sqlite","postgres"],type:"string"},local:{description:"Local-development substitute provider (e.g. sqlite for D1).",type:"string"},module:{description:"Module specifier exporting the provider implementation.",type:"string"},provider:{description:"Provider identifier (e.g. d1, supabase, sqlite).",type:"string"},serve:{description:"Module specifier exporting the serve-time worker binding.",type:"string"}},required:["provider","kind"],type:"object"},tf={description:"Studio control-surface hints for a format class: editor modes, document-mode rules, templates, and the element/nesting constraints that gate structural editing.",properties:{documentMode:{properties:{componentWhen:{description:"Treat the document as a component when this top-level/frontmatter key matches the regex.",properties:{frontmatterKey:{type:"string"},matches:{type:"string"}},type:"object"},default:{enum:["content","component"],type:"string"}},type:"object"},elements:{description:"Element allowlist and nesting constraints for structural editing.",properties:{block:{items:{type:"string"},type:"array"},inline:{items:{type:"string"},type:"array"},nesting:{additionalProperties:{properties:{block:{type:"boolean"},directive:{type:"boolean"},inline:{type:"boolean"},only:{items:{type:"string"},type:"array"}},type:"object"},description:'Per-parent child rules keyed by tag (or "_root"): { block, inline, directive } booleans or { only: [tags] }.',type:"object"},textOnly:{items:{type:"string"},type:"array"},void:{items:{type:"string"},type:"array"}},type:"object"},icon:{type:"string"},modes:{description:"Editor modes the studio offers for documents of this format.",items:{type:"string"},type:"array"},newFileTemplate:{description:"Initial source text for newly created files of this format.",type:"string"}},type:"object"},Og={additionalProperties:!1,description:'A .class.json schema-defined class. $prototype must be "Class". Defines fields, constructor, methods, and type parameters via $defs. Optionally points to a JS module via $implementation for hybrid execution.',properties:{$defs:{description:"Class members: parameters, returnTypes, fields, constructor, methods.",properties:{constructor:{$ref:"#/$defs/ClassConstructorDef"},fields:{additionalProperties:{$ref:"#/$defs/ClassFieldDef"},description:"Class fields with role, access, scope, and type information.",type:"object"},methods:{additionalProperties:{$ref:"#/$defs/ClassMethodDef"},description:"Class methods and accessors.",type:"object"},parameters:{additionalProperties:{$ref:"#/$defs/ClassParameterDef"},description:"Reusable typed parameter schemas, keyed by name.",type:"object"},returnTypes:{additionalProperties:{type:"object"},description:"Output type schemas, keyed by name.",type:"object"}},type:"object"},$id:{type:"string"},$implementation:{description:"Relative path to a JS module containing the actual class implementation.",type:"string"},$prototype:{const:"Class",type:"string"},$schema:{type:"string"},$studio:{$ref:"#/$defs/StudioHints"},connector:{$ref:"#/$defs/ConnectorBlockDef"},description:{type:"string"},extends:{description:"Base class — string name or $ref to another .class.json.",oneOf:[{type:"string"},{properties:{$ref:{type:"string"}},required:["$ref"],type:"object"}]},format:{$ref:"#/$defs/FormatDef"},project:{$ref:"#/$defs/ProjectBlockDef"},server:{$ref:"#/$defs/ServerBlockDef"},title:{description:"PascalCase class name, used as the export name.",type:"string"}},required:["$prototype","title"],type:"object"}});var Cv,nf;var Cg=J(()=>{Jo();Cv=[301,302,303,307,308],nf={description:"Schema for Jx project.json files. A project.json file is the root anchor file for a Jx project, declaring site metadata, default settings, global styles, extensions, and build configuration. Open by design: extension-contributed sections (e.g. `content`) are opaque top-level keys; the generated per-project entry document (project.schema.json) closes the composition.",properties:{$defs:{description:"Global type definitions available to all pages.",type:"object"},$elements:{description:"Global custom element dependencies available to all pages. Items are $ref objects or npm package specifier strings.",items:{oneOf:[{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"},{type:"string"}]},type:"array"},$head:{description:"Global <head> entries applied to all pages. Array of element definitions for meta tags, link tags, script tags, etc.",examples:[[{attributes:{href:"/favicon.svg",rel:"icon"},tagName:"link"},{attributes:{content:"Jx",name:"generator"},tagName:"meta"}]],items:{properties:{attributes:{additionalProperties:{type:"string"},type:"object"},tagName:{type:"string"}},type:"object"},type:"array"},$media:{additionalProperties:{type:"string"},description:'Named media breakpoints following CSS @custom-media convention. Available in all component style objects. Declaring a pure color-scheme query (e.g. "--dark": "(prefers-color-scheme: dark)") additionally opts the site into the forced-scheme contract: @--dark style blocks are dual-emitted so a data-color-scheme attribute on <html> overrides the OS preference, color-scheme is declared on :root, and a pre-paint script restores the '+"visitor's persisted choice (spec §9.5).",examples:[{"--dark":"(prefers-color-scheme: dark)","--lg":"(min-width: 1024px)","--md":"(min-width: 768px)","--sm":"(min-width: 640px)"}],type:"object"},$schema:{description:"Relative path to the generated per-project schema (conventionally ./project.schema.json, written by `jx schema`).",type:"string"},build:{description:"Build configuration.",properties:{adapter:{description:"Platform adapter for deployment-specific output.",enum:["static","cloudflare-pages","cloudflare-workers","node","bun"],type:"string"},deploy:{additionalProperties:!1,description:"Deployment tracking: the hosting project this repo publishes to. Identifiers "+"only (no secrets) — safe to commit; Studio uses it to tell whether the publish "+"workflow already exists. `adapter` says how the build is packaged; `deploy` says where it ships.",properties:{accountId:{description:"Hosting account id (e.g. the Cloudflare account id).",type:"string"},productionUrl:{description:"Production URL of the connected hosting project.",type:"string"},projectName:{description:"Hosting project name (e.g. the Cloudflare Pages project).",pattern:"^[a-z0-9][a-z0-9-]*$",type:"string"},provider:{description:"Hosting provider the project is connected to.",enum:["cloudflare-pages"],type:"string"}},required:["provider","accountId","projectName"],type:"object"},format:{default:"directory",description:"Reserved; currently unused. Accepted for forward compatibility with single-file output (desktop single-file mode) — the build emits per-route directories regardless.",enum:["directory","single"],type:"string"},outDir:{default:"./dist",description:"Output directory for compiled site.",type:"string"},headers:{additionalProperties:!1,description:"Emit dist/_headers — the response headers only the build can know. Honored by "+"Cloudflare Pages/Workers assets and Netlify; on the node/bun adapters the file documents what a reverse proxy in front of them must send.",properties:{cache:{default:"auto",description:'"auto" marks the content-addressed image variants immutable (RFC 8246) and revalidates everything else (RFC 9111). "off" emits no Cache-Control at all.',enum:["auto","off"],type:"string"},enabled:{default:!0,type:"boolean"},rules:{additionalProperties:{additionalProperties:{type:"string"},type:"object"},description:"Verbatim rules, merged after the generated block.",propertyNames:{pattern:"^/"},type:"object"},security:{additionalProperties:!1,properties:{contentTypeOptions:{default:!0,type:"boolean"},csp:{default:!1,description:"CSP Level 3. Off by default: unlike the other security headers this one "+"governs code the build cannot see — a third-party script that loads a "+"second script, a widget that opens a frame — so turning it on is a change "+"to verify in the browser console, not a safe default. `script-src` is derived from the inline scripts and external origins the build emitted; `style-src` keeps 'unsafe-inline', because per-page <style> blocks and per-element style attributes have no site-wide hash.",oneOf:[{type:"boolean"},{const:"report-only"},{additionalProperties:!1,properties:{directives:{additionalProperties:{oneOf:[{type:"string"},{const:!1}]},description:"Replace (string) or remove (false) a computed directive. A replacement is wholesale, so an addition restates the defaults.",type:"object"},mode:{default:"enforce",enum:["enforce","report-only"]},reportUri:{format:"uri-reference",type:"string"}},type:"object"}]},frameOptions:{default:"SAMEORIGIN",oneOf:[{enum:["DENY","SAMEORIGIN"],type:"string"},{const:!1}]},hsts:{default:!1,description:"RFC 6797. Off by default: a wrong max-age locks the apex domain to HTTPS for that long, and the mistake is invisible until a certificate lapses. `preload` requires `includeSubDomains` and is a build error without it.",oneOf:[{type:"boolean"},{additionalProperties:!1,properties:{includeSubDomains:{default:!0,type:"boolean"},maxAge:{default:31536000,minimum:0,type:"integer"},preload:{default:!1,type:"boolean"}},type:"object"}]},permissionsPolicy:{default:"camera=(), microphone=(), geolocation=()",oneOf:[{type:"string"},{const:!1}]},referrerPolicy:{default:"strict-origin-when-cross-origin",oneOf:[{enum:["no-referrer","no-referrer-when-downgrade","origin","origin-when-cross-origin","same-origin","strict-origin","strict-origin-when-cross-origin","unsafe-url"],type:"string"},{const:!1}]}},type:"object"}},type:"object"},sitemap:{default:!0,description:"Generate sitemap.xml from the route table (requires `url`). Set false to disable.",type:"boolean"},trailingSlash:{default:"always",description:"Trailing slash behavior for generated URLs.",enum:["always","never","ignore"],type:"string"}},type:"object"},copy:{additionalProperties:{type:"string"},description:"Declarative file copy map. Keys are source paths (relative to project root), values are destination paths (relative to outDir).",type:"object"},defaults:{description:"Default settings applied to all pages unless overridden.",properties:{charset:{default:"utf8",description:"Default charset for the page.",type:"string"},dir:{description:"Base direction for the <html> element. Omitted when unset — a page's `$dir` "+"overrides it. Right-to-left content renders left-to-right without this.",enum:["ltr","rtl","auto"],type:"string"},lang:{default:"en",description:"Default lang attribute for the <html> element. A page's `$lang` overrides it.",type:"string"},layout:{default:null,description:"Default layout file path applied to all pages. Set to null to render pages without a layout.",examples:["./layouts/base.json"],oneOf:[{type:"string"},{type:"null"}]},shadow:{default:!1,description:"Default shadow-DOM mode for every component (spec.md §16.6). Off unless set: a "+"shadow root isolates component styles from the page and replaces the <slot> emulation with real slot distribution. A component's own `$shadow` overrides this in both directions.",oneOf:[{enum:["open","closed"],type:"string"},{const:!1,type:"boolean"}]}},type:"object"},extensions:{description:"Extension packages: bare package names (resolved project-first through the package exports map) or relative paths. Each must export jx-extension.json.",examples:[["@jxsuite/parser"]],items:{type:"string"},type:"array"},manifest:{additionalProperties:!1,description:'W3C Web App Manifest, emitted as manifest.webmanifest with a <link rel="manifest"> on every page. Absent means no manifest: it is a claim that a site is meant to be installed, and most are not.',properties:{backgroundColor:{type:"string"},categories:{items:{type:"string"},type:"array"},description:{type:"string"},dir:{enum:["ltr","rtl","auto"],type:"string"},display:{default:"standalone",enum:["fullscreen","standalone","minimal-ui","browser"],type:"string"},enabled:{default:!0,type:"boolean"},icons:{description:"Icons at 192px and 512px are what browsers require before offering to install the site; the build warns when either is missing.",items:{additionalProperties:!1,properties:{purpose:{type:"string"},sizes:{examples:["192x192"],type:"string"},src:{type:"string"},type:{type:"string"}},required:["src"],type:"object"},type:"array"},lang:{type:"string"},name:{description:"Defaults to the project name.",type:"string"},orientation:{type:"string"},scope:{type:"string"},shortName:{type:"string"},startUrl:{default:"/",type:"string"},themeColor:{type:"string"}},type:"object"},serviceWorker:{default:!1,description:"W3C Service Worker, emitted as sw.js. Off unless declared — a worker is sticky, so it "+"is the one output that can keep breaking visitors after a deploy tries to fix them. **Turning it off means `false`, not deleting the key**: `false` emits a tombstone at the same URL that unregisters the old worker and clears its caches, and a 404 there is not an instruction to stop. HTML is always network-first; only the content-addressed /images/_optimized/* is served cache-first.",oneOf:[{type:"boolean"},{additionalProperties:!1,properties:{enabled:{default:!0,type:"boolean"},offlineFallback:{description:"Page served for a failed navigation. Added to `precache` if not already there.",type:"string"},precache:{description:"Site-absolute URLs fetched at install time. Each must be a file this build produces; one that is not fails the build, because a single unreachable entry stops the worker installing at all.",items:{pattern:"^/",type:"string"},type:"array"},scope:{default:"/",type:"string"}},type:"object"}]},securityTxt:{additionalProperties:!1,description:"RFC 9116 security.txt, emitted at .well-known/security.txt. `expires` is required by "+"§2.5.5 and an absent or past value is a build error — an expired file advertises a "+"reporting channel while telling the reporter not to trust it. A hand-placed public/.well-known/security.txt shadows this, which is how a clearsigned file ships.",properties:{acknowledgments:{items:{type:"string"},type:"array"},canonical:{type:"string"},contact:{description:"At least one mailto:, https: or tel: URI (§2.5.3).",items:{type:"string"},type:"array"},enabled:{default:!0,type:"boolean"},encryption:{items:{type:"string"},type:"array"},expires:{format:"date-time",type:"string"},hiring:{items:{type:"string"},type:"array"},policy:{items:{type:"string"},type:"array"},preferredLanguages:{description:"BCP 47 tags, validated and canonicalized like i18n.locales.",items:{pattern:Nu,type:"string"},type:"array"}},type:"object"},i18n:{description:"Internationalization configuration.",properties:{defaultLocale:{description:"Default locale, as a BCP 47 language tag. The pattern catches shape errors (`en_US`, `en--US`); the build is the authority on well-formedness.",examples:["en"],pattern:Nu,type:"string"},locales:{description:"Available locales, as BCP 47 language tags.",examples:[["en","fr","de"]],items:{pattern:Nu,type:"string"},type:"array"},routing:{description:"Locale routing strategy.",enum:["prefix-except-default","prefix-always"],type:"string"}},type:"object"},images:{$ref:"#/$defs/ImageConfig"},imports:{additionalProperties:{type:"string"},description:"Global import map: $prototype names to .class.json file paths. Makes external classes available by name in all pages.",examples:[{Markdown:"@jxsuite/parser/Markdown.class.json",MarkdownCollection:"@jxsuite/parser/MarkdownCollection.class.json"}],type:"object"},name:{default:"Jx Site",description:"Human-readable project name.",examples:["My Portfolio","Jx Example Site"],type:"string"},redirects:{additionalProperties:{oneOf:[{description:"Destination path or URL; implies a 301.",type:"string"},{additionalProperties:!1,description:"A redirect with an explicit RFC 9110 §15.4 status.",properties:{destination:{type:"string"},status:{default:301,description:"RFC 9110 §15.4 redirection status. 307 and 308 preserve the request method; "+"301 and 302 historically do not.",enum:[...Cv],type:"integer"}},required:["destination"],type:"object"},{additionalProperties:!1,description:"A rewrite (proxy): the destination's content is served AT the source URL, with no "+"redirect. Emitted as status 200 in `_redirects`, which is the host convention — "+"not an HTTP redirection status.",properties:{destination:{type:"string"},rewrite:{const:!0,type:"boolean"}},required:["destination","rewrite"],type:"object"}]},description:"Static redirect and rewrite rules. Keys are source paths in URLPattern pathname syntax.",examples:[{"/api/*":{destination:"https://api.example.com/*",rewrite:!0},"/legacy/*":{destination:"/archive/*",status:308},"/old-about":"/about"}],propertyNames:{pattern:"^/"},type:"object"},state:{description:"Site-wide reactive state available to all pages.",type:"object"},style:{additionalProperties:{oneOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/StyleObject"}]},description:"Global CSS styles applied to the <body> element. Uses the same camelCase CSSOM convention and recursive selector/at-rule nesting as component styles.",type:"object"},url:{description:"Production URL of the deployed site.",examples:["https://example.com","https://jxsuite.com"],type:"string"}},type:"object"}});var Rg;var Ng=J(()=>{Rg={additionalProperties:!1,description:"Schema for jx-extension.json manifests. Located at the extension package root and exported so hosts can resolve <package>/jx-extension.json through the exports map.",properties:{$schema:{type:"string"},classes:{additionalProperties:{type:"string"},description:"$prototype-visible class name → class descriptor path, relative to the manifest.",type:"object"},description:{description:"One-line description.",type:"string"},name:{description:"Package name; must match package.json.",type:"string"},schemas:{additionalProperties:!1,description:"Schema fragments this package contributes, relative to the manifest.",properties:{document:{description:"Document-schema fragment (positions like $paths values).",type:"string"},fields:{description:"Field-union fragment: its $defs members are unioned into the per-project "+"field-schema resource as extension field extras (specs/extensions.md §5.3).",type:"string"},project:{description:"Project-schema fragment (top-level project.json sections).",type:"string"}},type:"object"},title:{description:"Human-readable name for studio surfaces.",type:"string"}},required:["name"],type:"object"}});var xl="https://jxsuite.com/schema/project/fields/v2",Io="https://jxsuite.com/schema/document/paths/v2",Tg,Jg,bl,Mg;var $l=J(()=>{Tg={description:"A single field definition inside a section entry schema — a small, recursive subset of "+"JSON Schema. Recursive positions reference the effective field union via the well-known fields resource $id.",properties:{default:{},description:{type:"string"},enum:{type:"array"},format:{type:"string"},items:{$ref:"https://jxsuite.com/schema/project/fields/v2"},properties:{additionalProperties:{$ref:"https://jxsuite.com/schema/project/fields/v2"},type:"object"},required:{items:{type:"string"},type:"array"},type:{enum:["string","number","integer","boolean","array","object"],type:"string"}},required:["type"],type:"object"},Jg={description:`Relationship reference field: points at a named entry of a referenceable section via "#/<sectionKey>/<name>" (specs/relationships.md). A bare reference is to-one; wrap in an array field's items for to-many.`,properties:{$ref:{pattern:"^#/[A-Za-z][A-Za-z0-9_-]*/[A-Za-z0-9._-]+$",type:"string"},description:{type:"string"}},required:["$ref"],type:"object"},bl=[{additionalProperties:!1,description:'Explicit value list: generates one page per value, bound to `param` (default "value").',properties:{param:{description:'Route parameter to fill (default "value").',type:"string"},values:{description:"The values to expand.",type:"array"}},required:["values"],type:"object"},{additionalProperties:!1,description:"JSON data-file source: loads a project-relative file that must contain an array, and generates one page per item.",properties:{$ref:{description:"Project-relative path to a .json file containing an array.",type:"string"},field:{description:'Item field providing the parameter value (default "id").',type:"string"},param:{description:'Route parameter to fill (default "id").',type:"string"}},required:["$ref"],type:"object"},{additionalProperties:!1,description:"Paged list: one route per `pageSize` items of an entry of this page's own state, which must resolve to an array at build time. The page number fills the route's one parameter that `each` does not.",properties:{each:{description:"Another `$paths` source for the route's other parameter: the list is paged once per value of it, as a paged archive per tag is.",type:["object","array"]},pageSize:{description:"Items on each page.",minimum:1,type:"integer"},paginate:{additionalProperties:!1,description:"The state entry to page.",properties:{$ref:{description:"A pointer to an entry of this page's state: `#/state/<key>`.",pattern:"^#/state/[^/]+$",type:"string"}},required:["$ref"],type:"object"}},required:["paginate","pageSize"],type:"object"},{description:"Legacy explicit form: an array of ready-made parameter objects, used as-is with no expansion. Prefer one of the source shapes above.",items:{additionalProperties:{type:"string"},type:"object"},type:"array"}],Mg={description:"A source shape contributed by an extension this schema cannot see. The project's generated document.schema.json validates these exactly; enable the owning extension and regenerate with `jx schema` to get precise checking here.",minProperties:1,type:"object"}});var Rv=J(()=>{ph();hh();bh();Sh();Eh();jh();_h();Ih();Dh();Vh();zh();Gh();Yh();eg();rg();og();vg();kg();Ag();Cg();Ng();$l()});function Nv(e,t,n){let r=e.$description;if(k(r))(Object.keys(t).length>0?t:n).$description=r}function Tv(e,t,n,r,s=y1,o={}){let i=[],a=(p,m)=>{let y={mediaQueries:t,scope:m,transposeValue:n};if(r)y.resolveValue=(S,g)=>r(S,g,m);for(let S of Pi(p,y))i.push(o.comments===!0?fl(S):S.text)},l={},c={},u=[],d=[];for(let[p,m]of Object.entries(e)){if(D(m)&&!Array.isArray(m)){if(p.startsWith("@"))u.push([p,m]);else if(!p.startsWith("--"))d.push([p,m]);continue}if(ul(p)||p.startsWith("@")||p.startsWith("$"))continue;if(p.startsWith("--")||p==="colorScheme"||p==="color-scheme")l[p]=m;else c[p]=m}Nv(e,l,c),a(l,s.root),a(c,s.body);for(let[p,m]of d)if(p.startsWith("&"))a({[p]:m},s.root);else a(m,p);for(let[p,m]of u){if(ll(p)||cl(p)){a({[p]:m},null);continue}let y={},S={},g=[];for(let[x,P]of Object.entries(m)){if(D(P)&&!Array.isArray(P)){if(!x.startsWith("@"))g.push([x,P]);continue}if(x.startsWith("$"))continue;if(x.startsWith("--"))y[x]=P;else S[x]=P}Nv(m,y,S),a({[p]:y},s.root),a({[p]:S},s.body);for(let[x,P]of g)a({[p]:P},x)}if(Object.values(t).some((p)=>fr(p)!==null)&&!("colorScheme"in e))i.push(`${s.root} { color-scheme: light dark }`,`${s.root}:where([${ur}="light"]) { color-scheme: light }`,`${s.root}:where([${ur}="dark"]) { color-scheme: dark }`);return i.join(`
|
|
130
|
+
`)}var y1;var Jv=J(()=>{dl();ce();y1={body:"body",root:":root"}});function Mv(e,t){return t===null?e:":host"}var Sl=J(()=>{dl()});function kl(e,t){let n=[];for(let[r,s]of(e.parameters??[]).entries()){let o=Iv(s);if(!o)continue;let i=Dv(s)?`_a[${r}] === undefined ? ${JSON.stringify(s.default)} : _a[${r}]`:`_a[${r}]`;n.push(`${JSON.stringify(o)}: ${i}`)}return`(..._a) => { const _args = { ${n.join(", ")} }; return ${t}; }`}function Iv(e){return k(e)?e:e?.name??""}function Dv(e){return D(e)&&"default"in e}function x1(e,t){let n=Lv(e,t);return n===e?e:`${n} as ${e}`}function Lv(e,t){let n=t?.$export;return k(n)&&n!==""?n:e}function cf(e,t,n={}){let{statePrefix:r="state",indent:s="",collect:o}=n,{url:i}=t,a=le(i),l=t.method??"GET";if(t.manual)return`${s}// ${e}: manual Request — fetch triggered by user action`;let c=[`// ${e}: auto-fetch from ${a?"(dynamic URL)":i}`,o?`${o}.push(effect(() => {`:"effect(() => {"];if(a)c.push(` const url = \`${$1(i,r)}\`;`,' if (!url || url === "undefined" || url.includes("undefined")) return;');else c.push(` const url = ${JSON.stringify(i)};`);let u=[];if(l!=="GET")u.push(`method: ${JSON.stringify(l)}`);if(t.headers)u.push(`headers: ${JSON.stringify(t.headers)}`);if(t.body){let p=D(t.body)?JSON.stringify(JSON.stringify(t.body)):JSON.stringify(t.body);u.push(`body: ${p}`)}let d=u.length>0?`, { ${u.join(", ")} }`:"";return c.push(` fetch(url${d})`," .then(r => r.ok ? r.json() : Promise.reject(r.statusText))",` .then(d => { ${r}.${e} = d; })`,` .catch(e => { ${r}.${e} = { error: String(e) }; });`,o?"}));":"});"),c.map((p)=>`${s}${p}`).join(`
|
|
131
|
+
`)}function uf(e,t,n={}){let{statePrefix:r="state",indent:s="",collect:o,serverBaseUrl:i="/_jx/server"}=n,a=JSON.stringify(`${i}/${t.$export}`),l=Object.entries(t.arguments??{}),c=l.map(([S,g])=>{if(!me(g))return`${us(S)}: ${JSON.stringify(g)}`;if(b1.some((x)=>g.$ref.startsWith(x)))throw Error(`Server function "${e}": argument "${S}" references "${g.$ref}", which a state entry cannot read. Use a #/state/, parent#/, window#/ or document#/ reference.`);return`${us(S)}: ${fs({$ref:g.$ref},{statePrefix:r})}`}),u=l.some(([,S])=>me(S)),d=`${Qv}(${a}, ${c.length>0?`{ ${c.join(", ")} }`:"{}"})`,p=Re(r,Wt(e)),m=`console.error(${JSON.stringify(`Jx server function ${t.$export}:`)}, e)`;return(u?[`// ${e}: server function ${t.$export}, called again when an argument changes`,"{"," let _jxSeq = 0;",o?` ${o}.push(effect(() => {`:" effect(() => {"," const _seq = ++_jxSeq;",` ${d}`,` .then((d) => { if (_seq === _jxSeq) ${p} = d; })`,` .catch((e) => { if (_seq === _jxSeq) ${m}; });`,o?" }));":" });","}"]:[`// ${e}: server function ${t.$export}, called once`,d,` .then((d) => { ${p} = d; })`,` .catch((e) => { ${m}; });`]).map((S)=>`${s}${S}`).join(`
|
|
132
|
+
`)}function $1(e,t){if(t==="state")return e;return e.replaceAll(/\$\{([^}]*)\}/g,(n,r)=>`\${${r.replaceAll(/(?<!this\.)\bstate\./g,`${t}.`)}}`)}function Pl(e){return`<script type="importmap">
|
|
133
|
+
{
|
|
134
|
+
"imports": {
|
|
135
|
+
${Object.entries(e).map(([n,r])=>` ${JSON.stringify(n)}: ${JSON.stringify(r)}`).join(`,
|
|
136
|
+
`)}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
</script>`}function Ii(e){if(e.runtimeImports!==void 0)return Pl(e.runtimeImports);let t={"@vue/reactivity":e.reactivitySrc,"lit-html":e.litHtmlSrc};return Pl(e.litHtmlSrc===Nr?{...t,"lit-html/":`${Nr}/`}:t)}function ff(e,t){let n=t.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`),r=String.raw`\bstate${vl}\??\.${vl}${n}(?![\w$])`,s="(?:\\\\\"|['`])",o=String.raw`\bstate${vl}(?:\?\.)?\[${vl}${"(?:\\\\\"|['`])"}${n}${"(?:\\\\\"|['`])"}`,i=String.raw`#/state/${n}(?=["/])`;return new RegExp(`${r}|${o}|${i}`).test(e)||S1.test(e)}function df(e,t){let n=Qm(t),r=e.state??{},s=Object.keys(n).filter((c)=>!(c in r));if(s.length===0)return e;let o=JSON.stringify(e),i=Object.values(r).some((c)=>D(c)&&!Array.isArray(c)&&k(c.$src)),a=new Set(s.filter((c)=>i||ff(o,c)));for(let c of a)for(let u of Zm(n[c]))if(!(u in r))a.add(u);if(a.size===0)return e;let l=Object.fromEntries(s.filter((c)=>a.has(c)).map((c)=>[c,n[c]]));return{...e,state:{...l,...r}}}function w1(e){let t=Object.fromEntries(Object.entries(e.state??{}).filter(([,n])=>!Mo(n)));return JSON.stringify({...e,state:t})}function pf(e){if(k(e))return le(e);if(!D(e))return!1;if(e.state){let n;for(let[r,s]of Object.entries(e.state)){if(r==="$site"||r==="$page")continue;if(!D(s)||Array.isArray(s))return!0;if(s.timing==="compiler")continue;if(Mo(s)){if(n??=w1(e),ff(n,r))return!0;continue}if(s.$prototype)return!0;if("default"in s)return!0;if($s(s))continue;return!0}}if(e.$switch)return!0;if(Le(e)||Lb(e.children))return!0;if(Array.isArray(e.children)&&e.children.some((n)=>pf(n)))return!0;let t=Di(e);for(let[n,r]of Object.entries(e)){if(pr.has(n)||t&&n==="innerHTML")continue;if(me(r))return!0;if(le(r))return!0}if(D(e.style)){for(let n of Object.values(e.style))if(le(n))return!0}if(D(e.attributes)){for(let n of Object.values(e.attributes))if(le(n))return!0}return!1}function Di(e){return e.$static===!0||e.$prerendered===!0}function Li(e,t=null,n={},r={}){let s=e?.state?Do(e.state,t):t??of();return{media:r,scope:s,scopeDefs:n}}function of(e=null){return Object.create(e)}function Fg(e){return e[Fv]}function Vg(e,t){return Fg(e)?.has(t)??!1}function Ol(e,t){if(!e.startsWith("#/state/"))return!1;let[n=""]=e.slice(8).split("/");return Vg(t,n.replaceAll("~1","/").replaceAll("~0","~"))}function Lg(e,t,n){if(t>0&&j1.test(e.charAt(t-1)))return!1;let r=t+5;if(n)return!P1.test(e.charAt(r));while(/\s/u.test(e.charAt(r)))r+=1;return e.charAt(r)==="."}function Vv(e){for(let t=e.indexOf("state");t!==-1;t=e.indexOf("state",t+1))if(Lg(e,t,!0)&&!Lg(e,t,!1))return!0;return!1}function Fi(e,t,n={}){if(!e.includes("state"))return e;let r=n.bare===!0,s=n.code===!1?e:po(e),o="",i=0;for(let a=s.indexOf("state");a!==-1;a=s.indexOf("state",a+1))if(Lg(s,a,r))o+=e.slice(i,a)+t,i=a+5;return o+e.slice(i)}function af(e,t){if(k(e)){if(!e.includes("state."))return;let o=po(e);for(let i of o.matchAll(v1))t.add(i[1]);for(let i of o.matchAll(E1))t.add(i[1]);return}if(Array.isArray(e)){for(let o of e)af(o,t);return}if(!D(e))return;let n=e,{operator:r,target:s}=n;if(k(r)&&dr(r)&&me(s)&&s.$ref.startsWith("#/state/"))t.add(s.$ref.slice(8).split("/")[0]);for(let o of Object.values(n))af(o,t)}function sf(e,t){for(let n of Bi(e)){if(Le(n)){sf(n.map?[n.map]:[],t);continue}if(!Ot(n))continue;for(let[r,s]of Object.entries(n))if(r.startsWith("on")&&(kt(s)||fn(s)))af(s.body??s.$expression,t);sf(Object.values(n.cases??{}).filter((r)=>Ot(r)&&!Xe(r)),t),sf(n.children,t)}}function ps(e,t){if(kt(t)&&fm(t))throw Error(`${e} declares both "body" and "$src"; they are mutually exclusive (spec.md §5.3 4d). Keep one.`)}function mf(e,t){let n={eager:new Map,lazy:new Map};for(let[r,s]of Object.entries(e)){if(ps(`state entry "${r}"`,s),!kt(s)||!s.$src)continue;if(s.$lazy===!0){if(t.get(r)==="computed")throw Error(`"${r}" declares "$lazy": true but is used as a computed value, not called. A lazily loaded function resolves to a promise; a computed must resolve now. Remove "$lazy", or call ${r}() from a handler instead of binding its value.`);let i=n.lazy.get(s.$src);if(!i)i=[],n.lazy.set(s.$src,i);i.push({binding:r,exportName:Lv(r,s)});continue}let o=n.eager.get(s.$src);if(!o)o=new Set,n.eager.set(s.$src,o);o.add(x1(r,s))}return n}function hf(e,t){let n=[];for(let[o,i]of e.eager)n.push(`import { ${[...i].join(", ")} } from '${t?t(o):o}';`);let r=[],s=0;for(let[o,i]of e.lazy){let a=`_jxLazy${s}`;s+=1,r.push(`let ${a};`,`const ${a}Load = () => (${a} ??= import('${t?t(o):o}'));`,...i.map(({binding:l,exportName:c})=>`const ${l} = (...args) => ${a}Load().then((m) => m.${c}(...args));`))}return{imports:n,loaders:r}}function Do(e={},t=null,n={}){let r=of(t),s=t?Fg(t):void 0,o=new Set(s);if(Object.defineProperty(r,Fv,{configurable:!0,enumerable:!1,value:o,writable:!0}),n.holdMutable===!0){let d=new Set;for(let p of Object.values(e))if(kt(p)||fn(p))af(p.body??p.$expression,d);if(n.document)sf([n.document],d);for(let p of d)if(p in e)o.add(p)}let i=Or({state:e});for(let[d,p]of Object.entries(e)){if(!D(p)||Array.isArray(p)){ds(r,d,rf(p));continue}if("default"in p){ds(r,d,rf(p.default));continue}if(Zr(p)){o.add(d);continue}if(!p.$prototype&&!("$expression"in p)&&!$s(p))ds(r,d,rf(p))}let a=[],l=[],c=[];for(let[d,p]of Object.entries(e)){if(le(p)){a.push([d,p]);continue}if(!D(p))continue;if(fn(p)){let m=p.$expression;if(c.push([d,JSON.stringify(m)]),wr(p)){let y=p.parameters;ds(r,d,(...S)=>{let g={};for(let[x,P]of y.entries()){let w=Iv(P);if(!w)continue;g[w]=S[x]===void 0&&Dv(P)?P.default:S[x]}return Nn(m,r,null,{args:g})})}else if(dr(m.operator))ds(r,d,(y,S)=>Nn(m,y,S));else Ig(r,d,()=>Nn(m,r,null));continue}if(kt(p)){if(ps(`state entry "${d}"`,p),vr(p)){let{body:m}=p;c.push([d,JSON.stringify(m)]),ds(r,d,(y,S)=>{Ci(m,y??r,S??null)})}else if(k(p.body)){let{body:m}=p,y=Function(...kr(p),m);if(i.get(d)==="computed")Ig(r,d,()=>y(r)),l.push([d,m]);else ds(r,d,y),c.push([d,m])}else ds(r,d,()=>{}),o.add(d);continue}if(Pn(p)&&(p.$prototype==="LocalStorage"||p.$prototype==="SessionStorage")){ds(r,d,rf(p.default??null));continue}if(Pn(p)&&p.$prototype==="Request")o.add(d);if(Hi(p))o.add(d)}let u=!0;while(u){u=!1;for(let[d,p]of[...l,...a])if(!o.has(d)&&Hv(p,r))o.add(d),u=!0;for(let[d,p]of c)if(!o.has(d)&&_1(p,o))o.add(d),u=!0}for(let[d,p]of a)Ig(r,d,()=>Gt(p,r));return r}function ds(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0})}function Ig(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:n})}function tt(e,t){if(me(e))return qv(e.$ref,t);if(le(e))return Gt(e,t);return e}function Xe(e){return me(e)}function qv(e,t){if(!k(e))return e;let n=sn(e);if(n.startsWith("$map/")){let r=n.split("/"),s=r[1],i=t.$map?.[s]??t[`$map/${s}`];return r.length>2?Dg(i,r.slice(2).join("/")):i}if(e.startsWith("#/state/"))return Dg(t,e.slice(8));return Dg(t,e)??null}function Hv(e,t){if(!t)return!1;let n=Fg(t);for(let r of e.matchAll(/\bstate\.([A-Za-z_$][\w$]*)\s*(\()?/g)){if(r[2])continue;let s=r[1];if(n?.has(s))return!0;let o;try{o=t[s]}catch{continue}if(_t(o))return!0}return!1}function _1(e,t){for(let n of e.matchAll(/#\/state\/([^"/\\]+)|\bstate\.([A-Za-z_$][\w$]*)/g)){let[,r,s]=n,o=r===void 0?s:r.replaceAll("~1","/").replaceAll("~0","~");if(o!==void 0&&t.has(o))return!0}return!1}function gf(e){return Ji(e)?`(${e.slice(2,-1)})`:`\`${e}\``}function Gt(e,t){if(Hv(e,t))return null;let n=["state","$map","$site","$page"],r=[t,t?.$map,t?.$site,t?.$page],s=t?.$map;if(D(s)&&!Array.isArray(s)){n.push("item","index");let o=s;r.push(o.item,o.index)}try{let o=Ji(e)?`return (${e.slice(2,-1)})`:`return \`${e}\``;return Function(...n,o)(...r)}catch{return null}}function Dg(e,t){return Bt(e,t)}function rf(e){if(!D(e))return e;return structuredClone(e)}function k1(e,t){if(!e||!t)return"";return Object.entries(e).filter(([n,r])=>!n.startsWith(":")&&!n.startsWith(".")&&!n.startsWith("&")&&!n.startsWith("[")&&!n.startsWith("@")&&le(r)).map(([n,r])=>{let s=tt(r,t);return s==null?null:`${hn(n)}: ${s}`}).filter(Boolean).join("; ")}function qg(e,t){if(!k(t)&&!Ie(t)&&!Ge(t))return null;if(e.kind==="text")return String(t);if(e.kind==="hidden"){if(k(t)&&t.toLowerCase()==="until-found")return"until-found";return t?"":null}let n=Boolean(t);if(e.keywords)return e.keywords[n?0:1];return Rr(e.attribute,n)}function Bv(e,t){if(me(e)&&(t===null||Ol(e.$ref,t)))return;try{return tt(e,t)}catch{return}}function wl(e,t,n){return n&&t===""?` ${e}`:` ${e}="${Ne(t)}"`}function Lo(e,t,n=""){let r=Il(e.tagName,t),s=new Map,o,i=tt(e.id,t);if(i)s.set("id",wl("id",String(i),!1));let a=Jl(e),l=a?tt(Ml(e),t):null,c=[k(l)||Ie(l)?String(l):"",Js(e)??""].filter((S)=>S!=="").join(" ");if(c)s.set("class",wl("class",c,!1));let u=(S,g)=>{if(g===void 0)return;let x=Bu(r,S);if(!x)return;let P=Bv(g,t);if(x.live&&P!==void 0)o??=new Set,o.add(x.attribute);let w=qg(x,P);if(w!==null)s.set(x.attribute,wl(x.attribute,w,x.kind!=="text"))};for(let S of Wv)u(S,e[S]);let d=e;for(let S of Object.keys(d)){if(A1.has(S)||S.startsWith("$")||S.startsWith("on")||ch(r,S))continue;u(S,d[S])}let p="";if(e.attributes)for(let[S,g]of Object.entries(e.attributes)){if(a&&S==="class")continue;let x=tt(g,t),P=null;if(Ge(x)){let E=Rr(S,x);P=E===null?null:wl(S,E,!0)}else if(k(x)||Ie(x))P=wl(S,String(x),!1);let w=S.toLowerCase();if(o?.has(w))continue;if(s.has(w)){if(P===null&&(x===null||x===void 0||Ge(x)))s.delete(w);else if(P!==null)s.set(w,P);continue}p+=P??""}let m="";for(let S of s.values())m+=S;let y=[k1(e.style,t),n].filter(Boolean).join("; ");if(y)m+=` style="${Ne(y)}"`;if(m+=p,e.$static)m+=" data-jx-static";else if(e.$prerendered)m+=" data-jx-prerendered";return m}function Al(e,t,n){if(Di(e))return;if(!(("innerText"in e)||("value"in e)||("defaultValue"in e)||("text"in e)))return;for(let[r,s]of Object.entries(e)){if(s===void 0||!ch(t,r))continue;let o=Bv(s,n),i=o===null||o===void 0?"":Ne(String(o));return r==="innerText"?i.replaceAll(/\r\n|\r|\n/gu,"<br>"):i}return}function Cl(e,t=" "){return e?"":`
|
|
140
|
+
${t}`}function Vi(){let e=JSON.stringify(Mu),t=JSON.stringify(ur);return`(function(){try{var s=localStorage.getItem(${e});if(s==="light"||s==="dark"){document.documentElement.setAttribute(${t},s)}}catch(e){}})()`}function Uv(e,t,n,r,s={}){for(let o of Pi(t,{...s,mediaQueries:r,resolveValue:(i,a)=>zv(i,a,n),scope:n}))e.push(fl(o))}function zv(e,t,n){let r=k(t)?t:t.$ref;return C1.push({property:e,selector:n,source:r}),null}function yf(){return`const __jxEnumAttrs = new Set(${JSON.stringify(jv())});
|
|
141
|
+
function ${Vo}(n, v) {
|
|
133
142
|
if (typeof v !== 'boolean') return v;
|
|
134
143
|
const l = n.toLowerCase();
|
|
135
144
|
if (l.startsWith('aria-') || __jxEnumAttrs.has(l)) return String(v);
|
|
136
145
|
return v ? '' : null;
|
|
137
|
-
}`}function
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
146
|
+
}`}function xf(e){let t={keyed:!1,arranged:!1},n=(r)=>{for(let s of Bi(r)){if(Le(s)){t.arranged||=me(s.filter)||me(s.sort),t.keyed||=me(s.key),n(s.map?[s.map]:[]);continue}if(!Ot(s))continue;n(Object.values(s.cases??{}).filter((o)=>Ot(o)&&!Xe(o))),n(s.children)}};return n([e]),t}function Hg(e,t){for(let r of[e.items,e.filter,e.sort])if(me(r)&&Ol(r.$ref,t))return!1;let n=(r)=>{for(let s of Bi(r)){if(Le(s)){if(!Hg(s,t))return!1;continue}if(!Ot(s))continue;let o=Object.values(s.cases??{}).filter((i)=>Ot(i)&&!Xe(i));if(!n(o)||!n(s.children))return!1}return!0};return n(e.map?[e.map]:[])}function qo(e){let{items:t}=e;if(le(t))throw Error(`A repeater's items must be a $ref or a literal array, not the template string ${JSON.stringify(t)}. A template is not read as a list: bind items to a state entry by $ref, and compute the list in that entry.`)}function bf(e){let t=sn(e);if(t==="$map/item")return[];return t.startsWith("$map/item/")?Un(t.slice(10)):null}function $f(){return`function ${qi}(items, filter, sort) {
|
|
147
|
+
if (!Array.isArray(items)) return [];
|
|
148
|
+
let list = items;
|
|
149
|
+
if (typeof filter === 'function') list = list.filter(filter);
|
|
150
|
+
if (typeof sort === 'function') list = [...list].sort(sort);
|
|
151
|
+
return list;
|
|
152
|
+
}
|
|
153
|
+
function ${Kv}(list, path, pointer, warn) {
|
|
154
|
+
const keys = list.map((item, index) => {
|
|
155
|
+
if (pointer === null) return index;
|
|
156
|
+
if (path === null) {
|
|
157
|
+
`+' warn(`key "${pointer}" is not a $map/item pointer — rows fall back to their index`);\n'+` return index;
|
|
158
|
+
}
|
|
159
|
+
if (path.length === 0) return item;
|
|
160
|
+
let key = item;
|
|
161
|
+
for (const name of path) key = key?.[name];
|
|
162
|
+
if (key === undefined || key === null) {
|
|
163
|
+
`+' warn(`key "${pointer}" is empty for some items — those rows fall back to their index`);\n'+` return index;
|
|
164
|
+
}
|
|
165
|
+
return key;
|
|
166
|
+
});
|
|
167
|
+
const seen = new Set();
|
|
168
|
+
for (let i = 0; i < keys.length; i++) {
|
|
169
|
+
if (seen.has(keys[i])) {
|
|
170
|
+
`+" warn(`duplicate key ${String(keys[i])} — every occurrence after the first is rebuilt on each change`);\n"+` keys[i] = { duplicate: i };
|
|
171
|
+
} else {
|
|
172
|
+
seen.add(keys[i]);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return keys;
|
|
176
|
+
}`}function wf(){return["class __JxKeyedList extends AsyncDirective {"," #args = null;"," #runner = null;"," #queued = false;"," #warned = false;"," #snap = shallowRef({ list: [], keys: [] });"," #warn = (message) => {"," if (this.#warned) return;"," this.#warned = true;"," console.warn(`Jx $map: ${message}`);"," };"," #compute = () => {"," const [items, filter, sort, path, pointer] = this.#args;",` const list = Array.from(${qi}(items, filter, sort));`,` this.#snap.value = { list, keys: ${Kv}(list, path, pointer, this.#warn) };`," };"," #schedule = () => {"," if (this.#queued) return;"," this.#queued = true;"," queueMicrotask(() => {"," this.#queued = false;"," if (this.#runner) this.#runner();"," });"," };"," #start(lazy) {"," this.#runner = effect(this.#compute, { lazy, scheduler: this.#schedule });"," if (lazy) this.#schedule();"," }"," render() {}"," update(_part, args) {"," const previous = this.#args;"," this.#args = args;"," if (!this.#runner) {"," if (this.isConnected) this.#start(false);"," } else if (previous[0] !== args[0] || previous[1] !== args[1] || previous[2] !== args[2]) {"," this.#schedule();"," }"," const snap = this.#snap.value;"," return repeat(snap.list, (_item, index) => snap.keys[index], args[5]);"," }"," disconnected() {"," if (this.#runner) stop(this.#runner);"," this.#runner = null;"," }"," reconnected() {"," if (!this.#runner && this.#args) this.#start(true);"," }","}",`const ${Nl} = directive(__JxKeyedList);`,"const __jxLiterals = new Map();",`function ${Rl}(text) {`," if (!__jxLiterals.has(text)) __jxLiterals.set(text, JSON.parse(text));"," return __jxLiterals.get(text);","}"].join(`
|
|
177
|
+
`)}function Gv(){return[`function ${Wg}(el, k) {`," if (Object.hasOwn(el, k)) return true;"," if (el.hasAttribute(k)) return true;"," const kebab = k.replace(/[A-Z]/g, (c) => '-' + c.toLowerCase());"," return kebab !== k && el.hasAttribute(kebab);","}",`function ${Bg}(el, k) {`," for (let p = Object.getPrototypeOf(el); p; p = Object.getPrototypeOf(p)) {"," const d = Object.getOwnPropertyDescriptor(p, k);"," if (d) return d.set;"," }"," return undefined;","}"].join(`
|
|
178
|
+
`)}function Xv(){return[`function ${vf}(state, name, value, defaults) {`," const key = name.replace(/-([a-z])/g, (_, c) => c.toUpperCase());"," if (defaults && defaults.has(key) && defaults.get(key) === undefined) return;"," const current = state[key];"," if (typeof current === 'boolean') {"," state[key] = value !== null && value !== 'false';"," return;"," }"," if (value === null) {"," const declared = defaults ? defaults.get(key) : undefined;"," state[key] = declared === undefined ? (typeof current === 'number' ? 0 : '') : declared;"," return;"," }"," state[key] = typeof current === 'number' ? Number(value) : value;","}"].join(`
|
|
179
|
+
`)}function Yv(e){return Qo(e)}function Tl(e){let{observedAttributes:t}=e;return Array.isArray(t)?t.filter((n)=>k(n)):[]}function Zv(e){let t=ih(e),n=new Set(Tl(e).map((s)=>Yv(s)));return`new Map([${[...t].flatMap(([s,o])=>n.has(s)?[`[${JSON.stringify(s)}, ${o===void 0?"undefined":JSON.stringify(o)}]`]:[]).join(", ")}])`}function Ef(){return[`async function ${Qv}(url, args) {`," const r = await fetch(url, {"," method: 'POST',"," headers: { 'Content-Type': 'application/json' },"," body: JSON.stringify(args),"," });"," const text = await r.text();"," let body = null;"," if (text !== '') {"," try { body = JSON.parse(text); } catch (e) { if (r.ok) throw e; }"," }"," if (!r.ok) throw new Error((body && body.error) || text || r.statusText);"," return body;","}"].join(`
|
|
180
|
+
`)}function Ug(e){let t={};for(let[n,r]of Object.entries(e))if(!R1.has(n)&&r!==void 0)t[n]=r;return t}function zg(e){return Pn(e)&&!N1.has(e.$prototype)}function Hi(e){return zg(e)&&e.timing==="client"}function jf(){return[`async function ${e0}(C, name, config) {`,` if (typeof C !== 'function') throw new TypeError('Jx: "' + name + '" is not a class');`," const i = new C(config);"," const v = typeof i.resolve === 'function' ? await i.resolve() : 'value' in i ? i.value : i;"," return [v, i];","}"].join(`
|
|
181
|
+
`)}function Pf(e,t){let n=[],r=new Map;for(let[s,o]of Object.entries(e)){if(!Hi(o))continue;if(t===void 0)throw Error(`"${s}": external class "${o.$prototype}" with timing "client" compiles only in a site build`);let i=t(o),a=r.get(i);if(a===void 0)a=`_JxClass${r.size}`,r.set(i,a);n.push({binding:a,config:Ug(o),key:s,name:o.$prototype})}return{entries:n,imports:[...r].map(([s,o])=>`import ${o} from '${s}';`)}}function _f(e,t){let{indent:n,instances:r,statePrefix:s}=t,o=["Promise.all(["];for(let{binding:i,config:a,key:l,name:c}of e){let u=Re(s,Wt(l)),d=JSON.stringify(l);o.push(`${n} ${e0}(${i}, ${JSON.stringify(c)}, ${JSON.stringify(a)}).then(([v, i]) => {`,`${n} ${u} = v;`,`${n} ${r}.set(${d}, i);`,`${n} if (typeof i.subscribe === 'function') i.subscribe((n) => { ${u} = n; });`,`${n} }).catch((e) => { console.error(${JSON.stringify(`Jx: external class "${l}" failed`)}, e); }),`)}return o.push(`${n}])`),o.join(`
|
|
182
|
+
`)}function t0(){return[`function ${Kg}(host, internals, state, keys, root, formValue, watch) {`," const initial = { checked: state.checked, value: state.value };"," let ownDisabled = state.disabled;"," let forced = false;"," const control = () => root().querySelector('input, textarea, select');"," const mayBeLabelled = () => {"," if (host.closest('label')) return true;"," const id = host.id;"," if (id === '') return false;"," const tree = host.getRootNode();"," const scope = tree instanceof DocumentFragment ? tree : host.ownerDocument;"," return Array.from(scope.querySelectorAll('label[for]'))"," .some((label) => label.getAttribute('for') === id);"," };"," const nameControl = () => {"," if (!mayBeLabelled()) return;"," const target = control();"," const labels = internals.labels;"," if (target && labels.length > 0 && 'ariaLabelledByElements' in target &&"," !target.hasAttribute('aria-label') && !target.getAttribute('aria-labelledby')) {"," target.ariaLabelledByElements = Array.from(labels).filter((l) => l instanceof Element);"," }"," };"," host.addEventListener('click', (event) => {"," const target = control();"," if (event.target !== host || !target || target.disabled) return;"," target.focus();"," if (target.type === 'checkbox' || target.type === 'radio') target.click();"," });"," host.addEventListener('focusin', nameControl);"," const valueMissingMessage = () => {"," const probe = host.ownerDocument.createElement('input');"," probe.required = true;"," if (keys.checked) probe.type = 'checkbox';"," return probe.validationMessage || 'Please fill out this field.';"," };"," return {"," disabled(flag) {"," if (!keys.disabled) return;"," if (flag) {"," if (!forced) { ownDisabled = host.hasAttribute('disabled') ? false : state.disabled; forced = true; }"," state.disabled = true;"," } else if (forced) {"," forced = false;"," state.disabled = ownDisabled;"," }"," },"," reset() {"," if (keys.value) state.value = initial.value;"," if (keys.checked) state.checked = initial.checked;"," },"," start() {"," if (formValue) {"," watch(() => {"," const value = formValue();"," if (value === null || value === undefined) internals.setFormValue(null);"," else if (value instanceof File || value instanceof FormData) internals.setFormValue(value);"," else internals.setFormValue(String(value));"," });"," }"," if (keys.required) {"," watch(() => {"," const empty = keys.checked"," ? !state.checked"," : state.value === null || state.value === undefined || state.value === '';"," if (state.required && empty) {"," internals.setValidity({ valueMissing: true }, valueMissingMessage(), control() ?? undefined);"," } else {"," internals.setValidity({});"," }"," });"," }"," nameControl();"," },"," };","}"].join(`
|
|
183
|
+
`)}function n0(){let e=`new RegExp(${JSON.stringify(qu.source)}, ${JSON.stringify(qu.flags)})`,t=`Symbol.for(${JSON.stringify(lh)})`,n=JSON.stringify(ml),r=JSON.stringify(Hu);return[`const __jxSlotWs = ${e};`,`const __jxSlotRec = globalThis[${t}] || (globalThis[${t}] = new WeakMap());`,`function ${Gg}(host) {`,` const id = host.getAttribute(${n});`," if (id === null) return Array.from(host.childNodes);",` host.removeAttribute(${n});`,` const open = ${r} + ' ' + id + ' ';`,` const close = '/' + ${r} + ' ' + id;`," const openers = [];"," const w = host.ownerDocument.createTreeWalker(host, 128);"," for (let n = w.nextNode(); n; n = w.nextNode()) if (n.data.startsWith(open)) openers.push(n);"," const out = [];"," for (const o of openers) {"," const name = decodeURIComponent(o.data.slice(open.length));"," for (let n = o.nextSibling; n; n = n.nextSibling) {"," if (n.nodeType === 8 && n.data === close) break;"," __jxSlotRec.set(n, name);"," out.push(n);"," }"," }"," return out;","}",`function ${Xg}(host, captured) {`," const slots = Array.from(host.querySelectorAll('slot'));"," if (slots.length === 0) return;"," const groups = new Map();"," for (const n of captured) {"," if (n.nodeType === 3 && __jxSlotWs.test(n.data)) continue;"," const r = __jxSlotRec.get(n);"," __jxSlotRec.delete(n);"," const name = r !== undefined ? r : n.nodeType === 1 ? n.getAttribute('slot') || '' : '';"," let g = groups.get(name);"," if (!g) { g = []; groups.set(name, g); }"," g.push(n);"," }"," const taken = new Set();"," for (const slot of slots) {"," const name = slot.getAttribute('name') || '';"," let g = [];"," if (!taken.has(name)) { taken.add(name); g = groups.get(name) || []; }"," const content = g.some((n) => n.nodeType === 1 || (n.nodeType === 3 && n.data !== ''));"," const placed = content ? g : g.concat(Array.from(slot.childNodes));"," const p = slot.parentElement;"," if (p && p !== host && p.localName.includes('-')) {"," const r = __jxSlotRec.get(slot);"," const f = r !== undefined ? r : slot.getAttribute('slot') || '';"," for (const n of placed) __jxSlotRec.set(n, f);"," }"," slot.replaceWith(...placed);"," }","}"].join(`
|
|
184
|
+
`)}function Ns(e){for(let t of Bi(e)){if(Le(t)){if(t.map&&Ns([t.map]))return!0;continue}if(!Ot(t))continue;if(t.tagName==="slot")return!0;let n=Object.values(t.cases??{}).filter((r)=>Ot(r)&&!Xe(r));if(Ns(n)||Ns(t.children))return!0}return!1}function Bi(e){if(Le(e))return[e];if(!Array.isArray(e))return[];return e}function Ui(e,t={},n=null){let r=[],s=Tv(D(n)?n:{},t,(i)=>i,zv,void 0,{comments:!0});if(s!=="")r.push(s);if(Af(e,r,t,"",{n:0}),r.length===0)return"";return`<style>
|
|
185
|
+
${kf(r.join(`
|
|
141
186
|
`))}
|
|
142
|
-
</style>`}function
|
|
143
|
-
${
|
|
144
|
-
`);return""}function
|
|
145
|
-
`)
|
|
146
|
-
|
|
147
|
-
|
|
187
|
+
</style>`}function kf(e){return e.replaceAll(/<\/(?=style)/gi,String.raw`<\/`)}function Js(e){return e[r0]}function s0(e,t,n){let r=Js(e);if(r!==void 0)return r;let s=`${n}-${t.n}`;return t.n+=1,e[r0]=s,s}function Of(e){let{children:t}=e;if(Array.isArray(t))return t;return Le(t)?[t]:[]}function jl(e,t){if(!D(e))return;if(Le(e)){if(e.map)jl(e.map,t);return}t(e);for(let n of Of(e))jl(n,t);if(D(e.cases))for(let n of Object.values(e.cases))jl(n,t)}function o0(e,t,n){jl(e,(r)=>{if(r.style)s0(r,t,n)})}function Jl(e){return Js(e)!==void 0||Boolean(e.className)}function Ml(e){let{attributes:t}=e;return D(t)&&Object.hasOwn(t,"class")?t.class:e.className}function Af(e,t,n,r="",s,o="jx",i={}){let a=s??{n:0};jl(e,(l)=>{if(l.style)Uv(t,l.style,`.${s0(l,a,o)}`,n,i)})}function Ne(e){return String(e).replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}function Ms(e){return e.split("-").map((t)=>t.charAt(0).toUpperCase()+t.slice(1)).join("")}function i0(e){let t=new Set;return a0(e,t),[...t]}function a0(e,t){if(!D(e))return;if(e.state){for(let n of Object.values(e.state))if(kt(n)&&n.$src)t.add(n.$src)}if(Array.isArray(e.children))for(let n of e.children)a0(n,t)}function l0(e){let t=[];return c0(e,t),t}function c0(e,t){if(!D(e))return;if(e.state){for(let[n,r]of Object.entries(e.state))if(Zr(r))t.push({exportName:r.$export,key:n,src:r.$src})}if(Array.isArray(e.children))for(let n of e.children)c0(n,t)}function Il(e,t){if(k(e))return e;let n=Yo(e);if(n.length===0)return"div";if(!rr(e))return n[0];let r=e.$expression,s=r.target;if(r.operator==="?:")return tt(s,t)?r.value:r.initial;let o=tt(s,t);return r.cases[String(o)]??r.default}function Zg(e){if(!e?.slotIds)return null;return e.slotIds.n+=1,e.slotIds.n}function Qg(e,t,n,r=null){let s=new Map;for(let o of Bi(e)){let i="",a=!0,l;if(k(o)||Ie(o)||Ge(o)){if(l=n(o),qu.test(l))continue;a=l!==""}else if(Le(o))l=n(o);else if(!Ot(o))l=n(o),a=l!=="";else{let u=tt(o.attributes?.slot,t),d=k(o.slot)?tt(o.slot,t):null;if(k(u)&&u!=="")i=u,l=n(o);else if(k(d)&&d!==""){i=d;let{slot:p,...m}=o;l=n({...m,attributes:{...m.attributes,slot:d}})}else l=n(o)}let c=s.get(i);if(c)c.html=c.html===""?l:`${c.html}
|
|
188
|
+
${l}`,c.content||=a;else s.set(i,{content:a,html:l})}return{groups:s,id:r,taken:new Set}}function u0(e,t,n){for(let r of Bi(e)){if(Le(r)||!Ot(r))continue;if(r.tagName==="slot"){let s=tt(r.attributes?.name,t);n.taken.add(k(s)?s:"")}u0(r.children,t,n)}}function ey(e){let t=null,n={};for(let[r,s]of Object.entries(e??{}))if(r.startsWith("props.")&&r.length>6)t??={},t[r.slice(6)]=s;else n[r]=s;return{lifted:t,rest:n}}function Dl(e,t){if(!t)return Do(e.state??{},null);let n={...e.state};for(let[r,s]of Object.entries(t)){let o=n[r];n[r]=D(o)&&!Array.isArray(o)&&"default"in o?{...o,default:s}:s}return Do(n,null)}function ty(e,t,n){let r=Tl(e).filter((a)=>Object.hasOwn(t??{},a));if(!t||r.length===0)return null;let s=ih(e),o=Dl(e,null),i=null;for(let a of r){let l=tt(t[a],n),c=null;if(Ge(l))c=Rr(a,l);else if(k(l)||Ie(l))c=String(l);let u=Yv(a);if(c===null||s.has(u)&&s.get(u)===void 0)continue;_v(o,a,c,s),i??={},i[u]=o[u]}return i}function ny(e,t){let n={};for(let[r,s]of Object.entries(e??{})){if(me(s)&&Ol(s.$ref,t))continue;let o;try{o=tt(s,t)}catch{continue}if(k(o)||Ie(o)||Ge(o))n[r]=o}return n}function ry(e,t){return Object.fromEntries(Object.entries(e??{}).flatMap(([n,r])=>{if(!le(r))return[];let s=tt(r,t);return s==null?[]:[[n,s]]}))}function _l(e,t,n,r,s=!1){if(e.textContent!==void 0){let i=tt(e.textContent,t);return i!=null?Ne(String(i)):""}if(e.innerHTML){let i=tt(e.innerHTML,t);return i!=null?String(i):e.innerHTML}let o=Al(e,Il(e.tagName,t),t);if(o!==void 0)return o;if(Le(e.children))return f0(e.children,t,n,r,s);if(Array.isArray(e.children))return e.children.map((i)=>Fo(i,t,n,r,s)).join(s?"":`
|
|
189
|
+
`);return""}function f0(e,t,n=null,r=null,s=!1){let o=e.map;if(!o)return"";qo(e);let i=t??of(),a=sy(e,i);if(a===null)return"";return a.map((l,c)=>{let u=of(i);return u.$map={index:c,item:l},u["$map/item"]=l,u["$map/index"]=c,Fo(o,u,n,r,s)}).join(s?"":`
|
|
190
|
+
`)}function sy(e,t){let n=(r)=>me(r)?qv(r.$ref,t):void 0;for(let r of[e.items,e.filter,e.sort])if(me(r)&&Ol(r.$ref,t))return null;try{let r=me(e.items)?n(e.items):e.items;if(!Array.isArray(r))return null;return Pv(r,n(e.filter),n(e.sort))}catch{return null}}function Fo(e,t,n=null,r=null,s=!1){if(k(e)){if(le(e)&&t){let c=Gt(e,t);if(c!=null)return Ne(String(c));return r?"":Ne(e)}return Ne(e)}if(Ie(e)||Ge(e))return Ne(String(e));if(Array.isArray(e))return e.map((c)=>Fo(c,t,n,r,s)).join(s?"":`
|
|
191
|
+
`);if(!D(e))return"";if(Le(e))return f0(e,t,n,r,s);if(e.$switch){let c=e.tagName??"div",u=Lo(e,t),p=me(e.$switch)&&t!==null&&Ol(e.$switch.$ref,t)?null:tt(e.$switch,t),m=p==null?void 0:e.cases?.[String(p)],y=m!==void 0&&!Xe(m)?Fo(m,t,n,r,s):"";return`<${c}${u}>${y}</${c}>`}let o=Il(e.tagName,t);if(o==="slot"&&n){let c=tt(e.attributes?.name,t),u=k(c)?c:"",d;if(!n.taken.has(u))n.taken.add(u),d=n.groups.get(u);let p=d?.html??"";if(p!==""&&n.id!==null)p=`<!--${Hu} ${n.id} ${encodeURIComponent(u)}-->${p}<!--/${Hu} ${n.id}-->`;if(d?.content)return u0(e.children,t,n),p;let m=_l(e,t,n,r,s);return p===""?m:m===""?p:`${p}
|
|
192
|
+
${m}`}let i=r?.componentDefs.get(o);if(i&&r)return T1(e,i,t,n,r);let a=Lo(e,t);if(Yg.has(o))return`<${o}${a}>`;let l=_l(e,t,n,r,s||ms.has(o));return`<${o}${a}>${l}</${o}>`}function T1(e,t,n,r,s){let o=t.tagName,{lifted:i,rest:a}=ey(e.attributes),l={...i,...e.$props},c={};for(let[O,N]of Object.entries(l))c[O]=tt(N,n)??N;let u=Object.keys(c).length>0,d={...ty(t,a,n),...c},p=Object.keys(d).length>0,m=s.path??[],y={key:JSON.stringify(d),tag:o},S=[...m.map((O)=>O.tag),o].join(" → ");if(m.some((O)=>O.tag===y.tag&&O.key===y.key))throw Error(`Component <${o}> renders itself: ${S}. A component cannot appear inside its own `+"definition with the same props — the expansion would never end.");if(m.length>=ah)throw Error(`Component nesting exceeds ${ah} levels: ${S}. A component that renders itself with changing props needs a case that stops.`);let g={...s,path:[...m,y]},{children:x}=e,P=(O)=>Fo(O,n,r,s),w=Rn(t,s.defaults),E=!oy(o,t,s.liveTags),j=Dl(t,p?d:null),A,T=null;if(w){let O=Array.isArray(x)?x.map((N)=>P(N)).join(`
|
|
193
|
+
`):"";A=`<template shadowrootmode="${w}"><link rel="stylesheet" href="${Rf(o)}">${_l(t,j,null,g)}</template>${O}`}else{T=!E&&Ns(t.children)?Zg(s):null;let O=Qg(x,n,P,T);A=_l(t,j,O,g)}let I=Object.entries(ry(t.style,j)).map(([O,N])=>`${hn(O)}: ${N}`).join("; "),V={...e};delete V.$props,delete V.children;let H={...a,...ny(t.attributes,j)};if(V.attributes=!E&&u?{...H,"data-jx-props":JSON.stringify(c)}:H,T!==null)V.attributes={...V.attributes,[ml]:String(T)};if(E)V.$static=!0;else V.$prerendered=!0;return`<${o}${Lo(V,n,I)}>${A}</${o}>`}function d0(e,t=null,n=null,r=null){return _l(e,Dl(e,t),n,r)}function oy(e,t,n){return n?n.has(e):!m0(t)}function lf(e,t){let n=new Set,r=(s,o)=>{if(Array.isArray(s)){for(let i of s)r(i,!1);return}if(!D(s))return;if(Le(s)){r(s.map,!1);return}if(!o){for(let i of Yo(s.tagName))if(t.has(i))n.add(i)}r(s.children,!1);for(let i of Object.values(s.cases??{}))if(!Xe(i))r(i,!1)};return r(e,!0),n}function p0(e,t){let n=(i)=>{let a=new Set(i),l=[...a];for(let c=l.pop();c!==void 0;c=l.pop())for(let u of lf(e.get(c),e))if(!a.has(u))a.add(u),l.push(u);return a},r=t?n(lf(t,e)):void 0,s=new Set,o=[];for(let[i,a]of e)if(!m0(a)){if(s.add(i),!r||r.has(i))o.push(i)}for(let i of n(o))s.add(i);return s}function Cf(e,t){let n=new Set(e),r=new Set,s=[],o=(i)=>{if(r.has(i))return;r.add(i);let a=t.get(i);if(a)for(let l of[...lf(a,t)].toSorted())o(l);if(n.has(i))s.push(i)};for(let i of[...e].toSorted())o(i);return s}function m0(e){if(Tl(e).length>0)return!1;return El(e)}function El(e){if(!D(e))return!0;if(Array.isArray(e))return e.every((t)=>El(t));if(Le(e))return Array.isArray(e.items)&&e.filter===void 0&&e.sort===void 0&&e.key===void 0&&(e.map===void 0||El(e.map));if(e.$prototype)return!1;if(e.$switch!==void 0||rr(e.tagName))return!1;if(e.$ref)return!1;if(e.state)for(let t of Object.values(e.state)){if(!D(t)||Array.isArray(t))continue;if(t.$prototype)return!1;if(t.$ref)return!1}for(let t of Object.keys(e))if(t.startsWith("on")&&t!=="observedAttributes")return!1;if(Array.isArray(e.children))return e.children.every((t)=>El(t));if(Le(e.children))return El(e.children);return!0}function Rf(e){return`/components/${e}.css`}function h0(e,t,n,r){let s=new Set([e]),o=[n.get(e)??""],i=(a)=>{for(let l of lf(t.get(a)??{},t)){if(s.has(l)||r.has(l))continue;s.add(l),o.push(n.get(l)??""),i(l)}};return i(e),o.join("")}function Nf(e,t,n=null,r={},s=null){let o=[],i=Mv(e,s),a={host:s===null?"light":"shadow"};if(s!==null)a.shadowTree=!0;let l=D(t)?t:{};if(Uv(o,"display"in l?l:{display:"block",...l},i,r,a),n){let c={n:0};for(let u of Of(n))Af(u,o,r,"",c,e,{shadowTree:s!==null})}return o.length>0?`${o.join(`
|
|
148
194
|
`)}
|
|
149
|
-
`:""}var
|
|
150
|
-
${e.slice(n)}`}function N$(e,t){return new URL(`/${VJ(e,t).split(qJ).join("/")}`,"http://localhost").pathname}var WJ="/404";var em=T(()=>{hr()});function T$(e,t){if(t===null||t.routing!=="prefix-always")return[];let n=[];for(let r of e){if(r.urlPattern==="/")continue;let s=r.urlPattern.split("/").find(Boolean),o=Tn(s);if(o===null||!t.locales.includes(o))n.push(r.urlPattern)}return n}function J$(e,t){if(t===null)return null;let n=e.split("/").find(Boolean),r=Tn(n);if(n===void 0||r===null||t.locales.includes(r))return null;let s=t.locales.find((o)=>o!==r&&o.split("-")[0]===r.split("-")[0]);return s===void 0?null:{meant:s,segment:n}}function UJ(e,t){let n=e.split("/").filter(Boolean),r=Tn(n[0]);if(t!==null&&r!==null&&t.locales.includes(r))return n.slice(1).join("/");return n.join("/")}function tm(e,t){let n=new Map,r=[];if(t===null)return{conflicts:r,sets:n};let s=new Map,o=new Set;for(let i of e){let a=i.translationKey===void 0?UJ(i.urlPattern,t):i.translationKey.replaceAll(/^\/+|\/+$/g,"");if(i.translationKey!==void 0)o.add(i.urlPattern);let c=Xn(i.urlPattern,t);if(c===null)continue;let l=s.get(a)??[],u=l.find((d)=>d.locale===c);if(u===void 0)l.push({locale:c,urlPattern:i.urlPattern});else r.push({declared:o.has(u.urlPattern)||i.translationKey!==void 0,key:a,locale:c,urlPatterns:[u.urlPattern,i.urlPattern]});s.set(a,l)}for(let i of s.values()){let a=i.toSorted((c,l)=>c.locale===l.locale?0:c.locale<l.locale?-1:1);for(let c of i)n.set(c.urlPattern,a)}return{conflicts:r,sets:n}}function I$(e,t,n,r){let s=new Map;if(t===null||n==="")return s;let o=new Map;for(let[i,a]of tm(e,t).sets){if(a.length<2)continue;let c=o.get(a);if(c===void 0){c=a.map((u)=>({href:hs(Ni(u.urlPattern,r),n),hreflang:u.locale}));let l=a.find((u)=>u.locale===t.defaultLocale);if(l!==void 0)c.push({href:hs(Ni(l.urlPattern,r),n),hreflang:"x-default"});o.set(a,c)}s.set(i,c)}return s}function M$({pageLang:e,pageDir:t,routeLocale:n,defaults:r}){let s=e??n??r?.lang??"en",o=t??r?.dir;if(o!==void 0)return{dir:o,lang:s};return Ua(s)==="rtl"?{dir:"rtl",lang:s}:{lang:s}}var nm=T(()=>{$n();Eo();em();Eo();Eo()});function D$(e,t,n,r=null,s=null,o=[]){if(!e.state)e.state={};let i={};if(s!==null)i.defaultLocale=s.defaultLocale,i.locales=s.locales;e.state.$site={...Object.fromEntries(Object.entries(t.state??{}).filter(([u])=>!BJ.has(u))),name:t.name??"Jx Site",url:t.url??"",...i};let a=(k(e.$lang)?e.$lang:void 0)??Xn(n.urlPattern,s)??t.defaults?.lang,c=o.map((u)=>({code:u.locale,current:u.urlPattern===n.urlPattern,dir:Ua(u.locale),label:Db(u.locale),url:u.urlPattern})),l={params:n._pathParams??{},title:e.title??e._pageTitle??t.name??"",url:n.urlPattern};if(c.length>0)l.alternates=c;if(n.pagination){let{first:u,itemCount:d,last:p,next:m,number:x,pageCount:h,pageSize:g,pages:b,prev:j}=n.pagination;l.pagination={first:u,itemCount:d,last:p,next:m,number:x,pageCount:h,pageSize:g,pages:b.map(({current:v,number:P,url:S})=>({current:v,number:P,url:S})),prev:j}}if(a!==void 0)l.dir=Ua(a),l.locale=a;if(e.state.$page=l,t.state){for(let[u,d]of Object.entries(t.state))if(u!=="$site"&&u!=="$page"&&!(u in e.state))e.state[u]=d}if(t.$media)e.$media={...t.$media,...e.$media};if(t.imports&&Object.keys(t.imports).length>0){if(!e.imports)e.imports={};for(let[u,d]of Object.entries(t.imports))if(!(u in e.imports))e.imports[u]=r&&(d.startsWith("./")||d.startsWith("../"))?r(d,n):d}if(t.$elements?.length)if(!e.$elements?.length)e.$elements=[...t.$elements];else{let u=new Set,d=[];for(let p of[...t.$elements,...e.$elements]){let m=k(p)?p:D(p)?p.$ref:void 0;if(m&&!u.has(m))u.add(m),d.push(p)}e.$elements=d}return e}var BJ;var F$=T(()=>{le();Eo();BJ=new Set(["defaultLocale","locales","name","url"])});import{dirname as zJ,relative as KJ,resolve as GJ}from"node:path";function rm(e){return(t,n)=>{if(!n.sourcePath)return t;return`./${KJ(zJ(n.sourcePath),GJ(e,t))}`}}function L$(e,t,n,r=null,s=null,o=[]){return D$(e,t,n,r===null?null:rm(r),s,o)}var sm=T(()=>{F$()});import{readFileSync as XJ}from"node:fs";import{dirname as om,resolve as yu}from"node:path";import{createRequire as YJ}from"node:module";function e1(e){return At(e.resolve)}async function xu(e,t,n,r={}){let s=e.imports??{},{state:o}=e;if(!o)return;for(let[i,a]of Object.entries(o)){if(!_n(a))continue;if(ZJ.has(a.$prototype))continue;if(a.timing&&a.timing!=="compiler"){let c=r.registry?.byName(a.$prototype);if(c?.capabilities.lower)try{let l=await c.call("lower",a,{projectConfig:r.config,root:n,route:t});if(V(l)){let u=l.$bundle;if(Array.isArray(u)){for(let d of u)if(k(d))r.registerBundle?.(d)}delete l.$bundle}o[i]=l}catch(l){console.warn(`prototype-resolver: failed to lower "${i}" ($prototype: "${a.$prototype}"):`,$e(l))}continue}if(!a.$src){let c=s[a.$prototype]??t1(r,a.$prototype);if(!c)continue;a.$src=c}try{let c=await n1(a,t,n,o,r);if(a.timing&&V(c))c.timing=a.timing;o[i]=c}catch(c){console.warn(`prototype-resolver: failed to resolve "${i}" ($prototype: "${a.$prototype}"):`,$e(c))}}}function t1(e,t){return e.registry?.byName(t)?.classPath}async function n1(e,t,n,r,s){let o=e.$src;if(!o)throw Error(`$prototype "${e.$prototype}" has no $src to resolve`);let i;if(o.startsWith("./")||o.startsWith("../"))i=t.sourcePath?yu(om(t.sourcePath),o):yu(n,o);else i=YJ(yu(n,"package.json")).resolve(o);let a=XJ(i,"utf8"),c=Zg(a,i);if(!c.$implementation)throw Error(`${o} has no $implementation field`);let l=yu(om(i),c.$implementation),u=await Hd(l),d=e.$export??c.title??e.$prototype,p=u[d]??u.default?.[d];if(!p)throw Error(`Module ${c.$implementation} does not export "${d}"`);let m={};for(let[h,g]of Object.entries(e))if(!QJ.has(h))m[h]=g;if(m.src&&!m.basePath&&t.sourcePath)m.basePath=om(t.sourcePath);m._project={config:s.config??null,root:n,...s.sections},m._document={route:t,state:r};let x=new p(m);if(e1(x))return await x.resolve();return x}var ZJ,QJ;var im=T(()=>{Ur();le();Dt();ZJ=new Set(["Function","LocalStorage","SessionStorage","Array"]),QJ=new Set(["$prototype","$src","$export","timing","default","description"])});import{readFileSync as am,readdirSync as r1,statSync as s1}from"node:fs";import{extname as q$,join as o1,relative as i1,resolve as a1}from"node:path";async function Qr(e,t){let n=am(e,"utf8");if(Wr(e))return ur(Kn(n,e),e);let r=q$(e).toLowerCase(),s=t?.byExtension(r,"parse");if(!s)throw Error(`No format class registered for "${r}" (${e}). Enable an extension providing this format in project.json "extensions", e.g. "@jxsuite/parser".`);return ur(await s.parseDocument(n),e)}async function W$(e,t){let n=new Map,r=new Map;for(let s of e){if(!r.has(s.sourcePath))r.set(s.sourcePath,await l1(s.sourcePath,t));let o=r.get(s.sourcePath);if(o!==null&&o!==void 0)n.set(s.urlPattern,c1(o,s._pathParams))}return n}function c1(e,t){if(!e.includes("${"))return e;return e.replaceAll(/\$\{(\w+)\}/g,(n,r)=>t?.[r]??n)}async function l1(e,t){if(!am(e,"utf8").includes("$translationKey"))return null;let n;try{n=await Qr(e,t)}catch{return null}return k(n.$translationKey)&&n.$translationKey!==""?n.$translationKey:null}async function H$(e,t){let n=[],r=new Set([".json",".jxn",...t?.documentExtensions("page")??[]]);return await U$(e,e,n,r,t),n.sort(Cb),n}async function U$(e,t,n,r,s){let o=r1(e,{withFileTypes:!0});for(let i of o){let a=o1(e,i.name);if(i.isDirectory()){if(i.name.startsWith("_"))continue;await U$(a,t,n,r,s);continue}let c=q$(i.name).toLowerCase();if(!r.has(c))continue;if(i.name.startsWith("_"))continue;let l=i1(t,a);n.push(await u1(l,a,s))}}async function u1(e,t,n){let{isCatchAll:r,isDynamic:s,params:o,urlPattern:i}=Rb(e),a=null;try{let l=(await Qr(t,n)).$layout;if(k(l))a=l}catch{}return{$layout:a,isCatchAll:r,isDynamic:s,params:o,relativePath:e,sourcePath:t,urlPattern:i}}function f1(e){let t=e[bu];if(!V(t))return null;let{mtime:n}=t;return k(n)&&n!==""?n:null}function B$(e){if(e.includes("\x00"))return"has a NUL character";for(let t of e.split("/")){if(t==="."||t==="..")return'has a "." or ".." segment';if(t.includes("\\"))return"has a backslash"}return null}async function z$(e,t,n={},r,s,o,i={}){let a=[],c=(u,d)=>{let p=`Dynamic route ${u.urlPattern}: ${d}`;if(i.errors===void 0)throw Error(p);i.errors.push(p)},l=e.flatMap((u)=>u.isDynamic?[u.urlPattern]:[]);for(let u of e){if(!u.isDynamic){a.push(u);continue}let d;try{d=await Qr(u.sourcePath,r?.formats)}catch{a.push(u);continue}if(!d.$paths){console.warn(`Warning: dynamic route ${u.urlPattern} has no $paths — skipping`);continue}let p;try{p=Tb(d.$paths)}catch(x){c(u,$e(x));continue}if(p!==null){let x=Xn(u.urlPattern,o??null),h=p.each===void 0?[{}]:await V$(p.each,t,n,r,s,x,u,l);for(let g of h){let b=await d1(u,d,p,g,{locale:x,projectConfig:s,projectRoot:t,registry:r,report:c,sections:n});a.push(...b)}continue}let m=await V$(d.$paths,t,n,r,s,Xn(u.urlPattern,o??null),u,l);for(let x of m){let h=u.urlPattern,g={};for(let[P,S]of Object.entries(x)){if(P===bu)continue;g[P]=String(S),h=h.replace(`:${P}`,g[P]),h=h.replace("*",g[P])}let b=B$(h);if(b!==null){console.warn(`Warning: $paths for ${u.urlPattern} produced "${h}", which ${b}; skipping it`);continue}let j=f1(x),v={...u,_pathParams:g,isCatchAll:!1,isDynamic:!1,params:[],urlPattern:h};if(j!==null)v.sourceMtime=j;a.push(v)}}return a}function K$(e,t){let n=e;for(let[r,s]of Object.entries(t)){let o=new RegExp(`:${r.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}(?=/|$)`);n=o.test(n)?n.replace(o,()=>s):n.replace("*",()=>s)}return n}async function d1(e,t,n,r,s){let o={};for(let[x,h]of Object.entries(r))if(x!==bu)o[x]=String(h);let i=e.params.filter((x)=>!(x in o));if(i.length!==1)return s.report(e,`a paged route takes exactly one parameter besides those its each source fills; this one has ${i.length}`),[];let a=i[0];if(t.state?.[n.key]===void 0)return s.report(e,`$paths.paginate names state entry "${n.key}", which this page does not declare`),[];let c=K$(e.urlPattern,o),l=B$(c);if(l!==null)return console.warn(`Warning: $paths for ${e.urlPattern} produced "${c}", which ${l}; skipping it`),[];let u=await m1(t,n.key,e,o,s);if(!Array.isArray(u))return s.report(e,`state entry "${n.key}" did not resolve to an array at build time`),[];let d=p1(u,e.sourcePath),p=pp(u.length,n.pageSize),m=[];for(let x=1;x<=p;x++){let h={...e,_pathParams:{...o,[a]:String(x)},isCatchAll:!1,isDynamic:!1,pagedState:{items:Jb(u,x,n.pageSize),key:n.key},pagination:Ib(c,x,n.pageSize,u.length),params:[],urlPattern:vo(c,x)};if(d!==null)h.sourceMtime=d;m.push(h)}return m}function p1(e,t){let n=null,r=s1(t).mtime.getTime();for(let s of e){let o=V(s)?s[bu]:void 0,i=V(o)?o.mtime:void 0;if(k(i)&&Date.parse(i)>r)r=Date.parse(i),n=i}return n}async function m1(e,t,n,r,s){let o=e.state?.[t];if(o===void 0||Array.isArray(o))return o;let i={},a=rm(s.projectRoot);for(let[u,d]of Object.entries(s.projectConfig?.imports??{}))i[u]=d.startsWith("./")||d.startsWith("../")?a(d,n):d;Object.assign(i,e.imports);let c={imports:i,state:{[t]:structuredClone(o)}},l={_pathParams:r,locale:s.locale,sourcePath:n.sourcePath,urlPattern:K$(n.urlPattern,r)};return await xu(c,l,s.projectRoot,{...s.projectConfig&&{config:s.projectConfig},...s.registry&&{registry:s.registry},sections:s.sections}),c.state?.[t]}async function V$(e,t,n,r,s,o,i,a){if(Array.isArray(e))return e;if("values"in e&&Array.isArray(e.values)){let c=k(e.param)?e.param:"value";return e.values.map((l)=>({[c]:l}))}if("$ref"in e&&k(e.$ref)&&e.$ref){let c=e.$ref,l=a1(t,c),u;try{u=JSON.parse(am(l,"utf8"))}catch(m){return console.warn(`Warning: $paths.$ref could not load "${c}": ${$e(m)}`),[]}if(!Array.isArray(u))return console.warn(`Warning: $paths.$ref "${c}" must be a JSON array`),[];let d=k(e.param)?e.param:"id",p=k(e.field)?e.field:"id";return u.map((m)=>{if(m===null)throw TypeError(`$paths.$ref "${c}" contains a null entry`);return{[d]:(V(m)?m[p]??m.id:void 0)??String(m)}})}for(let c of Object.keys(e)){let l=r?.byPathsDiscriminator(c);if(!l?.project)continue;let u={data:n[l.project.key],locale:o,projectConfig:s,root:t};if(i!==void 0)u.params=i.params,u.urlPattern=i.urlPattern;if(a!==void 0)u.patterns=a;return await l.call("resolvePaths",e,u)}return console.warn("Warning: unrecognized $paths shape — skipping"),[]}var bu="_meta";var cm=T(()=>{pi();le();ds();Dt();Nb();Mb();nm();sm();im()});import{createHash as h1}from"node:crypto";function G$(){return{fontOrigins:new Set,frameOrigins:new Set,imgOrigins:new Set,scriptHashes:new Set,scriptOrigins:new Set,styleOrigins:new Set}}function Ao(e,t){let n=new RegExp(`\\b${t}\\s*=\\s*("([^"]*)"|'([^']*)')`,"i").exec(e);return n?.[2]??n?.[3]}function lm(e){if(e===void 0||!/^https?:\/\//i.test(e))return null;try{return new URL(e).origin}catch{return null}}function v1(e){return`'sha256-${h1("sha256").update(e,"utf8").digest("base64")}'`}function X$(e,t){for(let n of e.matchAll(y1)){let r=n[1]??"",s=Ao(r,"src"),o=(Ao(r,"type")??"").trim().toLowerCase();if(s!==void 0){let i=lm(s);if(i)t.scriptOrigins.add(i);continue}if(g1.has(o))t.scriptHashes.add(v1(n[2]??""))}for(let n of e.matchAll(x1)){let r=n[1]??"",s=(Ao(r,"rel")??"").toLowerCase(),o=Ao(r,"href"),i=lm(o);if(!i)continue;if(s.includes("stylesheet"))t.styleOrigins.add(i);if(S1.test(o??"")||(Ao(r,"as")??"")==="font")t.fontOrigins.add(i)}for(let[n,r]of[[b1,t.imgOrigins],[$1,t.imgOrigins],[w1,t.frameOrigins]])for(let s of e.matchAll(n)){let o=s[1]??"";for(let i of[Ao(o,"src"),...E1(Ao(o,"srcset"))]){let a=lm(i);if(a)r.add(a)}}}function E1(e){return e===void 0?[]:e.split(",").map((t)=>t.trim().split(/\s+/)[0]??"").filter(Boolean)}function j1(e){if(e===!1)return!1;return e==="DENY"?"'none'":"'self'"}function Y$(e){let t=e?.csp;if(t===void 0||t===!1)return null;if(t===!0)return{};if(t==="report-only")return{mode:"report-only"};return t}function Z$(e,t,n="SAMEORIGIN"){let r=(a,c)=>[...a,...c].join(" "),s={"base-uri":"'self'","default-src":"'self'","font-src":r(["'self'"],e.fontOrigins),"form-action":"'self'","frame-ancestors":j1(n),"frame-src":r(["'self'"],e.frameOrigins),"img-src":r(["'self'","data:"],e.imgOrigins),"object-src":"'none'","script-src":r(["'self'",...[...e.scriptHashes].toSorted()],e.scriptOrigins),"style-src":r(["'self'","'unsafe-inline'"],e.styleOrigins)};if(t.reportUri!==void 0&&t.reportUri!=="")s["report-to"]="csp-endpoint",s["report-uri"]=t.reportUri;for(let[a,c]of Object.entries(t.directives??{}))s[a]=c;let o=Object.entries(s).filter(([,a])=>a!==!1&&a!=="").toSorted(([a],[c])=>a<c?-1:1).map(([a,c])=>`${a} ${String(c)}`).join("; "),i=t.mode==="report-only"?{"Content-Security-Policy-Report-Only":o}:{"Content-Security-Policy":o};if(t.reportUri!==void 0&&t.reportUri!=="")i["Reporting-Endpoints"]=`csp-endpoint="${t.reportUri}"`;return i}var g1,y1,x1,b1,$1,w1,S1;var um=T(()=>{g1=new Set(["","module","importmap","text/javascript","module-shim","speculationrules"]),y1=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,x1=/<link\b([^>]*)>/gi,b1=/<img\b([^>]*)>/gi,$1=/<source\b([^>]*)>/gi,w1=/<iframe\b([^>]*)>/gi,S1=/\.(woff2?|ttf|otf|eot)(\?|#|$)/i});import{existsSync as $u,readFileSync as P1,writeFileSync as ew}from"node:fs";import{join as wu}from"node:path";function tw(e,t){let n=e?.headers??{},r=[];if(n.enabled===!1)return{errors:r,rules:[]};let s=n.security??{},o={};if(s.contentTypeOptions!==!1)o["X-Content-Type-Options"]="nosniff";if(s.referrerPolicy!==!1)o["Referrer-Policy"]=s.referrerPolicy??"strict-origin-when-cross-origin";if(s.permissionsPolicy!==!1)o["Permissions-Policy"]=s.permissionsPolicy??"camera=(), microphone=(), geolocation=()";if(s.frameOptions!==!1)o["X-Frame-Options"]=s.frameOptions??"SAMEORIGIN";let{hsts:i}=s;if(i){let u=i===!0?{}:i,d=u.maxAge??Q$,p=u.includeSubDomains??!0,m=u.preload??!1;if(m&&!p)r.push("build.headers.security.hsts: `preload` requires `includeSubDomains` — the preload list "+"will not accept the header without it.");else o["Strict-Transport-Security"]=[`max-age=${d}`,p?"includeSubDomains":null,m?"preload":null].filter(Boolean).join("; ")}let a=Y$(s);if(a)if(t===void 0)r.push("build.headers.security.csp is set, but no page was scanned for inline scripts — the "+"policy would block every one of them.");else Object.assign(o,Z$(t,a,s.frameOptions));let c=n.cache??"auto";if(c==="auto")o["Cache-Control"]="public, max-age=0, must-revalidate";let l=[];if(Object.keys(o).length>0)l.push({headers:o,pattern:"/*"});if(c==="auto")l.push({headers:{"Cache-Control":`public, max-age=${Q$}, immutable`},pattern:_1});for(let[u,d]of Object.entries(n.rules??{}))l.push({headers:d,pattern:u});return{errors:r,rules:l}}function nw(e){let t=[["feed.xml","application/atom+xml; charset=utf-8"],["feed.json","application/feed+json; charset=utf-8"],["manifest.webmanifest","application/manifest+json; charset=utf-8"],[".well-known/security.txt","text/plain; charset=utf-8"]],n=[];for(let[r,s]of t)if($u(wu(e,r)))n.push({headers:{"Content-Type":s},pattern:`/${r}`});if($u(wu(e,"feed","archive")))n.push({headers:{"Content-Type":"application/atom+xml; charset=utf-8"},pattern:"/feed/archive/*"});return n}function rw(e,t){if(t==="")return[...e];return e.map((n)=>({headers:n.headers,pattern:We(t,n.pattern)}))}function A1(e){let t=e.map((n)=>{let r=Object.entries(n.headers).map(([s,o])=>` ${s}: ${o}`);return[n.pattern,...r].join(`
|
|
151
|
-
`)});return
|
|
195
|
+
`:""}var b1,Fv,Ts="https://esm.sh/@vue/reactivity@3.5.40",Nr="https://esm.sh/lit-html@3.3.0",vl,S1,v1,E1,j1,P1,Wv,O1,A1,ms,C1,Vo="__jxAttrText",qi="__jxListItems",Kv="__jxRowKeys",Rl="__jxLiteral",Nl="__jxKeyed",Sf,Wg="__jxSupplies",Bg="__jxNativeSetter",vf="__jxAbsorbAttr",Qv="__jxServerCall",R1,N1,e0="__jxInstantiate",Kg="__jxAssociateForm",Gg="__jxCaptureSlotted",Xg="__jxDistributeSlots",Wi="<!---->",r0,Yg;var yn=J(()=>{$i();Mi();uh();Ai();Fu();Rv();Jv();ce();Sl();_i();Mi();Ai();Fu();ce();Ai();b1=["$map/","event#/","$args/","$reduce/"];Fv=Symbol("jx.runtimeOnlyStateKeys");vl=String.raw`(?:\s|\\[nrt])*`,S1=new RegExp(String.raw`(?:=|\.\.\.)${vl}state[ \t]*(?:[;,)}\]"]|\\[nr])`);v1=/\bstate\.([A-Za-z_$][\w$]*)\s*(?:\+\+|--|(?:\*\*|\|\||&&|\?\?|<<|>>>|>>|[-+*/%&|^])?=(?!=))/g,E1=/\bstate\.([A-Za-z_$][\w$]*)\s*\.\s*(?:push|pop|shift|unshift|splice|sort|reverse|fill|copyWithin)\s*\(/g,j1=/[\w$.]/u,P1=/[\w$]/u;Wv=["hidden","tabIndex","title","lang","dir"],O1=new Set([...Wv,"id","className"]),A1=new Set([...pr,...O1,"textContent","innerHTML"]);ms=new Set(["pre","textarea","listing","plaintext","xmp"]);C1=[];Sf=["import { AsyncDirective, directive } from 'lit-html/async-directive.js';","import { repeat } from 'lit-html/directives/repeat.js';"];R1=new Set(["$prototype","$src","$export","timing","default","description"]);N1=new Set(tg);r0=Symbol("jx.styleHandle");Yg=new Set(["input","br","hr","img","meta","link","area","col","source"])});import{relative as J1,sep as M1}from"node:path";function Ll(e){return e===I1}function zi(e,t){if(e==="/")return"/";if(t==="always")return e.endsWith("/")?e:`${e}/`;if(t==="never")return e.replace(/\/+$/,"")||"/";return e}function Tf(e,t){let n=new RegExp(`\\s${t}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s"'>]+))`,"i").exec(e);return n===null?null:n[1]??n[2]??n[3]??""}function g0(e){let t=e.search(/<\/head\s*>/i),n=t===-1?e:e.slice(0,t);for(let[r]of n.matchAll(/<meta\b[^>]*>/gi)){if(Tf(r,"name")?.trim().toLowerCase()!=="robots")continue;let s=new Set((Tf(r,"content")??"").toLowerCase().split(",").map((o)=>o.trim()));if(s.has("noindex")||s.has("none"))return!0}return!1}function y0(e){let t=e.search(/<\/head\s*>/i);return{end:t,head:t===-1?e:e.slice(0,t)}}function D1(e,t){let n=t.trim().toLowerCase();for(let[r]of y0(e).head.matchAll(/<link\b[^>]*>/gi)){let s=(Tf(r,"rel")??"").toLowerCase().split(/\s+/),o=(Tf(r,"type")??"").split(";")[0]?.trim().toLowerCase();if(s.includes("alternate")&&o===n)return!0}return!1}function x0(e,t){let{end:n}=y0(e);if(n===-1||D1(e,t.type))return e;let r=`<link href="${Ne(t.href)}" rel="alternate" type="${Ne(t.type)}">`;return`${e.slice(0,n)}${r}
|
|
196
|
+
${e.slice(n)}`}function b0(e,t){return new URL(`/${J1(e,t).split(M1).join("/")}`,"http://localhost").pathname}var I1="/404";var iy=J(()=>{yn()});function $0(e,t){if(t===null||t.routing!=="prefix-always")return[];let n=[];for(let r of e){if(r.urlPattern==="/")continue;let s=r.urlPattern.split("/").find(Boolean),o=Bn(s);if(o===null||!t.locales.includes(o))n.push(r.urlPattern)}return n}function S0(e,t){if(t===null)return null;let n=e.split("/").find(Boolean),r=Bn(n);if(n===void 0||r===null||t.locales.includes(r))return null;let s=t.locales.find((o)=>o!==r&&o.split("-")[0]===r.split("-")[0]);return s===void 0?null:{meant:s,segment:n}}function L1(e,t){let n=e.split("/").filter(Boolean),r=Bn(n[0]);if(t!==null&&r!==null&&t.locales.includes(r))return n.slice(1).join("/");return n.join("/")}function ay(e,t){let n=new Map,r=[];if(t===null)return{conflicts:r,sets:n};let s=new Map,o=new Set;for(let i of e){let a=i.translationKey===void 0?L1(i.urlPattern,t):i.translationKey.replaceAll(/^\/+|\/+$/g,"");if(i.translationKey!==void 0)o.add(i.urlPattern);let l=cr(i.urlPattern,t);if(l===null)continue;let c=s.get(a)??[],u=c.find((d)=>d.locale===l);if(u===void 0)c.push({locale:l,urlPattern:i.urlPattern});else r.push({declared:o.has(u.urlPattern)||i.translationKey!==void 0,key:a,locale:l,urlPatterns:[u.urlPattern,i.urlPattern]});s.set(a,c)}for(let i of s.values()){let a=i.toSorted((l,c)=>l.locale===c.locale?0:l.locale<c.locale?-1:1);for(let l of i)n.set(l.urlPattern,a)}return{conflicts:r,sets:n}}function w0(e,t,n,r){let s=new Map;if(t===null||n==="")return s;let o=new Map;for(let[i,a]of ay(e,t).sets){if(a.length<2)continue;let l=o.get(a);if(l===void 0){l=a.map((u)=>({href:Cs(zi(u.urlPattern,r),n),hreflang:u.locale}));let c=a.find((u)=>u.locale===t.defaultLocale);if(c!==void 0)l.push({href:Cs(zi(c.urlPattern,r),n),hreflang:"x-default"});o.set(a,l)}s.set(i,l)}return s}function v0({pageLang:e,pageDir:t,routeLocale:n,defaults:r}){let s=e??n??r?.lang??"en",o=t??r?.dir;if(o!==void 0)return{dir:o,lang:s};return al(s)==="rtl"?{dir:"rtl",lang:s}:{lang:s}}var ly=J(()=>{An();Jo();iy();Jo();Jo()});function E0(e,t,n,r=null,s=null,o=[]){if(!e.state)e.state={};let i={};if(s!==null)i.defaultLocale=s.defaultLocale,i.locales=s.locales;e.state.$site={...Object.fromEntries(Object.entries(t.state??{}).filter(([u])=>!F1.has(u))),name:t.name??"Jx Site",url:t.url??"",...i};let a=(k(e.$lang)?e.$lang:void 0)??cr(n.urlPattern,s)??t.defaults?.lang,l=o.map((u)=>({code:u.locale,current:u.urlPattern===n.urlPattern,dir:al(u.locale),label:Kw(u.locale),url:u.urlPattern})),c={params:n._pathParams??{},title:e.title??e._pageTitle??t.name??"",url:n.urlPattern};if(l.length>0)c.alternates=l;if(n.pagination){let{first:u,itemCount:d,last:p,next:m,number:y,pageCount:S,pageSize:g,pages:x,prev:P}=n.pagination;c.pagination={first:u,itemCount:d,last:p,next:m,number:y,pageCount:S,pageSize:g,pages:x.map(({current:w,number:E,url:j})=>({current:w,number:E,url:j})),prev:P}}if(a!==void 0)c.dir=al(a),c.locale=a;if(e.state.$page=c,t.state){for(let[u,d]of Object.entries(t.state))if(u!=="$site"&&u!=="$page"&&!(u in e.state))e.state[u]=d}if(t.$media)e.$media={...t.$media,...e.$media};if(t.imports&&Object.keys(t.imports).length>0){if(!e.imports)e.imports={};for(let[u,d]of Object.entries(t.imports))if(!(u in e.imports))e.imports[u]=r&&(d.startsWith("./")||d.startsWith("../"))?r(d,n):d}if(t.$elements?.length)if(!e.$elements?.length)e.$elements=[...t.$elements];else{let u=new Set,d=[];for(let p of[...t.$elements,...e.$elements]){let m=k(p)?p:D(p)?p.$ref:void 0;if(m&&!u.has(m))u.add(m),d.push(p)}e.$elements=d}return e}var F1;var j0=J(()=>{ce();Jo();F1=new Set(["defaultLocale","locales","name","url"])});import{dirname as V1,relative as q1,resolve as H1}from"node:path";function cy(e){return(t,n)=>{if(!n.sourcePath)return t;return`./${q1(V1(n.sourcePath),H1(e,t))}`}}function P0(e,t,n,r=null,s=null,o=[]){return E0(e,t,n,r===null?null:cy(r),s,o)}var uy=J(()=>{j0()});function Fl(e){let t=Fw(e,e.title??"a class"),n=t.title;if(!n)throw Error("compileClassJson: missing title (class name)");let r=B1(t.extends),s=t.$defs,o=s?.fields??{},i=s?.constructor,a=W1(i)?i:void 0,l=s?.methods??{},c=["// Generated by @jxsuite/compiler from .class.json — do not edit manually"];if(t.$id)c.push(`// Source: ${t.$id}`);c.push("");let u=U1(t.extends);if(u!==null)c.push(u,"");let d=r!=="Object"?` extends ${r}`:"";c.push(`class ${n}${d} {`);for(let[p,m]of Object.entries(o)){if(m.scope!=="static")continue;let y=m.identifier??p,S=m.access==="private"?"#":"",g=m.initializer!==void 0?JSON.stringify(m.initializer):m.default!==void 0?JSON.stringify(m.default):"null";c.push(` static ${S}${y} = ${g};`)}for(let[p,m]of Object.entries(o)){if(m.scope==="static")continue;if(m.access!=="private")continue;let y=m.identifier??p;c.push(` #${y};`)}if(Object.keys(o).length>0)c.push("");if(c.push(" constructor(config = {}) {"),a?.superCall||r!=="Object"){let p=a?.superCall?.arguments?a.superCall.arguments.join(", "):"";c.push(` super(${p});`)}for(let[p,m]of Object.entries(o)){if(m.scope==="static")continue;let y=m.identifier??p,S=m.access==="private"?"#":"",g=m.initializer!==void 0?JSON.stringify(m.initializer):m.default!==void 0?JSON.stringify(m.default):"null";c.push(` this.${S}${y} = config.${y} !== undefined ? config.${y} : ${g};`)}if(a?.body){let p=Array.isArray(a.body)?a.body:[a.body];for(let m of p)c.push(` ${m}`)}c.push(" }");for(let[p,m]of Object.entries(l)){let y=m.identifier??p,S=m.scope==="static",x=m.access==="private"?"#":"",P=S?"static ":"",w=m.returnType?.$ref?.includes("Promise")||K1(m)?"async ":"",E=_0(m.parameters??[]),j=z1(m.body);if(c.push(""),m.role==="accessor"){if(m.getter)c.push(` ${P}get ${x}${y}() {`,` ${m.getter.body}`," }");if(m.setter){let A=_0(m.setter.parameters??[])||"v";c.push(` ${P}set ${x}${y}(${A}) {`,` ${m.setter.body}`," }")}}else{c.push(` ${P}${w}${x}${y}(${E}) {`);for(let A of j)c.push(` ${A}`);c.push(" }")}}return c.push("}","",`export { ${n} };`,`export default ${n};`,""),c.join(`
|
|
197
|
+
`)}function W1(e){return typeof e==="object"}function B1(e){if(!e)return"Object";if(k(e))return e;if(e.$ref){let t=e.$ref.match(k0);return t?t[1]:"Object"}return"Object"}function U1(e){if(!e||k(e)||!e.$ref)return null;let t=e.$ref.match(k0);if(!t)return null;let[n=""]=e.$ref.split("#"),r=n.replace(/\.class\.json$/,".js"),s=/^(?:\.{0,2}\/|[a-z][a-z0-9+.-]*:)/i.test(r)?r:`./${r}`;return`import ${t[1]} from ${JSON.stringify(s)};`}function _0(e){return e.map((t)=>{if(t.$ref)return t.$ref.split("/").pop();let n=t.identifier??t.name;return k(n)?n:"arg"}).join(", ")}function z1(e){if(!e)return[""];return Array.isArray(e)?e:[e]}function K1(e){return(Array.isArray(e.body)?e.body.join(`
|
|
198
|
+
`):e.body??"").includes("await ")}var k0;var fy=J(()=>{Ei();ce();k0=/([A-Za-z0-9_]+)\.class\.json/});import{createHash as G1}from"node:crypto";import{mkdirSync as X1,readFileSync as Y1,rmSync as Z1,writeFileSync as Q1}from"node:fs";import{createRequire as eD}from"node:module";import{tmpdir as tD}from"node:os";import{dirname as C0,join as O0,resolve as Jf}from"node:path";import{pathToFileURL as nD}from"node:url";function Mf(e,t){let n=e.$src??t.imports?.[e.$prototype]??t.registry?.byName(e.$prototype)?.classPath;if(!n)return;let r;if(n.startsWith("./")||n.startsWith("../"))r=Jf(t.docDir??t.projectRoot,n);else r=eD(Jf(t.projectRoot,"package.json")).resolve(n);let s=Qb(Y1(r,"utf8"),r);return{classDef:s,classJsonPath:r,exportName:e.$export??s.title??e.$prototype}}function R0(e){let t=e.classDef.extends;if(t!==void 0&&!k(t))throw Error(`${e.classJsonPath} has no $implementation and extends another class document ("${t.$ref}"), which a site build does not compile: give it an $implementation`)}function rD(e){R0(e);let t=Fl(e.classDef),n=G1("sha256").update(t).digest("hex").slice(0,16),r=A0.get(n);if(r===void 0){let s=O0(tD(),`jx-class-${process.pid}`);X1(s,{recursive:!0});let o=O0(s,`${e.classDef.title}-${n}.mjs`);Q1(o,t,"utf8"),r=import(nD(o).href).then((i)=>i.default).finally(()=>{Z1(o,{force:!0})}),A0.set(n,r)}return r}async function N0(e){let{classDef:t,classJsonPath:n,exportName:r}=e;if(!t.$implementation)return rD(e);let s=await om(Jf(C0(n),t.$implementation)),o=s[r]??s.default?.[r];if(!_t(o))throw Error(`Module ${t.$implementation} does not export "${r}"`);return o}function sD(e){return"resolve"in e&&_t(e.resolve)}function oD(e){return"value"in e}async function T0(e,t){let n=new e(t);if(sD(n))return{instance:n,value:await n.resolve()};if(oD(n))return{instance:n,value:n.value};return{instance:n,value:n}}function J0(e){return JSON.stringify(e).includes('"#/$context/')}function M0(e){let{classDef:t,classJsonPath:n,exportName:r}=e;if(!t.$implementation)return R0(e),Fl(t);let s=CS(Jf(C0(n),t.$implementation)),o=JSON.stringify(r);return[`import * as m from ${JSON.stringify(s)};`,`export default m[${o}] ?? m.default?.[${o}];`,""].join(`
|
|
199
|
+
`)}var A0;var dy=J(()=>{ce();Lt();fy();is();A0=new Map});import{dirname as I0}from"node:path";async function Vl(e,t,n,r={}){let s={},{state:o}=e;if(!o)return s;let i=[],a={docDir:t.sourcePath?I0(t.sourcePath):null,imports:e.imports,projectRoot:n,registry:r.registry};for(let[l,c]of Object.entries(o)){if(!Pn(c))continue;if(iD.has(c.$prototype))continue;let u=`"${l}" ($prototype "${c.$prototype}")`;if(c.timing&&c.timing!=="compiler"){let d=r.registry?.byName(c.$prototype);if(d?.capabilities.lower)try{let p=await d.call("lower",c,{projectConfig:r.config,root:n,route:t});if(L(p)){let m=p.$bundle;if(Array.isArray(m)){for(let y of m)if(k(y))r.registerBundle?.(y)}delete p.$bundle}o[l]=p,s[l]=p}catch(p){i.push(`${u}: its class could not lower it: ${be(p)}`)}continue}try{let d=Mf(c,a);if(d===void 0){if(c.timing==="compiler"&&zg(c))i.push(`${u} names no class: give it a $src or an imports entry, or enable the extension that provides "${c.$prototype}"`);continue}let p=await N0(d),{value:m}=await T0(p,aD(c,t,n,o,r));if(r.asInitialValues)o[l]={default:m??null};else{if(c.timing&&L(m))m.timing=c.timing;o[l]=m}s[l]=o[l]}catch(d){let p=c.timing?"":' (set "timing": "client" if it must run in the browser)';i.push(`${u}: ${be(d)}${p}`)}}if(i.length>0)throw Error(i.length===1?`state entry ${i[0]}`:`${i.length} state entries could not be resolved: ${i.join("; ")}`);return s}function aD(e,t,n,r,s){let o={...Ug(e)};if(o.src&&!o.basePath&&t.sourcePath)o.basePath=I0(t.sourcePath);return o._project={config:s.config??null,root:n,...s.sections},o._document={route:t,state:r},o}var iD;var py=J(()=>{ce();Lt();yn();dy();iD=new Set(["Function","LocalStorage","SessionStorage","Array"])});import{readFileSync as my,readdirSync as lD,statSync as cD}from"node:fs";import{extname as L0,join as uD,relative as fD,resolve as dD}from"node:path";async function hs(e,t){let n=my(e,"utf8");if(Vn(e))return Ar(kn(n,e),e);let r=L0(e).toLowerCase(),s=t?.byExtension(r,"parse");if(!s)throw Error(`No format class registered for "${r}" (${e}). Enable an extension providing this format in project.json "extensions", e.g. "@jxsuite/parser".`);return Ar(await s.parseDocument(n),e)}async function F0(e,t){let n=new Map,r=new Map;for(let s of e){if(!r.has(s.sourcePath))r.set(s.sourcePath,await mD(s.sourcePath,t));let o=r.get(s.sourcePath);if(o!==null&&o!==void 0)n.set(s.urlPattern,pD(o,s._pathParams))}return n}function pD(e,t){if(!e.includes("${"))return e;return e.replaceAll(/\$\{(\w+)\}/g,(n,r)=>t?.[r]??n)}async function mD(e,t){if(!my(e,"utf8").includes("$translationKey"))return null;let n;try{n=await hs(e,t)}catch{return null}return k(n.$translationKey)&&n.$translationKey!==""?n.$translationKey:null}async function V0(e,t){let n=[],r=new Set([".json",".jxn",...t?.documentExtensions("page")??[]]);return await q0(e,e,n,r,t),n.sort(qw),n}async function q0(e,t,n,r,s){let o=lD(e,{withFileTypes:!0});for(let i of o){let a=uD(e,i.name);if(i.isDirectory()){if(i.name.startsWith("_"))continue;await q0(a,t,n,r,s);continue}let l=L0(i.name).toLowerCase();if(!r.has(l))continue;if(i.name.startsWith("_"))continue;let c=fD(t,a);n.push(await hD(c,a,s))}}async function hD(e,t,n){let{isCatchAll:r,isDynamic:s,params:o,urlPattern:i}=Vw(e),a=null;try{let c=(await hs(t,n)).$layout;if(k(c))a=c}catch{}return{$layout:a,isCatchAll:r,isDynamic:s,params:o,relativePath:e,sourcePath:t,urlPattern:i}}function gD(e){let t=e[If];if(!L(t))return null;let{mtime:n}=t;return k(n)&&n!==""?n:null}function H0(e){if(e.includes("\x00"))return"has a NUL character";for(let t of e.split("/")){if(t==="."||t==="..")return'has a "." or ".." segment';if(t.includes("\\"))return"has a backslash"}return null}async function W0(e,t,n={},r,s,o,i={}){let a=[],l=(u,d)=>{let p=`Dynamic route ${u.urlPattern}: ${d}`;if(i.errors===void 0)throw Error(p);i.errors.push(p)},c=e.flatMap((u)=>u.isDynamic?[u.urlPattern]:[]);for(let u of e){if(!u.isDynamic){a.push(u);continue}let d;try{d=await hs(u.sourcePath,r?.formats)}catch{a.push(u);continue}if(!d.$paths){console.warn(`Warning: dynamic route ${u.urlPattern} has no $paths — skipping`);continue}let p;try{p=Ww(d.$paths)}catch(y){l(u,be(y));continue}if(p!==null){let y=cr(u.urlPattern,o??null),S=p.each===void 0?[{}]:await D0(p.each,t,n,r,s,y,u,c);for(let g of S){let x=await yD(u,d,p,g,{locale:y,projectConfig:s,projectRoot:t,registry:r,report:l,sections:n});a.push(...x)}continue}let m=await D0(d.$paths,t,n,r,s,cr(u.urlPattern,o??null),u,c);for(let y of m){let S=u.urlPattern,g={};for(let[E,j]of Object.entries(y)){if(E===If)continue;g[E]=String(j),S=S.replace(`:${E}`,g[E]),S=S.replace("*",g[E])}let x=H0(S);if(x!==null){console.warn(`Warning: $paths for ${u.urlPattern} produced "${S}", which ${x}; skipping it`);continue}let P=gD(y),w={...u,_pathParams:g,isCatchAll:!1,isDynamic:!1,params:[],urlPattern:S};if(P!==null)w.sourceMtime=P;a.push(w)}}return a}function B0(e,t){let n=e;for(let[r,s]of Object.entries(t)){let o=new RegExp(`:${r.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}(?=/|$)`);n=o.test(n)?n.replace(o,()=>s):n.replace("*",()=>s)}return n}async function yD(e,t,n,r,s){let o={};for(let[y,S]of Object.entries(r))if(y!==If)o[y]=String(S);let i=e.params.filter((y)=>!(y in o));if(i.length!==1)return s.report(e,`a paged route takes exactly one parameter besides those its each source fills; this one has ${i.length}`),[];let a=i[0];if(t.state?.[n.key]===void 0)return s.report(e,`$paths.paginate names state entry "${n.key}", which this page does not declare`),[];let l=B0(e.urlPattern,o),c=H0(l);if(c!==null)return console.warn(`Warning: $paths for ${e.urlPattern} produced "${l}", which ${c}; skipping it`),[];let u;try{u=await bD(t,n.key,e,o,s)}catch(y){return s.report(e,be(y)),[]}if(!Array.isArray(u))return s.report(e,`state entry "${n.key}" did not resolve to an array at build time`),[];let d=xD(u,e.sourcePath),p=Jm(u.length,n.pageSize),m=[];for(let y=1;y<=p;y++){let S={...e,_pathParams:{...o,[a]:String(y)},isCatchAll:!1,isDynamic:!1,pagedState:{items:Bw(u,y,n.pageSize),key:n.key},pagination:Uw(l,y,n.pageSize,u.length),params:[],urlPattern:To(l,y)};if(d!==null)S.sourceMtime=d;m.push(S)}return m}function xD(e,t){let n=null,r=cD(t).mtime.getTime();for(let s of e){let o=L(s)?s[If]:void 0,i=L(o)?o.mtime:void 0;if(k(i)&&Date.parse(i)>r)r=Date.parse(i),n=i}return n}async function bD(e,t,n,r,s){let o=e.state?.[t];if(o===void 0||Array.isArray(o))return o;let i={},a=cy(s.projectRoot);for(let[u,d]of Object.entries(s.projectConfig?.imports??{}))i[u]=d.startsWith("./")||d.startsWith("../")?a(d,n):d;Object.assign(i,e.imports);let l={imports:i,state:{[t]:structuredClone(o)}},c={_pathParams:r,locale:s.locale,sourcePath:n.sourcePath,urlPattern:B0(n.urlPattern,r)};return await Vl(l,c,s.projectRoot,{...s.projectConfig&&{config:s.projectConfig},...s.registry&&{registry:s.registry},sections:s.sections}),l.state?.[t]}async function D0(e,t,n,r,s,o,i,a){if(Array.isArray(e))return e;if("values"in e&&Array.isArray(e.values)){let l=k(e.param)?e.param:"value";return e.values.map((c)=>({[l]:c}))}if("$ref"in e&&k(e.$ref)&&e.$ref){let l=e.$ref,c=dD(t,l),u;try{u=JSON.parse(my(c,"utf8"))}catch(m){return console.warn(`Warning: $paths.$ref could not load "${l}": ${be(m)}`),[]}if(!Array.isArray(u))return console.warn(`Warning: $paths.$ref "${l}" must be a JSON array`),[];let d=k(e.param)?e.param:"id",p=k(e.field)?e.field:"id";return u.map((m)=>{if(m===null)throw TypeError(`$paths.$ref "${l}" contains a null entry`);return{[d]:(L(m)?m[p]??m.id:void 0)??String(m)}})}for(let l of Object.keys(e)){let c=r?.byPathsDiscriminator(l);if(!c?.project)continue;let u={data:n[c.project.key],locale:o,projectConfig:s,root:t};if(i!==void 0)u.params=i.params,u.urlPattern=i.urlPattern;if(a!==void 0)u.patterns=a;return await c.call("resolvePaths",e,u)}return console.warn("Warning: unrecognized $paths shape — skipping"),[]}var If="_meta";var hy=J(()=>{Ei();ce();os();Lt();Hw();zw();ly();uy();py()});import{createHash as $D}from"node:crypto";function U0(){return{fontOrigins:new Set,frameOrigins:new Set,imgOrigins:new Set,scriptHashes:new Set,scriptOrigins:new Set,styleOrigins:new Set}}function Ho(e,t){let n=new RegExp(`\\b${t}\\s*=\\s*("([^"]*)"|'([^']*)')`,"i").exec(e);return n?.[2]??n?.[3]}function gy(e){if(e===void 0||!/^https?:\/\//i.test(e))return null;try{return new URL(e).origin}catch{return null}}function kD(e){return`'sha256-${$D("sha256").update(e,"utf8").digest("base64")}'`}function z0(e,t){for(let n of e.matchAll(wD)){let r=n[1]??"",s=Ho(r,"src"),o=(Ho(r,"type")??"").trim().toLowerCase();if(s!==void 0){let i=gy(s);if(i)t.scriptOrigins.add(i);continue}if(SD.has(o))t.scriptHashes.add(kD(n[2]??""))}for(let n of e.matchAll(vD)){let r=n[1]??"",s=(Ho(r,"rel")??"").toLowerCase(),o=Ho(r,"href"),i=gy(o);if(!i)continue;if(s.includes("stylesheet"))t.styleOrigins.add(i);if(_D.test(o??"")||(Ho(r,"as")??"")==="font")t.fontOrigins.add(i)}for(let[n,r]of[[ED,t.imgOrigins],[jD,t.imgOrigins],[PD,t.frameOrigins]])for(let s of e.matchAll(n)){let o=s[1]??"";for(let i of[Ho(o,"src"),...OD(Ho(o,"srcset"))]){let a=gy(i);if(a)r.add(a)}}}function OD(e){return e===void 0?[]:e.split(",").map((t)=>t.trim().split(/\s+/)[0]??"").filter(Boolean)}function AD(e){if(e===!1)return!1;return e==="DENY"?"'none'":"'self'"}function K0(e){let t=e?.csp;if(t===void 0||t===!1)return null;if(t===!0)return{};if(t==="report-only")return{mode:"report-only"};return t}function G0(e,t,n="SAMEORIGIN"){let r=(a,l)=>[...a,...l].join(" "),s={"base-uri":"'self'","default-src":"'self'","font-src":r(["'self'"],e.fontOrigins),"form-action":"'self'","frame-ancestors":AD(n),"frame-src":r(["'self'"],e.frameOrigins),"img-src":r(["'self'","data:"],e.imgOrigins),"object-src":"'none'","script-src":r(["'self'",...[...e.scriptHashes].toSorted()],e.scriptOrigins),"style-src":r(["'self'","'unsafe-inline'"],e.styleOrigins)};if(t.reportUri!==void 0&&t.reportUri!=="")s["report-to"]="csp-endpoint",s["report-uri"]=t.reportUri;for(let[a,l]of Object.entries(t.directives??{}))s[a]=l;let o=Object.entries(s).filter(([,a])=>a!==!1&&a!=="").toSorted(([a],[l])=>a<l?-1:1).map(([a,l])=>`${a} ${String(l)}`).join("; "),i=t.mode==="report-only"?{"Content-Security-Policy-Report-Only":o}:{"Content-Security-Policy":o};if(t.reportUri!==void 0&&t.reportUri!=="")i["Reporting-Endpoints"]=`csp-endpoint="${t.reportUri}"`;return i}var SD,wD,vD,ED,jD,PD,_D;var yy=J(()=>{SD=new Set(["","module","importmap","text/javascript","module-shim","speculationrules"]),wD=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,vD=/<link\b([^>]*)>/gi,ED=/<img\b([^>]*)>/gi,jD=/<source\b([^>]*)>/gi,PD=/<iframe\b([^>]*)>/gi,_D=/\.(woff2?|ttf|otf|eot)(\?|#|$)/i});import{existsSync as Df,readFileSync as CD,writeFileSync as Y0}from"node:fs";import{join as Lf}from"node:path";function Z0(e,t){let n=e?.headers??{},r=[];if(n.enabled===!1)return{errors:r,rules:[]};let s=n.security??{},o={};if(s.contentTypeOptions!==!1)o["X-Content-Type-Options"]="nosniff";if(s.referrerPolicy!==!1)o["Referrer-Policy"]=s.referrerPolicy??"strict-origin-when-cross-origin";if(s.permissionsPolicy!==!1)o["Permissions-Policy"]=s.permissionsPolicy??"camera=(), microphone=(), geolocation=()";if(s.frameOptions!==!1)o["X-Frame-Options"]=s.frameOptions??"SAMEORIGIN";let{hsts:i}=s;if(i){let u=i===!0?{}:i,d=u.maxAge??X0,p=u.includeSubDomains??!0,m=u.preload??!1;if(m&&!p)r.push("build.headers.security.hsts: `preload` requires `includeSubDomains` — the preload list "+"will not accept the header without it.");else o["Strict-Transport-Security"]=[`max-age=${d}`,p?"includeSubDomains":null,m?"preload":null].filter(Boolean).join("; ")}let a=K0(s);if(a)if(t===void 0)r.push("build.headers.security.csp is set, but no page was scanned for inline scripts — the "+"policy would block every one of them.");else Object.assign(o,G0(t,a,s.frameOptions));let l=n.cache??"auto";if(l==="auto")o["Cache-Control"]="public, max-age=0, must-revalidate";let c=[];if(Object.keys(o).length>0)c.push({headers:o,pattern:"/*"});if(l==="auto")c.push({headers:{"Cache-Control":`public, max-age=${X0}, immutable`},pattern:RD});for(let[u,d]of Object.entries(n.rules??{}))c.push({headers:d,pattern:u});return{errors:r,rules:c}}function Q0(e){let t=[["feed.xml","application/atom+xml; charset=utf-8"],["feed.json","application/feed+json; charset=utf-8"],["manifest.webmanifest","application/manifest+json; charset=utf-8"],[".well-known/security.txt","text/plain; charset=utf-8"]],n=[];for(let[r,s]of t)if(Df(Lf(e,r)))n.push({headers:{"Content-Type":s},pattern:`/${r}`});if(Df(Lf(e,"feed","archive")))n.push({headers:{"Content-Type":"application/atom+xml; charset=utf-8"},pattern:"/feed/archive/*"});return n}function eE(e,t){if(t==="")return[...e];return e.map((n)=>({headers:n.headers,pattern:Fe(t,n.pattern)}))}function JD(e){let t=e.map((n)=>{let r=Object.entries(n.headers).map(([s,o])=>` ${s}: ${o}`);return[n.pattern,...r].join(`
|
|
200
|
+
`)});return`${[ND,"",...t].join(`
|
|
152
201
|
`)}
|
|
153
|
-
`}function
|
|
154
|
-
${
|
|
202
|
+
`}function tE(e,t){if(t.length===0)return 0;let n=Lf(e,"_headers"),r=Df(n)?CD(n,"utf8").trim():"",s=JD(t),o=r===""?s:`${s}
|
|
203
|
+
${TD}
|
|
155
204
|
${r}
|
|
156
|
-
`;return
|
|
157
|
-
`)}function
|
|
205
|
+
`;return Y0(n,o,"utf8"),1}function nE(e){let t=Lf(e,".nojekyll");if(Df(t))return 0;return Y0(t,"","utf8"),1}var RD="/images/_optimized/*",X0=31536000,ND="# Generated by @jxsuite/compiler — configure via build.headers in project.json.",TD="# ─── public/_headers (hand-authored; these rules override the block above) ───";var rE=J(()=>{An();yy()});async function sE(e,t,n,r={}){let s={},o=am(e);for(let i of n.projectContributions()){let a=i.project?.key;if(!a||!i.capabilities.projectData)continue;if(!t||!(a in t))continue;s[a]=await i.call("projectData",t[a],{io:o,projectConfig:t,registry:n,root:e,...r.lazy===!0&&{lazy:!0},...r.includeHeld===!0&&{includeHeld:!0}})}return s}var oE=J(()=>{is()});import{cpSync as MD,existsSync as ID,mkdirSync as DD}from"node:fs";import{dirname as LD,resolve as FD}from"node:path";async function iE(e,t,n){let r=[],s=[],o=new Map;for(let i of e.assetProviders()){let a=i.project?.key,l=a?t[a]:void 0;if(a&&(l==null||D(l)&&Object.keys(l).length===0))continue;try{let c=await i.call("assets",l??null,{projectConfig:t,root:n});for(let u of c??[]){if(!D(u)||!u.urlPrefix||!u.dir)continue;let d={dir:u.dir,urlPrefix:yu(u.urlPrefix)};if(_t(u.filter))d.filter=u.filter;let p=o.get(d.urlPrefix);if(p){if(p.dir!==d.dir)s.push(`Asset mount conflict: "${d.urlPrefix}" is claimed by both "${p.dir}" and "${d.dir}"`);continue}o.set(d.urlPrefix,d),r.push(d)}}catch(c){s.push(`Error in ${i.name}.assets: ${be(c)}`)}}return{errors:s,mounts:r}}function Ff(e,t,n){if(t.length===0||!e)return;for(let r of HS(e,t))n.add(r)}function aE(e,t,n){let r=0,s=[];for(let o of e){let i=xu(t,o);if(!i||!ID(i)){s.push(o);continue}let a=FD(n,decodeURIComponent(o).replace(/^\//,""));DD(LD(a),{recursive:!0}),MD(i,a),r+=1}return{copied:r,missing:s}}var lE=J(()=>{An();ce();Lt()});import{readFileSync as VD}from"node:fs";import{dirname as qD,isAbsolute as HD,relative as WD,resolve as cE,sep as BD}from"node:path";function Vf(e,t){return`${e}${t==="client"?xy:by}`}function GD(e){if(e.endsWith(xy))return{documentPath:e.slice(0,-xy.length),side:"client"};if(e.endsWith(by))return{documentPath:e.slice(0,-by.length),side:"server"};return null}function Ki(e,t,n){return pl(e,uE(t,n))}function uE(e,t){return WD(t,e).split(BD).join("/")}function XD(e){return kn(VD(e,"utf8"),e)}function fE(e,t=XD){let n=new Map,r=(c)=>uE(c,e),s=(c)=>{let u=n.get(c);if(u===void 0)u=(async()=>t(c))(),n.set(c,u);return u},o=async(c,u)=>{let d;try{d=await s(c)}catch(S){throw Error(`Cannot read ${r(c)} for its ${u} script`,{cause:S})}let p=d.$script?.[u];if(p===void 0)throw Error(`${r(c)} has no ${u} script: nothing in it is $script.${u}, but something names its ${u} module`);let[m,...y]=Mw(p).problems;if(m!==void 0)throw new Cu({path:r(c),pointer:`/$script/${u}`},[m,...y]);return p},i=(c)=>{let u=Ni(c);if(u===null)return null;return{documentPath:cE(e,u.path),side:u.side}},a=(c)=>({name:`jx-document-scripts-${c}`,setup:(u)=>{u.onResolve({filter:zD},({path:d})=>{let p=i(d);if(p===null)return;if(p.side==="server"&&c==="client")throw Error(`${r(p.documentPath)}: its server script cannot be imported by code a browser runs`);return{path:Vf(p.documentPath,p.side)}}),u.onResolve({filter:KD},({importer:d,path:p})=>{if(HD(p))return{path:Vf(p,"client")};return p.startsWith("./")||p.startsWith("../")?{path:Vf(cE(qD(d),p),"client")}:void 0}),u.onLoad({filter:UD},async({path:d})=>{let p=GD(d);return{contents:await o(p.documentPath,p.side),loader:"ts"}})}}),l=async(c)=>{let u=i(c);if(u===null)throw Error(`"${c}" does not name a document's script`);return{contents:await o(u.documentPath,u.side),path:Vf(u.documentPath,u.side)}};return{clientPlugin:a("client"),module:l,serverPlugin:a("server")}}var xy=".jx-client.ts",by=".jx-server.ts",UD,zD,KD;var qf=J(()=>{Ru();Ti();os();UD=/\.jx-(?:client|server)\.ts$/,zD=/^jx-script:/,KD=/\.jxn$/});async function $y(e,t,n){let r=e.$layout??t.defaults?.layout??null;if(!r)return e;let s=await n(r);if(s.$layout)s=await $y(s,t,n);let o=e.children??[],i=k(o)?[o]:Array.isArray(o)?o:[],a=ZD(s);if(YD(a,i),e.state)a.state={...a.state,...e.state};if(e.$media)a.$media={...a.$media,...e.$media};if(e.style)a.style={...a.style,...e.style};if(e.attributes)a.attributes={...a.attributes,...e.attributes};if(e.$head)a._pageHead=e.$head;if(e.title)a._pageTitle=e.title;return delete a.$layout,a}function YD(e,t){let n=new Map,r=[];for(let s of t){let o=D(s)?s.attributes?.slot:void 0;if(o){let i=n.get(o);if(!i)i=[],n.set(o,i);i.push(s)}else r.push(s)}dE(e,n,r)}function dE(e,t,n){if(!D(e))return;if(!Array.isArray(e.children))return;let r=[];for(let s of e.children)if(D(s)&&s.tagName==="slot"){let o=s.attributes?.name,i=o?t.get(o):void 0;if(o&&i)r.push(...i),t.delete(o);else if(!o&&n.length>0)r.push(...n);else if(Array.isArray(s.children))r.push(...s.children)}else dE(s,t,n),r.push(s);e.children=r}function ZD(e){return structuredClone(e)}var pE=J(()=>{ce()});import{existsSync as QD,readFileSync as eL}from"node:fs";import{resolve as mE}from"node:path";function hE(e){return(t)=>{let n=mE(e,t);if(!QD(n))throw Error(`Layout not found: ${t} (resolved to ${n})`);try{let r=kn(eL(n,"utf8"),n);return Ki(Ar(r,n),n,e)}catch(r){throw Error(`Invalid layout at ${n}: ${be(r)}`,{cause:r})}}}function gE(e,t,n){return $y(e,t,hE(n))}function Hf(e,t,n){let r=hE(n),s=[],o=e.$layout??t.defaults?.layout;while(o){let i=mE(n,o);if(s.some((l)=>l.path===i))break;let a=r(o);s.push({doc:a,path:i}),o=a.$layout}return s}var Sy=J(()=>{Ei();qf();os();Lt();pE()});import{existsSync as yE,readdirSync as tL}from"node:fs";import{dirname as nL,isAbsolute as rL,relative as sL,resolve as wy}from"node:path";function oL(e){let{$elements:t}=e;if(!Array.isArray(t))return[];let n=[];for(let r of t)if(L(r)&&k(r.$ref)&&r.$ref!=="")n.push(r.$ref);return n}async function xE(e){let{formatRegistry:t,pageSources:n,projectConfig:r,projectRoot:s}=e,o=[],i=[],a=new Set,l=new Map,c=(m)=>sL(s,m).replaceAll("\\","/"),u=async(m,y)=>{if(a.has(m))return;let S=c(m),g=y?`${y.declarer}: $elements entry "${y.ref}" names`:"";if(y){if(S.startsWith("..")||rL(S)){a.add(m),i.push(`${g} ${S}, outside the project`);return}if(!yE(m)){a.add(m),i.push(`${g} no file (${S})`);return}}a.add(m);let x;try{x=Ki(await hs(m,t),m,s)}catch(E){i.push(`Error compiling component ${S}: ${be(E)}`);return}let P=k(x.tagName)?x.tagName:"";if(!P.includes("-")){i.push(y?`${g} ${S}, which is not a component (no hyphenated tagName)`:`Error compiling component ${S}: tagName "${P}" must contain a hyphen`);return}let w=l.get(P);if(w!==void 0){i.push(`${c(w)} and ${S} both declare tagName "${P}"; rename one`);return}l.set(P,m),o.push({doc:x,path:m,tagName:P}),await d(x,m)},d=async(m,y,S=nL(y))=>{for(let g of oL(m))await u(wy(S,g),{declarer:c(y),ref:g})},p=wy(s,"components");if(yE(p)){let m=[".json",...t.documentExtensions("component")],y=tL(p).filter((S)=>m.some((g)=>S.endsWith(g))).toSorted();for(let S of y)await u(wy(p,S),null)}await d(r,qn(s),s);for(let m of new Set(n))try{let y=await hs(m,t),S=Hf(y,r,s);await d(y,m);for(let g of S)await d(g.doc,g.path)}catch{}return{components:o,errors:i}}var bE=J(()=>{ce();Lt();Eo();qf();Sy();hy()});import{dirname as iL,relative as aL,resolve as lL,sep as cL}from"node:path";function $E(e,t){return aL(t,e).split(cL).join("/")}function uL(e,t,n){if(!e.startsWith("./")&&!e.startsWith("../"))return e;return`./${$E(lL(t,e),n)}`}function ql(e,t,n){let r=iL(t),s=$E(t,n);return l0(e).map((o)=>({exportName:o.exportName,src:uL(o.src,r,n),declaredIn:s}))}function SE(e){let t=new Map;for(let{exportName:s,src:o,declaredIn:i}of e){let a=t.get(s)??new Map;if(t.set(s,a),!a.has(o))a.set(o,i)}let n=[],r=[];for(let[s,o]of t){let i=[...o];if(n.push({exportName:s,src:i[0][0]}),i.length>1){let a=i.map(([l,c])=>`${l} (declared in ${c})`);r.push(`Server function "${s}" is exported by ${i.length} different modules: ${a.join(", ")}. The site worker serves one function per export name, at /_jx/server/${s}, so a call meant for any but the first would get the first's answer. Rename the export in all but one module, and the $export that names it.`)}}return{entries:n,errors:r}}var wE=J(()=>{yn()});function vE(e,t){if(!k(t)||t.trim()==="")return[...e];return[{attributes:{content:t,name:"description"},tagName:"meta"},...e]}function EE(e=[],t=[],n=[],r={}){let s=[{attributes:{charset:r.charset??"utf8"},tagName:"meta"},{attributes:{content:"width=device-width, initial-scale=1",name:"viewport"},tagName:"meta"}],o=new Map;for(let a of[...s,...e,...t,...n]){let l=vy(a);o.set(l,a)}let i=r.title??r.siteName??"Jx Site";if(o.set("title",{children:[i],tagName:"title"}),r.pageUrl&&r.siteUrl){let a=Cs(r.pageUrl,r.siteUrl);if(![...o.values()].some((c)=>D(c)&&c.tagName==="link"&&c.attributes?.rel==="canonical")){let c={attributes:{href:a,rel:"canonical"},tagName:"link"};o.set(vy(c),c)}if(!o.has("meta:og:url"))o.set("meta:og:url",{attributes:{content:a,property:"og:url"},tagName:"meta"})}if(r.siteName&&!o.has("meta:og:site_name"))o.set("meta:og:site_name",{attributes:{content:r.siteName,property:"og:site_name"},tagName:"meta"});for(let a of r.alternates??[]){let l={attributes:{href:a.href,hreflang:a.hreflang,rel:"alternate"},tagName:"link"},c=vy(l);if(!o.has(c))o.set(c,l)}return[...o.values()]}function vy(e){if(!D(e))return String(e);let t=e.tagName??"unknown",n=e.attributes??{};if(t==="title")return"title";if(n.charset)return"meta:charset";if(t==="meta"&&n.name)return`meta:${n.name}`;if(t==="meta"&&n.property)return`meta:${n.property}`;if(t==="link"&&n.rel){let r=n.hreflang??n.type??n.media??n.sizes??"";return`link:${n.rel}:${n.href??""}:${String(r)}`}if(t==="script"&&n.src)return`script:${n.src}`;if(t==="style"){let r=Array.isArray(e.children)?e.children.join(""):e.textContent,s=D(r)?JSON.stringify(r):r??"";return`style:${fL(s)}`}return`${t}:${JSON.stringify(e)}`}function fL(e){let t=0;for(let n=0;n<e.length;n++)t=Math.trunc((t<<5)-t+(e.codePointAt(n)??0));return t.toString(36)}function jE(e){return e.map((t)=>dL(t)).join(`
|
|
206
|
+
`)}function dL(e){if(k(e))return e;if(!D(e))return"";let t=e.tagName,n=e.attributes??{},r=Object.entries(n).map(([l,c])=>c===!0?l:`${l}="${pL(c)}"`).join(" "),s=r?`<${t} ${r}>`:`<${t}>`;if(t!==void 0&&new Set(["meta","link","base","br","hr","img","input"]).has(t))return s;let i=Array.isArray(e.children)?e.children.join(""):e.textContent,a=D(i)?JSON.stringify(i,null,2):i??"";return`${s}${a}</${t}>`}function pL(e){return String(e).replaceAll("&","&").replaceAll('"',""").replaceAll("<","<")}var PE=J(()=>{An();ce()});function gL(e){let t=e.indexOf(":");if(t===-1)return!1;if(t===e.length-1)return!1;try{return new URL(e).protocol!==""}catch{return!1}}function yL(e){if(!k(e))return[];return e.split(/\s+/).filter((t)=>{if(t==="")return!1;let n=t.toLowerCase();return!mL.has(n)&&!hL.has(n)&&!gL(t)})}function _E(e){let t=new Set;for(let n of e){if(!D(n)||n.tagName!=="link")continue;for(let r of yL(n.attributes?.rel))t.add(r)}return[...t]}var mL,hL;var kE=J(()=>{ce();mL=new Set(["about","acl","alternate","amphtml","api-catalog","appendix","apple-touch-icon","apple-touch-startup-image","archives","author","blocked-by","bookmark","c2pa-manifest","canonical","chapter","cite-as","collection","compression-dictionary","contents","convertedfrom","copyright","create-form","current","deprecation","describedby","describes","disclosure","dns-prefetch","dpp","duplicate","edit","edit-form","edit-media","enclosure","external","first","geofeed","glossary","help","hosts","hub","ice-server","icon","index","intervalafter","intervalbefore","intervalcontains","intervaldisjoint","intervalduring","intervalequals","intervalfinishedby","intervalfinishes","intervalin","intervalmeets","intervalmetby","intervaloverlappedby","intervaloverlaps","intervalstartedby","intervalstarts","item","last","latest-version","license","linkset","lrdd","manifest","mask-icon","me","media-feed","memento","micropub","modulepreload","monitor","monitor-group","next","next-archive","nofollow","noopener","noreferrer","opener","openid2.local_id","openid2.provider","original","p3pv1","payment","pingback","preconnect","predecessor-version","prefetch","preload","prerender","prev","prev-archive","preview","previous","privacy-policy","profile","publication","rdap-active","rdap-bottom","rdap-down","rdap-top","rdap-up","related","replies","restconf","ruleinput","search","section","self","service","service-desc","service-doc","service-meta","sip-trunking-capability","sponsored","start","status","stylesheet","subsection","successor-version","sunset","tag","terms-of-service","timegate","timemap","type","ugc","up","version-history","via","webmention","working-copy","working-copy-of"]),hL=new Set(["shortcut"])});function bL(e){let t=JSON.stringify(e);return/^\.{1,2}\//u.test(e)?`new URL(${t}, import.meta.url).href`:t}async function Gi(e,t={}){let{resolveElementPath:n,$media:r,formats:s}=t,o=[],i=new Set;async function a(l,c){let u,d;if(k(l)){let{readFileSync:T}=await import("node:fs"),{resolve:I}=await import("node:path");if(d=c?I(c,l):I(l),i.has(d))return;if(i.add(d),Vn(d))u=kn(T(d,"utf8"),d);else{let{extname:V}=await import("node:path"),H=V(d).toLowerCase(),O=s?.byExtension(H,"parse");if(!O){await Promise.resolve().then(() => is());throw du(d,H)}u=await O.parseDocument(T(d,"utf8"))}if(u=Ar(u,d),t.projectRoot!==void 0){let{relative:V}=await import("node:path");u=pl(u,V(t.projectRoot,d))}}else{if(u=Ar(l,l.tagName??"a component"),d=null,u.tagName&&i.has(u.tagName))return;if(u.tagName)i.add(u.tagName)}await t.prepareDocument?.(u,d);let p=u.state??{};u=df(u,t.projectState);let{tagName:m}=u;if(!m||!m.includes("-"))throw Error(`compileElement: tagName "${m}" must contain a hyphen`);let{dirname:y}=await import("node:path"),S=d?y(d):null,g=[];if(Array.isArray(u.$elements))for(let T of u.$elements){let I=me(T)?T.$ref:T;if(!k(I))continue;if(S)await a(I,S);let V=n?n(I,S):I.replace(/\.(?:json|jxn)$/i,".js");g.push(V)}let x=Ms(m);if(r)u.$media={...r,...u.$media};let{resolveClass:P,rewriteSrc:w}=t,E=u.imports??{},j=Ey(u,x,g,w?(T)=>w(T,S):void 0,Rn(u,t.defaults),t.serverBaseUrl,Object.keys(u.state??{}).filter((T)=>!(T in p)),P?(T)=>P(T,S,E):void 0,t.stylesheetHref?.(m)??null),A=d?d.replace(/\.(?:json|jxn)$/i,".js"):`${m}.js`;o.push({content:j,path:A,tagName:m})}return await a(e,t.basePath??null),{files:o}}async function $L(e,t={}){let{title:n="Jx App",reactivitySrc:r=Ts,litHtmlSrc:s=Nr}=t,o=await Gi(e,t),i=o.files.at(-1);if(!i)throw Error("compileElementPage: no element modules were produced");let{basename:a}=await import("node:path"),l=a(i.path),c=`<!DOCTYPE html>
|
|
158
207
|
<html lang="en">
|
|
159
208
|
<head>
|
|
160
209
|
<meta charset="utf-8">
|
|
161
210
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
162
|
-
<title>${
|
|
163
|
-
|
|
164
|
-
{
|
|
165
|
-
"imports": {
|
|
166
|
-
"@vue/reactivity": "${r}",
|
|
167
|
-
"lit-html": "${s}"
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
</script>
|
|
211
|
+
<title>${Ne(n)}</title>
|
|
212
|
+
${Ii({litHtmlSrc:s,reactivitySrc:r,runtimeImports:t.runtimeImports})}
|
|
171
213
|
</head>
|
|
172
214
|
<body>
|
|
173
215
|
<${i.tagName}></${i.tagName}>
|
|
174
|
-
<script type="module" src="./${
|
|
216
|
+
<script type="module" src="./${l}"></script>
|
|
175
217
|
</body>
|
|
176
|
-
</html>`;return{files:o.files,html:l}}function mI(e){if(!D(e)||Array.isArray(e))return JSON.stringify(e);if("default"in e)return JSON.stringify(e.default);if(rs(e))return;if(e.$prototype==="LocalStorage"||e.$prototype==="SessionStorage")return JSON.stringify(e.default??null);if(e.$prototype==="Request")return"null";if(Mr(e))return"null";return JSON.stringify(e)}function ic(e,t,n,r,s=null,o="/_jx/server"){let i=["// Generated by @jxsuite/compiler — do not edit manually"];if(e.$id)i.push(`// Source: ${e.$id}`);for(let S of n)i.push(`import '${S}';`);let a=e.state??{},c=jo(e),l=cu(au(a,c),r);i.push(...l.imports);let u=Object.entries(a).flatMap(([S,_])=>_n(_)&&_.$prototype==="Request"?[[S,_]]:[]),d=Object.entries(a).flatMap(([S,_])=>Mr(_)?[[S,_]]:[]);if(i.push("import { reactive, computed, effect, stop } from '@vue/reactivity';","import { render, html, nothing } from 'lit-html';",uu()),d.length>0)i.push(fu());let p=s===null&&xs(e.children);if(p)i.push(S$());i.push(...l.loaders,"",`class ${t} extends HTMLElement {`," #effects = [];"," #rendered = false;",...s===null?[]:[" #root = null;"],""," constructor() {"," super();");let m=[],x=[],h=[],g=[],b=[];for(let[S,_]of Object.entries(a))if(yn(_))if(Ir(_))g.push([S,_]);else if(mr(_.$expression.operator))h.push([S,_]);else x.push([S,_]);else if(jt(_))(c.get(S)==="computed"?x:h).push([S,_]);else if(k(_)&&_.includes("${"))b.push([S,_]);else{let N=mI(_);if(N!==void 0)m.push([S,N])}i.push(" this.state = reactive({");for(let[S,_]of m)i.push(` ${Gr(S)}: ${_},`);i.push(" });");for(let[S,_]of h)if(i.push(""),yn(_)){let N=Yt(_.$expression,{eventParam:"e",statePrefix:"s"});i.push(` ${Je("this.state",Xt(S))} = (s, e) => { ${N}; };`)}else if(sr(_)){let N=Jn(_.body,{dispatchTarget:"this",eventParam:"e",indent:" ",statePrefix:"this.state"});i.push(` ${Je("this.state",Xt(S))} = (s, e) => {`,N," };")}else{let N=Je("this.state",Xt(S));if(_.$src)i.push(` ${N} = ${S};`);else{let F=k(_.body)?_.body:"";i.push(` ${N} = (${fr(_).join(", ")}) => {`,` ${F}`," };")}}for(let[S,_]of g){i.push("");let N=Yt(_.$expression,{eventParam:"e",statePrefix:"this.state"});i.push(` ${Je("this.state",Xt(S))} = ${nc(_,N)};`)}for(let[S,_]of b)i.push("",` ${Je("this.state",Xt(S))} = computed(() => ${lu(ki(_,"this.state",{code:!1}))});`);for(let[S,_]of x)if(i.push(""),yn(_)){let N=Yt(_.$expression,{eventParam:"e",statePrefix:"this.state"});i.push(` ${Je("this.state",Xt(S))} = computed(() => ${N});`)}else if(_.$src)i.push(` ${Je("this.state",Xt(S))} = computed(() => ${S}(this.state));`);else{i.push(` ${Je("this.state",Xt(S))} = computed(() => {`);let N=ki(k(_.body)?_.body:"","this.state");i.push(` ${N}`," });")}i.push(" }","");let j=[];if(Array.isArray(e.children)){let S={n:0};for(let _ of e.children)bs(_,j,e.$media??{},"",S,e.tagName)}let v=Tw(),P=!Array.isArray(e.children)&&e.textContent!==void 0?` ${ku(e.textContent)}`:Pu(e.children,e.style," ",!1,!1,v);i.push(" template() {"," const s = this.state;",...v.decls," return html`",P," `;"," }","",...s===null?[]:[" #renderRoot() {"," if (this.#root) return this.#root;",s==="closed"?" this.#root = this.attachInternals().shadowRoot ?? this.attachShadow({ mode: 'closed' });":" this.#root = this.shadowRoot ?? this.attachShadow({ mode: 'open' });"," return this.#root;"," }",""]," connectedCallback() {"," const _pa = this.getAttribute('data-jx-props');"," if (_pa) {"," try {"," const _p = JSON.parse(_pa);"," for (const [k, v] of Object.entries(_p)) {"," if (k.startsWith('#')) continue;"," if (k in this.state) this.state[k] = v;"," }"," } catch {}"," this.removeAttribute('data-jx-props');"," }"," const _pn = this.getAttributeNames().filter(n => n.startsWith('props.') && n.length > 6);"," for (const _n of _pn) {"," const _k = _n.slice(6);"," if (_k.startsWith('#')) { this.removeAttribute(_n); continue; }"," if (_k in this.state) {"," this.state[_k] = this.getAttribute(_n);"," this.removeAttribute(_n);"," }"," }"," for (const key of Object.keys(this.state)) {"," if (key.startsWith('#')) continue;"," if (this.hasOwnProperty(key) && this[key] !== undefined) {"," this.state[key] = this[key];"," }"," }");for(let[S,_]of u)i.push(nu(S,_,{collect:"this.#effects",indent:" ",statePrefix:"this.state"}));for(let[S,_]of d)i.push(ru(S,_,{collect:"this.#effects",indent:" ",serverBaseUrl:o,statePrefix:"this.state"}));if(D(e.style)){let S=[];for(let[_,N]of Object.entries(e.style)){if(_.startsWith(":")||_.startsWith(".")||_.startsWith("&")||_.startsWith("[")||_.startsWith("@"))continue;if(k(N)&&N.includes("${"))S.push([an(_),N])}if(S.length>0){i.push(" this.#effects.push(effect(() => {");for(let[_,N]of S){let F=N.replaceAll(/\$\{([^}]+)\}/g,(K,J)=>`\${${ki(J,"this.state")}}`);i.push(` this.style['${_}'] = \`${F}\`;`)}i.push(" }));")}}if(i.push(" const _first = !this.#rendered;"," this.#rendered = true;"),p)i.push(` const _slotted = _first ? ${Up}(this) : null;`);if(i.push(" if (this.hasAttribute('data-jx-prerendered')) {"," this.removeAttribute('data-jx-prerendered');"," }"),s===null)i.push(" if (_first) this.replaceChildren();"," this.#effects.push(effect(() => render(this.template(), this)));");else i.push(" const _root = this.#renderRoot();"," if (_first) {"," for (const _n of [..._root.childNodes]) {"," if (!(_n.nodeType === 1 && _n.tagName === 'LINK')) _n.remove();"," }"," }"," this.#effects.push(effect(() => render(this.template(), _root)));");if(p)i.push(` if (_first) ${Bp}(this, _slotted);`);return i.push(" if (typeof this.state.onMount === 'function') {"," queueMicrotask(() => this.state.onMount(this.state));"," }"," }",""," disconnectedCallback() {"," for (const _e of this.#effects) { stop(_e); }"," this.#effects.length = 0;"," if (typeof this.state.onUnmount === 'function') { this.state.onUnmount(this.state); }"," }","}","",`customElements.define('${e.tagName}', ${t});`,""),i.join(`
|
|
177
|
-
`)}function
|
|
218
|
+
</html>`;return{files:o.files,html:c}}function SL(e){if(!D(e)||Array.isArray(e))return JSON.stringify(e);if("default"in e)return JSON.stringify(e.default);if($s(e))return;if(e.$prototype==="LocalStorage"||e.$prototype==="SessionStorage")return JSON.stringify(e.default??null);if(e.$prototype==="Request")return"null";if(Hi(e))return"null";if(Zr(e))return"null";return JSON.stringify(e)}function Ey(e,t,n,r,s=null,o="/_jx/server",i=[],a,l=null){let c=["// Generated by @jxsuite/compiler — do not edit manually"];if(e.$id)c.push(`// Source: ${e.$id}`);for(let B of n)c.push(`import '${B}';`);let u=e.state??{},d=Or(e),p=hf(mf(u,d),r);c.push(...p.imports);let m=Pf(u,a),y=m.entries.length>0;c.push(...m.imports);let S=Object.entries(u).flatMap(([B,q])=>Pn(q)&&q.$prototype==="Request"?[[B,q]]:[]),g=Object.entries(u).flatMap(([B,q])=>Zr(q)?[[B,q]]:[]),x=xf(e);if(c.push(x.keyed?"import { reactive, computed, effect, stop, shallowRef } from '@vue/reactivity';":"import { reactive, computed, effect, stop } from '@vue/reactivity';","import { render, html, nothing } from 'lit-html';",...x.keyed?Sf:[],yf()),x.arranged||x.keyed)c.push($f());if(x.keyed)c.push(wf());let P=Object.keys(u).filter((B)=>!Zo(B)),w=P.filter((B)=>!xL.has(B)),E=w.filter((B)=>i.includes(B)),j=E.length>0;c.push(`const __jxProps = ${JSON.stringify(P)};`);let A=oh(e),T=w.filter((B)=>A.has(B));if(w.length>0)c.push(`const __jxBridged = ${JSON.stringify(w)};`,Gv());if(T.length>0)c.push(`const __jxDerived = new Set(${JSON.stringify(T)});`);if(j)c.push(`const __jxInherited = new Set(${JSON.stringify(E)});`);let I=Tl(e);if(I.length>0)c.push(Xv(),`const __jxObserved = ${JSON.stringify(I)};`,`const __jxObservedDefaults = () => ${Zv(e)};`);if(g.length>0)c.push(Ef());if(y)c.push(jf());let V=s===null&&Ns(e.children);if(V)c.push(n0());let H=e.formAssociated===!0;if(H)c.push(t0());c.push(...p.loaders,"",`class ${t} extends HTMLElement {`," #effects = [];"," #rendered = false;",...x.keyed?[" #part = null;"]:[],...s===null?[]:[" #root = null;"],...H?[" #internals;"," #form = null;"]:[],...y?[" #jxInstances = new Map();"," #jxReady = null;"," #jxConnection = 0;"," #jxDrawn = false;"]:[],"",...I.length>0?[" static get observedAttributes() { return __jxObserved; }",""]:[],...H?[" static formAssociated = true;",""," #attach() {"," if (this.#internals === undefined) {"," this.#internals = typeof this.attachInternals === 'function' ? this.attachInternals() : null;"," }"," return this.#internals;"," }",""]:[]," constructor() {"," super();");let O=[],N=[],G=[],Q=[],re=[];for(let[B,q]of Object.entries(u))if(fn(q))if(wr(q))Q.push([B,q]);else if(dr(q.$expression.operator))G.push([B,q]);else N.push([B,q]);else if(kt(q))(d.get(B)==="computed"?N:G).push([B,q]);else if(k(q)&&q.includes("${"))re.push([B,q]);else{let z=SL(q);if(z!==void 0)O.push([B,z])}c.push(" this.state = reactive({");for(let[B,q]of O)c.push(` ${us(B)}: ${q},`);c.push(" });");for(let[B,q]of G)if(c.push(""),fn(q)){let z=gn(q.$expression,{eventParam:"e",statePrefix:"s"});c.push(` ${Re("this.state",Wt(B))} = (s, e) => { ${z}; };`)}else if(vr(q)){let z=zn(q.body,{dispatchTarget:"this",eventParam:"e",indent:" ",statePrefix:"this.state"});c.push(` ${Re("this.state",Wt(B))} = (s, e) => {`,z," };")}else{let z=Re("this.state",Wt(B));if(q.$src)c.push(` ${z} = ${B};`);else{let We=k(q.body)?q.body:"";c.push(` ${z} = (${kr(q).join(", ")}) => {`,` ${We}`," };")}}for(let[B,q]of Q){c.push("");let z=gn(q.$expression,{eventParam:"e",statePrefix:"this.state"});c.push(` ${Re("this.state",Wt(B))} = ${kl(q,z)};`)}for(let[B,q]of re){let z=Fi(q,"this.state",{code:!1}),We=gf(z);c.push("",zf(z)?` ${Re("this.state",Wt(B))} = computed(() => { const state = this.state; return ${We}; });`:` ${Re("this.state",Wt(B))} = computed(() => ${We});`)}for(let[B,q]of N)if(c.push(""),fn(q)){let z=gn(q.$expression,{eventParam:"e",statePrefix:"this.state"});c.push(` ${Re("this.state",Wt(B))} = computed(() => ${z});`)}else if(q.$src)c.push(` ${Re("this.state",Wt(B))} = computed(() => ${B}(this.state));`);else{c.push(` ${Re("this.state",Wt(B))} = computed(() => {`);let z=Fi(k(q.body)?q.body:"","this.state");c.push(` ${z}`," });")}let ue=wL(e);if(ue.length>0){c.push(""," {"," const s = this.state;");for(let{type:B,source:q}of ue)c.push(` this.addEventListener(${JSON.stringify(B)}, ${q});`);c.push(" }")}c.push(" }","");let ne={n:0};for(let B of Of(e))o0(B,ne,e.tagName??"jx");let fe=CE(),xe=!Array.isArray(e.children)&&e.textContent!==void 0?` ${Kf(e.textContent)}`:Bf(e.children,e.style," ",!1,!1,fe),X=[xe,...fe.decls].some((B)=>zf(B));if(c.push(" template() {"," const s = this.state;",...X?[" const state = s;"]:[],...fe.decls," return html`",xe," `;"," }","",...s===null?[]:[" #renderRoot() {"," if (this.#root) return this.#root;",s==="closed"?H?" const _a = this.#attach()?.shadowRoot ?? null;":" const _a = this.attachInternals().shadowRoot;":" const _a = this.shadowRoot;",` this.#root = _a ?? this.attachShadow({ mode: '${s}' });`,...l===null?[]:[` if (!_a) this.#root.append(Object.assign(document.createElement('link'), { rel: 'stylesheet', href: ${bL(l)} }));`]," return this.#root;"," }",""]," connectedCallback() {"," const _first = !this.#rendered;"," this.#rendered = true;",...x.keyed?[" this.#part?.setConnected(true);"]:[],...j?[" const _given = new Set();"]:[],...I.length>0?[" if (_first) {"," const _d = __jxObservedDefaults();"," for (const _a of __jxObserved) {",` if (this.hasAttribute(_a)) ${vf}(this.state, _a, this.getAttribute(_a), _d);`," }"," }"]:[]," const _pa = this.getAttribute('data-jx-props');"," if (_pa) {"," try {"," const _p = JSON.parse(_pa);"," for (const [k, v] of Object.entries(_p)) {"," if (k.startsWith('#')) continue;",j?" if (__jxProps.includes(k)) { this.state[k] = v; _given.add(k); }":" if (__jxProps.includes(k)) this.state[k] = v;"," }"," } catch {}"," this.removeAttribute('data-jx-props');"," }"," const _pn = this.getAttributeNames().filter(n => n.startsWith('props.') && n.length > 6);"," for (const _n of _pn) {"," const _k = _n.slice(6);"," if (_k.startsWith('#')) { this.removeAttribute(_n); continue; }"," if (__jxProps.includes(_k)) {"," this.state[_k] = this.getAttribute(_n);",...j?[" _given.add(_k);"]:[]," this.removeAttribute(_n);"," }"," }"),w.length>0)c.push(" if (_first) {"," for (const _k of __jxBridged) {",...T.length>0?[" if (__jxDerived.has(_k)) continue;"]:[],` if (_k in this && this[_k] !== undefined && ${Wg}(this, _k)) {`," this.state[_k] = this[_k];",...j?[" _given.add(_k);"]:[]," }"," }"," for (const _k of __jxBridged) {",...j?[" if (__jxInherited.has(_k) && !_given.has(_k)) continue;"]:[],...T.length>0?[" if (__jxDerived.has(_k)) {"," Object.defineProperty(this, _k, { configurable: true, get: () => this.state[_k] });"," continue;"," }"]:[],` const _set = ${Bg}(this, _k);`," Object.defineProperty(this, _k, {"," configurable: true,"," get: () => this.state[_k],"," set: (v) => { if (_set) _set.call(this, v); this.state[_k] = v; },"," });"," }"," }");if(y)c.push(` this.#jxReady ??= ${_f(m.entries,{indent:" ",instances:"this.#jxInstances",statePrefix:"this.state"})};`," const _c = ++this.#jxConnection;"," this.#jxReady.then(() => {"," if (_c === this.#jxConnection && this.isConnected) this.#jxRender();"," });"," }",""," #jxRender() {"," const _first = !this.#jxDrawn;"," this.#jxDrawn = true;");for(let[B,q]of S)c.push(cf(B,q,{collect:"this.#effects",indent:" ",statePrefix:"this.state"}));for(let[B,q]of g)c.push(uf(B,q,{collect:"this.#effects",indent:" ",serverBaseUrl:o,statePrefix:"this.state"}));if(c.push(...vL(e)),D(e.style)){let B=[];for(let[q,z]of Object.entries(e.style)){if(q.startsWith(":")||q.startsWith(".")||q.startsWith("&")||q.startsWith("[")||q.startsWith("@"))continue;if(k(z)&&z.includes("${"))B.push([hn(q),z])}if(B.length>0){c.push(" this.#effects.push(effect(() => {");for(let[q,z]of B){let We=z.replaceAll(/\$\{([^}]+)\}/g,(qe,Ye)=>`\${${Fi(Ye,"this.state")}}`);c.push(` this.style['${q}'] = \`${We}\`;`)}c.push(" }));")}}if(V)c.push(` const _slotted = _first ? ${Gg}(this) : null;`);if(c.push(" if (this.hasAttribute('data-jx-prerendered')) {"," this.removeAttribute('data-jx-prerendered');"," }"),s===null)c.push(" if (_first) this.replaceChildren();",x.keyed?" this.#effects.push(effect(() => { this.#part = render(this.template(), this); }));":" this.#effects.push(effect(() => render(this.template(), this)));");else c.push(" const _root = this.#renderRoot();"," if (_first) {"," for (const _n of [..._root.childNodes]) {"," if (!(_n.nodeType === 1 && _n.tagName === 'LINK')) _n.remove();"," }"," }",x.keyed?" this.#effects.push(effect(() => { this.#part = render(this.template(), _root); }));":" this.#effects.push(effect(() => render(this.template(), _root)));");if(V)c.push(` if (_first) ${Xg}(this, _slotted);`);if(H)c.push(" if (_first) {"," const _i = this.#attach();"," if (_i) {",` this.#form = ${Kg}(this, _i, this.state, ${JSON.stringify(kv(e))}, () => ${s===null?"this":"this.#renderRoot()"}, ${EL(e.formValue)}, (fn) => { this.#effects.push(effect(fn)); });`," }"," }"," if (this.#form) this.#form.start();");if(c.push(" if (_first && typeof this.state.onMount === 'function') {"," queueMicrotask(() => this.state.onMount.call(this, this.state, this));"," }"," }",""," disconnectedCallback() {",...x.keyed?[" this.#part?.setConnected(false);"]:[]," for (const _e of this.#effects) { stop(_e); }"," this.#effects.length = 0;"," if (typeof this.state.onUnmount === 'function') { this.state.onUnmount(this.state); }"," }"),"onAdopted"in u)c.push(""," adoptedCallback() {"," if (typeof this.state.onAdopted === 'function') { this.state.onAdopted(this.state); }"," }");if(H)c.push(""," formResetCallback() { if (this.#form) this.#form.reset(); }",""," formDisabledCallback(disabled) { if (this.#form) this.#form.disabled(disabled); }");if(I.length>0)c.push(""," attributeChangedCallback(name, oldVal, newVal) {"," if (oldVal === newVal) return;",` ${vf}(this.state, name, newVal, __jxObservedDefaults());`," }");return c.push("}","",`customElements.define('${e.tagName}', ${t});`,""),c.join(`
|
|
219
|
+
`)}function CE(){return{byText:new Map,decls:[]}}function RE(e,t){let n=e.byText.get(t);if(n)return n;let r=`_c${e.decls.length}`;e.decls.push(` const ${r} = html\`
|
|
178
220
|
${t}
|
|
179
|
-
\`;`);let s=`\${${r}}`;return e.byText.set(t,s),s}function
|
|
180
|
-
`)}function
|
|
221
|
+
\`;`);let s=`\${${r}}`;return e.byText.set(t,s),s}function Bf(e,t,n,r=!1,s=!1,o=null,i=!1){if(!e)return"";let a=i?Wi:"";if(Le(e))return`${AE(e,n)}${a}`;if(!Array.isArray(e))return"";return e.map((l)=>{if(Le(l))return`${AE(l,n)}${a}`;let c=jy(l,r?"":n,r,s,o);return k(l)&&l.includes("${")||D(l)&&rr(l.tagName)?`${c}${a}`:c}).join(r?"":`
|
|
222
|
+
`)}function jy(e,t,n=!1,r=!1,s=null,o=null){if(k(e)){if(e.includes("${"))return`${t}${Kf(e)}`;return`${t}${Ne(e)}`}if(Ie(e)||Ge(e))return`${t}${Ne(String(e))}`;if(!D(e))return"";if(rr(e.tagName)){let g=e.tagName.$expression,x=fs(g.target,{eventParam:"e",statePrefix:"s"}),P=g.operator==="?:"?[[!0,g.value],[!1,g.initial]]:[...Object.entries(g.cases),["__default__",g.default]],w=P.map(([,V])=>V),E=w.map((V)=>n||ms.has(V)),j=null;if(s&&E.every((V)=>V===E[0])){let V=OE(e,`${t} `,E[0]===!0,r,s,w.some((H)=>H.includes("-")));if(V.trim()!=="")j=RE(s,V)}let A=P.map(([V,H])=>{let O={...e,tagName:H};return[V,jy(O,`${t} `,n,r,s,j)]});if(g.operator==="?:"){let[,V]=A[0],[,H]=A[1];return`${t}\${${x}
|
|
181
223
|
? html\`
|
|
182
|
-
${
|
|
224
|
+
${V}
|
|
183
225
|
\`
|
|
184
226
|
: html\`
|
|
185
|
-
${
|
|
186
|
-
\`}`}let
|
|
187
|
-
${
|
|
188
|
-
\``]),[,
|
|
189
|
-
${
|
|
227
|
+
${H}
|
|
228
|
+
\`}`}let T=A.flatMap(([V,H])=>V==="__default__"?[]:[` ${JSON.stringify(V)}: html\`
|
|
229
|
+
${H}
|
|
230
|
+
\``]),[,I]=A.at(-1);return`${t}\${{
|
|
231
|
+
${T.join(`,
|
|
190
232
|
`)}
|
|
191
|
-
}[String(${
|
|
192
|
-
${
|
|
193
|
-
\`}`}let i=e.tagName??"div",a=n||
|
|
194
|
-
${t} ${
|
|
195
|
-
${t} `)}`:"";if(new Set(["input","br","hr","img","meta","link"]).has(i))return`${t}<${i}${
|
|
196
|
-
${t}>`;let
|
|
197
|
-
${t}>${
|
|
198
|
-
${
|
|
199
|
-
${
|
|
233
|
+
}[String(${x})] ?? html\`
|
|
234
|
+
${I}
|
|
235
|
+
\`}`}let i=e.tagName??"div",a=n||ms.has(i),l=[],c=NE(e,Xt,xn);if(e.attributes)for(let[g,x]of Object.entries(e.attributes)){if(g==="class"&&c!==null)continue;if(me(x))l.push(`${g}="\${${Vo}('${g}', ${xn(x.$ref)}) ?? nothing}"`);else if(k(x)&&Py(x))l.push(`${g}="\${${Vo}('${g}', ${Xt(x).slice(2,-1)}) ?? nothing}"`);else if(k(x)&&x.includes("${"))l.push(`${g}="${Xt(x)}"`);else if(Ge(x)){let P=Rr(g,x);if(P!==null)l.push(P===""?g:`${g}="${P}"`)}else l.push(`${g}="${x}"`)}if(e.id)l.push(`id="${Xt(String(e.id))}"`);if(c!==null)l.push(c);for(let[g,x]of Object.entries(e)){if(pr.has(g)||g.startsWith("$")||g.startsWith("on")||g==="tagName"||g==="id"||g==="className"||g==="style"||g==="children"||g==="textContent"||g==="innerHTML"||g==="attributes")continue;if(Uf(x))l.push(`.${g}="\${${xn(x.$ref)}}"`);else if(k(x)&&x.includes("${"))l.push(`.${g}="${Xt(x)}"`);else l.push(`.${g}="\${${JSON.stringify(x)}}"`)}if(e.$props)for(let[g,x]of Object.entries(e.$props))if(Uf(x))l.push(`.${g}="\${${xn(x.$ref)}}"`);else if(k(x)&&x.includes("${"))l.push(`.${g}="${Xt(x)}"`);else l.push(`.${g}="\${${JSON.stringify(x)}}"`);let u=r?"s.$map = $map; ":"";for(let[g,x]of Object.entries(e)){if(!g.startsWith("on")||g==="observedAttributes")continue;ps(`inline "${g}" handler`,x);let P=g.slice(2).toLowerCase(),w=_y(x,u);if(w!==null)l.push(`@${P}="\${${w}}"`)}let d=JE(e.style);if(d)l.push(`style="${d}"`);let p=l.length>0?`
|
|
236
|
+
${t} ${l.join(`
|
|
237
|
+
${t} `)}`:"";if(new Set(["input","br","hr","img","meta","link"]).has(i))return`${t}<${i}${p}
|
|
238
|
+
${t}>`;let y=o??OE(e,t,a,r,s,i.includes("-")),S=i==="slot"?Wi:"";return a?`${S}<${i}${p}>${y}${S}</${i}>`:`${t}${S}<${i}${p}
|
|
239
|
+
${t}>${y}${S}</${i}>`}function OE(e,t,n,r,s,o=!1){if(e.$switch){let i=me(e.$switch)?e.$switch.$ref:e.$switch,a=xn(i),l=[];for(let[p,m]of Object.entries(e.cases??{})){if(!m||me(m))continue;l.push([p,jy(m,`${t} `,!1,r,s)])}let c=l.map(([,p])=>p),u=new Set(c.filter((p,m)=>c.indexOf(p)!==m&&p.trim()!==""));return`\${{
|
|
240
|
+
${l.map(([p,m])=>{let y=s&&u.has(m)?RE(s,m):m;return` ${JSON.stringify(p)}: html\`
|
|
241
|
+
${y}
|
|
200
242
|
\``}).join(`,
|
|
201
243
|
`)}
|
|
202
|
-
}[${a}]}`}if(e.textContent!==void 0){let i=
|
|
203
|
-
${
|
|
204
|
-
${t}`;return""}function
|
|
205
|
-
${t} ${
|
|
206
|
-
${t} `)}`:"",
|
|
207
|
-
${
|
|
208
|
-
${t} `;let
|
|
209
|
-
${t} <${
|
|
210
|
-
${t} >${
|
|
211
|
-
${t}\``,
|
|
212
|
-
})(s, e);`;return`${
|
|
213
|
-
`}function
|
|
214
|
-
|
|
215
|
-
"imports": {
|
|
216
|
-
"@vue/reactivity": "${r}",
|
|
217
|
-
"lit-html": "${s}"
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
</script>`,d=l.map((x)=>`<script type="module" src="./${x.path}"></script>`).join(`
|
|
221
|
-
`)}let p=t.prePaintScheme!==!1&&Object.values(e.$media??{}).some((x)=>Zn(String(x))!==null)?`<script>${Oi()}</script>
|
|
222
|
-
`:"",m=`<!DOCTYPE html>
|
|
244
|
+
}[${a}]}`}if(e.textContent!==void 0){let i=Kf(e.textContent),a=me(e.textContent)||k(e.textContent)&&e.textContent.includes("${");return o&&a?`${i}${Wi}`:i}if(e.innerHTML!==void 0)return e.innerHTML;if(e.children)return n?Bf(e.children,e.style,"",!0,r,s,o):`
|
|
245
|
+
${Bf(e.children,e.style,`${t} `,!1,r,s,o)}
|
|
246
|
+
${t}`;return""}function AE(e,t){qo(e);let n=me(e.key),r=JSON.stringify(Array.isArray(e.items)?e.items:[]),s=n?`${Rl}(${JSON.stringify(r)})`:r;if(me(e.items))s=`(${xn(e.items.$ref)} ?? [])`;let o=me(e.filter)?xn(e.filter.$ref):"undefined",i=me(e.sort)?xn(e.sort.$ref):"undefined",a=me(e.filter)||me(e.sort),l=e.map;if(!l)return"";let c=l.tagName??"div",u=[],d=NE(l,Xt,Wf);if(l.attributes)for(let[E,j]of Object.entries(l.attributes)){if(E==="class"&&d!==null)continue;if(me(j))u.push(`${E}="\${${Wf(j.$ref)}}"`);else if(k(j)&&j.includes("${"))u.push(`${E}="${Xt(j)}"`);else u.push(`${E}="${j}"`)}if(l.id)u.push(`id="${Xt(String(l.id))}"`);if(d!==null)u.push(d);for(let[E,j]of Object.entries(l)){if(pr.has(E)||E.startsWith("$")||E.startsWith("on")||E==="tagName"||E==="id"||E==="className"||E==="style"||E==="children"||E==="textContent"||E==="innerHTML"||E==="attributes")continue;if(Uf(j))u.push(`.${E}="\${${Wf(j.$ref)}}"`);else if(k(j)&&j.includes("${"))u.push(`.${E}="${Xt(j)}"`);else u.push(`.${E}="\${${JSON.stringify(j)}}"`)}if(l.$props)for(let[E,j]of Object.entries(l.$props))if(me(j))u.push(`.${E}="\${${Wf(j.$ref)}}"`);else if(k(j)&&j.includes("${"))u.push(`.${E}="${Xt(j)}"`);else u.push(`.${E}="\${${JSON.stringify(j)}}"`);let p=JE(l.style);if(p)u.push(`style="${p}"`);for(let[E,j]of Object.entries(l)){if(!E.startsWith("on"))continue;ps(`inline "${E}" handler`,j);let A=E.slice(2).toLowerCase(),T=_y(j,"s.$map = $map; ");if(T!==null)u.push(`@${A}="\${${T}}"`)}let m=u.length>0?`
|
|
247
|
+
${t} ${u.join(`
|
|
248
|
+
${t} `)}`:"",y=CE(),S="";if(l.textContent!==void 0)S=Kf(l.textContent);else if(l.children)S=`
|
|
249
|
+
${Bf(l.children,null,`${t} `,!1,!0,y)}
|
|
250
|
+
${t} `;let g=`html\`
|
|
251
|
+
${t} <${c}${m}
|
|
252
|
+
${t} >${S}</${c}>
|
|
253
|
+
${t}\``,x=(g.includes("$map")?"const $map = { item, index }; ":"")+y.decls.map((E)=>`${E.trim()} `).join(""),P=x?`(item, index) => { ${x}return ${g}; }`:`(item, index) => ${g}`;if(me(e.key)){let E=e.key.$ref,j=[s,o,i,JSON.stringify(bf(E)),JSON.stringify(E),P];return`${t}\${${Nl}(${j.join(", ")})}`}let w=a?`${qi}(${s}, ${o}, ${i})`:s;return`${t}\${${w}.map(${P})}`}function NE(e,t,n){if(!Jl(e))return null;let r=Ml(e),s="";if(me(r))s=`\${${n(r.$ref)} ?? ""}`;else if(k(r))s=t(r);else if(Ie(r))s=String(r);let o=Js(e)??"";return`class="${[s,o].filter((i)=>i!=="").join(" ")}"`}function Uf(e){return me(e)&&e.$ref!==""}function xn(e){let t=sn(e);if(t.startsWith("#/state/"))return Re("s",t.slice(8));if(t.startsWith("$map/"))return TE(t.slice(5));if(t.startsWith("parent#/"))return Re("s",t.slice(8));if(t.startsWith("window#/"))return Re("window",t.slice(8));if(t.startsWith("document#/"))return Re("document",t.slice(10));return Re("s",t)}function TE(e){let[t,...n]=Un(e);return Re(t??"",n.map((r)=>Wt(r)).join("/"))}function Wf(e){let t=sn(e);if(t.startsWith("$map/"))return TE(t.slice(5));return xn(t)}function Xt(e){return Fi(e,"s",{code:!1})}function Py(e){return e.startsWith("${")&&e.endsWith("}")&&!e.slice(2).includes("${")}function Kf(e){if(me(e))return`\${${xn(e.$ref)}}`;if(k(e)&&e.includes("${"))return Xt(e);return String(e)}function zf(e){let t=0,n="";for(let r=0;r<e.length;r++){let s=e.charAt(r);if(t===0){if(s==="$"&&e.charAt(r+1)==="{")t=1,n="",r+=1;continue}if(s==="{")t+=1;else if(s==="}"){if(t-=1,t===0){if(Vv(n))return!0;continue}}n+=s}return!1}function _y(e,t){if(Uf(e))return t?`(e) => { ${t}${xn(e.$ref)}(s, e); }`:`(e) => ${xn(e.$ref)}(s, e)`;if(D(e)&&"$expression"in e){let n=gn(e.$expression,{eventParam:"e",statePrefix:"s"});return`(e) => { ${t}${n}; }`}if(kt(e))return`(e) => { ${t}${jL(e)} }`;return null}function wL(e){let t=[];for(let[n,r]of Object.entries(e)){if(!n.startsWith("on")||pr.has(n))continue;ps(`root "${n}" handler`,r);let s=_y(r,"");if(s!==null)t.push({source:s,type:n.slice(2).toLowerCase()})}return t}function vL(e){let t=[],n=(r,s,o)=>[" this.#effects.push(effect(() => {",o?" const s = this.state, state = s;":" const s = this.state;",` const _v = ${Vo}(${r}, ${s});`,` if (_v === null || _v === undefined) this.removeAttribute(${r});`,` else this.setAttribute(${r}, String(_v));`," }));"];for(let[r,s]of Object.entries(e.attributes??{})){let o=JSON.stringify(r);if(me(s))t.push(...n(o,xn(s.$ref),!1));else if(k(s)&&Py(s)){let i=Xt(s);t.push(...n(o,i.slice(2,-1),zf(i)))}else if(k(s)&&s.includes("${")){let i=Xt(s);t.push(...n(o,`\`${i}\``,zf(i)))}else if(Ge(s)){let i=Rr(r,s);if(i!==null)t.push(` if (_first) this.setAttribute(${o}, ${JSON.stringify(i)});`)}else if(k(s)||Ie(s))t.push(` if (_first) this.setAttribute(${o}, ${JSON.stringify(String(s))});`)}return t}function EL(e){if(e===void 0)return"null";if(me(e))return`() => { const s = this.state; return ${xn(e.$ref)}; }`;if(k(e)&&e.includes("${")){let t=Xt(e);return`() => { const s = this.state, state = s; try { return ${Py(e)?t.slice(2,-1):`\`${t}\``}; } catch { return null; } }`}return`() => ${JSON.stringify(e)}`}function jL(e){if(vr(e))return zn(e.body,{dispatchTarget:"e.currentTarget",eventParam:"e",statePrefix:"s"});let t=k(e.body)?e.body:"";if(Xa(e))return`((${kr(e).join(", ")}) => { ${t}
|
|
254
|
+
})(s, e);`;return`${Fi(t,"s",{bare:!0})}
|
|
255
|
+
`}function JE(e){if(!D(e))return"";let t=[];for(let[n,r]of Object.entries(e)){if(n.startsWith(":")||n.startsWith(".")||n.startsWith("&")||n.startsWith("[")||n.startsWith("@"))continue;if(k(r)&&r.includes("${")){let s=hn(n);t.push(`${s}: ${Xt(r)}`)}}return t.join("; ")}var xL;var Hl=J(()=>{Ei();Ti();$i();Mi();yn();ce();os();Sl();_i();xL=new Set(["state","template","constructor","connectedCallback","disconnectedCallback","adoptedCallback","attributeChangedCallback","formResetCallback","formDisabledCallback"])});function ME(e,t){let{title:n="Jx App"}=t,r=Li(e,null,e.state??{},e.$media??{}),s=Ui(e,e.$media??{},t.projectStyle??null),o=IE(e,r),i=[],a=t.prePaintScheme!==!1&&Object.values(e.$media??{}).some((c)=>fr(String(c))!==null)?`<script>${Vi()}</script>
|
|
256
|
+
`:"",l=`<!DOCTYPE html>
|
|
223
257
|
<html lang="en">
|
|
224
258
|
<head>
|
|
225
259
|
<meta charset="utf-8">
|
|
226
260
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
227
|
-
<title>${
|
|
228
|
-
${
|
|
229
|
-
${
|
|
261
|
+
<title>${Ne(n)}</title>
|
|
262
|
+
${a}
|
|
263
|
+
${s}
|
|
230
264
|
</head>
|
|
231
265
|
<body>
|
|
232
|
-
${
|
|
233
|
-
${d}
|
|
266
|
+
${o}
|
|
234
267
|
</body>
|
|
235
|
-
</html>`;return{files:
|
|
236
|
-
${
|
|
237
|
-
})()`)};`);else g.push([
|
|
238
|
-
`:"",
|
|
268
|
+
</html>`;return{files:i,html:l}}function IE(e,t){if(k(e))return Ne(e);if(Ie(e)||Ge(e))return Ne(String(e));if(!D(e))return"";let n=Li(e,t.scope,e.state??t.scopeDefs,e.$media??t.media),r=Il(e.tagName,n.scope),s=Lo(e,n.scope);if(Yg.has(r))return`<${r}${s}>`;let o=t.preformatted===!0||ms.has(r),i=PL(e,r,{...n,preformatted:o});return`<${r}${s}>${i}</${r}>`}function PL(e,t,n){if(e.textContent!==void 0){let s=tt(e.textContent,n.scope);return s==null?"":Ne(String(s))}if(e.innerHTML){if(Di(e))return e.innerHTML;let s=tt(e.innerHTML,n.scope);return s==null?e.innerHTML:String(s)}let r=Al(e,t,n.scope);if(r!==void 0)return r;if(Array.isArray(e.children))return e.children.map((s)=>IE(s,n)).join(Cl(n.preformatted));return""}var DE=J(()=>{yn();ce()});function Ry(e,t){let{title:n="Jx App",reactivitySrc:r=Ts,litHtmlSrc:s=Nr,modulePath:o="app.js",serverBaseUrl:i="/_jx/server"}=t,a=Li(e,null,e.state??{},e.$media??{}),l=Or(e),c=Ui(e,e.$media??{},t.projectStyle??null),u={h:0,l:0,m:0,needsLit:!1,s:0,sw:0,t:0,textParts:!1},d=new Map,p=new Map,m=[],y=[],S=[],g=[],x=[],P=[],w=e.state??{},E=Pf(w,t.resolveClass);for(let[O,N]of Object.entries(w)){if(!D(N)||Array.isArray(N)){if(le(N))y.push([O,`() => ${gf(N)}`]);else m.push([O,N]);continue}if(fn(N)){let G=N.$expression,Q=gn(G,{eventParam:"e",statePrefix:"state"});if(wr(N))x.push(`state[${JSON.stringify(O)}] = ${kl(N,Q)};`);else if(dr(G.operator))g.push([O,{args:["state","e"],body:Q}]);else y.push([O,`() => ${Q}`]);continue}if(kt(N)){let{body:G}=N;if(Array.isArray(G)){let Q=zn(G,{eventParam:"e",statePrefix:"state"});if(N.parameters&&N.parameters.length>0)x.push(`state[${JSON.stringify(O)}] = ${kl(N,`(() => {
|
|
269
|
+
${Q}
|
|
270
|
+
})()`)};`);else g.push([O,{args:["state","e"],body:Q}])}else if(N.$src)if(l.get(O)==="computed")y.push([O,`() => { return ${O}(state); }`]);else x.push(`state[${JSON.stringify(O)}] = ${O};`),g.push([O,{args:["state","event"],body:`return ${O}(state, event);`}]);else if(k(G)&&l.get(O)==="computed")y.push([O,`() => { ${G} }`]);else g.push([O,{args:kr(N),body:G}]);continue}if($s(N))continue;if(jc(N)){m.push([O,N.default]);continue}if(Pn(N)){if(N.$prototype==="LocalStorage"||N.$prototype==="SessionStorage"){let G=N.$prototype==="LocalStorage"?"localStorage":"sessionStorage",Q=N.key??O,re=N.default??null;m.push([O,null]),x.push(AL(O,G,Q,re));continue}if(N.$prototype==="Request"){m.push([O,null]),x.push(cf(O,N));continue}if(N.$prototype==="Cookie"){m.push([O,null]),x.push(CL(O,N.name??O,N.default??null));continue}if(Hi(N)){m.push([O,null]);continue}}if(Zr(N)){m.push([O,null]),P.push(uf(O,N,{serverBaseUrl:i}));continue}m.push([O,N])}let j=LE(e,a,d,p,u);for(let[O,N]of d)if(!S.some(([G])=>G===O))S.push([O,N]);for(let[O,N]of p)if(!g.some(([G])=>G===O))g.push([O,N]);let A=mf(w,l),T=OL(m,y,S,g,x,P,A,u,r,t.rewriteSrc,E,xf(e)),I=Ii({litHtmlSrc:s,reactivitySrc:r,runtimeImports:t.runtimeImports}),V=t.prePaintScheme!==!1&&Object.values(e.$media??{}).some((O)=>fr(String(O))!==null)?`<script>${Vi()}</script>
|
|
271
|
+
`:"",H=`<!DOCTYPE html>
|
|
239
272
|
<html lang="en">
|
|
240
273
|
<head>
|
|
241
274
|
<meta charset="utf-8">
|
|
242
275
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
243
|
-
<title>${
|
|
244
|
-
${
|
|
245
|
-
{
|
|
246
|
-
"imports": {
|
|
247
|
-
${N.join(`,
|
|
248
|
-
`)}
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
</script>
|
|
252
|
-
${l}
|
|
276
|
+
<title>${Ne(n)}</title>
|
|
277
|
+
${V}${I}
|
|
278
|
+
${c}
|
|
253
279
|
<script type="module" src="./${o}"></script>
|
|
254
280
|
</head>
|
|
255
281
|
<body>
|
|
256
|
-
${
|
|
282
|
+
${j}
|
|
257
283
|
</body>
|
|
258
|
-
</html>`;return{files:[{content:
|
|
259
|
-
${
|
|
260
|
-
\``),a.push(`:render="${
|
|
261
|
-
})(state, e);`:`${
|
|
262
|
-
`;s+=` @${
|
|
263
|
-
${
|
|
264
|
-
`;else if(Array.isArray(e.children)){let c=e.children.map((
|
|
284
|
+
</html>`;return{files:[{content:T,path:o}],html:H}}function LE(e,t,n,r,s){if(k(e)){if(!le(e))return Ne(e);let g=`_t${s.t}`;s.t+=1,s.textParts=!0,n.set(g,`() => \`${e}\``);let x=tt(e,t.scope),P=x==null?"":Ne(String(x));return`<!--jx-text:${g}-->${P}<!--/jx-text-->`}if(Ie(e)||Ge(e))return Ne(String(e));if(!D(e))return"";let o=Li(e,t.scope,e.state??t.scopeDefs,e.$media??t.media);if(rr(e.tagName))throw Error(`A tag chosen at creation is not supported on a dynamic page yet (candidates: ${Yo(e.tagName).join(", ")}). Move the element into a component, or give it a literal tagName.`);let i=e.tagName??"div";o.preformatted=t.preformatted===!0||ms.has(i);let a=[],l=!1;if(e.textContent!==void 0){let g=e.textContent;if(Xe(g)){let x=Wl(g.$ref);a.push(`:text-content="${x}"`),Oy(n,x,g.$ref),l=!0}else if(le(g)){let x=`_t${s.t}`;s.t+=1,a.push(`:text-content="${x}"`),n.set(x,`() => \`${g}\``),l=!0}}for(let[g,x]of Object.entries(e)){if(!g.startsWith("on")||g==="observedAttributes")continue;ps(`inline "${g}" handler`,x);let P=g.slice(2).toLowerCase();if(Xe(x)){let w=Wl(x.$ref);a.push(`@${P}="${w}"`),l=!0}else if(kt(x)){let w=`_h${s.h}`;s.h+=1,a.push(`@${P}="${w}"`);let{body:E}=x;r.set(w,Array.isArray(E)?{args:["state","e"],body:zn(E,{eventParam:"e",statePrefix:"state"})}:{args:Xa(x)?kr(x):["state","event"],body:E}),l=!0}else if(fn(x)){let w=`_h${s.h}`;s.h+=1,a.push(`@${P}="${w}"`);let E=gn(x.$expression,{eventParam:"e",statePrefix:"state"});r.set(w,{args:["state","e"],body:E}),l=!0}}if(D(e.style))for(let[g,x]of Object.entries(e.style)){if(g.startsWith(":")||g.startsWith(".")||g.startsWith("&")||g.startsWith("[")||g.startsWith("@"))continue;if(HE(x))continue;if(le(x)){let P=`_s${s.s}`;s.s+=1,a.push(`:style.${hn(g)}="${P}"`),n.set(P,`() => \`${x}\``),l=!0}}if(D(e.attributes))for(let[g,x]of Object.entries(e.attributes)){let P=g==="class"?Js(e):void 0;if(P!==void 0&&(Xe(x)||le(x))){let w=`_t${s.t}`;s.t+=1;let E=Xe(x)?Cy(x.$ref):`\`${x}\``;a.push(`:attr.class="${w}"`),n.set(w,`() => [${E}, ${JSON.stringify(P)}].filter((c) => c != null && c !== "").join(" ")`),l=!0;continue}if(Xe(x)){let w=Wl(x.$ref);a.push(`:attr.${g}="${w}"`),Oy(n,w,x.$ref),l=!0}else if(le(x)){let w=`_t${s.t}`;s.t+=1,a.push(`:attr.${g}="${w}"`),n.set(w,`() => \`${x}\``),l=!0}}for(let[g,x]of Object.entries(e)){if(pr.has(g)||g.startsWith("on")||g.startsWith("$")||g==="tagName"||g==="id"||g==="className"||g==="style"||g==="children"||g==="textContent"||g==="innerHTML"||g==="attributes")continue;if(Xe(x)){let P=Wl(x.$ref);a.push(`:${hn(g)}="${P}"`),Oy(n,P,x.$ref),l=!0}else if(le(x)){let P=`_t${s.t}`;s.t+=1,a.push(`:${hn(g)}="${P}"`),n.set(P,`() => \`${x}\``),l=!0}}let c=Lo(e,o.scope),u=l?" data-bind":"",d=a.length>0?` ${a.join(" ")}`:"",p="",m=e;if(m.$switch){s.needsLit=!0;let g=`_sw${s.sw}`;s.sw+=1;let x=Xe(m.$switch)?Cy(m.$switch.$ref):`\`${String(m.$switch)}\``,P=m.cases??{},w=Object.entries(P).filter(([,j])=>j&&!Xe(j)).map(([j,A])=>`${JSON.stringify(j)}: html\`${Ay(A,o.preformatted)}\``);n.set(g,`() => ({${w.join(", ")}})[String(${x})] ?? html\`\``),a.push(`:render="${g}"`);let E=` ${a.join(" ")}`;return`<${i}${c} data-bind${E}></${i}>`}let y=Al(m,i,o.scope);if(m.textContent!==void 0&&!l){let g=tt(m.textContent,o.scope);p=g==null?"":Ne(String(g))}else if(m.textContent!==void 0&&l){let g=tt(m.textContent,o.scope);p=g==null?"":Ne(String(g))}else if(m.innerHTML){let g=Di(m)?m.innerHTML:tt(m.innerHTML,o.scope);p=g==null?m.innerHTML:String(g)}else if(y!==void 0)p=y;else if(Le(m.children)){s.needsLit=!0;let g=`_list${s.l}`;s.l+=1;let x=m.children;n.set(g,`() => ${qE(x)}`),a.push(`:render="${g}"`),l=!0;let P=" data-bind",w=` ${a.join(" ")}`;if(new Set(["input","br","hr","img","meta","link"]).has(i))return`<${i}${c}${P}${w}>`;return`<${i}${c}${P}${w}></${i}>`}else if(Array.isArray(m.children)&&m.children.some((g)=>Le(g))){s.needsLit=!0;let g=`_children${s.l}`;s.l+=1;let x=m.children.map((w)=>Ay(w,o.preformatted)).join(Cl(o.preformatted," "));n.set(g,o.preformatted?`() => html\`${x}\``:`() => html\`
|
|
285
|
+
${x}
|
|
286
|
+
\``),a.push(`:render="${g}"`),l=!0;let P=` ${a.join(" ")}`;return`<${i}${c} data-bind${P}></${i}>`}else if(Array.isArray(m.children)){if(_L.has(i)&&m.children.some((g)=>le(g)))throw Error(`A template text child of <${i}> cannot be bound: HTML reads its content as text. Write it as the element's textContent.`);p=m.children.map((g)=>LE(g,o,n,r,s)).join(Cl(o.preformatted))}if(new Set(["input","br","hr","img","meta","link"]).has(i))return`<${i}${c}${u}${d}>`;return`<${i}${c}${u}${d}>${p}</${i}>`}function FE(e,t=!1){if(!e)return"";if(rr(e.tagName))throw Error(`A tag chosen at creation is not supported inside a dynamic page's repeater yet (candidates: ${Yo(e.tagName).join(", ")}). Move the item into a component, or give it a literal tagName.`);let n=e.tagName??"div",r=t||ms.has(n),s="";if(e.id)s+=` id="${e.id}"`;let o=Jl(e);if(o){let c=Ml(e),u="";if(Xe(c))u=`\${${Xi(c.$ref)} ?? ""}`;else if(k(c))u=Is(c);else if(Ie(c))u=String(c);let d=[u,Js(e)??""].filter((p)=>p!=="").join(" ");s+=` class="${d}"`}if(D(e.$props))for(let[c,u]of Object.entries(e.$props))if(Xe(u))s+=` .${c}="\${${Xi(u.$ref)}}"`;else if(le(u))s+=` .${c}="${Is(u)}"`;else s+=` .${c}="\${${JSON.stringify(u)}}"`;if(D(e.attributes))for(let[c,u]of Object.entries(e.attributes)){if(o&&c==="class")continue;if(le(u)){s+=` ${c}="${Is(u)}"`;continue}if(Xe(u)){s+=` ${c}="\${${Xi(u.$ref)}}"`;continue}if(Ge(u)){let d=Rr(c,u);if(d!==null)s+=d===""?` ${c}`:` ${c}="${Ne(d)}"`;continue}s+=` ${c}="${Ne(String(u))}"`}if(D(e.style)){let c=[];for(let[u,d]of Object.entries(e.style)){if(u.startsWith(":")||u.startsWith(".")||u.startsWith("&")||u.startsWith("[")||u.startsWith("@"))continue;if(HE(d))continue;if(le(String(d)))c.push(`${hn(u)}: ${Is(String(d))}`)}if(c.length>0)s+=` style="${c.join("; ")}"`}for(let[c,u]of Object.entries(e)){if(!c.startsWith("on")||c==="observedAttributes")continue;ps(`inline "${c}" handler`,u);let d=c.slice(2).toLowerCase();if(Xe(u)){let p=Wl(u.$ref);s+=` @${d}=\${(e) => { state.$map = { item, index }; on.${p}(e); }}`}else if(vr(u)){let p=zn(u.body,{eventParam:"e",statePrefix:"state"});s+=` @${d}=\${(e) => { state.$map = { item, index }; ${p} }}`}else if(kt(u)){let p=kL(u.body),m=Xa(u)?`((${kr(u).join(", ")}) => { ${p}
|
|
287
|
+
})(state, e);`:`${p}
|
|
288
|
+
`;s+=` @${d}=\${(e) => { state.$map = { item, index }; ${m}}}`}else if(D(u)&&"$expression"in u){let p=gn(u.$expression,{eventParam:"e",statePrefix:"state"});s+=` @${d}=\${(e) => { state.$map = { item, index }; ${p}; }}`}}for(let[c,u]of Object.entries(e)){if(pr.has(c)||c.startsWith("$")||c.startsWith("on")||c==="tagName"||c==="id"||c==="className"||c==="style"||c==="children"||c==="textContent"||c==="innerHTML"||c==="attributes")continue;if(Xe(u))s+=` .${c}="\${${Xi(u.$ref)}}"`;else if(le(u))s+=` .${c}="${Is(u)}"`;else s+=` .${c}="\${${JSON.stringify(u)}}"`}let i=n.includes("-")?Wi:"",a="";if(e.textContent!==void 0){let c=String(e.textContent);if(le(c))a=`${Is(c)}${i}`;else if(Xe(e.textContent))a=`\${${Xi(e.textContent.$ref)}}${i}`;else a=Ne(c)}else if(e.innerHTML)a=Is(String(e.innerHTML));else if(Le(e.children))a=`
|
|
289
|
+
${VE(e.children)}${i}
|
|
290
|
+
`;else if(Array.isArray(e.children)){let c=e.children.map((u)=>{let d=Ay(u,r);return Le(u)||k(u)&&le(u)?`${d}${i}`:d});a=r?c.join(""):`
|
|
265
291
|
${c.join(`
|
|
266
292
|
`)}
|
|
267
|
-
`}if(new Set(["input","br","hr","img","meta","link"]).has(n))return`<${n}${s}>`;return`<${n}${s}>${
|
|
268
|
-
}; fn(state, e); },`);
|
|
269
|
-
`)}function
|
|
270
|
-
`)}function
|
|
271
|
-
`)}function
|
|
293
|
+
`}if(new Set(["input","br","hr","img","meta","link"]).has(n))return`<${n}${s}>`;return`<${n}${s}>${a}</${n}>`}function Ay(e,t=!1){if(k(e))return le(e)?Is(e):Ne(e);if(Ie(e)||Ge(e))return Ne(String(e));if(Le(e))return VE(e);return FE(e,t)}function VE(e){return`\${${qE(e)}}`}function ky(e){return sn(e).startsWith("$map/")?Xi(e):Cy(e)}function qE(e){qo(e);let{items:t,filter:n,sort:r,key:s}=e,o=Xe(s),i=JSON.stringify(t??[]),a=o?`${Rl}(${JSON.stringify(i)})`:i;if(Xe(t))a=ky(t.$ref);let l=Xe(n)?ky(n.$ref):"undefined",c=Xe(r)?ky(r.$ref):"undefined",u=`(item, index) => html\`${FE(e.map)}\``;if(o){let d=s.$ref,p=[`(${a} ?? [])`,l,c,JSON.stringify(bf(d)),JSON.stringify(d),u];return`${Nl}(${p.join(", ")})`}if(Xe(n)||Xe(r))return`${qi}(${a}, ${l}, ${c}).map(${u})`;return`(${a} ?? []).map(${u})`}function Is(e){return e.replaceAll("$map.","")}function kL(e){return e.replaceAll(/(?<![\w$.])\$map\./gu,"")}function OL(e,t,n,r,s,o,i,a,l,c,u,d){let p=[],{needsLit:m,textParts:y}=a,S=t.length>0;p.push("// Generated by @jxsuite/compiler — do not edit manually");let g=["reactive","effect"];if(S)g.push("computed");if(d.keyed)g.push("stop","shallowRef");if(p.push(`import { ${g.join(", ")} } from '@vue/reactivity';`),m)p.push("import { html, render } from 'lit-html';");if(d.keyed)p.push(...Sf);let x=hf(i,c);if(p.push(...x.imports,...u.imports,...x.loaders,"",yf()),d.arranged||d.keyed)p.push($f());if(d.keyed)p.push(wf());if(o.length>0)p.push("",Ef());let P=u.entries.length>0;if(P)p.push("",jf(),"const _jxInstances = new Map();");p.push("","const state = reactive({");for(let[w,E]of e)p.push(` ${us(w)}: ${JSON.stringify(E)},`);if(p.push("});",""),s.length>0){for(let w of s)p.push(w);p.push("")}if(t.length>0){for(let[w,E]of t)p.push(`${Re("state",Wt(w))} = computed(${E});`);p.push("")}if(o.length>0){for(let w of o)p.push(w);p.push("")}if(n.length>0){p.push("const bind = {");for(let[w,E]of n)p.push(` ${us(w)}: ${E},`);p.push("};")}else p.push("const bind = {};");if(p.push(""),r.length>0){p.push("const on = {");for(let[w,E]of r)p.push(` ${us(w)}: (e) => { const fn = (${E.args.join(", ")}) => { ${E.body}
|
|
294
|
+
}; fn(state, e); },`);p.push("};")}else p.push("const on = {};");if(p.push("","function hydrate(root) {"),y)p.push(" const texts = [];"," const walker = document.createTreeWalker(root, 128);"," while (walker.nextNode()) {"," const c = walker.currentNode;"," if (c.data.startsWith('jx-text:') && c.data.slice(8) in bind) { texts.push(c); }"," }");if(p.push(" root.querySelectorAll('[data-bind]').forEach(el => {"," [...el.attributes].forEach(a => {"," if (a.name.startsWith(':')) {"," const parts = a.name.slice(1).split('.');"," const key = a.value;"),m)p.push(" if (parts[0] === 'render') {"," effect(() => { render(bind[key](), el); });"," } else if (parts[0] === 'style' && parts.length > 1) {");else p.push(" if (parts[0] === 'style' && parts.length > 1) {");if(p.push(" effect(() => { el.style[parts[1]] = bind[key](); });"," } else if (parts[0] === 'attr' && parts.length > 1) {"," effect(() => {",` const _t = ${Vo}(parts[1], bind[key]());`," if (_t === null) { el.removeAttribute(parts[1]); }"," else { el.setAttribute(parts[1], _t); }"," });"," } else {"," const prop = parts[0].replace(/-([a-z])/g, (_, c) => c.toUpperCase());"," effect(() => { el[prop] = bind[key](); });"," }"," } else if (a.name.startsWith('@')) {"," el.addEventListener(a.name.slice(1), on[a.value]);"," }"," });"," });"),y)p.push(" texts.forEach(c => {"," const key = c.data.slice(8);"," let text = c.nextSibling;"," if (!text || text.nodeType !== 3) {"," text = document.createTextNode('');"," c.after(text);"," }"," effect(() => { text.data = bind[key](); });"," });");if(p.push("}",""),P)p.push(`await ${_f(u.entries,{indent:"",instances:"_jxInstances",statePrefix:"state"})};`);return p.push("hydrate(document);",""),p.join(`
|
|
295
|
+
`)}function AL(e,t,n,r){return[`// ${e}: ${t} (key: "${n}")`,"try {",` const _s = ${t}.getItem(${JSON.stringify(n)});`,` state.${e} = _s !== null ? JSON.parse(_s) : ${JSON.stringify(r)};`,`} catch { state.${e} = ${JSON.stringify(r)}; }`,"effect(() => {",` const v = state.${e};`," try {",` if (v === null) ${t}.removeItem(${JSON.stringify(n)});`,` else ${t}.setItem(${JSON.stringify(n)}, JSON.stringify(v));`," } catch {}","});"].join(`
|
|
296
|
+
`)}function CL(e,t,n){return[`// ${e}: Cookie (name: "${t}")`,"{",` const _m = document.cookie.match(new RegExp("(?:^|; )${t}=([^;]*)"));`,` try { state.${e} = _m ? JSON.parse(decodeURIComponent(_m[1])) : ${JSON.stringify(n)}; }`,` catch { state.${e} = _m ? _m[1] : ${JSON.stringify(n)}; }`,"}"].join(`
|
|
297
|
+
`)}function HE(e){return e===null||D(e)}function Xi(e){let t=sn(e);if(t.startsWith("$map/")){let[n,...r]=Un(t.slice(5));return Re(n??"",r.map((s)=>Wt(s)).join("/"))}if(t.startsWith("#/state/"))return Re("state",t.slice(8));return Re("state",t)}function Cy(e){return lv("state",e.startsWith("#/state/")?e.slice(8):e)}function Wl(e){return cv(e.startsWith("#/state/")?e.slice(8):e)}function Oy(e,t,n){if(e.has(t))return;e.set(t,`() => ${Re("state",n.startsWith("#/state/")?n.slice(8):n)}`)}var _L;var Ny=J(()=>{$i();Mi();yn();ce();_i();_L=new Set(["script","style","textarea","title"])});function RL(e,t){if(t.routing==="prefix-except-default"&&e===t.defaultLocale)return"/";return`/${e.toLowerCase()}/`}function WE(e){if(e===null||e.locales.length<2)return"";let t=JSON.stringify(e.locales),n=JSON.stringify(e.defaultLocale),r=JSON.stringify(Object.fromEntries(e.locales.map((s)=>[s,RL(s,e)])));return`
|
|
272
298
|
// ─── Locale negotiation (RFC 4647 Lookup over Accept-Language) ───────────────
|
|
273
299
|
const JX_LOCALES = ${t}
|
|
274
300
|
const JX_DEFAULT_LOCALE = ${n}
|
|
@@ -337,24 +363,24 @@ app.use('/', async (c, next) => {
|
|
|
337
363
|
res.headers.set('Content-Language', locale)
|
|
338
364
|
c.res = res
|
|
339
365
|
})
|
|
340
|
-
`}function
|
|
341
|
-
`),
|
|
366
|
+
`}function Gf(e,t="/_jx/server"){return Fe(e,t)}function Ty(e,t={}){let{adapter:n=null,mounts:r=[],connectors:s=[],i18n:o=null,base:i=""}=t,a=Gf(i,t.baseUrl);if(e.length===0&&r.length===0&&!n)return null;let l=e.map(({exportName:y,src:S})=>`import { ${y} } from '${S}'`).join(`
|
|
367
|
+
`),c=NL(r,s),u=e.map(({exportName:y})=>ML(y,a)).join(`
|
|
342
368
|
`),d=n==="cloudflare-workers"||n==="cloudflare-pages"?`
|
|
343
369
|
app.all('*', (c) => c.env.ASSETS.fetch(c.req.raw))
|
|
344
370
|
`:`
|
|
345
|
-
`,p=
|
|
371
|
+
`,p=WE(o),m=e.length===0&&r.length===0?"":JL(i,a);return`// Generated by @jxsuite/compiler — do not edit manually
|
|
346
372
|
import { Hono } from 'hono'
|
|
347
|
-
${
|
|
373
|
+
${l}${c.imports}
|
|
348
374
|
|
|
349
375
|
const app = new Hono()
|
|
350
|
-
${p}${m}${
|
|
376
|
+
${p}${m}${c.routes}${u}
|
|
351
377
|
${d}
|
|
352
378
|
export default app
|
|
353
|
-
`}function
|
|
379
|
+
`}function NL(e,t){if(e.length===0)return{imports:"",routes:""};let n=e.toSorted((o,i)=>o.order-i.order),r=[];for(let o of n)r.push(`import { ${o.className} } from '${o.module}'`);for(let o of t)r.push(`import { ${o.className} } from '${o.module}'`);let s=["// Extension server mounts (specs/extensions.md §11): one shared ctx, mounted in order.","const jxCtx = {}",`const jxConnectors = { ${t.map((o)=>`${JSON.stringify(o.provider)}: ${o.className}`).join(", ")} }`];for(let[o,i]of n.entries()){let a=JSON.stringify(i.options);s.push(`const jxMount${o} = await ${i.className}.mount({ ...${a}, connectors: jxConnectors }, jxCtx)`,`app.all('${i.basePath}/*', (c) => jxMount${o}(c.req.raw, c.env))`,`app.all('${i.basePath}', (c) => jxMount${o}(c.req.raw, c.env))`)}return{imports:`
|
|
354
380
|
${r.join(`
|
|
355
381
|
`)}`,routes:`${s.join(`
|
|
356
382
|
`)}
|
|
357
|
-
`}}function
|
|
383
|
+
`}}function JL(e,t){let n=Fe(e,TL);return`// Request gate (specs/compiler.md §6.4): another site may link here, never call here.
|
|
358
384
|
const jxGate = async (c, next) => {
|
|
359
385
|
const site = c.req.header('sec-fetch-site')
|
|
360
386
|
const foreign = site !== undefined && site !== 'same-origin' && site !== 'none'
|
|
@@ -371,7 +397,7 @@ const jxGate = async (c, next) => {
|
|
|
371
397
|
}
|
|
372
398
|
${(t===n||t.startsWith(`${n}/`)?[n]:[n,t]).map((o)=>`app.use('${o}/*', jxGate)`).join(`
|
|
373
399
|
`)}
|
|
374
|
-
`}function
|
|
400
|
+
`}function ML(e,t){return`
|
|
375
401
|
app.post('${t}/${e}', async (c) => {
|
|
376
402
|
if (!/^application\\/([\\w.-]+\\+)?json\\b/i.test(c.req.header('content-type') ?? '')) {
|
|
377
403
|
return c.json({ ok: false, error: 'Expected an application/json body' }, 415)
|
|
@@ -383,39 +409,33 @@ app.post('${t}/${e}', async (c) => {
|
|
|
383
409
|
console.error('jx: server function ${e} threw:', e)
|
|
384
410
|
return c.json({ ok: false, error: 'Server error' }, 500)
|
|
385
411
|
}
|
|
386
|
-
})`}var
|
|
387
|
-
|
|
388
|
-
`)
|
|
412
|
+
})`}var TL="/_jx";var Jy=J(()=>{An()});async function FL(e){let{readdirSync:t}=await import("node:fs"),{resolve:n}=await import("node:path");if(!k(e))return e.map((r)=>n(r));return t(e).filter((r)=>Vn(r)).toSorted().map((r)=>n(e,r))}async function VL(e){let{readFileSync:t}=await import("node:fs");if(!Vn(e))throw Error(`compileElementPack: ${e} is not a .json or .jxn document, the two a pack compiles`);return kn(t(e,"utf8"),e)}async function qL(e){let{resolve:t}=await import("node:path"),n=(e.packDir??"dist").replaceAll(/^\.?\/+|\/+$/gu,""),r=await FL(e.components),s=new Map,o=new Map;for(let y of r){let S=await VL(y),{tagName:g}=S;if(!k(g)||!g.includes("-"))throw Error(`compileElementPack: ${y} is not a component: its tagName must contain a hyphen`);let x=[...o].find(([,P])=>P===g);if(x)throw Error(`compileElementPack: ${x[0]} and ${y} both declare the tagName "${g}"`);s.set(g,S),o.set(y,g)}let i={stylesheetHref:(y)=>`./${y}.css`,resolveElementPath:(y,S)=>{let g=S===null?t(y):t(S,y),x=o.get(g);if(x===void 0)throw Error(`compileElementPack: "${y}" names a component outside the pack (${g})`);return`./${x}.js`}};if(e.rewriteSrc)i.rewriteSrc=e.rewriteSrc;if(e.$media)i.$media=e.$media;if(e.defaults)i.defaults=e.defaults;let a=new Map;for(let y of r){let{files:S}=await Gi(y,i);for(let g of S)if(!a.has(g.tagName))a.set(g.tagName,g.content)}let l=Cf([...s.keys()],s),c=[],u=[],d=[];for(let y of l){let S=s.get(y),g=a.get(y);if(!S||g===void 0)continue;c.push({content:g,path:`${y}.js`});let x=Rn(S,e.defaults),P=Nf(y,S.style,S,e.$media??S.$media??{},x);if(P!==""){if(c.push({content:P,path:`${y}.css`}),x===null)u.push(P)}d.push({className:Ms(y),doc:S,modulePath:n===""?`${y}.js`:`${n}/${y}.js`,shadow:x!==null,tagName:y})}let{manifest:p,warnings:m}=pu(d);return c.push({content:`// Generated by @jxsuite/compiler — do not edit manually
|
|
413
|
+
${l.map((y)=>`import './${y}.js';`).join(`
|
|
414
|
+
`)}
|
|
415
|
+
`,path:IL},{content:u.join(""),path:DL},{content:mu(p),path:LL}),{files:c,manifest:p,tags:l,warnings:m}}async function HL(e,t){let{mkdirSync:n,writeFileSync:r}=await import("node:fs"),{dirname:s,resolve:o}=await import("node:path");return e.files.map((i)=>{let a=o(t,i.path);return n(s(a),{recursive:!0}),r(a,i.content,"utf8"),a})}var IL="index.js",DL="elements.css",LL="custom-elements.json";var BE=J(()=>{dm();ce();os();Sl();yn();Hl()});import{readFileSync as WL}from"node:fs";async function My(e,t={}){let{title:n="Jx App",reactivitySrc:r=Ts,litHtmlSrc:s=Nr,projectStyle:o=null}=t,i;if(k(e)){let l=WL(e,"utf8");if(Vn(e))i=kn(l,e);else{let{extname:c}=await import("node:path"),u=c(e).toLowerCase(),d=t.formats?.byExtension(u,"parse");if(!d){await Promise.resolve().then(() => is());throw du(e,u)}i=await d.parseDocument(l)}}else i=e;if(i=Ar(i,k(e)?e:"the document"),Fb(i)){await Promise.resolve().then(() => fy());let c=Fl(i),u=k(e)?e.replace(/(\.class)?\.[^./\\]+$/,".js"):`${i.title}.js`;return{files:[{content:c,path:u}],html:""}}if(!pf(i)){let l={projectStyle:o,title:n};if(t.prePaintScheme===!1)l.prePaintScheme=!1;return ME(i,l)}if(i.tagName&&i.tagName.includes("-")){let{tagName:l}=i,c=Ms(l),d={content:Ey(i,c,[],t.rewriteSrc,null,t.serverBaseUrl,[],t.resolveClass),path:`${l}.js`,tagName:l},p=Ui(i,i.$media??{},o),m=`<!DOCTYPE html>
|
|
389
416
|
<html lang="en">
|
|
390
417
|
<head>
|
|
391
418
|
<meta charset="utf-8">
|
|
392
419
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
393
|
-
<title>${
|
|
394
|
-
|
|
395
|
-
{
|
|
396
|
-
"imports": {
|
|
397
|
-
"@vue/reactivity": "${r}",
|
|
398
|
-
"lit-html": "${s}"
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
</script>
|
|
420
|
+
<title>${Ne(n)}</title>
|
|
421
|
+
${Ii({litHtmlSrc:s,reactivitySrc:r,runtimeImports:t.runtimeImports})}
|
|
402
422
|
${p}
|
|
403
423
|
</head>
|
|
404
424
|
<body>
|
|
405
|
-
<${
|
|
406
|
-
<script type="module" src="./${
|
|
425
|
+
<${l}></${l}>
|
|
426
|
+
<script type="module" src="./${l}.js"></script>
|
|
407
427
|
</body>
|
|
408
|
-
</html>`;return{files:[d],html:m}}let a={litHtmlSrc:s,projectStyle:o,reactivitySrc:r,...
|
|
428
|
+
</html>`;return{files:[d],html:m}}let a={litHtmlSrc:s,projectStyle:o,reactivitySrc:r,...BL(t),title:n};if(t.serverBaseUrl!==void 0)a.serverBaseUrl=t.serverBaseUrl;if(t.resolveClass!==void 0)a.resolveClass=t.resolveClass;if(t.runtimeImports!==void 0)a.runtimeImports=t.runtimeImports;return Ry(i,a)}function BL(e){let t={};if(e.prePaintScheme===!1)t.prePaintScheme=!1;if(e.rewriteSrc)t.rewriteSrc=e.rewriteSrc;return t}async function uee(e,t){let n=await My(e),{writeFileSync:r,mkdirSync:s}=await import("node:fs"),{dirname:o,join:i}=await import("node:path");if(t){r(t,n.html,"utf8"),console.error(`Written to ${t}`);let a=o(t);for(let l of n.files){let c=i(a,l.path);s(o(c),{recursive:!0}),r(c,l.content,"utf8"),console.error(`Written to ${c}`)}}else process.stdout.write(n.html)}var UE=J(()=>{Ei();yn();Hl();DE();Ny();ce();os();yn();Jy();Hl();BE();Ny()});function zE(e){let t=e.arch==="x64"||e.arch==="arm64"?e.arch:null;if(!t)return[];if(e.platform==="linux"){let[n,r]=e.musl?["musl","gnu"]:["gnu","musl"];return[`linux-${t}-${n}`,`linux-${t}-${r}`]}if(e.platform==="darwin")return[`darwin-${t}`];if(e.platform==="win32")return[`win32-${t}-msvc`];return[]}function KE(e){return`jx-compiler.${e}.node`}function GE(e){return`@jxsuite/compiler-binding-${e}`}var XE=()=>{};import{createRequire as UL}from"node:module";import{existsSync as zL}from"node:fs";import{dirname as QE,join as KL}from"node:path";function GL(e,t){return e==="linux"&&t!==void 0&&!t.header?.glibcVersionRuntime}function XL(e){try{return[QE(e("@jxsuite/compiler-binding/package.json"))]}catch{return[]}}function YL(){return{arch:process.arch,exists:zL,load:(e)=>{let t=YE(e);return ZL(t)?t:void 0},localDirs:[...new Set([QE(import.meta.dirname),import.meta.dirname,...XL((e)=>YE.resolve(e))])],musl:GL(process.platform,process.report.getReport()),platform:process.platform}}function ZL(e){return typeof e==="object"&&e!==null&&"processImage"in e&&typeof e.processImage==="function"}function QL(e){let t=zE(e);if(t.length===0)throw Error(`@jxsuite/compiler-binding has no build for ${e.platform}-${e.arch}. Image optimization needs one; set images.optimize to false to build without it.`);let n=[];for(let s of t){let o=[...e.localDirs.map((i)=>KL(i,KE(s))).filter((i)=>e.exists(i)),GE(s)];for(let i of o)try{let a=e.load(i);if(a)return a;n.push(`${i}: loaded, but it is not the Jx compiler addon`)}catch(a){n.push(`${i}: ${a instanceof Error?a.message:String(a)}`)}}let r=n.map((s)=>` - ${s}`).join(`
|
|
409
429
|
`);throw Error(`The Jx compiler's native addon could not be loaded.
|
|
410
430
|
${r}
|
|
411
|
-
In a checkout of the Jx repository, build it with \`bun run build:addon\` (needs Rust). In a project, reinstall dependencies without --no-optional so the package for this platform is installed.`)}function sS(){return nS??=FI(MI()),nS}async function oS(e){return sS().imageMetadata(e)}async function iS(e){return sS().processImage(e)}var tS,nS;var aS=T(()=>{eS();tS=CI(import.meta.url)});import{createHash as Om}from"node:crypto";import{readFileSync as LI}from"node:fs";import{basename as VI,extname as qI,resolve as cS}from"node:path";async function lS(e){return oS(e)}function Ii(e){let t=LI(e);return Om("md5").update(t).digest("hex").slice(0,8)}function HI(e){return Om("md5").update(`${Ii(e)}:${uS}`).digest("hex").slice(0,8)}function fS(e){let t=JSON.stringify({formats:e.formats,quality:e.quality,v:uS,widths:e.widths});return Om("md5").update(t).digest("hex").slice(0,8)}async function dS(e,t,n){let r=cS(t,"_optimized"),s={};if(n.quality.avif!==void 0)s.avif=n.quality.avif;if(n.quality.jpeg!==void 0)s.jpeg=n.quality.jpeg;let o=await iS({formats:n.formats,hash:HI(e),outDir:r,quality:s,source:e,stem:VI(e,qI(e)),widths:n.widths});return{contentHash:Ii(e),original:o.original,variants:o.variants.map((i)=>({absolutePath:cS(r,i.fileName),format:i.format,outputPath:`/${WI}/${i.fileName}`,width:i.width}))}}function pS(e,t){return e.flatMap((n)=>n.format===t?[`${Am(n.outputPath)} ${n.width}w`]:[]).join(", ")}function Am(e){return e.split("/").map((t)=>encodeURIComponent(t)).join("/")}var WI="images/_optimized",uS=3;var Rm=T(()=>{aS()});import{existsSync as UI,mkdirSync as BI,readFileSync as zI,rmSync as KI,writeFileSync as GI}from"node:fs";import{basename as mS,extname as XI,resolve as Ru}from"node:path";import{execSync as YI}from"node:child_process";import{tmpdir as ZI}from"node:os";function eM(){let e=process.env.npm_config_cache??process.env.NPM_CONFIG_CACHE;if(e)return e;try{let t=YI("npm config get cache",{cwd:ZI(),encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:QI}).trim();return t&&t!=="undefined"?t:null}catch{return null}}function Mi(e){if(Au===void 0)Au=eM();if(Au)return Ru(Au,"jxsuite-images",mS(e));return Ru(e,".cache/images")}function hS(e,t){return`${Ii(e)}:${fS(t)}:${mS(e,XI(e))}`}function gS(e){let t=Ru(Mi(e),"manifest.json");if(!UI(t))return{entries:{},touched:new Set,version:1};try{let n=JSON.parse(zI(t,"utf8"));return n.touched=new Set,n}catch{return{entries:{},touched:new Set,version:1}}}function yS(e,t,n={}){if(n.prune&&t.touched)tM(t,t.touched);let r=Mi(e);BI(r,{recursive:!0}),GI(Ru(r,"manifest.json"),JSON.stringify({entries:t.entries,version:t.version},null,2),"utf8")}function tM(e,t){let n=new Set,r=Object.entries(e.entries);for(let[s,o]of r)if(t.has(s))for(let i of o.manifest.variants??[])n.add(i.absolutePath);for(let[s,o]of r){if(t.has(s))continue;for(let i of o.manifest.variants??[])if(!n.has(i.absolutePath))KI(i.absolutePath,{force:!0});delete e.entries[s]}}function xS(e,t){e.touched?.add(t);let n=e.entries[t];if(!n)return null;return n.manifest}function bS(e,t,n,r){e.touched?.add(t),e.entries[t]={manifest:r,source:n,timestamp:Date.now()}}var Au,QI=3000;var Cm=T(()=>{Rm()});function Nm(e,t){if(!t||$S(e.loading))return{};if(String(e.fetchpriority??"").toLowerCase()==="high")return{};return $S(e.decoding)?{loading:"lazy"}:{decoding:"async",loading:"lazy"}}var $S=(e)=>e!==void 0&&e!==null&&e!=="";function SS(e){let t=e.lastIndexOf(".");return nM.get(t>0?e.slice(t).toLowerCase():"")??null}function Nu(e){try{return sM.decode(e)}catch{throw new En("The metadata is not valid UTF-8.")}}function Cu(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function cc(e,t,n){return String.fromCodePoint(...e.subarray(t,t+n))}function vS(e,t){switch(t){case"jpeg":return aM(e).packet;case"png":return fM(e).packet;case"webp":return pM(e).packet;default:return yM(Nu(e)).packet}}function oM(e){if(e[0]!==255||e[1]!==216)throw new En("Not a JPEG file.");let t=[],n=2;while(n+4<=e.length){if(e[n]!==255)throw new En("The JPEG's markers are damaged.");let r=e[n+1]??0;if(r===255){n+=1;continue}if(r===218||r===217)break;let s=Cu(e).getUint16(n+2),o=n+2+s;if(s<2||o>e.length)throw new En("The JPEG's markers are damaged.");t.push({end:o,marker:r,start:n}),n=o}return t}function iM(e,t){let n=t.start+4;return t.marker===225&&t.end-n>=Tm.length&&Tm.every((r,s)=>e[n+s]===r)}function aM(e){let t=oM(e),n=t.find((s)=>iM(e,s));return{packet:n===void 0?null:Nu(e.subarray(n.start+4+Tm.length,n.end)),parts:t}}function lM(e){if(!wS.every((r,s)=>e[s]===r))throw new En("Not a PNG file.");let t=[],n=wS.length;while(n+12<=e.length){let r=Cu(e).getUint32(n),s=n+12+r;if(s>e.length)throw new En("The PNG's chunks are damaged.");let o=cc(e,n+4,4);if(t.push({dataStart:n+8,end:s,start:n,type:o}),n=s,o==="IEND")break}return t}function uM(e,t){if(t.type!=="iTXt")return null;let n=e.subarray(t.dataStart,t.end-4),r=n.indexOf(0);if(r===-1||cc(n,0,r)!==cM)return null;if(n[r+1]!==0)throw new En("The PNG's metadata is compressed, which Studio does not rewrite.");let s=n.indexOf(0,r+3),o=s===-1?-1:n.indexOf(0,s+1);if(o===-1)throw new En("The PNG's metadata chunk is damaged.");return Nu(n.subarray(o+1))}function fM(e){let t=lM(e);return{packet:t.map((r)=>uM(e,r)).find((r)=>r!==null)??null,parts:t}}function dM(e){if(cc(e,0,4)!=="RIFF"||cc(e,8,4)!=="WEBP")throw new En("Not a WebP file.");let t=Math.min(e.length,8+Cu(e).getUint32(4,!0)),n=[],r=12;while(r+8<=t){let s=Cu(e).getUint32(r+4,!0),o=r+8,i=o+s+s%2;if(o+s>t)throw new En("The WebP's chunks are damaged.");n.push({dataStart:o,end:Math.min(i,t),fourcc:cc(e,r,4),size:s,start:r}),r=i}return n}function pM(e){let t=dM(e),n=t.find((s)=>s.fourcc==="XMP ");return{packet:n===void 0?null:Nu(e.subarray(n.dataStart,n.dataStart+n.size)),parts:t}}function hM(e,t){let n=null;for(let r=t+1;r<e.length;r++){let s=e[r];if(n!==null){if(s===n)n=null}else if(s==='"'||s==="'")n=s;else if(s===">")return r}return-1}function gM(e){let t=/<svg[\s>/]/.exec(e);if(t===null)throw new En("Not an SVG file.");let n=hM(e,t.index);if(n===-1)throw new En("The SVG's root element is damaged.");return{end:n,selfClosing:e[n-1]==="/",start:t.index}}function yM(e){gM(e);let t=mM.exec(e);return t===null?{end:-1,packet:null,start:-1}:{end:t.index+t[0].length,packet:t[0],start:t.index}}var En,nM,rM,sM,Tm,wS,cM="XML:com.adobe.xmp",mM;var ES=T(()=>{En=class En extends Error{name="XmpContainerError"};nM=new Map([[".jpeg","jpeg"],[".jpg","jpeg"],[".png","png"],[".svg","svg"],[".webp","webp"]]);rM=new TextEncoder,sM=new TextDecoder("utf-8",{fatal:!0});Tm=rM.encode("http://ns.adobe.com/xap/1.0/\x00");wS=Uint8Array.of(137,80,78,71,13,10,26,10);mM=/<([\w.-]+:)?xmpmeta\b[\s\S]*?<\/\1?xmpmeta\s*>/});function jS(){return{alt:"",focus:null,tags:[]}}function bM(e){if(e.startsWith("#x")||e.startsWith("#X"))return Number.parseInt(e.slice(2),16);return e.startsWith("#")?Number(e.slice(1)):null}function Jm(e){return e.replaceAll(/&(#x[\da-f]+|#\d+|\w+);/gi,(t,n)=>{let r=bM(n),s=r===null?xM.get(n):r<=1114111?String.fromCodePoint(r):void 0;if(s===void 0)throw new jn(`Unknown entity ${t}`);return s})}function $M(e){let t={attrs:[],children:[],name:"#root",type:"element"},n=[t],r=0,s=()=>n.at(-1)??t;while(r<e.length){let o=e.indexOf("<",r);if(o===-1){s().children.push({type:"text",value:Jm(e.slice(r))});break}if(o>r)s().children.push({type:"text",value:Jm(e.slice(r,o))});let i=e.slice(o,o+9),a;if(i.startsWith("<!--"))a=e.indexOf("-->",o),a=a===-1?-1:a+3;else if(i.startsWith("<![CDATA["))a=e.indexOf("]]>",o),a=a===-1?-1:a+3;else if(i.startsWith("<?"))a=e.indexOf("?>",o),a=a===-1?-1:a+2;else if(i.startsWith("<!"))throw new jn("A packet may not declare a document type.");else if(i.startsWith("</")){let c=e.indexOf(">",o);if(c===-1)throw new jn("Unclosed end tag.");let l=e.slice(o+2,c).trim(),u=n.pop();if(u===void 0||u===t||u.name!==l)throw new jn(`Unexpected </${l}>.`);r=c+1;continue}else{r=wM(e,o,n);continue}if(a===-1)throw new jn("Unterminated markup.");s().children.push({source:e.slice(o,a),type:"raw"}),r=a}if(n.length!==1)throw new jn(`<${s().name}> is never closed.`);return t.children}function wM(e,t,n){let r=t+1,s=PS.exec(e.slice(r));if(s===null)throw new jn("A tag has no name.");let o={attrs:[],children:[],name:s[0],type:"element"};r+=s[0].length;for(;;){while(/\s/.test(e[r]??""))r+=1;let i=e[r];if(i===void 0)throw new jn(`<${o.name}> is never finished.`);if(i===">"||e.startsWith("/>",r)){if(n.at(-1)?.children.push(o),i===">")return n.push(o),r+1;return r+2}let a=PS.exec(e.slice(r));if(a===null)throw new jn(`<${o.name}> has a malformed attribute.`);r+=a[0].length;while(/\s/.test(e[r]??""))r+=1;if(e[r]!=="=")throw new jn(`${a[0]} has no value.`);r+=1;while(/\s/.test(e[r]??""))r+=1;let c=e[r];if(c!=='"'&&c!=="'")throw new jn(`${a[0]} is not quoted.`);let l=e.indexOf(c,r+1);if(l===-1)throw new jn(`${a[0]} is never closed.`);o.attrs.push([a[0],Jm(e.slice(r+1,l))]),r=l+1}}function Di(e,t){let n=e.attrs.filter(([s])=>s==="xmlns"||s.startsWith("xmlns:"));if(n.length===0)return t;let r=new Map(t);for(let[s,o]of n)r.set(s==="xmlns"?"":s.slice(6),o);return r}function SM(e,t,n=!1){let r=e.indexOf(":");if(r===-1)return n?["",e]:[t.get("")??"",e];let s=e.slice(0,r),o=s==="xml"?"http://www.w3.org/XML/1998/namespace":t.get(s);return o===void 0?null:[o,e.slice(r+1)]}function Qn(e,t,n,r,s=!1){let o=SM(e,t,s);return o!==null&&o[0]===n&&o[1]===r}function Fi(e){return e.filter((t)=>t.type==="element")}function Li(e){return e.children.map((t)=>t.type==="text"?t.value:t.type==="element"?Li(t):"").join("")}function kS(e,t=new Map){let n=[];for(let r of Fi(e)){let s=Di(r,t);if(Qn(r.name,s,"http://www.w3.org/1999/02/22-rdf-syntax-ns#","Description"))n.push([r,s]);else n.push(...kS(r.children,s))}return n}function Vi(e,t){let n=[];for(let r of Fi(e.children)){let s=Di(r,t);for(let o of Fi(r.children)){let i=Di(o,s);if(Qn(o.name,i,"http://www.w3.org/1999/02/22-rdf-syntax-ns#","li"))n.push([o,i])}}return n}function vM(e,t){let n=e.attrs.find(([r])=>Qn(r,t,"http://www.w3.org/XML/1998/namespace","lang",!0));return n===void 0?null:n[1]}function EM(e,t){let n=Vi(e,t),r=n.find(([s,o])=>vM(s,o)?.toLowerCase()==="x-default")??n[0];return r===void 0?Li(e).trim():Li(r[0])}function Tu(e,t){if(!e.attrs.some(([r,s])=>s==="Resource"&&Qn(r,t,"http://www.w3.org/1999/02/22-rdf-syntax-ns#","parseType",!0)))for(let r of Fi(e.children)){let s=Di(r,t);if(Qn(r.name,s,"http://www.w3.org/1999/02/22-rdf-syntax-ns#","Description"))return[r,s]}return[e,t]}function uc(e,t,n,r){for(let s of Fi(e.children)){let o=Di(s,t);if(Qn(s.name,o,n,r))return[s,o]}return null}function lc(e,t,n,r){let s=e.attrs.find(([i])=>Qn(i,t,n,r,!0));if(s!==void 0)return s[1].trim();let o=uc(e,t,n,r);return o===null?null:Li(o[0]).trim()}function _S(e){if(e===null||e==="")return null;let t=Number(e);return Number.isFinite(t)&&t>=0&&t<=1?t:null}function jM(e,t){let n=uc(e,t,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rRole");if(n===null)return!1;return Vi(...n).some(([r,s])=>{let[o,i]=Tu(r,s),a=uc(o,i,"http://ns.adobe.com/xap/1.0/","Identifier");return(a===null?[lc(o,i,"http://ns.adobe.com/xap/1.0/","Identifier")??""]:Vi(...a).map(([l])=>Li(l).trim())).some((l)=>l.replace(/^https:/,"http:")==="http://cv.iptc.org/newscodes/imageregionrole/areaOfInterest")})}function PM(e,t){let[n,r]=Tu(e,t),s=uc(n,r,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","RegionBoundary");if(s===null||!jM(n,r))return null;let[o,i]=Tu(...s),a=uc(o,i,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbVertices");if(lc(o,i,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbShape")!=="polygon"||lc(o,i,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbUnit")!=="relative"||a===null)return null;let c=Vi(...a);if(c.length!==1)return null;let[l,u]=Tu(...c[0]),d=_S(lc(l,u,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbX")),p=_S(lc(l,u,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbY"));return d===null||p===null?null:{x:d,y:p}}function _M(e){let t=new Set,n=[];for(let r of e){let s=r.trim(),o=s.toLowerCase();if(s!==""&&!t.has(o))t.add(o),n.push(s)}return n}function OS(e){if(e===null)return jS();let t=jS(),n=!1;for(let[r,s]of kS($M(e))){for(let[o,i]of r.attrs)if(!n&&Qn(o,s,"http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/","AltTextAccessibility",!0))t.alt=i,n=!0;for(let o of Fi(r.children)){let i=Di(o,s);if(!n&&Qn(o.name,i,"http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/","AltTextAccessibility"))t.alt=EM(o,i),n=!0;else if(Qn(o.name,i,"http://purl.org/dc/elements/1.1/","subject"))t.tags.push(...Vi(o,i).map(([a])=>Li(a)));else if(t.focus===null&&Qn(o.name,i,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","ImageRegion"))for(let[a,c]of Vi(o,i))t.focus??=PM(a,c)}}return t.tags=_M(t.tags),t.alt=t.alt.trim(),t}var jn,xM,PS;var AS=T(()=>{jn=class jn extends Error{name="XmpParseError"};xM=new Map([["amp","&"],["apos","'"],["gt",">"],["lt","<"],["quot",'"']]);PS=/^[A-Za-z_][\w.:-]*/});import{existsSync as DS,readFileSync as kM,statSync as OM}from"node:fs";import{basename as AM,extname as Im,resolve as RS}from"node:path";async function CM(e,t){let n=t.get(e);if(!n){let r=Ii(e);try{let s=await lS(e);n={width:s.width,height:s.height,hash:r}}catch(s){if(!CS)CS=!0,console.warn(`Could not read image dimensions (${$e(s)}) — `+"emitting srcsets without width/height attributes.");n={width:null,height:null,hash:r}}t.set(e,n)}return n}function NS(e,t,n,r){let s=t.quality.webp??80,o=e.startsWith("/")?"":"/",i=r?`?v=${r}`:"",a=NM(e);return t.widths.filter((c)=>c<=n).toSorted((c,l)=>c-l).map((c)=>`/cdn-cgi/image/width=${c},quality=${s},fit=scale-down,format=auto${o}${a}${i} ${c}w`).join(", ")}function NM(e){return e.replaceAll(/[\s,]/g,(t)=>encodeURIComponent(t))}async function TM(e,t,n,r,s){let o=hS(e,n),i=xS(s,o);if(i){if(i.variants.every((l)=>DS(l.absolutePath)))return i}if(!i)console.log(` Optimizing ${AM(e)}...`);let a=await dS(e,Mi(r),n);return bS(s,o,t,a),a}function JM(e){if(!e)return!0;if(e.includes("${"))return!0;if(LS.some((t)=>e.startsWith(t)))return!0;if(FS.has(Im(e).toLowerCase()))return!0;return!1}function IM(e,t){if(t.service!=="cloudflare")return!1;if(!t.remoteDomains?.length)return!1;if(!e.startsWith("https://"))return!1;if(e.includes("${"))return!1;try{let n=new URL(e);if(FS.has(Im(n.pathname).toLowerCase()))return!1;return t.remoteDomains.includes(n.hostname)}catch{return!1}}function VS(e,t,n){let r=n?.length?_l(n,e):null;if(r)return r;if(e.startsWith("/"))return RS(t,"public",e.slice(1));return RS(t,e)}function JS(e){return`${Math.round(e*1000)/10}%`}function MM(e){let t=SS(e);if(t===null)return null;let n;try{let o=OM(e);n=`${e}|${o.mtimeMs}|${o.size}`}catch{return null}let r=TS.get(n);if(r!==void 0)return r;let s=null;try{let o=new Uint8Array(kM(e)),{focus:i}=OS(vS(o,t));s=i===null?null:`${JS(i.x)} ${JS(i.y)}`}catch{s=null}return TS.set(n,s),s}function DM(e,t,n,r){if(!k(t)||t===""||t.includes("${"))return;if(LS.some((a)=>t.startsWith(a)))return;let{style:s}=e;if(s!==void 0&&!D(s))return;if(s?.objectPosition!==void 0)return;let[o=""]=t.split(/[?#]/),i=MM(VS(o,n,r));if(i!==null)e.style={...s,objectPosition:i}}async function qS(e,t,n,r,s,o=[]){let i=new Map;return await WS(e,t,n,r,s??new Map,i,o),{imageRefs:i}}async function WS(e,t,n,r,s,o,i,a=null){if(e.tagName==="img"){if(await UM(e,t,n,r,s,o,i,a))return}if(k(e.innerHTML)&&e.innerHTML.includes("<img"))e.innerHTML=await XM(e.innerHTML,t,n,r,s,o,i);if(Array.isArray(e.children)){let c=US(e,a);for(let l of e.children){if(!nn(l))continue;await WS(l,t,n,r,s,o,i,c)}}}async function HS(e,t,n,r,s,o,i,a){if(!k(e)||t)return null;let c=IM(e,n);if(!c&&JM(e))return null;if(c)return{dims:null,sources:[],srcset:NS(e,n,1/0,null)};let l=VS(e,r,a);if(!DS(l))return null;if(n.service==="cloudflare"){let g=await CM(l,o),b=NS(e,n,g.width??1/0,g.hash);return{dims:g.width&&g.height?{height:g.height,width:g.width}:null,sources:[],srcset:b}}if(RM.has(Im(l).toLowerCase()))return null;let u=i.get(l);if(!u)u=await TM(l,e,n,r,s),i.set(l,u);let d=LM(n.formats,u.variants),m=[...IS.filter((g)=>d.includes(g)),...d.filter((g)=>!IS.includes(g))].flatMap((g)=>{let b=pS(u.variants,g);return b===""?[]:[{srcset:b,type:FM.get(g)??`image/${g}`}]}),x=u.original?.width&&u.original.height?{height:u.original.height,width:u.original.width}:null,h=n.picture!==!1&&m.length>1;return{dims:x,fallbackSrc:qM(u.variants,d),sources:h?m:[],srcset:m[0]?.srcset??""}}function LM(e,t){return e.includes("jpeg")&&!e.includes("png")&&t.some((r)=>r.format==="png")&&!t.some((r)=>r.format==="jpeg")?[...e,"png"]:e}function qM(e,t){let n=VM.find((s)=>t.includes(s)&&e.some((o)=>o.format===s));if(n===void 0)return;let r;for(let s of e)if(s.format===n&&(r===void 0||s.width>r.width))r=s;return r&&Am(r.outputPath)}function MS(e){if(!k(e))return null;let t=WM.exec(e.trim());if(!t)return null;let n=Number(t[1]);return t[2]==="rem"?n*16:n}function US(e,t){let{style:n}=e;if(!D(n))return t;let r=MS(n.maxWidth)??MS(n.width);if(r===null)return t;return t===null?r:Math.min(t,r)}function HM(e){if(e===null)return;let t=Math.round(e);return`(max-width: ${t}px) 100vw, ${t}px`}async function UM(e,t,n,r,s,o,i,a=null){if(!e.attributes)e.attributes={};let c=e.attributes;if(c.src===void 0&&k(e.src))c.src=e.src,delete e.src;DM(e,c.src,n,i);let l=t.optimize?await HS(c.src,c["data-no-optimize"]!==void 0,t,n,r,s,o,i):null,u=US(e,a),d=c.sizes??HM(u)??t.sizes;if(l){if(l.srcset!==""){if(c.srcset=l.srcset,c.sizes=d,l.fallbackSrc!==void 0)c.src=l.fallbackSrc}if(l.dims&&c.width===void 0&&c.height===void 0)c.width=String(l.dims.width),c.height=String(l.dims.height)}if(Object.assign(c,Nm(c,t.lazyLoad)),l&&l.sources.length>0)return BM(e,l.sources,d),!0;return!1}function BM(e,t,n){let r={...e.attributes},s=r.sizes??n;delete r.srcset,delete r.sizes;let o={attributes:r,tagName:"img"};if(e.style!==void 0)o.style=e.style,delete e.style;let i=t.map((a)=>{let c={};if(s!=="")c.sizes=s;return c.srcset=a.srcset,c.type=a.type,{attributes:c,tagName:"source"}});i.push(o),e.tagName="picture",e.attributes={},e.children=i}async function XM(e,t,n,r,s,o,i){let a=[];for(let l of e.matchAll(zM)){let u=l[0],d=l[1],p=(fc(d,"src")??"").replaceAll("&","&"),m=KM.test(d),x=t.optimize&&p!==""&&!m?await HS(p,GM.test(d),t,n,r,s,o,i):null,h="";if(x&&x.srcset!=="")h+=` srcset="${x.srcset}" sizes="${t.sizes}"`;if(x?.dims&&!/\bwidth=/.test(d)&&!/\bheight=/.test(d))h+=` width="${x.dims.width}" height="${x.dims.height}"`;let g=Nm({decoding:fc(d,"decoding"),fetchpriority:fc(d,"fetchpriority"),loading:fc(d,"loading")},t.lazyLoad);for(let[j,v]of Object.entries(g))h+=` ${j}="${v}"`;if(h==="")continue;let b=x&&x.sources.length>0?YM(d,x.sources,t.sizes,h):`<img${d}${h}>`;a.push({match:u,replacement:b})}let c=e;for(let{match:l,replacement:u}of a)c=c.replace(l,u);return c}function YM(e,t,n,r){let s=fc(e,"sizes")??n,o=r.replace(/ srcset="[^"]*"/,"").replace(/ sizes="[^"]*"/,"");return`<picture>${t.map((a)=>`<source type="${a.type}" srcset="${a.srcset}" sizes="${s}">`).join("")}<img${e}${o}></picture>`}function fc(e,t){return new RegExp(`\\b${t}="([^"]*)"`,"i").exec(e)?.[1]}var FS,RM,LS,CS=!1,TS,IS,FM,VM,WM,zM,KM,GM;var BS=T(()=>{Rm();Cm();$n();le();Dt();ES();AS();FS=new Set([".svg",".gif"]),RM=new Set([".avif"]),LS=["http://","https://","data:","//"];TS=new Map;IS=["avif","webp","jpeg","png"],FM=new Map([["avif","image/avif"],["jpeg","image/jpeg"],["png","image/png"],["webp","image/webp"]]);VM=["jpeg","png"];WM=/^(\d+(?:\.\d+)?)(px|rem)$/;zM=/<img\b([^>]*)>/gi,KM=/\bsrcset="/,GM=/\bdata-no-optimize\b/});import{createHash as ZM}from"node:crypto";import{existsSync as QM}from"node:fs";import{join as zS}from"node:path";function nD(e,t){let n=e.replace(/^\//,"");return e.endsWith("/")||n===""?zS(t,n,"index.html"):zS(t,n)}function Dm(e){if(e===void 0)return null;if(e===!1)return!1;if(e===!0)return{};return e.enabled===!1?!1:e}function rD(e){let t=JSON.stringify({fallback:e.offlineFallback??null,precache:[...e.precache??[]].toSorted(),scope:e.scope??"/"});return ZM("sha256").update(t,"utf8").digest("hex").slice(0,8)}function KS(e,t,n=""){let r=[],s=[],o=[...e.precache??[]],i=e.offlineFallback;if(i!==void 0&&!o.includes(i))o.push(i),r.push(`serviceWorker: "${i}" is the offline fallback but was not in \`precache\` — `+"added, since a page that was never cached cannot be served offline.");if(t!==void 0){for(let m of o)if(!m.startsWith("/"))s.push(`serviceWorker.precache: "${m}" must be a site-absolute URL starting with /.`);else if(!QM(nD(m,t)))s.push(`serviceWorker.precache: "${m}" is not a file this build produced — `+"`cache.addAll()` is all-or-nothing, so one bad entry stops the worker installing.")}let a=o.map((m)=>We(n,m)),c=We(n,eD),l=i===void 0?null:We(n,i),u=`${We(n,tD)}/`,d=`jx-${rD(e)}`,p=`/*
|
|
431
|
+
In a checkout of the Jx repository, build it with \`bun run build:addon\` (needs Rust). In a project, reinstall dependencies without --no-optional so the package for this platform is installed.`)}function tj(){return ZE??=QL(YL()),ZE}async function nj(e){return tj().imageMetadata(e)}async function rj(e){return tj().processImage(e)}var ej,YE,ZE;var sj=J(()=>{XE();ej={avif:65,jpeg:80},YE=UL(import.meta.url)});import{createHash as Iy}from"node:crypto";import{readFileSync as eF}from"node:fs";import{basename as tF,extname as nF,resolve as oj}from"node:path";async function ij(e){return nj(e)}function Yi(e){let t=eF(e);return Iy("md5").update(t).digest("hex").slice(0,8)}function oF(e,t){let n=new Map(Object.entries(e)).get(t);if(n!==void 0)return n;return new Map(Object.entries(ej)).get(t)??sF}function iF(e,t,n){return Iy("md5").update(`${Yi(e)}:${aj}:${t}:${n}`).digest("hex").slice(0,8)}function lj(e){let t=JSON.stringify({formats:e.formats,quality:e.quality,v:aj,widths:e.widths});return Iy("md5").update(t).digest("hex").slice(0,8)}async function cj(e,t,n){let r=oj(t,"_optimized"),s={};if(n.quality.avif!==void 0)s.avif=n.quality.avif;if(n.quality.jpeg!==void 0)s.jpeg=n.quality.jpeg;let o=await rj({formats:n.formats,hashes:Object.fromEntries(n.formats.map((i)=>[i,iF(e,i,oF(n.quality,i))])),outDir:r,quality:s,source:e,stem:tF(e,nF(e)),widths:n.widths});return{contentHash:Yi(e),original:o.original,variants:o.variants.map((i)=>({absolutePath:oj(r,i.fileName),format:i.format,outputPath:`/${rF}/${i.fileName}`,width:i.width}))}}function uj(e,t){return e.flatMap((n)=>n.format===t?[`${Dy(n.outputPath)} ${n.width}w`]:[]).join(", ")}function Dy(e){return e.split("/").map((t)=>encodeURIComponent(t)).join("/")}var rF="images/_optimized",aj=4,sF=100;var Ly=J(()=>{sj()});import{existsSync as aF,mkdirSync as lF,readFileSync as cF,rmSync as uF,writeFileSync as fF}from"node:fs";import{basename as fj,extname as dF,resolve as Bl}from"node:path";import{execSync as pF}from"node:child_process";import{createHash as mF}from"node:crypto";import{tmpdir as hF}from"node:os";function yF(){let e=process.env.npm_config_cache??process.env.NPM_CONFIG_CACHE;if(e)return e;try{let t=pF("npm config get cache",{cwd:hF(),encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:gF}).trim();return t&&t!=="undefined"?t:null}catch{return null}}function Yf(e){if(Xf===void 0)Xf=yF();if(Xf){let t=Bl(e),n=mF("md5").update(t).digest("hex").slice(0,8);return Bl(Xf,"jxsuite-images",`${fj(t)}-${n}`)}return Bl(e,".cache/images")}function dj(e,t){return`${Yi(e)}:${lj(t)}:${fj(e,dF(e))}`}function pj(e){let t=Bl(Yf(e),"manifest.json");if(!aF(t))return{entries:{},touched:new Set,version:1};try{let n=JSON.parse(cF(t,"utf8"));return n.touched=new Set,n}catch{return{entries:{},touched:new Set,version:1}}}function mj(e,t,n={}){if(n.prune&&t.touched)xF(t,t.touched);let r=Yf(e);lF(r,{recursive:!0}),fF(Bl(r,"manifest.json"),JSON.stringify({entries:t.entries,version:t.version},null,2),"utf8")}function xF(e,t){let n=new Set,r=Object.entries(e.entries);for(let[s,o]of r)if(t.has(s))for(let i of o.manifest.variants??[])n.add(i.absolutePath);for(let[s,o]of r){if(t.has(s))continue;for(let i of o.manifest.variants??[])if(!n.has(i.absolutePath))uF(i.absolutePath,{force:!0});delete e.entries[s]}}function hj(e){let t=new Set,n=new Map(Object.entries(e.entries));for(let r of e.touched??[])for(let s of n.get(r)?.manifest.variants??[])t.add(s.absolutePath);return[...t]}function gj(e,t){e.touched?.add(t);let n=e.entries[t];if(!n)return null;return n.manifest}function yj(e,t,n,r){e.touched?.add(t),e.entries[t]={manifest:r,source:n,timestamp:Date.now()}}var Xf,gF=3000;var Fy=J(()=>{Ly()});function Vy(e,t){if(!t||xj(e.loading))return{};if(String(e.fetchpriority??"").toLowerCase()==="high")return{};return xj(e.decoding)?{loading:"lazy"}:{decoding:"async",loading:"lazy"}}var xj=(e)=>e!==void 0&&e!==null&&e!=="";function $j(e){let t=e.lastIndexOf(".");return bF.get(t>0?e.slice(t).toLowerCase():"")??null}function Qf(e){try{return SF.decode(e)}catch{throw new Tn("The metadata is not valid UTF-8.")}}function Zf(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Ul(e,t,n){return String.fromCodePoint(...e.subarray(t,t+n))}function Sj(e,t){switch(t){case"jpeg":return EF(e).packet;case"png":return kF(e).packet;case"webp":return AF(e).packet;default:return TF(Qf(e)).packet}}function wF(e){if(e[0]!==255||e[1]!==216)throw new Tn("Not a JPEG file.");let t=[],n=2;while(n+4<=e.length){if(e[n]!==255)throw new Tn("The JPEG's markers are damaged.");let r=e[n+1]??0;if(r===255){n+=1;continue}if(r===218||r===217)break;let s=Zf(e).getUint16(n+2),o=n+2+s;if(s<2||o>e.length)throw new Tn("The JPEG's markers are damaged.");t.push({end:o,marker:r,start:n}),n=o}return t}function vF(e,t){let n=t.start+4;return t.marker===225&&t.end-n>=qy.length&&qy.every((r,s)=>e[n+s]===r)}function EF(e){let t=wF(e),n=t.find((s)=>vF(e,s));return{packet:n===void 0?null:Qf(e.subarray(n.start+4+qy.length,n.end)),parts:t}}function PF(e){if(!bj.every((r,s)=>e[s]===r))throw new Tn("Not a PNG file.");let t=[],n=bj.length;while(n+12<=e.length){let r=Zf(e).getUint32(n),s=n+12+r;if(s>e.length)throw new Tn("The PNG's chunks are damaged.");let o=Ul(e,n+4,4);if(t.push({dataStart:n+8,end:s,start:n,type:o}),n=s,o==="IEND")break}return t}function _F(e,t){if(t.type!=="iTXt")return null;let n=e.subarray(t.dataStart,t.end-4),r=n.indexOf(0);if(r===-1||Ul(n,0,r)!==jF)return null;if(n[r+1]!==0)throw new Tn("The PNG's metadata is compressed, which Studio does not rewrite.");let s=n.indexOf(0,r+3),o=s===-1?-1:n.indexOf(0,s+1);if(o===-1)throw new Tn("The PNG's metadata chunk is damaged.");return Qf(n.subarray(o+1))}function kF(e){let t=PF(e);return{packet:t.map((r)=>_F(e,r)).find((r)=>r!==null)??null,parts:t}}function OF(e){if(Ul(e,0,4)!=="RIFF"||Ul(e,8,4)!=="WEBP")throw new Tn("Not a WebP file.");let t=Math.min(e.length,8+Zf(e).getUint32(4,!0)),n=[],r=12;while(r+8<=t){let s=Zf(e).getUint32(r+4,!0),o=r+8,i=o+s+s%2;if(o+s>t)throw new Tn("The WebP's chunks are damaged.");n.push({dataStart:o,end:Math.min(i,t),fourcc:Ul(e,r,4),size:s,start:r}),r=i}return n}function AF(e){let t=OF(e),n=t.find((s)=>s.fourcc==="XMP ");return{packet:n===void 0?null:Qf(e.subarray(n.dataStart,n.dataStart+n.size)),parts:t}}function RF(e,t){let n=null;for(let r=t+1;r<e.length;r++){let s=e[r];if(n!==null){if(s===n)n=null}else if(s==='"'||s==="'")n=s;else if(s===">")return r}return-1}function NF(e){let t=/<svg[\s>/]/.exec(e);if(t===null)throw new Tn("Not an SVG file.");let n=RF(e,t.index);if(n===-1)throw new Tn("The SVG's root element is damaged.");return{end:n,selfClosing:e[n-1]==="/",start:t.index}}function TF(e){NF(e);let t=CF.exec(e);return t===null?{end:-1,packet:null,start:-1}:{end:t.index+t[0].length,packet:t[0],start:t.index}}var Tn,bF,$F,SF,qy,bj,jF="XML:com.adobe.xmp",CF;var wj=J(()=>{Tn=class Tn extends Error{name="XmpContainerError"};bF=new Map([[".jpeg","jpeg"],[".jpg","jpeg"],[".png","png"],[".svg","svg"],[".webp","webp"]]);$F=new TextEncoder,SF=new TextDecoder("utf-8",{fatal:!0});qy=$F.encode("http://ns.adobe.com/xap/1.0/\x00");bj=Uint8Array.of(137,80,78,71,13,10,26,10);CF=/<([\w.-]+:)?xmpmeta\b[\s\S]*?<\/\1?xmpmeta\s*>/});function vj(){return{alt:"",focus:null,tags:[]}}function MF(e){if(e.startsWith("#x")||e.startsWith("#X"))return Number.parseInt(e.slice(2),16);return e.startsWith("#")?Number(e.slice(1)):null}function Hy(e){return e.replaceAll(/&(#x[\da-f]+|#\d+|\w+);/gi,(t,n)=>{let r=MF(n),s=r===null?JF.get(n):r<=1114111?String.fromCodePoint(r):void 0;if(s===void 0)throw new Jn(`Unknown entity ${t}`);return s})}function IF(e){let t={attrs:[],children:[],name:"#root",type:"element"},n=[t],r=0,s=()=>n.at(-1)??t;while(r<e.length){let o=e.indexOf("<",r);if(o===-1){s().children.push({type:"text",value:Hy(e.slice(r))});break}if(o>r)s().children.push({type:"text",value:Hy(e.slice(r,o))});let i=e.slice(o,o+9),a;if(i.startsWith("<!--"))a=e.indexOf("-->",o),a=a===-1?-1:a+3;else if(i.startsWith("<![CDATA["))a=e.indexOf("]]>",o),a=a===-1?-1:a+3;else if(i.startsWith("<?"))a=e.indexOf("?>",o),a=a===-1?-1:a+2;else if(i.startsWith("<!"))throw new Jn("A packet may not declare a document type.");else if(i.startsWith("</")){let l=e.indexOf(">",o);if(l===-1)throw new Jn("Unclosed end tag.");let c=e.slice(o+2,l).trim(),u=n.pop();if(u===void 0||u===t||u.name!==c)throw new Jn(`Unexpected </${c}>.`);r=l+1;continue}else{r=DF(e,o,n);continue}if(a===-1)throw new Jn("Unterminated markup.");s().children.push({source:e.slice(o,a),type:"raw"}),r=a}if(n.length!==1)throw new Jn(`<${s().name}> is never closed.`);return t.children}function DF(e,t,n){let r=t+1,s=Ej.exec(e.slice(r));if(s===null)throw new Jn("A tag has no name.");let o={attrs:[],children:[],name:s[0],type:"element"};r+=s[0].length;for(;;){while(/\s/.test(e[r]??""))r+=1;let i=e[r];if(i===void 0)throw new Jn(`<${o.name}> is never finished.`);if(i===">"||e.startsWith("/>",r)){if(n.at(-1)?.children.push(o),i===">")return n.push(o),r+1;return r+2}let a=Ej.exec(e.slice(r));if(a===null)throw new Jn(`<${o.name}> has a malformed attribute.`);r+=a[0].length;while(/\s/.test(e[r]??""))r+=1;if(e[r]!=="=")throw new Jn(`${a[0]} has no value.`);r+=1;while(/\s/.test(e[r]??""))r+=1;let l=e[r];if(l!=='"'&&l!=="'")throw new Jn(`${a[0]} is not quoted.`);let c=e.indexOf(l,r+1);if(c===-1)throw new Jn(`${a[0]} is never closed.`);o.attrs.push([a[0],Hy(e.slice(r+1,c))]),r=c+1}}function Zi(e,t){let n=e.attrs.filter(([s])=>s==="xmlns"||s.startsWith("xmlns:"));if(n.length===0)return t;let r=new Map(t);for(let[s,o]of n)r.set(s==="xmlns"?"":s.slice(6),o);return r}function LF(e,t,n=!1){let r=e.indexOf(":");if(r===-1)return n?["",e]:[t.get("")??"",e];let s=e.slice(0,r),o=s==="xml"?"http://www.w3.org/XML/1998/namespace":t.get(s);return o===void 0?null:[o,e.slice(r+1)]}function mr(e,t,n,r,s=!1){let o=LF(e,t,s);return o!==null&&o[0]===n&&o[1]===r}function Qi(e){return e.filter((t)=>t.type==="element")}function ea(e){return e.children.map((t)=>t.type==="text"?t.value:t.type==="element"?ea(t):"").join("")}function Pj(e,t=new Map){let n=[];for(let r of Qi(e)){let s=Zi(r,t);if(mr(r.name,s,"http://www.w3.org/1999/02/22-rdf-syntax-ns#","Description"))n.push([r,s]);else n.push(...Pj(r.children,s))}return n}function ta(e,t){let n=[];for(let r of Qi(e.children)){let s=Zi(r,t);for(let o of Qi(r.children)){let i=Zi(o,s);if(mr(o.name,i,"http://www.w3.org/1999/02/22-rdf-syntax-ns#","li"))n.push([o,i])}}return n}function FF(e,t){let n=e.attrs.find(([r])=>mr(r,t,"http://www.w3.org/XML/1998/namespace","lang",!0));return n===void 0?null:n[1]}function VF(e,t){let n=ta(e,t),r=n.find(([s,o])=>FF(s,o)?.toLowerCase()==="x-default")??n[0];return r===void 0?ea(e).trim():ea(r[0])}function ed(e,t){if(!e.attrs.some(([r,s])=>s==="Resource"&&mr(r,t,"http://www.w3.org/1999/02/22-rdf-syntax-ns#","parseType",!0)))for(let r of Qi(e.children)){let s=Zi(r,t);if(mr(r.name,s,"http://www.w3.org/1999/02/22-rdf-syntax-ns#","Description"))return[r,s]}return[e,t]}function Kl(e,t,n,r){for(let s of Qi(e.children)){let o=Zi(s,t);if(mr(s.name,o,n,r))return[s,o]}return null}function zl(e,t,n,r){let s=e.attrs.find(([i])=>mr(i,t,n,r,!0));if(s!==void 0)return s[1].trim();let o=Kl(e,t,n,r);return o===null?null:ea(o[0]).trim()}function jj(e){if(e===null||e==="")return null;let t=Number(e);return Number.isFinite(t)&&t>=0&&t<=1?t:null}function qF(e,t){let n=Kl(e,t,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rRole");if(n===null)return!1;return ta(...n).some(([r,s])=>{let[o,i]=ed(r,s),a=Kl(o,i,"http://ns.adobe.com/xap/1.0/","Identifier");return(a===null?[zl(o,i,"http://ns.adobe.com/xap/1.0/","Identifier")??""]:ta(...a).map(([c])=>ea(c).trim())).some((c)=>c.replace(/^https:/,"http:")==="http://cv.iptc.org/newscodes/imageregionrole/areaOfInterest")})}function HF(e,t){let[n,r]=ed(e,t),s=Kl(n,r,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","RegionBoundary");if(s===null||!qF(n,r))return null;let[o,i]=ed(...s),a=Kl(o,i,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbVertices");if(zl(o,i,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbShape")!=="polygon"||zl(o,i,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbUnit")!=="relative"||a===null)return null;let l=ta(...a);if(l.length!==1)return null;let[c,u]=ed(...l[0]),d=jj(zl(c,u,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbX")),p=jj(zl(c,u,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbY"));return d===null||p===null?null:{x:d,y:p}}function WF(e){let t=new Set,n=[];for(let r of e){let s=r.trim(),o=s.toLowerCase();if(s!==""&&!t.has(o))t.add(o),n.push(s)}return n}function _j(e){if(e===null)return vj();let t=vj(),n=!1;for(let[r,s]of Pj(IF(e))){for(let[o,i]of r.attrs)if(!n&&mr(o,s,"http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/","AltTextAccessibility",!0))t.alt=i,n=!0;for(let o of Qi(r.children)){let i=Zi(o,s);if(!n&&mr(o.name,i,"http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/","AltTextAccessibility"))t.alt=VF(o,i),n=!0;else if(mr(o.name,i,"http://purl.org/dc/elements/1.1/","subject"))t.tags.push(...ta(o,i).map(([a])=>ea(a)));else if(t.focus===null&&mr(o.name,i,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","ImageRegion"))for(let[a,l]of ta(o,i))t.focus??=HF(a,l)}}return t.tags=WF(t.tags),t.alt=t.alt.trim(),t}var Jn,JF,Ej;var kj=J(()=>{Jn=class Jn extends Error{name="XmpParseError"};JF=new Map([["amp","&"],["apos","'"],["gt",">"],["lt","<"],["quot",'"']]);Ej=/^[A-Za-z_][\w.:-]*/});import{existsSync as Mj,readFileSync as BF,statSync as UF}from"node:fs";import{basename as zF,extname as Uy,resolve as Oj}from"node:path";async function XF(e,t){let n=t.get(e);if(!n){let r=Yi(e);try{let s=await ij(e);n={width:s.width,height:s.height,hash:r}}catch(s){if(!Aj)Aj=!0,console.warn(`Could not read image dimensions (${be(s)}) — `+"emitting srcsets without width/height attributes.");n={width:null,height:null,hash:r}}t.set(e,n)}return n}function Cj(e,t,n,r){let s=t.quality.webp??80,o=e.startsWith("/")?"":"/",i=r?`?v=${r}`:"",a=YF(e);return t.widths.filter((l)=>l<=n).toSorted((l,c)=>l-c).map((l)=>`/cdn-cgi/image/width=${l},quality=${s},fit=scale-down,format=auto${o}${a}${i} ${l}w`).join(", ")}function YF(e){return e.replaceAll(/[\s,]/g,(t)=>encodeURIComponent(t))}async function ZF(e,t,n,r,s){let o=dj(e,n),i=gj(s,o);if(i){if(i.variants.every((c)=>Mj(c.absolutePath)))return i}if(!i)console.log(` Optimizing ${zF(e)}...`);let a=await cj(e,Yf(r),n);return yj(s,o,t,a),a}function QF(e){if(!e)return!0;if(e.includes("${"))return!0;if(Dj.some((n)=>e.startsWith(n)))return!0;let t=Uy(e).toLowerCase();return!KF.has(t)&&!Ij.has(t)}function e2(e,t){if(t.service!=="cloudflare")return!1;if(!t.remoteDomains?.length)return!1;if(!e.startsWith("https://"))return!1;if(e.includes("${"))return!1;try{let n=new URL(e);if(GF.has(Uy(n.pathname).toLowerCase()))return!1;return t.remoteDomains.includes(n.hostname)}catch{return!1}}function Lj(e,t,n){let r=n?.length?xu(n,e):null;if(r)return r;if(e.startsWith("/"))return Oj(t,"public",e.slice(1));return Oj(t,e)}function Nj(e){return`${Math.round(e*1000)/10}%`}function t2(e){let t=$j(e);if(t===null)return null;let n;try{let o=UF(e);n=`${e}|${o.mtimeMs}|${o.size}`}catch{return null}let r=Rj.get(n);if(r!==void 0)return r;let s=null;try{let o=new Uint8Array(BF(e)),{focus:i}=_j(Sj(o,t));s=i===null?null:`${Nj(i.x)} ${Nj(i.y)}`}catch{s=null}return Rj.set(n,s),s}function n2(e,t,n,r){if(!k(t)||t===""||t.includes("${"))return;if(Dj.some((a)=>t.startsWith(a)))return;let{style:s}=e;if(s!==void 0&&!D(s))return;if(s?.objectPosition!==void 0)return;let[o=""]=t.split(/[?#]/),i=t2(Lj(o,n,r));if(i!==null)e.style={...s,objectPosition:i}}function gs(e){return e.replaceAll("$","$$$$")}async function zy(e,t,n,r,s,o=[]){let i=new Map;return await Fj(e,t,n,r,s??new Map,i,o),{imageRefs:i}}async function Fj(e,t,n,r,s,o,i,a=null){if(e.tagName==="img"){if(await u2(e,t,n,r,s,o,i,a))return}if(k(e.innerHTML)&&e.innerHTML.includes("<img"))e.innerHTML=await g2(e.innerHTML,t,n,r,s,o,i,By(e,a));let l=By(e,a);for(let c of r2(e))await Fj(c,t,n,r,s,o,i,l)}function r2(e){let t=[],n=(s)=>{if(!Ot(s))return;if(s.$prototype==="Array"){n(s.map);return}t.push(s)};if(Array.isArray(e.children))for(let s of e.children)n(s);else n(e.children);let r=e.cases??{};for(let s of Object.values(r))n(s);return t}async function Vj(e,t,n,r,s,o,i,a){if(!k(e)||t)return null;let l=e2(e,n);if(!l&&QF(e))return null;if(l)return{dims:null,sources:[],srcset:Cj(e,n,1/0,null)};let c=Lj(e,r,a);if(!Mj(c))return null;if(n.service==="cloudflare"){let g=await XF(c,o),x=Cj(e,n,g.width??1/0,g.hash);return{dims:g.width&&g.height?{height:g.height,width:g.width}:null,sources:[],srcset:x}}if(Ij.has(Uy(c).toLowerCase()))return null;let u=i.get(c);if(!u)u=await ZF(c,e,n,r,s),i.set(c,u);let d=o2(n.formats,u.variants),m=[...Tj.filter((g)=>d.includes(g)),...d.filter((g)=>!Tj.includes(g))].flatMap((g)=>{let x=uj(u.variants,g);return x===""?[]:[{srcset:x,type:s2.get(g)??`image/${g}`}]}),y=u.original?.width&&u.original.height?{height:u.original.height,width:u.original.width}:null,S=n.picture!==!1&&m.length>1;return{dims:y,fallbackSrc:a2(u.variants,d),sources:S?m:[],srcset:m[0]?.srcset??""}}function o2(e,t){return e.includes("jpeg")&&!e.includes("png")&&t.some((r)=>r.format==="png")&&!t.some((r)=>r.format==="jpeg")?[...e,"png"]:e}function a2(e,t){let n=i2.find((s)=>t.includes(s)&&e.some((o)=>o.format===s));if(n===void 0)return;let r;for(let s of e)if(s.format===n&&(r===void 0||s.width>r.width))r=s;return r&&Dy(r.outputPath)}function Jj(e){if(!k(e))return null;let t=l2.exec(e.trim());if(!t)return null;let n=Number(t[1]);return t[2]==="rem"?n*16:n}function By(e,t){let{style:n}=e;if(!D(n))return t;let r=t;for(let s of[Jj(n.maxWidth),Jj(n.width)])if(s!==null&&(r===null||s<r))r=s;return r}function qj(e){if(e===null)return;let t=Math.round(e);return`(max-width: ${t}px) 100vw, ${t}px`}function c2(e,t){for(let[n,r]of Object.entries(e)){if(n==="id"||n==="className")continue;let s=Bu("img",n);if(!s)continue;if(delete e[n],t[s.attribute]!==void 0)continue;if(me(r)||le(r)){t[s.attribute]=r;continue}let o=qg(s,r);if(o===null)continue;t[s.attribute]=o===""&&s.kind!=="text"?!0:o}}async function u2(e,t,n,r,s,o,i,a=null){if(!e.attributes)e.attributes={};let l=e.attributes;c2(e,l),n2(e,l.src,n,i);let c=t.optimize?await Vj(l.src,l["data-no-optimize"]!==void 0||l.srcset!==void 0,t,n,r,s,o,i):null,u=By(e,a),d=l.sizes??qj(u)??t.sizes;if(c){if(c.srcset!==""){if(l.srcset=c.srcset,d!==void 0)l.sizes=d;if(c.fallbackSrc!==void 0)l.src=c.fallbackSrc}if(c.dims&&l.width===void 0&&l.height===void 0)l.width=String(c.dims.width),l.height=String(c.dims.height)}if(Object.assign(l,Vy(l,t.lazyLoad)),c&&c.sources.length>0)return f2(e,c.sources,d),!0;return!1}function f2(e,t,n){let r={...e.attributes},s=r.sizes??n;delete r.srcset,delete r.sizes;let o={attributes:r,tagName:"img"};if(e.style!==void 0)o.style=e.style,delete e.style;let i=t.map((a)=>{let l={};if(s!==void 0&&s!=="")l.sizes=s;return l.srcset=a.srcset,l.type=a.type,{attributes:l,tagName:"source"}});i.push(o),e.tagName="picture",e.attributes={},e.children=i}async function g2(e,t,n,r,s,o,i,a){let l=[];for(let u of e.matchAll(d2)){let d=u[0],p=u[1],m=(Gl(p,"src")??"").replaceAll("&","&"),y=t.optimize&&m!==""?await Vj(m,p2.test(p)||Wy(p,"srcset")||y2(e,u.index),t,n,r,s,o,i):null,S=Gl(p,"sizes"),g=S??qj(a)??t.sizes,x=p,P="";if(y&&y.srcset!==""){if(P+=` srcset="${y.srcset}"`,S===void 0&&g!==void 0&&g!=="")P+=` sizes="${g}"`;let{fallbackSrc:j}=y;if(j!==void 0)x=p.replace(m2,(A,T)=>`${T}src="${j}"`)}if(y?.dims&&!Wy(p,"width")&&!Wy(p,"height"))P+=` width="${y.dims.width}" height="${y.dims.height}"`;let w=Vy({decoding:Gl(p,"decoding"),fetchpriority:Gl(p,"fetchpriority"),loading:Gl(p,"loading")},t.lazyLoad);for(let[j,A]of Object.entries(w))P+=` ${j}="${A}"`;if(P==="")continue;let E=y&&y.sources.length>0?x2(x,y.sources,g,P):`<img${x}${P}>`;l.push({match:d,replacement:E})}let c=e;for(let{match:u,replacement:d}of l)c=c.replace(u,gs(d));return c}function y2(e,t){let n=e.slice(0,t).toLowerCase();return n.lastIndexOf("<picture")>n.lastIndexOf("</picture>")}function x2(e,t,n,r){let s=e.replace(h2,""),o=r.replace(/ srcset="[^"]*"/,"").replace(/ sizes="[^"]*"/,""),i=n===void 0||n===""?"":` sizes="${n}"`;return`<picture>${t.map((l)=>`<source type="${l.type}" srcset="${l.srcset}"${i}>`).join("")}<img${s}${o}></picture>`}function Gl(e,t){return new RegExp(`(?:^|\\s)${t}="([^"]*)"`,"i").exec(e)?.[1]}function Wy(e,t){return new RegExp(`(?:^|\\s)${t}=`,"i").test(e)}var KF,Ij,GF,Dj,Aj=!1,Rj,Tj,s2,i2,l2,d2,p2,m2,h2;var Hj=J(()=>{Ly();Fy();An();uh();ce();yn();Lt();wj();kj();KF=new Set([".jpg",".jpeg",".png",".webp",".tif",".tiff",".bmp"]),Ij=new Set([".avif"]),GF=new Set([".svg",".gif"]),Dj=["http://","https://","data:","//"];Rj=new Map;Tj=["avif","webp","jpeg","png"],s2=new Map([["avif","image/avif"],["jpeg","image/jpeg"],["png","image/png"],["webp","image/webp"]]);i2=["jpeg","png"];l2=/^(\d+(?:\.\d+)?)(px|rem)$/;d2=/<img\b([^>]*)>/gi,p2=/\bdata-no-optimize\b/,m2=/(^|\s)src="[^"]*"/i,h2=/(?:^|\s)sizes="[^"]*"/i});import{createHash as b2}from"node:crypto";import{existsSync as $2}from"node:fs";import{join as Wj}from"node:path";function v2(e,t){let n=e.replace(/^\//,"");return e.endsWith("/")||n===""?Wj(t,n,"index.html"):Wj(t,n)}function Gy(e){if(e===void 0)return null;if(e===!1)return!1;if(e===!0)return{};return e.enabled===!1?!1:e}function E2(e){let t=JSON.stringify({fallback:e.offlineFallback??null,precache:[...e.precache??[]].toSorted(),scope:e.scope??"/"});return b2("sha256").update(t,"utf8").digest("hex").slice(0,8)}function Bj(e,t,n=""){let r=[],s=[],o=[...e.precache??[]],i=e.offlineFallback;if(i!==void 0&&!o.includes(i))o.push(i),r.push(`serviceWorker: "${i}" is the offline fallback but was not in \`precache\` — `+"added, since a page that was never cached cannot be served offline.");if(t!==void 0){for(let m of o)if(!m.startsWith("/"))s.push(`serviceWorker.precache: "${m}" must be a site-absolute URL starting with /.`);else if(!$2(v2(m,t)))s.push(`serviceWorker.precache: "${m}" is not a file this build produced — `+"`cache.addAll()` is all-or-nothing, so one bad entry stops the worker installing.")}let a=o.map((m)=>Fe(n,m)),l=Fe(n,S2),c=i===void 0?null:Fe(n,i),u=`${Fe(n,w2)}/`,d=`jx-${E2(e)}`,p=`/*
|
|
412
432
|
* Generated by @jxsuite/compiler — configure via \`serviceWorker\` in project.json.
|
|
413
433
|
* Set \`"serviceWorker": false\` to replace this with a worker that removes itself.
|
|
414
434
|
*/
|
|
415
435
|
const CACHE = ${JSON.stringify(d)};
|
|
416
436
|
const PRECACHE = ${JSON.stringify(a)};
|
|
417
|
-
const CACHE_FIRST = ${JSON.stringify(
|
|
418
|
-
const OFFLINE_FALLBACK = ${JSON.stringify(
|
|
437
|
+
const CACHE_FIRST = ${JSON.stringify(l)};
|
|
438
|
+
const OFFLINE_FALLBACK = ${JSON.stringify(c)};
|
|
419
439
|
const DYNAMIC = ${JSON.stringify(u)};
|
|
420
440
|
|
|
421
441
|
// A response its server marked as one visitor's, or as not to be kept, is never written to a cache.
|
|
@@ -509,7 +529,7 @@ self.addEventListener("fetch", (event) => {
|
|
|
509
529
|
})(),
|
|
510
530
|
);
|
|
511
531
|
});
|
|
512
|
-
`;return{errors:s,path:
|
|
532
|
+
`;return{errors:s,path:Ky,source:p,warnings:r}}function Uj(){return{errors:[],path:Ky,source:`/*
|
|
513
533
|
* Generated by @jxsuite/compiler. This site had a service worker and no longer does.
|
|
514
534
|
*
|
|
515
535
|
* A worker is sticky: removing the file would leave every previous visitor running the old one
|
|
@@ -532,96 +552,89 @@ self.addEventListener("activate", (event) => {
|
|
|
532
552
|
})(),
|
|
533
553
|
);
|
|
534
554
|
});
|
|
535
|
-
`,warnings:[]}}function
|
|
536
|
-
`,path:"manifest.webmanifest"}],warnings:r}}function
|
|
555
|
+
`,warnings:[]}}function zj(e,t=""){return`if('serviceWorker' in navigator){addEventListener('load',function(){navigator.serviceWorker.register('${Fe(t,`/${Ky}`)}',{scope:${JSON.stringify(Fe(t,e))}}).catch(function(){})})}`}var Ky="sw.js",S2="/images/_optimized/",w2="/_jx";var Kj=J(()=>{An()});import{mkdirSync as j2,writeFileSync as P2}from"node:fs";import{dirname as _2,join as k2}from"node:path";function Ds(e,t,n){if(n!==void 0)e[t]=n}function Gj(e){let t=e.manifest,n=[],r=[];if(t===void 0||t.enabled===!1)return{errors:n,files:[],warnings:r};let s=t.name??e.name??"Jx Site",o=Po(e.url),i=[];for(let u of t.icons??[])i.push(k(u.src)?{...u,src:Fe(o,u.src)}:u);let a={display:t.display??"standalone",icons:i,name:s,short_name:t.shortName??s,start_url:Fe(o,t.startUrl??"/")};Ds(a,"description",t.description),Ds(a,"theme_color",t.themeColor),Ds(a,"background_color",t.backgroundColor),Ds(a,"scope",t.scope===void 0?void 0:Fe(o,t.scope)),Ds(a,"orientation",t.orientation),Ds(a,"lang",t.lang),Ds(a,"dir",t.dir),Ds(a,"categories",t.categories);let l=new Set(i.flatMap((u)=>(u.sizes??"").split(/\s+/).map((d)=>Math.trunc(Number(d.split("x")[0]))))),c=O2.filter((u)=>!l.has(u));if(c.length>0)r.push(`manifest: no ${c.join("px and no ")}px icon declared — browsers will not offer to `+"install the site without one at each size.");return{errors:n,files:[{content:`${JSON.stringify(a,null,2)}
|
|
556
|
+
`,path:"manifest.webmanifest"}],warnings:r}}function Xj(e){let t=e.manifest;if(t===void 0||t.enabled===!1)return[];let n=[{attributes:{href:"/manifest.webmanifest",rel:"manifest"},tagName:"link"}];if(t.themeColor!==void 0)n.push({attributes:{content:t.themeColor,name:"theme-color"},tagName:"meta"});return n}function Yj(e,t){let n=e.securityTxt,r=[],s=[];if(n===void 0||n.enabled===!1)return{errors:r,files:[],warnings:s};let o=n.contact??[];if(o.length===0)r.push("securityTxt: at least one `contact` is required (RFC 9116 §2.5.3).");if(n.expires===void 0)r.push("securityTxt: `expires` is required (RFC 9116 §2.5.5) — a security.txt with no expiry "+"never goes stale visibly, which is how they end up pointing at people who left.");else{let l=new Date(n.expires);if(Number.isNaN(l.getTime()))r.push(`securityTxt: \`expires\` is not a valid date: "${n.expires}".`);else if(l.getTime()<=t.getTime())r.push(`securityTxt: \`expires\` is in the past (${l.toISOString()}) — an expired `+"security.txt tells a reporter not to trust what it says.")}let i=[];for(let l of n.preferredLanguages??[]){let c=Bn(l);if(c===null)r.push(`securityTxt.preferredLanguages: "${l}" is not a well-formed language tag.`);else i.push(c)}if(r.length>0)return{errors:r,files:[],warnings:s};let a=["# Generated by @jxsuite/compiler — configure via securityTxt in project.json.",...o.map((l)=>`Contact: ${l}`),`Expires: ${new Date(n.expires).toISOString().replace(/\.\d{3}Z$/,"Z")}`,...(n.encryption??[]).map((l)=>`Encryption: ${l}`),...(n.acknowledgments??[]).map((l)=>`Acknowledgments: ${l}`),...i.length>0?[`Preferred-Languages: ${i.join(", ")}`]:[],...n.canonical===void 0?[]:[`Canonical: ${n.canonical}`],...(n.policy??[]).map((l)=>`Policy: ${l}`),...(n.hiring??[]).map((l)=>`Hiring: ${l}`)];return{errors:r,files:[{content:`${a.join(`
|
|
537
557
|
`)}
|
|
538
|
-
`,path:".well-known/security.txt"}],warnings:s}}function
|
|
539
|
-
`,{outfile:a,resolveDir:n},{minify:r,target:"browser"}),o+=1}catch(
|
|
540
|
-
|
|
541
|
-
"imports": {
|
|
542
|
-
${Object.entries(
|
|
558
|
+
`,path:".well-known/security.txt"}],warnings:s}}function Zj(e,t,n){let r=0,s=[];for(let o of e){let i=k2(t,o.path);if(n(i)){s.push(o.path);continue}j2(_2(i),{recursive:!0}),P2(i,o.content,"utf8"),r+=1}return{skipped:s,written:r}}var O2;var Qj=J(()=>{An();Jo();ce();O2=[192,512]});import{existsSync as A2,mkdirSync as Yy,readFileSync as C2,readdirSync as R2,writeFileSync as N2}from"node:fs";import{dirname as Xl,join as T2,relative as J2,resolve as td}from"node:path";function M2(e){return e.endsWith("/")}function tP(e=Zy){let t={},n=[],r=[];for(let s of nd)if(I2(s.specifier,e))t[s.specifier]=s.assetPath,t[`${s.specifier}/`]=s.assetDir,r.push(s.assetPath);else t[s.specifier]=s.fallback,t[`${s.specifier}/`]=`${s.fallback}/`,n.push(`Could not resolve "${s.specifier}" — the import map falls back to ${s.fallback}. Interactive pages will load it from a third party, and a \`default-src 'self'\` policy will block them.`);return{assetPaths:r,imports:t,warnings:n}}async function nP(e,t,n=Zy,r=!0){let s=[],o=0;for(let i of nd){if(!e.assetPaths.includes(i.assetPath))continue;let a=td(t,i.assetPath.replace(/^\//,""));Yy(Xl(a),{recursive:!0});try{await No(`export * from ${JSON.stringify(i.specifier)};
|
|
559
|
+
`,{outfile:a,resolveDir:n},{minify:r,target:"browser"}),o+=1}catch(l){s.push(`Bundling client runtime "${i.specifier}": ${be(l)}`)}}return{errors:s,written:o}}function Qy(e){return Object.entries(e).filter(([t,n])=>!M2(t)&&n.startsWith("/")).map(([,t])=>t)}function rP(e){let t=[];for(let n of e.matchAll(/<script type="importmap">([\s\S]*?)<\/script>/g)){let r;try{r=JSON.parse(n[1])}catch{continue}let s=L(r)?r.imports:void 0;if(!D(s))continue;let o=Object.entries(s).flatMap(([i,a])=>k(a)?[[i,a]]:[]);t.push(...Qy(Object.fromEntries(o)))}return t}function I2(e,t){try{return jw(e,t),!0}catch{return!1}}async function sP(e,t=Zy,n=!0){let r=[],s=new Set,o=new Map,i=new Map,a=0,l=async(u)=>{if(!i.has(u.specifier))i.set(u.specifier,await kw(u.specifier,t,{target:"browser"}));return i.get(u.specifier)},c=async(u)=>[...C2(u,"utf8").matchAll(/(?:from|import)\s*["']([^"']+)["']/g)].map((p)=>p[1]);for(let u=0;u<eP;u++){let d=0,p=[];try{p=R2(e,{recursive:!0}).map(String).filter((m)=>m.endsWith(".js")).map((m)=>T2(e,m))}catch{return Xy(e,o,r,a)}for(let m of p){let y=[];try{y=await c(m)}catch{continue}for(let S of y){let g=nd.find((w)=>S.startsWith(`${w.specifier}/`));if(!g||s.has(S))continue;s.add(S);let x=S.slice(g.specifier.length+1),P=td(e,`${g.assetDir.replace(/^\//,"")}${x}`);Yy(Xl(P),{recursive:!0});try{await No(`export * from ${JSON.stringify(S)};
|
|
560
|
+
`,{outfile:P,resolveDir:t},{minify:n,resolver:D2(g,P,await l(g),o),target:"browser"}),a+=1,d+=1}catch(w){r.push(`Bundling runtime subpath "${S}": ${be(w)}`)}}}if(d===0)return Xy(e,o,r,a)}return r.push(`Runtime subpath resolution did not settle in ${eP} passes — a package subpath `+"graph this deep is more likely a cycle in the scan than a real dependency chain."),Xy(e,o,r,a)}function D2(e,t,n,r){return{filter:/.*/,resolve:({importer:s,path:o})=>{if(km(s))return;if(nd.find((a)=>o===a.specifier||o.startsWith(`${a.specifier}/`))!==void 0)return{external:!0,path:o};if(n===void 0||!o.startsWith("."))return;if(td(Xl(s),o)!==n)return;return r.set(td(Xl(t),o),e.specifier),{external:!0,path:o}}}}function Xy(e,t,n,r){let s=r;for(let[o,i]of t){if(A2(o))continue;try{Yy(Xl(o),{recursive:!0}),N2(o,`export * from ${JSON.stringify(i)};
|
|
561
|
+
`,"utf8"),s+=1}catch(a){n.push(`Writing shared core stub ${J2(e,o)}: ${be(a)}`)}}return{errors:n,written:s}}var nd,Zy,eP=10;var oP=J(()=>{Om();yn();ce();Lt();yn();nd=[{assetDir:"/assets/@vue/reactivity/",assetPath:"/assets/vue-reactivity.js",fallback:Ts,specifier:"@vue/reactivity"},{assetDir:"/assets/lit-html/",assetPath:"/assets/lit-html.js",fallback:Nr,specifier:"lit-html"}];Zy=import.meta.dirname});import{copyFileSync as L2,cpSync as ex,existsSync as Ls,mkdirSync as hr,mkdtempSync as F2,readFileSync as V2,rmSync as iP,statSync as q2,writeFileSync as on}from"node:fs";import{createHash as H2}from"node:crypto";import{tmpdir as W2}from"node:os";import{basename as tx,dirname as gr,join as Tr,relative as nx,resolve as at,sep as aP}from"node:path";async function fP(e,t={}){let{clean:n=!0,includeHeld:r=!1,optimizeImages:s=!0,verbose:o=!1}=t,i=[],a=o?console.log.bind(console):()=>{},l={bundles:0,components:0,content:0,outputs:0,routes:0,setup:0,total:0},c=performance.now(),u=c,d=(h)=>{let b=performance.now();l[h]=b-u,u=b};a("Loading project.json...");let{config:p}=As(e);if(!s&&p.images.optimize)p.images={...p.images,optimize:!1},console.log("Image optimization is off for this build: images are published as they are.");if("contentTypes"in p)throw Error('project.json declares "contentTypes", which is no longer supported. Run `bun scripts/migrate-project-extensions.ts <project>` to migrate to "extensions" + "content", then `jx schema`.');let m=at(e,p.build.outDir),y=at(e,"pages"),S=at(e,"public"),g=p.build.trailingSlash??"always",x=p.build.minify!==!1,P=new Map,w=new Map,E=new Map,j=(h)=>{let b=h.toSorted(),_=`/assets/elements-${H2("sha1").update(b.join("\x00")).digest("hex").slice(0,12)}.js`;return E.set(_,b),_},A=tP(),T=A.imports,I=new Set,V=U0(),{errors:H,i18n:O}=Mm(p);for(let h of H)i.push(h),console.error(h);for(let h of A.warnings)console.warn(h);let N=new Map,G=(h,b,v)=>{let _=N.get(h);if(_!==void 0&&_.entryPath!==b)throw Error(`"${v}" and "${_.specifier}" both map to ${h} — rename one`);N.set(h,{entryPath:b,specifier:v})},Q=new Set,re=(h)=>{if(!Q.has(h))Q.add(h),i.push(h),console.error(h)},ue=(h)=>{let b=Ni(h);if(b===null)return re(`$src "${h}" is not a document script specifier`),h;if(b.side==="server")return re(`${b.path}: a client function names "#server". A server module is called by a timing: "server" entry and never imported by a page`),h;try{let v=gu(`./${b.path}`);return G(v,h,h),P.set(v,{entryPath:h,script:!0,specifier:h}),v}catch(v){return re(`Script of ${b.path}: ${be(v)}`),h}},ne=(h,b)=>{if(Vu(h))return ue(h);if(Ri(h)!==null)return re(`$src "${h}" names its own document's script, but it is not in a document: project.json has no $script. Move the entry into the page, layout or component that carries the script`),h;if(!Ew(h))return h;try{let v=Pm(h,b??e,e);if(!jo(h)&&!Ls(v))return console.warn(`Sidecar "${h}" not found at ${v} — emitting unbundled`),h;let _=jo(h)?h:`./${nx(e,v)}`,M=gu(_);return G(M,v,h),P.set(M,{entryPath:v,specifier:h}),M}catch(v){return i.push(`Sidecar "${h}": ${be(v)}`),h}},fe=(h)=>{let b=VS(h);try{let v=Pm(`npm:${h}`,e,e);return G(b,v,h),w.set(b,v),b}catch(v){return i.push(`$head specifier "${h}": ${be(v)}`),h}},xe=await Os(e,p),X=new Map,B=(h,b,v)=>{let _=Mf(h,{docDir:b,imports:v,projectRoot:e,registry:xe});if(_===void 0)throw Error(`external class "${h.$prototype}" names no class: give it a $src or an imports entry, or enable the extension that provides "${h.$prototype}"`);if(J0(_.classDef))throw Error(`external class "${h.$prototype}" reads the build's context (#/$context/) and cannot run in a browser: use "timing": "compiler"`);let M=M0(_),K=gu(`class:${_.exportName}`);return G(K,_.classJsonPath,h.$prototype),X.set(K,M),K},q=xe.formats,z=fE(e,(h)=>hs(h,q));if(q.entries.length>0)a(` Registered ${q.entries.length} format(s): ${q.entries.map((h)=>h.name).join(", ")}`);let We=xe.serverMounts().filter((h)=>{if(!h.project)return!0;let b=p[h.project.key];return D(b)&&Object.keys(b).length>0});if(We.length>0&&!p.build.adapter){let h=We.map((b)=>b.project?`"${b.project.key}"`:`"${b.server.basePath}"`).join(", ");throw Error(`project.json declares dynamic section(s) ${h} served by extension mounts, but `+`build.adapter is "static". Dynamic tables need a server-capable adapter — ${lP}`)}if(d("setup"),n&&Ls(m))iP(m,{force:!0,recursive:!0});if(hr(m,{recursive:!0}),!Ls(y))throw Error(`pages/ directory not found in ${e}`);a("Discovering pages...");let qe=await V0(y,q);a(` Found ${qe.length} page(s)`),a("Loading project sections...");let Ye=await sE(e,p,xe,{includeHeld:r}),te=Object.keys(Ye);if(te.length>0)a(` Loaded ${te.length} section(s): ${te.join(", ")}`);let{errors:Ut,mounts:Je}=await iE(xe,p,e);i.push(...Ut);for(let h of Ut)console.error(h);if(Je.length>0)a(` Mounted ${Je.length} asset dir(s): ${Je.map((h)=>h.urlPrefix).join(", ")}`);let jt=new Set,bt=await z2(xe,p,e),ct=(await W0(qe,e,Ye,xe,p,O,{errors:i})).map((h)=>Object.assign(h,{locale:cr(h.urlPattern,O)}));a(` ${ct.length} route(s) after expansion`);let Se=0;d("content");let Ze=p.images.optimize&&p.images.service==="cloudflare",Nt=p.images.optimize&&!Ze?pj(e):null,co=Ze?new Map:null;if(Nt&&p.images.formats?.includes("webp"))console.warn('images.formats lists "webp", which this compiler writes losslessly: its files are several times the size of AVIF or JPEG. Keep it only for pixel-exact output; ["avif", "jpeg"] is the default.');if(Ze)console.log('images.service is "cloudflare" — srcsets use /cdn-cgi/image transform URLs. '+"Ensure Image Transformations are enabled for your zone (Cloudflare dashboard → "+"Images → Transformations); these URLs do not work on *.pages.dev / *.workers.dev previews.");let $t=[],tr=new Map,tn=new Map,Xr=new Map,{components:Mn,errors:Ca}=await xE({formatRegistry:q,pageSources:ct.map((h)=>h.sourcePath),projectConfig:p,projectRoot:e});for(let h of Ca)i.push(h),console.error(h);if(Mn.length>0){a("Compiling components...");let h=at(m,"components");hr(h,{recursive:!0});let b=new Map(Mn.map((ie)=>[ie.path,ie.tagName])),v=new Set(b.values()),_=new Map,M=new Set,K=Po(p.url),ae=Gf(K),U=new Map,oe=async(ie,ge)=>{await zy(ie,p.images,e,Nt,co??void 0,Je);let De=ge??"",ut=U.get(De);if(ut===void 0){let Me=Vl(ie,ge===null?{}:{sourcePath:ge},e,{asInitialValues:!0,config:p,registerBundle:(Pt)=>{ne(Pt,null)},registry:xe,sections:Ye});U.set(De,Me),await Me;return}let In=await ut;if(ie.state)Object.assign(ie.state,In)};for(let{doc:ie,path:ge}of Mn){let De=df(ie,p.state);try{await oe(De,ge);let ut={formats:q,prepareDocument:async(Me,Pt)=>{await oe(Me,Pt),US(Me,K)},resolveClass:(Me,Pt,Dt)=>Fe(K,B(Me,Pt,Dt)),resolveElementPath:(Me,Pt)=>{let Dt=Pt?at(Pt,Me):at(Me),$r=b.get(Dt);return $r?`./${$r}.js`:Me.replace(/\.(?:json|jxn)$/i,".js")},projectRoot:e,projectState:p.state,rewriteSrc:(Me,Pt)=>Fe(K,ne(Me,Pt)),serverBaseUrl:ae,stylesheetHref:(Me)=>v.has(Me)?Fe(K,Rf(Me)):null};if(p.$media)ut.$media=p.$media;ut.defaults=p.defaults;let In=await Gi(ge,ut);for(let Me of In.files){let Pt=Me.tagName?`${Me.tagName}.js`:tx(Me.path);if(!$t.includes(Me.tagName))on(at(h,Pt),Me.content,"utf8"),$t.push(Me.tagName),Se+=1}if(De.tagName){tn.set(De.tagName,De),Xr.set(De.tagName,ge);let Me=Rn(De,p.defaults),Pt=Nf(De.tagName,De.style,De,p.$media??{},Me);if(_.set(De.tagName,Pt),Me===null)tr.set(De.tagName,Pt),Ff(Pt,Je,jt),on(at(h,`${De.tagName}.css`),Qa(Pt,K),"utf8"),Se+=1;else M.add(De.tagName)}}catch(ut){let In=be(ut),Me=nx(e,ge).replaceAll("\\","/");i.push(`Error compiling component ${Me}: ${In}`),console.error(`Error compiling component ${Me}: ${In}`)}}for(let ie of M){let ge=h0(ie,tn,_,M);Ff(ge,Je,jt),on(at(h,`${ie}.css`),Qa(ge,K),"utf8"),Se+=1}a(` Compiled ${$t.length} component(s): ${$t.join(", ")}`)}if(tn.size>0){let h=[...tn].map(([_,M])=>({className:Ms(_),doc:M,modulePath:nx(e,at(m,"components",`${_}.js`)).split(aP).join("/"),shadow:Rn(M,p.defaults)!==null,tagName:_})),{manifest:b,warnings:v}=pu(h);for(let _ of v)console.warn(_);on(at(m,"custom-elements.json"),mu(b),"utf8"),Se+=1,a(` Wrote custom-elements.json (${h.length} element(s))`)}let dp=Cf($t,tn),xr=[];for(let[h,b]of tn)xr.push(...ql(b,Xr.get(h),e));if(p.state){let h=ql({state:p.state},qn(e),e);for(let b of h)if(Ri(b.src)===null)xr.push(b);else re(`Server function "${b.exportName}" in ${b.declaredIn} names "${b.src}", its own document's script, but project.json has no $script. Move the entry into the page, layout or component that carries the script`)}d("components");let br=p.url,nr=Po(br),bs=Boolean(br)&&p.build.sitemap!==!1,uo=[],bc=ct.filter((h)=>!h.urlPattern.includes(":")&&!h.urlPattern.includes("*")),pp=O===null?new Map:await F0(bc,q),un=bc.map((h)=>({translationKey:pp.get(h.urlPattern),urlPattern:h.urlPattern})),Xo=w0(un,O,br,g),{conflicts:$c,sets:mp}=ay(un,O);for(let h of $c){let[b,v]=h.urlPatterns,_=h.declared?"Give one of them a different $translationKey.":"Move one out of the locale tree, or give it its own $translationKey.",M=`${v} and ${b} are both the "${h.locale}" version of "${h.key}". A translation set names one URL per language, so ${v} is `+`dropped from it — it carries no alternates and no switcher. ${_}`;if(h.declared)i.push(M),console.error(M);else console.warn(M)}let fo=$0(ct,O);if(fo.length>0)console.warn(`i18n.routing is "prefix-always", but ${fo.length} route(s) sit outside the locale tree and are served as "${O?.defaultLocale}": ${fo.slice(0,10).join(", ")}${fo.length>10?`, and ${fo.length-10} more`:""}. Move them under a locale directory, or use "prefix-except-default".`);if(O!==null&&O.routing==="prefix-always"&&!p.build.adapter&&!ct.some((h)=>h.urlPattern==="/"))console.warn('i18n.routing is "prefix-always" and no page claims "/", so the site root is a 404. '+'Locale negotiation answers "/" only when build.adapter is set — a static deployment has '+`no runtime to read Accept-Language. Add a redirect from "/" to "/${O.defaultLocale.toLowerCase()}/", set build.adapter, or use "prefix-except-default".`);let Sc=new Set,wc=new Set;for(let h of ct){let b=S0(h.urlPattern,O);if(b&&!Sc.has(b.segment))Sc.add(b.segment),console.warn(`Routes under /${b.segment}/ are served as "${O?.defaultLocale}" — `+`i18n.locales declares "${b.meant}", not "${b.segment}". Rename the directory to "${b.meant.toLowerCase()}" or declare the shorter tag.`);try{a(` Compiling ${h.urlPattern} ...`);let v=await B2(h,p,e,Ye,Nt,tn,co,q,xe,ne,Je,bt,fe,{alternates:Xo.get(h.urlPattern)??[],i18n:O,translations:mp.get(h.urlPattern)??[]},T,j,B);xr.push(...v.serverEntries);for(let U of v.unregisteredRelations)if(!wc.has(U))wc.add(U),console.warn(`<link rel="${U}"> — "${U}" is not an IANA link relation, and a relation nobody recognizes does nothing. Check the spelling, or use an absolute `+"URI if it is an extension relation (RFC 8288 §2.1.2).");if($t.length>0)v.html=Y2(v.html,$t,tr,new Set($t.filter((U)=>!v.liveTags.has(U))),v.files.map((U)=>U.content).join(`
|
|
562
|
+
`),T,dp);for(let U of rP(v.html))I.add(U);Ff(v.html,Je,jt),z0(v.html,V);let _=gP(h.urlPattern,m,g);hr(gr(_),{recursive:!0});let M=!h.urlPattern.includes(":")&&!h.urlPattern.includes("*"),K=!Ll(h.urlPattern)&&!g0(v.html);if(bs&&!v.excludeFromSitemap&&K&&M){let U=Xo.get(h.urlPattern)??[];uo.push({lastmod:k(h.sourceMtime)&&h.sourceMtime!==""?h.sourceMtime:tV(q2(h.sourcePath).mtime),loc:Cs(zi(h.urlPattern,g),br),...U.length>0&&{alternates:U}})}let ae=[];for(let U of q.withCapability("serialize")){if(!U.exportTarget||Ll(h.urlPattern))continue;try{let oe=await U.call("serialize",v.doc,{buildScope:(ie)=>Do(ie,null),componentDefs:tn,evaluateTemplate:(ie,ge)=>{if(!le(ie))return;return Gt(ie,ge)??ie},mode:"export"});if(oe){let ie=_.replace(/\.html$/,U.extensions[0]);ae.push({content:oe,path:ie,type:U.mediaTypeEssence})}}catch(oe){i.push(`Error exporting ${U.name} for ${h.urlPattern}: ${be(oe)}`)}}for(let U of ae)if(U.type!==null)v.html=x0(v.html,{href:b0(m,U.path),type:U.type});on(_,ym(v.html,nr),"utf8"),Se+=1;for(let U of ae)on(U.path,U.content,"utf8"),Se+=1;for(let U of v.files){let oe=at(gr(_),U.path);hr(gr(oe),{recursive:!0}),on(oe,U.content,"utf8"),Se+=1}}catch(v){let _=`Error compiling ${h.urlPattern}: ${be(v)}`;i.push(_),console.error(_)}}if(d("routes"),Nt&&p.images.optimize){mj(e,Nt,{prune:i.length===0});let h=hj(Nt).filter((v)=>Ls(v));if(h.length>0){let v=at(m,"images/_optimized");hr(v,{recursive:!0});for(let _ of h)L2(_,at(v,tx(_)))}let b=Object.keys(Nt.entries).length;if(b>0)a(` Optimized ${b} image(s)`)}let f=[];if(!p.build.adapter&&xr.length>0){let b=`timing: "server" entries ${[...new Set(xr.map(({exportName:v,declaredIn:_})=>`${v} (${_})`))].join(", ")} need a server-capable adapter, but `+`build.adapter is "static": a static deployment has nothing to serve /_jx/server — ${lP}`;i.push(b),console.error(b)}if(p.build.adapter){let{adapter:h}=p.build;a("Generating site-wide server worker...");let{entries:b,errors:v}=SE(xr);f=b;for(let U of v)i.push(U),console.error(U);let{mounts:_,connectors:M}=U2(We,xe,p);if(_.length>0)a(` Mounting ${_.length} extension route(s): ${_.map((U)=>U.basePath).join(", ")}`);let ae=h==="cloudflare-pages"&&f.length===0&&_.length===0?null:Ty(f,{adapter:h,base:nr,connectors:M,i18n:O,mounts:_});if(ae){let U=h==="cloudflare-pages"?"_worker.js":"worker.js";try{await Ow(ae,{adapter:h,outfile:at(m,U),plugins:[z.serverPlugin],projectRoot:e}),Se+=1,a(` Generated dist/${U} (bundled, ${f.length} server function(s))`)}catch(oe){let ie=`Error bundling dist/${U}: ${be(oe)}`;i.push(ie),console.error(ie)}if(h==="cloudflare-pages")on(at(m,"_routes.json"),`${JSON.stringify({exclude:[],include:(O&&O.locales.length>1?["/","/_jx/*"]:["/_jx/*"]).map((oe)=>Fe(nr,oe)),version:1},null,2)}
|
|
563
|
+
`,"utf8"),Se+=1}}if(I.size>0){a(`Bundling ${I.size} client runtime module(s)...`);let h=await nP({...A,assetPaths:[...I]},m,void 0,x);Se+=h.written;for(let b of h.errors)i.push(b),console.error(b)}if(w.size>0){a(`Copying ${w.size} package asset(s)...`);for(let[h,b]of w){let v=at(m,h.replace(/^\//,""));hr(gr(v),{recursive:!0}),ex(b,v),Se+=1,a(` ${b} → ${h}`)}}if(P.size>0){a(`Bundling ${P.size} client sidecar module(s)...`);for(let[h,b]of P)try{let v=at(m,h.replace(/^\//,""));hr(gr(v),{recursive:!0});let _={entryPath:b.entryPath,outfile:v};if(b.script){let M=await z.module(b.specifier);_.entryPath=M.path,_.contents=M.contents}await Pw(_,{external:jm,minify:x,plugins:[z.clientPlugin],target:"browser"}),Se+=1,a(` ${b.specifier} → ${h}`)}catch(v){let _=`Error bundling sidecar "${b.specifier}": ${be(v)}`;i.push(_),console.error(_)}}if(X.size>0){a(`Bundling ${X.size} external class module(s)...`);let h=F2(Tr(W2(),"jx-class-entries-"));try{let b=[...X].map(([_,M])=>{let K=Tr(h,tx(_));return on(K,M,"utf8"),K}),v=await _w(b,at(m,"assets"),{external:jm,minify:x,target:"browser"});Se+=v.length;for(let _ of X.keys())a(` ${_}`)}catch(b){let v=`Error bundling external classes: ${be(b)}`;i.push(v),console.error(v)}finally{iP(h,{force:!0,recursive:!0})}}if(E.size>0){a(`Bundling ${E.size} npm element set(s)...`);for(let[h,b]of E){let v=at(m,h.replace(/^\//,""));hr(gr(v),{recursive:!0});try{await No(`${b.map((_)=>`import ${JSON.stringify(_)};`).join(`
|
|
543
564
|
`)}
|
|
544
|
-
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
`,{outfile:v,resolveDir:t},{minify:n,resolver:yD(b,v,await l(b),o),target:"browser"}),c+=1,p+=1}catch(P){r.push(`Bundling runtime subpath "${g}": ${$e(P)}`)}}}if(p===0)return Fm(e,o,r,c)}return r.push(`Runtime subpath resolution did not settle in ${rv} passes — a package subpath `+"graph this deep is more likely a cycle in the scan than a real dependency chain."),Fm(e,o,r,c)}function yD(e,t,n,r){return{filter:/.*/,resolve:({importer:s,path:o})=>{if(ip(s))return;if(Ju.find((a)=>o===a.specifier||o.startsWith(`${a.specifier}/`))!==void 0)return{external:!0,path:o};if(n===void 0||!o.startsWith("."))return;if(pc(dc(s),o)!==n)return;return r.set(pc(dc(t),o),e.specifier),{external:!0,path:o}}}}function Fm(e,t,n,r){let s=r;for(let[o,i]of t){if(lD(o))continue;try{Lm(dc(o),{recursive:!0}),dD(o,`export * from ${JSON.stringify(i)};
|
|
548
|
-
`,"utf8"),s+=1}catch(a){n.push(`Writing shared core stub ${mD(e,o)}: ${$e(a)}`)}}return{errors:n,written:s}}var Ju,Vm,rv=10;var lv=T(()=>{ap();hr();le();Dt();Ju=[{assetDir:"/assets/@vue/reactivity/",assetPath:"/assets/vue-reactivity.js",fallback:$s,specifier:"@vue/reactivity"},{assetDir:"/assets/lit-html/",assetPath:"/assets/lit-html.js",fallback:ws,specifier:"lit-html"}];Vm=import.meta.dirname});import{cpSync as Iu,existsSync as js,mkdirSync as er,readFileSync as xD,rmSync as bD,statSync as $D,writeFileSync as In}from"node:fs";import{createHash as wD}from"node:crypto";import{basename as SD,dirname as yr,join as Ps,relative as uv,resolve as $t,sep as vD}from"node:path";async function mv(e,t={}){let{clean:n=!0,includeHeld:r=!1,verbose:s=!1}=t,o=[],i=s?console.log.bind(console):()=>{},a={bundles:0,components:0,content:0,outputs:0,routes:0,setup:0,total:0},c=performance.now(),l=c,u=(A)=>{let H=performance.now();a[A]=H-l,l=H};i("Loading project.json...");let{config:d}=ms(e);if("contentTypes"in d)throw Error('project.json declares "contentTypes", which is no longer supported. Run `bun scripts/migrate-project-extensions.ts <project>` to migrate to "extensions" + "content", then `jx schema`.');let p=$t(e,d.build.outDir),m=$t(e,"pages"),x=$t(e,"public"),h=d.build.trailingSlash??"always",g=d.build.minify!==!1,b=new Map,j=new Map,v=new Map,P=(A)=>{let H=A.toSorted(),f=`/assets/elements-${wD("sha1").update(H.join("\x00")).digest("hex").slice(0,12)}.js`;return v.set(f,H),f},S=sv(),_=S.imports,N=new Set,F=G$(),{errors:K,i18n:J}=mp(d);for(let A of K)o.push(A),console.error(A);for(let A of S.warnings)console.warn(A);let C=new Map,L=(A,H,U)=>{let f=C.get(A);if(f!==void 0&&f.entryPath!==H)throw Error(`"${U}" and "${f.specifier}" both map to ${A} — rename one`);C.set(A,{entryPath:H,specifier:U})},G=new Set,te=(A)=>{if(!G.has(A))G.add(A),o.push(A),console.error(A)},de=(A)=>{let H=wi(A);if(H===null)return te(`$src "${A}" is not a document script specifier`),A;if(H.side==="server")return te(`${H.path}: a client function names "#server". A server module is called by a timing: "server" entry and never imported by a page`),A;try{let U=Gd(`./${H.path}`);return L(U,A,A),b.set(U,{entryPath:A,script:!0,specifier:A}),U}catch(U){return te(`Script of ${H.path}: ${$e(U)}`),A}},ae=(A,H)=>{if(Yl(A))return de(A);if($i(A)!==null)return te(`$src "${A}" names its own document's script, but it is not in a document: project.json has no $script. Move the entry into the page, layout or component that carries the script`),A;if(!mb(A))return A;try{let U=op(A,H??e,e);if(!mo(A)&&!js(U))return console.warn(`Sidecar "${A}" not found at ${U} — emitting unbundled`),A;let f=mo(A)?A:`./${uv(e,U)}`,y=Gd(f);return L(y,U,A),b.set(y,{entryPath:U,specifier:A}),y}catch(U){return o.push(`Sidecar "${A}": ${$e(U)}`),A}},ne=(A)=>{let H=Nx(A);try{let U=op(`npm:${A}`,e,e);return L(H,U,A),j.set(H,U),H}catch(U){return o.push(`$head specifier "${A}": ${$e(U)}`),A}},se=await ps(e,d),xe=se.formats,z=mw(e,(A)=>Qr(A,xe));if(xe.entries.length>0)i(` Registered ${xe.entries.length} format(s): ${xe.entries.map((A)=>A.name).join(", ")}`);let ye=se.serverMounts().filter((A)=>{if(!A.project)return!0;let H=d[A.project.key];return D(H)&&Object.keys(H).length>0});if(ye.length>0&&!d.build.adapter){let A=ye.map((H)=>H.project?`"${H.project.key}"`:`"${H.server.basePath}"`).join(", ");throw Error(`project.json declares dynamic section(s) ${A} served by extension mounts, but `+`build.adapter is "static". Dynamic tables need a server-capable adapter — ${fv}`)}if(u("setup"),n&&js(p))bD(p,{force:!0,recursive:!0});if(er(p,{recursive:!0}),!js(m))throw Error(`pages/ directory not found in ${e}`);i("Discovering pages...");let pe=await H$(m,xe);i(` Found ${pe.length} page(s)`),i("Loading project sections...");let ee=await aw(e,d,se,{includeHeld:r}),Qe=Object.keys(ee);if(Qe.length>0)i(` Loaded ${Qe.length} section(s): ${Qe.join(", ")}`);let{errors:Me,mounts:Ge}=await lw(se,d,e);o.push(...Me);for(let A of Me)console.error(A);if(Ge.length>0)i(` Mounted ${Ge.length} asset dir(s): ${Ge.map((A)=>A.urlPrefix).join(", ")}`);let X=new Set,Bt=await PD(se,d,e),ce=(await z$(pe,e,ee,se,d,J,{errors:o})).map((A)=>Object.assign(A,{locale:Xn(A.urlPattern,J)}));i(` ${ce.length} route(s) after expansion`);let be=0;u("content");let Fe=[],Le=new Map,ot=new Map,Nr=new Map,{components:nr,errors:Xs}=await ww({formatRegistry:xe,pageSources:ce.map((A)=>A.sourcePath),projectConfig:d,projectRoot:e});for(let A of Xs)o.push(A),console.error(A);if(nr.length>0){i("Compiling components...");let A=$t(p,"components");er(A,{recursive:!0});let H=new Map(nr.map((y)=>[y.path,y.tagName])),U=ho(d.url),f=Ou(U);for(let{doc:y,path:w}of nr){let E=ou(y,d.state);try{let O={formats:xe,resolveElementPath:(q,Z)=>{let oe=Z?$t(Z,q):$t(q),fe=H.get(oe);return fe?`./${fe}.js`:q.replace(/\.(?:json|jxn)$/i,".js")},projectRoot:e,projectState:d.state,rewriteSrc:(q,Z)=>We(U,ae(q,Z)),serverBaseUrl:f};if(d.$media)O.$media=d.$media;let I=await _u(w,O);for(let q of I.files){let Z=q.tagName?`${q.tagName}.js`:SD(q.path);if(!Fe.includes(q.tagName))In($t(A,Z),q.content,"utf8"),Fe.push(q.tagName),be+=1}if(E.tagName){ot.set(E.tagName,E),Nr.set(E.tagName,w);let q=ko(E,d.defaults),Z=O$(E.tagName,E.style,E,d.$media??{},q);if(Z){if(q===null)Le.set(E.tagName,Z);fm(Z,Ge,X),In($t(A,`${E.tagName}.css`),Z,"utf8"),be+=1}}}catch(O){let I=$e(O),q=uv(e,w).replaceAll("\\","/");o.push(`Error compiling component ${q}: ${I}`),console.error(`Error compiling component ${q}: ${I}`)}}i(` Compiled ${Fe.length} component(s): ${Fe.join(", ")}`)}let pt=[];for(let[A,H]of ot)pt.push(...oc(H,Nr.get(A),e));if(d.state){let A=oc({state:d.state},Rn(e),e);for(let H of A)if($i(H.src)===null)pt.push(H);else te(`Server function "${H.exportName}" in ${H.declaredIn} names "${H.src}", its own document's script, but project.json has no $script. Move the entry into the page, layout or component that carries the script`)}u("components");let Pn=d.images.optimize&&d.images.service==="cloudflare",It=d.images.optimize&&!Pn?gS(e):null,Fo=Pn?new Map:null;if(It&&d.images.formats?.includes("webp"))console.warn('images.formats lists "webp", which this compiler writes losslessly: its files are several times the size of AVIF or JPEG. Keep it only for pixel-exact output; ["avif", "jpeg"] is the default.');if(Pn)console.log('images.service is "cloudflare" — srcsets use /cdn-cgi/image transform URLs. '+"Ensure Image Transformations are enabled for your zone (Cloudflare dashboard → "+"Images → Transformations); these URLs do not work on *.pages.dev / *.workers.dev previews.");let ns=d.url,rr=ho(ns),ya=Boolean(ns)&&d.build.sitemap!==!1,Ys=[],Lo=ce.filter((A)=>!A.urlPattern.includes(":")&&!A.urlPattern.includes("*")),Vo=J===null?new Map:await W$(Lo,xe),Zs=Lo.map((A)=>({translationKey:Vo.get(A.urlPattern),urlPattern:A.urlPattern})),qo=I$(Zs,J,ns,h),{conflicts:Yf,sets:Zf}=tm(Zs,J);for(let A of Yf){let[H,U]=A.urlPatterns,f=A.declared?"Give one of them a different $translationKey.":"Move one out of the locale tree, or give it its own $translationKey.",y=`${U} and ${H} are both the "${A.locale}" version of "${A.key}". A translation set names one URL per language, so ${U} is `+`dropped from it — it carries no alternates and no switcher. ${f}`;if(A.declared)o.push(y),console.error(y);else console.warn(y)}let Ot=T$(ce,J);if(Ot.length>0)console.warn(`i18n.routing is "prefix-always", but ${Ot.length} route(s) sit outside the locale tree and are served as "${J?.defaultLocale}": ${Ot.slice(0,10).join(", ")}${Ot.length>10?`, and ${Ot.length-10} more`:""}. Move them under a locale directory, or use "prefix-except-default".`);if(J!==null&&J.routing==="prefix-always"&&!d.build.adapter&&!ce.some((A)=>A.urlPattern==="/"))console.warn('i18n.routing is "prefix-always" and no page claims "/", so the site root is a 404. '+'Locale negotiation answers "/" only when build.adapter is set — a static deployment has '+`no runtime to read Accept-Language. Add a redirect from "/" to "/${J.defaultLocale.toLowerCase()}/", set build.adapter, or use "prefix-except-default".`);let Wo=new Set,xa=new Set;for(let A of ce){let H=J$(A.urlPattern,J);if(H&&!Wo.has(H.segment))Wo.add(H.segment),console.warn(`Routes under /${H.segment}/ are served as "${J?.defaultLocale}" — `+`i18n.locales declares "${H.meant}", not "${H.segment}". Rename the directory to "${H.meant.toLowerCase()}" or declare the shorter tag.`);try{i(` Compiling ${A.urlPattern} ...`);let U=await ED(A,d,e,ee,It,ot,Fo,xe,se,ae,Ge,Bt,ne,{alternates:qo.get(A.urlPattern)??[],i18n:J,translations:Zf.get(A.urlPattern)??[]},_,P);pt.push(...U.serverEntries);for(let I of U.unregisteredRelations)if(!xa.has(I))xa.add(I),console.warn(`<link rel="${I}"> — "${I}" is not an IANA link relation, and a relation nobody recognizes does nothing. Check the spelling, or use an absolute `+"URI if it is an extension relation (RFC 8288 §2.1.2).");let f=new Set;for(let[I,q]of ot)if(hu(q))f.add(I);if(Fe.length>0)U.html=AD(U.html,Fe,Le,f,U.files.map((I)=>I.content).join(`
|
|
549
|
-
`),_);for(let I of iv(U.html))N.add(I);fm(U.html,Ge,X),X$(U.html,F);let y=xv(A.urlPattern,p,h);er(yr(y),{recursive:!0});let w=!A.urlPattern.includes(":")&&!A.urlPattern.includes("*"),E=!sc(A.urlPattern)&&!A$(U.html);if(ya&&!U.excludeFromSitemap&&E&&w){let I=qo.get(A.urlPattern)??[];Ys.push({lastmod:k(A.sourceMtime)&&A.sourceMtime!==""?A.sourceMtime:TD($D(A.sourcePath).mtime),loc:hs(Ni(A.urlPattern,h),ns),...I.length>0&&{alternates:I}})}let O=[];for(let I of xe.withCapability("serialize")){if(!I.exportTarget||sc(A.urlPattern))continue;try{let q=await I.call("serialize",U.doc,{buildScope:(Z)=>ji(Z,null),componentDefs:ot,evaluateTemplate:(Z,oe)=>{if(!me(Z))return;return Vt(Z,oe)??Z},mode:"export"});if(q){let Z=y.replace(/\.html$/,I.extensions[0]);O.push({content:q,path:Z,type:I.mediaTypeEssence})}}catch(q){o.push(`Error exporting ${I.name} for ${A.urlPattern}: ${$e(q)}`)}}for(let I of O)if(I.type!==null)U.html=C$(U.html,{href:N$(p,I.path),type:I.type});In(y,Mx(U.html,rr),"utf8"),be+=1;for(let I of O)In(I.path,I.content,"utf8"),be+=1;for(let I of U.files){let q=$t(yr(y),I.path);er(yr(q),{recursive:!0}),In(q,I.content,"utf8"),be+=1}}catch(U){let f=`Error compiling ${A.urlPattern}: ${$e(U)}`;o.push(f),console.error(f)}}if(u("routes"),It&&d.images.optimize){yS(e,It,{prune:o.length===0});let A=$t(Mi(e),"_optimized");if(js(A)){let U=$t(p,"images/_optimized");er(U,{recursive:!0}),Iu(A,U,{recursive:!0})}let H=Object.keys(It.entries).length;if(H>0)i(` Optimized ${H} image(s)`)}let Qs=[];if(!d.build.adapter&&pt.length>0){let H=`timing: "server" entries ${[...new Set(pt.map(({exportName:U,declaredIn:f})=>`${U} (${f})`))].join(", ")} need a server-capable adapter, but `+`build.adapter is "static": a static deployment has nothing to serve /_jx/server — ${fv}`;o.push(H),console.error(H)}if(d.build.adapter){let{adapter:A}=d.build;i("Generating site-wide server worker...");let{entries:H,errors:U}=Ew(pt);Qs=H;for(let O of U)o.push(O),console.error(O);let{mounts:f,connectors:y}=jD(ye,se,d);if(f.length>0)i(` Mounting ${f.length} extension route(s): ${f.map((O)=>O.basePath).join(", ")}`);let E=A==="cloudflare-pages"&&Qs.length===0&&f.length===0?null:Pm(Qs,{adapter:A,base:rr,connectors:y,i18n:J,mounts:f});if(E){let O=A==="cloudflare-pages"?"_worker.js":"worker.js";try{await bb(E,{adapter:A,outfile:$t(p,O),plugins:[z.serverPlugin],projectRoot:e}),be+=1,i(` Generated dist/${O} (bundled, ${Qs.length} server function(s))`)}catch(I){let q=`Error bundling dist/${O}: ${$e(I)}`;o.push(q),console.error(q)}if(A==="cloudflare-pages")In($t(p,"_routes.json"),`${JSON.stringify({exclude:[],include:(J&&J.locales.length>1?["/","/_jx/*"]:["/_jx/*"]).map((I)=>We(rr,I)),version:1},null,2)}
|
|
550
|
-
`,"utf8"),be+=1}}if(N.size>0){i(`Bundling ${N.size} client runtime module(s)...`);let A=await ov({...S,assetPaths:[...N]},p,void 0,g);be+=A.written;for(let H of A.errors)o.push(H),console.error(H)}if(j.size>0){i(`Copying ${j.size} package asset(s)...`);for(let[A,H]of j){let U=$t(p,A.replace(/^\//,""));er(yr(U),{recursive:!0}),Iu(H,U),be+=1,i(` ${H} → ${A}`)}}if(b.size>0){i(`Bundling ${b.size} client sidecar module(s)...`);for(let[A,H]of b)try{let U=$t(p,A.replace(/^\//,""));er(yr(U),{recursive:!0});let f={entryPath:H.entryPath,outfile:U};if(H.script){let y=await z.module(H.specifier);f.entryPath=y.path,f.contents=y.contents}await yb(f,{external:pb,minify:g,plugins:[z.clientPlugin],target:"browser"}),be+=1,i(` ${H.specifier} → ${A}`)}catch(U){let f=`Error bundling sidecar "${H.specifier}": ${$e(U)}`;o.push(f),console.error(f)}}if(v.size>0){i(`Bundling ${v.size} npm element set(s)...`);for(let[A,H]of v){let U=$t(p,A.replace(/^\//,""));er(yr(U),{recursive:!0});try{await So(`${H.map((f)=>`import ${JSON.stringify(f)};`).join(`
|
|
551
|
-
`)}
|
|
552
|
-
`,{outfile:U,resolveDir:e},{minify:g,target:"browser"}),be+=1,i(` ${H.length} element(s) → ${A}`)}catch(f){let y=`Error bundling npm $elements [${H.join(", ")}]: ${$e(f)}`;o.push(y),console.error(y)}}}if(N.size>0){let A=await cv(p,void 0,g);if(A.written>0)i(`Bundling ${A.written} runtime subpath module(s)...`);be+=A.written;for(let H of A.errors)o.push(H),console.error(H)}for(let A of se.emitters()){let H=A.project?.key,U=H?d[H]:void 0;if(H&&(U==null||D(U)&&Object.keys(U).length===0))continue;try{let f=await A.call("emit",U??null,{projectConfig:d,root:e,routes:ce,sections:ee});for(let y of f??[]){let w=$t(p,y.path.replace(/^\//,""));if(!w.startsWith(p+vD))throw Error(`emit path escapes outDir: ${y.path}`);er(yr(w),{recursive:!0}),In(w,y.content),be+=1,i(` ${A.name} emitted ${y.path}`)}}catch(f){let y=`Error in ${A.name}.emit: ${$e(f)}`;o.push(y),console.error(y)}}if(u("bundles"),d.redirects&&Object.keys(d.redirects).length>0){i("Generating redirects...");let A=new Set(ce.map((U)=>U.urlPattern)),H=ND(d.redirects,p,{basePath:rr,compiledUrls:A,trailingSlash:d.build.trailingSlash});be+=H.files,o.push(...H.errors)}if(ya)i(`Generating sitemap (${Ys.length} URL(s))...`),be+=ID(Ys,p);else if(!ns&&d.build.sitemap!==!1)console.warn("sitemap.xml skipped — set `url` in project.json to enable sitemap generation.");if(X.size>0){let{copied:A,missing:H}=uw(X,Ge,p);be+=A,i(`Copying ${A} mounted asset(s)...`);for(let U of H)console.warn(`Referenced asset not found: ${U}`)}if(js(x))i("Copying public/ assets..."),Iu(x,p,{recursive:!0});if(ya)be+=MD(p,ns);{let A=[ZS(d),ev(d,new Date)];for(let f of A){for(let y of f.errors)o.push(y),console.error(y);for(let y of f.warnings)console.warn(y)}let{skipped:H,written:U}=tv(A.flatMap((f)=>f.files),p,js);be+=U;for(let f of H)i(` ${f} — kept the copy from public/`)}{let A=Dm(d.serviceWorker);if(A!==null){let H=A===!1?GS():KS(A,p,rr);for(let U of H.warnings)console.warn(U);for(let U of H.errors)o.push(U),console.error(U);if(H.path!==null)In(Ps(p,H.path),H.source,"utf8"),be+=1,i(A===!1?" sw.js — tombstone (unregisters and clears)":" sw.js")}}{let{errors:A,rules:H}=tw(d.build,F);o.push(...A);let U=rw([...H,...nw(p)],rr);if(U.length>0){i("Writing response headers..."),be+=sw(p,U);let{adapter:f,deploy:y}=d.build;if(f==="node"||f==="bun")console.warn(`The "${f}" adapter serves no static assets, so dist/_headers is documentation `+"rather than configuration — apply these headers at the reverse proxy in front of it.");else if(f===void 0&&y===void 0)if(js($t(x,"CNAME")))console.warn("GitHub Pages ignores dist/_headers and serves its own Cache-Control: max-age=600, so the generated caching and security rules will not take effect. Deploy behind a host that reads _headers (Cloudflare Pages, Cloudflare Workers assets, Netlify) to apply them.");else i(" note: _headers is read by Cloudflare Pages, Cloudflare Workers assets and Netlify; other static hosts ignore it and serve their own Cache-Control.")}be+=ow(p)}if(d.copy){i("Copying mapped files...");for(let[A,H]of Object.entries(d.copy)){if(!k(H))throw TypeError(`project.json copy["${A}"] must be a destination path string`);let U=$t(e,A),f=$t(p,H);er(yr(f),{recursive:!0}),Iu(U,f)}}if(i(`
|
|
553
|
-
Build complete: ${ce.length} routes, ${be} files`),o.length>0)i(` ${o.length} error(s)`);return u("outputs"),a.total=performance.now()-c,{errors:o,files:be,routes:ce.length,serverEntries:Qs,timings:a}}async function ED(e,t,n,r,s,o,i,a,c,l,u,d,p,m,x,h){let g=ho(t.url),b=Ti(await Qr(e.sourcePath,a),e.sourcePath,n),j=await bw(b,t,n),v=Eu(b,t,n),P=[...oc(b,e.sourcePath,n),...v.flatMap((ce)=>oc(ce.doc,ce.path,n))],S=Pw(b.$head??j._pageHead??[],b.description),_=j.$head??[],N=b.title??j._pageTitle??null;delete j._pageHead,delete j._pageTitle;let F=new Set(Object.keys(j.state??{}));L$(j,t,e,n,m.i18n,m.translations);let K=Object.keys(t.state??{}).filter((ce)=>ce!=="$site"&&ce!=="$page"&&!F.has(ce)),J=M$({defaults:t.defaults,pageDir:k(b.$dir)?b.$dir:void 0,pageLang:k(b.$lang)?b.$lang:void 0,routeLocale:Xn(e.urlPattern,m.i18n)}),C={...j.state};if(e.pagedState&&j.state&&e.pagedState.key in j.state)j.state[e.pagedState.key]=e.pagedState.items;await xu(j,e,n,{config:t,registerBundle:(ce)=>{l(ce,null)},registry:c,sections:r});let L=kD(C,j.state??{},e.pagedState?.key),G=ji(j.state??{}),te=N??t.name;if(me(te))te=Vt(te,G)??te;let de=Wm(dv(S,G),p),ae=Wm(dv(_,G),p);mc(j,G,L);let ne={counter:{n:0},media:{...t.$media,...j.$media},rules:[]},se={n:0};if(Km(j,o,ne,t.defaults,se),j.state){let ce=new Set,be=new Set(K);for(let[Le,ot]of Object.entries(j.state)){if(Le==="$site"||Le==="$page")continue;if(V(ot)&&ot.timing==="compiler")delete j.state[Le];else if(Array.isArray(ot))ce.add(Le);else if(Po(ot))ce.add(Le),be.add(Le)}for(let Le of K)if(Le in j.state)ce.add(Le);let Fe=!0;while(Fe){Fe=!1;let Le={...j.state};delete Le.$site,delete Le.$page;for(let It of ce)delete Le[It];let{$head:ot,$paths:Nr,title:nr,...Xs}=j,pt={...Xs,state:Le};if(v$(pt).length>0){for(let It of be)if(ce.delete(It))Fe=!0}let Pn=JSON.stringify(pt);for(let It of ce)if(su(Pn,It))ce.delete(It),Fe=!0}for(let Le of ce)delete j.state[Le]}let xe=Dm(t.serviceWorker),z=xe===null||xe===!1?[]:[{tagName:"script",textContent:XS(xe.scope??"/",g)}],ye=[...QS(t),...z,...d,...Wm(t.$head??[],p)],pe=_w(ye,ae,de,{title:te,charset:t.defaults.charset??"utf8",siteName:t.name,siteUrl:t.url,...m.alternates.length>0&&{alternates:m.alternates},...!sc(e.urlPattern)&&{pageUrl:Ni(e.urlPattern,t.build.trailingSlash)}});if(t.$media)j.$media={...t.$media,...j.$media};if(Object.values(j.$media??{}).some((ce)=>Zn(String(ce))!==null))pe.splice(2,0,{tagName:"script",textContent:Oi()});let ee=t.images;await qS(j,ee,n,s,i??void 0,u);let Qe={lang:J.lang,prePaintScheme:!1,projectStyle:t.style??null,rewriteSrc:(ce)=>We(g,l(ce,yr(e.sourcePath))),serverBaseUrl:Ou(g),title:te},Me=x["@vue/reactivity"];if(Me!==void 0)Qe.reactivitySrc=Me;let Ge=x["lit-html"];if(Ge!==void 0)Qe.litHtmlSrc=Ge;let X=await km(j,Qe);if(ne.rules.length>0)X.html=X.html.replace("</head>",`<style>
|
|
554
|
-
${du(ne.rules.join(`
|
|
565
|
+
`,{outfile:v,resolveDir:e},{minify:x,target:"browser"}),Se+=1,a(` ${b.length} element(s) → ${h}`)}catch(_){let M=`Error bundling npm $elements [${b.join(", ")}]: ${be(_)}`;i.push(M),console.error(M)}}}if(I.size>0){let h=await sP(m,void 0,x);if(h.written>0)a(`Bundling ${h.written} runtime subpath module(s)...`);Se+=h.written;for(let b of h.errors)i.push(b),console.error(b)}for(let h of xe.emitters()){let b=h.project?.key,v=b?p[b]:void 0;if(b&&(v==null||D(v)&&Object.keys(v).length===0))continue;try{let _=await h.call("emit",v??null,{projectConfig:p,root:e,routes:ct,sections:Ye});for(let M of _??[]){let K=at(m,M.path.replace(/^\//,""));if(!K.startsWith(m+aP))throw Error(`emit path escapes outDir: ${M.path}`);hr(gr(K),{recursive:!0}),on(K,M.content),Se+=1,a(` ${h.name} emitted ${M.path}`)}}catch(_){let M=`Error in ${h.name}.emit: ${be(_)}`;i.push(M),console.error(M)}}if(d("bundles"),p.redirects&&Object.keys(p.redirects).length>0){a("Generating redirects...");let h=new Set(ct.map((v)=>v.urlPattern)),b=eV(p.redirects,m,{basePath:nr,compiledUrls:h,trailingSlash:p.build.trailingSlash});Se+=b.files,i.push(...b.errors)}if(bs)a(`Generating sitemap (${uo.length} URL(s))...`),Se+=rV(uo,m);else if(!br&&p.build.sitemap!==!1)console.warn("sitemap.xml skipped — set `url` in project.json to enable sitemap generation.");if(jt.size>0){let{copied:h,missing:b}=aE(jt,Je,m);Se+=h,a(`Copying ${h} mounted asset(s)...`);for(let v of b)console.warn(`Referenced asset not found: ${v}`)}if(Ls(S))a("Copying public/ assets..."),ex(S,m,{recursive:!0});if(bs)Se+=sV(m,br);{let h=[Gj(p),Yj(p,new Date)];for(let _ of h){for(let M of _.errors)i.push(M),console.error(M);for(let M of _.warnings)console.warn(M)}let{skipped:b,written:v}=Zj(h.flatMap((_)=>_.files),m,Ls);Se+=v;for(let _ of b)a(` ${_} — kept the copy from public/`)}{let h=Gy(p.serviceWorker);if(h!==null){let b=h===!1?Uj():Bj(h,m,nr);for(let v of b.warnings)console.warn(v);for(let v of b.errors)i.push(v),console.error(v);if(b.path!==null)on(Tr(m,b.path),b.source,"utf8"),Se+=1,a(h===!1?" sw.js — tombstone (unregisters and clears)":" sw.js")}}{let{errors:h,rules:b}=Z0(p.build,V);i.push(...h);let v=eE([...b,...Q0(m)],nr);if(v.length>0){a("Writing response headers..."),Se+=tE(m,v);let{adapter:_,deploy:M}=p.build;if(_==="node"||_==="bun")console.warn(`The "${_}" adapter serves no static assets, so dist/_headers is documentation `+"rather than configuration — apply these headers at the reverse proxy in front of it.");else if(_===void 0&&M===void 0)if(Ls(at(S,"CNAME")))console.warn("GitHub Pages ignores dist/_headers and serves its own Cache-Control: max-age=600, so the generated caching and security rules will not take effect. Deploy behind a host that reads _headers (Cloudflare Pages, Cloudflare Workers assets, Netlify) to apply them.");else a(" note: _headers is read by Cloudflare Pages, Cloudflare Workers assets and Netlify; other static hosts ignore it and serve their own Cache-Control.")}Se+=nE(m)}if(p.copy){a("Copying mapped files...");for(let[h,b]of Object.entries(p.copy)){if(!k(b))throw TypeError(`project.json copy["${h}"] must be a destination path string`);let v=at(e,h),_=at(m,b);hr(gr(_),{recursive:!0}),ex(v,_)}}if(a(`
|
|
566
|
+
Build complete: ${ct.length} routes, ${Se} files`),i.length>0)a(` ${i.length} error(s)`);return d("outputs"),l.total=performance.now()-c,{errors:i,files:Se,routes:ct.length,serverEntries:f,timings:l}}async function B2(e,t,n,r,s,o,i,a,l,c,u,d,p,m,y,S,g){let x=Po(t.url),P=Ki(await hs(e.sourcePath,a),e.sourcePath,n),w=await gE(P,t,n),E=Hf(P,t,n),j=[...ql(P,e.sourcePath,n),...E.flatMap((pe)=>ql(pe.doc,pe.path,n))],A=vE(P.$head??w._pageHead??[],P.description),T=w.$head??[],I=P.title??w._pageTitle??null;delete w._pageHead,delete w._pageTitle;let V=new Set(Object.keys(w.state??{}));P0(w,t,e,n,m.i18n,m.translations);let H=Object.keys(t.state??{}).filter((pe)=>pe!=="$site"&&pe!=="$page"&&!V.has(pe)),O=v0({defaults:t.defaults,pageDir:k(P.$dir)?P.$dir:void 0,pageLang:k(P.$lang)?P.$lang:void 0,routeLocale:cr(e.urlPattern,m.i18n)}),N={...w.state};if(e.pagedState&&w.state&&e.pagedState.key in w.state)w.state[e.pagedState.key]=e.pagedState.items;await Vl(w,e,n,{config:t,registerBundle:(pe)=>{c(pe,null)},registry:l,sections:r});let G=G2(N,w.state??{},e.pagedState?.key),Q=Do(w.state??{},null,{document:w,holdMutable:!0}),re=I??t.name;if(le(re))re=Gt(re,Q)??re;let ue=rx(cP(A,Q),p),ne=rx(cP(T,Q),p);Zl(w,Q,G);let fe={counter:{n:0},media:{...t.$media,...w.$media},rules:[]},xe={n:0},X,B=()=>X??=Do(w.state??{}),q=p0(o,w);if(lx(w,o,{defaults:t.defaults,liveTags:q,slotCss:fe,slotIds:xe,slotScope:B}),w.state){let pe=new Set,ct=new Set(H);for(let[Ze,Nt]of Object.entries(w.state)){if(Ze==="$site"||Ze==="$page")continue;if(L(Nt)&&Nt.timing==="compiler")delete w.state[Ze];else if(Array.isArray(Nt))pe.add(Ze);else if(Mo(Nt))pe.add(Ze),ct.add(Ze)}for(let Ze of H)if(Ze in w.state)pe.add(Ze);let Se=!0;while(Se){Se=!1;let Ze={...w.state};delete Ze.$site,delete Ze.$page;for(let Mn of pe)delete Ze[Mn];let{$head:Nt,$paths:co,title:$t,...tr}=w,tn={...tr,state:Ze};if(i0(tn).length>0){for(let Mn of ct)if(pe.delete(Mn))Se=!0}let Xr=JSON.stringify(tn);for(let Mn of pe)if(ff(Xr,Mn))pe.delete(Mn),Se=!0}for(let Ze of pe)delete w.state[Ze]}let z=Gy(t.serviceWorker),We=z===null||z===!1?[]:[{tagName:"script",textContent:zj(z.scope??"/",x)}],qe=[...Xj(t),...We,...d,...rx(t.$head??[],p)],Ye=EE(qe,ne,ue,{title:re,charset:t.defaults.charset??"utf8",siteName:t.name,siteUrl:t.url,...m.alternates.length>0&&{alternates:m.alternates},...!Ll(e.urlPattern)&&{pageUrl:zi(e.urlPattern,t.build.trailingSlash)}});if(t.$media)w.$media={...t.$media,...w.$media};if(Object.values(w.$media??{}).some((pe)=>fr(String(pe))!==null))Ye.splice(2,0,{tagName:"script",textContent:Vi()});let te=t.images;await zy(w,te,n,s,i??void 0,u);let Ut={lang:O.lang,prePaintScheme:!1,projectStyle:t.style??null,resolveClass:(pe)=>Fe(x,g(pe,gr(e.sourcePath),w.imports??{})),rewriteSrc:(pe)=>Fe(x,c(pe,gr(e.sourcePath))),runtimeImports:y,serverBaseUrl:Gf(x),title:re},Je=await My(w,Ut);if(fe.rules.length>0){let pe=`<style>
|
|
567
|
+
${kf(fe.rules.join(`
|
|
555
568
|
`))}
|
|
556
569
|
</style>
|
|
557
|
-
</head
|
|
558
|
-
`):null,
|
|
559
|
-
`),u
|
|
560
|
-
${
|
|
561
|
-
</style>`,
|
|
562
|
-
`);return
|
|
563
|
-
</head>`)},
|
|
564
|
-
`),
|
|
565
|
-
`);return
|
|
566
|
-
</body>`)}function
|
|
567
|
-
</body>`)}function
|
|
568
|
-
${c.join(`
|
|
569
|
-
`)}`;let l=o[1].match(/<script[\s\S]*?<\/script>/gi);if(l)i+=`
|
|
570
|
+
</head>`;Je.html=Je.html.replace("</head>",gs(pe))}Je.html=Q2(Je.html,Ye,O);let jt=(pe)=>typeof pe==="string"&&!pe.startsWith("./")&&!pe.startsWith("../"),bt=[...new Set([...w.$elements??[],...E.flatMap((pe)=>pe.doc.$elements??[]),...P.$elements??[]].filter((pe)=>jt(pe)))];if(bt.length>0)Je.html=Z2(Je.html,S(bt));return{doc:w,excludeFromSitemap:P.$sitemap===!1,files:Je.files,html:Je.html,liveTags:q,unregisteredRelations:_E(Ye),serverEntries:j}}function U2(e,t,n){if(e.length===0)return{connectors:[],mounts:[]};let r=Po(n.url),s={};for(let l of t.projectContributions()){let{key:c}=l.project;if(c in n)s[c]=n[c]}let o=e.map((l)=>{let c=l.server,{module:u}=c;if(!k(u)||u==="")throw Error(`Extension class "${l.name}": server.module (a bare import specifier) is required to generate a deployable worker`);let d=Fe(r,c.basePath);return{basePath:d,className:l.classDef.title??l.name,module:u,options:{basePath:d,sections:s},order:c.order??100}}),i=new Set;for(let l of Object.values(s)){if(!L(l))continue;for(let c of Object.values(l)){let u=L(c)?c.provider:void 0;if(k(u))i.add(u)}}let a=[];for(let l of t.connectors()){let c=String(l.connector.provider);if(!i.has(c))continue;let{module:u}=l.connector;if(!k(u)||u==="")throw Error(`Connector class "${l.name}": connector.module (a bare import specifier) is required to generate a deployable worker`);a.push({className:l.classDef.title??l.name,module:u,provider:c})}return{connectors:a,mounts:o}}async function z2(e,t,n){let r=[];for(let s of e.headProviders()){let o=s.project?.key,i=o===void 0?null:t[o];if(o!==void 0&&(i===void 0||i===null))continue;try{let a=await s.call("head",i??null,{projectConfig:t,root:n});r.push(...a??[])}catch(a){console.warn(`${s.name} head capability failed: ${be(a)}`)}}return r}function ax(e,t){if(Array.isArray(e))return e.map((n)=>ax(n,t));if(L(e))return Object.fromEntries(Object.entries(e).map(([n,r])=>[n,ax(r,t)]));if(le(e))return Gt(e,t)??e;return e}function cP(e,t){return e.map((n)=>{if(!D(n))return n;let r={...n};if(r.attributes){r.attributes={...r.attributes};for(let[s,o]of Object.entries(r.attributes))if(le(o))r.attributes[s]=Gt(o,t)??o}if(le(r.textContent))r.textContent=Gt(r.textContent,t)??r.textContent;else if(D(r.textContent))r.textContent=ax(r.textContent,t);return r})}function rx(e,t){return e.map((n)=>{if(!D(n)||!n.attributes)return n;let r={...n,attributes:{...n.attributes}};for(let s of["href","src"]){let o=r.attributes[s];if(k(o)&&K2(o))r.attributes[s]=t(o)}return r})}function K2(e){return!e.startsWith("/")&&!e.startsWith("./")&&!e.startsWith("../")&&!e.startsWith("http")&&!e.startsWith("data:")}function dP(e){return yP(e).replaceAll("${","${")}function pP(e){return e.replaceAll("${","${")}function mP(e){return k(e)||Ie(e)||Ge(e)?String(e):null}function hP(e,t){if(!D(e))return e;let n={};for(let[r,s]of Object.entries(e))if(r==="children"&&Array.isArray(e.children))n.children=e.children.map((o)=>{if(k(o))return le(o)?mP(Yl(o,t))??o:o;return hP(o,t)});else if(r==="style"&&D(e.style)){let o={...e.style};for(let[i,a]of Object.entries(o))if(le(a))o[i]=Yl(a,t)??a;n.style=o}else if(r==="attributes"&&D(e.attributes)){let o={...e.attributes};for(let[i,a]of Object.entries(o))if(le(a)){let l=Yl(a,t);o[i]=k(l)&&l.includes("${")?pP(l):l??a}n.attributes=o}else if(r==="$props"&&D(e.$props)){let o={...e.$props};for(let[i,a]of Object.entries(o))if(le(a)){let l=Yl(a,t);o[i]=l!==null?l??null:a}n.$props=o}else if(le(s)){let o=Yl(s,t);if(r==="textContent"&&k(o)&&o.includes("${"))n.innerHTML=dP(o);else n[r]=o??s}else n[r]=s;return n}function Yl(e,t){try{let n=t.$map,r=D(n)&&"item"in n?n.item:void 0,s=D(n)&&"index"in n?n.index:void 0,o=Ji(e)?`return (${e.slice(2,-1)})`:`return \`${e}\``;return Function("state","$map","item","index",o)(t,n,r,s)}catch{return null}}function Zl(e,t,n){if(!D(e))return;if(le(e.innerHTML)){let o=Gt(e.innerHTML,t);if(o!=null)e.innerHTML=String(o).replaceAll("${","${")}let r=e.textContent;if(le(r)){let o=Gt(r,t);if(k(o)&&o.includes("${"))e.innerHTML=dP(o),delete e.textContent;else e.textContent=o??r}if(D(e.style)){for(let[o,i]of Object.entries(e.style))if(le(i))e.style[o]=Gt(i,t)??i}if(D(e.attributes)){for(let[o,i]of Object.entries(e.attributes))if(le(i)){let a=Gt(i,t);e.attributes[o]=k(a)&&a.includes("${")?pP(a):a??i}}if(D(e.$props)){let o=e.$props;for(let[i,a]of Object.entries(o))if(le(a))o[i]=Gt(a,t)??a}let s=e.children;if(Le(s)){let o=uP(s,t,n);if(o){e.children=o;return}}if(le(s)){let o=Gt(s,t);if(Array.isArray(o)){let i=o;e.children=i;for(let a of i)Zl(a,t,n)}}else if(Array.isArray(e.children)){let o=0;while(o<e.children.length){let i=e.children[o];if(le(i)){let a=Gt(i,t);if(Array.isArray(a)){let c=a;e.children.splice(o,1,...c);for(let u of c)Zl(u,t,n);o+=c.length;continue}let l=mP(a);if(l!==null){e.children[o]=l,o+=1;continue}}if(Le(i)){let a=uP(i,t,n);if(a){e.children.splice(o,1,...a),o+=a.length;continue}}Zl(i,t,n),o+=1}}}function G2(e,t,n){let r=new Set(["$site","$page"]);if(n!==void 0)r.add(n);for(let[s,o]of Object.entries(e))if(Pn(o)&&(o.timing===void 0||o.timing==="compiler")&&t[s]!==o)r.add(s);return r}function X2(e,t,n){if(!me(e))return!0;let r=e.$ref;if(r.startsWith("$map/"))return!0;let[s=""]=r.slice(8).split("/"),o=s.replaceAll("~1","/").replaceAll("~0","~");return r.startsWith("#/state/")&&n.has(o)&&!Vg(t,o)}function uP(e,t,n){qo(e);let{items:r,map:s}=e;if(!s||!Hg(e,t))return null;let o=sy(e,t);if(o===null)return null;if(o.length===0&&!X2(r,t,n))return null;return o.map((i,a)=>{let l=Object.create(t);l.$map={index:a,item:i},l["$map/item"]=i,l["$map/index"]=a;let c=hP(s,l);return Zl(c,l,n),c})}function lx(e,t,n={}){let{defaults:r,liveTags:s,slotCss:o,slotIds:i,slotScope:a}=n;if(!D(e))return;if(Array.isArray(e)){for(let u of e)lx(u,t,n);return}if(Array.isArray(e.children))for(let u of e.children)lx(u,t,n);let{tagName:l}=e;if(!k(l))return;let c=t.get(l);if(c){if(e.attributes){let{lifted:I,rest:V}=ey(e.attributes);if(I)e.attributes=V,e.$props={...I,...e.$props}}let u=()=>a?.()??{},d=(I)=>{if(o&&D(I)&&!Array.isArray(I))Af(I,o.rules,o.media,"",o.counter,"jxs");return Fo(I,u(),null)},p=Rn(c,r),m=ty(c,e.attributes,{}),y=m?{...m,...e.$props}:e.$props||null,S={componentDefs:t,defaults:r,liveTags:s,path:[{key:JSON.stringify(y??{}),tag:l}],slotIds:i},g=!oy(l,c,s),{children:x}=e,P=!p&&!g&&Ns(c.children)?Zg(S):null,w=p?(Array.isArray(x)?x:[]).map((I)=>d(I)).join(`
|
|
571
|
+
`):null,E=d0(c,y,p?null:Qg(x,u(),d,P),S);if(P!==null)e.attributes={...e.attributes,[ml]:String(P)};e.innerHTML=p?`<template shadowrootmode="${p}"><link rel="stylesheet" href="${Rf(l)}">${E}</template>${w??""}`:E,delete e.children;let j=Dl(c,y),A=ry(c.style,j);if(Object.keys(A).length>0)e.style={...e.style,...A};let T=ny(c.attributes,j);if(Object.keys(T).length>0)e.attributes={...e.attributes,...T};if(!g&&e.$props&&Object.keys(e.$props).length>0)e.attributes={...e.attributes,"data-jx-props":JSON.stringify(e.$props)};if(delete e.$props,g)e.$static=!0;else e.$prerendered=!0}}function Y2(e,t,n=new Map,r=new Set,s="",o={},i=t){let a=(j)=>e.includes(`<${j}`),l=(j)=>s.includes(`<${j}`),c=t.filter((j)=>a(j)||l(j));if(c.length===0)return e;let u=c.flatMap((j)=>{let A=n.get(j);return A===void 0||A===""?[]:[A]}).join(`
|
|
572
|
+
`),d=u===""?"":`<style>
|
|
573
|
+
${kf(u)}
|
|
574
|
+
</style>`,p=(j)=>{let A=j.filter(Boolean).join(`
|
|
575
|
+
`);return A===""?e:e.replace("</head>",gs(` ${A}
|
|
576
|
+
</head>`))},m=new Set(c),y=i.filter((j)=>m.has(j)&&(l(j)||!r.has(j)));if(y.length===0)return p([d]);let S=Pl(o),x=[...Qy(o),...y.map((j)=>`/components/${j}.js`)].map((j)=>`<link rel="modulepreload" href="${j}">`).join(`
|
|
577
|
+
`),P=e.includes('<script type="importmap">'),w=p([P?"":S,x,d]),E=y.map((j)=>`<script type="module" src="/components/${j}.js"></script>`).join(`
|
|
578
|
+
`);return w.replace("</body>",gs(` ${E}
|
|
579
|
+
</body>`))}function Z2(e,t){return e.replace("</body>",gs(` <script type="module" src="${t}"></script>
|
|
580
|
+
</body>`))}function Q2(e,t,n){let r=jE(t),s=/<head>([\s\S]*?)<\/head>/i,o=e.match(s),i="";if(o){let l=o[1].match(/<style>[\s\S]*?<\/style>/gi);if(l)i+=`
|
|
570
581
|
${l.join(`
|
|
571
|
-
`)}
|
|
582
|
+
`)}`;let c=o[1].match(/<script[\s\S]*?<\/script>/gi);if(c)i+=`
|
|
583
|
+
${c.join(`
|
|
584
|
+
`)}`}let a=e;if(s.test(a))a=a.replace(s,gs(`<head>
|
|
572
585
|
${r}${i}
|
|
573
|
-
</head>`);return a=a.replace(/<html\s[^>]*>/i,(
|
|
574
|
-
<link rel="canonical" href="${
|
|
575
|
-
<meta name="robots" content="noindex">`,
|
|
586
|
+
</head>`));return a=a.replace(/<html\s[^>]*>/i,(l)=>{let c=/lang=/.test(l)?l.replace(/lang="[^"]*"/,gs(`lang="${n.lang}"`)):l.replace("<html",`<html lang="${n.lang}"`);if(n.dir!==void 0)c=/\sdir=/.test(c)?c.replace(/\sdir="[^"]*"/,` dir="${n.dir}"`):c.replace("<html",gs(`<html dir="${n.dir}"`));return c}),a}function gP(e,t,n){if(e==="/")return Tr(t,"index.html");if(Ll(e))return Tr(t,"404.html");let r=e.replace(/^\//,"");if(n==="always")return Tr(t,r,"index.html");return Tr(t,`${r}.html`)}function eV(e,t,n={}){let r=0,s=[],o=[],i=(c)=>c.length>1&&c.endsWith("/")?c.slice(0,-1):c,a=new Set([...n.compiledUrls??[]].map((c)=>i(c))),l=n.trailingSlash??"always";for(let[c,u]of Object.entries(e)){let d=k(u)?u:u.destination,p=!k(u)&&"rewrite"in u&&u.rewrite,m=p?200:!k(u)&&("status"in u)?u.status??301:301;if(!p&&!sx.has(String(m))){s.push(`Redirect "${c}" has status ${m}, which is not an RFC 9110 §15.4 redirection `+`status. Use one of ${[...sx.keys()].join(", ")}, or { destination, rewrite: true } for a proxy.`);continue}let y=n.basePath??"";if(o.push(`${Fe(y,c)} ${Fe(y,d)} ${m}`),c.includes(":")||c.includes("*"))continue;if(a.has(i(c)))console.warn(`The ${p?"rewrite":"redirect"} "${c}" collides with a compiled page at the same route — `+"remove one or the other.");if(p)continue;let S=sx.get(String(m));if(!S.html)continue;let g=gP(c,t,l),x=S.canonical?`
|
|
587
|
+
<link rel="canonical" href="${ox(d)}">`:`
|
|
588
|
+
<meta name="robots" content="noindex">`,P=`<!DOCTYPE html>
|
|
576
589
|
<html>
|
|
577
590
|
<head>
|
|
578
591
|
<meta charset="utf-8">
|
|
579
|
-
<meta http-equiv="refresh" content="0;url=${
|
|
592
|
+
<meta http-equiv="refresh" content="0;url=${ox(d)}">${x}
|
|
580
593
|
<title>Redirecting...</title>
|
|
581
594
|
</head>
|
|
582
595
|
<body>
|
|
583
|
-
<p>Redirecting to <a href="${
|
|
596
|
+
<p>Redirecting to <a href="${ox(d)}">${yP(d)}</a>...</p>
|
|
584
597
|
</body>
|
|
585
|
-
</html>`;
|
|
598
|
+
</html>`;hr(gr(g),{recursive:!0}),on(g,P,"utf8"),r+=1}if(o.length>0)on(Tr(t,"_redirects"),`${o.join(`
|
|
586
599
|
`)}
|
|
587
|
-
`,"utf8"),r+=1;return{errors:s,files:r}}function
|
|
600
|
+
`,"utf8"),r+=1;return{errors:s,files:r}}function yP(e){return String(e).replaceAll("&","&").replaceAll("<","<").replaceAll(">",">")}function ox(e){return String(e).replaceAll("&","&").replaceAll('"',""").replaceAll("<","<")}function ix(e){return String(e).replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}function tV(e){return e.toISOString().replace(/\.\d{3}Z$/,"Z")}function rV(e,t){if(e.length===0)return 0;let n=e.map((o)=>{let i=(o.alternates??[]).map((a)=>` <xhtml:link rel="alternate" hreflang="${ix(a.hreflang)}" href="${ix(a.href)}"/>`).join(`
|
|
588
601
|
`);return` <url>
|
|
589
|
-
<loc>${
|
|
602
|
+
<loc>${ix(o.loc)}</loc>
|
|
590
603
|
<lastmod>${o.lastmod}</lastmod>
|
|
591
604
|
${i===""?"":`${i}
|
|
592
605
|
`} </url>`}).join(`
|
|
593
606
|
`),s=`<?xml version="1.0" encoding="UTF-8"?>
|
|
594
|
-
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"${e.some((o)=>(o.alternates?.length??0)>0)?` xmlns:xhtml="${
|
|
607
|
+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"${e.some((o)=>(o.alternates?.length??0)>0)?` xmlns:xhtml="${nV}"`:""}>
|
|
595
608
|
${n}
|
|
596
609
|
</urlset>
|
|
597
|
-
`;return
|
|
610
|
+
`;return on(Tr(t,"sitemap.xml"),s,"utf8"),1}function sV(e,t){let n=Tr(e,"robots.txt"),r=Ls(n),s=r?V2(n,"utf8"):`User-agent: *
|
|
598
611
|
Allow: /
|
|
599
612
|
`;if(/^Sitemap:/im.test(s))return 0;if(!s.endsWith(`
|
|
600
613
|
`))s+=`
|
|
601
614
|
`;return s+=`
|
|
602
|
-
Sitemap: ${
|
|
603
|
-
`,In(n,s,"utf8"),r?0:1}var fv='set build.adapter to "cloudflare-workers", "cloudflare-pages", "node", or "bun".',Hm,JD="http://www.w3.org/1999/xhtml";var $v=T(()=>{le();Dt();$n();Dx();ap();Da();cm();iw();Ur();cw();fw();Sw();vu();Si();hm();jw();Ow();Rw();sm();Xw();ac();_m();hr();Ei();im();BS();um();YS();em();nv();nm();lv();Cm();po();Hm=new Map([["301",{canonical:!0,html:!0,why:""}],["302",{canonical:!1,html:!0,why:""}],["303",{canonical:!1,html:!0,why:""}],["307",{canonical:!1,html:!1,why:"307 preserves the request method and body; a meta-refresh silently converts POST to GET"}],["308",{canonical:!1,html:!1,why:"308 preserves the request method and body; a meta-refresh silently converts POST to GET"}]])});import{createRequire as DD}from"node:module";import{join as FD}from"node:path";import{spawn as LD}from"node:child_process";function VD(e){try{return DD(FD(e,"package.json")).resolve("@jxsuite/server/dev")}catch{throw Error(`@jxsuite/server is not installed in ${e}. Add it to devDependencies (e.g. \`bun add -d @jxsuite/server\`) and retry.`)}}function wv(e,t,n=LD,r=process){let o=[VD(e),"--root",e];if(t!==void 0)o.push("--port",String(t));let i=n("bun",o,{stdio:"inherit"});return i.on("error",(a)=>{if(a.code==="ENOENT")console.error("The Jx dev server runs on Bun, which was not found on your PATH. Install it from https://bun.sh and retry.");else console.error(`Failed to start the dev server: ${a.message}`);r.exitCode=1}),r.on("SIGINT",()=>{i.kill("SIGINT")}),r.on("SIGTERM",()=>{i.kill("SIGTERM")}),i.on("exit",(a)=>{r.exitCode=a??0}),i}var Sv=()=>{};import{createServer as qD}from"node:http";import{existsSync as Du,readFileSync as vv,statSync as WD}from"node:fs";import{extname as HD,join as Gm,normalize as UD,resolve as Ev,sep as BD}from"node:path";function KD(e,t){let n=UD(t).replaceAll("\\","/"),r=Ev(e,`.${n.startsWith("/")?n:`/${n}`}`);if(r!==e&&!r.startsWith(e+BD))return null;if(Du(r)){if(WD(r).isDirectory()){let o=Gm(r,"index.html");return Du(o)?o:null}return r}let s=Gm(r,"index.html");return Du(s)?s:null}function jv(e,t){let n=Ev(e),r=qD((s,o)=>{let i=new URL(s.url??"/","http://localhost"),a=KD(n,decodeURIComponent(i.pathname));if(a){o.writeHead(200,{"Content-Type":zD.get(HD(a).toLowerCase())??"application/octet-stream"}),o.end(vv(a));return}let c=Gm(n,"404.html");if(Du(c)){o.writeHead(404,{"Content-Type":"text/html; charset=utf-8"}),o.end(vv(c));return}o.writeHead(404,{"Content-Type":"text/plain; charset=utf-8"}),o.end("Not found")});return r.listen(t),r}var zD;var Pv=T(()=>{sd();zD=new Map(Object.entries({".avif":"image/avif",".css":"text/css; charset=utf-8",".gif":"image/gif",".html":"text/html; charset=utf-8",".ico":"image/x-icon",".jpeg":"image/jpeg",".jpg":"image/jpeg",".js":"text/javascript; charset=utf-8",".json":"application/json; charset=utf-8",".png":"image/png",".svg":"image/svg+xml",".txt":"text/plain; charset=utf-8",".webp":"image/webp",".woff2":"font/woff2",".xml":"application/xml; charset=utf-8",...py}))});var hc="https://jxsuite.com/schema/project/fields/v2",Co="https://jxsuite.com/schema/document/paths/v2",_v,kv,gc,Xm;var Fu=T(()=>{_v={description:"A single field definition inside a section entry schema — a small, recursive subset of "+"JSON Schema. Recursive positions reference the effective field union via the well-known fields resource $id.",properties:{default:{},description:{type:"string"},enum:{type:"array"},format:{type:"string"},items:{$ref:"https://jxsuite.com/schema/project/fields/v2"},properties:{additionalProperties:{$ref:"https://jxsuite.com/schema/project/fields/v2"},type:"object"},required:{items:{type:"string"},type:"array"},type:{enum:["string","number","integer","boolean","array","object"],type:"string"}},required:["type"],type:"object"},kv={description:`Relationship reference field: points at a named entry of a referenceable section via "#/<sectionKey>/<name>" (specs/relationships.md). A bare reference is to-one; wrap in an array field's items for to-many.`,properties:{$ref:{pattern:"^#/[A-Za-z][A-Za-z0-9_-]*/[A-Za-z0-9._-]+$",type:"string"},description:{type:"string"}},required:["$ref"],type:"object"},gc=[{additionalProperties:!1,description:'Explicit value list: generates one page per value, bound to `param` (default "value").',properties:{param:{description:'Route parameter to fill (default "value").',type:"string"},values:{description:"The values to expand.",type:"array"}},required:["values"],type:"object"},{additionalProperties:!1,description:"JSON data-file source: loads a project-relative file that must contain an array, and generates one page per item.",properties:{$ref:{description:"Project-relative path to a .json file containing an array.",type:"string"},field:{description:'Item field providing the parameter value (default "id").',type:"string"},param:{description:'Route parameter to fill (default "id").',type:"string"}},required:["$ref"],type:"object"},{additionalProperties:!1,description:"Paged list: one route per `pageSize` items of an entry of this page's own state, which must resolve to an array at build time. The page number fills the route's one parameter that `each` does not.",properties:{each:{description:"Another `$paths` source for the route's other parameter: the list is paged once per value of it, as a paged archive per tag is.",type:["object","array"]},pageSize:{description:"Items on each page.",minimum:1,type:"integer"},paginate:{additionalProperties:!1,description:"The state entry to page.",properties:{$ref:{description:"A pointer to an entry of this page's state: `#/state/<key>`.",pattern:"^#/state/[^/]+$",type:"string"}},required:["$ref"],type:"object"}},required:["paginate","pageSize"],type:"object"},{description:"Legacy explicit form: an array of ready-made parameter objects, used as-is with no expansion. Prefer one of the source shapes above.",items:{additionalProperties:{type:"string"},type:"object"},type:"array"}],Xm={description:"A source shape contributed by an extension this schema cannot see. The project's generated document.schema.json validates these exactly; enable the owning extension and regenerate with `jx schema` to get precise checking here.",minProperties:1,type:"object"}});function GD(e){let{corePath:t,fragments:n,fieldSchemaRefs:r=[]}=e;return{$comment:Cv,$defs:{Fields:{$id:hc,anyOf:[{$ref:`${Ov}#/$defs/JxFieldSchema`},{$ref:`${Ov}#/$defs/RelationshipRef`},...r.map((s)=>({$ref:s}))]}},$schema:"https://json-schema.org/draft/2020-12/schema",allOf:[{$ref:t},...n.map((s)=>({$ref:s}))],type:"object",unevaluatedProperties:!1}}async function xc(e,t,n,r=[]){let s=structuredClone(e),o=new Map,i=new Set;Ym(s,i);let a=0,c=async(u)=>{let d=yc(u),p=o.get(d);if(p!==void 0)return p;let m;try{m=structuredClone(await t(d))}catch(b){throw Error(`bundleSchema: cannot load $ref target "${d}": ${nF(b)}`,{cause:b})}let x=k(m.$id)&&_s(m.$id)?m.$id:null;a+=x===null?1:0;let h=x??`urn:jx:bundled:${a}`;if(o.set(d,h),i.has(h))return h;i.add(h),m.$id=h,await l(m,tF(d),!0);let g=s.$defs??={};return g[h]=m,h},l=async(u,d,p=!1)=>{if(Array.isArray(u)){for(let g of u)await l(g,d);return}if(!V(u))return;let m=u,x=d;if(!p&&k(m.$id)&&_s(m.$id))x=null;let h=m.$ref;if(k(h)&&x!==null&&!h.startsWith("#")&&!_s(h)){let g=h.indexOf("#"),b=g===-1?h:h.slice(0,g),j=g===-1?"":h.slice(g);if(b){let v=await c(`${x}/${b}`);m.$ref=`${v}${j}`}}for(let g of Object.values(m))await l(g,x)};await l(s,yc(n),!0);for(let u of r)await c(`${yc(n)}/${u}`);return s}function QD(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function*Av(e,t){for(let n of XD){let r=e[n];if(Array.isArray(r)){for(let[s,o]of r.entries())if(V(o))yield[o,`${t}/${n}/${s}`]}else if(V(r))yield[r,`${t}/${n}`]}for(let n of YD){let r=e[n];if(!V(r))continue;for(let[s,o]of Object.entries(r))if(V(o))yield[o,`${t}/${n}/${QD(s)}`]}for(let n of ZD){let r=e[n];if(!Array.isArray(r))continue;for(let[s,o]of r.entries())if(V(o))yield[o,`${t}/${n}/${s}`]}}function eF(e,t){let n=e.replace(/^[a-zA-Z][a-zA-Z\d+.-]*:/,"");if(n.startsWith("//")){let o=n.indexOf("/",2);n=o===-1?"":n.slice(o+1)}n=n.replace(/^schema\//,"");let r=n.split(/[^a-zA-Z0-9]+/).filter(Boolean).join("-")||"resource",s=r;for(let o=2;t.has(s);o+=1)s=`${r}-${o}`;return t.add(s),s}function bc(e){let t=structuredClone(e);if(V(t.$defs)){let o=new Set(Object.keys(t.$defs).filter((a)=>!_s(a))),i={};for(let[a,c]of Object.entries(t.$defs)){let l=V(c)&&k(c.$id)?c.$id:a;i[_s(a)?eF(l,o):a]=c}t.$defs=i}let n=new Map,r=(o,i)=>{let{$id:a}=o;if(k(a)&&_s(a)&&!n.has(a))n.set(a,i);for(let[c,l]of Av(o,i))r(c,l)};r(t,"#");let s=(o,i)=>{let a=i,{$id:c}=o;if(k(c)&&_s(c)){if(a=n.get(c)??i,a!=="#")delete o.$id}let l=o.$ref;if(k(l)){let u=l.indexOf("#"),d=u===-1?l:l.slice(0,u),p=u===-1?"":l.slice(u+1);if(d===""){if(p.startsWith("/"))o.$ref=`${a}${p}`}else{let m=n.get(d);if(m!==void 0)o.$ref=p?`${m}${p}`:m}}for(let[u]of Av(o,a))s(u,a)};return s(t,"#"),t}function Ym(e,t){if(Array.isArray(e)){for(let r of e)Ym(r,t);return}if(!V(e))return;let n=e;if(k(n.$id)&&_s(n.$id))t.add(n.$id);for(let r of Object.values(n))Ym(r,t)}function _s(e){return/^[a-zA-Z][a-zA-Z\d+.-]*:/.test(e)}function yc(e){let t=e.replaceAll("\\","/"),n=t.startsWith("/"),r=[];for(let s of t.split("/")){if(s===""||s===".")continue;if(s===".."){if(r.length>0&&r.at(-1)!=="..")r.pop();else if(!n)r.push("..");continue}r.push(s)}return(n?"/":"")+r.join("/")}function tF(e){let t=e.lastIndexOf("/");if(t===-1)return".";return t===0?"/":e.slice(0,t)}function nF(e){return e instanceof Error?e.message:String(e)}function rF(e){let{corePath:t,pathsValueRefs:n}=e;return{$comment:Cv,$defs:{PathsValue:{$id:Co,anyOf:[...gc,...n.map((r)=>({$ref:r}))]}},$schema:"https://json-schema.org/draft/2020-12/schema",allOf:[{$ref:t}]}}async function Nv(e){let{baseDir:t,coreDocumentRef:n,coreProjectRef:r,extensions:s,loadJson:o}=e,i=[],a=[],c=[],l=[];for(let p of s){if(p.project)i.push(p.project);if(p.document){let m=await Rv(p.document,o,t);if(a.push(...m),m.length>0)c.push(p.document)}if(p.fields)l.push(...await Rv(p.fields,o,t)),i.push(p.fields)}let u=GD({corePath:r,fieldSchemaRefs:l,fragments:i}),d=rF({corePath:n,pathsValueRefs:a});return{document:bc(await xc(d,o,t,c)),project:bc(await xc(u,o,t))}}async function Rv(e,t,n){let r;try{r=await t(yc(`${yc(n)}/${e}`))}catch{return[]}let{$id:s}=r;if(!k(s)||!r.$defs)return[];return Object.keys(r.$defs).map((o)=>`${s}#/$defs/${o}`)}var Ov="https://jxsuite.com/schema/project/core/v2",Cv="Generated by `jx schema` from project.json#/extensions — do not edit.",XD,YD,ZD;var Tv=T(()=>{Fu();le();Fu();XD=["additionalItems","additionalProperties","contains","contentSchema","else","if","items","not","propertyNames","then","unevaluatedItems","unevaluatedProperties"],YD=["$defs","definitions","dependencies","dependentSchemas","patternProperties","properties"],ZD=["allOf","anyOf","oneOf","prefixItems"]});import{existsSync as Mv,readFileSync as sF,statSync as Jv,writeFileSync as Lu}from"node:fs";import{createRequire as Qm}from"node:module";import{dirname as oF,isAbsolute as iF,relative as eh,resolve as ks,sep as th}from"node:path";async function Dv(e){let{config:t}=ms(e),n=await ps(e,t),r=ks(e),{document:s,project:o}=await Nv({baseDir:r,coreDocumentRef:Iv(e,cF),coreProjectRef:Iv(e,aF),extensions:n.extensions.map((i)=>({document:i.schemas.document&&Zm(e,i,i.schemas.document),fields:i.schemas.fields&&Zm(e,i,i.schemas.fields),project:i.schemas.project&&Zm(e,i,i.schemas.project)})),loadJson:Vv(r)});return{documentSchema:s,projectSchema:o}}async function Fv(e){let{documentSchema:t,projectSchema:n}=await Dv(e),r=ks(e,"project.schema.json"),s=ks(e,"document.schema.json");return Lu(r,`${JSON.stringify(n,null,2)}
|
|
604
|
-
`,"utf8"),
|
|
605
|
-
`,"utf8"),{documentSchemaPath:s,projectSchemaPath:r}}async function
|
|
606
|
-
`,"utf8"),
|
|
607
|
-
`,"utf8");let u=
|
|
608
|
-
`);return
|
|
615
|
+
Sitemap: ${Cs("/sitemap.xml",t)}
|
|
616
|
+
`,on(n,s,"utf8"),r?0:1}var lP='set build.adapter to "cloudflare-workers", "cloudflare-pages", "node", or "bun".',sx,nV="http://www.w3.org/1999/xhtml";var xP=J(()=>{ce();dm();Lt();An();zS();Om();bi();hy();rE();is();oE();lE();bE();qf();Ti();Sy();wE();PE();kE();uy();UE();Hl();Jy();yn();Mi();py();dy();Hj();yy();Sl();Kj();iy();Qj();ly();oP();Fy();Eo();sx=new Map([["301",{canonical:!0,html:!0,why:""}],["302",{canonical:!1,html:!0,why:""}],["303",{canonical:!1,html:!0,why:""}],["307",{canonical:!1,html:!1,why:"307 preserves the request method and body; a meta-refresh silently converts POST to GET"}],["308",{canonical:!1,html:!1,why:"308 preserves the request method and body; a meta-refresh silently converts POST to GET"}]])});import{createRequire as oV}from"node:module";import{join as iV}from"node:path";import{spawn as aV}from"node:child_process";function lV(e){try{return oV(iV(e,"package.json")).resolve("@jxsuite/server/dev")}catch{throw Error(`@jxsuite/server is not installed in ${e}. Add it to devDependencies (e.g. \`bun add -d @jxsuite/server\`) and retry.`)}}function bP(e,t,n=aV,r=process){let o=[lV(e),"--root",e];if(t!==void 0)o.push("--port",String(t));let i=n("bun",o,{stdio:"inherit"});return i.on("error",(a)=>{if(a.code==="ENOENT")console.error("The Jx dev server runs on Bun, which was not found on your PATH. Install it from https://bun.sh and retry.");else console.error(`Failed to start the dev server: ${a.message}`);r.exitCode=1}),r.on("SIGINT",()=>{i.kill("SIGINT")}),r.on("SIGTERM",()=>{i.kill("SIGTERM")}),i.on("exit",(a)=>{r.exitCode=a??0}),i}var $P=()=>{};import{createServer as cV}from"node:http";import{existsSync as rd,readFileSync as SP,statSync as uV}from"node:fs";import{extname as fV,join as cx,normalize as dV,resolve as wP,sep as pV}from"node:path";function hV(e,t){let n=dV(t).replaceAll("\\","/"),r=wP(e,`.${n.startsWith("/")?n:`/${n}`}`);if(r!==e&&!r.startsWith(e+pV))return null;if(rd(r)){if(uV(r).isDirectory()){let o=cx(r,"index.html");return rd(o)?o:null}return r}let s=cx(r,"index.html");return rd(s)?s:null}function vP(e,t){let n=wP(e),r=cV((s,o)=>{let i=new URL(s.url??"/","http://localhost"),a=hV(n,decodeURIComponent(i.pathname));if(a){o.writeHead(200,{"Content-Type":mV.get(fV(a).toLowerCase())??"application/octet-stream"}),o.end(SP(a));return}let l=cx(n,"404.html");if(rd(l)){o.writeHead(404,{"Content-Type":"text/html; charset=utf-8"}),o.end(SP(l));return}o.writeHead(404,{"Content-Type":"text/plain; charset=utf-8"}),o.end("Not found")});return r.listen(t),r}var mV;var EP=J(()=>{bp();mV=new Map(Object.entries({".avif":"image/avif",".css":"text/css; charset=utf-8",".gif":"image/gif",".html":"text/html; charset=utf-8",".ico":"image/x-icon",".jpeg":"image/jpeg",".jpg":"image/jpeg",".js":"text/javascript; charset=utf-8",".json":"application/json; charset=utf-8",".png":"image/png",".svg":"image/svg+xml",".txt":"text/plain; charset=utf-8",".webp":"image/webp",".woff2":"font/woff2",".xml":"application/xml; charset=utf-8",...m$}))});function gV(e){let{corePath:t,fragments:n,fieldSchemaRefs:r=[]}=e;return{$comment:kP,$defs:{Fields:{$id:xl,anyOf:[{$ref:`${jP}#/$defs/JxFieldSchema`},{$ref:`${jP}#/$defs/RelationshipRef`},...r.map((s)=>({$ref:s}))]}},$schema:"https://json-schema.org/draft/2020-12/schema",allOf:[{$ref:t},...n.map((s)=>({$ref:s}))],type:"object",unevaluatedProperties:!1}}async function ec(e,t,n,r=[]){let s=structuredClone(e),o=new Map,i=new Set;ux(s,i);let a=0,l=async(u)=>{let d=Ql(u),p=o.get(d);if(p!==void 0)return p;let m;try{m=structuredClone(await t(d))}catch(x){throw Error(`bundleSchema: cannot load $ref target "${d}": ${vV(x)}`,{cause:x})}let y=k(m.$id)&&Fs(m.$id)?m.$id:null;a+=y===null?1:0;let S=y??`urn:jx:bundled:${a}`;if(o.set(d,S),i.has(S))return S;i.add(S),m.$id=S,await c(m,wV(d),!0);let g=s.$defs??={};return g[S]=m,S},c=async(u,d,p=!1)=>{if(Array.isArray(u)){for(let g of u)await c(g,d);return}if(!L(u))return;let m=u,y=d;if(!p&&k(m.$id)&&Fs(m.$id))y=null;let S=m.$ref;if(k(S)&&y!==null&&!S.startsWith("#")&&!Fs(S)){let g=S.indexOf("#"),x=g===-1?S:S.slice(0,g),P=g===-1?"":S.slice(g);if(x){let w=await l(`${y}/${x}`);m.$ref=`${w}${P}`}}for(let g of Object.values(m))await c(g,y)};await c(s,Ql(n),!0);for(let u of r)await l(`${Ql(n)}/${u}`);return s}function $V(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function*PP(e,t){for(let n of yV){let r=e[n];if(Array.isArray(r)){for(let[s,o]of r.entries())if(L(o))yield[o,`${t}/${n}/${s}`]}else if(L(r))yield[r,`${t}/${n}`]}for(let n of xV){let r=e[n];if(!L(r))continue;for(let[s,o]of Object.entries(r))if(L(o))yield[o,`${t}/${n}/${$V(s)}`]}for(let n of bV){let r=e[n];if(!Array.isArray(r))continue;for(let[s,o]of r.entries())if(L(o))yield[o,`${t}/${n}/${s}`]}}function SV(e,t){let n=e.replace(/^[a-zA-Z][a-zA-Z\d+.-]*:/,"");if(n.startsWith("//")){let o=n.indexOf("/",2);n=o===-1?"":n.slice(o+1)}n=n.replace(/^schema\//,"");let r=n.split(/[^a-zA-Z0-9]+/).filter(Boolean).join("-")||"resource",s=r;for(let o=2;t.has(s);o+=1)s=`${r}-${o}`;return t.add(s),s}function tc(e){let t=structuredClone(e);if(L(t.$defs)){let o=new Set(Object.keys(t.$defs).filter((a)=>!Fs(a))),i={};for(let[a,l]of Object.entries(t.$defs)){let c=L(l)&&k(l.$id)?l.$id:a;i[Fs(a)?SV(c,o):a]=l}t.$defs=i}let n=new Map,r=(o,i)=>{let{$id:a}=o;if(k(a)&&Fs(a)&&!n.has(a))n.set(a,i);for(let[l,c]of PP(o,i))r(l,c)};r(t,"#");let s=(o,i)=>{let a=i,{$id:l}=o;if(k(l)&&Fs(l)){if(a=n.get(l)??i,a!=="#")delete o.$id}let c=o.$ref;if(k(c)){let u=c.indexOf("#"),d=u===-1?c:c.slice(0,u),p=u===-1?"":c.slice(u+1);if(d===""){if(p.startsWith("/"))o.$ref=`${a}${p}`}else{let m=n.get(d);if(m!==void 0)o.$ref=p?`${m}${p}`:m}}for(let[u]of PP(o,a))s(u,a)};return s(t,"#"),t}function ux(e,t){if(Array.isArray(e)){for(let r of e)ux(r,t);return}if(!L(e))return;let n=e;if(k(n.$id)&&Fs(n.$id))t.add(n.$id);for(let r of Object.values(n))ux(r,t)}function Fs(e){return/^[a-zA-Z][a-zA-Z\d+.-]*:/.test(e)}function Ql(e){let t=e.replaceAll("\\","/"),n=t.startsWith("/"),r=[];for(let s of t.split("/")){if(s===""||s===".")continue;if(s===".."){if(r.length>0&&r.at(-1)!=="..")r.pop();else if(!n)r.push("..");continue}r.push(s)}return(n?"/":"")+r.join("/")}function wV(e){let t=e.lastIndexOf("/");if(t===-1)return".";return t===0?"/":e.slice(0,t)}function vV(e){return e instanceof Error?e.message:String(e)}function EV(e){let{corePath:t,pathsValueRefs:n}=e;return{$comment:kP,$defs:{PathsValue:{$id:Io,anyOf:[...bl,...n.map((r)=>({$ref:r}))]}},$schema:"https://json-schema.org/draft/2020-12/schema",allOf:[{$ref:t}]}}async function OP(e){let{baseDir:t,coreDocumentRef:n,coreProjectRef:r,extensions:s,loadJson:o}=e,i=[],a=[],l=[],c=[];for(let p of s){if(p.project)i.push(p.project);if(p.document){let m=await _P(p.document,o,t);if(a.push(...m),m.length>0)l.push(p.document)}if(p.fields)c.push(...await _P(p.fields,o,t)),i.push(p.fields)}let u=gV({corePath:r,fieldSchemaRefs:c,fragments:i}),d=EV({corePath:n,pathsValueRefs:a});return{document:tc(await ec(d,o,t,l)),project:tc(await ec(u,o,t))}}async function _P(e,t,n){let r;try{r=await t(Ql(`${Ql(n)}/${e}`))}catch{return[]}let{$id:s}=r;if(!k(s)||!r.$defs)return[];return Object.keys(r.$defs).map((o)=>`${s}#/$defs/${o}`)}var jP="https://jxsuite.com/schema/project/core/v2",kP="Generated by `jx schema` from project.json#/extensions — do not edit.",yV,xV,bV;var AP=J(()=>{$l();ce();$l();yV=["additionalItems","additionalProperties","contains","contentSchema","else","if","items","not","propertyNames","then","unevaluatedItems","unevaluatedProperties"],xV=["$defs","definitions","dependencies","dependentSchemas","patternProperties","properties"],bV=["allOf","anyOf","oneOf","prefixItems"]});import{existsSync as NP,readFileSync as jV,statSync as CP,writeFileSync as sd}from"node:fs";import{createRequire as dx}from"node:module";import{dirname as PV,isAbsolute as _V,relative as px,resolve as Vs,sep as mx}from"node:path";async function TP(e){let{config:t}=As(e),n=await Os(e,t),r=Vs(e),{document:s,project:o}=await OP({baseDir:r,coreDocumentRef:RP(e,OV),coreProjectRef:RP(e,kV),extensions:n.extensions.map((i)=>({document:i.schemas.document&&fx(e,i,i.schemas.document),fields:i.schemas.fields&&fx(e,i,i.schemas.fields),project:i.schemas.project&&fx(e,i,i.schemas.project)})),loadJson:IP(r)});return{documentSchema:s,projectSchema:o}}async function JP(e){let{documentSchema:t,projectSchema:n}=await TP(e),r=Vs(e,"project.schema.json"),s=Vs(e,"document.schema.json");return sd(r,`${JSON.stringify(n,null,2)}
|
|
617
|
+
`,"utf8"),sd(s,`${JSON.stringify(t,null,2)}
|
|
618
|
+
`,"utf8"),{documentSchemaPath:s,projectSchemaPath:r}}async function MP(e,t={}){let{write:n=!0}=t,r=Vs(e),s=qn(r),o=Vs(r,"project.schema.json"),i=Vs(r,"document.schema.json"),a=(S)=>{if(!NP(S))return!0;try{return CP(s).mtimeMs>CP(S).mtimeMs}catch{return!1}},c=a(o)||a(i)?await TP(r):null;if(c&&n)sd(o,`${JSON.stringify(c.projectSchema,null,2)}
|
|
619
|
+
`,"utf8"),sd(i,`${JSON.stringify(c.documentSchema,null,2)}
|
|
620
|
+
`,"utf8");let u=IP(r),d=c?.projectSchema??nc(o),p=c?.documentSchema??nc(i),m=tc(await ec(d,u,r));return{document:tc(await ec(p,u,r)),project:m}}function nc(e){let t=JSON.parse(jV(e,"utf8"));if(!L(t))throw TypeError(`Schema file "${e}" is not a JSON object`);return t}function CV(e){return e.startsWith(AV)&&e.endsWith(".json")}function RV(e,t){try{return dx(import.meta.url).resolve(e)}catch(n){throw Error(`Schema ref "${t}" names the core schema "${e}", which must resolve from the host workspace and does not. The project's own copy is deliberately not consulted, so the host install is missing "${e.split("/").slice(0,2).join("/")}" — check that `+"the package ships with this build",{cause:n})}}function IP(e){return async(t)=>{let n=Vs(t),r=px(e,n);if(r.startsWith("..")||_V(r))throw Error(`Schema ref "${t}" escapes the project root ${e}`);let s=r.split(mx).join("/"),o="node_modules/",i=s.lastIndexOf(o),a=i===-1?null:s.slice(i+o.length);if(a!==null&&CV(a))return nc(RV(a,t));if(NP(n))return nc(n);if(a===null)throw Error(`Schema ref "${t}" does not exist`);let l;try{l=im(e,a)}catch(c){throw Error(`Schema ref "${t}" does not exist and "${a}" is not resolvable from the `+"project — is the package installed?",{cause:c})}return nc(l)}}function RP(e,t){let n=null;try{n=dx(Vs(e,"package.json")).resolve(t)}catch{try{n=dx(import.meta.url).resolve(t)}catch{n=null}}let r=`./node_modules/${t}`;return n?DP(e,n,r):r}function fx(e,t,n){let r=px(PV(t.manifestPath),n).split(mx).join("/"),s=`./node_modules/${t.specifier}/${r}`;return DP(e,n,s)}function DP(e,t,n){let r=px(e,t).split(mx).join("/");if(r.startsWith(".."))return n;return r.startsWith("./")?r:`./${r}`}var kV="@jxsuite/schema/schemas/project.core.schema.json",OV="@jxsuite/schema/schema.json",AV="@jxsuite/schema/";var hx=J(()=>{AP();ce();is();bi();Eo()});var VP=W(function(Pne,FP){var __dirname="/home/runner/work/jx/jx/node_modules/@webref/elements",LP=pt("fs").promises,od=pt("path");async function NV({folder:e=__dirname}={}){let t={},n=await LP.readdir(e);for(let r of n)if(r.endsWith(".json")&&r!=="package.json"){let s=await LP.readFile(od.join(e,r),"utf8");t[od.basename(r,".json")]=JSON.parse(s)}return t}FP.exports={listAll:NV}});var BP=W(function(_ne,WP){var __dirname="/home/runner/work/jx/jx/node_modules/@webref/css",TV=pt("fs").promises,qP=pt("path");async function HP({folder:e=__dirname}={}){let t=await TV.readFile(qP.join(e,"css.json"),"utf8");return JSON.parse(t)}async function JV({folder:e=__dirname}={}){let t=await HP(e),n={};for(let[r,s]of Object.entries(t)){n[r]={};for(let o of s){let i=o.name,a=null;if(o.for)a=s.find((l)=>l!==o&&l.name===o.name);if(a)i+=" for "+o.for[0];if(n[r][i]=o,o.descriptors){let l=o.descriptors;o.descriptors={};for(let c of l)o.descriptors[c.name]=c}}}return n}WP.exports={listAll:HP,index:JV}});var UP=W(function(id,gx){(function(e,t){typeof id=="object"&&typeof gx=="object"?gx.exports=t():typeof define=="function"&&define.amd?define([],t):typeof id=="object"?id.WebIDL2=t():e.WebIDL2=t()})(globalThis,()=>(()=>{var e={d:(f,h)=>{for(var b in h)e.o(h,b)&&!e.o(f,b)&&Object.defineProperty(f,b,{enumerable:!0,get:h[b]})},o:(f,h)=>Object.prototype.hasOwnProperty.call(f,h),r:(f)=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(f,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(f,"__esModule",{value:!0})}},t={};function n(f,h,b,v,_,{level:M="error",autofix:K,ruleName:ae}={}){function U(Dt){return Dt>0?f.slice(h,h+Dt):f.slice(Math.max(h+Dt,0),h)}function oe(Dt,{precedes:$r}={}){let Yr=Dt.map((Na)=>Na.trivia+Na.value).join(""),Ra=f[h];return Ra.type==="eof"?Yr:$r?Yr+Ra.trivia:Yr.slice(Ra.trivia.length)}let ie=f[h].type!=="eof"?f[h].line:f.length>1?f[h-1].line:1,ge=function(Dt){let $r=Dt.split(`
|
|
621
|
+
`);return $r[$r.length-1]}(oe(U(-5),{precedes:!0})),De=U(5),ut=oe(De),In=ge+ut.split(`
|
|
609
622
|
`)[0]+`
|
|
610
|
-
`+(" ".repeat(
|
|
611
|
-
${ba}`;return{message:`${Rg} ${E}`,bareMessage:E,context:Rg,line:Oe,sourceName:f.name,level:I,ruleName:Z,autofix:q,input:tn,tokens:zt}}function r(f,y,w,E){return n(f,y,w,E,"Syntax")}function s(f,y,w,E,O={}){return O.ruleName=w,n(y.source,f.index,y,E,"Validation",O)}e.r(t),e.d(t,{WebIDLParseError:()=>Fe,parse:()=>Zf,validate:()=>U,write:()=>Qs});class o{constructor({source:f,tokens:y}){Object.defineProperties(this,{source:{value:f},tokens:{value:y,writable:!0},parent:{value:null,writable:!0},this:{value:this}})}toJSON(){let f={type:void 0,name:void 0,inheritance:void 0},y=this;for(;y!==Object.prototype;){let w=Object.getOwnPropertyDescriptors(y);for(let[E,O]of Object.entries(w))(O.enumerable||O.get)&&(f[E]=this[E]);y=Object.getPrototypeOf(y)}return f}}function i(f,y,{useNullableInner:w}={}){if(!f.union){let E=y.unique.get(f.idlType);if(!E)return;if(E.type==="typedef"){let{typedefIncludesDictionary:O}=y.cache;if(O.has(E))return O.get(E);y.cache.typedefIncludesDictionary.set(E,void 0);let I=i(E.idlType,y);if(y.cache.typedefIncludesDictionary.set(E,I),I)return{reference:f,dictionary:I.dictionary}}if(E.type==="dictionary"&&(w||!f.nullable))return{reference:f,dictionary:E}}for(let E of f.subtype){let O=i(E,y);if(O)return E.union?O:{reference:E,dictionary:O.dictionary}}}function a(f,y){if(y.cache.dictionaryIncludesRequiredField.has(f))return y.cache.dictionaryIncludesRequiredField.get(f);y.cache.dictionaryIncludesRequiredField.set(f,void 0);let w=f.members.some((E)=>E.required);if(!w&&f.inheritance){let E=y.unique.get(f.inheritance);E?a(E,y)&&(w=!0):w=!0}return y.cache.dictionaryIncludesRequiredField.set(f,w),w}class c extends Array{constructor({source:f,tokens:y}){super(),Object.defineProperties(this,{source:{value:f},tokens:{value:y},parent:{value:null,writable:!0}})}}class l extends o{static parser(f,y){return()=>{let w=f.consumeKind(y);if(w)return new l({source:f.source,tokens:{value:w}})}}get value(){return C(this.tokens.value.value)}write(f){return f.ts.wrap([f.token(this.tokens.value),f.token(this.tokens.separator)])}}class u extends l{static parse(f){let y=f.consumeKind("eof");if(y)return new u({source:f.source,tokens:{value:y}})}get type(){return"eof"}}function d(f,y){return L(f,{parser:l.parser(f,y),listName:y+" list"})}let p=["identifier","decimal","integer","string"],m=new Map([...["NoInterfaceObject","LenientSetter","LenientThis","TreatNonObjectAsNull","Unforgeable"].map((f)=>[f,`Legacy${f}`]),["NamedConstructor","LegacyFactoryFunction"],["OverrideBuiltins","LegacyOverrideBuiltIns"],["TreatNullAs","LegacyNullToEmptyString"]]);function x(f){for(let y of p){let w=d(f,y);if(w.length)return w}f.error("Expected identifiers, strings, decimals, or integers but none found")}class h extends o{static parse(f){let y={assign:f.consume("=")},w=ee(new h({source:f.source,tokens:y}));if(w.list=[],y.assign){if(y.asterisk=f.consume("*"),y.asterisk)return w.this;y.secondaryName=f.consumeKind(...p)}return y.open=f.consume("("),y.open?(w.list=w.rhsIsList?x(f):ae(f),y.close=f.consume(")")||f.error("Unexpected token in extended attribute argument list")):y.assign&&!y.secondaryName&&f.error("No right hand side to extended attribute assignment"),w.this}get rhsIsList(){return this.tokens.assign&&!this.tokens.asterisk&&!this.tokens.secondaryName}get rhsType(){return this.rhsIsList?this.list[0].tokens.value.type+"-list":this.tokens.asterisk?"*":this.tokens.secondaryName?this.tokens.secondaryName.type:null}write(f){let{rhsType:y}=this;return f.ts.wrap([f.token(this.tokens.assign),f.token(this.tokens.asterisk),f.reference_token(this.tokens.secondaryName,this.parent),f.token(this.tokens.open),...this.list.map((w)=>y==="identifier-list"?f.identifier(w,this.parent):w.write(f)),f.token(this.tokens.close)])}}class g extends o{static parse(f){let y=f.consumeKind("identifier");if(y)return new g({source:f.source,tokens:{name:y},params:h.parse(f)})}constructor({source:f,tokens:y,params:w}){super({source:f,tokens:y}),w.parent=this,Object.defineProperty(this,"params",{value:w})}get type(){return"extended-attribute"}get name(){return this.tokens.name.value}get rhs(){let{rhsType:f,tokens:y,list:w}=this.params;if(!f)return null;return{type:f,value:this.params.rhsIsList?w:this.params.tokens.secondaryName?C(y.secondaryName.value):null}}get arguments(){let{rhsIsList:f,list:y}=this.params;return!y||f?[]:y}*validate(f){let{name:y}=this;if(y==="LegacyNoInterfaceObject")yield s(this.tokens.name,this,"no-nointerfaceobject","`[LegacyNoInterfaceObject]` extended attribute is an undesirable feature that may be removed from Web IDL in the future. Refer to the [relevant upstream PR](https://github.com/whatwg/webidl/pull/609) for more information.",{level:"warning"});else if(m.has(y)){let E=`\`[${y}]\` extended attribute is a legacy feature that is now renamed to \`[${m.get(y)}]\`. Refer to the [relevant upstream PR](https://github.com/whatwg/webidl/pull/870) for more information.`;yield s(this.tokens.name,this,"renamed-legacy",E,{level:"warning",autofix:(w=this,()=>{let{name:O}=w;w.tokens.name.value=m.get(O),O==="TreatNullAs"&&(w.params.tokens={})})})}var w;for(let E of this.arguments)yield*E.validate(f)}write(f){return f.ts.wrap([f.ts.trivia(this.tokens.name.trivia),f.ts.extendedAttribute(f.ts.wrap([f.ts.extendedAttributeReference(this.name),this.params.write(f)])),f.token(this.tokens.separator)])}}class b extends c{static parse(f){let y={};y.open=f.consume("[");let w=new b({source:f.source,tokens:y});return y.open?(w.push(...L(f,{parser:g.parse,listName:"extended attribute"})),y.close=f.consume("]")||f.error("Expected a closing token for the extended attribute list"),w.length||(f.unconsume(y.close.index),f.error("An extended attribute list must not be empty")),f.probe("[")&&f.error("Illegal double extended attribute lists, consider merging them"),w):w}*validate(f){for(let y of this)yield*y.validate(f)}write(f){return this.length?f.ts.wrap([f.token(this.tokens.open),...this.map((y)=>y.write(f)),f.token(this.tokens.close)]):""}}function j(f,y){let w=f.consume("?");w&&(y.tokens.nullable=w),f.probe("?")&&f.error("Can't nullable more than once")}function v(f,y){let w=function(E,O){let I=E.consume("FrozenArray","ObservableArray","Promise","async_sequence","sequence","record");if(!I)return;let q=ee(new P({source:E.source,tokens:{base:I}}));switch(q.tokens.open=E.consume("<")||E.error(`No opening bracket after ${I.value}`),I.value){case"Promise":{E.probe("[")&&E.error("Promise type cannot have extended attribute");let Z=se(E,O)||E.error("Missing Promise subtype");q.subtype.push(Z);break}case"async_sequence":case"sequence":case"FrozenArray":case"ObservableArray":{let Z=ne(E,O)||E.error(`Missing ${I.value} subtype`);q.subtype.push(Z);break}case"record":{E.probe("[")&&E.error("Record key cannot have extended attribute");let Z=E.consume(...Ge)||E.error(`Record key must be one of: ${Ge.join(", ")}`),oe=new P({source:E.source,tokens:{base:Z}});oe.tokens.separator=E.consume(",")||E.error("Missing comma after record key type"),oe.type=O;let fe=ne(E,O)||E.error("Error parsing generic type record");q.subtype.push(oe,fe);break}}return q.idlType||E.error(`Error parsing generic type ${I.value}`),q.tokens.close=E.consume(">")||E.error(`Missing closing bracket after ${I.value}`),q.this}(f,y)||de(f);if(!w){let E=f.consumeKind("identifier")||f.consume(...Ge,...Me);if(!E)return;w=new P({source:f.source,tokens:{base:E}}),f.probe("<")&&f.error(`Unsupported generic type ${E.value}`)}return w.generic==="Promise"&&f.probe("?")&&f.error("Promise type cannot be nullable"),w.type=y||null,j(f,w),w.nullable&&w.idlType==="any"&&f.error("Type `any` cannot be made nullable"),w}class P extends o{static parse(f,y){return v(f,y)||function(w,E){let O={};if(O.open=w.consume("("),!O.open)return;let I=ee(new P({source:w.source,tokens:O}));for(I.type=E||null;;){let q=ne(w,E)||w.error("No type after open parenthesis or 'or' in union type");q.idlType==="any"&&w.error("Type `any` cannot be included in a union type"),q.generic==="Promise"&&w.error("Type `Promise` cannot be included in a union type"),I.subtype.push(q);let Z=w.consume("or");if(!Z)break;q.tokens.separator=Z}return I.idlType.length<2&&w.error("At least two types are expected in a union type but found less"),O.close=w.consume(")")||w.error("Unterminated union type"),j(w,I),I.this}(f,y)}constructor({source:f,tokens:y}){super({source:f,tokens:y}),Object.defineProperty(this,"subtype",{value:[],writable:!0}),this.extAttrs=new b({source:f,tokens:{}})}get generic(){return this.subtype.length&&this.tokens.base?this.tokens.base.value:""}get nullable(){return Boolean(this.tokens.nullable)}get union(){return Boolean(this.subtype.length)&&!this.tokens.base}get idlType(){if(this.subtype.length)return this.subtype;return C([this.tokens.prefix,this.tokens.base,this.tokens.postfix].filter((f)=>f).map((f)=>f.value).join(" "))}*validate(f){if(yield*this.extAttrs.validate(f),this.idlType==="BufferSource")for(let O of[this.extAttrs,this.parent?.extAttrs])for(let I of O){if(I.name!=="AllowShared")continue;let q="`[AllowShared] BufferSource` is now replaced with AllowSharedBufferSource.";yield s(this.tokens.base,this,"migrate-allowshared",q,{autofix:S(this,I,O)})}if(this.idlType==="void")yield s(this.tokens.base,this,"replace-void","`void` is now replaced by `undefined`. Refer to the [relevant GitHub issue](https://github.com/whatwg/webidl/issues/60) for more information.",{autofix:(y=this,()=>{y.tokens.base.value="undefined"})});var y;let w=!this.union&&f.unique.get(this.idlType),E=this.union?this:w&&w.type==="typedef"?w.idlType:void 0;if(E&&this.nullable){let{reference:O}=i(E,f)||{};if(O){let I=(this.union?O:this).tokens.base;yield s(I,this,"no-nullable-union-dict","Nullable union cannot include a dictionary type.")}}else for(let O of this.subtype)yield*O.validate(f)}write(f){return f.ts.wrap([this.extAttrs.write(f),(()=>{if(this.union||this.generic)return f.ts.wrap([f.token(this.tokens.base,f.ts.generic),f.token(this.tokens.open),...this.subtype.map((O)=>O.write(f)),f.token(this.tokens.close)]);let y=this.tokens.prefix||this.tokens.base,w=this.tokens.prefix?[this.tokens.prefix.value,f.ts.trivia(this.tokens.base.trivia)]:[],E=f.reference(f.ts.wrap([...w,this.tokens.base.value,f.token(this.tokens.postfix)]),{unescaped:this.idlType,context:this});return f.ts.wrap([f.ts.trivia(y.trivia),E])})(),f.token(this.tokens.nullable),f.token(this.tokens.separator)])}}function S(f,y,w){return()=>{let E=w.indexOf(y);w.splice(E,1),!w.length&&f.tokens.base.trivia.match(/^\s$/)&&(f.tokens.base.trivia=""),f.tokens.base.value="AllowSharedBufferSource"}}class _ extends o{static parse(f){let y=f.consume("=");if(!y)return null;let w=G(f)||f.consumeKind("string")||f.consume("null","[","{")||f.error("No value for default"),E=[w];if(w.value==="["){let O=f.consume("]")||f.error("Default sequence value must be empty");E.push(O)}else if(w.value==="{"){let O=f.consume("}")||f.error("Default dictionary value must be empty");E.push(O)}return new _({source:f.source,tokens:{assign:y},expression:E})}constructor({source:f,tokens:y,expression:w}){super({source:f,tokens:y}),w.parent=this,Object.defineProperty(this,"expression",{value:w})}get type(){return te(this.expression[0]).type}get value(){return te(this.expression[0]).value}get negative(){return te(this.expression[0]).negative}write(f){return f.ts.wrap([f.token(this.tokens.assign),...this.expression.map((y)=>f.token(y))])}}class N extends o{static parse(f){let y=f.position,w={},E=ee(new N({source:f.source,tokens:w}));return E.extAttrs=b.parse(f),w.optional=f.consume("optional"),E.idlType=ne(f,"argument-type"),E.idlType?(w.optional||(w.variadic=f.consume("...")),w.name=f.consumeKind("identifier")||f.consume(...X),w.name?(E.default=w.optional?_.parse(f):null,E.this):f.unconsume(y)):f.unconsume(y)}get type(){return"argument"}get optional(){return!!this.tokens.optional}get variadic(){return!!this.tokens.variadic}get name(){return C(this.tokens.name.value)}*validate(f){yield*this.extAttrs.validate(f),yield*this.idlType.validate(f);let y=i(this.idlType,f,{useNullableInner:!0});if(y){if(this.idlType.nullable)yield s(this.tokens.name,this,"no-nullable-dict-arg","Dictionary arguments cannot be nullable.");else if(this.optional){if(!this.default)yield s(this.tokens.name,this,"dict-arg-default","Optional dictionary arguments must have a default value of `{}`.",{autofix:F(this)})}else if(this.parent&&!a(y.dictionary,f)&&function(E){let O=E.parent.arguments||E.parent.list,I=O.indexOf(E);return!O.slice(I+1).some((Z)=>!Z.optional)}(this))yield s(this.tokens.name,this,"dict-arg-optional","Dictionary argument must be optional if it has no required fields",{autofix:(w=this,()=>{let O=pe(w.idlType);w.tokens.optional={...O,type:"optional",value:"optional"},O.trivia=" ",F(w)()})})}var w}write(f){return f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.optional),f.ts.type(this.idlType.write(f)),f.token(this.tokens.variadic),f.name_token(this.tokens.name,{data:this}),this.default?this.default.write(f):"",f.token(this.tokens.separator)])}}function F(f){return()=>{f.default=_.parse(new be(" = {}"))}}class K extends o{static parse(f,{special:y,regular:w}={}){let E={special:y},O=ee(new K({source:f.source,tokens:E}));return y&&y.value==="stringifier"&&(E.termination=f.consume(";"),E.termination)?(O.arguments=[],O):(y||w||(E.special=f.consume("getter","setter","deleter")),O.idlType=se(f)||f.error("Missing return type"),E.name=f.consumeKind("identifier")||f.consume("includes"),E.open=f.consume("(")||f.error("Invalid operation"),O.arguments=ae(f),E.close=f.consume(")")||f.error("Unterminated operation"),E.termination=f.consume(";")||f.error("Unterminated operation, expected `;`"),O.this)}get type(){return"operation"}get name(){let{name:f}=this.tokens;return f?C(f.value):""}get special(){return this.tokens.special?this.tokens.special.value:""}*validate(f){if(yield*this.extAttrs.validate(f),!this.name&&["","static"].includes(this.special))yield s(this.tokens.open,this,"incomplete-op","Regular or static operations must have both a return type and an identifier.");if(this.idlType){if(this.idlType.generic==="async_sequence")yield s(this.idlType.tokens.base,this,"async-sequence-idl-to-js","async_sequence types cannot be returned by an operation.");yield*this.idlType.validate(f)}for(let y of this.arguments)yield*y.validate(f)}write(f){let{parent:y}=this,w=this.idlType?[f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this,parent:y}),f.token(this.tokens.open),f.ts.wrap(this.arguments.map((E)=>E.write(f))),f.token(this.tokens.close)]:[];return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),this.tokens.name?f.token(this.tokens.special):f.token(this.tokens.special,f.ts.nameless,{data:this,parent:y}),...w,f.token(this.tokens.termination)]),{data:this,parent:y})}}class J extends o{static parse(f,{special:y,noInherit:w=!1,readonly:E=!1}={}){let O=f.position,I={special:y},q=ee(new J({source:f.source,tokens:I}));if(y||w||(I.special=f.consume("inherit")),q.special==="inherit"&&f.probe("readonly")&&f.error("Inherited attributes cannot be read-only"),I.readonly=f.consume("readonly"),E&&!I.readonly&&f.probe("attribute")&&f.error("Attributes must be readonly in this context"),I.base=f.consume("attribute"),I.base)return q.idlType=ne(f,"attribute-type")||f.error("Attribute lacks a type"),I.name=f.consumeKind("identifier")||f.consume("async","required")||f.error("Attribute lacks a name"),I.termination=f.consume(";")||f.error("Unterminated attribute, expected `;`"),q.this;f.unconsume(O)}get type(){return"attribute"}get special(){return this.tokens.special?this.tokens.special.value:""}get readonly(){return!!this.tokens.readonly}get name(){return C(this.tokens.name.value)}*validate(f){if(yield*this.extAttrs.validate(f),yield*this.idlType.validate(f),["async_sequence","sequence","record"].includes(this.idlType.generic)){let y=`Attributes cannot accept ${this.idlType.generic} types.`;yield s(this.tokens.name,this,"attr-invalid-type",y)}{let{reference:y}=i(this.idlType,f)||{};if(y){let w=(this.idlType.union?y:this.idlType).tokens.base;yield s(w,this,"attr-invalid-type","Attributes cannot accept dictionary types.")}}if(this.readonly&&function(y,w){if(y.union)return!1;if(y.extAttrs.some((O)=>O.name==="EnforceRange"))return!0;let E=w.unique.get(y.idlType);return E?.type==="typedef"&&E.idlType.extAttrs.some((O)=>O.name==="EnforceRange")}(this.idlType,f)){let y=this.idlType.tokens.base;yield s(y,this,"attr-invalid-type","Readonly attributes cannot accept [EnforceRange] extended attribute.")}}write(f){let{parent:y}=this;return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.special),f.token(this.tokens.readonly),f.token(this.tokens.base),f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this,parent:y}),f.token(this.tokens.termination)]),{data:this,parent:y})}}function C(f){return f.startsWith("_")?f.slice(1):f}function L(f,{parser:y,allowDangler:w,listName:E="list"}){let O=y(f);if(!O)return[];O.tokens.separator=f.consume(",");let I=[O];for(;O.tokens.separator;){let q=y(f);if(!q){w||f.error(`Trailing comma in ${E}`);break}if(q.tokens.separator=f.consume(","),I.push(q),!q.tokens.separator)break}return I}function G(f){return f.consumeKind("decimal","integer")||f.consume("true","false","Infinity","-Infinity","NaN")}function te({type:f,value:y}){switch(f){case"decimal":case"integer":return{type:"number",value:y};case"string":return{type:"string",value:y.slice(1,-1)}}switch(y){case"true":case"false":return{type:"boolean",value:y==="true"};case"Infinity":case"-Infinity":return{type:"Infinity",negative:y.startsWith("-")};case"[":return{type:"sequence",value:[]};case"{":return{type:"dictionary"};default:return{type:y}}}function de(f){let{source:y}=f,w=function(){let O=f.consume("unsigned"),I=f.consume("short","long");if(I){let q=f.consume("long");return new P({source:y,tokens:{prefix:O,base:I,postfix:q}})}O&&f.error("Failed to parse integer type")}()||function(){let O=f.consume("unrestricted"),I=f.consume("float","double");if(I)return new P({source:y,tokens:{prefix:O,base:I}});O&&f.error("Failed to parse float type")}();if(w)return w;let E=f.consume("bigint","boolean","byte","octet","undefined");return E?new P({source:y,tokens:{base:E}}):void 0}function ae(f){return L(f,{parser:N.parse,listName:"arguments list"})}function ne(f,y){let w=b.parse(f),E=P.parse(f,y);return E&&(ee(E).extAttrs=w),E}function se(f,y){let w=P.parse(f,y||"return-type");if(w)return w;let E=f.consume("void");if(E){let O=new P({source:f.source,tokens:{base:E}});return O.type="return-type",O}}function xe(f){let y=f.consume("stringifier");if(!y)return;return J.parse(f,{special:y})||K.parse(f,{special:y})||f.error("Unterminated stringifier")}function z(f){let y=f.split(`
|
|
612
|
-
`);if(
|
|
613
|
-
${z(y)}`}}}function pe(f){if(f.extAttrs.length)return f.extAttrs.tokens.open;if(f.type==="operation"&&!f.special)return pe(f.idlType);return Object.values(f.tokens).sort((y,w)=>y.index-w.index)[0]}function ee(f,y){if(y||(y=f),!f)return f;return new Proxy(f,{get(w,E){let O=w[E];return Array.isArray(O)&&E!=="source"?ee(O,w):O},set(w,E,O){if(w[E]=O,!O)return!0;if(Array.isArray(O))for(let I of O)I.parent!==void 0&&(I.parent=y);else O.parent!==void 0&&(O.parent=y);return!0}})}let Qe={decimal:/-?(?=[0-9]*\.|[0-9]+[eE])(([0-9]+\.[0-9]*|[0-9]*\.[0-9]+)([Ee][-+]?[0-9]+)?|[0-9]+[Ee][-+]?[0-9]+)/y,integer:/-?(0([Xx][0-9A-Fa-f]+|[0-7]*)|[1-9][0-9]*)/y,identifier:/[_-]?[A-Za-z][0-9A-Z_a-z-]*/y,string:/"[^"]*"/y,whitespace:/[\t\n\r ]+/y,comment:/\/\/.*|\/\*[\s\S]*?\*\//y,other:/[^\t\n\r 0-9A-Za-z]/y},Me=["ArrayBuffer","SharedArrayBuffer","DataView","Int8Array","Int16Array","Int32Array","Uint8Array","Uint16Array","Uint32Array","Uint8ClampedArray","BigInt64Array","BigUint64Array","Float16Array","Float32Array","Float64Array","any","object","symbol"],Ge=["ByteString","DOMString","USVString"],X=["async","attribute","callback","const","constructor","deleter","dictionary","enum","getter","includes","inherit","interface","iterable","maplike","namespace","partial","required","setlike","setter","static","stringifier","typedef","unrestricted"],Bt=["-Infinity","FrozenArray","Infinity","NaN","ObservableArray","Promise","async_iterable","async_sequence","bigint","boolean","byte","double","false","float","long","mixin","null","octet","optional","or","readonly","record","sequence","short","true","undefined","unsigned","void"].concat(X,Ge,Me),Et=["(",")",",","...",":",";","<","=",">","?","*","[","]","{","}"],ce=["_constructor","toString","_toString"];class be{constructor(f){this.source=function(y){let w=[],E=0,O="",I=1,q=0;for(;E<y.length;){let oe=y.charAt(E),fe=-1;if(/[\t\n\r ]/.test(oe)?fe=Z("whitespace",{noFlushTrivia:!0}):oe==="/"&&(fe=Z("comment",{noFlushTrivia:!0})),fe!==-1){let Oe=w.pop().value;I+=(Oe.match(/\n/g)||[]).length,O+=Oe,q-=1}else if(/[-0-9.A-Z_a-z]/.test(oe)){if(fe=Z("decimal"),fe===-1&&(fe=Z("integer")),fe===-1){fe=Z("identifier");let Oe=w.length-1,Te=w[Oe];if(fe!==-1){if(ce.includes(Te.value)){let zt=`${C(Te.value)} is a reserved identifier and must not be used.`;throw new Fe(r(w,Oe,null,zt))}Bt.includes(Te.value)&&(Te.type="inline")}}}else oe==='"'&&(fe=Z("string"));for(let Oe of Et)if(y.startsWith(Oe,E)){w.push({type:"inline",value:Oe,trivia:O,line:I,index:q}),O="",E+=Oe.length,fe=E;break}if(fe===-1&&(fe=Z("other")),fe===-1)throw Error("Token stream not progressing");E=fe,q+=1}return w.push({type:"eof",value:"",trivia:O,line:I,index:q}),w;function Z(oe,{noFlushTrivia:fe}={}){let Oe=Qe[oe];Oe.lastIndex=E;let Te=Oe.exec(y);return Te?(w.push({type:oe,value:Te[0],trivia:O,line:I,index:q}),fe||(O=""),Oe.lastIndex):-1}}(f),this.position=0}error(f){throw new Fe(r(this.source,this.position,this.current,f))}probeKind(f){return this.source.length>this.position&&this.source[this.position].type===f}probe(f){return this.probeKind("inline")&&this.source[this.position].value===f}consumeKind(...f){for(let y of f){if(!this.probeKind(y))continue;let w=this.source[this.position];return this.position++,w}}consume(...f){if(!this.probeKind("inline"))return;let y=this.source[this.position];for(let w of f)if(y.value===w)return this.position++,y}consumeIdentifier(f){if(this.probeKind("identifier")&&this.source[this.position].value===f)return this.consumeKind("identifier")}unconsume(f){this.position=f}}class Fe extends Error{constructor({message:f,bareMessage:y,context:w,line:E,sourceName:O,input:I,tokens:q}){super(f),this.name="WebIDLParseError",this.bareMessage=y,this.context=w,this.line=E,this.sourceName=O,this.input=I,this.tokens=q}}class Le extends l{static parse(f){let y=f.consumeKind("string");if(y)return new Le({source:f.source,tokens:{value:y}})}get type(){return"enum-value"}get value(){return super.value.slice(1,-1)}write(f){let{parent:y}=this;return f.ts.wrap([f.ts.trivia(this.tokens.value.trivia),f.ts.definition(f.ts.wrap(['"',f.ts.name(this.value,{data:this,parent:y}),'"']),{data:this,parent:y}),f.token(this.tokens.separator)])}}class ot extends o{static parse(f){let y={};if(y.base=f.consume("enum"),!y.base)return;y.name=f.consumeKind("identifier")||f.error("No name for enum");let w=ee(new ot({source:f.source,tokens:y}));return f.current=w.this,y.open=f.consume("{")||f.error("Bodyless enum"),w.values=L(f,{parser:Le.parse,allowDangler:!0,listName:"enumeration"}),f.probeKind("string")&&f.error("No comma between enum values"),y.close=f.consume("}")||f.error("Unexpected value in enum"),w.values.length||f.error("No value in enum"),y.termination=f.consume(";")||f.error("No semicolon after enum"),w.this}get type(){return"enum"}get name(){return C(this.tokens.name.value)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base),f.name_token(this.tokens.name,{data:this}),f.token(this.tokens.open),f.ts.wrap(this.values.map((y)=>y.write(f))),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this})}}class Nr extends o{static parse(f){let y=f.consumeKind("identifier");if(!y)return;let w={target:y};if(w.includes=f.consume("includes"),w.includes)return w.mixin=f.consumeKind("identifier")||f.error("Incomplete includes statement"),w.termination=f.consume(";")||f.error("No terminating ; for includes statement"),new Nr({source:f.source,tokens:w});f.unconsume(y.index)}get type(){return"includes"}get target(){return C(this.tokens.target.value)}get includes(){return C(this.tokens.mixin.value)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.reference_token(this.tokens.target,this),f.token(this.tokens.includes),f.reference_token(this.tokens.mixin,this),f.token(this.tokens.termination)]),{data:this})}}class nr extends o{static parse(f){let y={},w=ee(new nr({source:f.source,tokens:y}));if(y.base=f.consume("typedef"),y.base)return w.idlType=ne(f,"typedef-type")||f.error("Typedef lacks a type"),y.name=f.consumeKind("identifier")||f.error("Typedef lacks a name"),f.current=w.this,y.termination=f.consume(";")||f.error("Unterminated typedef, expected `;`"),w.this}get type(){return"typedef"}get name(){return C(this.tokens.name.value)}*validate(f){yield*this.idlType.validate(f)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base),f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this}),f.token(this.tokens.termination)]),{data:this})}}class Xs extends o{static parse(f,y){let w={base:y},E=ee(new Xs({source:f.source,tokens:w}));return w.name=f.consumeKind("identifier")||f.error("Callback lacks a name"),f.current=E.this,w.assign=f.consume("=")||f.error("Callback lacks an assignment"),E.idlType=se(f)||f.error("Callback lacks a return type"),w.open=f.consume("(")||f.error("Callback lacks parentheses for arguments"),E.arguments=ae(f),w.close=f.consume(")")||f.error("Unterminated callback"),w.termination=f.consume(";")||f.error("Unterminated callback, expected `;`"),E.this}get type(){return"callback"}get name(){return C(this.tokens.name.value)}*validate(f){yield*this.extAttrs.validate(f);for(let y of this.arguments)if(yield*y.validate(f),y.idlType.generic==="async_sequence")yield s(y.tokens.name,y,"async-sequence-idl-to-js","async_sequence types cannot be returned as a callback argument.");yield*this.idlType.validate(f)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base),f.name_token(this.tokens.name,{data:this}),f.token(this.tokens.assign),f.ts.type(this.idlType.write(f)),f.token(this.tokens.open),...this.arguments.map((y)=>y.write(f)),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this})}}class pt extends o{static parse(f,y,{inheritable:w,allowedMembers:E}){let{tokens:O,type:I}=y;for(O.name=f.consumeKind("identifier")||f.error(`Missing name in ${I}`),f.current=y,y=ee(y),w&&Object.assign(O,function(q){let Z=q.consume(":");return Z?{colon:Z,inheritance:q.consumeKind("identifier")||q.error("Inheritance lacks a type")}:{}}(f)),O.open=f.consume("{")||f.error(`Bodyless ${I}`),y.members=[];;){if(O.close=f.consume("}"),O.close)return O.termination=f.consume(";")||f.error(`Missing semicolon after ${I}`),y.this;let q=b.parse(f),Z;for(let[oe,...fe]of E)if(Z=ee(oe(f,...fe)),Z)break;Z||f.error("Unknown member"),Z.extAttrs=q,y.members.push(Z.this)}}get partial(){return!!this.tokens.partial}get name(){return C(this.tokens.name.value)}get inheritance(){return this.tokens.inheritance?C(this.tokens.inheritance.value):null}*validate(f){for(let y of this.members)y.validate&&(yield*y.validate(f))}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.callback),f.token(this.tokens.partial),f.token(this.tokens.base),f.token(this.tokens.mixin),f.name_token(this.tokens.name,{data:this}),(()=>this.tokens.inheritance?f.ts.wrap([f.token(this.tokens.colon),f.ts.trivia(this.tokens.inheritance.trivia),f.ts.inheritance(f.reference(this.tokens.inheritance.value,{context:this}))]):"")(),f.token(this.tokens.open),f.ts.wrap(this.members.map((y)=>y.write(f))),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this})}}class Pn extends o{static parse(f){let y={};if(y.base=f.consume("const"),!y.base)return;let w=de(f);if(!w){let O=f.consumeKind("identifier")||f.error("Const lacks a type");w=new P({source:f.source,tokens:{base:O}})}f.probe("?")&&f.error("Unexpected nullable constant type"),w.type="const-type",y.name=f.consumeKind("identifier")||f.error("Const lacks a name"),y.assign=f.consume("=")||f.error("Const lacks value assignment"),y.value=G(f)||f.error("Const lacks a value"),y.termination=f.consume(";")||f.error("Unterminated const, expected `;`");let E=new Pn({source:f.source,tokens:y});return ee(E).idlType=w,E}get type(){return"const"}get name(){return C(this.tokens.name.value)}get value(){return te(this.tokens.value)}write(f){let{parent:y}=this;return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base),f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this,parent:y}),f.token(this.tokens.assign),f.token(this.tokens.value),f.token(this.tokens.termination)]),{data:this,parent:y})}}class It extends o{static parse(f){let y=f.position,w=ee(new It({source:f.source,tokens:{}})),{tokens:E}=w;if(E.readonly=f.consume("readonly"),E.readonly||(E.async=f.consume("async")),E.base=E.readonly?f.consume("maplike","setlike"):E.async?f.consume("iterable"):f.consume("iterable","async_iterable","maplike","setlike"),!E.base)return void f.unconsume(y);let{type:O}=w,I=O==="maplike",q=I||O==="iterable"||O==="async_iterable",Z=O==="async_iterable"||w.async&&O==="iterable";E.open=f.consume("<")||f.error(`Missing less-than sign \`<\` in ${O} declaration`);let oe=ne(f)||f.error(`Missing a type argument in ${O} declaration`);return w.idlType=[oe],w.arguments=[],q&&(oe.tokens.separator=f.consume(","),oe.tokens.separator?w.idlType.push(ne(f)):I&&f.error(`Missing second type argument in ${O} declaration`)),E.close=f.consume(">")||f.error(`Missing greater-than sign \`>\` in ${O} declaration`),f.probe("(")&&(Z?(E.argsOpen=f.consume("("),w.arguments.push(...ae(f)),E.argsClose=f.consume(")")||f.error("Unterminated async iterable argument list")):f.error("Arguments are only allowed for `async iterable`")),E.termination=f.consume(";")||f.error(`Missing semicolon after ${O} declaration`),w.this}get type(){return this.tokens.base.value}get readonly(){return!!this.tokens.readonly}get async(){return!!this.tokens.async}*validate(f){if(this.async&&this.type==="iterable")yield s(this.tokens.async,this,"obsolete-async-iterable-syntax","`async iterable` is now changed to `async_iterable`.",{autofix:(y=this,()=>{let E=y.tokens.async;y.tokens.base={...E,type:"async_iterable",value:"async_iterable"},delete y.tokens.async})});var y;for(let w of this.idlType)yield*w.validate(f);for(let w of this.arguments)yield*w.validate(f)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.readonly),f.token(this.tokens.async),f.token(this.tokens.base,f.ts.generic),f.token(this.tokens.open),f.ts.wrap(this.idlType.map((y)=>y.write(f))),f.token(this.tokens.close),f.token(this.tokens.argsOpen),f.ts.wrap(this.arguments.map((y)=>y.write(f))),f.token(this.tokens.argsClose),f.token(this.tokens.termination)]),{data:this,parent:this.parent})}}class Fo extends o{static parse(f){let y=f.consume("constructor");if(!y)return;let w={base:y};w.open=f.consume("(")||f.error("No argument list in constructor");let E=ae(f);w.close=f.consume(")")||f.error("Unterminated constructor"),w.termination=f.consume(";")||f.error("No semicolon after constructor");let O=new Fo({source:f.source,tokens:w});return ee(O).arguments=E,O}get type(){return"constructor"}*validate(f){for(let y of this.arguments)yield*y.validate(f)}write(f){let{parent:y}=this;return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base,f.ts.nameless,{data:this,parent:y}),f.token(this.tokens.open),f.ts.wrap(this.arguments.map((w)=>w.write(f))),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this,parent:y})}}function ns(f){let y=f.consume("static");if(!y)return;return J.parse(f,{special:y})||K.parse(f,{special:y})||f.error("No body in static member")}class rr extends pt{static parse(f,y,{extMembers:w=[],partial:E=null}={}){let O={partial:E,base:y};return pt.parse(f,new rr({source:f.source,tokens:O}),{inheritable:!E,allowedMembers:[...w,[Pn.parse],[Fo.parse],[ns],[xe],[It.parse],[J.parse],[K.parse]]})}get type(){return"interface"}*validate(f){if(yield*this.extAttrs.validate(f),!this.partial&&this.extAttrs.every((w)=>w.name!=="Exposed"))yield s(this.tokens.name,this,"require-exposed","Interfaces must have `[Exposed]` extended attribute. To fix, add, for example, `[Exposed=Window]`. Please also consider carefully if your interface should also be exposed in a Worker scope. Refer to the [WebIDL spec section on Exposed](https://heycam.github.io/webidl/#Exposed) for more information.",{autofix:ye(this)});let y=this.extAttrs.filter((w)=>w.name==="Constructor");for(let w of y)yield s(w.tokens.name,this,"constructor-member","Constructors should now be represented as a `constructor()` operation on the interface instead of `[Constructor]` extended attribute. Refer to the [WebIDL spec section on constructor operations](https://heycam.github.io/webidl/#idl-constructors) for more information.",{autofix:ya(this,w)});if(this.extAttrs.some((w)=>w.name==="Global")){let w=this.extAttrs.filter((O)=>O.name==="LegacyFactoryFunction");for(let O of w)yield s(O.tokens.name,this,"no-constructible-global","Interfaces marked as `[Global]` cannot have factory functions.");let E=this.members.filter((O)=>O.type==="constructor");for(let O of E)yield s(O.tokens.base,this,"no-constructible-global","Interfaces marked as `[Global]` cannot have constructors.")}yield*super.validate(f),this.partial||(yield*function*(w,E){let O=function(fe){let Oe=oe(fe);return{statics:new Set(Oe.filter((Te)=>Te.special==="static").map((Te)=>Te.name)),nonstatics:new Set(Oe.filter((Te)=>Te.special!=="static").map((Te)=>Te.name))}}(E),I=w.partials.get(E.name)||[],q=w.mixinMap.get(E.name)||[];for(let fe of[...I,...q]){let Oe=oe(fe),Te=Oe.filter((tn)=>tn.special==="static"),zt=Oe.filter((tn)=>tn.special!=="static");yield*Z(Te,O.statics,fe,E),yield*Z(zt,O.nonstatics,fe,E),Te.forEach((tn)=>O.statics.add(tn.name)),zt.forEach((tn)=>O.nonstatics.add(tn.name))}function*Z(fe,Oe,Te,zt){for(let tn of fe){let{name:ba}=tn;if(ba&&Oe.has(ba)){let Qf=`The ${tn.special==="static"?"static ":""}operation "${ba}" has already been defined for the base interface "${zt.name}" either in itself or in a mixin`;yield s(tn.tokens.name,Te,"no-cross-overload",Qf)}}}function oe(fe){return fe.members.filter(({type:Oe})=>Oe==="operation")}}(f,this))}}function ya(f,y){return f=ee(f),()=>{let w=z(f.extAttrs.tokens.open.trivia),E=f.members.length?z(pe(f.members[0]).trivia):function(Oe){let Te=z(Oe),zt=Te.includes("\t")?"\t":" ";return Te+zt}(w),O=Fo.parse(new be(`
|
|
614
|
-
${
|
|
615
|
-
`)||(
|
|
616
|
-
${w}`);let{extAttrs:Z}=f,oe=Z.indexOf(y),fe=Z.splice(oe,1);Z.length?Z.length===oe?Z[oe-1].tokens.separator=void 0:Z[oe].tokens.name.trivia.trim()||(Z[oe].tokens.name.trivia=fe[0].tokens.name.trivia):Z.tokens.open=Z.tokens.close=void 0}}class Ys extends pt{static parse(f,y,{extMembers:w=[],partial:E}={}){let O={partial:E,base:y};if(O.mixin=f.consume("mixin"),O.mixin)return pt.parse(f,new Ys({source:f.source,tokens:O}),{allowedMembers:[...w,[Pn.parse],[xe],[J.parse,{noInherit:!0}],[K.parse,{regular:!0}]]})}get type(){return"interface mixin"}}class Lo extends o{static parse(f){let y={},w=ee(new Lo({source:f.source,tokens:y}));return w.extAttrs=b.parse(f),y.required=f.consume("required"),w.idlType=ne(f,"dictionary-type")||f.error("Dictionary member lacks a type"),y.name=f.consumeKind("identifier")||f.error("Dictionary member lacks a name"),w.default=_.parse(f),y.required&&w.default&&f.error("Required member must not have a default"),y.termination=f.consume(";")||f.error("Unterminated dictionary member, expected `;`"),w.this}get type(){return"field"}get name(){return C(this.tokens.name.value)}get required(){return!!this.tokens.required}*validate(f){yield*this.idlType.validate(f)}write(f){let{parent:y}=this;return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.required),f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this,parent:y}),this.default?this.default.write(f):"",f.token(this.tokens.termination)]),{data:this,parent:y})}}class Vo extends pt{static parse(f,{extMembers:y=[],partial:w}={}){let E={partial:w};if(E.base=f.consume("dictionary"),E.base)return pt.parse(f,new Vo({source:f.source,tokens:E}),{inheritable:!w,allowedMembers:[...y,[Lo.parse]]})}get type(){return"dictionary"}}class Zs extends pt{static parse(f,{extMembers:y=[],partial:w}={}){let E={partial:w};if(E.base=f.consume("namespace"),E.base)return pt.parse(f,new Zs({source:f.source,tokens:E}),{allowedMembers:[...y,[J.parse,{noInherit:!0,readonly:!0}],[Pn.parse],[K.parse,{regular:!0}]]})}get type(){return"namespace"}*validate(f){if(!this.partial&&this.extAttrs.every((y)=>y.name!=="Exposed"))yield s(this.tokens.name,this,"require-exposed","Namespaces must have [Exposed] extended attribute. To fix, add, for example, [Exposed=Window]. Please also consider carefully if your namespace should also be exposed in a Worker scope. Refer to the [WebIDL spec section on Exposed](https://heycam.github.io/webidl/#Exposed) for more information.",{autofix:ye(this)});yield*super.validate(f)}}class qo extends pt{static parse(f,y,{extMembers:w=[]}={}){let E={callback:y};if(E.base=f.consume("interface"),E.base)return pt.parse(f,new qo({source:f.source,tokens:E}),{allowedMembers:[...w,[Pn.parse],[K.parse,{regular:!0}]]})}get type(){return"callback interface"}}function Yf(f,y){let w=f.source;function E(oe){f.error(oe)}function O(...oe){return f.consume(...oe)}function I(oe){let fe=O("interface");if(fe)return Ys.parse(f,fe,{...oe,...y?.extensions?.mixin})||rr.parse(f,fe,{...oe,...y?.extensions?.interface})||E("Interface has no proper body")}function q(){if(y.productions)for(let oe of y.productions){let fe=oe(f);if(fe)return fe}return function(){let oe=O("callback");if(oe)return f.probe("interface")?qo.parse(f,oe,{...y?.extensions?.callbackInterface}):Xs.parse(f,oe)}()||I()||function(){let oe=O("partial");if(oe)return Vo.parse(f,{partial:oe,...y?.extensions?.dictionary})||I({partial:oe})||Zs.parse(f,{partial:oe,...y?.extensions?.namespace})||E("Partial doesn't apply to anything")}()||Vo.parse(f,y?.extensions?.dictionary)||ot.parse(f)||nr.parse(f)||Nr.parse(f)||Zs.parse(f,y?.extensions?.namespace)}let Z=function(){if(!w.length)return[];let oe=[];for(;;){let Oe=b.parse(f),Te=q();if(!Te){Oe.length&&E("Stray extended attributes");break}ee(Te).extAttrs=Oe,oe.push(Te)}let fe=u.parse(f);return y.concrete&&oe.push(fe),oe}();return f.position<w.length&&E("Unrecognised tokens"),Z}function Zf(f,y={}){let w=new be(f);return y.sourceName!==void 0&&(w.source.name=y.sourceName),Yf(w,y)}function Ot(f){return f}let Wo={wrap:(f)=>f.join(""),trivia:Ot,name:Ot,reference:Ot,type:Ot,generic:Ot,nameless:Ot,inheritance:Ot,definition:Ot,extendedAttribute:Ot,extendedAttributeReference:Ot};class xa{constructor(f){this.ts=Object.assign({},Wo,f)}reference(f,{unescaped:y,context:w}){return y||(y=f.startsWith("_")?f.slice(1):f),this.ts.reference(f,y,w)}token(f,y=Ot,...w){if(!f)return"";let E=y(f.value,...w);return this.ts.wrap([this.ts.trivia(f.trivia),E])}reference_token(f,y){return this.token(f,this.reference.bind(this),{context:y})}name_token(f,y){return this.token(f,this.ts.name,y)}identifier(f,y){return this.ts.wrap([this.reference_token(f.tokens.value,y),this.token(f.tokens.separator)])}}function Qs(f,{templates:y=Wo}={}){y=Object.assign({},Wo,y);let w=new xa(y);return y.wrap(f.map((E)=>E.write(w)))}function A(f,y){let w=new Map,E=f.filter((O)=>O.type==="includes");for(let O of E){let I=y.get(O.includes);if(!I)continue;let q=w.get(O.target);q?q.push(I):w.set(O.target,[I])}return w}function*H(f){let y=function(w){let E=new Map,O=new Set,I=new Map;for(let q of w)if(q.partial){let Z=I.get(q.name);Z?Z.push(q):I.set(q.name,[q])}else q.name&&(E.has(q.name)?O.add(q):E.set(q.name,q));return{all:w,unique:E,partials:I,duplicates:O,mixinMap:A(w,E),cache:{typedefIncludesDictionary:new WeakMap,dictionaryIncludesRequiredField:new WeakMap}}}(f);for(let w of y.all)w.validate&&(yield*w.validate(y));yield*function*({unique:w,duplicates:E}){for(let O of E){let{name:I}=O,q=`The name "${I}" of type "${w.get(I).type}" was already seen`;yield s(O.tokens.name,O,"no-duplicate",q)}}(y)}function U(f){return[...H((y=f,y.flat?y.flat():[].concat(...y)))];var y}return t})())});var n0=W(function(N7,t0){var __dirname="/home/runner/work/jx/jx/node_modules/@webref/idl",Yv=it("fs").promises,Wu=it("path"),Zv=Xv();class Qv{constructor(e,t){this.filename=t,this.shortname=Wu.basename(t,".idl"),this.path=Wu.join(e,t)}async text(){return await Yv.readFile(this.path,"utf8")}async parse(){let e=await this.text();return Zv.parse(e)}}async function e0({folder:e=__dirname}={}){let t={},n=await Yv.readdir(e);for(let r of n)if(r.endsWith(".idl")){let s=new Qv(e,r);t[s.shortname]=s}return t}async function hF(e){let t=await e0(e);for(let[n,r]of Object.entries(t))t[n]=await r.parse();return t}t0.exports={listAll:e0,parseAll:hF}});var r0,s0;var o0=T(()=>{r0={anyOf:[{additionalProperties:!1,description:"Two-way: `target` is the test, `value` the tag when it is truthy, `initial` the tag when it is not.",properties:{initial:{$ref:"#/$defs/TagName"},operator:{const:"?:",type:"string"},target:{$ref:"#/$defs/ExpressionOperand"},value:{$ref:"#/$defs/TagName"}},required:["operator","target","value","initial"],title:"?: — the tag when the test holds, and the tag when it does not"},{additionalProperties:!1,description:"Multiway: `target` is the discriminant, matched against case keys by its string form. "+"`default` is required — an element with no tag cannot exist.",properties:{cases:{additionalProperties:{$ref:"#/$defs/TagName"},type:"object"},default:{$ref:"#/$defs/TagName"},operator:{const:"switch",type:"string"},target:{$ref:"#/$defs/ExpressionOperand"}},required:["operator","target","cases","default"],title:"switch — one tag per discriminant value, with a required fallback"}],description:"A tag name chosen at element creation. Every branch resolves to a `TagName`, so the candidate set is enumerable without evaluating anything."},s0={anyOf:[{$ref:"#/$defs/TagName"},{additionalProperties:!1,properties:{$expression:{$ref:"#/$defs/TagExpression"}},required:["$expression"],type:"object"}]}});var i0;var a0=T(()=>{i0={description:"HTML element tag name or custom element name (must contain a hyphen per Web Components spec). "+"A NAME, never an expression: no `${…}` position in the pipeline evaluates a tagName. Use "+"`$switch`/`cases` to vary the element.",minLength:1,pattern:"^[a-zA-Z][a-zA-Z0-9._-]*$",type:"string"}});var c0,l0,u0;var f0=T(()=>{c0={oneOf:[{type:"string"},{$ref:"#/$defs/RefObject"}]},l0={oneOf:[{type:"boolean"},{$ref:"#/$defs/RefObject"}]},u0={oneOf:[{type:"number"},{$ref:"#/$defs/RefObject"}]}});var d0;var p0=T(()=>{d0={additionalProperties:!0,description:"A page-level <head> entry. Defines meta tags, link tags, script tags, etc.",properties:{attributes:{additionalProperties:{oneOf:[{type:"string"},{type:"boolean"}]},type:"object"},children:{items:{$ref:"#/$defs/HeadEntry"},type:"array"},tagName:{type:"string"},textContent:{description:"Element content. An object is serialized to JSON inside the tag — that is how a "+'JSON-LD block (`<script type="application/ld+json">`) is authored.',oneOf:[{type:"string"},{type:"object"}]}},required:["tagName"],type:"object"}});var m0,h0;var g0=T(()=>{m0={description:"A CEM-compatible parameter definition for a function. Follows the Custom Elements Manifest Parameter shape.",properties:{default:{description:"Default value for the parameter."},description:{description:"Parameter documentation.",type:"string"},name:{description:"Parameter name.",type:"string"},optional:{description:"Whether the parameter is optional.",type:"boolean"},type:{description:"Parameter type (JSON Schema or CEM { text } format)."}},required:["name"],type:"object"},h0={description:"A CEM-compatible event definition. Describes a CustomEvent the function dispatches.",properties:{deprecated:{description:"Deprecation notice.",oneOf:[{type:"boolean"},{type:"string"}]},description:{description:"Event documentation.",type:"string"},name:{description:"Event name (e.g. 'task-toggled').",type:"string"},type:{description:"Event type (e.g. { text: 'CustomEvent' })."}},required:["name"],type:"object"}});var y0;var x0=T(()=>{y0={enum:["string","number","integer","boolean","array","object","null"],type:"string"}});var b0,$0,w0,S0,v0,E0,j0,P0,_0;var k0=T(()=>{b0={description:"Reference to a $defs type definition in the current component.",examples:["#/$defs/Count","#/$defs/TodoItem","#/$defs/Status"],pattern:String.raw`^#/\$defs/`,type:"string"},$0={description:"Reference to a state entry (runtime variable) in the current component.",examples:["#/state/count","#/state/addTask","#/state/items"],pattern:"^#/state/",type:"string"},w0={description:"Reference to an external Jx component file.",examples:["./card.json","https://cdn.example.com/button.json"],pattern:String.raw`^(\./|\.\./).*\.json$|^https?://`,type:"string"},S0={description:"Reference to a window or document global.",examples:["window#/currentUser","document#/appConfig"],pattern:"^(window|document)#/",type:"string"},v0={description:"Reference to a named state entry passed via $props from a parent component.",examples:["parent#/sharedState","parent#/theme"],pattern:"^parent#/",type:"string"},E0={description:"Reference to the current Array map iteration context.",examples:["$map/item","$map/index","$map/item/text","$map/item/done"],pattern:String.raw`^\$map/(item|index)(/.*)?$`,type:"string"},j0={oneOf:[{$ref:"#/$defs/InternalRef"},{$ref:"#/$defs/StateRef"},{$ref:"#/$defs/ExternalRef"},{$ref:"#/$defs/GlobalRef"},{$ref:"#/$defs/ParentRef"},{$ref:"#/$defs/MapRef"}],type:"string"},P0={additionalProperties:!1,description:"A $ref binding. Resolves to a state entry (reactive) or plain value (static).",properties:{$ref:{$ref:"#/$defs/AnyRef"}},required:["$ref"],type:"object"},_0={properties:{$props:{$ref:"#/$defs/PropsObject"},$ref:{$ref:"#/$defs/ExternalRef"}},required:["$ref"],type:"object"}});var Hu;var O0=T(()=>{Hu={additionalProperties:{anyOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/RefObject"},{$ref:"#/$defs/StyleObject"}]},description:"CSS style definition. camelCase property names follow CSSOM convention. Keys starting with :, ., &, or [ are treated as nested CSS selectors. Keys matching $media breakpoint names (or other @-prefixed at-rules) group nested rules. Nesting is recursive: selector and at-rule groups may nest to arbitrary depth "+"(e.g. breakpoint → selector → pseudo-class), mirroring the compiler's recursive emission. "+"An object carrying $ref is a reactive VALUE, and the runtime reads it as one. It also matches the nested-block branch vacuously, since a block admits a string under any key, which is why these branches are anyOf rather than oneOf. A DECLARATION at-rule (@font-face, @property, @position-try, @counter-style) may hold an ARRAY of blocks, which is that key written more than once, in order: an object's keys are "+"unique, so @font-face — the at-rule whose identity is not in its key — could not otherwise "+"state a family's second weight at all.",patternProperties:{"^@(font-face|property|position-try|counter-style)":{anyOf:[{$ref:"#/$defs/StyleObject"},{items:{$ref:"#/$defs/StyleObject"},minItems:1,type:"array"}]}},properties:{$description:{description:"Why this rule exists. Emitted as a comment by static builds, ignored at runtime.",type:"string"}},type:"object"}});var A0,R0;var C0=T(()=>{A0={additionalProperties:!1,description:"Dynamic mapped list. Re-renders when the items state entry changes.",properties:{$prototype:{const:"Array",type:"string"},filter:{$ref:"#/$defs/RefObject"},items:{oneOf:[{$ref:"#/$defs/RefObject"},{type:"array"}]},key:{additionalProperties:!1,description:"The identity of each rendered row: a $map/item pointer read per item. A row whose key survives a change keeps its DOM node and its effects across reorders, insertions and "+"removals; without a key, rows are keyed by index. $map/index is not a key — an index "+"names a position, not a row.",properties:{$ref:{pattern:String.raw`^\$map/item(/.+)?$`,type:"string"}},required:["$ref"],type:"object"},map:{$ref:"#/$defs/ElementDef"},sort:{$ref:"#/$defs/RefObject"}},required:["$prototype","items","map"],type:"object"},R0={description:"Array of child definitions — elements, text, or Array namespaces (dynamic lists) mixed "+"freely. A bare Array namespace (the whole children slot is one dynamic list) is also "+"accepted for backward compatibility, as is a ${…} template string that resolves at build "+"time to an array of child definitions.",oneOf:[{items:{anyOf:[{$ref:"#/$defs/ElementDef"},{$ref:"#/$defs/SwitchNode"},{$ref:"#/$defs/ArrayNamespace"},{type:"string"},{type:"number"}]},type:"array"},{$ref:"#/$defs/ArrayNamespace"},{description:"Computed children — a ${…} template that resolves at build time to an array of child "+'definitions (e.g. "${state.entry.$children}" for parsed content). A bare plain-text string is NOT a valid children value; text children must be array items.',pattern:String.raw`\$\{`,type:"string"}]}});var N0,T0,J0,I0,M0,sh;var D0=T(()=>{N0={additionalProperties:{oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{$ref:"#/$defs/RefObject"}]},description:"HTML attributes and ARIA attributes set via element.setAttribute().",type:"object"},T0={additionalProperties:{anyOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"array"},{type:"object"},{$ref:"#/$defs/RefObject"}]},description:"Explicit prop passing at a component boundary.",type:"object"},J0={oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"null"},{$ref:"#/$defs/RefObject"}]},I0={additionalProperties:!1,description:"Reactive $ref that drives which case to render: a state entry, or inside a mapped array's template the row's $map/item or $map/index (spec §14.1).",properties:{$ref:{oneOf:[{$ref:"#/$defs/StateRef"},{$ref:"#/$defs/MapRef"}],type:"string"}},required:["$ref"],type:"object"},M0={properties:{$switch:{$ref:"#/$defs/SwitchDef"},cases:{additionalProperties:{oneOf:[{$ref:"#/$defs/ElementDef"},{$ref:"#/$defs/ExternalComponentRef"}]},type:"object"},tagName:{$ref:"#/$defs/TagName"}},required:["$switch","cases"],type:"object"},sh={additionalProperties:{$ref:"#/$defs/ElementPropertyValue"},description:"A Jx element definition. Maps directly to a DOM element.",properties:{"$map/index":{$ref:"#/$defs/RefObject"},"$map/item":{$ref:"#/$defs/RefObject"},$props:{$ref:"#/$defs/PropsObject"},$ref:{$ref:"#/$defs/ExternalRef"},$switch:{$ref:"#/$defs/SwitchDef"},alt:{$ref:"#/$defs/StringOrRef"},attributes:{$ref:"#/$defs/AttributesObject"},cases:{additionalProperties:{oneOf:[{$ref:"#/$defs/ElementDef"},{$ref:"#/$defs/ExternalComponentRef"}]},description:"Switch cases for this element. Maps case values to element definitions or external component refs, rendered according to the reactive $switch discriminant.",type:"object"},checked:{$ref:"#/$defs/BoolOrRef"},children:{$ref:"#/$defs/ChildrenValue"},className:{$ref:"#/$defs/StringOrRef"},dir:{enum:["ltr","rtl","auto"],type:"string"},disabled:{$ref:"#/$defs/BoolOrRef"},hidden:{$ref:"#/$defs/BoolOrRef"},href:{$ref:"#/$defs/StringOrRef"},id:{type:"string"},innerHTML:{$ref:"#/$defs/StringOrRef"},innerText:{$ref:"#/$defs/StringOrRef"},lang:{$ref:"#/$defs/StringOrRef"},name:{$ref:"#/$defs/StringOrRef"},placeholder:{$ref:"#/$defs/StringOrRef"},selected:{$ref:"#/$defs/BoolOrRef"},src:{$ref:"#/$defs/StringOrRef"},style:{$ref:"#/$defs/StyleObject"},tabIndex:{$ref:"#/$defs/NumberOrRef"},tagName:{$ref:"#/$defs/ElementTagName"},textContent:{$ref:"#/$defs/StringOrRef"},title:{$ref:"#/$defs/StringOrRef"},type:{$ref:"#/$defs/StringOrRef"},value:{$ref:"#/$defs/StringOrRef"}},required:["tagName"],type:"object"}});var F0;var L0=T(()=>{F0={description:"A typed reactive state variable with explicit type and default value. The type property is a JSON Schema or $ref to a $defs type definition. The default property is the initial runtime value.",not:{required:["$prototype"]},properties:{$ref:{description:"Reference to a shared type definition.",type:"string"},attribute:{description:"Linked HTML attribute name for CEM extraction.",type:"string"},default:{description:"Initial state value."},deprecated:{description:"Deprecation notice for CEM extraction.",oneOf:[{type:"boolean"},{type:"string"}]},description:{type:"string"},examples:{type:"array"},reflects:{description:"Whether property changes reflect back to the HTML attribute.",type:"boolean"},type:{description:"JSON Schema type definition, $ref to a $defs type, or JSON Schema type string.",oneOf:[{type:"string"},{type:"object"}]}},required:["default"],type:"object"}});var V0;var q0=T(()=>{V0={additionalProperties:!1,description:'A function declaration. $prototype must be "Function". body (inline) and $src (external) are mutually exclusive; declaring both is an error. First parameter is always state (the reactive scope).',not:{required:["body","$src"]},properties:{$export:{description:"Named export in $src module. Defaults to the state key name.",type:"string"},$lazy:{description:"Load $src on first call instead of importing it up front. The function then returns a "+"promise, so it may only be called from a handler or lifecycle hook — never bound as a "+"computed value. Use it for code most visitors never reach.",type:"boolean"},$prototype:{const:"Function",type:"string"},$src:{description:"External module specifier. Mutually exclusive with body.",examples:["./counter.js","npm:@myorg/validators"],type:"string"},arguments:{description:"Legacy alias for parameters: bare string parameter names (state may be listed explicitly as the first name). Superseded by parameters.",examples:[["state","event"]],items:{type:"string"},type:"array"},body:{description:"Inline function body: a source string in erasable TypeScript, which plain JavaScript already is (spec §23.1; types are erased before it is analysed or run; first implicit parameter is state), or a structured statement array (spec §20) — explicit structured function declaration, analyzable by tooling and editable visually. The escalation ladder within the shape is structured statements → source string.",examples:["state.count++",'state.items.push({ id: Date.now(), text: "", done: false })','return state.score >= 90 ? "gold" : "silver"',"const input = event.target as HTMLInputElement; state.label = input.value",[{operator:"push",target:{$ref:"#/state/cart"},value:1},{dispatchEvent:"cart-changed",detail:{$ref:"#/state/cart"}}]],oneOf:[{type:"string"},{$ref:"#/$defs/StatementList"}]},description:{type:"string"},emits:{description:"Array of CEM-compatible Event objects this function dispatches. Used for CEM extraction and studio event discovery.",items:{$ref:"#/$defs/CemEvent"},type:"array"},name:{description:"Explicit function name. Defaults to the state key name.",type:"string"},parameters:{description:"Function parameters (after the implicit state parameter). Accepts CEM-compatible parameter objects or bare string names for backward compatibility.",examples:[["event"],[{name:"event",type:{text:"Event"}}],[{description:"Item identifier",name:"id",type:{text:"number"}}]],items:{oneOf:[{type:"string"},{$ref:"#/$defs/CemParameter"}]},type:"array"},type:{description:"Return type for tooling (JSON Schema or CEM { text } format)."}},required:["$prototype"],type:"object"}});var W0,H0;var U0=T(()=>{W0={description:"One statement of a structured function body. Either a bare expression node in statement position (a mutation like =/push, or a call — its result discarded unless captured by an assignment), an if/then/else branch (JSON Schema conditional keywords; if holds a pure expression, then/else hold statement lists), a $switch multiway branch (discriminant matched by string form against cases keys, like element-level $switch), a dispatchEvent statement (WHATWG DOM: dispatches a CustomEvent from the handler's current target, with CustomEventInit members detail/bubbles/composed), or the two WHATWG event verbs stopPropagation and preventDefault, each spelled as the member set to true.",oneOf:[{$ref:"#/$defs/ExpressionNode"},{additionalProperties:!1,properties:{else:{items:{$ref:"#/$defs/Statement"},type:"array"},if:{$ref:"#/$defs/ExpressionOperand"},then:{items:{$ref:"#/$defs/Statement"},type:"array"}},required:["if","then"],title:"if / then / else — conditional branch (JSON Schema keyword triple)",type:"object"},{additionalProperties:!1,properties:{$switch:{$ref:"#/$defs/ExpressionOperand"},cases:{additionalProperties:{items:{$ref:"#/$defs/Statement"},type:"array"},type:"object"},default:{items:{$ref:"#/$defs/Statement"},type:"array"}},required:["$switch","cases"],title:"$switch / cases — multiway branch (element-level convention, ECMA switch semantics)",type:"object"},{additionalProperties:!1,properties:{bubbles:{type:"boolean"},composed:{type:"boolean"},detail:{$ref:"#/$defs/ExpressionOperand"},dispatchEvent:{description:"The CustomEvent type to dispatch (WHATWG DOM dispatchEvent).",type:"string"}},required:["dispatchEvent"],title:"dispatchEvent — emit a CustomEvent (WHATWG naming, CustomEventInit members)",type:"object"},{additionalProperties:!1,properties:{stopPropagation:{const:!0,description:"Stop the handler's event at the current target (WHATWG DOM stopPropagation), so an ancestor's handler for the same event does not run. A body run without an event has nothing to stop."}},required:["stopPropagation"],title:"stopPropagation — stop the event here (WHATWG DOM)",type:"object"},{additionalProperties:!1,properties:{preventDefault:{const:!0,description:"Cancel the handler's event's default action (WHATWG DOM preventDefault): a link's navigation, a form's submission, a key's scroll."}},required:["preventDefault"],title:"preventDefault — cancel the event's default action (WHATWG DOM)",type:"object"}]},H0={description:"A structured function body: statements executed sequentially (one yielding a promise is awaited before the next, per ECMA async/await semantics).",items:{$ref:"#/$defs/Statement"},type:"array"}});var B0;var z0=T(()=>{B0={description:'An external class / data source. $prototype is a constructor name (not "Function"). When $prototype is not in the built-in registry, $src is required. All state entries are reactive by default.',properties:{$export:{description:"Named export in $src module. Defaults to the $prototype value.",type:"string"},$prototype:{description:"Constructor name — built-in Web API class or external class name.",examples:["Request","URLSearchParams","FormData","LocalStorage","SessionStorage","Cookie","IndexedDB","Array","Set","Map","Blob","ReadableStream","MarkdownCollection","MyParser"],not:{const:"Function"},type:"string"},$src:{description:"External module specifier. Required when $prototype is not a built-in.",examples:["@jxsuite/md","./lib/my-parser.js","npm:@myorg/data"],type:"string"},autoIncrement:{type:"boolean"},body:{},database:{type:"string"},debounce:{minimum:0,type:"integer"},default:{},description:{type:"string"},domain:{type:"string"},filter:{anyOf:[{$ref:"#/$defs/RefObject"},{description:"A single filter object, e.g. an equality shorthand.",type:"object"},{description:'Ordered filter rules, e.g. [{ field: "Slug", op: "not empty" }].',items:{type:"object"},type:"array"}],description:"Filter configuration: a reactive $ref binding, a single filter object, or an ordered array of rules."},headers:{additionalProperties:{type:"string"},type:"object"},indexes:{items:{properties:{keyPath:{oneOf:[{type:"string"},{items:{type:"string"},type:"array"}]},name:{type:"string"},unique:{type:"boolean"}},required:["name","keyPath"],type:"object"},type:"array"},items:{},key:{type:"string"},keyPath:{type:"string"},manual:{type:"boolean"},map:{$ref:"#/$defs/ElementDef"},maxAge:{type:"integer"},method:{enum:["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],type:"string"},name:{type:"string"},path:{type:"string"},responseType:{enum:["json","text","blob","arraybuffer","document",""],type:"string"},sameSite:{enum:["strict","lax","none"],type:"string"},secure:{type:"boolean"},sort:{anyOf:[{$ref:"#/$defs/RefObject"},{description:"A single sort rule, e.g. { field, order }.",type:"object"},{description:'Ordered sort rules, e.g. [{ field: "date", order: "desc" }].',items:{type:"object"},type:"array"}],description:"Sort configuration: a reactive $ref binding, a single { field, order } rule, or an ordered array of rules."},src:{description:"Configuration property passed to external class constructor.",type:"string"},store:{type:"string"},timing:{enum:["compiler","server","client"],type:"string"},url:{$ref:"#/$defs/StringOrRef"},version:{minimum:1,type:"integer"}},required:["$prototype"],type:"object"}});var K0;var G0=T(()=>{K0={description:"A reusable JSON Schema type definition for tooling only. No function, no runtime artifact. Referenced from state entries via $ref. Naming convention: PascalCase.",not:{anyOf:[{required:["default"]},{required:["$prototype"]}]},properties:{description:{type:"string"},enum:{type:"array"},examples:{type:"array"},items:{},maxLength:{minimum:0,type:"integer"},maximum:{type:"number"},minLength:{minimum:0,type:"integer"},minimum:{type:"number"},pattern:{type:"string"},properties:{type:"object"},required:{items:{type:"string"},type:"array"},type:{$ref:"#/$defs/JsonSchemaType"}},required:["type"],type:"object"}});var X0,Y0,Z0,Q0,eE,tE,nE,rE,sE,oE,iE,aE,cE,lE,uE,fE,dE;var pE=T(()=>{wp();X0={additionalProperties:!1,description:"A JSON Pointer $ref operand within an expression node. $args/<name> resolves a named formula's parameter (callable entries only).",properties:{$ref:{pattern:String.raw`^(\$map/|\$reduce/|\$args/|event#/|#/|parent#/|window#/|document#/)`,type:"string"}},required:["$ref"],type:"object"},Y0={anyOf:[{not:{pattern:String.raw`\$\{`},type:"string"},{type:"number"},{type:"boolean"},{type:"null"},{items:{$ref:"#/$defs/ExpressionOperand"},type:"array"},{description:"Plain-object literal (e.g. an Intl options bag). Objects carrying $ref or operator keys are pointers/nodes, never literals.",not:{anyOf:[{required:["$ref"]},{required:["operator"]}]},type:"object"}],description:"A non-reactive operand: scalar, plain-object literal, or array of operands."},Z0={anyOf:[{$ref:"#/$defs/ExpressionPointer"},{$ref:"#/$defs/ExpressionNode"},{$ref:"#/$defs/ExpressionLiteral"}],description:"Anything that may appear in target or value: a pointer, a literal, or a nested expression node."},Q0={enum:["!","-"]},eE={enum:["+","-","*","/","%","===","!==","<","<=",">",">=","&&","||","??"]},tE={const:"?:"},nE={const:"switch"},rE={const:"call"},sE={description:"A genuine pure String.prototype / Array.prototype / Number.prototype method (spec §19.4d). The ES2023 change-by-copy family (toSorted, toReversed, toSpliced, with) stands in where mutation would otherwise occur. Receiver in target; value carries the argument (bare scalar) or argument list (array).",enum:["includes","indexOf","lastIndexOf","join","slice","concat","at","flat","toSorted","toReversed","toSpliced","with","toUpperCase","toLowerCase","trim","trimStart","trimEnd","split","startsWith","endsWith","padStart","padEnd","replaceAll","repeat","charAt","normalize","toLocaleUpperCase","toLocaleLowerCase","toFixed","toPrecision","toLocaleString"]},oE={enum:["=","+=","-=","*=","/="]},iE={enum:["pop","shift"]},aE={enum:["push","unshift"]},cE={const:"splice"},lE={const:"reduce"},uE={enum:["map","filter"]},fE={additionalProperties:!1,description:"The core expression node. operator + target, with value gated by arity.",oneOf:[{not:{anyOf:[{required:["value"]},{required:["initial"]}]},properties:{operator:{$ref:"#/$defs/UnaryOperator"}},required:["operator"],title:"Unary — target only, no value"},{not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/BinaryOperator"}},required:["operator","value"],title:"Binary — left in target, right in value"},{not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/AssignmentOperator"},target:{$ref:"#/$defs/ExpressionPointer"}},required:["operator","value"],title:"Assignment — writable target, value required"},{not:{anyOf:[{required:["value"]},{required:["initial"]}]},properties:{operator:{$ref:"#/$defs/NoArgMethod"},target:{$ref:"#/$defs/ExpressionPointer"}},required:["operator"],title:"pop / shift — array receiver, no value"},{not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/OneArgMethod"},target:{$ref:"#/$defs/ExpressionPointer"}},required:["operator","value"],title:"push / unshift — array receiver, single value argument"},{not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/SpliceMethod"},target:{$ref:"#/$defs/ExpressionPointer"},value:{items:{$ref:"#/$defs/ExpressionOperand"},minItems:1,type:"array"}},required:["operator","value"],title:"splice — array receiver, [start, deleteCount, ...items]"},{properties:{operator:{$ref:"#/$defs/ReduceMethod"},target:{anyOf:[{$ref:"#/$defs/ExpressionPointer"},{$ref:"#/$defs/ExpressionNode"}]},value:{$ref:"#/$defs/ExpressionNode"}},required:["operator","value","initial"],title:"reduce — pure fold over a pointer or derived array; seed in initial"},{not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/MapFilterMethod"},target:{anyOf:[{$ref:"#/$defs/ExpressionPointer"},{$ref:"#/$defs/ExpressionNode"}]},value:{$ref:"#/$defs/ExpressionNode"}},required:["operator","value"],title:"map / filter — pure over a pointer or derived array; per-item expression in value"},{description:"The ECMAScript conditional (ternary) operator, pure: target is the test, value the consequent, initial the alternate (the reduce precedent for repurposing initial). Chain else-if by nesting another ?: node in initial.",properties:{operator:{$ref:"#/$defs/ConditionalOperator"}},required:["operator","value","initial"],title:"?: — pure conditional; test in target, consequent in value, alternate in initial"},{description:"Value-keyed multiway selection, pure: target is the discriminant (matched against case keys by its string form, like element-level $switch), cases maps matched values to result operands, default is the operand when no case matches (result is undefined without it). Condition-chain branching composes from nested ?: nodes instead.",not:{anyOf:[{required:["value"]},{required:["initial"]}]},properties:{cases:{additionalProperties:{$ref:"#/$defs/ExpressionOperand"},type:"object"},default:{$ref:"#/$defs/ExpressionOperand"},operator:{$ref:"#/$defs/SwitchOperator"}},required:["operator","cases"],title:"switch — pure value-keyed selection; discriminant in target, results in cases/default"},{description:"A pure standard-library method call: target is the receiver (any operand — never mutated; change-by-copy names replace the mutating originals), value the optional argument (bare scalar) or argument list (array). A missing receiver or method yields undefined, matching null-safe path reads.",not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/PureMethod"}},required:["operator"],title:"Pure method — genuine prototype methods; receiver in target, args in value"},{description:"Invoke a callable, pure in formula position: target is the callee pointer — a named formula entry (#/state/…) or a blessed pure global via window#/ (Math.*, JSON.*, Object.keys/values/entries, and "+`${Hb()}) — and value is the positional argument list (the splice args-in-value precedent). Argument order follows the callee's declared parameters.`,not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/CallOperator"},target:{$ref:"#/$defs/ExpressionPointer"},value:{items:{$ref:"#/$defs/ExpressionOperand"},type:"array"}},required:["operator"],title:"call — invoke a named formula or blessed global; callee in target, args in value"}],properties:{cases:{additionalProperties:{$ref:"#/$defs/ExpressionOperand"},description:"switch only: matched discriminant value (string form) → result operand.",type:"object"},default:{$ref:"#/$defs/ExpressionOperand",description:"switch only: result operand when no case key matches."},initial:{$ref:"#/$defs/ExpressionOperand"},operator:{type:"string"},target:{$ref:"#/$defs/ExpressionOperand"},value:{$ref:"#/$defs/ExpressionOperand"}},required:["operator","target"],type:"object"},dE={additionalProperties:!1,description:"A declarative expression entry (Shape 5). Used as a state entry or inline event handler. With parameters it is a named formula: a pure, reusable computation invoked via the call operator, its parameters resolved through $args/<name> refs in the body.",properties:{$description:{type:"string"},$expression:{$ref:"#/$defs/ExpressionNode"},$title:{type:"string"},parameters:{description:"Named-formula parameters (CEM convention, as on Function entries): bare names or CEM parameter objects. Present ⇒ the entry is callable, not a computed value.",items:{anyOf:[{type:"string"},{$ref:"#/$defs/CemParameter"}]},type:"array"}},required:["$expression"],type:"object"}});var mE,hE,gE,yE;var xE=T(()=>{mE={description:"A single state entry. Shape is determined by value type: "+"scalar/array → naked reactive property, string with ${} → computed, "+'object with $prototype: "Function" → function, '+"object with $prototype: <other> → data source, "+"object with type and default → typed reactive property, "+"plain object → naked object reactive property.",oneOf:[{type:"number"},{type:"boolean"},{type:"null"},{type:"string"},{type:"array"},{$ref:"#/$defs/TypedStateDef"},{$ref:"#/$defs/FunctionDef"},{$ref:"#/$defs/ExternalClassDef"},{$ref:"#/$defs/ExpressionEntry"},{not:{anyOf:[{required:["$prototype"]},{required:["default"]},{required:["type"]},{required:["$expression"]}]},type:"object"}]},hE={additionalProperties:{$ref:"#/$defs/StateEntry"},description:"Map of runtime variables. Keys are camelCase (public) or #-prefixed (private). All entries are reactive by default.",type:"object"},gE={additionalProperties:{$ref:"#/$defs/TypeDefEntry"},description:"Map of reusable JSON Schema type definitions. Keys are PascalCase type names. No runtime artifacts are produced.",type:"object"},yE={description:"A $defs type definition entry. Must be a pure JSON Schema type definition or a class definition (.class.json format).",oneOf:[{$ref:"#/$defs/PureTypeDef"},{$ref:"#/$defs/ClassDef"}]}});var gF,oh,ih,ah,ch,lh,uh,fh,dh,ph,bE;var $E=T(()=>{gF=["method","accessor","parse","serialize","rewrite","discover","load","projectData","resolvePaths","lower","emit","head","assets","mount","dialect","deploySchema","bindings","testConnection"],oh={description:"A typed parameter definition for a class.",properties:{default:{},description:{type:"string"},examples:{type:"array"},format:{description:`When "json-schema", this parameter's value is itself a JSON Schema.`,type:"string"},identifier:{type:"string"},type:{}},required:["identifier"],type:"object"},ih={description:"A class field definition with access control and scope.",properties:{$prototype:{description:'Data source prototype for this field (e.g., "Request").',type:"string"},access:{enum:["public","private","protected"],type:"string"},default:{},description:{type:"string"},examples:{type:"array"},identifier:{type:"string"},initializer:{},role:{const:"field",type:"string"},scope:{enum:["instance","static"],type:"string"},type:{}},type:"object"},ah={description:"Class constructor definition.",properties:{$prototype:{const:"Function",type:"string"},body:{description:"The member's body in erasable TypeScript, which plain JavaScript already is (spec §23.1), as one string or as an array of lines.",oneOf:[{type:"string"},{items:{type:"string"},type:"array"}]},description:{type:"string"},parameters:{items:{oneOf:[{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"},{$ref:"#/$defs/ClassParameterDef"}]},type:"array"},role:{const:"constructor",type:"string"},superCall:{properties:{arguments:{items:{type:"string"},type:"array"}},type:"object"}},type:"object"},ch={description:"A class method or accessor definition. Capability roles (parse, serialize, rewrite, discover, load) mark static methods that hosts (compiler, server, studio) invoke for format dispatch.",properties:{$prototype:{const:"Function",type:"string"},access:{enum:["public","private","protected"],type:"string"},body:{description:"The member's body in erasable TypeScript, which plain JavaScript already is (spec §23.1), as one string or as an array of lines.",oneOf:[{type:"string"},{items:{type:"string"},type:"array"}]},description:{type:"string"},getter:{properties:{body:{type:"string"}},type:"object"},identifier:{type:"string"},parameters:{items:{oneOf:[{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"},{$ref:"#/$defs/ClassParameterDef"}]},type:"array"},returnType:{},role:{enum:gF,type:"string"},scope:{enum:["instance","static"],type:"string"},setter:{properties:{body:{type:"string"},parameters:{type:"array"}},type:"object"},timing:{description:"Execution environments allowed to call this capability directly. Hosts outside the list round-trip through the dev server.",items:{enum:["compiler","server","client"],type:"string"},type:"array"}},type:"object"},lh={description:"Format participation marker. A class carrying this block is auto-discovered from the project imports map and used for file-extension dispatch by the compiler, server, and studio.",properties:{documentKinds:{description:'"page"/"component" allow the extension in pages/components discovery; "content" allows it as a content-type source.',items:{enum:["page","component","content"],type:"string"},type:"array"},exportTarget:{description:"When true, site builds emit a serialized sidecar per page in this format.",type:"boolean"},extensions:{description:'File extensions this format claims, with leading dot (e.g. [".md"]).',items:{pattern:String.raw`^\.`,type:"string"},minItems:1,type:"array"},mediaType:{description:"MIME type for the format (icons, labels, HTTP).",type:"string"},remote:{description:"When true, the load capability accepts http(s) URLs as sources.",type:"boolean"}},required:["extensions"],type:"object"},uh={additionalProperties:!1,description:"Project-section admission block (specs/extensions.md §9). A class carrying this block owns "+"the project.json section named by `key`; hosts dispatch that section's data through the class's projectData/resolvePaths capabilities.",properties:{description:{type:"string"},key:{description:"The project.json top-level section this class owns (exclusive per project).",type:"string"},referenceable:{description:"Whether section entries can be referenced from documents (e.g. content types).",type:"boolean"},title:{type:"string"}},required:["key"],type:"object"},fh={additionalProperties:!1,description:"Server-mount admission block (specs/extensions.md §11). A class carrying this block mounts "+"routes under its /_jx/ basePath in the site worker and dev server.",properties:{basePath:{description:"Route subtree this class mounts — must be under /_jx/ (exclusive per project).",examples:["/_jx/data","/_jx/auth"],type:"string"},module:{description:"Module specifier exporting the mount handler.",type:"string"},order:{description:"Mount order (ascending; default 100).",type:"number"}},required:["basePath"],type:"object"},dh={description:"Connection-provider admission block (specs/extensions.md §12). A class carrying this block "+"provides database connections of the given provider/kind.",properties:{kind:{description:"SQL dialect family the provider speaks.",enum:["sqlite","postgres"],type:"string"},local:{description:"Local-development substitute provider (e.g. sqlite for D1).",type:"string"},module:{description:"Module specifier exporting the provider implementation.",type:"string"},provider:{description:"Provider identifier (e.g. d1, supabase, sqlite).",type:"string"},serve:{description:"Module specifier exporting the serve-time worker binding.",type:"string"}},required:["provider","kind"],type:"object"},ph={description:"Studio control-surface hints for a format class: editor modes, document-mode rules, templates, and the element/nesting constraints that gate structural editing.",properties:{documentMode:{properties:{componentWhen:{description:"Treat the document as a component when this top-level/frontmatter key matches the regex.",properties:{frontmatterKey:{type:"string"},matches:{type:"string"}},type:"object"},default:{enum:["content","component"],type:"string"}},type:"object"},elements:{description:"Element allowlist and nesting constraints for structural editing.",properties:{block:{items:{type:"string"},type:"array"},inline:{items:{type:"string"},type:"array"},nesting:{additionalProperties:{properties:{block:{type:"boolean"},directive:{type:"boolean"},inline:{type:"boolean"},only:{items:{type:"string"},type:"array"}},type:"object"},description:'Per-parent child rules keyed by tag (or "_root"): { block, inline, directive } booleans or { only: [tags] }.',type:"object"},textOnly:{items:{type:"string"},type:"array"},void:{items:{type:"string"},type:"array"}},type:"object"},icon:{type:"string"},modes:{description:"Editor modes the studio offers for documents of this format.",items:{type:"string"},type:"array"},newFileTemplate:{description:"Initial source text for newly created files of this format.",type:"string"}},type:"object"},bE={additionalProperties:!1,description:'A .class.json schema-defined class. $prototype must be "Class". Defines fields, constructor, methods, and type parameters via $defs. Optionally points to a JS module via $implementation for hybrid execution.',properties:{$defs:{description:"Class members: parameters, returnTypes, fields, constructor, methods.",properties:{constructor:{$ref:"#/$defs/ClassConstructorDef"},fields:{additionalProperties:{$ref:"#/$defs/ClassFieldDef"},description:"Class fields with role, access, scope, and type information.",type:"object"},methods:{additionalProperties:{$ref:"#/$defs/ClassMethodDef"},description:"Class methods and accessors.",type:"object"},parameters:{additionalProperties:{$ref:"#/$defs/ClassParameterDef"},description:"Reusable typed parameter schemas, keyed by name.",type:"object"},returnTypes:{additionalProperties:{type:"object"},description:"Output type schemas, keyed by name.",type:"object"}},type:"object"},$id:{type:"string"},$implementation:{description:"Relative path to a JS module containing the actual class implementation.",type:"string"},$prototype:{const:"Class",type:"string"},$schema:{type:"string"},$studio:{$ref:"#/$defs/StudioHints"},connector:{$ref:"#/$defs/ConnectorBlockDef"},description:{type:"string"},extends:{description:"Base class — string name or $ref to another .class.json.",oneOf:[{type:"string"},{properties:{$ref:{type:"string"}},required:["$ref"],type:"object"}]},format:{$ref:"#/$defs/FormatDef"},project:{$ref:"#/$defs/ProjectBlockDef"},server:{$ref:"#/$defs/ServerBlockDef"},title:{description:"PascalCase class name, used as the export name.",type:"string"}},required:["$prototype","title"],type:"object"}});var wE;var SE=T(()=>{wE={additionalProperties:!1,description:"Schema for jx-extension.json manifests. Located at the extension package root and exported so hosts can resolve <package>/jx-extension.json through the exports map.",properties:{$schema:{type:"string"},classes:{additionalProperties:{type:"string"},description:"$prototype-visible class name → class descriptor path, relative to the manifest.",type:"object"},description:{description:"One-line description.",type:"string"},name:{description:"Package name; must match package.json.",type:"string"},schemas:{additionalProperties:!1,description:"Schema fragments this package contributes, relative to the manifest.",properties:{document:{description:"Document-schema fragment (positions like $paths values).",type:"string"},fields:{description:"Field-union fragment: its $defs members are unioned into the per-project "+"field-schema resource as extension field extras (specs/extensions.md §5.3).",type:"string"},project:{description:"Project-schema fragment (top-level project.json sections).",type:"string"}},type:"object"},title:{description:"Human-readable name for studio surfaces.",type:"string"}},required:["name"],type:"object"}});var Uu;var vE=T(()=>{Uu={description:"Image optimization configuration for the project.",properties:{formats:{description:'Output formats, each one of "avif", "jpeg", "png" or "webp" (default ["avif", "jpeg"]). AVIF and JPEG are lossy; PNG and WebP are written losslessly, so listing WebP produces larger files than either. A source with transparency is written as PNG wherever JPEG is listed.',items:{type:"string"},type:"array"},lazyLoad:{type:"boolean"},optimize:{type:"boolean"},picture:{description:"Wrap a multi-format image in a <picture> with one <source> per format (default true). With it off the <img> carries a srcset in the preferred format alone, which browsers that cannot decode that format will still select from.",type:"boolean"},quality:{description:"Lossy quality per format, 1 to 100 (defaults: avif 65, jpeg 80). The build writes png and webp losslessly, so png is never read and webp is read only by the cloudflare service, as the quality of its transform URLs (default 80).",properties:{avif:{type:"number"},jpeg:{type:"number"},png:{type:"number"},webp:{type:"number"}},type:"object"},remoteDomains:{description:'Hostnames whose remote (https) images are optimized through /cdn-cgi/image transform URLs (cloudflare service only), e.g. ["drive.usercontent.google.com"]. Remote sources from other hosts are left untouched.',items:{type:"string"},type:"array"},service:{description:'How images are optimized: "build" encodes variants at build time; "cloudflare" emits /cdn-cgi/image transform URLs served by Cloudflare Image Transformations (requires the feature to be enabled on the serving zone).',enum:["build","cloudflare"],type:"string"},sizes:{type:"string"},widths:{items:{type:"number"},type:"array"}},type:"object"}});var yF,mh;var EE=T(()=>{Eo();yF=[301,302,303,307,308],mh={description:"Schema for Jx project.json files. A project.json file is the root anchor file for a Jx project, declaring site metadata, default settings, global styles, extensions, and build configuration. Open by design: extension-contributed sections (e.g. `content`) are opaque top-level keys; the generated per-project entry document (project.schema.json) closes the composition.",properties:{$defs:{description:"Global type definitions available to all pages.",type:"object"},$elements:{description:"Global custom element dependencies available to all pages. Items are $ref objects or npm package specifier strings.",items:{oneOf:[{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"},{type:"string"}]},type:"array"},$head:{description:"Global <head> entries applied to all pages. Array of element definitions for meta tags, link tags, script tags, etc.",examples:[[{attributes:{href:"/favicon.svg",rel:"icon"},tagName:"link"},{attributes:{content:"Jx",name:"generator"},tagName:"meta"}]],items:{properties:{attributes:{additionalProperties:{type:"string"},type:"object"},tagName:{type:"string"}},type:"object"},type:"array"},$media:{additionalProperties:{type:"string"},description:'Named media breakpoints following CSS @custom-media convention. Available in all component style objects. Declaring a pure color-scheme query (e.g. "--dark": "(prefers-color-scheme: dark)") additionally opts the site into the forced-scheme contract: @--dark style blocks are dual-emitted so a data-color-scheme attribute on <html> overrides the OS preference, color-scheme is declared on :root, and a pre-paint script restores the '+"visitor's persisted choice (spec §9.5).",examples:[{"--dark":"(prefers-color-scheme: dark)","--lg":"(min-width: 1024px)","--md":"(min-width: 768px)","--sm":"(min-width: 640px)"}],type:"object"},$schema:{description:"Relative path to the generated per-project schema (conventionally ./project.schema.json, written by `jx schema`).",type:"string"},build:{description:"Build configuration.",properties:{adapter:{description:"Platform adapter for deployment-specific output.",enum:["static","cloudflare-pages","cloudflare-workers","node","bun"],type:"string"},deploy:{additionalProperties:!1,description:"Deployment tracking: the hosting project this repo publishes to. Identifiers "+"only (no secrets) — safe to commit; Studio uses it to tell whether the publish "+"workflow already exists. `adapter` says how the build is packaged; `deploy` says where it ships.",properties:{accountId:{description:"Hosting account id (e.g. the Cloudflare account id).",type:"string"},productionUrl:{description:"Production URL of the connected hosting project.",type:"string"},projectName:{description:"Hosting project name (e.g. the Cloudflare Pages project).",pattern:"^[a-z0-9][a-z0-9-]*$",type:"string"},provider:{description:"Hosting provider the project is connected to.",enum:["cloudflare-pages"],type:"string"}},required:["provider","accountId","projectName"],type:"object"},format:{default:"directory",description:"Reserved; currently unused. Accepted for forward compatibility with single-file output (desktop single-file mode) — the build emits per-route directories regardless.",enum:["directory","single"],type:"string"},outDir:{default:"./dist",description:"Output directory for compiled site.",type:"string"},headers:{additionalProperties:!1,description:"Emit dist/_headers — the response headers only the build can know. Honored by "+"Cloudflare Pages/Workers assets and Netlify; on the node/bun adapters the file documents what a reverse proxy in front of them must send.",properties:{cache:{default:"auto",description:'"auto" marks the content-addressed image variants immutable (RFC 8246) and revalidates everything else (RFC 9111). "off" emits no Cache-Control at all.',enum:["auto","off"],type:"string"},enabled:{default:!0,type:"boolean"},rules:{additionalProperties:{additionalProperties:{type:"string"},type:"object"},description:"Verbatim rules, merged after the generated block.",propertyNames:{pattern:"^/"},type:"object"},security:{additionalProperties:!1,properties:{contentTypeOptions:{default:!0,type:"boolean"},csp:{default:!1,description:"CSP Level 3. Off by default: unlike the other security headers this one "+"governs code the build cannot see — a third-party script that loads a "+"second script, a widget that opens a frame — so turning it on is a change "+"to verify in the browser console, not a safe default. `script-src` is derived from the inline scripts and external origins the build emitted; `style-src` keeps 'unsafe-inline', because per-page <style> blocks and per-element style attributes have no site-wide hash.",oneOf:[{type:"boolean"},{const:"report-only"},{additionalProperties:!1,properties:{directives:{additionalProperties:{oneOf:[{type:"string"},{const:!1}]},description:"Replace (string) or remove (false) a computed directive. A replacement is wholesale, so an addition restates the defaults.",type:"object"},mode:{default:"enforce",enum:["enforce","report-only"]},reportUri:{format:"uri-reference",type:"string"}},type:"object"}]},frameOptions:{default:"SAMEORIGIN",oneOf:[{enum:["DENY","SAMEORIGIN"],type:"string"},{const:!1}]},hsts:{default:!1,description:"RFC 6797. Off by default: a wrong max-age locks the apex domain to HTTPS for that long, and the mistake is invisible until a certificate lapses. `preload` requires `includeSubDomains` and is a build error without it.",oneOf:[{type:"boolean"},{additionalProperties:!1,properties:{includeSubDomains:{default:!0,type:"boolean"},maxAge:{default:31536000,minimum:0,type:"integer"},preload:{default:!1,type:"boolean"}},type:"object"}]},permissionsPolicy:{default:"camera=(), microphone=(), geolocation=()",oneOf:[{type:"string"},{const:!1}]},referrerPolicy:{default:"strict-origin-when-cross-origin",oneOf:[{enum:["no-referrer","no-referrer-when-downgrade","origin","origin-when-cross-origin","same-origin","strict-origin","strict-origin-when-cross-origin","unsafe-url"],type:"string"},{const:!1}]}},type:"object"}},type:"object"},sitemap:{default:!0,description:"Generate sitemap.xml from the route table (requires `url`). Set false to disable.",type:"boolean"},trailingSlash:{default:"always",description:"Trailing slash behavior for generated URLs.",enum:["always","never","ignore"],type:"string"}},type:"object"},copy:{additionalProperties:{type:"string"},description:"Declarative file copy map. Keys are source paths (relative to project root), values are destination paths (relative to outDir).",type:"object"},defaults:{description:"Default settings applied to all pages unless overridden.",properties:{charset:{default:"utf8",description:"Default charset for the page.",type:"string"},dir:{description:"Base direction for the <html> element. Omitted when unset — a page's `$dir` "+"overrides it. Right-to-left content renders left-to-right without this.",enum:["ltr","rtl","auto"],type:"string"},lang:{default:"en",description:"Default lang attribute for the <html> element. A page's `$lang` overrides it.",type:"string"},layout:{default:null,description:"Default layout file path applied to all pages. Set to null to render pages without a layout.",examples:["./layouts/base.json"],oneOf:[{type:"string"},{type:"null"}]},shadow:{default:!1,description:"Default shadow-DOM mode for every component (spec.md §16.6). Off unless set: a "+"shadow root isolates component styles from the page and replaces the <slot> emulation with real slot distribution. A component's own `$shadow` overrides this in both directions.",oneOf:[{enum:["open","closed"],type:"string"},{const:!1,type:"boolean"}]}},type:"object"},extensions:{description:"Extension packages: bare package names (resolved project-first through the package exports map) or relative paths. Each must export jx-extension.json.",examples:[["@jxsuite/parser"]],items:{type:"string"},type:"array"},manifest:{additionalProperties:!1,description:'W3C Web App Manifest, emitted as manifest.webmanifest with a <link rel="manifest"> on every page. Absent means no manifest: it is a claim that a site is meant to be installed, and most are not.',properties:{backgroundColor:{type:"string"},categories:{items:{type:"string"},type:"array"},description:{type:"string"},dir:{enum:["ltr","rtl","auto"],type:"string"},display:{default:"standalone",enum:["fullscreen","standalone","minimal-ui","browser"],type:"string"},enabled:{default:!0,type:"boolean"},icons:{description:"Icons at 192px and 512px are what browsers require before offering to install the site; the build warns when either is missing.",items:{additionalProperties:!1,properties:{purpose:{type:"string"},sizes:{examples:["192x192"],type:"string"},src:{type:"string"},type:{type:"string"}},required:["src"],type:"object"},type:"array"},lang:{type:"string"},name:{description:"Defaults to the project name.",type:"string"},orientation:{type:"string"},scope:{type:"string"},shortName:{type:"string"},startUrl:{default:"/",type:"string"},themeColor:{type:"string"}},type:"object"},serviceWorker:{default:!1,description:"W3C Service Worker, emitted as sw.js. Off unless declared — a worker is sticky, so it "+"is the one output that can keep breaking visitors after a deploy tries to fix them. **Turning it off means `false`, not deleting the key**: `false` emits a tombstone at the same URL that unregisters the old worker and clears its caches, and a 404 there is not an instruction to stop. HTML is always network-first; only the content-addressed /images/_optimized/* is served cache-first.",oneOf:[{type:"boolean"},{additionalProperties:!1,properties:{enabled:{default:!0,type:"boolean"},offlineFallback:{description:"Page served for a failed navigation. Added to `precache` if not already there.",type:"string"},precache:{description:"Site-absolute URLs fetched at install time. Each must be a file this build produces; one that is not fails the build, because a single unreachable entry stops the worker installing at all.",items:{pattern:"^/",type:"string"},type:"array"},scope:{default:"/",type:"string"}},type:"object"}]},securityTxt:{additionalProperties:!1,description:"RFC 9116 security.txt, emitted at .well-known/security.txt. `expires` is required by "+"§2.5.5 and an absent or past value is a build error — an expired file advertises a "+"reporting channel while telling the reporter not to trust it. A hand-placed public/.well-known/security.txt shadows this, which is how a clearsigned file ships.",properties:{acknowledgments:{items:{type:"string"},type:"array"},canonical:{type:"string"},contact:{description:"At least one mailto:, https: or tel: URI (§2.5.3).",items:{type:"string"},type:"array"},enabled:{default:!0,type:"boolean"},encryption:{items:{type:"string"},type:"array"},expires:{format:"date-time",type:"string"},hiring:{items:{type:"string"},type:"array"},policy:{items:{type:"string"},type:"array"},preferredLanguages:{description:"BCP 47 tags, validated and canonicalized like i18n.locales.",items:{pattern:Wl,type:"string"},type:"array"}},type:"object"},i18n:{description:"Internationalization configuration.",properties:{defaultLocale:{description:"Default locale, as a BCP 47 language tag. The pattern catches shape errors (`en_US`, `en--US`); the build is the authority on well-formedness.",examples:["en"],pattern:Wl,type:"string"},locales:{description:"Available locales, as BCP 47 language tags.",examples:[["en","fr","de"]],items:{pattern:Wl,type:"string"},type:"array"},routing:{description:"Locale routing strategy.",enum:["prefix-except-default","prefix-always"],type:"string"}},type:"object"},images:{$ref:"#/$defs/ImageConfig"},imports:{additionalProperties:{type:"string"},description:"Global import map: $prototype names to .class.json file paths. Makes external classes available by name in all pages.",examples:[{Markdown:"@jxsuite/parser/Markdown.class.json",MarkdownCollection:"@jxsuite/parser/MarkdownCollection.class.json"}],type:"object"},name:{default:"Jx Site",description:"Human-readable project name.",examples:["My Portfolio","Jx Example Site"],type:"string"},redirects:{additionalProperties:{oneOf:[{description:"Destination path or URL; implies a 301.",type:"string"},{additionalProperties:!1,description:"A redirect with an explicit RFC 9110 §15.4 status.",properties:{destination:{type:"string"},status:{default:301,description:"RFC 9110 §15.4 redirection status. 307 and 308 preserve the request method; "+"301 and 302 historically do not.",enum:[...yF],type:"integer"}},required:["destination"],type:"object"},{additionalProperties:!1,description:"A rewrite (proxy): the destination's content is served AT the source URL, with no "+"redirect. Emitted as status 200 in `_redirects`, which is the host convention — "+"not an HTTP redirection status.",properties:{destination:{type:"string"},rewrite:{const:!0,type:"boolean"}},required:["destination","rewrite"],type:"object"}]},description:"Static redirect and rewrite rules. Keys are source paths in URLPattern pathname syntax.",examples:[{"/api/*":{destination:"https://api.example.com/*",rewrite:!0},"/legacy/*":{destination:"/archive/*",status:308},"/old-about":"/about"}],propertyNames:{pattern:"^/"},type:"object"},state:{description:"Site-wide reactive state available to all pages.",type:"object"},style:{additionalProperties:{oneOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/StyleObject"}]},description:"Global CSS styles applied to the <body> element. Uses the same camelCase CSSOM convention and recursive selector/at-rule nesting as component styles.",type:"object"},url:{description:"Production URL of the deployed site.",examples:["https://example.com","https://jxsuite.com"],type:"string"}},type:"object"}});function xF(){return jE??=bF(),jE}async function bF(){let[e,t,n]=await Promise.all([_E.listAll(),kE.default.listAll(),OE.default.parseAll()]),r=new Set;for(let{elements:l}of Object.values(e))for(let u of l)if(!u.obsolete)r.add(u.name);let s=[...r].toSorted(),o=new Set;for(let l of t.properties)for(let u of l.styleDeclaration??[])o.add(u);let i=[...o].toSorted(),a=new Set;for(let l of Object.values(n))for(let u of l){if(u.type!=="interface"&&u.type!=="interface mixin")continue;if(!u.members)continue;for(let d of u.members)if(d.type==="attribute"&&d.name?.startsWith("on")&&d.idlType?.idlType==="EventHandler")a.add(d.name)}let c=[...a].toSorted();return{cssProps:i,eventHandlers:c,tagExamples:s}}function $F(e){let t={};for(let n of e)t[n]={description:`Event handler for the "${n.slice(2)}" event.`,oneOf:[{$ref:"#/$defs/RefObject"},{$ref:"#/$defs/ExpressionEntry"},{$ref:"#/$defs/FunctionDef"}]};return t}function wF(e){let t={...Hu.properties};for(let n of e)t[n]={oneOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/RefObject"}]};return t}async function SF(){let{tagExamples:e,cssProps:t,eventHandlers:n}=await xF();return{$defs:{DefsMap:gE,TypeDefEntry:yE,StateMap:hE,StateEntry:mE,TypedStateDef:F0,PureTypeDef:K0,FunctionDef:V0,ClassDef:bE,ClassParameterDef:oh,ClassFieldDef:ih,ClassConstructorDef:ah,ClassMethodDef:ch,FormatDef:lh,ProjectBlockDef:uh,ServerBlockDef:fh,ConnectorBlockDef:dh,StudioHints:ph,ExternalClassDef:B0,ExpressionPointer:X0,ExpressionLiteral:Y0,ExpressionOperand:Z0,UnaryOperator:Q0,BinaryOperator:eE,ConditionalOperator:tE,SwitchOperator:nE,CallOperator:rE,PureMethod:sE,AssignmentOperator:oE,NoArgMethod:iE,OneArgMethod:aE,SpliceMethod:cE,ReduceMethod:lE,MapFilterMethod:uE,ExpressionNode:fE,ExpressionEntry:dE,Statement:W0,StatementList:H0,ElementDef:{...sh,properties:{...sh.properties,...$F(n)}},ChildrenValue:R0,ArrayNamespace:A0,SwitchDef:I0,SwitchNode:M0,StyleObject:{...Hu,properties:wF(t)},AttributesObject:N0,PropsObject:T0,RefObject:P0,AnyRef:j0,InternalRef:b0,StateRef:$0,ExternalRef:w0,ExternalComponentRef:_0,GlobalRef:S0,ParentRef:v0,MapRef:E0,ElementPropertyValue:J0,StringOrRef:c0,BoolOrRef:l0,NumberOrRef:u0,CemParameter:m0,CemEvent:h0,TagName:{...i0,examples:[...e,"my-counter","todo-app","user-card"]},TagExpression:r0,ElementTagName:s0,JsonSchemaType:y0,HeadEntry:d0,ImageConfig:Uu,PathsValue:{$id:Co,anyOf:[...gc,Xm],description:"Default $paths source union: the core shapes, plus a catch-all for source shapes contributed by extensions this schema cannot see. The project's generated document.schema.json replaces this with the exact set its extensions provide."}},$id:"https://jxsuite.com/schema/v1",$schema:"https://json-schema.org/draft/2020-12/schema",additionalProperties:{$ref:"#/$defs/ElementPropertyValue"},description:"Schema for Jx component files. A Jx document is a JSON object that declaratively describes a reactive web component: its structure (DOM tree), styling, type definitions ($defs), runtime state, and inline or external functions. Reactivity is powered by @vue/reactivity.",properties:{$defs:{$ref:"#/$defs/DefsMap",description:"Pure JSON Schema type definitions for this component. "+"All entries are reusable type schemas — no runtime artifacts are produced. "+"Referenced from state entries via $ref. Naming convention: PascalCase."},$elements:{description:"Custom element dependencies. Items are either $ref objects pointing to JX element definitions, or bare npm package name strings for web component libraries.",items:{oneOf:[{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"},{description:"npm package specifier (must declare customElements in package.json)",type:"string"}]},type:"array"},$head:{description:"Page-level <head> entries. Array of head entries for meta tags, link tags, script tags, etc. Merged with layout and site-level $head entries.",items:{$ref:"#/$defs/HeadEntry"},type:"array"},$id:{description:"Component identifier string. Used by tooling and the builder.",examples:["Counter","TodoApp","UserCard"],type:"string"},$dir:{description:"Base direction for this page's <html> element, overriding `defaults.dir`. Right-to-left content renders left-to-right without it.",enum:["ltr","rtl","auto"],type:"string"},$lang:{description:"Language tag for this page's <html> element, overriding `defaults.lang` "+"(site-architecture.md §8.4).",examples:["en","fr","ar-EG"],type:"string"},$translationKey:{description:"This page's identity across languages, overriding the one its path implies "+"(site-architecture.md §13.5). Two routes are translations when their keys match; "+"the default key is the path with the locale prefix removed, which is right whenever "+"the paths are parallel and wrong for a localized slug — /fr-ca/a-propos/ shares "+"nothing with /about/ until one of them says so.",examples:["about","blog/hello-world"],type:"string"},$layout:{description:"Layout reference for pages. String path to a layout JSON file, or false to opt out of the default layout.",examples:["./layouts/base.json"],oneOf:[{type:"string"},{const:!1,type:"boolean"}]},$script:{additionalProperties:!1,description:"This document's own modules, as TypeScript module text (spec.md §23.2). "+'A state entry names an export of one with `$src: "#client"` or `$src: "#server"`. `client` runs in the browser; `server` runs only on the server and is never sent to one.',properties:{client:{description:'The module the browser runs. A Function entry with `$src: "#client"` is one of its exports.',type:"string"},server:{description:'The module the server runs. A `timing: "server"` entry with `$src: "#server"` is one of its exports, called with `(args, env)`.',type:"string"}},type:"object"},$shadow:{description:"Render this component into a shadow root instead of the light DOM (spec.md §16.6). "+"Off unless set: a shadow root isolates the component's styles from the page and replaces the <slot> emulation with real slot distribution, so it changes how the "+"component composes. Overrides `defaults.shadow` in both directions — `false` opts "+"one component out of a project that opted in.",oneOf:[{enum:["open","closed"],type:"string"},{const:!1,type:"boolean"}]},$sitemap:{description:"Set false to exclude this page from sitemap.xml (site-architecture.md §8.4.1). "+"Every other page with a URL is included.",type:"boolean"},$media:{additionalProperties:{type:"string"},description:'Named media breakpoints following CSS @custom-media convention. Keys use the CSS custom property -- prefix. Pure color-scheme queries (e.g. "--dark": "(prefers-color-scheme: dark)") are dual-emitted so a data-color-scheme attribute on the root element forces the scheme '+"regardless of the OS preference (spec §9.5).",examples:[{"--dark":"(prefers-color-scheme: dark)","--md":"(min-width: 768px)","--sm":"(min-width: 640px)"}],type:"object"},$paths:{$ref:Co,description:"Dynamic route source for a page: expands one page per entry at build time. One of the core shapes (explicit `values`, a `$ref` data file, or a bare array of parameter objects) or a source shape contributed by an enabled extension, such as the parser's `contentType`."},$schema:{description:"URI identifying the Jx dialect version. Enables schema-aware IDE tooling.",examples:["https://jxsuite.com/schema/v1"],type:"string"},attributes:{$ref:"#/$defs/AttributesObject"},cases:{additionalProperties:{oneOf:[{$ref:"#/$defs/ElementDef"},{$ref:"#/$defs/ExternalComponentRef"}]},description:"Switch cases object. Maps case values to element definitions or external component refs. Used alongside $switch for dynamic component rendering.",type:"object"},children:{$ref:"#/$defs/ChildrenValue"},imports:{additionalProperties:{type:"string"},description:"Import map: $prototype names to .class.json file paths. Allows state entries to reference external classes by name without $src.",type:"object"},observedAttributes:{description:"HTML attributes the custom element watches for changes. Follows the Web Components observedAttributes convention.",items:{type:"string"},type:"array"},state:{$ref:"#/$defs/StateMap",description:"Runtime variables for this component. All entries are reactive by default. Entry shape is determined by value type: "+"scalar/array → reactive property, string with ${} → computed, "+"object with $prototype → function or data source, "+"object with type and default → typed reactive property."},style:{$ref:"#/$defs/StyleObject"},tagName:{$ref:"#/$defs/TagName"},title:{$ref:"#/$defs/StringOrRef",description:"Page title. Can be a static string or a template string with ${} expressions."}},title:"Jx Document",type:"object"}}function vF(){return{$defs:{ImageConfig:Uu,StyleObject:AE},$id:"https://jxsuite.com/schema/project/v1",$schema:"https://json-schema.org/draft/2020-12/schema",description:"Schema for Jx project.json files. A project.json file is the root anchor file for a Jx project, declaring site metadata, default settings, global styles, extensions, and build configuration. Open by design: extension-contributed sections are opaque top-level keys; the generated per-project entry document (project.schema.json) closes the composition.",properties:mh.properties,title:"Jx Project",type:"object"}}function EF(){return{$defs:{ImageConfig:Uu,JxFieldSchema:_v,RelationshipRef:kv,StyleObject:AE},$id:"https://jxsuite.com/schema/project/core/v2",$schema:"https://json-schema.org/draft/2020-12/schema",description:"Core fragment of the Jx project.json schema. Open by design: extension fragments contribute their own top-level sections and the generated per-project entry document "+"(project.schema.json) closes the composition. See specs/extensions.md §5.",properties:mh.properties,title:"Jx Project Core",type:"object"}}function jF(){return{$id:hc,$schema:"https://json-schema.org/draft/2020-12/schema",anyOf:[{$ref:"https://jxsuite.com/schema/project/core/v2#/$defs/JxFieldSchema"},{$ref:"https://jxsuite.com/schema/project/core/v2#/$defs/RelationshipRef"}],description:"Default field-schema union for section entry schemas: the core field shape plus relationship references. Per-project entry documents override this resource with the "+"effective union. See specs/extensions.md §5.3.",title:"Jx Project Field Union"}}function PF(){return{$id:Co,$schema:"https://json-schema.org/draft/2020-12/schema",anyOf:[...gc,Xm],description:"Default $paths-value union for documents: the core source shapes. Per-project entry documents override this resource with those members PLUS every extension-contributed paths shape.",title:"Jx Document Paths Union"}}function _F(){return{$id:"https://jxsuite.com/schema/extension-manifest/v1",$schema:"https://json-schema.org/draft/2020-12/schema",title:"Jx Extension Manifest",...wE}}function hh(){return{$defs:{ClassConstructorDef:ah,ClassFieldDef:ih,ClassMethodDef:ch,ClassParameterDef:oh,ConnectorBlockDef:dh,FormatDef:lh,ProjectBlockDef:uh,ServerBlockDef:fh,StudioHints:ph},$id:"https://jxsuite.com/schema/class/v1",$schema:"https://json-schema.org/draft/2020-12/schema",additionalProperties:!1,description:"Schema for Jx .class.json files. A class definition describes a schema-defined class with fields, constructor, methods, and type parameters. Optionally points to a JS module via $implementation for hybrid execution.",properties:{$defs:{description:"Class members: parameters, returnTypes, fields, constructor, methods.",properties:{constructor:{$ref:"#/$defs/ClassConstructorDef"},fields:{additionalProperties:{$ref:"#/$defs/ClassFieldDef"},description:"Class fields with role, access, scope, and type information.",type:"object"},methods:{additionalProperties:{$ref:"#/$defs/ClassMethodDef"},description:"Class methods and accessors.",type:"object"},parameters:{additionalProperties:{$ref:"#/$defs/ClassParameterDef"},description:"Reusable typed parameter schemas, keyed by name.",type:"object"},returnTypes:{additionalProperties:{type:"object"},description:"Output type schemas, keyed by name.",type:"object"}},type:"object"},$id:{type:"string"},$implementation:{description:"Relative path to a JS module containing the actual class implementation.",examples:["./md.js","./lib/calculator.js"],type:"string"},$prototype:{const:"Class",description:'Must be "Class" for class definition files.',type:"string"},$schema:{type:"string"},$studio:{$ref:"#/$defs/StudioHints"},connector:{$ref:"#/$defs/ConnectorBlockDef"},description:{type:"string"},extends:{description:"Base class — string name or $ref to another .class.json.",oneOf:[{type:"string"},{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"}]},format:{$ref:"#/$defs/FormatDef"},project:{$ref:"#/$defs/ProjectBlockDef"},server:{$ref:"#/$defs/ServerBlockDef"},title:{description:"PascalCase class name, used as the export name.",examples:["MarkdownFile","DataSource","Calculator"],type:"string"}},required:["$prototype","title"],title:"Jx Class Definition",type:"object"}}async function kF(e){let{mkdirSync:t,writeFileSync:n}=await import("node:fs"),{resolve:r,dirname:s}=await import("node:path"),o=s(r(e,"..")),i=await SF(),a=vF(),c=hh(),l=EF(),u=_F(),d=jF(),p=PF(),m=JSON.stringify(i,null,2),x=JSON.stringify(a,null,2),h=JSON.stringify(c,null,2),g=JSON.stringify(l,null,2),b=JSON.stringify(u,null,2),j=JSON.stringify(d,null,2),v=JSON.stringify(p,null,2),[P]=process.argv.slice(2);if(P)n(P,m,"utf8"),console.error(`Jx component schema written to ${P}`);else{n(r(o,"schema.json"),m,"utf8"),n(r(o,"project-schema.json"),x,"utf8"),n(r(o,"class-schema.json"),h,"utf8"),t(r(o,"schemas"),{recursive:!0}),n(r(o,"schemas","project.core.schema.json"),g,"utf8"),n(r(o,"schemas","project.fields.schema.json"),j,"utf8"),n(r(o,"schemas","document.paths.schema.json"),v,"utf8"),n(r(o,"extension-manifest.schema.json"),b,"utf8");let S=Bun.spawnSync(["bunx","oxfmt",r(o,"schemas","project.core.schema.json"),r(o,"schemas","project.fields.schema.json"),r(o,"schemas","document.paths.schema.json")],{cwd:o});if(S.exitCode!==0){let _=S.stderr.toString()||S.stdout.toString()||`exit ${S.exitCode}${S.signalCode?`, signal ${S.signalCode}`:""}`;console.error(`Warning: skipped oxfmt reformat of generated schemas (${_})`)}console.error("Generated:"),console.error(" schema.json (component)"),console.error(" project-schema.json"),console.error(" class-schema.json"),console.error(" schemas/project.core.schema.json"),console.error(" schemas/project.fields.schema.json"),console.error(" schemas/document.paths.schema.json"),console.error(" extension-manifest.schema.json")}}var _E,kE,OE,jE=null,AE,PE,jZ;var RE=T(()=>{o0();a0();f0();p0();g0();x0();k0();O0();C0();D0();L0();q0();U0();z0();G0();pE();xE();$E();SE();Fu();vE();EE();_E=Jr(Uv(),1),kE=Jr(Gv(),1),OE=Jr(n0(),1);AE={...Hu,additionalProperties:{anyOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/StyleObject"}]}};[,PE]=process.argv,jZ=PE?.endsWith("schema.ts")?kF(PE):void 0});var Sc=W(function(TE){Object.defineProperty(TE,"__esModule",{value:!0});TE.regexpCode=TE.getEsmExportName=TE.getProperty=TE.safeStringify=TE.stringify=TE.strConcat=TE.addCodeArg=TE.str=TE._=TE.nil=TE._Code=TE.Name=TE.IDENTIFIER=TE._CodeOrName=void 0;class Bu{}TE._CodeOrName=Bu;TE.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class qi extends Bu{constructor(e){super();if(!TE.IDENTIFIER.test(e))throw Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}TE.Name=qi;class tr extends Bu{constructor(e){super();this._items=typeof e==="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((t,n)=>`${t}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((t,n)=>{if(n instanceof qi)t[n.str]=(t[n.str]||0)+1;return t},{})}}TE._Code=tr;TE.nil=new tr("");function CE(e,...t){let n=[e[0]],r=0;while(r<t.length)yh(n,t[r]),n.push(e[++r]);return new tr(n)}TE._=CE;var gh=new tr("+");function NE(e,...t){let n=[wc(e[0])],r=0;while(r<t.length)n.push(gh),yh(n,t[r]),n.push(gh,wc(e[++r]));return OF(n),new tr(n)}TE.str=NE;function yh(e,t){if(t instanceof tr)e.push(...t._items);else if(t instanceof qi)e.push(t);else e.push(CF(t))}TE.addCodeArg=yh;function OF(e){let t=1;while(t<e.length-1){if(e[t]===gh){let n=AF(e[t-1],e[t+1]);if(n!==void 0){e.splice(t-1,3,n);continue}e[t++]="+"}t++}}function AF(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string"){if(t instanceof qi||e[e.length-1]!=='"')return;if(typeof t!="string")return`${e.slice(0,-1)}${t}"`;if(t[0]==='"')return e.slice(0,-1)+t.slice(1);return}if(typeof t=="string"&&t[0]==='"'&&!(e instanceof qi))return`"${e}${t.slice(1)}`;return}function RF(e,t){return t.emptyStr()?e:e.emptyStr()?t:NE`${e}${t}`}TE.strConcat=RF;function CF(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:wc(Array.isArray(e)?e.join(","):e)}function NF(e){return new tr(wc(e))}TE.stringify=NF;function wc(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}TE.safeStringify=wc;function TF(e){return typeof e=="string"&&TE.IDENTIFIER.test(e)?new tr(`.${e}`):CE`[${e}]`}TE.getProperty=TF;function JF(e){if(typeof e=="string"&&TE.IDENTIFIER.test(e))return new tr(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}TE.getEsmExportName=JF;function IF(e){return new tr(e.toString())}TE.regexpCode=IF});var wh=W(function(DE){Object.defineProperty(DE,"__esModule",{value:!0});DE.ValueScope=DE.ValueScopeName=DE.Scope=DE.varKinds=DE.UsedValueState=void 0;var He=Sc();class IE extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var Ku;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(Ku||(DE.UsedValueState=Ku={}));DE.varKinds={const:new He.Name("const"),let:new He.Name("let"),var:new He.Name("var")};class bh{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof He.Name?e:this.name(e)}name(e){return new He.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,n;if(((n=(t=this._parent)===null||t===void 0?void 0:t._prefixes)===null||n===void 0?void 0:n.has(e))||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}DE.Scope=bh;class $h extends He.Name{constructor(e,t){super(t);this.prefix=e}setValue(e,{property:t,itemIndex:n}){this.value=e,this.scopePath=He._`.${new He.Name(t)}[${n}]`}}DE.ValueScopeName=$h;var GF=He._`\n`;class ME extends bh{constructor(e){super(e);this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?GF:He.nil}}get(){return this._scope}name(e){return new $h(e,this._newName(e))}value(e,t){var n;if(t.ref===void 0)throw Error("CodeGen: ref must be passed in value");let r=this.toName(e),{prefix:s}=r,o=(n=t.key)!==null&&n!==void 0?n:t.ref,i=this._values[s];if(i){let l=i.get(o);if(l)return l}else i=this._values[s]=new Map;i.set(o,r);let a=this._scope[s]||(this._scope[s]=[]),c=a.length;return a[c]=t.ref,r.setValue(t,{property:s,itemIndex:c}),r}getValue(e,t){let n=this._values[e];if(!n)return;return n.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,(n)=>{if(n.scopePath===void 0)throw Error(`CodeGen: name "${n}" has no value`);return He._`${e}${n.scopePath}`})}scopeCode(e=this._values,t,n){return this._reduceValues(e,(r)=>{if(r.value===void 0)throw Error(`CodeGen: name "${r}" has no value`);return r.value.code},t,n)}_reduceValues(e,t,n={},r){let s=He.nil;for(let o in e){let i=e[o];if(!i)continue;let a=n[o]=n[o]||new Map;i.forEach((c)=>{if(a.has(c))return;a.set(c,Ku.Started);let l=t(c);if(l){let u=this.opts.es5?DE.varKinds.var:DE.varKinds.const;s=He._`${s}${u} ${c} = ${l};${this.opts._n}`}else if(l=r===null||r===void 0?void 0:r(c))s=He._`${s}${l}${this.opts._n}`;else throw new IE(c);a.set(c,Ku.Completed)})}return s}}DE.ValueScope=ME});var ge=W(function(ln){Object.defineProperty(ln,"__esModule",{value:!0});ln.or=ln.and=ln.not=ln.CodeGen=ln.operators=ln.varKinds=ln.ValueScopeName=ln.ValueScope=ln.Scope=ln.Name=ln.regexpCode=ln.stringify=ln.getProperty=ln.nil=ln.strConcat=ln.str=ln._=void 0;var Y=Sc(),ct=wh(),Os=Sc();Object.defineProperty(ln,"_",{enumerable:!0,get:function(){return Os._}});Object.defineProperty(ln,"str",{enumerable:!0,get:function(){return Os.str}});Object.defineProperty(ln,"strConcat",{enumerable:!0,get:function(){return Os.strConcat}});Object.defineProperty(ln,"nil",{enumerable:!0,get:function(){return Os.nil}});Object.defineProperty(ln,"getProperty",{enumerable:!0,get:function(){return Os.getProperty}});Object.defineProperty(ln,"stringify",{enumerable:!0,get:function(){return Os.stringify}});Object.defineProperty(ln,"regexpCode",{enumerable:!0,get:function(){return Os.regexpCode}});Object.defineProperty(ln,"Name",{enumerable:!0,get:function(){return Os.Name}});var ef=wh();Object.defineProperty(ln,"Scope",{enumerable:!0,get:function(){return ef.Scope}});Object.defineProperty(ln,"ValueScope",{enumerable:!0,get:function(){return ef.ValueScope}});Object.defineProperty(ln,"ValueScopeName",{enumerable:!0,get:function(){return ef.ValueScopeName}});Object.defineProperty(ln,"varKinds",{enumerable:!0,get:function(){return ef.varKinds}});ln.operators={GT:new Y._Code(">"),GTE:new Y._Code(">="),LT:new Y._Code("<"),LTE:new Y._Code("<="),EQ:new Y._Code("==="),NEQ:new Y._Code("!=="),NOT:new Y._Code("!"),OR:new Y._Code("||"),AND:new Y._Code("&&"),ADD:new Y._Code("+")};class As{optimizeNodes(){return this}optimizeNames(e,t){return this}}class LE extends As{constructor(e,t,n){super();this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){let n=e?ct.varKinds.var:this.varKind,r=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${r};`+t}optimizeNames(e,t){if(!e[this.name.str])return;if(this.rhs)this.rhs=Hi(this.rhs,e,t);return this}get names(){return this.rhs instanceof Y._CodeOrName?this.rhs.names:{}}}class Eh extends As{constructor(e,t,n){super();this.lhs=e,this.rhs=t,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(this.lhs instanceof Y.Name&&!e[this.lhs.str]&&!this.sideEffects)return;return this.rhs=Hi(this.rhs,e,t),this}get names(){let e=this.lhs instanceof Y.Name?{}:{...this.lhs.names};return Qu(e,this.rhs)}}class VE extends Eh{constructor(e,t,n,r){super(e,n,r);this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class qE extends As{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class WE extends As{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class HE extends As{constructor(e){super();this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class UE extends As{constructor(e){super();this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=Hi(this.code,e,t),this}get names(){return this.code instanceof Y._CodeOrName?this.code.names:{}}}class tf extends As{constructor(e=[]){super();this.nodes=e}render(e){return this.nodes.reduce((t,n)=>t+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,t=e.length;while(t--){let n=e[t].optimizeNodes();if(Array.isArray(n))e.splice(t,1,...n);else if(n)e[t]=n;else e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:n}=this,r=n.length;while(r--){let s=n[r];if(s.optimizeNames(e,t))continue;QF(e,s.names),n.splice(r,1)}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>No(e,t.names),{})}}class Rs extends tf{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class BE extends tf{}class vc extends Rs{}vc.kind="else";class es extends Rs{constructor(e,t){super(t);this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);if(this.else)t+="else "+this.else.render(e);return t}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let t=this.else;if(t){let n=t.optimizeNodes();t=this.else=Array.isArray(n)?new vc(n):n}if(t){if(e===!1)return t instanceof es?t:t.nodes;if(this.nodes.length)return this;return new es(YE(e),t instanceof es?[t]:t.nodes)}if(e===!1||!this.nodes.length)return;return this}optimizeNames(e,t){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,t),!(super.optimizeNames(e,t)||this.else))return;return this.condition=Hi(this.condition,e,t),this}get names(){let e=super.names;if(Qu(e,this.condition),this.else)No(e,this.else.names);return e}}es.kind="if";class Wi extends Rs{}Wi.kind="for";class zE extends Wi{constructor(e){super();this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;return this.iteration=Hi(this.iteration,e,t),this}get names(){return No(super.names,this.iteration.names)}}class KE extends Wi{constructor(e,t,n,r){super();this.varKind=e,this.name=t,this.from=n,this.to=r}render(e){let t=e.es5?ct.varKinds.var:this.varKind,{name:n,from:r,to:s}=this;return`for(${t} ${n}=${r}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){let e=Qu(super.names,this.from);return Qu(e,this.to)}}class Sh extends Wi{constructor(e,t,n,r){super();this.loop=e,this.varKind=t,this.name=n,this.iterable=r}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;return this.iterable=Hi(this.iterable,e,t),this}get names(){return No(super.names,this.iterable.names)}}class Gu extends Rs{constructor(e,t,n){super();this.name=e,this.args=t,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}Gu.kind="func";class Xu extends tf{render(e){return"return "+super.render(e)}}Xu.kind="return";class GE extends Rs{render(e){let t="try"+super.render(e);if(this.catch)t+=this.catch.render(e);if(this.finally)t+=this.finally.render(e);return t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(t=this.finally)===null||t===void 0||t.optimizeNodes(),this}optimizeNames(e,t){var n,r;return super.optimizeNames(e,t),(n=this.catch)===null||n===void 0||n.optimizeNames(e,t),(r=this.finally)===null||r===void 0||r.optimizeNames(e,t),this}get names(){let e=super.names;if(this.catch)No(e,this.catch.names);if(this.finally)No(e,this.finally.names);return e}}class Yu extends Rs{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}Yu.kind="catch";class Zu extends Rs{render(e){return"finally"+super.render(e)}}Zu.kind="finally";class XE{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
|
|
617
|
-
`:""},this._extScope=e,this._scope=new ct.Scope({parent:e}),this._nodes=[new BE]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let n=this._extScope.value(e,t);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,n,r){let s=this._scope.toName(t);if(n!==void 0&&r)this._constants[s.str]=n;return this._leafNode(new LE(e,s,n)),s}const(e,t,n){return this._def(ct.varKinds.const,e,t,n)}let(e,t,n){return this._def(ct.varKinds.let,e,t,n)}var(e,t,n){return this._def(ct.varKinds.var,e,t,n)}assign(e,t,n){return this._leafNode(new Eh(e,t,n))}add(e,t){return this._leafNode(new VE(e,ln.operators.ADD,t))}code(e){if(typeof e=="function")e();else if(e!==Y.nil)this._leafNode(new UE(e));return this}object(...e){let t=["{"];for(let[n,r]of e){if(t.length>1)t.push(",");if(t.push(n),n!==r||this.opts.es5)t.push(":"),Y.addCodeArg(t,r)}return t.push("}"),new Y._Code(t)}if(e,t,n){if(this._blockNode(new es(e)),t&&n)this.code(t).else().code(n).endIf();else if(t)this.code(t).endIf();else if(n)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new es(e))}else(){return this._elseNode(new vc)}endIf(){return this._endBlockNode(es,vc)}_for(e,t){if(this._blockNode(e),t)this.code(t).endFor();return this}for(e,t){return this._for(new zE(e),t)}forRange(e,t,n,r,s=this.opts.es5?ct.varKinds.var:ct.varKinds.let){let o=this._scope.toName(e);return this._for(new KE(s,o,t,n),()=>r(o))}forOf(e,t,n,r=ct.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let o=t instanceof Y.Name?t:this.var("_arr",t);return this.forRange("_i",0,Y._`${o}.length`,(i)=>{this.var(s,Y._`${o}[${i}]`),n(s)})}return this._for(new Sh("of",r,s,t),()=>n(s))}forIn(e,t,n,r=this.opts.es5?ct.varKinds.var:ct.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,Y._`Object.keys(${t})`,n);let s=this._scope.toName(e);return this._for(new Sh("in",r,s,t),()=>n(s))}endFor(){return this._endBlockNode(Wi)}label(e){return this._leafNode(new qE(e))}break(e){return this._leafNode(new WE(e))}return(e){let t=new Xu;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(Xu)}try(e,t,n){if(!t&&!n)throw Error('CodeGen: "try" without "catch" and "finally"');let r=new GE;if(this._blockNode(r),this.code(e),t){let s=this.name("e");this._currNode=r.catch=new Yu(s),t(s)}if(n)this._currNode=r.finally=new Zu,this.code(n);return this._endBlockNode(Yu,Zu)}throw(e){return this._leafNode(new HE(e))}block(e,t){if(this._blockStarts.push(this._nodes.length),e)this.code(e).endBlock(t);return this}endBlock(e){let t=this._blockStarts.pop();if(t===void 0)throw Error("CodeGen: not in self-balancing block");let n=this._nodes.length-t;if(n<0||e!==void 0&&n!==e)throw Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=Y.nil,n,r){if(this._blockNode(new Gu(e,t,n)),r)this.code(r).endFunc();return this}endFunc(){return this._endBlockNode(Gu)}optimize(e=1){while(e-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let n=this._currNode;if(n instanceof e||t&&n instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof es))throw Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}}ln.CodeGen=XE;function No(e,t){for(let n in t)e[n]=(e[n]||0)+(t[n]||0);return e}function Qu(e,t){return t instanceof Y._CodeOrName?No(e,t.names):e}function Hi(e,t,n){if(e instanceof Y.Name)return r(e);if(!s(e))return e;return new Y._Code(e._items.reduce((o,i)=>{if(i instanceof Y.Name)i=r(i);if(i instanceof Y._Code)o.push(...i._items);else o.push(i);return o},[]));function r(o){let i=n[o.str];if(i===void 0||t[o.str]!==1)return o;return delete t[o.str],i}function s(o){return o instanceof Y._Code&&o._items.some((i)=>i instanceof Y.Name&&t[i.str]===1&&n[i.str]!==void 0)}}function QF(e,t){for(let n in t)e[n]=(e[n]||0)-(t[n]||0)}function YE(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:Y._`!${vh(e)}`}ln.not=YE;var eL=ZE(ln.operators.AND);function tL(...e){return e.reduce(eL)}ln.and=tL;var nL=ZE(ln.operators.OR);function rL(...e){return e.reduce(nL)}ln.or=rL;function ZE(e){return(t,n)=>t===Y.nil?n:n===Y.nil?t:Y._`${vh(t)} ${e} ${vh(n)}`}function vh(e){return e instanceof Y.Name?e:Y._`(${e})`}});var ke=W(function(cj){Object.defineProperty(cj,"__esModule",{value:!0});cj.checkStrictMode=cj.getErrorPath=cj.Type=cj.useFunc=cj.setEvaluated=cj.evaluatedPropsToName=cj.mergeEvaluated=cj.eachItem=cj.unescapeJsonPointer=cj.escapeJsonPointer=cj.escapeFragment=cj.unescapeFragment=cj.schemaRefOrVal=cj.schemaHasRulesButRef=cj.schemaHasRules=cj.checkUnknownRules=cj.alwaysValidSchema=cj.toHash=void 0;var ie=ge(),nj=Sc();function aL(e){let t={};for(let n of e)t[n]=!0;return t}cj.toHash=aL;function cL(e,t){if(typeof t=="boolean")return t;if(Object.keys(t).length===0)return!0;return rj(e,t),!sj(t,e.self.RULES.all)}cj.alwaysValidSchema=cL;function rj(e,t=e.schema){let{opts:n,self:r}=e;if(!n.strictSchema)return;if(typeof t==="boolean")return;let s=r.RULES.keywords;for(let o in t)if(!s[o])aj(e,`unknown keyword: "${o}"`)}cj.checkUnknownRules=rj;function sj(e,t){if(typeof e=="boolean")return!e;for(let n in e)if(t[n])return!0;return!1}cj.schemaHasRules=sj;function lL(e,t){if(typeof e=="boolean")return!e;for(let n in e)if(n!=="$ref"&&t.all[n])return!0;return!1}cj.schemaHasRulesButRef=lL;function uL({topSchemaRef:e,schemaPath:t},n,r,s){if(!s){if(typeof n=="number"||typeof n=="boolean")return n;if(typeof n=="string")return ie._`${n}`}return ie._`${e}${t}${ie.getProperty(r)}`}cj.schemaRefOrVal=uL;function fL(e){return oj(decodeURIComponent(e))}cj.unescapeFragment=fL;function dL(e){return encodeURIComponent(Ph(e))}cj.escapeFragment=dL;function Ph(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}cj.escapeJsonPointer=Ph;function oj(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}cj.unescapeJsonPointer=oj;function pL(e,t){if(Array.isArray(e))for(let n of e)t(n);else t(e)}cj.eachItem=pL;function ej({mergeNames:e,mergeToName:t,mergeValues:n,resultToName:r}){return(s,o,i,a)=>{let c=i===void 0?o:i instanceof ie.Name?(o instanceof ie.Name?e(s,o,i):t(s,o,i),i):o instanceof ie.Name?(t(s,i,o),o):n(o,i);return a===ie.Name&&!(c instanceof ie.Name)?r(s,c):c}}cj.mergeEvaluated={props:ej({mergeNames:(e,t,n)=>e.if(ie._`${n} !== true && ${t} !== undefined`,()=>{e.if(ie._`${t} === true`,()=>e.assign(n,!0),()=>e.assign(n,ie._`${n} || {}`).code(ie._`Object.assign(${n}, ${t})`))}),mergeToName:(e,t,n)=>e.if(ie._`${n} !== true`,()=>{if(t===!0)e.assign(n,!0);else e.assign(n,ie._`${n} || {}`),_h(e,n,t)}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:ij}),items:ej({mergeNames:(e,t,n)=>e.if(ie._`${n} !== true && ${t} !== undefined`,()=>e.assign(n,ie._`${t} === true ? true : ${n} > ${t} ? ${n} : ${t}`)),mergeToName:(e,t,n)=>e.if(ie._`${n} !== true`,()=>e.assign(n,t===!0?!0:ie._`${n} > ${t} ? ${n} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function ij(e,t){if(t===!0)return e.var("props",!0);let n=e.var("props",ie._`{}`);if(t!==void 0)_h(e,n,t);return n}cj.evaluatedPropsToName=ij;function _h(e,t,n){Object.keys(n).forEach((r)=>e.assign(ie._`${t}${ie.getProperty(r)}`,!0))}cj.setEvaluated=_h;var tj={};function mL(e,t){return e.scopeValue("func",{ref:t,code:tj[t.code]||(tj[t.code]=new nj._Code(t.code))})}cj.useFunc=mL;var jh;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(jh||(cj.Type=jh={}));function hL(e,t,n){if(e instanceof ie.Name){let r=t===jh.Num;return n?r?ie._`"[" + ${e} + "]"`:ie._`"['" + ${e} + "']"`:r?ie._`"/" + ${e}`:ie._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return n?ie.getProperty(e).toString():"/"+Ph(e)}cj.getErrorPath=hL;function aj(e,t,n=e.opts.strictSchema){if(!n)return;if(t=`strict mode: ${t}`,n===!0)throw Error(t);e.self.logger.warn(t)}cj.checkStrictMode=aj});var Mn=W(function(uj){Object.defineProperty(uj,"__esModule",{value:!0});var Ie=ge(),NL={data:new Ie.Name("data"),valCxt:new Ie.Name("valCxt"),instancePath:new Ie.Name("instancePath"),parentData:new Ie.Name("parentData"),parentDataProperty:new Ie.Name("parentDataProperty"),rootData:new Ie.Name("rootData"),dynamicAnchors:new Ie.Name("dynamicAnchors"),vErrors:new Ie.Name("vErrors"),errors:new Ie.Name("errors"),this:new Ie.Name("this"),self:new Ie.Name("self"),scope:new Ie.Name("scope"),json:new Ie.Name("json"),jsonPos:new Ie.Name("jsonPos"),jsonLen:new Ie.Name("jsonLen"),jsonPart:new Ie.Name("jsonPart")};uj.default=NL});var Ec=W(function(mj){Object.defineProperty(mj,"__esModule",{value:!0});mj.extendErrors=mj.resetErrorsCount=mj.reportExtraError=mj.reportError=mj.keyword$DataError=mj.keywordError=void 0;var Q=ge(),Cs=ke(),Zt=Mn();mj.keywordError={message:({keyword:e})=>Q.str`must pass "${e}" keyword validation`};mj.keyword$DataError={message:({keyword:e,schemaType:t})=>t?Q.str`"${e}" keyword must be ${t} ($data)`:Q.str`"${e}" keyword is invalid ($data)`};function JL(e,t=mj.keywordError,n,r){let{it:s}=e,{gen:o,compositeRule:i,allErrors:a}=s,c=pj(e,t,n);if(r!==null&&r!==void 0?r:i||a)fj(o,c);else dj(s,Q._`[${c}]`)}mj.reportError=JL;function IL(e,t=mj.keywordError,n){let{it:r}=e,{gen:s,compositeRule:o,allErrors:i}=r,a=pj(e,t,n);if(fj(s,a),!(o||i))dj(r,Zt.default.vErrors)}mj.reportExtraError=IL;function ML(e,t){e.assign(Zt.default.errors,t),e.if(Q._`${Zt.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(Q._`${Zt.default.vErrors}.length`,t),()=>e.assign(Zt.default.vErrors,null)))}mj.resetErrorsCount=ML;function DL({gen:e,keyword:t,schemaValue:n,data:r,errsCount:s,it:o}){if(s===void 0)throw Error("ajv implementation error");let i=e.name("err");e.forRange("i",s,Zt.default.errors,(a)=>{if(e.const(i,Q._`${Zt.default.vErrors}[${a}]`),e.if(Q._`${i}.instancePath === undefined`,()=>e.assign(Q._`${i}.instancePath`,Q.strConcat(Zt.default.instancePath,o.errorPath))),e.assign(Q._`${i}.schemaPath`,Q.str`${o.errSchemaPath}/${t}`),o.opts.verbose)e.assign(Q._`${i}.schema`,n),e.assign(Q._`${i}.data`,r)})}mj.extendErrors=DL;function fj(e,t){let n=e.const("err",t);e.if(Q._`${Zt.default.vErrors} === null`,()=>e.assign(Zt.default.vErrors,Q._`[${n}]`),Q._`${Zt.default.vErrors}.push(${n})`),e.code(Q._`${Zt.default.errors}++`)}function dj(e,t){let{gen:n,validateName:r,schemaEnv:s}=e;if(s.$async)n.throw(Q._`new ${e.ValidationError}(${t})`);else n.assign(Q._`${r}.errors`,t),n.return(!1)}var To={keyword:new Q.Name("keyword"),schemaPath:new Q.Name("schemaPath"),params:new Q.Name("params"),propertyName:new Q.Name("propertyName"),message:new Q.Name("message"),schema:new Q.Name("schema"),parentSchema:new Q.Name("parentSchema")};function pj(e,t,n){let{createErrors:r}=e.it;if(r===!1)return Q._`{}`;return FL(e,t,n)}function FL(e,t,n={}){let{gen:r,it:s}=e,o=[LL(s,n),VL(e,n)];return qL(e,t,o),r.object(...o)}function LL({errorPath:e},{instancePath:t}){let n=t?Q.str`${e}${Cs.getErrorPath(t,Cs.Type.Str)}`:e;return[Zt.default.instancePath,Q.strConcat(Zt.default.instancePath,n)]}function VL({keyword:e,it:{errSchemaPath:t}},{schemaPath:n,parentSchema:r}){let s=r?t:Q.str`${t}/${e}`;if(n)s=Q.str`${s}${Cs.getErrorPath(n,Cs.Type.Str)}`;return[To.schemaPath,s]}function qL(e,{params:t,message:n},r){let{keyword:s,data:o,schemaValue:i,it:a}=e,{opts:c,propertyName:l,topSchemaRef:u,schemaPath:d}=a;if(r.push([To.keyword,s],[To.params,typeof t=="function"?t(e):t||Q._`{}`]),c.messages)r.push([To.message,typeof n=="function"?n(e):n]);if(c.verbose)r.push([To.schema,i],[To.parentSchema,Q._`${u}${d}`],[Zt.default.data,o]);if(l)r.push([To.propertyName,l])}});var wj=W(function(bj){Object.defineProperty(bj,"__esModule",{value:!0});bj.boolOrEmptySchema=bj.topBoolOrEmptySchema=void 0;var gj=Ec(),yj=ge(),zL=Mn(),KL={message:"boolean schema is false"};function GL(e){let{gen:t,schema:n,validateName:r}=e;if(n===!1)xj(e,!1);else if(typeof n=="object"&&n.$async===!0)t.return(zL.default.data);else t.assign(yj._`${r}.errors`,null),t.return(!0)}bj.topBoolOrEmptySchema=GL;function XL(e,t){let{gen:n,schema:r}=e;if(r===!1)n.var(t,!1),xj(e);else n.var(t,!0)}bj.boolOrEmptySchema=XL;function xj(e,t){let{gen:n,data:r}=e;gj.reportError({gen:n,keyword:"false schema",data:r,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},KL,void 0,t)}});var Oh=W(function(Sj){Object.defineProperty(Sj,"__esModule",{value:!0});Sj.getRules=Sj.isJSONType=void 0;var ZL=["string","number","integer","boolean","null","object","array"],QL=new Set(ZL);function e2(e){return typeof e=="string"&&QL.has(e)}Sj.isJSONType=e2;function t2(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}Sj.getRules=t2});var Ah=W(function(Pj){Object.defineProperty(Pj,"__esModule",{value:!0});Pj.shouldUseRule=Pj.shouldUseGroup=Pj.schemaHasRulesForType=void 0;function r2({schema:e,self:t},n){let r=t.RULES.types[n];return r&&r!==!0&&Ej(e,r)}Pj.schemaHasRulesForType=r2;function Ej(e,t){return t.rules.some((n)=>jj(e,n))}Pj.shouldUseGroup=Ej;function jj(e,t){var n;return e[t.keyword]!==void 0||((n=t.definition.implements)===null||n===void 0?void 0:n.some((r)=>e[r]!==void 0))}Pj.shouldUseRule=jj});var jc=W(function(Nj){Object.defineProperty(Nj,"__esModule",{value:!0});Nj.reportTypeError=Nj.checkDataTypes=Nj.checkDataType=Nj.coerceAndCheckDataType=Nj.getJSONTypes=Nj.getSchemaTypes=Nj.DataType=void 0;var kj=Oh(),Oj=Ah(),Aj=Ec(),B=ge(),rf=ke(),Ui;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(Ui||(Nj.DataType=Ui={}));function i2(e){let t=Rj(e.type);if(t.includes("null")){if(e.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(e.nullable===!0)t.push("null")}return t}Nj.getSchemaTypes=i2;function Rj(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(kj.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}Nj.getJSONTypes=Rj;function a2(e,t){let{gen:n,data:r,opts:s}=e,o=c2(t,s.coerceTypes),i=t.length>0&&!(o.length===0&&t.length===1&&Oj.schemaHasRulesForType(e,t[0]));if(i){let a=Ch(t,r,s.strictNumbers,Ui.Wrong);n.if(a,()=>{if(o.length)l2(e,t,o);else Nh(e)})}return i}Nj.coerceAndCheckDataType=a2;var Cj=new Set(["string","number","integer","boolean","null"]);function c2(e,t){return t?e.filter((n)=>Cj.has(n)||t==="array"&&n==="array"):[]}function l2(e,t,n){let{gen:r,data:s,opts:o}=e,i=r.let("dataType",B._`typeof ${s}`),a=r.let("coerced",B._`undefined`);if(o.coerceTypes==="array")r.if(B._`${i} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,()=>r.assign(s,B._`${s}[0]`).assign(i,B._`typeof ${s}`).if(Ch(t,s,o.strictNumbers),()=>r.assign(a,s)));r.if(B._`${a} !== undefined`);for(let l of n)if(Cj.has(l)||l==="array"&&o.coerceTypes==="array")c(l);r.else(),Nh(e),r.endIf(),r.if(B._`${a} !== undefined`,()=>{r.assign(s,a),u2(e,a)});function c(l){switch(l){case"string":r.elseIf(B._`${i} == "number" || ${i} == "boolean"`).assign(a,B._`"" + ${s}`).elseIf(B._`${s} === null`).assign(a,B._`""`);return;case"number":r.elseIf(B._`${i} == "boolean" || ${s} === null
|
|
618
|
-
|| (${i} == "string" && ${s} && ${s} == +${s})`).assign(a,
|
|
619
|
-
|| (${i} === "string" && ${s} && ${s} == +${s} && !(${s} % 1))`).assign(a,
|
|
620
|
-
|| ${i} === "boolean" || ${s} === null`).assign(a,B._`[${s}]`)}}}function u2({gen:e,parentData:t,parentDataProperty:n},r){e.if(B._`${t} !== undefined`,()=>e.assign(B._`${t}[${n}]`,r))}function Rh(e,t,n,r=Ui.Correct){let s=r===Ui.Correct?B.operators.EQ:B.operators.NEQ,o;switch(e){case"null":return B._`${t} ${s} null`;case"array":o=B._`Array.isArray(${t})`;break;case"object":o=B._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":o=i(B._`!(${t} % 1) && !isNaN(${t})`);break;case"number":o=i();break;default:return B._`typeof ${t} ${s} ${e}`}return r===Ui.Correct?o:B.not(o);function i(a=B.nil){return B.and(B._`typeof ${t} == "number"`,a,n?B._`isFinite(${t})`:B.nil)}}Nj.checkDataType=Rh;function Ch(e,t,n,r){if(e.length===1)return Rh(e[0],t,n,r);let s,o=rf.toHash(e);if(o.array&&o.object){let i=B._`typeof ${t} != "object"`;s=o.null?i:B._`!${t} || ${i}`,delete o.null,delete o.array,delete o.object}else s=B.nil;if(o.number)delete o.integer;for(let i in o)s=B.and(s,Rh(i,t,n,r));return s}Nj.checkDataTypes=Ch;var f2={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?B._`{type: ${e}}`:B._`{type: ${t}}`};function Nh(e){let t=d2(e);Aj.reportError(t,f2)}Nj.reportTypeError=Nh;function d2(e){let{gen:t,data:n,schema:r}=e,s=rf.schemaRefOrVal(e,r,"type");return{gen:t,keyword:"type",data:n,schema:r.type,schemaCode:s,schemaValue:s,parentSchema:r,params:{},it:e}}});var Fj=W(function(Mj){Object.defineProperty(Mj,"__esModule",{value:!0});Mj.assignDefaults=void 0;var Dn=ge(),Ij=ke();function b2(e,t){let{properties:n,items:r}=e.schema;if(t==="object"&&n)for(let s in n)Jj(e,s,n[s].default);else if(t==="array"&&Array.isArray(r))r.forEach((s,o)=>Jj(e,o,s.default))}Mj.assignDefaults=b2;function Jj(e,t,n){let{gen:r,compositeRule:s,data:o,opts:i}=e;if(n===void 0)return;let a=Dn._`${o}${Dn.getProperty(t)}`;if(s){Ij.checkStrictMode(e,`default is ignored for: ${a}`);return}let c=Dn._`${a} === undefined`;if(i.useDefaults==="empty")c=Dn._`${c} || ${a} === null || ${a} === ""`;r.if(c,Dn._`${a} = ${Dn.stringify(n)}`)}});var Fn=W(function(Wj){Object.defineProperty(Wj,"__esModule",{value:!0});Wj.validateUnion=Wj.validateArray=Wj.usePattern=Wj.callValidateCode=Wj.schemaProperties=Wj.allSchemaProperties=Wj.noPropertyInData=Wj.propertyInData=Wj.isOwnProperty=Wj.hasPropFunc=Wj.reportMissingProp=Wj.checkMissingProp=Wj.checkReportMissingProp=void 0;var ue=ge(),Bi=ke(),Ns=Mn(),Lj=ke();function $2(e,t){let{gen:n,data:r,it:s}=e;n.if(Jh(n,r,t,s.opts.ownProperties),()=>{e.setParams({missingProperty:ue._`${t}`},!0),e.error()})}Wj.checkReportMissingProp=$2;function w2({gen:e,data:t,it:{opts:n}},r,s){return ue.or(...r.map((o)=>ue.and(Jh(e,t,o,n.ownProperties),ue._`${s} = ${o}`)))}Wj.checkMissingProp=w2;function S2(e,t){e.setParams({missingProperty:t},!0),e.error()}Wj.reportMissingProp=S2;function Vj(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:ue._`Object.prototype.hasOwnProperty`})}Wj.hasPropFunc=Vj;function Th(e,t,n){return ue._`${Vj(e)}.call(${t}, ${n})`}Wj.isOwnProperty=Th;function v2(e,t,n,r){let s=ue._`${t}${ue.getProperty(n)} !== undefined`;return r?ue._`${s} && ${Th(e,t,n)}`:s}Wj.propertyInData=v2;function Jh(e,t,n,r){let s=ue._`${t}${ue.getProperty(n)} === undefined`;return r?ue.or(s,ue.not(Th(e,t,n))):s}Wj.noPropertyInData=Jh;function qj(e){return e?Object.keys(e).filter((t)=>t!=="__proto__"):[]}Wj.allSchemaProperties=qj;function E2(e,t){return qj(t).filter((n)=>!Bi.alwaysValidSchema(e,t[n]))}Wj.schemaProperties=E2;function j2({schemaCode:e,data:t,it:{gen:n,topSchemaRef:r,schemaPath:s,errorPath:o},it:i},a,c,l){let u=l?ue._`${e}, ${t}, ${r}${s}`:t,d=[[Ns.default.instancePath,ue.strConcat(Ns.default.instancePath,o)],[Ns.default.parentData,i.parentData],[Ns.default.parentDataProperty,i.parentDataProperty],[Ns.default.rootData,Ns.default.rootData]];if(i.opts.dynamicRef)d.push([Ns.default.dynamicAnchors,Ns.default.dynamicAnchors]);let p=ue._`${u}, ${n.object(...d)}`;return c!==ue.nil?ue._`${a}.call(${c}, ${p})`:ue._`${a}(${p})`}Wj.callValidateCode=j2;var P2=ue._`new RegExp`;function _2({gen:e,it:{opts:t}},n){let r=t.unicodeRegExp?"u":"",{regExp:s}=t.code,o=s(n,r);return e.scopeValue("pattern",{key:o.toString(),ref:o,code:ue._`${s.code==="new RegExp"?P2:Lj.useFunc(e,s)}(${n}, ${r})`})}Wj.usePattern=_2;function k2(e){let{gen:t,data:n,keyword:r,it:s}=e,o=t.name("valid");if(s.allErrors){let a=t.let("valid",!0);return i(()=>t.assign(a,!1)),a}return t.var(o,!0),i(()=>t.break()),o;function i(a){let c=t.const("len",ue._`${n}.length`);t.forRange("i",0,c,(l)=>{e.subschema({keyword:r,dataProp:l,dataPropType:Bi.Type.Num},o),t.if(ue.not(o),a)})}}Wj.validateArray=k2;function O2(e){let{gen:t,schema:n,keyword:r,it:s}=e;if(!Array.isArray(n))throw Error("ajv implementation error");if(n.some((c)=>Bi.alwaysValidSchema(s,c))&&!s.opts.unevaluated)return;let i=t.let("valid",!1),a=t.name("_valid");t.block(()=>n.forEach((c,l)=>{let u=e.subschema({keyword:r,schemaProp:l,compositeRule:!0},a);if(t.assign(i,ue._`${i} || ${a}`),!e.mergeValidEvaluated(u,a))t.if(ue.not(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}Wj.validateUnion=O2});var Yj=W(function(Gj){Object.defineProperty(Gj,"__esModule",{value:!0});Gj.validateKeywordUsage=Gj.validSchemaType=Gj.funcKeywordCode=Gj.macroKeywordCode=void 0;var De=ge(),Jo=Mn(),Bj=Fn(),zj=Ec();function q2(e,t){let{gen:n,keyword:r,schema:s,parentSchema:o,it:i}=e,a=t.macro.call(i.self,s,o,i),c=Kj(n,r,a);if(i.opts.validateSchema!==!1)i.self.validateSchema(a,!0);let l=n.name("valid");e.subschema({schema:a,schemaPath:De.nil,errSchemaPath:`${i.errSchemaPath}/${r}`,topSchemaRef:c,compositeRule:!0},l),e.pass(l,()=>e.error(!0))}Gj.macroKeywordCode=q2;function W2(e,t){var n;let{gen:r,keyword:s,schema:o,parentSchema:i,$data:a,it:c}=e;U2(c,t);let l=!a&&t.compile?t.compile.call(c.self,o,i,c):t.validate,u=Kj(r,s,l),d=r.let("valid");e.block$data(d,p),e.ok((n=t.valid)!==null&&n!==void 0?n:d);function p(){if(t.errors===!1){if(h(),t.modifying)Uj(e);g(()=>e.error())}else{let b=t.async?m():x();if(t.modifying)Uj(e);g(()=>H2(e,b))}}function m(){let b=r.let("ruleErrs",null);return r.try(()=>h(De._`await `),(j)=>r.assign(d,!1).if(De._`${j} instanceof ${c.ValidationError}`,()=>r.assign(b,De._`${j}.errors`),()=>r.throw(j))),b}function x(){let b=De._`${u}.errors`;return r.assign(b,null),h(De.nil),b}function h(b=t.async?De._`await `:De.nil){let j=c.opts.passContext?Jo.default.this:Jo.default.self,v=!(("compile"in t)&&!a||t.schema===!1);r.assign(d,De._`${b}${Bj.callValidateCode(e,u,j,v)}`,t.modifying)}function g(b){var j;r.if(De.not((j=t.valid)!==null&&j!==void 0?j:d),b)}}Gj.funcKeywordCode=W2;function Uj(e){let{gen:t,data:n,it:r}=e;t.if(r.parentData,()=>t.assign(n,De._`${r.parentData}[${r.parentDataProperty}]`))}function H2(e,t){let{gen:n}=e;n.if(De._`Array.isArray(${t})`,()=>{n.assign(Jo.default.vErrors,De._`${Jo.default.vErrors} === null ? ${t} : ${Jo.default.vErrors}.concat(${t})`).assign(Jo.default.errors,De._`${Jo.default.vErrors}.length`),zj.extendErrors(e)},()=>e.error())}function U2({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}function Kj(e,t,n){if(n===void 0)throw Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof n=="function"?{ref:n}:{ref:n,code:De.stringify(n)})}function B2(e,t,n=!1){return!t.length||t.some((r)=>r==="array"?Array.isArray(e):r==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==r||n&&typeof e>"u")}Gj.validSchemaType=B2;function z2({schema:e,opts:t,self:n,errSchemaPath:r},s,o){if(Array.isArray(s.keyword)?!s.keyword.includes(o):s.keyword!==o)throw Error("ajv implementation error");let i=s.dependencies;if(i===null||i===void 0?void 0:i.some((a)=>!Object.prototype.hasOwnProperty.call(e,a)))throw Error(`parent schema must have dependencies of ${o}: ${i.join(",")}`);if(s.validateSchema){if(!s.validateSchema(e[o])){let c=`keyword "${o}" value is invalid at path "${r}": `+n.errorsText(s.validateSchema.errors);if(t.validateSchema==="log")n.logger.error(c);else throw Error(c)}}}Gj.validateKeywordUsage=z2});var eP=W(function(Zj){Object.defineProperty(Zj,"__esModule",{value:!0});Zj.extendSubschemaMode=Zj.extendSubschemaData=Zj.getSubschema=void 0;var wt=ge(),sf=ke();function Y2(e,{keyword:t,schemaProp:n,schema:r,schemaPath:s,errSchemaPath:o,topSchemaRef:i}){if(t!==void 0&&r!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let a=e.schema[t];return n===void 0?{schema:a,schemaPath:wt._`${e.schemaPath}${wt.getProperty(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[n],schemaPath:wt._`${e.schemaPath}${wt.getProperty(t)}${wt.getProperty(n)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${sf.escapeFragment(n)}`}}if(r!==void 0){if(s===void 0||o===void 0||i===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:r,schemaPath:s,topSchemaRef:i,errSchemaPath:o}}throw Error('either "keyword" or "schema" must be passed')}Zj.getSubschema=Y2;function Z2(e,t,{dataProp:n,dataPropType:r,data:s,dataTypes:o,propertyName:i}){if(s!==void 0&&n!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(n!==void 0){let{errorPath:l,dataPathArr:u,opts:d}=t,p=a.let("data",wt._`${t.data}${wt.getProperty(n)}`,!0);c(p),e.errorPath=wt.str`${l}${sf.getErrorPath(n,r,d.jsPropertySyntax)}`,e.parentDataProperty=wt._`${n}`,e.dataPathArr=[...u,e.parentDataProperty]}if(s!==void 0){let l=s instanceof wt.Name?s:a.let("data",s,!0);if(c(l),i!==void 0)e.propertyName=i}if(o)e.dataTypes=o;function c(l){e.data=l,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,l]}}Zj.extendSubschemaData=Z2;function Q2(e,{jtdDiscriminator:t,jtdMetadata:n,compositeRule:r,createErrors:s,allErrors:o}){if(r!==void 0)e.compositeRule=r;if(s!==void 0)e.createErrors=s;if(o!==void 0)e.allErrors=o;e.jtdDiscriminator=t,e.jtdMetadata=n}Zj.extendSubschemaMode=Q2});var Ih=W(function(QZ,tP){tP.exports=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var r,s,o;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(s=r;s--!==0;)if(!e(t[s],n[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(o=Object.keys(t),r=o.length,r!==Object.keys(n).length)return!1;for(s=r;s--!==0;)if(!Object.prototype.hasOwnProperty.call(n,o[s]))return!1;for(s=r;s--!==0;){var i=o[s];if(!e(t[i],n[i]))return!1}return!0}return t!==t&&n!==n}});var rP=W(function(eQ,nP){var Ts=nP.exports=function(e,t,n){if(typeof t=="function")n=t,t={};n=t.cb||n;var r=typeof n=="function"?n:n.pre||function(){},s=n.post||function(){};of(t,r,s,e,"",e)};Ts.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Ts.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Ts.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Ts.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function of(e,t,n,r,s,o,i,a,c,l){if(r&&typeof r=="object"&&!Array.isArray(r)){t(r,s,o,i,a,c,l);for(var u in r){var d=r[u];if(Array.isArray(d)){if(u in Ts.arrayKeywords)for(var p=0;p<d.length;p++)of(e,t,n,d[p],s+"/"+u+"/"+p,o,s,u,r,p)}else if(u in Ts.propsKeywords){if(d&&typeof d=="object")for(var m in d)of(e,t,n,d[m],s+"/"+u+"/"+nV(m),o,s,u,r,m)}else if(u in Ts.keywords||e.allKeys&&!(u in Ts.skipKeywords))of(e,t,n,d,s+"/"+u,o,s,u,r)}n(r,s,o,i,a,c,l)}}function nV(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Pc=W(function(cP){Object.defineProperty(cP,"__esModule",{value:!0});cP.getSchemaRefs=cP.resolveUrl=cP.normalizeId=cP._getFullPath=cP.getFullPath=cP.inlineRef=void 0;var sP=ke(),rV=Ih(),sV=rP(),oV=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function iV(e,t=!0){if(typeof e=="boolean")return!0;if(t===!0)return!Mh(e);if(!t)return!1;return oP(e)<=t}cP.inlineRef=iV;var aV=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Mh(e){for(let t in e){if(aV.has(t))return!0;let n=e[t];if(Array.isArray(n)&&n.some(Mh))return!0;if(typeof n=="object"&&Mh(n))return!0}return!1}function oP(e){let t=0;for(let n in e){if(n==="$ref")return 1/0;if(t++,oV.has(n))continue;if(typeof e[n]=="object")sP.eachItem(e[n],(r)=>t+=oP(r));if(t===1/0)return 1/0}return t}function iP(e,t="",n){if(n!==!1)t=zi(t);let r=e.parse(t);return aP(e,r)}cP.getFullPath=iP;function aP(e,t){return e.serialize(t).split("#")[0]+"#"}cP._getFullPath=aP;var cV=/#\/?$/;function zi(e){return e?e.replace(cV,""):""}cP.normalizeId=zi;function lV(e,t,n){return n=zi(n),e.resolve(t,n)}cP.resolveUrl=lV;var uV=/^[a-z_][-a-z0-9._]*$/i;function fV(e,t){if(typeof e=="boolean")return{};let{schemaId:n,uriResolver:r}=this.opts,s=zi(e[n]||t),o={"":s},i=iP(r,s,!1),a={},c=new Set;return sV(e,{allKeys:!0},(d,p,m,x)=>{if(x===void 0)return;let h=i+p,g=o[x];if(typeof d[n]=="string")g=b.call(this,d[n]);j.call(this,d.$anchor),j.call(this,d.$dynamicAnchor),o[p]=g;function b(v){let P=this.opts.uriResolver.resolve;if(v=zi(g?P(g,v):v),c.has(v))throw u(v);c.add(v);let S=this.refs[v];if(typeof S=="string")S=this.refs[S];if(typeof S=="object")l(d,S.schema,v);else if(v!==zi(h))if(v[0]==="#")l(d,a[v],v),a[v]=d;else this.refs[v]=h;return v}function j(v){if(typeof v=="string"){if(!uV.test(v))throw Error(`invalid anchor "${v}"`);b.call(this,`#${v}`)}}}),a;function l(d,p,m){if(p!==void 0&&!rV(d,p))throw u(m)}function u(d){return Error(`reference "${d}" resolves to more than one schema`)}}cP.getSchemaRefs=fV});var Xi=W(function(EP){Object.defineProperty(EP,"__esModule",{value:!0});EP.getData=EP.KeywordCxt=EP.validateFunctionCode=void 0;var cf=wj(),af=jc(),Gi=Ah(),Js=jc(),pP=Fj(),br=Yj(),Ki=eP(),M=ge(),he=Mn(),mP=Pc(),kt=ke(),xr=Ec();function yV(e){if(yP(e)){if(xP(e),gP(e)){$V(e);return}}hP(e,()=>cf.topBoolOrEmptySchema(e))}EP.validateFunctionCode=yV;function hP({gen:e,validateName:t,schema:n,schemaEnv:r,opts:s},o){if(s.code.es5)e.func(t,M._`${he.default.data}, ${he.default.valCxt}`,r.$async,()=>{e.code(M._`"use strict"; ${uP(n,s)}`),bV(e,s),e.code(o)});else e.func(t,M._`${he.default.data}, ${xV(s)}`,r.$async,()=>e.code(uP(n,s)).code(o))}function xV(e){return M._`{${he.default.instancePath}="", ${he.default.parentData}, ${he.default.parentDataProperty}, ${he.default.rootData}=${he.default.data}${e.dynamicRef?M._`, ${he.default.dynamicAnchors}={}`:M.nil}}={}`}function bV(e,t){e.if(he.default.valCxt,()=>{if(e.var(he.default.instancePath,M._`${he.default.valCxt}.${he.default.instancePath}`),e.var(he.default.parentData,M._`${he.default.valCxt}.${he.default.parentData}`),e.var(he.default.parentDataProperty,M._`${he.default.valCxt}.${he.default.parentDataProperty}`),e.var(he.default.rootData,M._`${he.default.valCxt}.${he.default.rootData}`),t.dynamicRef)e.var(he.default.dynamicAnchors,M._`${he.default.valCxt}.${he.default.dynamicAnchors}`)},()=>{if(e.var(he.default.instancePath,M._`""`),e.var(he.default.parentData,M._`undefined`),e.var(he.default.parentDataProperty,M._`undefined`),e.var(he.default.rootData,he.default.data),t.dynamicRef)e.var(he.default.dynamicAnchors,M._`{}`)})}function $V(e){let{schema:t,opts:n,gen:r}=e;hP(e,()=>{if(n.$comment&&t.$comment)$P(e);if(jV(e),r.let(he.default.vErrors,null),r.let(he.default.errors,0),n.unevaluated)wV(e);bP(e),kV(e)});return}function wV(e){let{gen:t,validateName:n}=e;e.evaluated=t.const("evaluated",M._`${n}.evaluated`),t.if(M._`${e.evaluated}.dynamicProps`,()=>t.assign(M._`${e.evaluated}.props`,M._`undefined`)),t.if(M._`${e.evaluated}.dynamicItems`,()=>t.assign(M._`${e.evaluated}.items`,M._`undefined`))}function uP(e,t){let n=typeof e=="object"&&e[t.schemaId];return n&&(t.code.source||t.code.process)?M._`/*# sourceURL=${n} */`:M.nil}function SV(e,t){if(yP(e)){if(xP(e),gP(e)){vV(e,t);return}}cf.boolOrEmptySchema(e,t)}function gP({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let n in e)if(t.RULES.all[n])return!0;return!1}function yP(e){return typeof e.schema!="boolean"}function vV(e,t){let{schema:n,gen:r,opts:s}=e;if(s.$comment&&n.$comment)$P(e);PV(e),_V(e);let o=r.const("_errs",he.default.errors);bP(e,o),r.var(t,M._`${o} === ${he.default.errors}`)}function xP(e){kt.checkUnknownRules(e),EV(e)}function bP(e,t){if(e.opts.jtd)return fP(e,[],!1,t);let n=af.getSchemaTypes(e.schema),r=af.coerceAndCheckDataType(e,n);fP(e,n,!r,t)}function EV(e){let{schema:t,errSchemaPath:n,opts:r,self:s}=e;if(t.$ref&&r.ignoreKeywordsWithRef&&kt.schemaHasRulesButRef(t,s.RULES))s.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}function jV(e){let{schema:t,opts:n}=e;if(t.default!==void 0&&n.useDefaults&&n.strictSchema)kt.checkStrictMode(e,"default is ignored in the schema root")}function PV(e){let t=e.schema[e.opts.schemaId];if(t)e.baseId=mP.resolveUrl(e.opts.uriResolver,e.baseId,t)}function _V(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function $P({gen:e,schemaEnv:t,schema:n,errSchemaPath:r,opts:s}){let o=n.$comment;if(s.$comment===!0)e.code(M._`${he.default.self}.logger.log(${o})`);else if(typeof s.$comment=="function"){let i=M.str`${r}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code(M._`${he.default.self}.opts.$comment(${o}, ${i}, ${a}.schema)`)}}function kV(e){let{gen:t,schemaEnv:n,validateName:r,ValidationError:s,opts:o}=e;if(n.$async)t.if(M._`${he.default.errors} === 0`,()=>t.return(he.default.data),()=>t.throw(M._`new ${s}(${he.default.vErrors})`));else{if(t.assign(M._`${r}.errors`,he.default.vErrors),o.unevaluated)OV(e);t.return(M._`${he.default.errors} === 0`)}}function OV({gen:e,evaluated:t,props:n,items:r}){if(n instanceof M.Name)e.assign(M._`${t}.props`,n);if(r instanceof M.Name)e.assign(M._`${t}.items`,r)}function fP(e,t,n,r){let{gen:s,schema:o,data:i,allErrors:a,opts:c,self:l}=e,{RULES:u}=l;if(o.$ref&&(c.ignoreKeywordsWithRef||!kt.schemaHasRulesButRef(o,u))){s.block(()=>SP(e,"$ref",u.all.$ref.definition));return}if(!c.jtd)AV(e,t);s.block(()=>{for(let p of u.rules)d(p);d(u.post)});function d(p){if(!Gi.shouldUseGroup(o,p))return;if(p.type){if(s.if(Js.checkDataType(p.type,i,c.strictNumbers)),dP(e,p),t.length===1&&t[0]===p.type&&n)s.else(),Js.reportTypeError(e);s.endIf()}else dP(e,p);if(!a)s.if(M._`${he.default.errors} === ${r||0}`)}}function dP(e,t){let{gen:n,schema:r,opts:{useDefaults:s}}=e;if(s)pP.assignDefaults(e,t.type);n.block(()=>{for(let o of t.rules)if(Gi.shouldUseRule(r,o))SP(e,o.keyword,o.definition,t.type)})}function AV(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;if(RV(e,t),!e.opts.allowUnionTypes)CV(e,t);NV(e,e.dataTypes)}function RV(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((n)=>{if(!wP(e.dataTypes,n))Dh(e,`type "${n}" not allowed by context "${e.dataTypes.join(",")}"`)}),JV(e,t)}function CV(e,t){if(t.length>1&&!(t.length===2&&t.includes("null")))Dh(e,"use allowUnionTypes to allow union type keyword")}function NV(e,t){let n=e.self.RULES.all;for(let r in n){let s=n[r];if(typeof s=="object"&&Gi.shouldUseRule(e.schema,s)){let{type:o}=s.definition;if(o.length&&!o.some((i)=>TV(t,i)))Dh(e,`missing type "${o.join(",")}" for keyword "${r}"`)}}}function TV(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function wP(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function JV(e,t){let n=[];for(let r of e.dataTypes)if(wP(t,r))n.push(r);else if(t.includes("integer")&&r==="number")n.push("integer");e.dataTypes=n}function Dh(e,t){let n=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${n}" (strictTypes)`,kt.checkStrictMode(e,t,e.opts.strictTypes)}class Fh{constructor(e,t,n){if(br.validateKeywordUsage(e,t,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=kt.schemaRefOrVal(e,this.schema,n,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",vP(this.$data,e));else if(this.schemaCode=this.schemaValue,!br.validSchemaType(this.schema,t.schemaType,t.allowUndefined))throw Error(`${n} value must be ${JSON.stringify(t.schemaType)}`);if("code"in t?t.trackErrors:t.errors!==!1)this.errsCount=e.gen.const("_errs",he.default.errors)}result(e,t,n){this.failResult(M.not(e),t,n)}failResult(e,t,n){if(this.gen.if(e),n)n();else this.error();if(t){if(this.gen.else(),t(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(e,t){this.failResult(M.not(e),void 0,t)}fail(e){if(e===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(e),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail(M._`${t} !== undefined && (${M.or(this.invalid$data(),e)})`)}error(e,t,n){if(t){this.setParams(t),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,t){(e?xr.reportExtraError:xr.reportError)(this,this.def.error,t)}$dataError(){xr.reportError(this,this.def.$dataError||xr.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');xr.resetErrorsCount(this.gen,this.errsCount)}ok(e){if(!this.allErrors)this.gen.if(e)}setParams(e,t){if(t)Object.assign(this.params,e);else this.params=e}block$data(e,t,n=M.nil){this.gen.block(()=>{this.check$data(e,n),t()})}check$data(e=M.nil,t=M.nil){if(!this.$data)return;let{gen:n,schemaCode:r,schemaType:s,def:o}=this;if(n.if(M.or(M._`${r} === undefined`,t)),e!==M.nil)n.assign(e,!0);if(s.length||o.validateSchema){if(n.elseIf(this.invalid$data()),this.$dataError(),e!==M.nil)n.assign(e,!1)}n.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:n,def:r,it:s}=this;return M.or(o(),i());function o(){if(n.length){if(!(t instanceof M.Name))throw Error("ajv implementation error");let a=Array.isArray(n)?n:[n];return M._`${Js.checkDataTypes(a,t,s.opts.strictNumbers,Js.DataType.Wrong)}`}return M.nil}function i(){if(r.validateSchema){let a=e.scopeValue("validate$data",{ref:r.validateSchema});return M._`!${a}(${t})`}return M.nil}}subschema(e,t){let n=Ki.getSubschema(this.it,e);Ki.extendSubschemaData(n,this.it,e),Ki.extendSubschemaMode(n,e);let r={...this.it,...n,items:void 0,props:void 0};return SV(r,t),r}mergeEvaluated(e,t){let{it:n,gen:r}=this;if(!n.opts.unevaluated)return;if(n.props!==!0&&e.props!==void 0)n.props=kt.mergeEvaluated.props(r,e.props,n.props,t);if(n.items!==!0&&e.items!==void 0)n.items=kt.mergeEvaluated.items(r,e.items,n.items,t)}mergeValidEvaluated(e,t){let{it:n,gen:r}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return r.if(t,()=>this.mergeEvaluated(e,M.Name)),!0}}EP.KeywordCxt=Fh;function SP(e,t,n,r){let s=new Fh(e,n,t);if("code"in n)n.code(s,r);else if(s.$data&&n.validate)br.funcKeywordCode(s,n);else if("macro"in n)br.macroKeywordCode(s,n);else if(n.compile||n.validate)br.funcKeywordCode(s,n)}var IV=/^\/(?:[^~]|~0|~1)*$/,MV=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function vP(e,{dataLevel:t,dataNames:n,dataPathArr:r}){let s,o;if(e==="")return he.default.rootData;if(e[0]==="/"){if(!IV.test(e))throw Error(`Invalid JSON-pointer: ${e}`);s=e,o=he.default.rootData}else{let l=MV.exec(e);if(!l)throw Error(`Invalid JSON-pointer: ${e}`);let u=+l[1];if(s=l[2],s==="#"){if(u>=t)throw Error(c("property/index",u));return r[t-u]}if(u>t)throw Error(c("data",u));if(o=n[t-u],!s)return o}let i=o,a=s.split("/");for(let l of a)if(l)o=M._`${o}${M.getProperty(kt.unescapeJsonPointer(l))}`,i=M._`${i} && ${o}`;return i;function c(l,u){return`Cannot access ${l} ${u} levels up, current level is ${t}`}}EP.getData=vP});var _c=W(function(_P){Object.defineProperty(_P,"__esModule",{value:!0});class PP extends Error{constructor(e){super("validation failed");this.errors=e,this.ajv=this.validation=!0}}_P.default=PP});var Zi=W(function(OP){Object.defineProperty(OP,"__esModule",{value:!0});var Yi=Pc();class kP extends Error{constructor(e,t,n,r){super(r||`can't resolve reference ${n} from id ${t}`);this.missingRef=Yi.resolveUrl(e,t,n),this.missingSchema=Yi.normalizeId(Yi.getFullPath(e,this.missingRef))}}OP.default=kP});var Oc=W(function(CP){Object.defineProperty(CP,"__esModule",{value:!0});CP.resolveSchema=CP.getCompilingSchema=CP.resolveRef=CP.compileSchema=CP.SchemaEnv=void 0;var lt=ge(),qV=_c(),Io=Mn(),ut=Pc(),lf=ke(),AP=Xi();class kc{constructor(e){var t;this.refs={},this.dynamicAnchors={};let n;if(typeof e.schema=="object")n=e.schema;this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(t=e.baseId)!==null&&t!==void 0?t:ut.normalizeId(n===null||n===void 0?void 0:n[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n===null||n===void 0?void 0:n.$async,this.refs={}}}CP.SchemaEnv=kc;function Vh(e){let t=RP.call(this,e);if(t)return t;let n=ut.getFullPath(this.opts.uriResolver,e.root.baseId),{es5:r,lines:s}=this.opts.code,{ownProperties:o}=this.opts,i=new lt.CodeGen(this.scope,{es5:r,lines:s,ownProperties:o}),a;if(e.$async)a=i.scopeValue("Error",{ref:qV.default,code:lt._`require("ajv/dist/runtime/validation_error").default`});let c=i.scopeName("validate");e.validateName=c;let l={gen:i,allErrors:this.opts.allErrors,data:Io.default.data,parentData:Io.default.parentData,parentDataProperty:Io.default.parentDataProperty,dataNames:[Io.default.data],dataPathArr:[lt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:lt.stringify(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:n,baseId:e.baseId||n,schemaPath:lt.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:lt._`""`,opts:this.opts,self:this},u;try{this._compilations.add(e),AP.validateFunctionCode(l),i.optimize(this.opts.code.optimize);let d=i.toString();if(u=`${i.scopeRefs(Io.default.scope)}return ${d}`,this.opts.code.process)u=this.opts.code.process(u,e);let m=Function(`${Io.default.self}`,`${Io.default.scope}`,u)(this,this.scope.get());if(this.scope.value(c,{ref:m}),m.errors=null,m.schema=e.schema,m.schemaEnv=e,e.$async)m.$async=!0;if(this.opts.code.source===!0)m.source={validateName:c,validateCode:d,scopeValues:i._values};if(this.opts.unevaluated){let{props:x,items:h}=l;if(m.evaluated={props:x instanceof lt.Name?void 0:x,items:h instanceof lt.Name?void 0:h,dynamicProps:x instanceof lt.Name,dynamicItems:h instanceof lt.Name},m.source)m.source.evaluated=lt.stringify(m.evaluated)}return e.validate=m,e}catch(d){if(delete e.validate,delete e.validateName,u)this.logger.error("Error compiling schema, function code:",u);throw d}finally{this._compilations.delete(e)}}CP.compileSchema=Vh;function WV(e,t,n){var r;n=ut.resolveUrl(this.opts.uriResolver,t,n);let s=e.refs[n];if(s)return s;let o=BV.call(this,e,n);if(o===void 0){let i=(r=e.localRefs)===null||r===void 0?void 0:r[n],{schemaId:a}=this.opts;if(i)o=new kc({schema:i,schemaId:a,root:e,baseId:t})}if(o===void 0)return;return e.refs[n]=HV.call(this,o)}CP.resolveRef=WV;function HV(e){if(ut.inlineRef(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:Vh.call(this,e)}function RP(e){for(let t of this._compilations)if(UV(t,e))return t}CP.getCompilingSchema=RP;function UV(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function BV(e,t){let n;while(typeof(n=this.refs[t])=="string")t=n;return n||this.schemas[t]||uf.call(this,e,t)}function uf(e,t){let n=this.opts.uriResolver.parse(t),r=ut._getFullPath(this.opts.uriResolver,n),s=ut.getFullPath(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&r===s)return Lh.call(this,n,e);let o=ut.normalizeId(r),i=this.refs[o]||this.schemas[o];if(typeof i=="string"){let a=uf.call(this,e,i);if(typeof(a===null||a===void 0?void 0:a.schema)!=="object")return;return Lh.call(this,n,a)}if(typeof(i===null||i===void 0?void 0:i.schema)!=="object")return;if(!i.validate)Vh.call(this,i);if(o===ut.normalizeId(t)){let{schema:a}=i,{schemaId:c}=this.opts,l=a[c];if(l)s=ut.resolveUrl(this.opts.uriResolver,s,l);return new kc({schema:a,schemaId:c,root:e,baseId:s})}return Lh.call(this,n,i)}CP.resolveSchema=uf;var zV=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Lh(e,{baseId:t,schema:n,root:r}){var s;if(((s=e.fragment)===null||s===void 0?void 0:s[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof n==="boolean")return;let c=n[lf.unescapeFragment(a)];if(c===void 0)return;n=c;let l=typeof n==="object"&&n[this.opts.schemaId];if(!zV.has(a)&&l)t=ut.resolveUrl(this.opts.uriResolver,t,l)}let o;if(typeof n!="boolean"&&n.$ref&&!lf.schemaHasRulesButRef(n,this.RULES)){let a=ut.resolveUrl(this.opts.uriResolver,t,n.$ref);o=uf.call(this,r,a)}let{schemaId:i}=this.opts;if(o=o||new kc({schema:n,schemaId:i,root:r,baseId:t}),o.schema!==o.root.schema)return o;return}});var TP=W(function(iQ,ZV){ZV.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var zh=W(function(aQ,qP){var QV=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Wh=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),eq=RegExp.prototype.test.bind(/^\d*$/u),Mo=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),Hh=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),IP=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),Uh=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),tq=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),un=Array(256);for(let t=0;t<256;t++)un[t]="%"+"0123456789ABCDEF"[t>>4]+"0123456789ABCDEF"[t&15];function qt(e){if(e<2048)return un[192|e>>6]+un[128|e&63];if(e<65536)return un[224|e>>12]+un[128|e>>6&63]+un[128|e&63];return un[240|e>>18]+un[128|e>>12&63]+un[128|e>>6&63]+un[128|e&63]}function nq(e){let t="",n=0,r=0;for(r=0;r<e.length;r++){if(n=e[r].charCodeAt(0),n===48)continue;if(!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return"";t+=e[r];break}for(r+=1;r<e.length;r++){if(n=e[r].charCodeAt(0),!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return"";t+=e[r]}return t}var rq=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),sq=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),oq=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),iq=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function aq(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++){if(oq(e[t]))continue;if(e[t]==="%"&&t+2<e.length&&Mo(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function JP(e){let t=-1,n=0,r=-1,s=0;for(let a=0;a<e.length;a++)if(e[a]==="0"){if(r===-1)r=a;if(s++,s>n)n=s,t=r}else r=-1,s=0;if(n<2)return e.join(":");let o=e.slice(0,t).join(":"),i=e.slice(t+n).join(":");return o+"::"+i}function cq(e){let t=e.indexOf("::");if(t!==-1&&e.indexOf("::",t+1)!==-1)return;let n=t===-1?e.split(":"):e.slice(0,t).split(":"),r=t===-1?[]:e.slice(t+2).split(":");if(t!==-1){if(n.length===1&&n[0]==="")n.length=0;if(r.length===1&&r[0]==="")r.length=0}let s=n.concat(r),o=0;for(let a=0;a<s.length;a++){let c=s[a];if(c==="")return;if(c.indexOf(".")!==-1){if(a!==s.length-1||t!==-1&&r.length===0||!Wh(c))return;o+=2;continue}if(!rq(c))return;s[a]=parseInt(c,16).toString(16),o++}if(t===-1){if(o!==8)return;return JP(s)}if(o>=8)return;let i=s.slice(0,n.length);for(let a=o;a<8;a++)i.push("0");for(let a=n.length;a<s.length;a++)i.push(s[a]);return JP(i)}function qh(e){let t=e[0]==="["&&e[e.length-1]==="]";if((e[0]==="["||e[e.length-1]==="]")&&!t)return{host:e,isIPV6:!1,error:!0};let r=t?e.slice(1,-1):e;if(t&&sq(r))return r=r.toLowerCase(),{host:`[${r}]`,escapedHost:r,isIPV6:!1,isIPVFuture:!0};if(lq(r,":")<2)return{host:e,isIPV6:!1,error:t};let s="",o=r.indexOf("%");if(o!==-1){let a=r.slice(o,o+3).toLowerCase()==="%25"?3:1;if(s=r.slice(o+a),!aq(s))return{host:e,isIPV6:!1,error:!0};r=r.slice(0,o)}let i=cq(r);if(i===void 0)return{host:e,isIPV6:!1,error:!0};return{host:i+(s?"%"+s:""),escapedHost:i+(s?"%25"+s:""),isIPV6:!0}}function lq(e,t){let n=0;for(let r=0;r<e.length;r++)if(e[r]===t)n++;return n}function MP(e){let t=e,n=[],r=-1,s=0;while(s=t.length){if(s===1)if(t===".")break;else if(t==="/"){n.push("/");break}else{n.push(t);break}else if(s===2){if(t[0]==="."){if(t[1]===".")break;else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."||t[1]==="/"){n.push("/");break}}}else if(s===3){if(t==="/.."){if(n.length!==0)n.pop();n.push("/");break}}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."){if(t[3]==="/"){if(t=t.slice(3),n.length!==0)n.pop();continue}}}}if((r=t.indexOf("/",1))===-1){n.push(t);break}else n.push(t.slice(0,r)),t=t.slice(r)}return n.join("")}function uq(e){if(e===""||e[0]==="/")return MP(e);let t=e.split("/"),n=t.length-1,r=[],s=!1;for(let o=0;o<=n;o++){let i=t[o];if(i==="."||i===".."){if(i==="..")if(r.length!==0&&r[r.length-1]!=="..")r.pop();else r.push("..");s=o===n}else r.push(i)}if(s&&r[r.length-1]!=="..")r.push("");if(r.length===0||r[0]===""||r[0].includes(":"))r.unshift(".");return r.join("/")}var fq={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},dq=/[@/?#:]/g,pq=/[@/?#]/g;function DP(e,t){let n=t?pq:dq;return n.lastIndex=0,e.replace(n,(r)=>fq[r])}function FP(e,t=!1){if(e.indexOf("%")===-1)return e;let n="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let s=e.slice(r+1,r+3);if(Mo(s)){let o=s.toUpperCase(),i=String.fromCharCode(parseInt(o,16));if(t&&Hh(i))n+=i;else n+="%"+o;r+=2;continue}}n+=e[r]}return n}function mq(e){let t="";for(let n=0;n<e.length;n++){let r=e[n];if(r==="%"&&n+2<e.length){let s=e.slice(n+1,n+3);if(Mo(s)){let o=s.toUpperCase(),i=String.fromCharCode(parseInt(o,16));if(i!=="."&&Hh(i))t+=i;else t+="%"+o;n+=2;continue}}if(IP(r))t+=r;else{let s=e.charCodeAt(n);if(s<128)t+=VP(s)?r:un[s];else if(s<55296||s>57343)t+=qt(s);else if(s<=56319&&n+1<e.length){let o=e.charCodeAt(n+1);if(o>=56320&&o<=57343)t+=qt(65536+(s-55296<<10)+(o-56320)),n++;else t+=qt(65533)}else t+=qt(65533)}}return t}function hq(e,t=!1){let n="",r=t&&e[0]!=="/";for(let s=0;s<e.length;s++){let o=e[s];if(o==="%"&&s+2<e.length){let i=e.slice(s+1,s+3);if(Mo(i)){n+="%"+i.toUpperCase(),s+=2;continue}}if(o==="/")r=!1;if(IP(o)&&(o!==":"||!r))n+=o;else{let i=e.charCodeAt(s);if(i<128)n+=un[i];else if(i<55296||i>57343)n+=qt(i);else if(i<=56319&&s+1<e.length){let a=e.charCodeAt(s+1);if(a>=56320&&a<=57343)n+=qt(65536+(i-55296<<10)+(a-56320)),s++;else n+=qt(65533)}else n+=qt(65533)}}return n}function Bh(e,t){let n="";for(let r=0;r<e.length;r++){let s=e[r];if(s==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(Mo(o)){n+="%"+o.toUpperCase(),r+=2;continue}}if(t(s))n+=s;else{let o=e.charCodeAt(r);if(o<128)n+=un[o];else if(o<55296||o>57343)n+=qt(o);else if(o<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);if(i>=56320&&i<=57343)n+=qt(65536+(o-55296<<10)+(i-56320)),r++;else n+=qt(65533)}else n+=qt(65533)}}return n}function LP(e){return Bh(e,tq)}function gq(e){return Bh(e,Uh)}function yq(e){return Bh(e,Uh)}function VP(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===42||e===43||e===45||e===46||e===47||e===64||e===95}function xq(e){let t="";for(let n=0;n<e.length;n++){let r=e[n];if(r==="%"&&n+2<e.length){let s=e.slice(n+1,n+3);if(Mo(s)){let o=s.toUpperCase(),i=String.fromCharCode(parseInt(o,16));if(Hh(i))t+=i;else t+="%"+o;n+=2;continue}}if(Uh(r))t+=r;else{let s=e.charCodeAt(n);if(s<128)t+=VP(s)?r:un[s];else if(s<55296||s>57343)t+=qt(s);else if(s<=56319&&n+1<e.length){let o=e.charCodeAt(n+1);if(o>=56320&&o<=57343)t+=qt(65536+(s-55296<<10)+(o-56320)),n++;else t+=qt(65533)}else t+=qt(65533)}}return t}function bq(e){let t="";for(let n=0;n<e.length;n++){if(e[n]==="%"&&n+2<e.length){let r=e.slice(n+1,n+3);if(Mo(r)){t+="%"+r.toUpperCase(),n+=2;continue}}t+=escape(e[n])}return t}function $q(e){let t=[];if(e.userinfo!==void 0)t.push(LP(e.userinfo)),t.push("@");if(e.host!==void 0){let n=e.host;if(!Wh(n)){let r=qh(n);if(r.isIPV6!==!0&&r.isIPVFuture!==!0)n=FP(n,!0),r=qh(n);if(r.isIPV6===!0||r.isIPVFuture===!0)n=`[${r.escapedHost}]`;else n=DP(n,!1)}t.push(n)}if(typeof e.port==="number"||typeof e.port==="string"){let n=String(e.port);if(!eq(n))throw TypeError("URI port is malformed.");t.push(":"),t.push(n)}return t.length?t.join(""):void 0}qP.exports={nonSimpleDomain:iq,recomposeAuthority:$q,reescapeHostDelimiters:DP,normalizePercentEncoding:FP,normalizePathEncoding:mq,serializePathEncoding:hq,normalizeQueryFragmentEncoding:xq,encodeUserinfo:LP,encodeQuery:gq,encodeFragment:yq,escapePreservingEscapes:bq,removeDotSegments:MP,removeDotSegmentsRelative:uq,isIPv4:Wh,isUUID:QV,normalizeIPv6:qh,stringArrayToHexStripped:nq}});var zP=W(function(cQ,BP){var{isUUID:wq}=zh(),Sq=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,vq=["http","https","ws","wss","urn","urn:uuid"];function Eq(e){return vq.indexOf(e)!==-1}function Kh(e){if(e.secure===!0)return!0;else if(e.secure===!1)return!1;else if(e.scheme)return e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S");else return!1}function WP(e){if(!e.host)e.error=e.error||"HTTP URIs must have a host.";return e}function HP(e){let t=String(e.scheme).toLowerCase()==="https";if(e.port===(t?443:80)||e.port==="")e.port=void 0;if(!e.path)e.path="/";return e}function jq(e){return e.secure=Kh(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function Pq(e){if(e.port===(Kh(e)?443:80)||e.port==="")e.port=void 0;if(typeof e.secure==="boolean")e.scheme=e.secure?"wss":"ws",e.secure=void 0;if(e.resourceName){let t=e.resourceName.indexOf("?"),n=t===-1?e.resourceName:e.resourceName.slice(0,t);e.path=n&&n!=="/"?n:void 0,e.query=t===-1?void 0:e.resourceName.slice(t+1),e.resourceName=void 0}return e.fragment=void 0,e}function _q(e,t){if(!e.path)return e.error="URN can not be parsed",e;let n=e.path.match(Sq);if(n&&n[0]===e.path){let r=t.scheme||e.scheme||"urn";e.nid=n[1].toLowerCase(),e.nss=n[2];let s=`${r}:${t.nid||e.nid}`,o=Gh(s);if(e.path=void 0,o)e=o.parse(e,t)}else e.error=e.error||"URN can not be parsed.";return e}function kq(e,t){if(e.nid===void 0)throw Error("URN without nid cannot be serialized");let n=t.scheme||e.scheme||"urn",r=e.nid.toLowerCase(),s=`${n}:${t.nid||r}`,o=Gh(s);if(o)e=o.serialize(e,t);let i=e,a=e.nss;return i.path=`${r||t.nid}:${a}`,t.skipEscape=!0,i}function Oq(e,t){let n=e;if(n.uuid=n.nss,n.nss=void 0,!t.tolerant&&(!n.uuid||!wq(n.uuid)))n.error=n.error||"UUID is not valid.";return n}function Aq(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var UP={scheme:"http",domainHost:!0,parse:WP,serialize:HP},Rq={scheme:"https",domainHost:UP.domainHost,parse:WP,serialize:HP},ff={scheme:"ws",domainHost:!0,parse:jq,serialize:Pq},Cq={scheme:"wss",domainHost:ff.domainHost,parse:ff.parse,serialize:ff.serialize},Nq={scheme:"urn",parse:_q,serialize:kq,skipNormalize:!0},Tq={scheme:"urn:uuid",parse:Oq,serialize:Aq,skipNormalize:!0},df={http:UP,https:Rq,ws:ff,wss:Cq,urn:Nq,"urn:uuid":Tq};Object.setPrototypeOf(df,null);function Gh(e){return e&&(df[e]||df[e.toLowerCase()])||void 0}BP.exports={wsIsSecure:Kh,SCHEMES:df,isValidSchemeName:Eq,getSchemeHandler:Gh}});var a_=W(function(lQ,gf){var{normalizeIPv6:ZP,removeDotSegments:Rc,removeDotSegmentsRelative:QP,recomposeAuthority:Jq,normalizePercentEncoding:Xh,normalizePathEncoding:Iq,serializePathEncoding:KP,normalizeQueryFragmentEncoding:GP,encodeQuery:Mq,encodeFragment:Dq,reescapeHostDelimiters:Fq,isIPv4:e_,nonSimpleDomain:Lq}=zh(),{SCHEMES:t_,getSchemeHandler:Yh}=zP(),n_=/^[A-Za-z][A-Za-z0-9+.-]*$/u,Vq=/[\0-\x20"#/:<>?@[\\\]^`{|}\x7F]/u;function XP(e){let t=String(e);if(!n_.test(t))throw TypeError("URI scheme is malformed.");return t}function qq(e,t){if(typeof e==="string")e=Yq(e,t);else if(typeof e==="object")e=mf(Do(e,t),t);return e}function Wq(e,t,n){let r=n?Object.assign({scheme:"null"},n):{scheme:"null"},{parsed:s,malformedAuthorityOrPort:o,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:c,malformedScheme:l}=pf(e,r),{parsed:u,malformedAuthorityOrPort:d,malformedPercentEncoding:p,malformedSchemeSpecific:m,malformedHost:x,malformedScheme:h}=pf(t,r);if(o||d||i||p||a||m||c||x||l||h)throw Error(s.error||u.error||"URI is malformed.");let g=r_(s,u,r,!0),b=Yh(n&&n.scheme||g.scheme),j=g.host,v=j!==void 0&&j!==""&&(e_(j)||ZP(j).isIPV6);if(o_(g,n||{},b,v))throw Error("URI host is malformed.");s_(g,n||{},b,v);let P=j&&j.indexOf("%")!==-1&&!/\P{ASCII}/u.test(j);if(g.error&&!P)throw Error(g.error);return r.skipEscape=!0,Do(g,r)}function r_(e,t,n,r){let s={};if(!r)e=mf(Do(e,n),n),t=mf(Do(t,n),n);if(n=n||{},!n.tolerant&&t.scheme)s.scheme=t.scheme,s.userinfo=t.userinfo,s.host=t.host,s.port=t.port,s.path=Rc(t.path||""),s.query=t.query;else{if(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)s.userinfo=t.userinfo,s.host=t.host,s.port=t.port,s.path=Rc(t.path||""),s.query=t.query;else{if(!t.path)if(s.path=e.path,t.query!==void 0)s.query=t.query;else s.query=e.query;else{if(t.path[0]==="/")s.path=Rc(t.path);else{let o=e.userinfo!==void 0||e.host!==void 0||e.port!==void 0;if(o&&!e.path)s.path="/"+t.path;else if(!e.path)s.path=t.path;else s.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path;s.path=e.scheme===void 0&&!o&&s.path[0]!=="/"?QP(s.path):Rc(s.path)}s.query=t.query}s.userinfo=e.userinfo,s.host=e.host,s.port=e.port}s.scheme=e.scheme}return s.fragment=t.fragment,s}function Hq(e,t,n){let r=YP(e,n),s=YP(t,n);return r!==void 0&&s!==void 0&&r===s}function Do(e,t){let n={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},r=Object.assign({},t),s=[];if(n.scheme)n.scheme=XP(n.scheme);let o=Yh(r.scheme||n.scheme);if(o&&o.serialize)o.serialize(n,r);let i=n.userinfo!==void 0||n.host!==void 0||n.port!==void 0,a=(n.scheme===void 0||r.reference==="suffix")&&!i,c=!r.skipEscape&&a;if(n.path!==void 0)if(!r.skipEscape)n.path=KP(n.path,c);else n.path=Xh(n.path);if(r.reference!=="suffix"&&n.scheme)n.scheme=XP(n.scheme),s.push(n.scheme,":");let l=Jq(n);if(l!==void 0){if(r.reference!=="suffix")s.push("//");if(s.push(l),n.path&&n.path[0]!=="/")s.push("/")}if(n.path!==void 0){let u=n.path;if(!r.absolutePath&&(!o||!o.absolutePath))u=a&&u[0]!=="/"?QP(u):Rc(u);if(a)u=KP(u,!0);if(l===void 0&&u[0]==="/"&&u[1]==="/")u="/%2F"+u.slice(2);s.push(u)}if(n.query!==void 0)s.push("?",Mq(n.query));if(n.fragment!==void 0)s.push("#",Dq(n.fragment));return s.join("")}var Uq=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,Bq=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,zq=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function Kq(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof e.port==="number"&&(e.port<0||e.port>65535))return"URI port is malformed.";return}function Ac(e){if(e===void 0)return!1;let t=e.indexOf("%");while(t!==-1){if(t+2>=e.length||!/^[\da-f]{2}$/iu.test(e.slice(t+1,t+3)))return!0;t=e.indexOf("%",t+3)}return!1}function hf(e){return e[0]==="["&&e[e.length-1]==="]"}function Gq(e){let t=e[4];return Ac(e[3])||t!==void 0&&!hf(t)&&Ac(t)||Ac(e[6])||Ac(e[7])||Ac(e[8])}function s_(e,t,n,r){if(o_(e,t,n,r))return e.error=e.error||"URI host is malformed.",!0;if(!t.unicodeSupport&&(!n||!n.unicodeSupport)&&e.host&&!hf(e.host)&&(t.domainHost||n&&n.domainHost)&&r===!1&&Lq(e.host)){let s;try{s=new URL("http://"+e.host)}catch(o){return e.error=e.error||"Host's domain name can not be converted to ASCII: "+o,!0}if(!Xq(s))return e.error=e.error||"URI host is malformed.",!0;e.host=s.hostname}return!1}function o_(e,t,n,r){return Boolean(e.host&&r===!1&&!hf(e.host)&&(t.domainHost||n&&n.domainHost)&&Vq.test(e.host))}function Xq(e){return e.username===""&&e.password===""&&e.port===""&&e.pathname==="/"&&e.search===""&&e.hash===""&&e.hostname!==""}function pf(e,t){let n=Object.assign({},t),r={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},s=!1,o=!1,i=!1,a=!1,c=!1,l=!1,u=!1;if(n.reference==="suffix")if(n.scheme)e=n.scheme+":"+e;else e="//"+e;let d=e.match(Bq);if(d!==null&&d[1].indexOf("\\")!==-1)r.error="URI authority must not contain a literal backslash.",s=!0;let p=e.match(zq);if(p!==null){let x=p[1],h=x.replace(/[\t\n\r]/g,"");if(h.length>=2){if(h.slice(0,2)!=="//")r.error=r.error||"URI authority must not contain a literal backslash.",s=!0;else if(x.length!==h.length)r.error=r.error||"URI authority introducer must not contain whitespace.",s=!0}}let m=e.match(Uq);if(m){if(r.scheme=m[1],r.userinfo=m[3],r.host=m[4],r.port=parseInt(m[5],10),r.path=m[6]||"",r.query=m[7],r.fragment=m[8],r.scheme!==void 0)if(n_.test(r.scheme))r.scheme=r.scheme.toLowerCase();else r.error=r.error||"URI scheme is malformed.",l=!0;if(o=Gq(m),o)r.error=r.error||"URI contains malformed percent-encoding.";if(isNaN(r.port))r.port=m[5];let x=Kq(r,m);if(x!==void 0)r.error=r.error||x,s=!0;if(r.host)if(e_(r.host)===!1){let b=hf(r.host),j=r.host.indexOf("[")!==-1||r.host.indexOf("]")!==-1,v=ZP(r.host);if(u=v.isIPV6||v.isIPVFuture===!0,c=j&&(!b||v.error===!0),r.host=u?v.host:v.host.toLowerCase(),c)r.error=r.error||"URI host is malformed.",s=!0}else u=!0;if(r.scheme===void 0&&r.userinfo===void 0&&r.host===void 0&&r.port===void 0&&r.query===void 0&&!r.path)r.reference="same-document";else if(r.scheme===void 0)r.reference="relative";else if(r.fragment===void 0)r.reference="absolute";else r.reference="uri";if(n.reference&&n.reference!=="suffix"&&n.reference!==r.reference)r.error=r.error||"URI is not a "+n.reference+" reference.";let h=Yh(n.scheme||r.scheme);if(!c)a=s_(r,n,h,u);if(e.indexOf("%")!==-1&&r.host!==void 0&&!c){let g=u?r.host:Xh(r.host,!0);if(!u)g=Xh(g.toLowerCase());r.host=u||n.scheme!=="null"?Fq(g,u):g}if(!h||h&&!h.skipNormalize){if(r.path)r.path=Iq(r.path);if(r.query)r.query=GP(r.query);if(r.fragment)r.fragment=GP(r.fragment)}if(h&&h.parse){if(h.parse(r,n),h===t_.urn&&r.nid===void 0)i=!0}}else r.error=r.error||"URI can not be parsed.";return{parsed:r,malformedAuthorityOrPort:s,malformedPercentEncoding:o,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:l}}function mf(e,t){return pf(e,t).parsed}function Yq(e,t){return i_(e,t).normalized}function i_(e,t){let{parsed:n,malformedAuthorityOrPort:r,malformedPercentEncoding:s,malformedSchemeSpecific:o,malformedHost:i,malformedScheme:a}=pf(e,t);return{normalized:r||s||o||i||a?e:Do(n,t),malformedAuthorityOrPort:r,malformedPercentEncoding:s,malformedSchemeSpecific:o,malformedHost:i,malformedScheme:a}}function YP(e,t){if(typeof e!=="string"&&typeof e!=="object")return;let n;try{n=typeof e==="string"?e:Do(e,t)}catch{return}let{normalized:r,malformedAuthorityOrPort:s,malformedPercentEncoding:o,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:c}=i_(n,t);return s||o||i||a||c?void 0:r}var Zh={SCHEMES:t_,normalize:qq,resolve:Wq,resolveComponent:r_,equal:Hq,serialize:Do,parse:mf};gf.exports=Zh;gf.exports.default=Zh;gf.exports.fastUri=Zh});var u_=W(function(l_){Object.defineProperty(l_,"__esModule",{value:!0});var c_=a_();c_.code='require("ajv/dist/runtime/uri").default';l_.default=c_});var eg=W(function(ts){Object.defineProperty(ts,"__esModule",{value:!0});ts.CodeGen=ts.Name=ts.nil=ts.stringify=ts.str=ts._=ts.KeywordCxt=void 0;var Qq=Xi();Object.defineProperty(ts,"KeywordCxt",{enumerable:!0,get:function(){return Qq.KeywordCxt}});var ea=ge();Object.defineProperty(ts,"_",{enumerable:!0,get:function(){return ea._}});Object.defineProperty(ts,"str",{enumerable:!0,get:function(){return ea.str}});Object.defineProperty(ts,"stringify",{enumerable:!0,get:function(){return ea.stringify}});Object.defineProperty(ts,"nil",{enumerable:!0,get:function(){return ea.nil}});Object.defineProperty(ts,"Name",{enumerable:!0,get:function(){return ea.Name}});Object.defineProperty(ts,"CodeGen",{enumerable:!0,get:function(){return ea.CodeGen}});var eW=_c(),h_=Zi(),g_=Oh(),$r=Oc(),y_=ge(),wr=Pc(),Is=jc(),Qi=ke(),f_=TP(),tW=u_(),x_=(e,t)=>new RegExp(e,t);x_.code="new RegExp";var nW=["removeAdditional","useDefaults","coerceTypes"],rW=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),sW={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},oW={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},d_=200;function iW(e){var t,n,r,s,o,i,a,c,l,u,d,p,m,x,h,g,b,j,v,P,S,_,N,F,K;let J=e.strict,C=(t=e.code)===null||t===void 0?void 0:t.optimize,L=C===!0||C===void 0?1:C||0,G=(r=(n=e.code)===null||n===void 0?void 0:n.regExp)!==null&&r!==void 0?r:x_,te=(s=e.uriResolver)!==null&&s!==void 0?s:tW.default;return{strictSchema:(i=(o=e.strictSchema)!==null&&o!==void 0?o:J)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=e.strictNumbers)!==null&&a!==void 0?a:J)!==null&&c!==void 0?c:!0,strictTypes:(u=(l=e.strictTypes)!==null&&l!==void 0?l:J)!==null&&u!==void 0?u:"log",strictTuples:(p=(d=e.strictTuples)!==null&&d!==void 0?d:J)!==null&&p!==void 0?p:"log",strictRequired:(x=(m=e.strictRequired)!==null&&m!==void 0?m:J)!==null&&x!==void 0?x:!1,code:e.code?{...e.code,optimize:L,regExp:G}:{optimize:L,regExp:G},loopRequired:(h=e.loopRequired)!==null&&h!==void 0?h:d_,loopEnum:(g=e.loopEnum)!==null&&g!==void 0?g:d_,meta:(b=e.meta)!==null&&b!==void 0?b:!0,messages:(j=e.messages)!==null&&j!==void 0?j:!0,inlineRefs:(v=e.inlineRefs)!==null&&v!==void 0?v:!0,schemaId:(P=e.schemaId)!==null&&P!==void 0?P:"$id",addUsedSchema:(S=e.addUsedSchema)!==null&&S!==void 0?S:!0,validateSchema:(_=e.validateSchema)!==null&&_!==void 0?_:!0,validateFormats:(N=e.validateFormats)!==null&&N!==void 0?N:!0,unicodeRegExp:(F=e.unicodeRegExp)!==null&&F!==void 0?F:!0,int32range:(K=e.int32range)!==null&&K!==void 0?K:!0,uriResolver:te}}class yf{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...iW(e)};let{es5:t,lines:n}=this.opts.code;this.scope=new y_.ValueScope({scope:{},prefixes:rW,es5:t,lines:n}),this.logger=dW(e.logger);let r=e.validateFormats;if(e.validateFormats=!1,this.RULES=g_.getRules(),p_.call(this,sW,e,"NOT SUPPORTED"),p_.call(this,oW,e,"DEPRECATED","warn"),this._metaOpts=uW.call(this),e.formats)cW.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords)lW.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);aW.call(this),e.validateFormats=r}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:n}=this.opts,r=f_;if(n==="id")r={...f_},r.id=r.$id,delete r.$id;if(t&&e)this.addMetaSchema(r,r[n],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[t]||e:void 0}validate(e,t){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let r=n(t);if(!("$async"in n))this.errors=n.errors;return r}compile(e,t){let n=this._addSchema(e,t);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,t){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return r.call(this,e,t);async function r(l,u){await s.call(this,l.$schema);let d=this._addSchema(l,u);return d.validate||o.call(this,d)}async function s(l){if(l&&!this.getSchema(l))await r.call(this,{$ref:l},!0)}async function o(l){try{return this._compileSchemaEnv(l)}catch(u){if(!(u instanceof h_.default))throw u;return i.call(this,u),await a.call(this,u.missingSchema),o.call(this,l)}}function i({missingSchema:l,missingRef:u}){if(this.refs[l])throw Error(`AnySchema ${l} is loaded but ${u} cannot be resolved`)}async function a(l){let u=await c.call(this,l);if(!this.refs[l])await s.call(this,u.$schema);if(!this.refs[l])this.addSchema(u,l,t)}async function c(l){let u=this._loading[l];if(u)return u;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l]}}}addSchema(e,t,n,r=this.opts.validateSchema){if(Array.isArray(e)){for(let o of e)this.addSchema(o,void 0,n,r);return this}let s;if(typeof e==="object"){let{schemaId:o}=this.opts;if(s=e[o],s!==void 0&&typeof s!="string")throw Error(`schema ${o} must be string`)}return t=wr.normalizeId(t||s),this._checkUnique(t),this.schemas[t]=this._addSchema(e,n,t,r,!0),this}addMetaSchema(e,t,n=this.opts.validateSchema){return this.addSchema(e,t,!0,n),this}validateSchema(e,t){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let r=this.validate(n,e);if(!r&&t){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw Error(s)}return r}getSchema(e){let t;while(typeof(t=m_.call(this,e))=="string")e=t;if(t===void 0){let{schemaId:n}=this.opts,r=new $r.SchemaEnv({schema:{},schemaId:n});if(t=$r.resolveSchema.call(this,r,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let t=m_.call(this,e);if(typeof t=="object")this._cache.delete(t.schema);return delete this.schemas[e],delete this.refs[e],this}case"object":{let t=e;this._cache.delete(t);let n=e[this.opts.schemaId];if(n)n=wr.normalizeId(n),delete this.schemas[n],delete this.refs[n];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let n;if(typeof e=="string"){if(n=e,typeof t=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=n}else if(typeof e=="object"&&t===void 0){if(t=e,n=t.keyword,Array.isArray(n)&&!n.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(mW.call(this,n,t),!t)return Qi.eachItem(n,(s)=>Qh.call(this,s)),this;gW.call(this,t);let r={...t,type:Is.getJSONTypes(t.type),schemaType:Is.getJSONTypes(t.schemaType)};return Qi.eachItem(n,r.type.length===0?(s)=>Qh.call(this,s,r):(s)=>r.type.forEach((o)=>Qh.call(this,s,r,o))),this}getKeyword(e){let t=this.RULES.all[e];return typeof t=="object"?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(let n of t.rules){let r=n.rules.findIndex((s)=>s.keyword===e);if(r>=0)n.rules.splice(r,1)}return this}addFormat(e,t){if(typeof t=="string")t=new RegExp(t);return this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:n="data"}={}){if(!e||e.length===0)return"No errors";return e.map((r)=>`${n}${r.instancePath} ${r.message}`).reduce((r,s)=>r+t+s)}$dataMetaSchema(e,t){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let r of t){let s=r.split("/").slice(1),o=e;for(let i of s)o=o[i];for(let i in n){let a=n[i];if(typeof a!="object")continue;let{$data:c}=a.definition,l=o[i];if(c&&l)o[i]=b_(l)}}return e}_removeAllSchemas(e,t){for(let n in e){let r=e[n];if(!t||t.test(n)){if(typeof r=="string")delete e[n];else if(r&&!r.meta)this._cache.delete(r.schema),delete e[n]}}}_addSchema(e,t,n,r=this.opts.validateSchema,s=this.opts.addUsedSchema){let o,{schemaId:i}=this.opts;if(typeof e=="object")o=e[i];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof e!="boolean")throw Error("schema must be object or boolean");let a=this._cache.get(e);if(a!==void 0)return a;n=wr.normalizeId(o||n);let c=wr.getSchemaRefs.call(this,e,n);if(a=new $r.SchemaEnv({schema:e,schemaId:i,meta:t,baseId:n,localRefs:c}),this._cache.set(a.schema,a),s&&!n.startsWith("#")){if(n)this._checkUnique(n);this.refs[n]=a}if(r)this.validateSchema(e,!0);return a}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta)this._compileMetaSchema(e);else $r.compileSchema.call(this,e);if(!e.validate)throw Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{$r.compileSchema.call(this,e)}finally{this.opts=t}}}yf.ValidationError=eW.default;yf.MissingRefError=h_.default;ts.default=yf;function p_(e,t,n,r="error"){for(let s in e){let o=s;if(o in t)this.logger[r](`${n}: option ${s}. ${e[o]}`)}}function m_(e){return e=wr.normalizeId(e),this.schemas[e]||this.refs[e]}function aW(){let e=this.opts.schemas;if(!e)return;if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function cW(){for(let e in this.opts.formats){let t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function lW(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let n=e[t];if(!n.keyword)n.keyword=t;this.addKeyword(n)}}function uW(){let e={...this.opts};for(let t of nW)delete e[t];return e}var fW={log(){},warn(){},error(){}};function dW(e){if(e===!1)return fW;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw Error("logger must implement log, warn and error methods")}var pW=/^[a-z_$][a-z0-9_$:-]*$/i;function mW(e,t){let{RULES:n}=this;if(Qi.eachItem(e,(r)=>{if(n.keywords[r])throw Error(`Keyword ${r} is already defined`);if(!pW.test(r))throw Error(`Keyword ${r} has invalid name`)}),!t)return;if(t.$data&&!(("code"in t)||("validate"in t)))throw Error('$data keyword must have "code" or "validate" function')}function Qh(e,t,n){var r;let s=t===null||t===void 0?void 0:t.post;if(n&&s)throw Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,i=s?o.post:o.rules.find(({type:c})=>c===n);if(!i)i={type:n,rules:[]},o.rules.push(i);if(o.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:Is.getJSONTypes(t.type),schemaType:Is.getJSONTypes(t.schemaType)}};if(t.before)hW.call(this,i,a,t.before);else i.rules.push(a);o.all[e]=a,(r=t.implements)===null||r===void 0||r.forEach((c)=>this.addKeyword(c))}function hW(e,t,n){let r=e.rules.findIndex((s)=>s.keyword===n);if(r>=0)e.rules.splice(r,0,t);else e.rules.push(t),this.logger.warn(`rule ${n} is not defined`)}function gW(e){let{metaSchema:t}=e;if(t===void 0)return;if(e.$data&&this.opts.$data)t=b_(t);e.validateSchema=this.compile(t,!0)}var yW={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function b_(e){return{anyOf:[e,yW]}}});var w_=W(function($_){Object.defineProperty($_,"__esModule",{value:!0});var $W={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};$_.default=$W});var wf=W(function(v_){Object.defineProperty(v_,"__esModule",{value:!0});v_.callRef=v_.getValidate=void 0;var SW=Zi(),bf=Fn(),Ue=ge(),ta=Mn(),$f=Oc(),Ms=ke(),vW={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:n,it:r}=e,{baseId:s,schemaEnv:o,validateName:i,opts:a,self:c}=r,{root:l}=o;if((n==="#"||n==="#/")&&s===l.baseId)return d();let u=$f.resolveRef.call(c,l,s,n);if(u===void 0)throw new SW.default(r.opts.uriResolver,s,n);if(u instanceof $f.SchemaEnv)return p(u);return m(u);function d(){if(o===l)return xf(e,i,o,o.$async);let x=t.scopeValue("root",{ref:l});return xf(e,Ue._`${x}.validate`,l,l.$async)}function p(x){let h=S_(e,x);xf(e,h,x,x.$async)}function m(x){let h=t.scopeValue("schema",a.code.source===!0?{ref:x,code:Ue.stringify(x)}:{ref:x}),g=t.name("valid"),b=e.subschema({schema:x,dataTypes:[],schemaPath:Ue.nil,topSchemaRef:h,errSchemaPath:n},g);e.mergeEvaluated(b),e.ok(g)}}};function S_(e,t){let{gen:n}=e;return t.validate?n.scopeValue("validate",{ref:t.validate}):Ue._`${n.scopeValue("wrapper",{ref:t})}.validate`}v_.getValidate=S_;function xf(e,t,n,r){let{gen:s,it:o}=e,{allErrors:i,schemaEnv:a,opts:c}=o,l=c.passContext?ta.default.this:Ue.nil;if(r)u();else d();function u(){if(!a.$async)throw Error("async schema referenced by sync schema");let x=s.let("valid");s.try(()=>{if(s.code(Ue._`await ${bf.callValidateCode(e,t,l)}`),m(t),!i)s.assign(x,!0)},(h)=>{if(s.if(Ue._`!(${h} instanceof ${o.ValidationError})`,()=>s.throw(h)),p(h),!i)s.assign(x,!1)}),e.ok(x)}function d(){e.result(bf.callValidateCode(e,t,l),()=>m(t),()=>p(t))}function p(x){let h=Ue._`${x}.errors`;s.assign(ta.default.vErrors,Ue._`${ta.default.vErrors} === null ? ${h} : ${ta.default.vErrors}.concat(${h})`),s.assign(ta.default.errors,Ue._`${ta.default.vErrors}.length`)}function m(x){var h;if(!o.opts.unevaluated)return;let g=(h=n===null||n===void 0?void 0:n.validate)===null||h===void 0?void 0:h.evaluated;if(o.props!==!0)if(g&&!g.dynamicProps){if(g.props!==void 0)o.props=Ms.mergeEvaluated.props(s,g.props,o.props)}else{let b=s.var("props",Ue._`${x}.evaluated.props`);o.props=Ms.mergeEvaluated.props(s,b,o.props,Ue.Name)}if(o.items!==!0)if(g&&!g.dynamicItems){if(g.items!==void 0)o.items=Ms.mergeEvaluated.items(s,g.items,o.items)}else{let b=s.var("items",Ue._`${x}.evaluated.items`);o.items=Ms.mergeEvaluated.items(s,b,o.items,Ue.Name)}}}v_.callRef=xf;v_.default=vW});var tg=W(function(j_){Object.defineProperty(j_,"__esModule",{value:!0});var PW=w_(),_W=wf(),kW=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",PW.default,_W.default];j_.default=kW});var __=W(function(P_){Object.defineProperty(P_,"__esModule",{value:!0});var Fs=ge(),Ds=Fs.operators,Sf={maximum:{okStr:"<=",ok:Ds.LTE,fail:Ds.GT},minimum:{okStr:">=",ok:Ds.GTE,fail:Ds.LT},exclusiveMaximum:{okStr:"<",ok:Ds.LT,fail:Ds.GTE},exclusiveMinimum:{okStr:">",ok:Ds.GT,fail:Ds.LTE}},AW={message:({keyword:e,schemaCode:t})=>Fs.str`must be ${Sf[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>Fs._`{comparison: ${Sf[e].okStr}, limit: ${t}}`},RW={keyword:Object.keys(Sf),type:"number",schemaType:"number",$data:!0,error:AW,code(e){let{keyword:t,data:n,schemaCode:r}=e;e.fail$data(Fs._`${n} ${Sf[t].fail} ${r} || isNaN(${n})`)}};P_.default=RW});var O_=W(function(k_){Object.defineProperty(k_,"__esModule",{value:!0});var Sr=ge(),NW={message:({schemaCode:e})=>Sr.str`must be multiple of ${e}`,params:({schemaCode:e})=>Sr._`{multipleOf: ${e}}`},TW={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:NW,code(e){let{gen:t,data:n,schemaCode:r,it:s}=e,o=s.opts.multipleOfPrecision,i=t.let("res"),a=o?Sr._`Math.abs(Math.round(${i}) - ${i}) > 1e-${o}`:Sr._`${i} !== parseInt(${i})`;e.fail$data(Sr._`(${r} === 0 || (${i} = ${n}/${r}, ${a}))`)}};k_.default=TW});var C_=W(function(R_){Object.defineProperty(R_,"__esModule",{value:!0});function A_(e){let t=e.length,n=0,r=0,s;while(r<t)if(n++,s=e.charCodeAt(r++),s>=55296&&s<=56319&&r<t){if(s=e.charCodeAt(r),(s&64512)===56320)r++}return n}R_.default=A_;A_.code='require("ajv/dist/runtime/ucs2length").default'});var J_=W(function(T_){Object.defineProperty(T_,"__esModule",{value:!0});var fn=ge(),N_=ke(),MW=C_(),DW={message({keyword:e,schemaCode:t}){return fn.str`must NOT have ${e==="maxLength"?"more":"fewer"} than ${t} characters`},params:({schemaCode:e})=>fn._`{limit: ${e}}`},FW={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:DW,code(e){let{keyword:t,data:n,schemaCode:r,it:s}=e,o=t==="maxLength"?fn.operators.GT:fn.operators.LT,i=s.opts.unicode===!1?fn._`${n}.length`:fn._`${N_.useFunc(e.gen,MW.default)}(${n})`;e.fail$data(fn._`${i} ${o} ${r}`)}};T_.default=FW});var F_=W(function(D_){Object.defineProperty(D_,"__esModule",{value:!0});var I_=Fn(),M_=ke(),Ln=ge(),VW={message:({schemaCode:e})=>Ln.str`must match pattern "${e}"`,params:({schemaCode:e})=>Ln._`{pattern: ${e}}`},qW={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:VW,code(e){let{gen:t,data:n,$data:r,schema:s,schemaCode:o,it:i}=e,a=i.opts.unicodeRegExp?"u":"";if(r){let{regExp:c}=i.opts.code,l=c.code==="new RegExp"?Ln._`new RegExp`:M_.useFunc(t,c),u=t.let("valid");t.try(()=>t.assign(u,Ln._`${l}(${o}, ${a}).test(${n})`),()=>t.assign(u,!1)),e.fail$data(Ln._`!${u}`)}else{let c=I_.usePattern(e,s);e.fail$data(Ln._`!${c}.test(${n})`)}}};D_.default=qW});var V_=W(function(L_){Object.defineProperty(L_,"__esModule",{value:!0});var vr=ge(),HW={message({keyword:e,schemaCode:t}){return vr.str`must NOT have ${e==="maxProperties"?"more":"fewer"} than ${t} properties`},params:({schemaCode:e})=>vr._`{limit: ${e}}`},UW={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:HW,code(e){let{keyword:t,data:n,schemaCode:r}=e,s=t==="maxProperties"?vr.operators.GT:vr.operators.LT;e.fail$data(vr._`Object.keys(${n}).length ${s} ${r}`)}};L_.default=UW});var H_=W(function(W_){Object.defineProperty(W_,"__esModule",{value:!0});var Er=Fn(),jr=ge(),q_=ke(),zW={message:({params:{missingProperty:e}})=>jr.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>jr._`{missingProperty: ${e}}`},KW={keyword:"required",type:"object",schemaType:"array",$data:!0,error:zW,code(e){let{gen:t,schema:n,schemaCode:r,data:s,$data:o,it:i}=e,{opts:a}=i;if(!o&&n.length===0)return;let c=n.length>=a.loopRequired;if(i.allErrors)l();else u();if(a.strictRequired){let m=e.parentSchema.properties,{definedProperties:x}=e.it;for(let h of n)if((m===null||m===void 0?void 0:m[h])===void 0&&!x.has(h)){let g=i.schemaEnv.baseId+i.errSchemaPath,b=`required property "${h}" is not defined at "${g}" (strictRequired)`;q_.checkStrictMode(i,b,i.opts.strictRequired)}}function l(){if(c||o)e.block$data(jr.nil,d);else for(let m of n)Er.checkReportMissingProp(e,m)}function u(){let m=t.let("missing");if(c||o){let x=t.let("valid",!0);e.block$data(x,()=>p(m,x)),e.ok(x)}else t.if(Er.checkMissingProp(e,n,m)),Er.reportMissingProp(e,m),t.else()}function d(){t.forOf("prop",r,(m)=>{e.setParams({missingProperty:m}),t.if(Er.noPropertyInData(t,s,m,a.ownProperties),()=>e.error())})}function p(m,x){e.setParams({missingProperty:m}),t.forOf(m,r,()=>{t.assign(x,Er.propertyInData(t,s,m,a.ownProperties)),t.if(jr.not(x),()=>{e.error(),t.break()})},jr.nil)}}};W_.default=KW});var B_=W(function(U_){Object.defineProperty(U_,"__esModule",{value:!0});var Pr=ge(),XW={message({keyword:e,schemaCode:t}){return Pr.str`must NOT have ${e==="maxItems"?"more":"fewer"} than ${t} items`},params:({schemaCode:e})=>Pr._`{limit: ${e}}`},YW={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:XW,code(e){let{keyword:t,data:n,schemaCode:r}=e,s=t==="maxItems"?Pr.operators.GT:Pr.operators.LT;e.fail$data(Pr._`${n}.length ${s} ${r}`)}};U_.default=YW});var vf=W(function(K_){Object.defineProperty(K_,"__esModule",{value:!0});var z_=Ih();z_.code='require("ajv/dist/runtime/equal").default';K_.default=z_});var Y_=W(function(X_){Object.defineProperty(X_,"__esModule",{value:!0});var na=jc(),Ce=ge(),G_=ke(),eH=vf(),tH={message:({params:{i:e,j:t}})=>Ce.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>Ce._`{i: ${e}, j: ${t}}`},nH={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:tH,code(e){let{gen:t,data:n,$data:r,schema:s,parentSchema:o,schemaCode:i,it:a}=e;if(!r&&!s)return;let c=t.let("valid"),l=o.items?na.getSchemaTypes(o.items):[];e.block$data(c,u,Ce._`${i} === false`),e.ok(c);function u(){let x=t.let("i",Ce._`${n}.length`),h=t.let("j");e.setParams({i:x,j:h}),t.assign(c,!0),t.if(Ce._`${x} > 1`,()=>(d()?p:m)(x,h))}function d(){return l.length>0&&!l.some((x)=>x==="object"||x==="array")}function p(x,h){let g=t.name("item"),b=na.checkDataTypes(l,g,a.opts.strictNumbers,na.DataType.Wrong),j=t.const("indices",Ce._`{}`);t.for(Ce._`;${x}--;`,()=>{if(t.let(g,Ce._`${n}[${x}]`),t.if(b,Ce._`continue`),l.length>1)t.if(Ce._`typeof ${g} == "string"`,Ce._`${g} += "_"`);t.if(Ce._`typeof ${j}[${g}] == "number"`,()=>{t.assign(h,Ce._`${j}[${g}]`),e.error(),t.assign(c,!1).break()}).code(Ce._`${j}[${g}] = ${x}`)})}function m(x,h){let g=G_.useFunc(t,eH.default),b=t.name("outer");t.label(b).for(Ce._`;${x}--;`,()=>t.for(Ce._`${h} = ${x}; ${h}--;`,()=>t.if(Ce._`${g}(${n}[${x}], ${n}[${h}])`,()=>{e.error(),t.assign(c,!1).break(b)})))}}};X_.default=nH});var ek=W(function(Q_){Object.defineProperty(Q_,"__esModule",{value:!0});var ra=ge(),Z_=ke(),sH=vf(),oH={message:"must be equal to constant",params:({schemaCode:e})=>ra._`{allowedValue: ${e}}`},iH={keyword:"const",$data:!0,error:oH,code(e){let{gen:t,data:n,$data:r,schemaCode:s,schema:o}=e;if(r||o&&typeof o=="object")e.fail$data(ra._`!${Z_.useFunc(t,sH.default)}(${n}, ${s})`);else e.fail(ra._`${o} !== ${n}`)}};Q_.default=iH});var rk=W(function(nk){Object.defineProperty(nk,"__esModule",{value:!0});var _r=ge(),tk=ke(),cH=vf(),lH={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>_r._`{allowedValues: ${e}}`},uH={keyword:"enum",schemaType:"array",$data:!0,error:lH,code(e){let{gen:t,data:n,$data:r,schema:s,schemaCode:o,it:i}=e;if(!r&&s.length===0)throw Error("enum must have non-empty array");let a=s.length>=i.opts.loopEnum,c,l=()=>c!==null&&c!==void 0?c:c=tk.useFunc(t,cH.default),u;if(a||r)u=t.let("valid"),e.block$data(u,d);else{if(!Array.isArray(s))throw Error("ajv implementation error");let m=t.const("vSchema",o);u=_r.or(...s.map((x,h)=>p(m,h)))}e.pass(u);function d(){t.assign(u,!1),t.forOf("v",o,(m)=>t.if(_r._`${l()}(${n}, ${m})`,()=>t.assign(u,!0).break()))}function p(m,x){let h=s[x];return typeof h==="object"&&h!==null?_r._`${l()}(${n}, ${m}[${x}])`:_r._`${n} === ${h}`}}};nk.default=uH});var ng=W(function(sk){Object.defineProperty(sk,"__esModule",{value:!0});var dH=__(),pH=O_(),mH=J_(),hH=F_(),gH=V_(),yH=H_(),xH=B_(),bH=Y_(),$H=ek(),wH=rk(),SH=[dH.default,pH.default,mH.default,hH.default,gH.default,yH.default,xH.default,bH.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},$H.default,wH.default];sk.default=SH});var rg=W(function(ik){Object.defineProperty(ik,"__esModule",{value:!0});ik.validateAdditionalItems=void 0;var dn=ge(),sa=ke(),EH={message:({params:{len:e}})=>dn.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>dn._`{limit: ${e}}`},jH={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:EH,code(e){let{parentSchema:t,it:n}=e,{items:r}=t;if(!Array.isArray(r)){sa.checkStrictMode(n,'"additionalItems" is ignored when "items" is not an array of schemas');return}ok(e,r)}};function ok(e,t){let{gen:n,schema:r,data:s,keyword:o,it:i}=e;i.items=!0;let a=n.const("len",dn._`${s}.length`);if(r===!1)e.setParams({len:t.length}),e.pass(dn._`${a} <= ${t.length}`);else if(typeof r=="object"&&!sa.alwaysValidSchema(i,r)){let l=n.var("valid",dn._`${a} <= ${t.length}`);n.if(dn.not(l),()=>c(l)),e.ok(l)}function c(l){n.forRange("i",t.length,a,(u)=>{if(e.subschema({keyword:o,dataProp:u,dataPropType:sa.Type.Num},l),!i.allErrors)n.if(dn.not(l),()=>n.break())})}}ik.validateAdditionalItems=ok;ik.default=jH});var sg=W(function(uk){Object.defineProperty(uk,"__esModule",{value:!0});uk.validateTuple=void 0;var Ef=ge(),Ls=ke(),ck=Fn(),_H={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:n}=e;if(Array.isArray(t))return lk(e,"additionalItems",t);if(n.items=!0,Ls.alwaysValidSchema(n,t))return;e.ok(ck.validateArray(e))}};function lk(e,t,n=e.schema){let{gen:r,parentSchema:s,data:o,keyword:i,it:a}=e;if(u(s),a.opts.unevaluated&&n.length&&a.items!==!0)a.items=Ls.mergeEvaluated.items(r,n.length,a.items);let c=r.name("valid"),l=r.const("len",Ef._`${o}.length`);n.forEach((d,p)=>{if(Ls.alwaysValidSchema(a,d))return;r.if(Ef._`${l} > ${p}`,()=>e.subschema({keyword:i,schemaProp:p,dataProp:p},c)),e.ok(c)});function u(d){let{opts:p,errSchemaPath:m}=a,x=n.length,h=x===d.minItems&&(x===d.maxItems||d[t]===!1);if(p.strictTuples&&!h){let g=`"${i}" is ${x}-tuple, but minItems or maxItems/${t} are not specified or different at path "${m}"`;Ls.checkStrictMode(a,g,p.strictTuples)}}}uk.validateTuple=lk;uk.default=_H});var mk=W(function(pk){Object.defineProperty(pk,"__esModule",{value:!0});var dk=sg(),OH={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(e)=>dk.validateTuple(e,"items")};pk.default=OH});var bk=W(function(xk){Object.defineProperty(xk,"__esModule",{value:!0});var jf=ge(),hk=ke(),gk=Fn(),yk=rg(),RH={message:({params:{len:e}})=>jf.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>jf._`{limit: ${e}}`},CH={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:RH,code(e){let{schema:t,parentSchema:n,it:r}=e,{prefixItems:s}=n;if(r.items=!0,hk.alwaysValidSchema(r,t))return;if(s)yk.validateAdditionalItems(e,s);else e.ok(gk.validateArray(e))}};xk.default=CH});var wk=W(function($k){Object.defineProperty($k,"__esModule",{value:!0});var nt=ge(),Vs=ke(),TH={message:({params:{min:e,max:t}})=>t===void 0?nt.str`must contain at least ${e} valid item(s)`:nt.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?nt._`{minContains: ${e}}`:nt._`{minContains: ${e}, maxContains: ${t}}`},JH={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:TH,code(e){let{gen:t,schema:n,parentSchema:r,data:s,it:o}=e,i,a,{minContains:c,maxContains:l}=r;if(o.opts.next)i=c===void 0?1:c,a=l;else i=1;let u=t.const("len",nt._`${s}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){Vs.checkStrictMode(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){Vs.checkStrictMode(o,'"minContains" > "maxContains" is always invalid'),e.fail();return}if(Vs.alwaysValidSchema(o,n)){let h=nt._`${u} >= ${i}`;if(a!==void 0)h=nt._`${h} && ${u} <= ${a}`;e.pass(h);return}o.items=!0;let d=t.name("valid");if(a===void 0&&i===1)m(d,()=>t.if(d,()=>t.break()));else if(i===0){if(t.let(d,!0),a!==void 0)t.if(nt._`${s}.length > 0`,p)}else t.let(d,!1),p();e.result(d,()=>e.reset());function p(){let h=t.name("_valid"),g=t.let("count",0);m(h,()=>t.if(h,()=>x(g)))}function m(h,g){t.forRange("i",0,u,(b)=>{e.subschema({keyword:"contains",dataProp:b,dataPropType:Vs.Type.Num,compositeRule:!0},h),g()})}function x(h){if(t.code(nt._`${h}++`),a===void 0)t.if(nt._`${h} >= ${i}`,()=>t.assign(d,!0).break());else if(t.if(nt._`${h} > ${a}`,()=>t.assign(d,!1).break()),i===1)t.assign(d,!0);else t.if(nt._`${h} >= ${i}`,()=>t.assign(d,!0))}}};$k.default=JH});var Pf=W(function(jk){Object.defineProperty(jk,"__esModule",{value:!0});jk.validateSchemaDeps=jk.validatePropertyDeps=jk.error=void 0;var oa=ge(),Sk=ke(),kr=Fn();jk.error={message:({params:{property:e,depsCount:t,deps:n}})=>oa.str`must have ${t===1?"property":"properties"} ${n} when property ${e} is present`,params:({params:{property:e,depsCount:t,deps:n,missingProperty:r}})=>oa._`{property: ${e},
|
|
623
|
+
`+(" ".repeat(ge.length)+"^"),Me=_==="Syntax"?"since":"inside",Pt=`${_} error at line ${ie}${f.name?` in ${f.name}`:""}${b&&b.name?`, ${Me} \`${b.partial?"partial ":""}${function(Dt){let $r=[Dt];for(;Dt&&Dt.parent;){let{parent:Yr}=Dt;$r.unshift(Yr),Dt=Yr}return $r.map((Yr)=>function(Ra,Na){let Nb=Ra;return Na&&(Nb+=` ${Na}`),Nb}(Yr.type,Yr.name)).join(" -> ")}(b)}\``:""}:
|
|
624
|
+
${In}`;return{message:`${Pt} ${v}`,bareMessage:v,context:Pt,line:ie,sourceName:f.name,level:M,ruleName:ae,autofix:K,input:ut,tokens:De}}function r(f,h,b,v){return n(f,h,b,v,"Syntax")}function s(f,h,b,v,_={}){return _.ruleName=b,n(h.source,f.index,h,v,"Validation",_)}e.r(t),e.d(t,{WebIDLParseError:()=>pe,parse:()=>pp,validate:()=>wc,write:()=>mp});class o{constructor({source:f,tokens:h}){Object.defineProperties(this,{source:{value:f},tokens:{value:h,writable:!0},parent:{value:null,writable:!0},this:{value:this}})}toJSON(){let f={type:void 0,name:void 0,inheritance:void 0},h=this;for(;h!==Object.prototype;){let b=Object.getOwnPropertyDescriptors(h);for(let[v,_]of Object.entries(b))(_.enumerable||_.get)&&(f[v]=this[v]);h=Object.getPrototypeOf(h)}return f}}function i(f,h,{useNullableInner:b}={}){if(!f.union){let v=h.unique.get(f.idlType);if(!v)return;if(v.type==="typedef"){let{typedefIncludesDictionary:_}=h.cache;if(_.has(v))return _.get(v);h.cache.typedefIncludesDictionary.set(v,void 0);let M=i(v.idlType,h);if(h.cache.typedefIncludesDictionary.set(v,M),M)return{reference:f,dictionary:M.dictionary}}if(v.type==="dictionary"&&(b||!f.nullable))return{reference:f,dictionary:v}}for(let v of f.subtype){let _=i(v,h);if(_)return v.union?_:{reference:v,dictionary:_.dictionary}}}function a(f,h){if(h.cache.dictionaryIncludesRequiredField.has(f))return h.cache.dictionaryIncludesRequiredField.get(f);h.cache.dictionaryIncludesRequiredField.set(f,void 0);let b=f.members.some((v)=>v.required);if(!b&&f.inheritance){let v=h.unique.get(f.inheritance);v?a(v,h)&&(b=!0):b=!0}return h.cache.dictionaryIncludesRequiredField.set(f,b),b}class l extends Array{constructor({source:f,tokens:h}){super(),Object.defineProperties(this,{source:{value:f},tokens:{value:h},parent:{value:null,writable:!0}})}}class c extends o{static parser(f,h){return()=>{let b=f.consumeKind(h);if(b)return new c({source:f.source,tokens:{value:b}})}}get value(){return O(this.tokens.value.value)}write(f){return f.ts.wrap([f.token(this.tokens.value),f.token(this.tokens.separator)])}}class u extends c{static parse(f){let h=f.consumeKind("eof");if(h)return new u({source:f.source,tokens:{value:h}})}get type(){return"eof"}}function d(f,h){return N(f,{parser:c.parser(f,h),listName:h+" list"})}let p=["identifier","decimal","integer","string"],m=new Map([...["NoInterfaceObject","LenientSetter","LenientThis","TreatNonObjectAsNull","Unforgeable"].map((f)=>[f,`Legacy${f}`]),["NamedConstructor","LegacyFactoryFunction"],["OverrideBuiltins","LegacyOverrideBuiltIns"],["TreatNullAs","LegacyNullToEmptyString"]]);function y(f){for(let h of p){let b=d(f,h);if(b.length)return b}f.error("Expected identifiers, strings, decimals, or integers but none found")}class S extends o{static parse(f){let h={assign:f.consume("=")},b=z(new S({source:f.source,tokens:h}));if(b.list=[],h.assign){if(h.asterisk=f.consume("*"),h.asterisk)return b.this;h.secondaryName=f.consumeKind(...p)}return h.open=f.consume("("),h.open?(b.list=b.rhsIsList?y(f):ue(f),h.close=f.consume(")")||f.error("Unexpected token in extended attribute argument list")):h.assign&&!h.secondaryName&&f.error("No right hand side to extended attribute assignment"),b.this}get rhsIsList(){return this.tokens.assign&&!this.tokens.asterisk&&!this.tokens.secondaryName}get rhsType(){return this.rhsIsList?this.list[0].tokens.value.type+"-list":this.tokens.asterisk?"*":this.tokens.secondaryName?this.tokens.secondaryName.type:null}write(f){let{rhsType:h}=this;return f.ts.wrap([f.token(this.tokens.assign),f.token(this.tokens.asterisk),f.reference_token(this.tokens.secondaryName,this.parent),f.token(this.tokens.open),...this.list.map((b)=>h==="identifier-list"?f.identifier(b,this.parent):b.write(f)),f.token(this.tokens.close)])}}class g extends o{static parse(f){let h=f.consumeKind("identifier");if(h)return new g({source:f.source,tokens:{name:h},params:S.parse(f)})}constructor({source:f,tokens:h,params:b}){super({source:f,tokens:h}),b.parent=this,Object.defineProperty(this,"params",{value:b})}get type(){return"extended-attribute"}get name(){return this.tokens.name.value}get rhs(){let{rhsType:f,tokens:h,list:b}=this.params;if(!f)return null;return{type:f,value:this.params.rhsIsList?b:this.params.tokens.secondaryName?O(h.secondaryName.value):null}}get arguments(){let{rhsIsList:f,list:h}=this.params;return!h||f?[]:h}*validate(f){let{name:h}=this;if(h==="LegacyNoInterfaceObject")yield s(this.tokens.name,this,"no-nointerfaceobject","`[LegacyNoInterfaceObject]` extended attribute is an undesirable feature that may be removed from Web IDL in the future. Refer to the [relevant upstream PR](https://github.com/whatwg/webidl/pull/609) for more information.",{level:"warning"});else if(m.has(h)){let v=`\`[${h}]\` extended attribute is a legacy feature that is now renamed to \`[${m.get(h)}]\`. Refer to the [relevant upstream PR](https://github.com/whatwg/webidl/pull/870) for more information.`;yield s(this.tokens.name,this,"renamed-legacy",v,{level:"warning",autofix:(b=this,()=>{let{name:_}=b;b.tokens.name.value=m.get(_),_==="TreatNullAs"&&(b.params.tokens={})})})}var b;for(let v of this.arguments)yield*v.validate(f)}write(f){return f.ts.wrap([f.ts.trivia(this.tokens.name.trivia),f.ts.extendedAttribute(f.ts.wrap([f.ts.extendedAttributeReference(this.name),this.params.write(f)])),f.token(this.tokens.separator)])}}class x extends l{static parse(f){let h={};h.open=f.consume("[");let b=new x({source:f.source,tokens:h});return h.open?(b.push(...N(f,{parser:g.parse,listName:"extended attribute"})),h.close=f.consume("]")||f.error("Expected a closing token for the extended attribute list"),b.length||(f.unconsume(h.close.index),f.error("An extended attribute list must not be empty")),f.probe("[")&&f.error("Illegal double extended attribute lists, consider merging them"),b):b}*validate(f){for(let h of this)yield*h.validate(f)}write(f){return this.length?f.ts.wrap([f.token(this.tokens.open),...this.map((h)=>h.write(f)),f.token(this.tokens.close)]):""}}function P(f,h){let b=f.consume("?");b&&(h.tokens.nullable=b),f.probe("?")&&f.error("Can't nullable more than once")}function w(f,h){let b=function(v,_){let M=v.consume("FrozenArray","ObservableArray","Promise","async_sequence","sequence","record");if(!M)return;let K=z(new E({source:v.source,tokens:{base:M}}));switch(K.tokens.open=v.consume("<")||v.error(`No opening bracket after ${M.value}`),M.value){case"Promise":{v.probe("[")&&v.error("Promise type cannot have extended attribute");let ae=fe(v,_)||v.error("Missing Promise subtype");K.subtype.push(ae);break}case"async_sequence":case"sequence":case"FrozenArray":case"ObservableArray":{let ae=ne(v,_)||v.error(`Missing ${M.value} subtype`);K.subtype.push(ae);break}case"record":{v.probe("[")&&v.error("Record key cannot have extended attribute");let ae=v.consume(...Ye)||v.error(`Record key must be one of: ${Ye.join(", ")}`),U=new E({source:v.source,tokens:{base:ae}});U.tokens.separator=v.consume(",")||v.error("Missing comma after record key type"),U.type=_;let oe=ne(v,_)||v.error("Error parsing generic type record");K.subtype.push(U,oe);break}}return K.idlType||v.error(`Error parsing generic type ${M.value}`),K.tokens.close=v.consume(">")||v.error(`Missing closing bracket after ${M.value}`),K.this}(f,h)||re(f);if(!b){let v=f.consumeKind("identifier")||f.consume(...Ye,...qe);if(!v)return;b=new E({source:f.source,tokens:{base:v}}),f.probe("<")&&f.error(`Unsupported generic type ${v.value}`)}return b.generic==="Promise"&&f.probe("?")&&f.error("Promise type cannot be nullable"),b.type=h||null,P(f,b),b.nullable&&b.idlType==="any"&&f.error("Type `any` cannot be made nullable"),b}class E extends o{static parse(f,h){return w(f,h)||function(b,v){let _={};if(_.open=b.consume("("),!_.open)return;let M=z(new E({source:b.source,tokens:_}));for(M.type=v||null;;){let K=ne(b,v)||b.error("No type after open parenthesis or 'or' in union type");K.idlType==="any"&&b.error("Type `any` cannot be included in a union type"),K.generic==="Promise"&&b.error("Type `Promise` cannot be included in a union type"),M.subtype.push(K);let ae=b.consume("or");if(!ae)break;K.tokens.separator=ae}return M.idlType.length<2&&b.error("At least two types are expected in a union type but found less"),_.close=b.consume(")")||b.error("Unterminated union type"),P(b,M),M.this}(f,h)}constructor({source:f,tokens:h}){super({source:f,tokens:h}),Object.defineProperty(this,"subtype",{value:[],writable:!0}),this.extAttrs=new x({source:f,tokens:{}})}get generic(){return this.subtype.length&&this.tokens.base?this.tokens.base.value:""}get nullable(){return Boolean(this.tokens.nullable)}get union(){return Boolean(this.subtype.length)&&!this.tokens.base}get idlType(){if(this.subtype.length)return this.subtype;return O([this.tokens.prefix,this.tokens.base,this.tokens.postfix].filter((f)=>f).map((f)=>f.value).join(" "))}*validate(f){if(yield*this.extAttrs.validate(f),this.idlType==="BufferSource")for(let _ of[this.extAttrs,this.parent?.extAttrs])for(let M of _){if(M.name!=="AllowShared")continue;let K="`[AllowShared] BufferSource` is now replaced with AllowSharedBufferSource.";yield s(this.tokens.base,this,"migrate-allowshared",K,{autofix:j(this,M,_)})}if(this.idlType==="void")yield s(this.tokens.base,this,"replace-void","`void` is now replaced by `undefined`. Refer to the [relevant GitHub issue](https://github.com/whatwg/webidl/issues/60) for more information.",{autofix:(h=this,()=>{h.tokens.base.value="undefined"})});var h;let b=!this.union&&f.unique.get(this.idlType),v=this.union?this:b&&b.type==="typedef"?b.idlType:void 0;if(v&&this.nullable){let{reference:_}=i(v,f)||{};if(_){let M=(this.union?_:this).tokens.base;yield s(M,this,"no-nullable-union-dict","Nullable union cannot include a dictionary type.")}}else for(let _ of this.subtype)yield*_.validate(f)}write(f){return f.ts.wrap([this.extAttrs.write(f),(()=>{if(this.union||this.generic)return f.ts.wrap([f.token(this.tokens.base,f.ts.generic),f.token(this.tokens.open),...this.subtype.map((_)=>_.write(f)),f.token(this.tokens.close)]);let h=this.tokens.prefix||this.tokens.base,b=this.tokens.prefix?[this.tokens.prefix.value,f.ts.trivia(this.tokens.base.trivia)]:[],v=f.reference(f.ts.wrap([...b,this.tokens.base.value,f.token(this.tokens.postfix)]),{unescaped:this.idlType,context:this});return f.ts.wrap([f.ts.trivia(h.trivia),v])})(),f.token(this.tokens.nullable),f.token(this.tokens.separator)])}}function j(f,h,b){return()=>{let v=b.indexOf(h);b.splice(v,1),!b.length&&f.tokens.base.trivia.match(/^\s$/)&&(f.tokens.base.trivia=""),f.tokens.base.value="AllowSharedBufferSource"}}class A extends o{static parse(f){let h=f.consume("=");if(!h)return null;let b=G(f)||f.consumeKind("string")||f.consume("null","[","{")||f.error("No value for default"),v=[b];if(b.value==="["){let _=f.consume("]")||f.error("Default sequence value must be empty");v.push(_)}else if(b.value==="{"){let _=f.consume("}")||f.error("Default dictionary value must be empty");v.push(_)}return new A({source:f.source,tokens:{assign:h},expression:v})}constructor({source:f,tokens:h,expression:b}){super({source:f,tokens:h}),b.parent=this,Object.defineProperty(this,"expression",{value:b})}get type(){return Q(this.expression[0]).type}get value(){return Q(this.expression[0]).value}get negative(){return Q(this.expression[0]).negative}write(f){return f.ts.wrap([f.token(this.tokens.assign),...this.expression.map((h)=>f.token(h))])}}class T extends o{static parse(f){let h=f.position,b={},v=z(new T({source:f.source,tokens:b}));return v.extAttrs=x.parse(f),b.optional=f.consume("optional"),v.idlType=ne(f,"argument-type"),v.idlType?(b.optional||(b.variadic=f.consume("...")),b.name=f.consumeKind("identifier")||f.consume(...te),b.name?(v.default=b.optional?A.parse(f):null,v.this):f.unconsume(h)):f.unconsume(h)}get type(){return"argument"}get optional(){return!!this.tokens.optional}get variadic(){return!!this.tokens.variadic}get name(){return O(this.tokens.name.value)}*validate(f){yield*this.extAttrs.validate(f),yield*this.idlType.validate(f);let h=i(this.idlType,f,{useNullableInner:!0});if(h){if(this.idlType.nullable)yield s(this.tokens.name,this,"no-nullable-dict-arg","Dictionary arguments cannot be nullable.");else if(this.optional){if(!this.default)yield s(this.tokens.name,this,"dict-arg-default","Optional dictionary arguments must have a default value of `{}`.",{autofix:I(this)})}else if(this.parent&&!a(h.dictionary,f)&&function(v){let _=v.parent.arguments||v.parent.list,M=_.indexOf(v);return!_.slice(M+1).some((ae)=>!ae.optional)}(this))yield s(this.tokens.name,this,"dict-arg-optional","Dictionary argument must be optional if it has no required fields",{autofix:(b=this,()=>{let _=q(b.idlType);b.tokens.optional={..._,type:"optional",value:"optional"},_.trivia=" ",I(b)()})})}var b}write(f){return f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.optional),f.ts.type(this.idlType.write(f)),f.token(this.tokens.variadic),f.name_token(this.tokens.name,{data:this}),this.default?this.default.write(f):"",f.token(this.tokens.separator)])}}function I(f){return()=>{f.default=A.parse(new bt(" = {}"))}}class V extends o{static parse(f,{special:h,regular:b}={}){let v={special:h},_=z(new V({source:f.source,tokens:v}));return h&&h.value==="stringifier"&&(v.termination=f.consume(";"),v.termination)?(_.arguments=[],_):(h||b||(v.special=f.consume("getter","setter","deleter")),_.idlType=fe(f)||f.error("Missing return type"),v.name=f.consumeKind("identifier")||f.consume("includes"),v.open=f.consume("(")||f.error("Invalid operation"),_.arguments=ue(f),v.close=f.consume(")")||f.error("Unterminated operation"),v.termination=f.consume(";")||f.error("Unterminated operation, expected `;`"),_.this)}get type(){return"operation"}get name(){let{name:f}=this.tokens;return f?O(f.value):""}get special(){return this.tokens.special?this.tokens.special.value:""}*validate(f){if(yield*this.extAttrs.validate(f),!this.name&&["","static"].includes(this.special))yield s(this.tokens.open,this,"incomplete-op","Regular or static operations must have both a return type and an identifier.");if(this.idlType){if(this.idlType.generic==="async_sequence")yield s(this.idlType.tokens.base,this,"async-sequence-idl-to-js","async_sequence types cannot be returned by an operation.");yield*this.idlType.validate(f)}for(let h of this.arguments)yield*h.validate(f)}write(f){let{parent:h}=this,b=this.idlType?[f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this,parent:h}),f.token(this.tokens.open),f.ts.wrap(this.arguments.map((v)=>v.write(f))),f.token(this.tokens.close)]:[];return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),this.tokens.name?f.token(this.tokens.special):f.token(this.tokens.special,f.ts.nameless,{data:this,parent:h}),...b,f.token(this.tokens.termination)]),{data:this,parent:h})}}class H extends o{static parse(f,{special:h,noInherit:b=!1,readonly:v=!1}={}){let _=f.position,M={special:h},K=z(new H({source:f.source,tokens:M}));if(h||b||(M.special=f.consume("inherit")),K.special==="inherit"&&f.probe("readonly")&&f.error("Inherited attributes cannot be read-only"),M.readonly=f.consume("readonly"),v&&!M.readonly&&f.probe("attribute")&&f.error("Attributes must be readonly in this context"),M.base=f.consume("attribute"),M.base)return K.idlType=ne(f,"attribute-type")||f.error("Attribute lacks a type"),M.name=f.consumeKind("identifier")||f.consume("async","required")||f.error("Attribute lacks a name"),M.termination=f.consume(";")||f.error("Unterminated attribute, expected `;`"),K.this;f.unconsume(_)}get type(){return"attribute"}get special(){return this.tokens.special?this.tokens.special.value:""}get readonly(){return!!this.tokens.readonly}get name(){return O(this.tokens.name.value)}*validate(f){if(yield*this.extAttrs.validate(f),yield*this.idlType.validate(f),["async_sequence","sequence","record"].includes(this.idlType.generic)){let h=`Attributes cannot accept ${this.idlType.generic} types.`;yield s(this.tokens.name,this,"attr-invalid-type",h)}{let{reference:h}=i(this.idlType,f)||{};if(h){let b=(this.idlType.union?h:this.idlType).tokens.base;yield s(b,this,"attr-invalid-type","Attributes cannot accept dictionary types.")}}if(this.readonly&&function(h,b){if(h.union)return!1;if(h.extAttrs.some((_)=>_.name==="EnforceRange"))return!0;let v=b.unique.get(h.idlType);return v?.type==="typedef"&&v.idlType.extAttrs.some((_)=>_.name==="EnforceRange")}(this.idlType,f)){let h=this.idlType.tokens.base;yield s(h,this,"attr-invalid-type","Readonly attributes cannot accept [EnforceRange] extended attribute.")}}write(f){let{parent:h}=this;return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.special),f.token(this.tokens.readonly),f.token(this.tokens.base),f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this,parent:h}),f.token(this.tokens.termination)]),{data:this,parent:h})}}function O(f){return f.startsWith("_")?f.slice(1):f}function N(f,{parser:h,allowDangler:b,listName:v="list"}){let _=h(f);if(!_)return[];_.tokens.separator=f.consume(",");let M=[_];for(;_.tokens.separator;){let K=h(f);if(!K){b||f.error(`Trailing comma in ${v}`);break}if(K.tokens.separator=f.consume(","),M.push(K),!K.tokens.separator)break}return M}function G(f){return f.consumeKind("decimal","integer")||f.consume("true","false","Infinity","-Infinity","NaN")}function Q({type:f,value:h}){switch(f){case"decimal":case"integer":return{type:"number",value:h};case"string":return{type:"string",value:h.slice(1,-1)}}switch(h){case"true":case"false":return{type:"boolean",value:h==="true"};case"Infinity":case"-Infinity":return{type:"Infinity",negative:h.startsWith("-")};case"[":return{type:"sequence",value:[]};case"{":return{type:"dictionary"};default:return{type:h}}}function re(f){let{source:h}=f,b=function(){let _=f.consume("unsigned"),M=f.consume("short","long");if(M){let K=f.consume("long");return new E({source:h,tokens:{prefix:_,base:M,postfix:K}})}_&&f.error("Failed to parse integer type")}()||function(){let _=f.consume("unrestricted"),M=f.consume("float","double");if(M)return new E({source:h,tokens:{prefix:_,base:M}});_&&f.error("Failed to parse float type")}();if(b)return b;let v=f.consume("bigint","boolean","byte","octet","undefined");return v?new E({source:h,tokens:{base:v}}):void 0}function ue(f){return N(f,{parser:T.parse,listName:"arguments list"})}function ne(f,h){let b=x.parse(f),v=E.parse(f,h);return v&&(z(v).extAttrs=b),v}function fe(f,h){let b=E.parse(f,h||"return-type");if(b)return b;let v=f.consume("void");if(v){let _=new E({source:f.source,tokens:{base:v}});return _.type="return-type",_}}function xe(f){let h=f.consume("stringifier");if(!h)return;return H.parse(f,{special:h})||V.parse(f,{special:h})||f.error("Unterminated stringifier")}function X(f){let h=f.split(`
|
|
625
|
+
`);if(h.length){let b=h[h.length-1].match(/^\s+/);if(b)return b[0]}return""}function B(f){return()=>{if(f.extAttrs.length){let h=new bt("Exposed=Window,"),b=g.parse(h);b.tokens.separator=h.consume(",");let v=f.extAttrs[0];/^\s/.test(v.tokens.name.trivia)||(v.tokens.name.trivia=` ${v.tokens.name.trivia}`),f.extAttrs.unshift(b)}else{z(f).extAttrs=x.parse(new bt("[Exposed=Window]"));let h=f.tokens.base.trivia;f.extAttrs.tokens.open.trivia=h,f.tokens.base.trivia=`
|
|
626
|
+
${X(h)}`}}}function q(f){if(f.extAttrs.length)return f.extAttrs.tokens.open;if(f.type==="operation"&&!f.special)return q(f.idlType);return Object.values(f.tokens).sort((h,b)=>h.index-b.index)[0]}function z(f,h){if(h||(h=f),!f)return f;return new Proxy(f,{get(b,v){let _=b[v];return Array.isArray(_)&&v!=="source"?z(_,b):_},set(b,v,_){if(b[v]=_,!_)return!0;if(Array.isArray(_))for(let M of _)M.parent!==void 0&&(M.parent=h);else _.parent!==void 0&&(_.parent=h);return!0}})}let We={decimal:/-?(?=[0-9]*\.|[0-9]+[eE])(([0-9]+\.[0-9]*|[0-9]*\.[0-9]+)([Ee][-+]?[0-9]+)?|[0-9]+[Ee][-+]?[0-9]+)/y,integer:/-?(0([Xx][0-9A-Fa-f]+|[0-7]*)|[1-9][0-9]*)/y,identifier:/[_-]?[A-Za-z][0-9A-Z_a-z-]*/y,string:/"[^"]*"/y,whitespace:/[\t\n\r ]+/y,comment:/\/\/.*|\/\*[\s\S]*?\*\//y,other:/[^\t\n\r 0-9A-Za-z]/y},qe=["ArrayBuffer","SharedArrayBuffer","DataView","Int8Array","Int16Array","Int32Array","Uint8Array","Uint16Array","Uint32Array","Uint8ClampedArray","BigInt64Array","BigUint64Array","Float16Array","Float32Array","Float64Array","any","object","symbol"],Ye=["ByteString","DOMString","USVString"],te=["async","attribute","callback","const","constructor","deleter","dictionary","enum","getter","includes","inherit","interface","iterable","maplike","namespace","partial","required","setlike","setter","static","stringifier","typedef","unrestricted"],Ut=["-Infinity","FrozenArray","Infinity","NaN","ObservableArray","Promise","async_iterable","async_sequence","bigint","boolean","byte","double","false","float","long","mixin","null","octet","optional","or","readonly","record","sequence","short","true","undefined","unsigned","void"].concat(te,Ye,qe),Je=["(",")",",","...",":",";","<","=",">","?","*","[","]","{","}"],jt=["_constructor","toString","_toString"];class bt{constructor(f){this.source=function(h){let b=[],v=0,_="",M=1,K=0;for(;v<h.length;){let U=h.charAt(v),oe=-1;if(/[\t\n\r ]/.test(U)?oe=ae("whitespace",{noFlushTrivia:!0}):U==="/"&&(oe=ae("comment",{noFlushTrivia:!0})),oe!==-1){let ie=b.pop().value;M+=(ie.match(/\n/g)||[]).length,_+=ie,K-=1}else if(/[-0-9.A-Z_a-z]/.test(U)){if(oe=ae("decimal"),oe===-1&&(oe=ae("integer")),oe===-1){oe=ae("identifier");let ie=b.length-1,ge=b[ie];if(oe!==-1){if(jt.includes(ge.value)){let De=`${O(ge.value)} is a reserved identifier and must not be used.`;throw new pe(r(b,ie,null,De))}Ut.includes(ge.value)&&(ge.type="inline")}}}else U==='"'&&(oe=ae("string"));for(let ie of Je)if(h.startsWith(ie,v)){b.push({type:"inline",value:ie,trivia:_,line:M,index:K}),_="",v+=ie.length,oe=v;break}if(oe===-1&&(oe=ae("other")),oe===-1)throw Error("Token stream not progressing");v=oe,K+=1}return b.push({type:"eof",value:"",trivia:_,line:M,index:K}),b;function ae(U,{noFlushTrivia:oe}={}){let ie=We[U];ie.lastIndex=v;let ge=ie.exec(h);return ge?(b.push({type:U,value:ge[0],trivia:_,line:M,index:K}),oe||(_=""),ie.lastIndex):-1}}(f),this.position=0}error(f){throw new pe(r(this.source,this.position,this.current,f))}probeKind(f){return this.source.length>this.position&&this.source[this.position].type===f}probe(f){return this.probeKind("inline")&&this.source[this.position].value===f}consumeKind(...f){for(let h of f){if(!this.probeKind(h))continue;let b=this.source[this.position];return this.position++,b}}consume(...f){if(!this.probeKind("inline"))return;let h=this.source[this.position];for(let b of f)if(h.value===b)return this.position++,h}consumeIdentifier(f){if(this.probeKind("identifier")&&this.source[this.position].value===f)return this.consumeKind("identifier")}unconsume(f){this.position=f}}class pe extends Error{constructor({message:f,bareMessage:h,context:b,line:v,sourceName:_,input:M,tokens:K}){super(f),this.name="WebIDLParseError",this.bareMessage=h,this.context=b,this.line=v,this.sourceName=_,this.input=M,this.tokens=K}}class ct extends c{static parse(f){let h=f.consumeKind("string");if(h)return new ct({source:f.source,tokens:{value:h}})}get type(){return"enum-value"}get value(){return super.value.slice(1,-1)}write(f){let{parent:h}=this;return f.ts.wrap([f.ts.trivia(this.tokens.value.trivia),f.ts.definition(f.ts.wrap(['"',f.ts.name(this.value,{data:this,parent:h}),'"']),{data:this,parent:h}),f.token(this.tokens.separator)])}}class Se extends o{static parse(f){let h={};if(h.base=f.consume("enum"),!h.base)return;h.name=f.consumeKind("identifier")||f.error("No name for enum");let b=z(new Se({source:f.source,tokens:h}));return f.current=b.this,h.open=f.consume("{")||f.error("Bodyless enum"),b.values=N(f,{parser:ct.parse,allowDangler:!0,listName:"enumeration"}),f.probeKind("string")&&f.error("No comma between enum values"),h.close=f.consume("}")||f.error("Unexpected value in enum"),b.values.length||f.error("No value in enum"),h.termination=f.consume(";")||f.error("No semicolon after enum"),b.this}get type(){return"enum"}get name(){return O(this.tokens.name.value)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base),f.name_token(this.tokens.name,{data:this}),f.token(this.tokens.open),f.ts.wrap(this.values.map((h)=>h.write(f))),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this})}}class Ze extends o{static parse(f){let h=f.consumeKind("identifier");if(!h)return;let b={target:h};if(b.includes=f.consume("includes"),b.includes)return b.mixin=f.consumeKind("identifier")||f.error("Incomplete includes statement"),b.termination=f.consume(";")||f.error("No terminating ; for includes statement"),new Ze({source:f.source,tokens:b});f.unconsume(h.index)}get type(){return"includes"}get target(){return O(this.tokens.target.value)}get includes(){return O(this.tokens.mixin.value)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.reference_token(this.tokens.target,this),f.token(this.tokens.includes),f.reference_token(this.tokens.mixin,this),f.token(this.tokens.termination)]),{data:this})}}class Nt extends o{static parse(f){let h={},b=z(new Nt({source:f.source,tokens:h}));if(h.base=f.consume("typedef"),h.base)return b.idlType=ne(f,"typedef-type")||f.error("Typedef lacks a type"),h.name=f.consumeKind("identifier")||f.error("Typedef lacks a name"),f.current=b.this,h.termination=f.consume(";")||f.error("Unterminated typedef, expected `;`"),b.this}get type(){return"typedef"}get name(){return O(this.tokens.name.value)}*validate(f){yield*this.idlType.validate(f)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base),f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this}),f.token(this.tokens.termination)]),{data:this})}}class co extends o{static parse(f,h){let b={base:h},v=z(new co({source:f.source,tokens:b}));return b.name=f.consumeKind("identifier")||f.error("Callback lacks a name"),f.current=v.this,b.assign=f.consume("=")||f.error("Callback lacks an assignment"),v.idlType=fe(f)||f.error("Callback lacks a return type"),b.open=f.consume("(")||f.error("Callback lacks parentheses for arguments"),v.arguments=ue(f),b.close=f.consume(")")||f.error("Unterminated callback"),b.termination=f.consume(";")||f.error("Unterminated callback, expected `;`"),v.this}get type(){return"callback"}get name(){return O(this.tokens.name.value)}*validate(f){yield*this.extAttrs.validate(f);for(let h of this.arguments)if(yield*h.validate(f),h.idlType.generic==="async_sequence")yield s(h.tokens.name,h,"async-sequence-idl-to-js","async_sequence types cannot be returned as a callback argument.");yield*this.idlType.validate(f)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base),f.name_token(this.tokens.name,{data:this}),f.token(this.tokens.assign),f.ts.type(this.idlType.write(f)),f.token(this.tokens.open),...this.arguments.map((h)=>h.write(f)),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this})}}class $t extends o{static parse(f,h,{inheritable:b,allowedMembers:v}){let{tokens:_,type:M}=h;for(_.name=f.consumeKind("identifier")||f.error(`Missing name in ${M}`),f.current=h,h=z(h),b&&Object.assign(_,function(K){let ae=K.consume(":");return ae?{colon:ae,inheritance:K.consumeKind("identifier")||K.error("Inheritance lacks a type")}:{}}(f)),_.open=f.consume("{")||f.error(`Bodyless ${M}`),h.members=[];;){if(_.close=f.consume("}"),_.close)return _.termination=f.consume(";")||f.error(`Missing semicolon after ${M}`),h.this;let K=x.parse(f),ae;for(let[U,...oe]of v)if(ae=z(U(f,...oe)),ae)break;ae||f.error("Unknown member"),ae.extAttrs=K,h.members.push(ae.this)}}get partial(){return!!this.tokens.partial}get name(){return O(this.tokens.name.value)}get inheritance(){return this.tokens.inheritance?O(this.tokens.inheritance.value):null}*validate(f){for(let h of this.members)h.validate&&(yield*h.validate(f))}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.callback),f.token(this.tokens.partial),f.token(this.tokens.base),f.token(this.tokens.mixin),f.name_token(this.tokens.name,{data:this}),(()=>this.tokens.inheritance?f.ts.wrap([f.token(this.tokens.colon),f.ts.trivia(this.tokens.inheritance.trivia),f.ts.inheritance(f.reference(this.tokens.inheritance.value,{context:this}))]):"")(),f.token(this.tokens.open),f.ts.wrap(this.members.map((h)=>h.write(f))),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this})}}class tr extends o{static parse(f){let h={};if(h.base=f.consume("const"),!h.base)return;let b=re(f);if(!b){let _=f.consumeKind("identifier")||f.error("Const lacks a type");b=new E({source:f.source,tokens:{base:_}})}f.probe("?")&&f.error("Unexpected nullable constant type"),b.type="const-type",h.name=f.consumeKind("identifier")||f.error("Const lacks a name"),h.assign=f.consume("=")||f.error("Const lacks value assignment"),h.value=G(f)||f.error("Const lacks a value"),h.termination=f.consume(";")||f.error("Unterminated const, expected `;`");let v=new tr({source:f.source,tokens:h});return z(v).idlType=b,v}get type(){return"const"}get name(){return O(this.tokens.name.value)}get value(){return Q(this.tokens.value)}write(f){let{parent:h}=this;return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base),f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this,parent:h}),f.token(this.tokens.assign),f.token(this.tokens.value),f.token(this.tokens.termination)]),{data:this,parent:h})}}class tn extends o{static parse(f){let h=f.position,b=z(new tn({source:f.source,tokens:{}})),{tokens:v}=b;if(v.readonly=f.consume("readonly"),v.readonly||(v.async=f.consume("async")),v.base=v.readonly?f.consume("maplike","setlike"):v.async?f.consume("iterable"):f.consume("iterable","async_iterable","maplike","setlike"),!v.base)return void f.unconsume(h);let{type:_}=b,M=_==="maplike",K=M||_==="iterable"||_==="async_iterable",ae=_==="async_iterable"||b.async&&_==="iterable";v.open=f.consume("<")||f.error(`Missing less-than sign \`<\` in ${_} declaration`);let U=ne(f)||f.error(`Missing a type argument in ${_} declaration`);return b.idlType=[U],b.arguments=[],K&&(U.tokens.separator=f.consume(","),U.tokens.separator?b.idlType.push(ne(f)):M&&f.error(`Missing second type argument in ${_} declaration`)),v.close=f.consume(">")||f.error(`Missing greater-than sign \`>\` in ${_} declaration`),f.probe("(")&&(ae?(v.argsOpen=f.consume("("),b.arguments.push(...ue(f)),v.argsClose=f.consume(")")||f.error("Unterminated async iterable argument list")):f.error("Arguments are only allowed for `async iterable`")),v.termination=f.consume(";")||f.error(`Missing semicolon after ${_} declaration`),b.this}get type(){return this.tokens.base.value}get readonly(){return!!this.tokens.readonly}get async(){return!!this.tokens.async}*validate(f){if(this.async&&this.type==="iterable")yield s(this.tokens.async,this,"obsolete-async-iterable-syntax","`async iterable` is now changed to `async_iterable`.",{autofix:(h=this,()=>{let v=h.tokens.async;h.tokens.base={...v,type:"async_iterable",value:"async_iterable"},delete h.tokens.async})});var h;for(let b of this.idlType)yield*b.validate(f);for(let b of this.arguments)yield*b.validate(f)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.readonly),f.token(this.tokens.async),f.token(this.tokens.base,f.ts.generic),f.token(this.tokens.open),f.ts.wrap(this.idlType.map((h)=>h.write(f))),f.token(this.tokens.close),f.token(this.tokens.argsOpen),f.ts.wrap(this.arguments.map((h)=>h.write(f))),f.token(this.tokens.argsClose),f.token(this.tokens.termination)]),{data:this,parent:this.parent})}}class Xr extends o{static parse(f){let h=f.consume("constructor");if(!h)return;let b={base:h};b.open=f.consume("(")||f.error("No argument list in constructor");let v=ue(f);b.close=f.consume(")")||f.error("Unterminated constructor"),b.termination=f.consume(";")||f.error("No semicolon after constructor");let _=new Xr({source:f.source,tokens:b});return z(_).arguments=v,_}get type(){return"constructor"}*validate(f){for(let h of this.arguments)yield*h.validate(f)}write(f){let{parent:h}=this;return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base,f.ts.nameless,{data:this,parent:h}),f.token(this.tokens.open),f.ts.wrap(this.arguments.map((b)=>b.write(f))),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this,parent:h})}}function Mn(f){let h=f.consume("static");if(!h)return;return H.parse(f,{special:h})||V.parse(f,{special:h})||f.error("No body in static member")}class Ca extends $t{static parse(f,h,{extMembers:b=[],partial:v=null}={}){let _={partial:v,base:h};return $t.parse(f,new Ca({source:f.source,tokens:_}),{inheritable:!v,allowedMembers:[...b,[tr.parse],[Xr.parse],[Mn],[xe],[tn.parse],[H.parse],[V.parse]]})}get type(){return"interface"}*validate(f){if(yield*this.extAttrs.validate(f),!this.partial&&this.extAttrs.every((b)=>b.name!=="Exposed"))yield s(this.tokens.name,this,"require-exposed","Interfaces must have `[Exposed]` extended attribute. To fix, add, for example, `[Exposed=Window]`. Please also consider carefully if your interface should also be exposed in a Worker scope. Refer to the [WebIDL spec section on Exposed](https://heycam.github.io/webidl/#Exposed) for more information.",{autofix:B(this)});let h=this.extAttrs.filter((b)=>b.name==="Constructor");for(let b of h)yield s(b.tokens.name,this,"constructor-member","Constructors should now be represented as a `constructor()` operation on the interface instead of `[Constructor]` extended attribute. Refer to the [WebIDL spec section on constructor operations](https://heycam.github.io/webidl/#idl-constructors) for more information.",{autofix:dp(this,b)});if(this.extAttrs.some((b)=>b.name==="Global")){let b=this.extAttrs.filter((_)=>_.name==="LegacyFactoryFunction");for(let _ of b)yield s(_.tokens.name,this,"no-constructible-global","Interfaces marked as `[Global]` cannot have factory functions.");let v=this.members.filter((_)=>_.type==="constructor");for(let _ of v)yield s(_.tokens.base,this,"no-constructible-global","Interfaces marked as `[Global]` cannot have constructors.")}yield*super.validate(f),this.partial||(yield*function*(b,v){let _=function(oe){let ie=U(oe);return{statics:new Set(ie.filter((ge)=>ge.special==="static").map((ge)=>ge.name)),nonstatics:new Set(ie.filter((ge)=>ge.special!=="static").map((ge)=>ge.name))}}(v),M=b.partials.get(v.name)||[],K=b.mixinMap.get(v.name)||[];for(let oe of[...M,...K]){let ie=U(oe),ge=ie.filter((ut)=>ut.special==="static"),De=ie.filter((ut)=>ut.special!=="static");yield*ae(ge,_.statics,oe,v),yield*ae(De,_.nonstatics,oe,v),ge.forEach((ut)=>_.statics.add(ut.name)),De.forEach((ut)=>_.nonstatics.add(ut.name))}function*ae(oe,ie,ge,De){for(let ut of oe){let{name:In}=ut;if(In&&ie.has(In)){let Me=`The ${ut.special==="static"?"static ":""}operation "${In}" has already been defined for the base interface "${De.name}" either in itself or in a mixin`;yield s(ut.tokens.name,ge,"no-cross-overload",Me)}}}function U(oe){return oe.members.filter(({type:ie})=>ie==="operation")}}(f,this))}}function dp(f,h){return f=z(f),()=>{let b=X(f.extAttrs.tokens.open.trivia),v=f.members.length?X(q(f.members[0]).trivia):function(ie){let ge=X(ie),De=ge.includes("\t")?"\t":" ";return ge+De}(b),_=Xr.parse(new bt(`
|
|
627
|
+
${v}constructor();`));_.extAttrs=new x({source:f.source,tokens:{}}),z(_).arguments=h.arguments;let M=function(ie,ge){let De=ie.slice().reverse().findIndex(ge);return De===-1?De:ie.length-De-1}(f.members,(ie)=>ie.type==="constructor");f.members.splice(M+1,0,_);let{close:K}=f.tokens;K.trivia.includes(`
|
|
628
|
+
`)||(K.trivia+=`
|
|
629
|
+
${b}`);let{extAttrs:ae}=f,U=ae.indexOf(h),oe=ae.splice(U,1);ae.length?ae.length===U?ae[U-1].tokens.separator=void 0:ae[U].tokens.name.trivia.trim()||(ae[U].tokens.name.trivia=oe[0].tokens.name.trivia):ae.tokens.open=ae.tokens.close=void 0}}class xr extends $t{static parse(f,h,{extMembers:b=[],partial:v}={}){let _={partial:v,base:h};if(_.mixin=f.consume("mixin"),_.mixin)return $t.parse(f,new xr({source:f.source,tokens:_}),{allowedMembers:[...b,[tr.parse],[xe],[H.parse,{noInherit:!0}],[V.parse,{regular:!0}]]})}get type(){return"interface mixin"}}class br extends o{static parse(f){let h={},b=z(new br({source:f.source,tokens:h}));return b.extAttrs=x.parse(f),h.required=f.consume("required"),b.idlType=ne(f,"dictionary-type")||f.error("Dictionary member lacks a type"),h.name=f.consumeKind("identifier")||f.error("Dictionary member lacks a name"),b.default=A.parse(f),h.required&&b.default&&f.error("Required member must not have a default"),h.termination=f.consume(";")||f.error("Unterminated dictionary member, expected `;`"),b.this}get type(){return"field"}get name(){return O(this.tokens.name.value)}get required(){return!!this.tokens.required}*validate(f){yield*this.idlType.validate(f)}write(f){let{parent:h}=this;return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.required),f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this,parent:h}),this.default?this.default.write(f):"",f.token(this.tokens.termination)]),{data:this,parent:h})}}class nr extends $t{static parse(f,{extMembers:h=[],partial:b}={}){let v={partial:b};if(v.base=f.consume("dictionary"),v.base)return $t.parse(f,new nr({source:f.source,tokens:v}),{inheritable:!b,allowedMembers:[...h,[br.parse]]})}get type(){return"dictionary"}}class bs extends $t{static parse(f,{extMembers:h=[],partial:b}={}){let v={partial:b};if(v.base=f.consume("namespace"),v.base)return $t.parse(f,new bs({source:f.source,tokens:v}),{allowedMembers:[...h,[H.parse,{noInherit:!0,readonly:!0}],[tr.parse],[V.parse,{regular:!0}]]})}get type(){return"namespace"}*validate(f){if(!this.partial&&this.extAttrs.every((h)=>h.name!=="Exposed"))yield s(this.tokens.name,this,"require-exposed","Namespaces must have [Exposed] extended attribute. To fix, add, for example, [Exposed=Window]. Please also consider carefully if your namespace should also be exposed in a Worker scope. Refer to the [WebIDL spec section on Exposed](https://heycam.github.io/webidl/#Exposed) for more information.",{autofix:B(this)});yield*super.validate(f)}}class uo extends $t{static parse(f,h,{extMembers:b=[]}={}){let v={callback:h};if(v.base=f.consume("interface"),v.base)return $t.parse(f,new uo({source:f.source,tokens:v}),{allowedMembers:[...b,[tr.parse],[V.parse,{regular:!0}]]})}get type(){return"callback interface"}}function bc(f,h){let b=f.source;function v(U){f.error(U)}function _(...U){return f.consume(...U)}function M(U){let oe=_("interface");if(oe)return xr.parse(f,oe,{...U,...h?.extensions?.mixin})||Ca.parse(f,oe,{...U,...h?.extensions?.interface})||v("Interface has no proper body")}function K(){if(h.productions)for(let U of h.productions){let oe=U(f);if(oe)return oe}return function(){let U=_("callback");if(U)return f.probe("interface")?uo.parse(f,U,{...h?.extensions?.callbackInterface}):co.parse(f,U)}()||M()||function(){let U=_("partial");if(U)return nr.parse(f,{partial:U,...h?.extensions?.dictionary})||M({partial:U})||bs.parse(f,{partial:U,...h?.extensions?.namespace})||v("Partial doesn't apply to anything")}()||nr.parse(f,h?.extensions?.dictionary)||Se.parse(f)||Nt.parse(f)||Ze.parse(f)||bs.parse(f,h?.extensions?.namespace)}let ae=function(){if(!b.length)return[];let U=[];for(;;){let ie=x.parse(f),ge=K();if(!ge){ie.length&&v("Stray extended attributes");break}z(ge).extAttrs=ie,U.push(ge)}let oe=u.parse(f);return h.concrete&&U.push(oe),U}();return f.position<b.length&&v("Unrecognised tokens"),ae}function pp(f,h={}){let b=new bt(f);return h.sourceName!==void 0&&(b.source.name=h.sourceName),bc(b,h)}function un(f){return f}let Xo={wrap:(f)=>f.join(""),trivia:un,name:un,reference:un,type:un,generic:un,nameless:un,inheritance:un,definition:un,extendedAttribute:un,extendedAttributeReference:un};class $c{constructor(f){this.ts=Object.assign({},Xo,f)}reference(f,{unescaped:h,context:b}){return h||(h=f.startsWith("_")?f.slice(1):f),this.ts.reference(f,h,b)}token(f,h=un,...b){if(!f)return"";let v=h(f.value,...b);return this.ts.wrap([this.ts.trivia(f.trivia),v])}reference_token(f,h){return this.token(f,this.reference.bind(this),{context:h})}name_token(f,h){return this.token(f,this.ts.name,h)}identifier(f,h){return this.ts.wrap([this.reference_token(f.tokens.value,h),this.token(f.tokens.separator)])}}function mp(f,{templates:h=Xo}={}){h=Object.assign({},Xo,h);let b=new $c(h);return h.wrap(f.map((v)=>v.write(b)))}function fo(f,h){let b=new Map,v=f.filter((_)=>_.type==="includes");for(let _ of v){let M=h.get(_.includes);if(!M)continue;let K=b.get(_.target);K?K.push(M):b.set(_.target,[M])}return b}function*Sc(f){let h=function(b){let v=new Map,_=new Set,M=new Map;for(let K of b)if(K.partial){let ae=M.get(K.name);ae?ae.push(K):M.set(K.name,[K])}else K.name&&(v.has(K.name)?_.add(K):v.set(K.name,K));return{all:b,unique:v,partials:M,duplicates:_,mixinMap:fo(b,v),cache:{typedefIncludesDictionary:new WeakMap,dictionaryIncludesRequiredField:new WeakMap}}}(f);for(let b of h.all)b.validate&&(yield*b.validate(h));yield*function*({unique:b,duplicates:v}){for(let _ of v){let{name:M}=_,K=`The name "${M}" of type "${b.get(M).type}" was already seen`;yield s(_.tokens.name,_,"no-duplicate",K)}}(h)}function wc(f){return[...Sc((h=f,h.flat?h.flat():[].concat(...h)))];var h}return t})())});var ZP=W(function(kne,YP){var __dirname="/home/runner/work/jx/jx/node_modules/@webref/idl",zP=pt("fs").promises,ad=pt("path"),KP=UP();class GP{constructor(e,t){this.filename=t,this.shortname=ad.basename(t,".idl"),this.path=ad.join(e,t)}async text(){return await zP.readFile(this.path,"utf8")}async parse(){let e=await this.text();return KP.parse(e)}}async function XP({folder:e=__dirname}={}){let t={},n=await zP.readdir(e);for(let r of n)if(r.endsWith(".idl")){let s=new GP(e,r);t[s.shortname]=s}return t}async function MV(e){let t=await XP(e);for(let[n,r]of Object.entries(t))t[n]=await r.parse();return t}YP.exports={listAll:XP,parseAll:MV}});function IV(){return QP??=DV(),QP}async function DV(){let[e,t,n]=await Promise.all([t_.listAll(),n_.default.listAll(),r_.default.parseAll()]),r=new Set;for(let{elements:c}of Object.values(e))for(let u of c)if(!u.obsolete)r.add(u.name);let s=[...r].toSorted(),o=new Set;for(let c of t.properties)for(let u of c.styleDeclaration??[])o.add(u);let i=[...o].toSorted(),a=new Set;for(let c of Object.values(n))for(let u of c){if(u.type!=="interface"&&u.type!=="interface mixin")continue;if(!u.members)continue;for(let d of u.members)if(d.type==="attribute"&&d.name?.startsWith("on")&&d.idlType?.idlType==="EventHandler")a.add(d.name)}let l=[...a].toSorted();return{cssProps:i,eventHandlers:l,tagExamples:s}}function LV(e){let t={};for(let n of e)t[n]={description:`Event handler for the "${n.slice(2)}" event.`,oneOf:[{$ref:"#/$defs/RefObject"},{$ref:"#/$defs/ExpressionEntry"},{$ref:"#/$defs/FunctionDef"}]};return t}function FV(e){let t={...yl.properties};for(let n of e)t[n]={oneOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/RefObject"}]};return t}async function VV(){let{tagExamples:e,cssProps:t,eventHandlers:n}=await IV();return{$defs:{DefsMap:Pg,TypeDefEntry:_g,StateMap:jg,StateEntry:Eg,TypedStateDef:Kh,PureTypeDef:sg,FunctionDef:Xh,ClassDef:Og,ClassParameterDef:zu,ClassFieldDef:Ku,ClassConstructorDef:Gu,ClassMethodDef:Xu,FormatDef:Yu,ProjectBlockDef:Zu,ServerBlockDef:Qu,ConnectorBlockDef:ef,StudioHints:tf,ExternalClassDef:ng,ExpressionPointer:ig,ExpressionLiteral:ag,ExpressionOperand:lg,UnaryOperator:cg,BinaryOperator:ug,ConditionalOperator:fg,SwitchOperator:dg,CallOperator:pg,PureMethod:mg,AssignmentOperator:hg,NoArgMethod:gg,OneArgMethod:yg,SpliceMethod:xg,ReduceMethod:bg,MapFilterMethod:$g,ExpressionNode:Sg,ExpressionEntry:wg,Statement:Zh,StatementList:Qh,ElementDef:{...Uu,properties:{...Uu.properties,...LV(n)}},ChildrenValue:Fh,ArrayNamespace:Lh,SwitchDef:Bh,SwitchNode:Uh,StyleObject:{...yl,properties:FV(t)},AttributesObject:qh,PropsObject:Hh,RefObject:Jh,AnyRef:Th,InternalRef:kh,StateRef:Oh,ExternalRef:Ah,ExternalComponentRef:Mh,GlobalRef:Ch,ParentRef:Rh,MapRef:Nh,ElementPropertyValue:Wh,StringOrRef:gh,BoolOrRef:yh,NumberOrRef:xh,CemParameter:wh,CemEvent:vh,TagName:{...mh,examples:[...e,"my-counter","todo-app","user-card"]},TagExpression:fh,ElementTagName:dh,JsonSchemaType:Ph,HeadEntry:$h,ImageConfig:gl,PathsValue:{$id:Io,anyOf:[...bl,Mg],description:"Default $paths source union: the core shapes, plus a catch-all for source shapes contributed by extensions this schema cannot see. The project's generated document.schema.json replaces this with the exact set its extensions provide."}},$id:"https://jxsuite.com/schema/v1",$schema:"https://json-schema.org/draft/2020-12/schema",additionalProperties:{$ref:"#/$defs/ElementPropertyValue"},description:"Schema for Jx component files. A Jx document is a JSON object that declaratively describes a reactive web component: its structure (DOM tree), styling, type definitions ($defs), runtime state, and inline or external functions. Reactivity is powered by @vue/reactivity.",properties:{$defs:{$ref:"#/$defs/DefsMap",description:"Pure JSON Schema type definitions for this component. "+"All entries are reusable type schemas — no runtime artifacts are produced. "+"Referenced from state entries via $ref. Naming convention: PascalCase."},$elements:{description:"Custom element dependencies. Items are either $ref objects pointing to JX element definitions, or bare npm package name strings for web component libraries.",items:{oneOf:[{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"},{description:"npm package specifier (must declare customElements in package.json)",type:"string"}]},type:"array"},$head:{description:"Page-level <head> entries. Array of head entries for meta tags, link tags, script tags, etc. Merged with layout and site-level $head entries.",items:{$ref:"#/$defs/HeadEntry"},type:"array"},$id:{description:"Component identifier string. Used by tooling and the builder.",examples:["Counter","TodoApp","UserCard"],type:"string"},$dir:{description:"Base direction for this page's <html> element, overriding `defaults.dir`. Right-to-left content renders left-to-right without it.",enum:["ltr","rtl","auto"],type:"string"},$lang:{description:"Language tag for this page's <html> element, overriding `defaults.lang` "+"(site-architecture.md §8.4).",examples:["en","fr","ar-EG"],type:"string"},$translationKey:{description:"This page's identity across languages, overriding the one its path implies "+"(site-architecture.md §13.5). Two routes are translations when their keys match; "+"the default key is the path with the locale prefix removed, which is right whenever "+"the paths are parallel and wrong for a localized slug — /fr-ca/a-propos/ shares "+"nothing with /about/ until one of them says so.",examples:["about","blog/hello-world"],type:"string"},$layout:{description:"Layout reference for pages. String path to a layout JSON file, or false to opt out of the default layout.",examples:["./layouts/base.json"],oneOf:[{type:"string"},{const:!1,type:"boolean"}]},$script:{additionalProperties:!1,description:"This document's own modules, as TypeScript module text (spec.md §23.2). "+'A state entry names an export of one with `$src: "#client"` or `$src: "#server"`. `client` runs in the browser; `server` runs only on the server and is never sent to one.',properties:{client:{description:'The module the browser runs. A Function entry with `$src: "#client"` is one of its exports.',type:"string"},server:{description:'The module the server runs. A `timing: "server"` entry with `$src: "#server"` is one of its exports, called with `(args, env)`.',type:"string"}},type:"object"},$shadow:{description:"Render this component into a shadow root instead of the light DOM (spec.md §16.6). "+"Off unless set: a shadow root isolates the component's styles from the page and replaces the <slot> emulation with real slot distribution, so it changes how the "+"component composes. Overrides `defaults.shadow` in both directions — `false` opts "+"one component out of a project that opted in.",oneOf:[{enum:["open","closed"],type:"string"},{const:!1,type:"boolean"}]},$sitemap:{description:"Set false to exclude this page from sitemap.xml (site-architecture.md §8.4.1). "+"Every other page with a URL is included.",type:"boolean"},$media:{additionalProperties:{type:"string"},description:'Named media breakpoints following CSS @custom-media convention. Keys use the CSS custom property -- prefix. Pure color-scheme queries (e.g. "--dark": "(prefers-color-scheme: dark)") are dual-emitted so a data-color-scheme attribute on the root element forces the scheme '+"regardless of the OS preference (spec §9.5).",examples:[{"--dark":"(prefers-color-scheme: dark)","--md":"(min-width: 768px)","--sm":"(min-width: 640px)"}],type:"object"},$paths:{$ref:Io,description:"Dynamic route source for a page: expands one page per entry at build time. One of the core shapes (explicit `values`, a `$ref` data file, or a bare array of parameter objects) or a source shape contributed by an enabled extension, such as the parser's `contentType`."},$schema:{description:"URI identifying the Jx dialect version. Enables schema-aware IDE tooling.",examples:["https://jxsuite.com/schema/v1"],type:"string"},attributes:{$ref:"#/$defs/AttributesObject"},cases:{additionalProperties:{oneOf:[{$ref:"#/$defs/ElementDef"},{$ref:"#/$defs/ExternalComponentRef"}]},description:"Switch cases object. Maps case values to element definitions or external component refs. Used alongside $switch for dynamic component rendering.",type:"object"},children:{$ref:"#/$defs/ChildrenValue"},formAssociated:{description:"Makes the custom element a form-associated one (the Web Components formAssociated static): it attaches ElementInternals, a form's reset and a disabled fieldset reach its `value`, `checked` and `disabled` state, `required` with an empty value is reported as a missing value, and a label naming it reaches its control.",type:"boolean"},formValue:{description:"The value a form-associated custom element submits under its `name`, through ElementInternals.setFormValue: a `$ref`, a `${}` template or a literal. Omit it when a named native control inside the element already submits the value."},imports:{additionalProperties:{type:"string"},description:"Import map: $prototype names to .class.json file paths. Allows state entries to reference external classes by name without $src.",type:"object"},observedAttributes:{description:"HTML attributes the custom element watches for changes. Follows the Web Components observedAttributes convention.",items:{type:"string"},type:"array"},state:{$ref:"#/$defs/StateMap",description:"Runtime variables for this component. All entries are reactive by default. Entry shape is determined by value type: "+"scalar/array → reactive property, string with ${} → computed, "+"object with $prototype → function or data source, "+"object with type and default → typed reactive property."},style:{$ref:"#/$defs/StyleObject"},tagName:{$ref:"#/$defs/TagName"},title:{$ref:"#/$defs/StringOrRef",description:"Page title. Can be a static string or a template string with ${} expressions."}},title:"Jx Document",type:"object"}}function qV(){return{$defs:{ImageConfig:gl,StyleObject:s_},$id:"https://jxsuite.com/schema/project/v1",$schema:"https://json-schema.org/draft/2020-12/schema",description:"Schema for Jx project.json files. A project.json file is the root anchor file for a Jx project, declaring site metadata, default settings, global styles, extensions, and build configuration. Open by design: extension-contributed sections are opaque top-level keys; the generated per-project entry document (project.schema.json) closes the composition.",properties:nf.properties,title:"Jx Project",type:"object"}}function HV(){return{$defs:{ImageConfig:gl,JxFieldSchema:Tg,RelationshipRef:Jg,StyleObject:s_},$id:"https://jxsuite.com/schema/project/core/v2",$schema:"https://json-schema.org/draft/2020-12/schema",description:"Core fragment of the Jx project.json schema. Open by design: extension fragments contribute their own top-level sections and the generated per-project entry document "+"(project.schema.json) closes the composition. See specs/extensions.md §5.",properties:nf.properties,title:"Jx Project Core",type:"object"}}function WV(){return{$id:xl,$schema:"https://json-schema.org/draft/2020-12/schema",anyOf:[{$ref:"https://jxsuite.com/schema/project/core/v2#/$defs/JxFieldSchema"},{$ref:"https://jxsuite.com/schema/project/core/v2#/$defs/RelationshipRef"}],description:"Default field-schema union for section entry schemas: the core field shape plus relationship references. Per-project entry documents override this resource with the "+"effective union. See specs/extensions.md §5.3.",title:"Jx Project Field Union"}}function BV(){return{$id:Io,$schema:"https://json-schema.org/draft/2020-12/schema",anyOf:[...bl,Mg],description:"Default $paths-value union for documents: the core source shapes. Per-project entry documents override this resource with those members PLUS every extension-contributed paths shape.",title:"Jx Document Paths Union"}}function UV(){return{$id:"https://jxsuite.com/schema/extension-manifest/v1",$schema:"https://json-schema.org/draft/2020-12/schema",title:"Jx Extension Manifest",...Rg}}function yx(){return{$defs:{ClassConstructorDef:Gu,ClassFieldDef:Ku,ClassMethodDef:Xu,ClassParameterDef:zu,ConnectorBlockDef:ef,FormatDef:Yu,ProjectBlockDef:Zu,ServerBlockDef:Qu,StudioHints:tf},$id:"https://jxsuite.com/schema/class/v1",$schema:"https://json-schema.org/draft/2020-12/schema",additionalProperties:!1,description:"Schema for Jx .class.json files. A class definition describes a schema-defined class with fields, constructor, methods, and type parameters. Optionally points to a JS module via $implementation for hybrid execution.",properties:{$defs:{description:"Class members: parameters, returnTypes, fields, constructor, methods.",properties:{constructor:{$ref:"#/$defs/ClassConstructorDef"},fields:{additionalProperties:{$ref:"#/$defs/ClassFieldDef"},description:"Class fields with role, access, scope, and type information.",type:"object"},methods:{additionalProperties:{$ref:"#/$defs/ClassMethodDef"},description:"Class methods and accessors.",type:"object"},parameters:{additionalProperties:{$ref:"#/$defs/ClassParameterDef"},description:"Reusable typed parameter schemas, keyed by name.",type:"object"},returnTypes:{additionalProperties:{type:"object"},description:"Output type schemas, keyed by name.",type:"object"}},type:"object"},$id:{type:"string"},$implementation:{description:"Relative path to a JS module containing the actual class implementation.",examples:["./md.js","./lib/calculator.js"],type:"string"},$prototype:{const:"Class",description:'Must be "Class" for class definition files.',type:"string"},$schema:{type:"string"},$studio:{$ref:"#/$defs/StudioHints"},connector:{$ref:"#/$defs/ConnectorBlockDef"},description:{type:"string"},extends:{description:"Base class — string name or $ref to another .class.json.",oneOf:[{type:"string"},{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"}]},format:{$ref:"#/$defs/FormatDef"},project:{$ref:"#/$defs/ProjectBlockDef"},server:{$ref:"#/$defs/ServerBlockDef"},title:{description:"PascalCase class name, used as the export name.",examples:["MarkdownFile","DataSource","Calculator"],type:"string"}},required:["$prototype","title"],title:"Jx Class Definition",type:"object"}}async function zV(e){let{mkdirSync:t,writeFileSync:n}=await import("node:fs"),{resolve:r,dirname:s}=await import("node:path"),o=s(r(e,"..")),i=await VV(),a=qV(),l=yx(),c=HV(),u=UV(),d=WV(),p=BV(),m=JSON.stringify(i,null,2),y=JSON.stringify(a,null,2),S=JSON.stringify(l,null,2),g=JSON.stringify(c,null,2),x=JSON.stringify(u,null,2),P=JSON.stringify(d,null,2),w=JSON.stringify(p,null,2),[E]=process.argv.slice(2);if(E)n(E,m,"utf8"),console.error(`Jx component schema written to ${E}`);else{n(r(o,"schema.json"),m,"utf8"),n(r(o,"project-schema.json"),y,"utf8"),n(r(o,"class-schema.json"),S,"utf8"),t(r(o,"schemas"),{recursive:!0}),n(r(o,"schemas","project.core.schema.json"),g,"utf8"),n(r(o,"schemas","project.fields.schema.json"),P,"utf8"),n(r(o,"schemas","document.paths.schema.json"),w,"utf8"),n(r(o,"extension-manifest.schema.json"),x,"utf8");let j=Bun.spawnSync(["bunx","oxfmt",r(o,"schemas","project.core.schema.json"),r(o,"schemas","project.fields.schema.json"),r(o,"schemas","document.paths.schema.json")],{cwd:o});if(j.exitCode!==0){let A=j.stderr.toString()||j.stdout.toString()||`exit ${j.exitCode}${j.signalCode?`, signal ${j.signalCode}`:""}`;console.error(`Warning: skipped oxfmt reformat of generated schemas (${A})`)}console.error("Generated:"),console.error(" schema.json (component)"),console.error(" project-schema.json"),console.error(" class-schema.json"),console.error(" schemas/project.core.schema.json"),console.error(" schemas/project.fields.schema.json"),console.error(" schemas/document.paths.schema.json"),console.error(" extension-manifest.schema.json")}}var t_,n_,r_,QP=null,s_,e_,Yne;var o_=J(()=>{ph();hh();bh();Sh();Eh();_h();Ih();Dh();Vh();zh();Gh();Yh();eg();rg();og();vg();kg();Ag();Ng();$l();jh();Cg();t_=Sr(VP(),1),n_=Sr(BP(),1),r_=Sr(ZP(),1);s_={...yl,additionalProperties:{anyOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/StyleObject"}]}};[,e_]=process.argv,Yne=e_?.endsWith("schema.ts")?zV(e_):void 0});var sc=W(function(l_){Object.defineProperty(l_,"__esModule",{value:!0});l_.regexpCode=l_.getEsmExportName=l_.getProperty=l_.safeStringify=l_.stringify=l_.strConcat=l_.addCodeArg=l_.str=l_._=l_.nil=l_._Code=l_.Name=l_.IDENTIFIER=l_._CodeOrName=void 0;class ld{}l_._CodeOrName=ld;l_.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class na extends ld{constructor(e){super();if(!l_.IDENTIFIER.test(e))throw Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}l_.Name=na;class yr extends ld{constructor(e){super();this._items=typeof e==="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((t,n)=>`${t}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((t,n)=>{if(n instanceof na)t[n.str]=(t[n.str]||0)+1;return t},{})}}l_._Code=yr;l_.nil=new yr("");function i_(e,...t){let n=[e[0]],r=0;while(r<t.length)bx(n,t[r]),n.push(e[++r]);return new yr(n)}l_._=i_;var xx=new yr("+");function a_(e,...t){let n=[rc(e[0])],r=0;while(r<t.length)n.push(xx),bx(n,t[r]),n.push(xx,rc(e[++r]));return KV(n),new yr(n)}l_.str=a_;function bx(e,t){if(t instanceof yr)e.push(...t._items);else if(t instanceof na)e.push(t);else e.push(YV(t))}l_.addCodeArg=bx;function KV(e){let t=1;while(t<e.length-1){if(e[t]===xx){let n=GV(e[t-1],e[t+1]);if(n!==void 0){e.splice(t-1,3,n);continue}e[t++]="+"}t++}}function GV(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string"){if(t instanceof na||e[e.length-1]!=='"')return;if(typeof t!="string")return`${e.slice(0,-1)}${t}"`;if(t[0]==='"')return e.slice(0,-1)+t.slice(1);return}if(typeof t=="string"&&t[0]==='"'&&!(e instanceof na))return`"${e}${t.slice(1)}`;return}function XV(e,t){return t.emptyStr()?e:e.emptyStr()?t:a_`${e}${t}`}l_.strConcat=XV;function YV(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:rc(Array.isArray(e)?e.join(","):e)}function ZV(e){return new yr(rc(e))}l_.stringify=ZV;function rc(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}l_.safeStringify=rc;function QV(e){return typeof e=="string"&&l_.IDENTIFIER.test(e)?new yr(`.${e}`):i_`[${e}]`}l_.getProperty=QV;function eq(e){if(typeof e=="string"&&l_.IDENTIFIER.test(e))return new yr(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}l_.getEsmExportName=eq;function tq(e){return new yr(e.toString())}l_.regexpCode=tq});var vx=W(function(d_){Object.defineProperty(d_,"__esModule",{value:!0});d_.ValueScope=d_.ValueScopeName=d_.Scope=d_.varKinds=d_.UsedValueState=void 0;var ze=sc();class u_ extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var ud;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(ud||(d_.UsedValueState=ud={}));d_.varKinds={const:new ze.Name("const"),let:new ze.Name("let"),var:new ze.Name("var")};class Sx{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof ze.Name?e:this.name(e)}name(e){return new ze.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,n;if(((n=(t=this._parent)===null||t===void 0?void 0:t._prefixes)===null||n===void 0?void 0:n.has(e))||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}d_.Scope=Sx;class wx extends ze.Name{constructor(e,t){super(t);this.prefix=e}setValue(e,{property:t,itemIndex:n}){this.value=e,this.scopePath=ze._`.${new ze.Name(t)}[${n}]`}}d_.ValueScopeName=wx;var mq=ze._`\n`;class f_ extends Sx{constructor(e){super(e);this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?mq:ze.nil}}get(){return this._scope}name(e){return new wx(e,this._newName(e))}value(e,t){var n;if(t.ref===void 0)throw Error("CodeGen: ref must be passed in value");let r=this.toName(e),{prefix:s}=r,o=(n=t.key)!==null&&n!==void 0?n:t.ref,i=this._values[s];if(i){let c=i.get(o);if(c)return c}else i=this._values[s]=new Map;i.set(o,r);let a=this._scope[s]||(this._scope[s]=[]),l=a.length;return a[l]=t.ref,r.setValue(t,{property:s,itemIndex:l}),r}getValue(e,t){let n=this._values[e];if(!n)return;return n.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,(n)=>{if(n.scopePath===void 0)throw Error(`CodeGen: name "${n}" has no value`);return ze._`${e}${n.scopePath}`})}scopeCode(e=this._values,t,n){return this._reduceValues(e,(r)=>{if(r.value===void 0)throw Error(`CodeGen: name "${r}" has no value`);return r.value.code},t,n)}_reduceValues(e,t,n={},r){let s=ze.nil;for(let o in e){let i=e[o];if(!i)continue;let a=n[o]=n[o]||new Map;i.forEach((l)=>{if(a.has(l))return;a.set(l,ud.Started);let c=t(l);if(c){let u=this.opts.es5?d_.varKinds.var:d_.varKinds.const;s=ze._`${s}${u} ${l} = ${c};${this.opts._n}`}else if(c=r===null||r===void 0?void 0:r(l))s=ze._`${s}${c}${this.opts._n}`;else throw new u_(l);a.set(l,ud.Completed)})}return s}}d_.ValueScope=f_});var $e=W(function(bn){Object.defineProperty(bn,"__esModule",{value:!0});bn.or=bn.and=bn.not=bn.CodeGen=bn.operators=bn.varKinds=bn.ValueScopeName=bn.ValueScope=bn.Scope=bn.Name=bn.regexpCode=bn.stringify=bn.getProperty=bn.nil=bn.strConcat=bn.str=bn._=void 0;var Z=sc(),mt=vx(),qs=sc();Object.defineProperty(bn,"_",{enumerable:!0,get:function(){return qs._}});Object.defineProperty(bn,"str",{enumerable:!0,get:function(){return qs.str}});Object.defineProperty(bn,"strConcat",{enumerable:!0,get:function(){return qs.strConcat}});Object.defineProperty(bn,"nil",{enumerable:!0,get:function(){return qs.nil}});Object.defineProperty(bn,"getProperty",{enumerable:!0,get:function(){return qs.getProperty}});Object.defineProperty(bn,"stringify",{enumerable:!0,get:function(){return qs.stringify}});Object.defineProperty(bn,"regexpCode",{enumerable:!0,get:function(){return qs.regexpCode}});Object.defineProperty(bn,"Name",{enumerable:!0,get:function(){return qs.Name}});var gd=vx();Object.defineProperty(bn,"Scope",{enumerable:!0,get:function(){return gd.Scope}});Object.defineProperty(bn,"ValueScope",{enumerable:!0,get:function(){return gd.ValueScope}});Object.defineProperty(bn,"ValueScopeName",{enumerable:!0,get:function(){return gd.ValueScopeName}});Object.defineProperty(bn,"varKinds",{enumerable:!0,get:function(){return gd.varKinds}});bn.operators={GT:new Z._Code(">"),GTE:new Z._Code(">="),LT:new Z._Code("<"),LTE:new Z._Code("<="),EQ:new Z._Code("==="),NEQ:new Z._Code("!=="),NOT:new Z._Code("!"),OR:new Z._Code("||"),AND:new Z._Code("&&"),ADD:new Z._Code("+")};class Hs{optimizeNodes(){return this}optimizeNames(e,t){return this}}class m_ extends Hs{constructor(e,t,n){super();this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){let n=e?mt.varKinds.var:this.varKind,r=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${r};`+t}optimizeNames(e,t){if(!e[this.name.str])return;if(this.rhs)this.rhs=sa(this.rhs,e,t);return this}get names(){return this.rhs instanceof Z._CodeOrName?this.rhs.names:{}}}class Px extends Hs{constructor(e,t,n){super();this.lhs=e,this.rhs=t,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(this.lhs instanceof Z.Name&&!e[this.lhs.str]&&!this.sideEffects)return;return this.rhs=sa(this.rhs,e,t),this}get names(){let e=this.lhs instanceof Z.Name?{}:{...this.lhs.names};return hd(e,this.rhs)}}class h_ extends Px{constructor(e,t,n,r){super(e,n,r);this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class g_ extends Hs{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class y_ extends Hs{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class x_ extends Hs{constructor(e){super();this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class b_ extends Hs{constructor(e){super();this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=sa(this.code,e,t),this}get names(){return this.code instanceof Z._CodeOrName?this.code.names:{}}}class yd extends Hs{constructor(e=[]){super();this.nodes=e}render(e){return this.nodes.reduce((t,n)=>t+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,t=e.length;while(t--){let n=e[t].optimizeNodes();if(Array.isArray(n))e.splice(t,1,...n);else if(n)e[t]=n;else e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:n}=this,r=n.length;while(r--){let s=n[r];if(s.optimizeNames(e,t))continue;xq(e,s.names),n.splice(r,1)}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>Wo(e,t.names),{})}}class Ws extends yd{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class $_ extends yd{}class oc extends Ws{}oc.kind="else";class ys extends Ws{constructor(e,t){super(t);this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);if(this.else)t+="else "+this.else.render(e);return t}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let t=this.else;if(t){let n=t.optimizeNodes();t=this.else=Array.isArray(n)?new oc(n):n}if(t){if(e===!1)return t instanceof ys?t:t.nodes;if(this.nodes.length)return this;return new ys(j_(e),t instanceof ys?[t]:t.nodes)}if(e===!1||!this.nodes.length)return;return this}optimizeNames(e,t){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,t),!(super.optimizeNames(e,t)||this.else))return;return this.condition=sa(this.condition,e,t),this}get names(){let e=super.names;if(hd(e,this.condition),this.else)Wo(e,this.else.names);return e}}ys.kind="if";class ra extends Ws{}ra.kind="for";class S_ extends ra{constructor(e){super();this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;return this.iteration=sa(this.iteration,e,t),this}get names(){return Wo(super.names,this.iteration.names)}}class w_ extends ra{constructor(e,t,n,r){super();this.varKind=e,this.name=t,this.from=n,this.to=r}render(e){let t=e.es5?mt.varKinds.var:this.varKind,{name:n,from:r,to:s}=this;return`for(${t} ${n}=${r}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){let e=hd(super.names,this.from);return hd(e,this.to)}}class Ex extends ra{constructor(e,t,n,r){super();this.loop=e,this.varKind=t,this.name=n,this.iterable=r}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;return this.iterable=sa(this.iterable,e,t),this}get names(){return Wo(super.names,this.iterable.names)}}class fd extends Ws{constructor(e,t,n){super();this.name=e,this.args=t,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}fd.kind="func";class dd extends yd{render(e){return"return "+super.render(e)}}dd.kind="return";class v_ extends Ws{render(e){let t="try"+super.render(e);if(this.catch)t+=this.catch.render(e);if(this.finally)t+=this.finally.render(e);return t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(t=this.finally)===null||t===void 0||t.optimizeNodes(),this}optimizeNames(e,t){var n,r;return super.optimizeNames(e,t),(n=this.catch)===null||n===void 0||n.optimizeNames(e,t),(r=this.finally)===null||r===void 0||r.optimizeNames(e,t),this}get names(){let e=super.names;if(this.catch)Wo(e,this.catch.names);if(this.finally)Wo(e,this.finally.names);return e}}class pd extends Ws{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}pd.kind="catch";class md extends Ws{render(e){return"finally"+super.render(e)}}md.kind="finally";class E_{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
|
|
630
|
+
`:""},this._extScope=e,this._scope=new mt.Scope({parent:e}),this._nodes=[new $_]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let n=this._extScope.value(e,t);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,n,r){let s=this._scope.toName(t);if(n!==void 0&&r)this._constants[s.str]=n;return this._leafNode(new m_(e,s,n)),s}const(e,t,n){return this._def(mt.varKinds.const,e,t,n)}let(e,t,n){return this._def(mt.varKinds.let,e,t,n)}var(e,t,n){return this._def(mt.varKinds.var,e,t,n)}assign(e,t,n){return this._leafNode(new Px(e,t,n))}add(e,t){return this._leafNode(new h_(e,bn.operators.ADD,t))}code(e){if(typeof e=="function")e();else if(e!==Z.nil)this._leafNode(new b_(e));return this}object(...e){let t=["{"];for(let[n,r]of e){if(t.length>1)t.push(",");if(t.push(n),n!==r||this.opts.es5)t.push(":"),Z.addCodeArg(t,r)}return t.push("}"),new Z._Code(t)}if(e,t,n){if(this._blockNode(new ys(e)),t&&n)this.code(t).else().code(n).endIf();else if(t)this.code(t).endIf();else if(n)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new ys(e))}else(){return this._elseNode(new oc)}endIf(){return this._endBlockNode(ys,oc)}_for(e,t){if(this._blockNode(e),t)this.code(t).endFor();return this}for(e,t){return this._for(new S_(e),t)}forRange(e,t,n,r,s=this.opts.es5?mt.varKinds.var:mt.varKinds.let){let o=this._scope.toName(e);return this._for(new w_(s,o,t,n),()=>r(o))}forOf(e,t,n,r=mt.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let o=t instanceof Z.Name?t:this.var("_arr",t);return this.forRange("_i",0,Z._`${o}.length`,(i)=>{this.var(s,Z._`${o}[${i}]`),n(s)})}return this._for(new Ex("of",r,s,t),()=>n(s))}forIn(e,t,n,r=this.opts.es5?mt.varKinds.var:mt.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,Z._`Object.keys(${t})`,n);let s=this._scope.toName(e);return this._for(new Ex("in",r,s,t),()=>n(s))}endFor(){return this._endBlockNode(ra)}label(e){return this._leafNode(new g_(e))}break(e){return this._leafNode(new y_(e))}return(e){let t=new dd;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(dd)}try(e,t,n){if(!t&&!n)throw Error('CodeGen: "try" without "catch" and "finally"');let r=new v_;if(this._blockNode(r),this.code(e),t){let s=this.name("e");this._currNode=r.catch=new pd(s),t(s)}if(n)this._currNode=r.finally=new md,this.code(n);return this._endBlockNode(pd,md)}throw(e){return this._leafNode(new x_(e))}block(e,t){if(this._blockStarts.push(this._nodes.length),e)this.code(e).endBlock(t);return this}endBlock(e){let t=this._blockStarts.pop();if(t===void 0)throw Error("CodeGen: not in self-balancing block");let n=this._nodes.length-t;if(n<0||e!==void 0&&n!==e)throw Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=Z.nil,n,r){if(this._blockNode(new fd(e,t,n)),r)this.code(r).endFunc();return this}endFunc(){return this._endBlockNode(fd)}optimize(e=1){while(e-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let n=this._currNode;if(n instanceof e||t&&n instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof ys))throw Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}}bn.CodeGen=E_;function Wo(e,t){for(let n in t)e[n]=(e[n]||0)+(t[n]||0);return e}function hd(e,t){return t instanceof Z._CodeOrName?Wo(e,t.names):e}function sa(e,t,n){if(e instanceof Z.Name)return r(e);if(!s(e))return e;return new Z._Code(e._items.reduce((o,i)=>{if(i instanceof Z.Name)i=r(i);if(i instanceof Z._Code)o.push(...i._items);else o.push(i);return o},[]));function r(o){let i=n[o.str];if(i===void 0||t[o.str]!==1)return o;return delete t[o.str],i}function s(o){return o instanceof Z._Code&&o._items.some((i)=>i instanceof Z.Name&&t[i.str]===1&&n[i.str]!==void 0)}}function xq(e,t){for(let n in t)e[n]=(e[n]||0)-(t[n]||0)}function j_(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:Z._`!${jx(e)}`}bn.not=j_;var bq=P_(bn.operators.AND);function $q(...e){return e.reduce(bq)}bn.and=$q;var Sq=P_(bn.operators.OR);function wq(...e){return e.reduce(Sq)}bn.or=wq;function P_(e){return(t,n)=>t===Z.nil?n:n===Z.nil?t:Z._`${jx(t)} ${e} ${jx(n)}`}function jx(e){return e instanceof Z.Name?e:Z._`(${e})`}});var Oe=W(function(M_){Object.defineProperty(M_,"__esModule",{value:!0});M_.checkStrictMode=M_.getErrorPath=M_.Type=M_.useFunc=M_.setEvaluated=M_.evaluatedPropsToName=M_.mergeEvaluated=M_.eachItem=M_.unescapeJsonPointer=M_.escapeJsonPointer=M_.escapeFragment=M_.unescapeFragment=M_.schemaRefOrVal=M_.schemaHasRulesButRef=M_.schemaHasRules=M_.checkUnknownRules=M_.alwaysValidSchema=M_.toHash=void 0;var de=$e(),A_=sc();function Pq(e){let t={};for(let n of e)t[n]=!0;return t}M_.toHash=Pq;function _q(e,t){if(typeof t=="boolean")return t;if(Object.keys(t).length===0)return!0;return C_(e,t),!R_(t,e.self.RULES.all)}M_.alwaysValidSchema=_q;function C_(e,t=e.schema){let{opts:n,self:r}=e;if(!n.strictSchema)return;if(typeof t==="boolean")return;let s=r.RULES.keywords;for(let o in t)if(!s[o])J_(e,`unknown keyword: "${o}"`)}M_.checkUnknownRules=C_;function R_(e,t){if(typeof e=="boolean")return!e;for(let n in e)if(t[n])return!0;return!1}M_.schemaHasRules=R_;function kq(e,t){if(typeof e=="boolean")return!e;for(let n in e)if(n!=="$ref"&&t.all[n])return!0;return!1}M_.schemaHasRulesButRef=kq;function Oq({topSchemaRef:e,schemaPath:t},n,r,s){if(!s){if(typeof n=="number"||typeof n=="boolean")return n;if(typeof n=="string")return de._`${n}`}return de._`${e}${t}${de.getProperty(r)}`}M_.schemaRefOrVal=Oq;function Aq(e){return N_(decodeURIComponent(e))}M_.unescapeFragment=Aq;function Cq(e){return encodeURIComponent(kx(e))}M_.escapeFragment=Cq;function kx(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}M_.escapeJsonPointer=kx;function N_(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}M_.unescapeJsonPointer=N_;function Rq(e,t){if(Array.isArray(e))for(let n of e)t(n);else t(e)}M_.eachItem=Rq;function k_({mergeNames:e,mergeToName:t,mergeValues:n,resultToName:r}){return(s,o,i,a)=>{let l=i===void 0?o:i instanceof de.Name?(o instanceof de.Name?e(s,o,i):t(s,o,i),i):o instanceof de.Name?(t(s,i,o),o):n(o,i);return a===de.Name&&!(l instanceof de.Name)?r(s,l):l}}M_.mergeEvaluated={props:k_({mergeNames:(e,t,n)=>e.if(de._`${n} !== true && ${t} !== undefined`,()=>{e.if(de._`${t} === true`,()=>e.assign(n,!0),()=>e.assign(n,de._`${n} || {}`).code(de._`Object.assign(${n}, ${t})`))}),mergeToName:(e,t,n)=>e.if(de._`${n} !== true`,()=>{if(t===!0)e.assign(n,!0);else e.assign(n,de._`${n} || {}`),Ox(e,n,t)}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:T_}),items:k_({mergeNames:(e,t,n)=>e.if(de._`${n} !== true && ${t} !== undefined`,()=>e.assign(n,de._`${t} === true ? true : ${n} > ${t} ? ${n} : ${t}`)),mergeToName:(e,t,n)=>e.if(de._`${n} !== true`,()=>e.assign(n,t===!0?!0:de._`${n} > ${t} ? ${n} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function T_(e,t){if(t===!0)return e.var("props",!0);let n=e.var("props",de._`{}`);if(t!==void 0)Ox(e,n,t);return n}M_.evaluatedPropsToName=T_;function Ox(e,t,n){Object.keys(n).forEach((r)=>e.assign(de._`${t}${de.getProperty(r)}`,!0))}M_.setEvaluated=Ox;var O_={};function Nq(e,t){return e.scopeValue("func",{ref:t,code:O_[t.code]||(O_[t.code]=new A_._Code(t.code))})}M_.useFunc=Nq;var _x;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(_x||(M_.Type=_x={}));function Tq(e,t,n){if(e instanceof de.Name){let r=t===_x.Num;return n?r?de._`"[" + ${e} + "]"`:de._`"['" + ${e} + "']"`:r?de._`"/" + ${e}`:de._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return n?de.getProperty(e).toString():"/"+kx(e)}M_.getErrorPath=Tq;function J_(e,t,n=e.opts.strictSchema){if(!n)return;if(t=`strict mode: ${t}`,n===!0)throw Error(t);e.self.logger.warn(t)}M_.checkStrictMode=J_});var Kn=W(function(D_){Object.defineProperty(D_,"__esModule",{value:!0});var Ve=$e(),Zq={data:new Ve.Name("data"),valCxt:new Ve.Name("valCxt"),instancePath:new Ve.Name("instancePath"),parentData:new Ve.Name("parentData"),parentDataProperty:new Ve.Name("parentDataProperty"),rootData:new Ve.Name("rootData"),dynamicAnchors:new Ve.Name("dynamicAnchors"),vErrors:new Ve.Name("vErrors"),errors:new Ve.Name("errors"),this:new Ve.Name("this"),self:new Ve.Name("self"),scope:new Ve.Name("scope"),json:new Ve.Name("json"),jsonPos:new Ve.Name("jsonPos"),jsonLen:new Ve.Name("jsonLen"),jsonPart:new Ve.Name("jsonPart")};D_.default=Zq});var ic=W(function(q_){Object.defineProperty(q_,"__esModule",{value:!0});q_.extendErrors=q_.resetErrorsCount=q_.reportExtraError=q_.reportError=q_.keyword$DataError=q_.keywordError=void 0;var ee=$e(),Bs=Oe(),an=Kn();q_.keywordError={message:({keyword:e})=>ee.str`must pass "${e}" keyword validation`};q_.keyword$DataError={message:({keyword:e,schemaType:t})=>t?ee.str`"${e}" keyword must be ${t} ($data)`:ee.str`"${e}" keyword is invalid ($data)`};function eH(e,t=q_.keywordError,n,r){let{it:s}=e,{gen:o,compositeRule:i,allErrors:a}=s,l=V_(e,t,n);if(r!==null&&r!==void 0?r:i||a)L_(o,l);else F_(s,ee._`[${l}]`)}q_.reportError=eH;function tH(e,t=q_.keywordError,n){let{it:r}=e,{gen:s,compositeRule:o,allErrors:i}=r,a=V_(e,t,n);if(L_(s,a),!(o||i))F_(r,an.default.vErrors)}q_.reportExtraError=tH;function nH(e,t){e.assign(an.default.errors,t),e.if(ee._`${an.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(ee._`${an.default.vErrors}.length`,t),()=>e.assign(an.default.vErrors,null)))}q_.resetErrorsCount=nH;function rH({gen:e,keyword:t,schemaValue:n,data:r,errsCount:s,it:o}){if(s===void 0)throw Error("ajv implementation error");let i=e.name("err");e.forRange("i",s,an.default.errors,(a)=>{if(e.const(i,ee._`${an.default.vErrors}[${a}]`),e.if(ee._`${i}.instancePath === undefined`,()=>e.assign(ee._`${i}.instancePath`,ee.strConcat(an.default.instancePath,o.errorPath))),e.assign(ee._`${i}.schemaPath`,ee.str`${o.errSchemaPath}/${t}`),o.opts.verbose)e.assign(ee._`${i}.schema`,n),e.assign(ee._`${i}.data`,r)})}q_.extendErrors=rH;function L_(e,t){let n=e.const("err",t);e.if(ee._`${an.default.vErrors} === null`,()=>e.assign(an.default.vErrors,ee._`[${n}]`),ee._`${an.default.vErrors}.push(${n})`),e.code(ee._`${an.default.errors}++`)}function F_(e,t){let{gen:n,validateName:r,schemaEnv:s}=e;if(s.$async)n.throw(ee._`new ${e.ValidationError}(${t})`);else n.assign(ee._`${r}.errors`,t),n.return(!1)}var Bo={keyword:new ee.Name("keyword"),schemaPath:new ee.Name("schemaPath"),params:new ee.Name("params"),propertyName:new ee.Name("propertyName"),message:new ee.Name("message"),schema:new ee.Name("schema"),parentSchema:new ee.Name("parentSchema")};function V_(e,t,n){let{createErrors:r}=e.it;if(r===!1)return ee._`{}`;return sH(e,t,n)}function sH(e,t,n={}){let{gen:r,it:s}=e,o=[oH(s,n),iH(e,n)];return aH(e,t,o),r.object(...o)}function oH({errorPath:e},{instancePath:t}){let n=t?ee.str`${e}${Bs.getErrorPath(t,Bs.Type.Str)}`:e;return[an.default.instancePath,ee.strConcat(an.default.instancePath,n)]}function iH({keyword:e,it:{errSchemaPath:t}},{schemaPath:n,parentSchema:r}){let s=r?t:ee.str`${t}/${e}`;if(n)s=ee.str`${s}${Bs.getErrorPath(n,Bs.Type.Str)}`;return[Bo.schemaPath,s]}function aH(e,{params:t,message:n},r){let{keyword:s,data:o,schemaValue:i,it:a}=e,{opts:l,propertyName:c,topSchemaRef:u,schemaPath:d}=a;if(r.push([Bo.keyword,s],[Bo.params,typeof t=="function"?t(e):t||ee._`{}`]),l.messages)r.push([Bo.message,typeof n=="function"?n(e):n]);if(l.verbose)r.push([Bo.schema,i],[Bo.parentSchema,ee._`${u}${d}`],[an.default.data,o]);if(c)r.push([Bo.propertyName,c])}});var G_=W(function(z_){Object.defineProperty(z_,"__esModule",{value:!0});z_.boolOrEmptySchema=z_.topBoolOrEmptySchema=void 0;var W_=ic(),B_=$e(),dH=Kn(),pH={message:"boolean schema is false"};function mH(e){let{gen:t,schema:n,validateName:r}=e;if(n===!1)U_(e,!1);else if(typeof n=="object"&&n.$async===!0)t.return(dH.default.data);else t.assign(B_._`${r}.errors`,null),t.return(!0)}z_.topBoolOrEmptySchema=mH;function hH(e,t){let{gen:n,schema:r}=e;if(r===!1)n.var(t,!1),U_(e);else n.var(t,!0)}z_.boolOrEmptySchema=hH;function U_(e,t){let{gen:n,data:r}=e;W_.reportError({gen:n,keyword:"false schema",data:r,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},pH,void 0,t)}});var Cx=W(function(X_){Object.defineProperty(X_,"__esModule",{value:!0});X_.getRules=X_.isJSONType=void 0;var yH=["string","number","integer","boolean","null","object","array"],xH=new Set(yH);function bH(e){return typeof e=="string"&&xH.has(e)}X_.isJSONType=bH;function $H(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}X_.getRules=$H});var Rx=W(function(ek){Object.defineProperty(ek,"__esModule",{value:!0});ek.shouldUseRule=ek.shouldUseGroup=ek.schemaHasRulesForType=void 0;function wH({schema:e,self:t},n){let r=t.RULES.types[n];return r&&r!==!0&&Z_(e,r)}ek.schemaHasRulesForType=wH;function Z_(e,t){return t.rules.some((n)=>Q_(e,n))}ek.shouldUseGroup=Z_;function Q_(e,t){var n;return e[t.keyword]!==void 0||((n=t.definition.implements)===null||n===void 0?void 0:n.some((r)=>e[r]!==void 0))}ek.shouldUseRule=Q_});var ac=W(function(ak){Object.defineProperty(ak,"__esModule",{value:!0});ak.reportTypeError=ak.checkDataTypes=ak.checkDataType=ak.coerceAndCheckDataType=ak.getJSONTypes=ak.getSchemaTypes=ak.DataType=void 0;var nk=Cx(),rk=Rx(),sk=ic(),Y=$e(),bd=Oe(),oa;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(oa||(ak.DataType=oa={}));function jH(e){let t=ok(e.type);if(t.includes("null")){if(e.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(e.nullable===!0)t.push("null")}return t}ak.getSchemaTypes=jH;function ok(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(nk.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}ak.getJSONTypes=ok;function PH(e,t){let{gen:n,data:r,opts:s}=e,o=_H(t,s.coerceTypes),i=t.length>0&&!(o.length===0&&t.length===1&&rk.schemaHasRulesForType(e,t[0]));if(i){let a=Tx(t,r,s.strictNumbers,oa.Wrong);n.if(a,()=>{if(o.length)kH(e,t,o);else Jx(e)})}return i}ak.coerceAndCheckDataType=PH;var ik=new Set(["string","number","integer","boolean","null"]);function _H(e,t){return t?e.filter((n)=>ik.has(n)||t==="array"&&n==="array"):[]}function kH(e,t,n){let{gen:r,data:s,opts:o}=e,i=r.let("dataType",Y._`typeof ${s}`),a=r.let("coerced",Y._`undefined`);if(o.coerceTypes==="array")r.if(Y._`${i} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,()=>r.assign(s,Y._`${s}[0]`).assign(i,Y._`typeof ${s}`).if(Tx(t,s,o.strictNumbers),()=>r.assign(a,s)));r.if(Y._`${a} !== undefined`);for(let c of n)if(ik.has(c)||c==="array"&&o.coerceTypes==="array")l(c);r.else(),Jx(e),r.endIf(),r.if(Y._`${a} !== undefined`,()=>{r.assign(s,a),OH(e,a)});function l(c){switch(c){case"string":r.elseIf(Y._`${i} == "number" || ${i} == "boolean"`).assign(a,Y._`"" + ${s}`).elseIf(Y._`${s} === null`).assign(a,Y._`""`);return;case"number":r.elseIf(Y._`${i} == "boolean" || ${s} === null
|
|
631
|
+
|| (${i} == "string" && ${s} && ${s} == +${s})`).assign(a,Y._`+${s}`);return;case"integer":r.elseIf(Y._`${i} === "boolean" || ${s} === null
|
|
632
|
+
|| (${i} === "string" && ${s} && ${s} == +${s} && !(${s} % 1))`).assign(a,Y._`+${s}`);return;case"boolean":r.elseIf(Y._`${s} === "false" || ${s} === 0 || ${s} === null`).assign(a,!1).elseIf(Y._`${s} === "true" || ${s} === 1`).assign(a,!0);return;case"null":r.elseIf(Y._`${s} === "" || ${s} === 0 || ${s} === false`),r.assign(a,null);return;case"array":r.elseIf(Y._`${i} === "string" || ${i} === "number"
|
|
633
|
+
|| ${i} === "boolean" || ${s} === null`).assign(a,Y._`[${s}]`)}}}function OH({gen:e,parentData:t,parentDataProperty:n},r){e.if(Y._`${t} !== undefined`,()=>e.assign(Y._`${t}[${n}]`,r))}function Nx(e,t,n,r=oa.Correct){let s=r===oa.Correct?Y.operators.EQ:Y.operators.NEQ,o;switch(e){case"null":return Y._`${t} ${s} null`;case"array":o=Y._`Array.isArray(${t})`;break;case"object":o=Y._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":o=i(Y._`!(${t} % 1) && !isNaN(${t})`);break;case"number":o=i();break;default:return Y._`typeof ${t} ${s} ${e}`}return r===oa.Correct?o:Y.not(o);function i(a=Y.nil){return Y.and(Y._`typeof ${t} == "number"`,a,n?Y._`isFinite(${t})`:Y.nil)}}ak.checkDataType=Nx;function Tx(e,t,n,r){if(e.length===1)return Nx(e[0],t,n,r);let s,o=bd.toHash(e);if(o.array&&o.object){let i=Y._`typeof ${t} != "object"`;s=o.null?i:Y._`!${t} || ${i}`,delete o.null,delete o.array,delete o.object}else s=Y.nil;if(o.number)delete o.integer;for(let i in o)s=Y.and(s,Nx(i,t,n,r));return s}ak.checkDataTypes=Tx;var AH={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?Y._`{type: ${e}}`:Y._`{type: ${t}}`};function Jx(e){let t=CH(e);sk.reportError(t,AH)}ak.reportTypeError=Jx;function CH(e){let{gen:t,data:n,schema:r}=e,s=bd.schemaRefOrVal(e,r,"type");return{gen:t,keyword:"type",data:n,schema:r.type,schemaCode:s,schemaValue:s,parentSchema:r,params:{},it:e}}});var pk=W(function(fk){Object.defineProperty(fk,"__esModule",{value:!0});fk.assignDefaults=void 0;var Gn=$e(),uk=Oe();function DH(e,t){let{properties:n,items:r}=e.schema;if(t==="object"&&n)for(let s in n)ck(e,s,n[s].default);else if(t==="array"&&Array.isArray(r))r.forEach((s,o)=>ck(e,o,s.default))}fk.assignDefaults=DH;function ck(e,t,n){let{gen:r,compositeRule:s,data:o,opts:i}=e;if(n===void 0)return;let a=Gn._`${o}${Gn.getProperty(t)}`;if(s){uk.checkStrictMode(e,`default is ignored for: ${a}`);return}let l=Gn._`${a} === undefined`;if(i.useDefaults==="empty")l=Gn._`${l} || ${a} === null || ${a} === ""`;r.if(l,Gn._`${a} = ${Gn.stringify(n)}`)}});var Xn=W(function(yk){Object.defineProperty(yk,"__esModule",{value:!0});yk.validateUnion=yk.validateArray=yk.usePattern=yk.callValidateCode=yk.schemaProperties=yk.allSchemaProperties=yk.noPropertyInData=yk.propertyInData=yk.isOwnProperty=yk.hasPropFunc=yk.reportMissingProp=yk.checkMissingProp=yk.checkReportMissingProp=void 0;var he=$e(),ia=Oe(),Us=Kn(),mk=Oe();function LH(e,t){let{gen:n,data:r,it:s}=e;n.if(Ix(n,r,t,s.opts.ownProperties),()=>{e.setParams({missingProperty:he._`${t}`},!0),e.error()})}yk.checkReportMissingProp=LH;function FH({gen:e,data:t,it:{opts:n}},r,s){return he.or(...r.map((o)=>he.and(Ix(e,t,o,n.ownProperties),he._`${s} = ${o}`)))}yk.checkMissingProp=FH;function VH(e,t){e.setParams({missingProperty:t},!0),e.error()}yk.reportMissingProp=VH;function hk(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:he._`Object.prototype.hasOwnProperty`})}yk.hasPropFunc=hk;function Mx(e,t,n){return he._`${hk(e)}.call(${t}, ${n})`}yk.isOwnProperty=Mx;function qH(e,t,n,r){let s=he._`${t}${he.getProperty(n)} !== undefined`;return r?he._`${s} && ${Mx(e,t,n)}`:s}yk.propertyInData=qH;function Ix(e,t,n,r){let s=he._`${t}${he.getProperty(n)} === undefined`;return r?he.or(s,he.not(Mx(e,t,n))):s}yk.noPropertyInData=Ix;function gk(e){return e?Object.keys(e).filter((t)=>t!=="__proto__"):[]}yk.allSchemaProperties=gk;function HH(e,t){return gk(t).filter((n)=>!ia.alwaysValidSchema(e,t[n]))}yk.schemaProperties=HH;function WH({schemaCode:e,data:t,it:{gen:n,topSchemaRef:r,schemaPath:s,errorPath:o},it:i},a,l,c){let u=c?he._`${e}, ${t}, ${r}${s}`:t,d=[[Us.default.instancePath,he.strConcat(Us.default.instancePath,o)],[Us.default.parentData,i.parentData],[Us.default.parentDataProperty,i.parentDataProperty],[Us.default.rootData,Us.default.rootData]];if(i.opts.dynamicRef)d.push([Us.default.dynamicAnchors,Us.default.dynamicAnchors]);let p=he._`${u}, ${n.object(...d)}`;return l!==he.nil?he._`${a}.call(${l}, ${p})`:he._`${a}(${p})`}yk.callValidateCode=WH;var BH=he._`new RegExp`;function UH({gen:e,it:{opts:t}},n){let r=t.unicodeRegExp?"u":"",{regExp:s}=t.code,o=s(n,r);return e.scopeValue("pattern",{key:o.toString(),ref:o,code:he._`${s.code==="new RegExp"?BH:mk.useFunc(e,s)}(${n}, ${r})`})}yk.usePattern=UH;function zH(e){let{gen:t,data:n,keyword:r,it:s}=e,o=t.name("valid");if(s.allErrors){let a=t.let("valid",!0);return i(()=>t.assign(a,!1)),a}return t.var(o,!0),i(()=>t.break()),o;function i(a){let l=t.const("len",he._`${n}.length`);t.forRange("i",0,l,(c)=>{e.subschema({keyword:r,dataProp:c,dataPropType:ia.Type.Num},o),t.if(he.not(o),a)})}}yk.validateArray=zH;function KH(e){let{gen:t,schema:n,keyword:r,it:s}=e;if(!Array.isArray(n))throw Error("ajv implementation error");if(n.some((l)=>ia.alwaysValidSchema(s,l))&&!s.opts.unevaluated)return;let i=t.let("valid",!1),a=t.name("_valid");t.block(()=>n.forEach((l,c)=>{let u=e.subschema({keyword:r,schemaProp:c,compositeRule:!0},a);if(t.assign(i,he._`${i} || ${a}`),!e.mergeValidEvaluated(u,a))t.if(he.not(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}yk.validateUnion=KH});var jk=W(function(vk){Object.defineProperty(vk,"__esModule",{value:!0});vk.validateKeywordUsage=vk.validSchemaType=vk.funcKeywordCode=vk.macroKeywordCode=void 0;var He=$e(),Uo=Kn(),$k=Xn(),Sk=ic();function aW(e,t){let{gen:n,keyword:r,schema:s,parentSchema:o,it:i}=e,a=t.macro.call(i.self,s,o,i),l=wk(n,r,a);if(i.opts.validateSchema!==!1)i.self.validateSchema(a,!0);let c=n.name("valid");e.subschema({schema:a,schemaPath:He.nil,errSchemaPath:`${i.errSchemaPath}/${r}`,topSchemaRef:l,compositeRule:!0},c),e.pass(c,()=>e.error(!0))}vk.macroKeywordCode=aW;function lW(e,t){var n;let{gen:r,keyword:s,schema:o,parentSchema:i,$data:a,it:l}=e;uW(l,t);let c=!a&&t.compile?t.compile.call(l.self,o,i,l):t.validate,u=wk(r,s,c),d=r.let("valid");e.block$data(d,p),e.ok((n=t.valid)!==null&&n!==void 0?n:d);function p(){if(t.errors===!1){if(S(),t.modifying)bk(e);g(()=>e.error())}else{let x=t.async?m():y();if(t.modifying)bk(e);g(()=>cW(e,x))}}function m(){let x=r.let("ruleErrs",null);return r.try(()=>S(He._`await `),(P)=>r.assign(d,!1).if(He._`${P} instanceof ${l.ValidationError}`,()=>r.assign(x,He._`${P}.errors`),()=>r.throw(P))),x}function y(){let x=He._`${u}.errors`;return r.assign(x,null),S(He.nil),x}function S(x=t.async?He._`await `:He.nil){let P=l.opts.passContext?Uo.default.this:Uo.default.self,w=!(("compile"in t)&&!a||t.schema===!1);r.assign(d,He._`${x}${$k.callValidateCode(e,u,P,w)}`,t.modifying)}function g(x){var P;r.if(He.not((P=t.valid)!==null&&P!==void 0?P:d),x)}}vk.funcKeywordCode=lW;function bk(e){let{gen:t,data:n,it:r}=e;t.if(r.parentData,()=>t.assign(n,He._`${r.parentData}[${r.parentDataProperty}]`))}function cW(e,t){let{gen:n}=e;n.if(He._`Array.isArray(${t})`,()=>{n.assign(Uo.default.vErrors,He._`${Uo.default.vErrors} === null ? ${t} : ${Uo.default.vErrors}.concat(${t})`).assign(Uo.default.errors,He._`${Uo.default.vErrors}.length`),Sk.extendErrors(e)},()=>e.error())}function uW({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}function wk(e,t,n){if(n===void 0)throw Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof n=="function"?{ref:n}:{ref:n,code:He.stringify(n)})}function fW(e,t,n=!1){return!t.length||t.some((r)=>r==="array"?Array.isArray(e):r==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==r||n&&typeof e>"u")}vk.validSchemaType=fW;function dW({schema:e,opts:t,self:n,errSchemaPath:r},s,o){if(Array.isArray(s.keyword)?!s.keyword.includes(o):s.keyword!==o)throw Error("ajv implementation error");let i=s.dependencies;if(i===null||i===void 0?void 0:i.some((a)=>!Object.prototype.hasOwnProperty.call(e,a)))throw Error(`parent schema must have dependencies of ${o}: ${i.join(",")}`);if(s.validateSchema){if(!s.validateSchema(e[o])){let l=`keyword "${o}" value is invalid at path "${r}": `+n.errorsText(s.validateSchema.errors);if(t.validateSchema==="log")n.logger.error(l);else throw Error(l)}}}vk.validateKeywordUsage=dW});var kk=W(function(Pk){Object.defineProperty(Pk,"__esModule",{value:!0});Pk.extendSubschemaMode=Pk.extendSubschemaData=Pk.getSubschema=void 0;var Rt=$e(),$d=Oe();function gW(e,{keyword:t,schemaProp:n,schema:r,schemaPath:s,errSchemaPath:o,topSchemaRef:i}){if(t!==void 0&&r!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let a=e.schema[t];return n===void 0?{schema:a,schemaPath:Rt._`${e.schemaPath}${Rt.getProperty(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[n],schemaPath:Rt._`${e.schemaPath}${Rt.getProperty(t)}${Rt.getProperty(n)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${$d.escapeFragment(n)}`}}if(r!==void 0){if(s===void 0||o===void 0||i===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:r,schemaPath:s,topSchemaRef:i,errSchemaPath:o}}throw Error('either "keyword" or "schema" must be passed')}Pk.getSubschema=gW;function yW(e,t,{dataProp:n,dataPropType:r,data:s,dataTypes:o,propertyName:i}){if(s!==void 0&&n!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(n!==void 0){let{errorPath:c,dataPathArr:u,opts:d}=t,p=a.let("data",Rt._`${t.data}${Rt.getProperty(n)}`,!0);l(p),e.errorPath=Rt.str`${c}${$d.getErrorPath(n,r,d.jsPropertySyntax)}`,e.parentDataProperty=Rt._`${n}`,e.dataPathArr=[...u,e.parentDataProperty]}if(s!==void 0){let c=s instanceof Rt.Name?s:a.let("data",s,!0);if(l(c),i!==void 0)e.propertyName=i}if(o)e.dataTypes=o;function l(c){e.data=c,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,c]}}Pk.extendSubschemaData=yW;function xW(e,{jtdDiscriminator:t,jtdMetadata:n,compositeRule:r,createErrors:s,allErrors:o}){if(r!==void 0)e.compositeRule=r;if(s!==void 0)e.createErrors=s;if(o!==void 0)e.allErrors=o;e.jtdDiscriminator=t,e.jtdMetadata=n}Pk.extendSubschemaMode=xW});var Dx=W(function(jre,Ok){Ok.exports=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var r,s,o;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(s=r;s--!==0;)if(!e(t[s],n[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(o=Object.keys(t),r=o.length,r!==Object.keys(n).length)return!1;for(s=r;s--!==0;)if(!Object.prototype.hasOwnProperty.call(n,o[s]))return!1;for(s=r;s--!==0;){var i=o[s];if(!e(t[i],n[i]))return!1}return!0}return t!==t&&n!==n}});var Ck=W(function(Pre,Ak){var zs=Ak.exports=function(e,t,n){if(typeof t=="function")n=t,t={};n=t.cb||n;var r=typeof n=="function"?n:n.pre||function(){},s=n.post||function(){};Sd(t,r,s,e,"",e)};zs.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};zs.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};zs.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};zs.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function Sd(e,t,n,r,s,o,i,a,l,c){if(r&&typeof r=="object"&&!Array.isArray(r)){t(r,s,o,i,a,l,c);for(var u in r){var d=r[u];if(Array.isArray(d)){if(u in zs.arrayKeywords)for(var p=0;p<d.length;p++)Sd(e,t,n,d[p],s+"/"+u+"/"+p,o,s,u,r,p)}else if(u in zs.propsKeywords){if(d&&typeof d=="object")for(var m in d)Sd(e,t,n,d[m],s+"/"+u+"/"+SW(m),o,s,u,r,m)}else if(u in zs.keywords||e.allKeys&&!(u in zs.skipKeywords))Sd(e,t,n,d,s+"/"+u,o,s,u,r)}n(r,s,o,i,a,l,c)}}function SW(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var lc=W(function(Mk){Object.defineProperty(Mk,"__esModule",{value:!0});Mk.getSchemaRefs=Mk.resolveUrl=Mk.normalizeId=Mk._getFullPath=Mk.getFullPath=Mk.inlineRef=void 0;var Rk=Oe(),wW=Dx(),vW=Ck(),EW=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function jW(e,t=!0){if(typeof e=="boolean")return!0;if(t===!0)return!Lx(e);if(!t)return!1;return Nk(e)<=t}Mk.inlineRef=jW;var PW=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Lx(e){for(let t in e){if(PW.has(t))return!0;let n=e[t];if(Array.isArray(n)&&n.some(Lx))return!0;if(typeof n=="object"&&Lx(n))return!0}return!1}function Nk(e){let t=0;for(let n in e){if(n==="$ref")return 1/0;if(t++,EW.has(n))continue;if(typeof e[n]=="object")Rk.eachItem(e[n],(r)=>t+=Nk(r));if(t===1/0)return 1/0}return t}function Tk(e,t="",n){if(n!==!1)t=aa(t);let r=e.parse(t);return Jk(e,r)}Mk.getFullPath=Tk;function Jk(e,t){return e.serialize(t).split("#")[0]+"#"}Mk._getFullPath=Jk;var _W=/#\/?$/;function aa(e){return e?e.replace(_W,""):""}Mk.normalizeId=aa;function kW(e,t,n){return n=aa(n),e.resolve(t,n)}Mk.resolveUrl=kW;var OW=/^[a-z_][-a-z0-9._]*$/i;function AW(e,t){if(typeof e=="boolean")return{};let{schemaId:n,uriResolver:r}=this.opts,s=aa(e[n]||t),o={"":s},i=Tk(r,s,!1),a={},l=new Set;return vW(e,{allKeys:!0},(d,p,m,y)=>{if(y===void 0)return;let S=i+p,g=o[y];if(typeof d[n]=="string")g=x.call(this,d[n]);P.call(this,d.$anchor),P.call(this,d.$dynamicAnchor),o[p]=g;function x(w){let E=this.opts.uriResolver.resolve;if(w=aa(g?E(g,w):w),l.has(w))throw u(w);l.add(w);let j=this.refs[w];if(typeof j=="string")j=this.refs[j];if(typeof j=="object")c(d,j.schema,w);else if(w!==aa(S))if(w[0]==="#")c(d,a[w],w),a[w]=d;else this.refs[w]=S;return w}function P(w){if(typeof w=="string"){if(!OW.test(w))throw Error(`invalid anchor "${w}"`);x.call(this,`#${w}`)}}}),a;function c(d,p,m){if(p!==void 0&&!wW(d,p))throw u(m)}function u(d){return Error(`reference "${d}" resolves to more than one schema`)}}Mk.getSchemaRefs=AW});var ua=W(function(Zk){Object.defineProperty(Zk,"__esModule",{value:!0});Zk.getData=Zk.KeywordCxt=Zk.validateFunctionCode=void 0;var vd=G_(),wd=ac(),ca=Rx(),Ks=ac(),Vk=pk(),Mr=jk(),la=kk(),F=$e(),ye=Kn(),qk=lc(),It=Oe(),Jr=ic();function MW(e){if(Bk(e)){if(Uk(e),Wk(e)){LW(e);return}}Hk(e,()=>vd.topBoolOrEmptySchema(e))}Zk.validateFunctionCode=MW;function Hk({gen:e,validateName:t,schema:n,schemaEnv:r,opts:s},o){if(s.code.es5)e.func(t,F._`${ye.default.data}, ${ye.default.valCxt}`,r.$async,()=>{e.code(F._`"use strict"; ${Dk(n,s)}`),DW(e,s),e.code(o)});else e.func(t,F._`${ye.default.data}, ${IW(s)}`,r.$async,()=>e.code(Dk(n,s)).code(o))}function IW(e){return F._`{${ye.default.instancePath}="", ${ye.default.parentData}, ${ye.default.parentDataProperty}, ${ye.default.rootData}=${ye.default.data}${e.dynamicRef?F._`, ${ye.default.dynamicAnchors}={}`:F.nil}}={}`}function DW(e,t){e.if(ye.default.valCxt,()=>{if(e.var(ye.default.instancePath,F._`${ye.default.valCxt}.${ye.default.instancePath}`),e.var(ye.default.parentData,F._`${ye.default.valCxt}.${ye.default.parentData}`),e.var(ye.default.parentDataProperty,F._`${ye.default.valCxt}.${ye.default.parentDataProperty}`),e.var(ye.default.rootData,F._`${ye.default.valCxt}.${ye.default.rootData}`),t.dynamicRef)e.var(ye.default.dynamicAnchors,F._`${ye.default.valCxt}.${ye.default.dynamicAnchors}`)},()=>{if(e.var(ye.default.instancePath,F._`""`),e.var(ye.default.parentData,F._`undefined`),e.var(ye.default.parentDataProperty,F._`undefined`),e.var(ye.default.rootData,ye.default.data),t.dynamicRef)e.var(ye.default.dynamicAnchors,F._`{}`)})}function LW(e){let{schema:t,opts:n,gen:r}=e;Hk(e,()=>{if(n.$comment&&t.$comment)Kk(e);if(WW(e),r.let(ye.default.vErrors,null),r.let(ye.default.errors,0),n.unevaluated)FW(e);zk(e),zW(e)});return}function FW(e){let{gen:t,validateName:n}=e;e.evaluated=t.const("evaluated",F._`${n}.evaluated`),t.if(F._`${e.evaluated}.dynamicProps`,()=>t.assign(F._`${e.evaluated}.props`,F._`undefined`)),t.if(F._`${e.evaluated}.dynamicItems`,()=>t.assign(F._`${e.evaluated}.items`,F._`undefined`))}function Dk(e,t){let n=typeof e=="object"&&e[t.schemaId];return n&&(t.code.source||t.code.process)?F._`/*# sourceURL=${n} */`:F.nil}function VW(e,t){if(Bk(e)){if(Uk(e),Wk(e)){qW(e,t);return}}vd.boolOrEmptySchema(e,t)}function Wk({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let n in e)if(t.RULES.all[n])return!0;return!1}function Bk(e){return typeof e.schema!="boolean"}function qW(e,t){let{schema:n,gen:r,opts:s}=e;if(s.$comment&&n.$comment)Kk(e);BW(e),UW(e);let o=r.const("_errs",ye.default.errors);zk(e,o),r.var(t,F._`${o} === ${ye.default.errors}`)}function Uk(e){It.checkUnknownRules(e),HW(e)}function zk(e,t){if(e.opts.jtd)return Lk(e,[],!1,t);let n=wd.getSchemaTypes(e.schema),r=wd.coerceAndCheckDataType(e,n);Lk(e,n,!r,t)}function HW(e){let{schema:t,errSchemaPath:n,opts:r,self:s}=e;if(t.$ref&&r.ignoreKeywordsWithRef&&It.schemaHasRulesButRef(t,s.RULES))s.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}function WW(e){let{schema:t,opts:n}=e;if(t.default!==void 0&&n.useDefaults&&n.strictSchema)It.checkStrictMode(e,"default is ignored in the schema root")}function BW(e){let t=e.schema[e.opts.schemaId];if(t)e.baseId=qk.resolveUrl(e.opts.uriResolver,e.baseId,t)}function UW(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function Kk({gen:e,schemaEnv:t,schema:n,errSchemaPath:r,opts:s}){let o=n.$comment;if(s.$comment===!0)e.code(F._`${ye.default.self}.logger.log(${o})`);else if(typeof s.$comment=="function"){let i=F.str`${r}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code(F._`${ye.default.self}.opts.$comment(${o}, ${i}, ${a}.schema)`)}}function zW(e){let{gen:t,schemaEnv:n,validateName:r,ValidationError:s,opts:o}=e;if(n.$async)t.if(F._`${ye.default.errors} === 0`,()=>t.return(ye.default.data),()=>t.throw(F._`new ${s}(${ye.default.vErrors})`));else{if(t.assign(F._`${r}.errors`,ye.default.vErrors),o.unevaluated)KW(e);t.return(F._`${ye.default.errors} === 0`)}}function KW({gen:e,evaluated:t,props:n,items:r}){if(n instanceof F.Name)e.assign(F._`${t}.props`,n);if(r instanceof F.Name)e.assign(F._`${t}.items`,r)}function Lk(e,t,n,r){let{gen:s,schema:o,data:i,allErrors:a,opts:l,self:c}=e,{RULES:u}=c;if(o.$ref&&(l.ignoreKeywordsWithRef||!It.schemaHasRulesButRef(o,u))){s.block(()=>Xk(e,"$ref",u.all.$ref.definition));return}if(!l.jtd)GW(e,t);s.block(()=>{for(let p of u.rules)d(p);d(u.post)});function d(p){if(!ca.shouldUseGroup(o,p))return;if(p.type){if(s.if(Ks.checkDataType(p.type,i,l.strictNumbers)),Fk(e,p),t.length===1&&t[0]===p.type&&n)s.else(),Ks.reportTypeError(e);s.endIf()}else Fk(e,p);if(!a)s.if(F._`${ye.default.errors} === ${r||0}`)}}function Fk(e,t){let{gen:n,schema:r,opts:{useDefaults:s}}=e;if(s)Vk.assignDefaults(e,t.type);n.block(()=>{for(let o of t.rules)if(ca.shouldUseRule(r,o))Xk(e,o.keyword,o.definition,t.type)})}function GW(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;if(XW(e,t),!e.opts.allowUnionTypes)YW(e,t);ZW(e,e.dataTypes)}function XW(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((n)=>{if(!Gk(e.dataTypes,n))Fx(e,`type "${n}" not allowed by context "${e.dataTypes.join(",")}"`)}),eB(e,t)}function YW(e,t){if(t.length>1&&!(t.length===2&&t.includes("null")))Fx(e,"use allowUnionTypes to allow union type keyword")}function ZW(e,t){let n=e.self.RULES.all;for(let r in n){let s=n[r];if(typeof s=="object"&&ca.shouldUseRule(e.schema,s)){let{type:o}=s.definition;if(o.length&&!o.some((i)=>QW(t,i)))Fx(e,`missing type "${o.join(",")}" for keyword "${r}"`)}}}function QW(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Gk(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function eB(e,t){let n=[];for(let r of e.dataTypes)if(Gk(t,r))n.push(r);else if(t.includes("integer")&&r==="number")n.push("integer");e.dataTypes=n}function Fx(e,t){let n=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${n}" (strictTypes)`,It.checkStrictMode(e,t,e.opts.strictTypes)}class Vx{constructor(e,t,n){if(Mr.validateKeywordUsage(e,t,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=It.schemaRefOrVal(e,this.schema,n,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",Yk(this.$data,e));else if(this.schemaCode=this.schemaValue,!Mr.validSchemaType(this.schema,t.schemaType,t.allowUndefined))throw Error(`${n} value must be ${JSON.stringify(t.schemaType)}`);if("code"in t?t.trackErrors:t.errors!==!1)this.errsCount=e.gen.const("_errs",ye.default.errors)}result(e,t,n){this.failResult(F.not(e),t,n)}failResult(e,t,n){if(this.gen.if(e),n)n();else this.error();if(t){if(this.gen.else(),t(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(e,t){this.failResult(F.not(e),void 0,t)}fail(e){if(e===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(e),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail(F._`${t} !== undefined && (${F.or(this.invalid$data(),e)})`)}error(e,t,n){if(t){this.setParams(t),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,t){(e?Jr.reportExtraError:Jr.reportError)(this,this.def.error,t)}$dataError(){Jr.reportError(this,this.def.$dataError||Jr.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');Jr.resetErrorsCount(this.gen,this.errsCount)}ok(e){if(!this.allErrors)this.gen.if(e)}setParams(e,t){if(t)Object.assign(this.params,e);else this.params=e}block$data(e,t,n=F.nil){this.gen.block(()=>{this.check$data(e,n),t()})}check$data(e=F.nil,t=F.nil){if(!this.$data)return;let{gen:n,schemaCode:r,schemaType:s,def:o}=this;if(n.if(F.or(F._`${r} === undefined`,t)),e!==F.nil)n.assign(e,!0);if(s.length||o.validateSchema){if(n.elseIf(this.invalid$data()),this.$dataError(),e!==F.nil)n.assign(e,!1)}n.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:n,def:r,it:s}=this;return F.or(o(),i());function o(){if(n.length){if(!(t instanceof F.Name))throw Error("ajv implementation error");let a=Array.isArray(n)?n:[n];return F._`${Ks.checkDataTypes(a,t,s.opts.strictNumbers,Ks.DataType.Wrong)}`}return F.nil}function i(){if(r.validateSchema){let a=e.scopeValue("validate$data",{ref:r.validateSchema});return F._`!${a}(${t})`}return F.nil}}subschema(e,t){let n=la.getSubschema(this.it,e);la.extendSubschemaData(n,this.it,e),la.extendSubschemaMode(n,e);let r={...this.it,...n,items:void 0,props:void 0};return VW(r,t),r}mergeEvaluated(e,t){let{it:n,gen:r}=this;if(!n.opts.unevaluated)return;if(n.props!==!0&&e.props!==void 0)n.props=It.mergeEvaluated.props(r,e.props,n.props,t);if(n.items!==!0&&e.items!==void 0)n.items=It.mergeEvaluated.items(r,e.items,n.items,t)}mergeValidEvaluated(e,t){let{it:n,gen:r}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return r.if(t,()=>this.mergeEvaluated(e,F.Name)),!0}}Zk.KeywordCxt=Vx;function Xk(e,t,n,r){let s=new Vx(e,n,t);if("code"in n)n.code(s,r);else if(s.$data&&n.validate)Mr.funcKeywordCode(s,n);else if("macro"in n)Mr.macroKeywordCode(s,n);else if(n.compile||n.validate)Mr.funcKeywordCode(s,n)}var tB=/^\/(?:[^~]|~0|~1)*$/,nB=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Yk(e,{dataLevel:t,dataNames:n,dataPathArr:r}){let s,o;if(e==="")return ye.default.rootData;if(e[0]==="/"){if(!tB.test(e))throw Error(`Invalid JSON-pointer: ${e}`);s=e,o=ye.default.rootData}else{let c=nB.exec(e);if(!c)throw Error(`Invalid JSON-pointer: ${e}`);let u=+c[1];if(s=c[2],s==="#"){if(u>=t)throw Error(l("property/index",u));return r[t-u]}if(u>t)throw Error(l("data",u));if(o=n[t-u],!s)return o}let i=o,a=s.split("/");for(let c of a)if(c)o=F._`${o}${F.getProperty(It.unescapeJsonPointer(c))}`,i=F._`${i} && ${o}`;return i;function l(c,u){return`Cannot access ${c} ${u} levels up, current level is ${t}`}}Zk.getData=Yk});var cc=W(function(tO){Object.defineProperty(tO,"__esModule",{value:!0});class eO extends Error{constructor(e){super("validation failed");this.errors=e,this.ajv=this.validation=!0}}tO.default=eO});var da=W(function(rO){Object.defineProperty(rO,"__esModule",{value:!0});var fa=lc();class nO extends Error{constructor(e,t,n,r){super(r||`can't resolve reference ${n} from id ${t}`);this.missingRef=fa.resolveUrl(e,t,n),this.missingSchema=fa.normalizeId(fa.getFullPath(e,this.missingRef))}}rO.default=nO});var fc=W(function(iO){Object.defineProperty(iO,"__esModule",{value:!0});iO.resolveSchema=iO.getCompilingSchema=iO.resolveRef=iO.compileSchema=iO.SchemaEnv=void 0;var ht=$e(),aB=cc(),zo=Kn(),gt=lc(),Ed=Oe(),sO=ua();class uc{constructor(e){var t;this.refs={},this.dynamicAnchors={};let n;if(typeof e.schema=="object")n=e.schema;this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(t=e.baseId)!==null&&t!==void 0?t:gt.normalizeId(n===null||n===void 0?void 0:n[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n===null||n===void 0?void 0:n.$async,this.refs={}}}iO.SchemaEnv=uc;function Hx(e){let t=oO.call(this,e);if(t)return t;let n=gt.getFullPath(this.opts.uriResolver,e.root.baseId),{es5:r,lines:s}=this.opts.code,{ownProperties:o}=this.opts,i=new ht.CodeGen(this.scope,{es5:r,lines:s,ownProperties:o}),a;if(e.$async)a=i.scopeValue("Error",{ref:aB.default,code:ht._`require("ajv/dist/runtime/validation_error").default`});let l=i.scopeName("validate");e.validateName=l;let c={gen:i,allErrors:this.opts.allErrors,data:zo.default.data,parentData:zo.default.parentData,parentDataProperty:zo.default.parentDataProperty,dataNames:[zo.default.data],dataPathArr:[ht.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:ht.stringify(e.schema)}:{ref:e.schema}),validateName:l,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:n,baseId:e.baseId||n,schemaPath:ht.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:ht._`""`,opts:this.opts,self:this},u;try{this._compilations.add(e),sO.validateFunctionCode(c),i.optimize(this.opts.code.optimize);let d=i.toString();if(u=`${i.scopeRefs(zo.default.scope)}return ${d}`,this.opts.code.process)u=this.opts.code.process(u,e);let m=Function(`${zo.default.self}`,`${zo.default.scope}`,u)(this,this.scope.get());if(this.scope.value(l,{ref:m}),m.errors=null,m.schema=e.schema,m.schemaEnv=e,e.$async)m.$async=!0;if(this.opts.code.source===!0)m.source={validateName:l,validateCode:d,scopeValues:i._values};if(this.opts.unevaluated){let{props:y,items:S}=c;if(m.evaluated={props:y instanceof ht.Name?void 0:y,items:S instanceof ht.Name?void 0:S,dynamicProps:y instanceof ht.Name,dynamicItems:S instanceof ht.Name},m.source)m.source.evaluated=ht.stringify(m.evaluated)}return e.validate=m,e}catch(d){if(delete e.validate,delete e.validateName,u)this.logger.error("Error compiling schema, function code:",u);throw d}finally{this._compilations.delete(e)}}iO.compileSchema=Hx;function lB(e,t,n){var r;n=gt.resolveUrl(this.opts.uriResolver,t,n);let s=e.refs[n];if(s)return s;let o=fB.call(this,e,n);if(o===void 0){let i=(r=e.localRefs)===null||r===void 0?void 0:r[n],{schemaId:a}=this.opts;if(i)o=new uc({schema:i,schemaId:a,root:e,baseId:t})}if(o===void 0)return;return e.refs[n]=cB.call(this,o)}iO.resolveRef=lB;function cB(e){if(gt.inlineRef(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:Hx.call(this,e)}function oO(e){for(let t of this._compilations)if(uB(t,e))return t}iO.getCompilingSchema=oO;function uB(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function fB(e,t){let n;while(typeof(n=this.refs[t])=="string")t=n;return n||this.schemas[t]||jd.call(this,e,t)}function jd(e,t){let n=this.opts.uriResolver.parse(t),r=gt._getFullPath(this.opts.uriResolver,n),s=gt.getFullPath(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&r===s)return qx.call(this,n,e);let o=gt.normalizeId(r),i=this.refs[o]||this.schemas[o];if(typeof i=="string"){let a=jd.call(this,e,i);if(typeof(a===null||a===void 0?void 0:a.schema)!=="object")return;return qx.call(this,n,a)}if(typeof(i===null||i===void 0?void 0:i.schema)!=="object")return;if(!i.validate)Hx.call(this,i);if(o===gt.normalizeId(t)){let{schema:a}=i,{schemaId:l}=this.opts,c=a[l];if(c)s=gt.resolveUrl(this.opts.uriResolver,s,c);return new uc({schema:a,schemaId:l,root:e,baseId:s})}return qx.call(this,n,i)}iO.resolveSchema=jd;var dB=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function qx(e,{baseId:t,schema:n,root:r}){var s;if(((s=e.fragment)===null||s===void 0?void 0:s[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof n==="boolean")return;let l=n[Ed.unescapeFragment(a)];if(l===void 0)return;n=l;let c=typeof n==="object"&&n[this.opts.schemaId];if(!dB.has(a)&&c)t=gt.resolveUrl(this.opts.uriResolver,t,c)}let o;if(typeof n!="boolean"&&n.$ref&&!Ed.schemaHasRulesButRef(n,this.RULES)){let a=gt.resolveUrl(this.opts.uriResolver,t,n.$ref);o=jd.call(this,r,a)}let{schemaId:i}=this.opts;if(o=o||new uc({schema:n,schemaId:i,root:r,baseId:t}),o.schema!==o.root.schema)return o;return}});var lO=W(function(Rre,yB){yB.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var Gx=W(function(Nre,gO){var xB=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Bx=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),bB=RegExp.prototype.test.bind(/^\d*$/u),Ko=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),Ux=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),uO=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),zx=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),$B=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),$n=Array(256);for(let t=0;t<256;t++)$n[t]="%"+"0123456789ABCDEF"[t>>4]+"0123456789ABCDEF"[t&15];function Yt(e){if(e<2048)return $n[192|e>>6]+$n[128|e&63];if(e<65536)return $n[224|e>>12]+$n[128|e>>6&63]+$n[128|e&63];return $n[240|e>>18]+$n[128|e>>12&63]+$n[128|e>>6&63]+$n[128|e&63]}function SB(e){let t="",n=0,r=0;for(r=0;r<e.length;r++){if(n=e[r].charCodeAt(0),n===48)continue;if(!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return"";t+=e[r];break}for(r+=1;r<e.length;r++){if(n=e[r].charCodeAt(0),!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return"";t+=e[r]}return t}var wB=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),vB=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),EB=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),jB=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function PB(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++){if(EB(e[t]))continue;if(e[t]==="%"&&t+2<e.length&&Ko(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function cO(e){let t=-1,n=0,r=-1,s=0;for(let a=0;a<e.length;a++)if(e[a]==="0"){if(r===-1)r=a;if(s++,s>n)n=s,t=r}else r=-1,s=0;if(n<2)return e.join(":");let o=e.slice(0,t).join(":"),i=e.slice(t+n).join(":");return o+"::"+i}function _B(e){let t=e.indexOf("::");if(t!==-1&&e.indexOf("::",t+1)!==-1)return;let n=t===-1?e.split(":"):e.slice(0,t).split(":"),r=t===-1?[]:e.slice(t+2).split(":");if(t!==-1){if(n.length===1&&n[0]==="")n.length=0;if(r.length===1&&r[0]==="")r.length=0}let s=n.concat(r),o=0;for(let a=0;a<s.length;a++){let l=s[a];if(l==="")return;if(l.indexOf(".")!==-1){if(a!==s.length-1||t!==-1&&r.length===0||!Bx(l))return;o+=2;continue}if(!wB(l))return;s[a]=parseInt(l,16).toString(16),o++}if(t===-1){if(o!==8)return;return cO(s)}if(o>=8)return;let i=s.slice(0,n.length);for(let a=o;a<8;a++)i.push("0");for(let a=n.length;a<s.length;a++)i.push(s[a]);return cO(i)}function Wx(e){let t=e[0]==="["&&e[e.length-1]==="]";if((e[0]==="["||e[e.length-1]==="]")&&!t)return{host:e,isIPV6:!1,error:!0};let r=t?e.slice(1,-1):e;if(t&&vB(r))return r=r.toLowerCase(),{host:`[${r}]`,escapedHost:r,isIPV6:!1,isIPVFuture:!0};if(kB(r,":")<2)return{host:e,isIPV6:!1,error:t};let s="",o=r.indexOf("%");if(o!==-1){let a=r.slice(o,o+3).toLowerCase()==="%25"?3:1;if(s=r.slice(o+a),!PB(s))return{host:e,isIPV6:!1,error:!0};r=r.slice(0,o)}let i=_B(r);if(i===void 0)return{host:e,isIPV6:!1,error:!0};return{host:i+(s?"%"+s:""),escapedHost:i+(s?"%25"+s:""),isIPV6:!0}}function kB(e,t){let n=0;for(let r=0;r<e.length;r++)if(e[r]===t)n++;return n}function fO(e){let t=e,n=[],r=-1,s=0;while(s=t.length){if(s===1)if(t===".")break;else if(t==="/"){n.push("/");break}else{n.push(t);break}else if(s===2){if(t[0]==="."){if(t[1]===".")break;else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."||t[1]==="/"){n.push("/");break}}}else if(s===3){if(t==="/.."){if(n.length!==0)n.pop();n.push("/");break}}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."){if(t[3]==="/"){if(t=t.slice(3),n.length!==0)n.pop();continue}}}}if((r=t.indexOf("/",1))===-1){n.push(t);break}else n.push(t.slice(0,r)),t=t.slice(r)}return n.join("")}function OB(e){if(e===""||e[0]==="/")return fO(e);let t=e.split("/"),n=t.length-1,r=[],s=!1;for(let o=0;o<=n;o++){let i=t[o];if(i==="."||i===".."){if(i==="..")if(r.length!==0&&r[r.length-1]!=="..")r.pop();else r.push("..");s=o===n}else r.push(i)}if(s&&r[r.length-1]!=="..")r.push("");if(r.length===0||r[0]===""||r[0].includes(":"))r.unshift(".");return r.join("/")}var AB={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},CB=/[@/?#:]/g,RB=/[@/?#]/g;function dO(e,t){let n=t?RB:CB;return n.lastIndex=0,e.replace(n,(r)=>AB[r])}function pO(e,t=!1){if(e.indexOf("%")===-1)return e;let n="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let s=e.slice(r+1,r+3);if(Ko(s)){let o=s.toUpperCase(),i=String.fromCharCode(parseInt(o,16));if(t&&Ux(i))n+=i;else n+="%"+o;r+=2;continue}}n+=e[r]}return n}function NB(e){let t="";for(let n=0;n<e.length;n++){let r=e[n];if(r==="%"&&n+2<e.length){let s=e.slice(n+1,n+3);if(Ko(s)){let o=s.toUpperCase(),i=String.fromCharCode(parseInt(o,16));if(i!=="."&&Ux(i))t+=i;else t+="%"+o;n+=2;continue}}if(uO(r))t+=r;else{let s=e.charCodeAt(n);if(s<128)t+=hO(s)?r:$n[s];else if(s<55296||s>57343)t+=Yt(s);else if(s<=56319&&n+1<e.length){let o=e.charCodeAt(n+1);if(o>=56320&&o<=57343)t+=Yt(65536+(s-55296<<10)+(o-56320)),n++;else t+=Yt(65533)}else t+=Yt(65533)}}return t}function TB(e,t=!1){let n="",r=t&&e[0]!=="/";for(let s=0;s<e.length;s++){let o=e[s];if(o==="%"&&s+2<e.length){let i=e.slice(s+1,s+3);if(Ko(i)){n+="%"+i.toUpperCase(),s+=2;continue}}if(o==="/")r=!1;if(uO(o)&&(o!==":"||!r))n+=o;else{let i=e.charCodeAt(s);if(i<128)n+=$n[i];else if(i<55296||i>57343)n+=Yt(i);else if(i<=56319&&s+1<e.length){let a=e.charCodeAt(s+1);if(a>=56320&&a<=57343)n+=Yt(65536+(i-55296<<10)+(a-56320)),s++;else n+=Yt(65533)}else n+=Yt(65533)}}return n}function Kx(e,t){let n="";for(let r=0;r<e.length;r++){let s=e[r];if(s==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(Ko(o)){n+="%"+o.toUpperCase(),r+=2;continue}}if(t(s))n+=s;else{let o=e.charCodeAt(r);if(o<128)n+=$n[o];else if(o<55296||o>57343)n+=Yt(o);else if(o<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);if(i>=56320&&i<=57343)n+=Yt(65536+(o-55296<<10)+(i-56320)),r++;else n+=Yt(65533)}else n+=Yt(65533)}}return n}function mO(e){return Kx(e,$B)}function JB(e){return Kx(e,zx)}function MB(e){return Kx(e,zx)}function hO(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===42||e===43||e===45||e===46||e===47||e===64||e===95}function IB(e){let t="";for(let n=0;n<e.length;n++){let r=e[n];if(r==="%"&&n+2<e.length){let s=e.slice(n+1,n+3);if(Ko(s)){let o=s.toUpperCase(),i=String.fromCharCode(parseInt(o,16));if(Ux(i))t+=i;else t+="%"+o;n+=2;continue}}if(zx(r))t+=r;else{let s=e.charCodeAt(n);if(s<128)t+=hO(s)?r:$n[s];else if(s<55296||s>57343)t+=Yt(s);else if(s<=56319&&n+1<e.length){let o=e.charCodeAt(n+1);if(o>=56320&&o<=57343)t+=Yt(65536+(s-55296<<10)+(o-56320)),n++;else t+=Yt(65533)}else t+=Yt(65533)}}return t}function DB(e){let t="";for(let n=0;n<e.length;n++){if(e[n]==="%"&&n+2<e.length){let r=e.slice(n+1,n+3);if(Ko(r)){t+="%"+r.toUpperCase(),n+=2;continue}}t+=escape(e[n])}return t}function LB(e){let t=[];if(e.userinfo!==void 0)t.push(mO(e.userinfo)),t.push("@");if(e.host!==void 0){let n=e.host;if(!Bx(n)){let r=Wx(n);if(r.isIPV6!==!0&&r.isIPVFuture!==!0)n=pO(n,!0),r=Wx(n);if(r.isIPV6===!0||r.isIPVFuture===!0)n=`[${r.escapedHost}]`;else n=dO(n,!1)}t.push(n)}if(typeof e.port==="number"||typeof e.port==="string"){let n=String(e.port);if(!bB(n))throw TypeError("URI port is malformed.");t.push(":"),t.push(n)}return t.length?t.join(""):void 0}gO.exports={nonSimpleDomain:jB,recomposeAuthority:LB,reescapeHostDelimiters:dO,normalizePercentEncoding:pO,normalizePathEncoding:NB,serializePathEncoding:TB,normalizeQueryFragmentEncoding:IB,encodeUserinfo:mO,encodeQuery:JB,encodeFragment:MB,escapePreservingEscapes:DB,removeDotSegments:fO,removeDotSegmentsRelative:OB,isIPv4:Bx,isUUID:xB,normalizeIPv6:Wx,stringArrayToHexStripped:SB}});var SO=W(function(Tre,$O){var{isUUID:FB}=Gx(),VB=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,qB=["http","https","ws","wss","urn","urn:uuid"];function HB(e){return qB.indexOf(e)!==-1}function Xx(e){if(e.secure===!0)return!0;else if(e.secure===!1)return!1;else if(e.scheme)return e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S");else return!1}function yO(e){if(!e.host)e.error=e.error||"HTTP URIs must have a host.";return e}function xO(e){let t=String(e.scheme).toLowerCase()==="https";if(e.port===(t?443:80)||e.port==="")e.port=void 0;if(!e.path)e.path="/";return e}function WB(e){return e.secure=Xx(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function BB(e){if(e.port===(Xx(e)?443:80)||e.port==="")e.port=void 0;if(typeof e.secure==="boolean")e.scheme=e.secure?"wss":"ws",e.secure=void 0;if(e.resourceName){let t=e.resourceName.indexOf("?"),n=t===-1?e.resourceName:e.resourceName.slice(0,t);e.path=n&&n!=="/"?n:void 0,e.query=t===-1?void 0:e.resourceName.slice(t+1),e.resourceName=void 0}return e.fragment=void 0,e}function UB(e,t){if(!e.path)return e.error="URN can not be parsed",e;let n=e.path.match(VB);if(n&&n[0]===e.path){let r=t.scheme||e.scheme||"urn";e.nid=n[1].toLowerCase(),e.nss=n[2];let s=`${r}:${t.nid||e.nid}`,o=Yx(s);if(e.path=void 0,o)e=o.parse(e,t)}else e.error=e.error||"URN can not be parsed.";return e}function zB(e,t){if(e.nid===void 0)throw Error("URN without nid cannot be serialized");let n=t.scheme||e.scheme||"urn",r=e.nid.toLowerCase(),s=`${n}:${t.nid||r}`,o=Yx(s);if(o)e=o.serialize(e,t);let i=e,a=e.nss;return i.path=`${r||t.nid}:${a}`,t.skipEscape=!0,i}function KB(e,t){let n=e;if(n.uuid=n.nss,n.nss=void 0,!t.tolerant&&(!n.uuid||!FB(n.uuid)))n.error=n.error||"UUID is not valid.";return n}function GB(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var bO={scheme:"http",domainHost:!0,parse:yO,serialize:xO},XB={scheme:"https",domainHost:bO.domainHost,parse:yO,serialize:xO},Pd={scheme:"ws",domainHost:!0,parse:WB,serialize:BB},YB={scheme:"wss",domainHost:Pd.domainHost,parse:Pd.parse,serialize:Pd.serialize},ZB={scheme:"urn",parse:UB,serialize:zB,skipNormalize:!0},QB={scheme:"urn:uuid",parse:KB,serialize:GB,skipNormalize:!0},_d={http:bO,https:XB,ws:Pd,wss:YB,urn:ZB,"urn:uuid":QB};Object.setPrototypeOf(_d,null);function Yx(e){return e&&(_d[e]||_d[e.toLowerCase()])||void 0}$O.exports={wsIsSecure:Xx,SCHEMES:_d,isValidSchemeName:HB,getSchemeHandler:Yx}});var JO=W(function(Jre,Cd){var{normalizeIPv6:PO,removeDotSegments:pc,removeDotSegmentsRelative:_O,recomposeAuthority:eU,normalizePercentEncoding:Zx,normalizePathEncoding:tU,serializePathEncoding:wO,normalizeQueryFragmentEncoding:vO,encodeQuery:nU,encodeFragment:rU,reescapeHostDelimiters:sU,isIPv4:kO,nonSimpleDomain:oU}=Gx(),{SCHEMES:OO,getSchemeHandler:Qx}=SO(),AO=/^[A-Za-z][A-Za-z0-9+.-]*$/u,iU=/[\0-\x20"#/:<>?@[\\\]^`{|}\x7F]/u;function EO(e){let t=String(e);if(!AO.test(t))throw TypeError("URI scheme is malformed.");return t}function aU(e,t){if(typeof e==="string")e=gU(e,t);else if(typeof e==="object")e=Od(Go(e,t),t);return e}function lU(e,t,n){let r=n?Object.assign({scheme:"null"},n):{scheme:"null"},{parsed:s,malformedAuthorityOrPort:o,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:l,malformedScheme:c}=kd(e,r),{parsed:u,malformedAuthorityOrPort:d,malformedPercentEncoding:p,malformedSchemeSpecific:m,malformedHost:y,malformedScheme:S}=kd(t,r);if(o||d||i||p||a||m||l||y||c||S)throw Error(s.error||u.error||"URI is malformed.");let g=CO(s,u,r,!0),x=Qx(n&&n.scheme||g.scheme),P=g.host,w=P!==void 0&&P!==""&&(kO(P)||PO(P).isIPV6);if(NO(g,n||{},x,w))throw Error("URI host is malformed.");RO(g,n||{},x,w);let E=P&&P.indexOf("%")!==-1&&!/\P{ASCII}/u.test(P);if(g.error&&!E)throw Error(g.error);return r.skipEscape=!0,Go(g,r)}function CO(e,t,n,r){let s={};if(!r)e=Od(Go(e,n),n),t=Od(Go(t,n),n);if(n=n||{},!n.tolerant&&t.scheme)s.scheme=t.scheme,s.userinfo=t.userinfo,s.host=t.host,s.port=t.port,s.path=pc(t.path||""),s.query=t.query;else{if(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)s.userinfo=t.userinfo,s.host=t.host,s.port=t.port,s.path=pc(t.path||""),s.query=t.query;else{if(!t.path)if(s.path=e.path,t.query!==void 0)s.query=t.query;else s.query=e.query;else{if(t.path[0]==="/")s.path=pc(t.path);else{let o=e.userinfo!==void 0||e.host!==void 0||e.port!==void 0;if(o&&!e.path)s.path="/"+t.path;else if(!e.path)s.path=t.path;else s.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path;s.path=e.scheme===void 0&&!o&&s.path[0]!=="/"?_O(s.path):pc(s.path)}s.query=t.query}s.userinfo=e.userinfo,s.host=e.host,s.port=e.port}s.scheme=e.scheme}return s.fragment=t.fragment,s}function cU(e,t,n){let r=jO(e,n),s=jO(t,n);return r!==void 0&&s!==void 0&&r===s}function Go(e,t){let n={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},r=Object.assign({},t),s=[];if(n.scheme)n.scheme=EO(n.scheme);let o=Qx(r.scheme||n.scheme);if(o&&o.serialize)o.serialize(n,r);let i=n.userinfo!==void 0||n.host!==void 0||n.port!==void 0,a=(n.scheme===void 0||r.reference==="suffix")&&!i,l=!r.skipEscape&&a;if(n.path!==void 0)if(!r.skipEscape)n.path=wO(n.path,l);else n.path=Zx(n.path);if(r.reference!=="suffix"&&n.scheme)n.scheme=EO(n.scheme),s.push(n.scheme,":");let c=eU(n);if(c!==void 0){if(r.reference!=="suffix")s.push("//");if(s.push(c),n.path&&n.path[0]!=="/")s.push("/")}if(n.path!==void 0){let u=n.path;if(!r.absolutePath&&(!o||!o.absolutePath))u=a&&u[0]!=="/"?_O(u):pc(u);if(a)u=wO(u,!0);if(c===void 0&&u[0]==="/"&&u[1]==="/")u="/%2F"+u.slice(2);s.push(u)}if(n.query!==void 0)s.push("?",nU(n.query));if(n.fragment!==void 0)s.push("#",rU(n.fragment));return s.join("")}var uU=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,fU=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,dU=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function pU(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof e.port==="number"&&(e.port<0||e.port>65535))return"URI port is malformed.";return}function dc(e){if(e===void 0)return!1;let t=e.indexOf("%");while(t!==-1){if(t+2>=e.length||!/^[\da-f]{2}$/iu.test(e.slice(t+1,t+3)))return!0;t=e.indexOf("%",t+3)}return!1}function Ad(e){return e[0]==="["&&e[e.length-1]==="]"}function mU(e){let t=e[4];return dc(e[3])||t!==void 0&&!Ad(t)&&dc(t)||dc(e[6])||dc(e[7])||dc(e[8])}function RO(e,t,n,r){if(NO(e,t,n,r))return e.error=e.error||"URI host is malformed.",!0;if(!t.unicodeSupport&&(!n||!n.unicodeSupport)&&e.host&&!Ad(e.host)&&(t.domainHost||n&&n.domainHost)&&r===!1&&oU(e.host)){let s;try{s=new URL("http://"+e.host)}catch(o){return e.error=e.error||"Host's domain name can not be converted to ASCII: "+o,!0}if(!hU(s))return e.error=e.error||"URI host is malformed.",!0;e.host=s.hostname}return!1}function NO(e,t,n,r){return Boolean(e.host&&r===!1&&!Ad(e.host)&&(t.domainHost||n&&n.domainHost)&&iU.test(e.host))}function hU(e){return e.username===""&&e.password===""&&e.port===""&&e.pathname==="/"&&e.search===""&&e.hash===""&&e.hostname!==""}function kd(e,t){let n=Object.assign({},t),r={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},s=!1,o=!1,i=!1,a=!1,l=!1,c=!1,u=!1;if(n.reference==="suffix")if(n.scheme)e=n.scheme+":"+e;else e="//"+e;let d=e.match(fU);if(d!==null&&d[1].indexOf("\\")!==-1)r.error="URI authority must not contain a literal backslash.",s=!0;let p=e.match(dU);if(p!==null){let y=p[1],S=y.replace(/[\t\n\r]/g,"");if(S.length>=2){if(S.slice(0,2)!=="//")r.error=r.error||"URI authority must not contain a literal backslash.",s=!0;else if(y.length!==S.length)r.error=r.error||"URI authority introducer must not contain whitespace.",s=!0}}let m=e.match(uU);if(m){if(r.scheme=m[1],r.userinfo=m[3],r.host=m[4],r.port=parseInt(m[5],10),r.path=m[6]||"",r.query=m[7],r.fragment=m[8],r.scheme!==void 0)if(AO.test(r.scheme))r.scheme=r.scheme.toLowerCase();else r.error=r.error||"URI scheme is malformed.",c=!0;if(o=mU(m),o)r.error=r.error||"URI contains malformed percent-encoding.";if(isNaN(r.port))r.port=m[5];let y=pU(r,m);if(y!==void 0)r.error=r.error||y,s=!0;if(r.host)if(kO(r.host)===!1){let x=Ad(r.host),P=r.host.indexOf("[")!==-1||r.host.indexOf("]")!==-1,w=PO(r.host);if(u=w.isIPV6||w.isIPVFuture===!0,l=P&&(!x||w.error===!0),r.host=u?w.host:w.host.toLowerCase(),l)r.error=r.error||"URI host is malformed.",s=!0}else u=!0;if(r.scheme===void 0&&r.userinfo===void 0&&r.host===void 0&&r.port===void 0&&r.query===void 0&&!r.path)r.reference="same-document";else if(r.scheme===void 0)r.reference="relative";else if(r.fragment===void 0)r.reference="absolute";else r.reference="uri";if(n.reference&&n.reference!=="suffix"&&n.reference!==r.reference)r.error=r.error||"URI is not a "+n.reference+" reference.";let S=Qx(n.scheme||r.scheme);if(!l)a=RO(r,n,S,u);if(e.indexOf("%")!==-1&&r.host!==void 0&&!l){let g=u?r.host:Zx(r.host,!0);if(!u)g=Zx(g.toLowerCase());r.host=u||n.scheme!=="null"?sU(g,u):g}if(!S||S&&!S.skipNormalize){if(r.path)r.path=tU(r.path);if(r.query)r.query=vO(r.query);if(r.fragment)r.fragment=vO(r.fragment)}if(S&&S.parse){if(S.parse(r,n),S===OO.urn&&r.nid===void 0)i=!0}}else r.error=r.error||"URI can not be parsed.";return{parsed:r,malformedAuthorityOrPort:s,malformedPercentEncoding:o,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:c}}function Od(e,t){return kd(e,t).parsed}function gU(e,t){return TO(e,t).normalized}function TO(e,t){let{parsed:n,malformedAuthorityOrPort:r,malformedPercentEncoding:s,malformedSchemeSpecific:o,malformedHost:i,malformedScheme:a}=kd(e,t);return{normalized:r||s||o||i||a?e:Go(n,t),malformedAuthorityOrPort:r,malformedPercentEncoding:s,malformedSchemeSpecific:o,malformedHost:i,malformedScheme:a}}function jO(e,t){if(typeof e!=="string"&&typeof e!=="object")return;let n;try{n=typeof e==="string"?e:Go(e,t)}catch{return}let{normalized:r,malformedAuthorityOrPort:s,malformedPercentEncoding:o,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:l}=TO(n,t);return s||o||i||a||l?void 0:r}var eb={SCHEMES:OO,normalize:aU,resolve:lU,resolveComponent:CO,equal:cU,serialize:Go,parse:Od};Cd.exports=eb;Cd.exports.default=eb;Cd.exports.fastUri=eb});var DO=W(function(IO){Object.defineProperty(IO,"__esModule",{value:!0});var MO=JO();MO.code='require("ajv/dist/runtime/uri").default';IO.default=MO});var nb=W(function(xs){Object.defineProperty(xs,"__esModule",{value:!0});xs.CodeGen=xs.Name=xs.nil=xs.stringify=xs.str=xs._=xs.KeywordCxt=void 0;var xU=ua();Object.defineProperty(xs,"KeywordCxt",{enumerable:!0,get:function(){return xU.KeywordCxt}});var ma=$e();Object.defineProperty(xs,"_",{enumerable:!0,get:function(){return ma._}});Object.defineProperty(xs,"str",{enumerable:!0,get:function(){return ma.str}});Object.defineProperty(xs,"stringify",{enumerable:!0,get:function(){return ma.stringify}});Object.defineProperty(xs,"nil",{enumerable:!0,get:function(){return ma.nil}});Object.defineProperty(xs,"Name",{enumerable:!0,get:function(){return ma.Name}});Object.defineProperty(xs,"CodeGen",{enumerable:!0,get:function(){return ma.CodeGen}});var bU=cc(),HO=da(),WO=Cx(),Ir=fc(),BO=$e(),Dr=lc(),Gs=ac(),pa=Oe(),LO=lO(),$U=DO(),UO=(e,t)=>new RegExp(e,t);UO.code="new RegExp";var SU=["removeAdditional","useDefaults","coerceTypes"],wU=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),vU={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},EU={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},FO=200;function jU(e){var t,n,r,s,o,i,a,l,c,u,d,p,m,y,S,g,x,P,w,E,j,A,T,I,V;let H=e.strict,O=(t=e.code)===null||t===void 0?void 0:t.optimize,N=O===!0||O===void 0?1:O||0,G=(r=(n=e.code)===null||n===void 0?void 0:n.regExp)!==null&&r!==void 0?r:UO,Q=(s=e.uriResolver)!==null&&s!==void 0?s:$U.default;return{strictSchema:(i=(o=e.strictSchema)!==null&&o!==void 0?o:H)!==null&&i!==void 0?i:!0,strictNumbers:(l=(a=e.strictNumbers)!==null&&a!==void 0?a:H)!==null&&l!==void 0?l:!0,strictTypes:(u=(c=e.strictTypes)!==null&&c!==void 0?c:H)!==null&&u!==void 0?u:"log",strictTuples:(p=(d=e.strictTuples)!==null&&d!==void 0?d:H)!==null&&p!==void 0?p:"log",strictRequired:(y=(m=e.strictRequired)!==null&&m!==void 0?m:H)!==null&&y!==void 0?y:!1,code:e.code?{...e.code,optimize:N,regExp:G}:{optimize:N,regExp:G},loopRequired:(S=e.loopRequired)!==null&&S!==void 0?S:FO,loopEnum:(g=e.loopEnum)!==null&&g!==void 0?g:FO,meta:(x=e.meta)!==null&&x!==void 0?x:!0,messages:(P=e.messages)!==null&&P!==void 0?P:!0,inlineRefs:(w=e.inlineRefs)!==null&&w!==void 0?w:!0,schemaId:(E=e.schemaId)!==null&&E!==void 0?E:"$id",addUsedSchema:(j=e.addUsedSchema)!==null&&j!==void 0?j:!0,validateSchema:(A=e.validateSchema)!==null&&A!==void 0?A:!0,validateFormats:(T=e.validateFormats)!==null&&T!==void 0?T:!0,unicodeRegExp:(I=e.unicodeRegExp)!==null&&I!==void 0?I:!0,int32range:(V=e.int32range)!==null&&V!==void 0?V:!0,uriResolver:Q}}class Rd{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...jU(e)};let{es5:t,lines:n}=this.opts.code;this.scope=new BO.ValueScope({scope:{},prefixes:wU,es5:t,lines:n}),this.logger=CU(e.logger);let r=e.validateFormats;if(e.validateFormats=!1,this.RULES=WO.getRules(),VO.call(this,vU,e,"NOT SUPPORTED"),VO.call(this,EU,e,"DEPRECATED","warn"),this._metaOpts=OU.call(this),e.formats)_U.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords)kU.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);PU.call(this),e.validateFormats=r}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:n}=this.opts,r=LO;if(n==="id")r={...LO},r.id=r.$id,delete r.$id;if(t&&e)this.addMetaSchema(r,r[n],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[t]||e:void 0}validate(e,t){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let r=n(t);if(!("$async"in n))this.errors=n.errors;return r}compile(e,t){let n=this._addSchema(e,t);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,t){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return r.call(this,e,t);async function r(c,u){await s.call(this,c.$schema);let d=this._addSchema(c,u);return d.validate||o.call(this,d)}async function s(c){if(c&&!this.getSchema(c))await r.call(this,{$ref:c},!0)}async function o(c){try{return this._compileSchemaEnv(c)}catch(u){if(!(u instanceof HO.default))throw u;return i.call(this,u),await a.call(this,u.missingSchema),o.call(this,c)}}function i({missingSchema:c,missingRef:u}){if(this.refs[c])throw Error(`AnySchema ${c} is loaded but ${u} cannot be resolved`)}async function a(c){let u=await l.call(this,c);if(!this.refs[c])await s.call(this,u.$schema);if(!this.refs[c])this.addSchema(u,c,t)}async function l(c){let u=this._loading[c];if(u)return u;try{return await(this._loading[c]=n(c))}finally{delete this._loading[c]}}}addSchema(e,t,n,r=this.opts.validateSchema){if(Array.isArray(e)){for(let o of e)this.addSchema(o,void 0,n,r);return this}let s;if(typeof e==="object"){let{schemaId:o}=this.opts;if(s=e[o],s!==void 0&&typeof s!="string")throw Error(`schema ${o} must be string`)}return t=Dr.normalizeId(t||s),this._checkUnique(t),this.schemas[t]=this._addSchema(e,n,t,r,!0),this}addMetaSchema(e,t,n=this.opts.validateSchema){return this.addSchema(e,t,!0,n),this}validateSchema(e,t){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let r=this.validate(n,e);if(!r&&t){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw Error(s)}return r}getSchema(e){let t;while(typeof(t=qO.call(this,e))=="string")e=t;if(t===void 0){let{schemaId:n}=this.opts,r=new Ir.SchemaEnv({schema:{},schemaId:n});if(t=Ir.resolveSchema.call(this,r,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let t=qO.call(this,e);if(typeof t=="object")this._cache.delete(t.schema);return delete this.schemas[e],delete this.refs[e],this}case"object":{let t=e;this._cache.delete(t);let n=e[this.opts.schemaId];if(n)n=Dr.normalizeId(n),delete this.schemas[n],delete this.refs[n];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let n;if(typeof e=="string"){if(n=e,typeof t=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=n}else if(typeof e=="object"&&t===void 0){if(t=e,n=t.keyword,Array.isArray(n)&&!n.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(NU.call(this,n,t),!t)return pa.eachItem(n,(s)=>tb.call(this,s)),this;JU.call(this,t);let r={...t,type:Gs.getJSONTypes(t.type),schemaType:Gs.getJSONTypes(t.schemaType)};return pa.eachItem(n,r.type.length===0?(s)=>tb.call(this,s,r):(s)=>r.type.forEach((o)=>tb.call(this,s,r,o))),this}getKeyword(e){let t=this.RULES.all[e];return typeof t=="object"?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(let n of t.rules){let r=n.rules.findIndex((s)=>s.keyword===e);if(r>=0)n.rules.splice(r,1)}return this}addFormat(e,t){if(typeof t=="string")t=new RegExp(t);return this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:n="data"}={}){if(!e||e.length===0)return"No errors";return e.map((r)=>`${n}${r.instancePath} ${r.message}`).reduce((r,s)=>r+t+s)}$dataMetaSchema(e,t){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let r of t){let s=r.split("/").slice(1),o=e;for(let i of s)o=o[i];for(let i in n){let a=n[i];if(typeof a!="object")continue;let{$data:l}=a.definition,c=o[i];if(l&&c)o[i]=zO(c)}}return e}_removeAllSchemas(e,t){for(let n in e){let r=e[n];if(!t||t.test(n)){if(typeof r=="string")delete e[n];else if(r&&!r.meta)this._cache.delete(r.schema),delete e[n]}}}_addSchema(e,t,n,r=this.opts.validateSchema,s=this.opts.addUsedSchema){let o,{schemaId:i}=this.opts;if(typeof e=="object")o=e[i];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof e!="boolean")throw Error("schema must be object or boolean");let a=this._cache.get(e);if(a!==void 0)return a;n=Dr.normalizeId(o||n);let l=Dr.getSchemaRefs.call(this,e,n);if(a=new Ir.SchemaEnv({schema:e,schemaId:i,meta:t,baseId:n,localRefs:l}),this._cache.set(a.schema,a),s&&!n.startsWith("#")){if(n)this._checkUnique(n);this.refs[n]=a}if(r)this.validateSchema(e,!0);return a}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta)this._compileMetaSchema(e);else Ir.compileSchema.call(this,e);if(!e.validate)throw Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{Ir.compileSchema.call(this,e)}finally{this.opts=t}}}Rd.ValidationError=bU.default;Rd.MissingRefError=HO.default;xs.default=Rd;function VO(e,t,n,r="error"){for(let s in e){let o=s;if(o in t)this.logger[r](`${n}: option ${s}. ${e[o]}`)}}function qO(e){return e=Dr.normalizeId(e),this.schemas[e]||this.refs[e]}function PU(){let e=this.opts.schemas;if(!e)return;if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function _U(){for(let e in this.opts.formats){let t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function kU(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let n=e[t];if(!n.keyword)n.keyword=t;this.addKeyword(n)}}function OU(){let e={...this.opts};for(let t of SU)delete e[t];return e}var AU={log(){},warn(){},error(){}};function CU(e){if(e===!1)return AU;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw Error("logger must implement log, warn and error methods")}var RU=/^[a-z_$][a-z0-9_$:-]*$/i;function NU(e,t){let{RULES:n}=this;if(pa.eachItem(e,(r)=>{if(n.keywords[r])throw Error(`Keyword ${r} is already defined`);if(!RU.test(r))throw Error(`Keyword ${r} has invalid name`)}),!t)return;if(t.$data&&!(("code"in t)||("validate"in t)))throw Error('$data keyword must have "code" or "validate" function')}function tb(e,t,n){var r;let s=t===null||t===void 0?void 0:t.post;if(n&&s)throw Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,i=s?o.post:o.rules.find(({type:l})=>l===n);if(!i)i={type:n,rules:[]},o.rules.push(i);if(o.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:Gs.getJSONTypes(t.type),schemaType:Gs.getJSONTypes(t.schemaType)}};if(t.before)TU.call(this,i,a,t.before);else i.rules.push(a);o.all[e]=a,(r=t.implements)===null||r===void 0||r.forEach((l)=>this.addKeyword(l))}function TU(e,t,n){let r=e.rules.findIndex((s)=>s.keyword===n);if(r>=0)e.rules.splice(r,0,t);else e.rules.push(t),this.logger.warn(`rule ${n} is not defined`)}function JU(e){let{metaSchema:t}=e;if(t===void 0)return;if(e.$data&&this.opts.$data)t=zO(t);e.validateSchema=this.compile(t,!0)}var MU={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function zO(e){return{anyOf:[e,MU]}}});var GO=W(function(KO){Object.defineProperty(KO,"__esModule",{value:!0});var LU={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};KO.default=LU});var Md=W(function(YO){Object.defineProperty(YO,"__esModule",{value:!0});YO.callRef=YO.getValidate=void 0;var VU=da(),Td=Xn(),Ke=$e(),ha=Kn(),Jd=fc(),Xs=Oe(),qU={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:n,it:r}=e,{baseId:s,schemaEnv:o,validateName:i,opts:a,self:l}=r,{root:c}=o;if((n==="#"||n==="#/")&&s===c.baseId)return d();let u=Jd.resolveRef.call(l,c,s,n);if(u===void 0)throw new VU.default(r.opts.uriResolver,s,n);if(u instanceof Jd.SchemaEnv)return p(u);return m(u);function d(){if(o===c)return Nd(e,i,o,o.$async);let y=t.scopeValue("root",{ref:c});return Nd(e,Ke._`${y}.validate`,c,c.$async)}function p(y){let S=XO(e,y);Nd(e,S,y,y.$async)}function m(y){let S=t.scopeValue("schema",a.code.source===!0?{ref:y,code:Ke.stringify(y)}:{ref:y}),g=t.name("valid"),x=e.subschema({schema:y,dataTypes:[],schemaPath:Ke.nil,topSchemaRef:S,errSchemaPath:n},g);e.mergeEvaluated(x),e.ok(g)}}};function XO(e,t){let{gen:n}=e;return t.validate?n.scopeValue("validate",{ref:t.validate}):Ke._`${n.scopeValue("wrapper",{ref:t})}.validate`}YO.getValidate=XO;function Nd(e,t,n,r){let{gen:s,it:o}=e,{allErrors:i,schemaEnv:a,opts:l}=o,c=l.passContext?ha.default.this:Ke.nil;if(r)u();else d();function u(){if(!a.$async)throw Error("async schema referenced by sync schema");let y=s.let("valid");s.try(()=>{if(s.code(Ke._`await ${Td.callValidateCode(e,t,c)}`),m(t),!i)s.assign(y,!0)},(S)=>{if(s.if(Ke._`!(${S} instanceof ${o.ValidationError})`,()=>s.throw(S)),p(S),!i)s.assign(y,!1)}),e.ok(y)}function d(){e.result(Td.callValidateCode(e,t,c),()=>m(t),()=>p(t))}function p(y){let S=Ke._`${y}.errors`;s.assign(ha.default.vErrors,Ke._`${ha.default.vErrors} === null ? ${S} : ${ha.default.vErrors}.concat(${S})`),s.assign(ha.default.errors,Ke._`${ha.default.vErrors}.length`)}function m(y){var S;if(!o.opts.unevaluated)return;let g=(S=n===null||n===void 0?void 0:n.validate)===null||S===void 0?void 0:S.evaluated;if(o.props!==!0)if(g&&!g.dynamicProps){if(g.props!==void 0)o.props=Xs.mergeEvaluated.props(s,g.props,o.props)}else{let x=s.var("props",Ke._`${y}.evaluated.props`);o.props=Xs.mergeEvaluated.props(s,x,o.props,Ke.Name)}if(o.items!==!0)if(g&&!g.dynamicItems){if(g.items!==void 0)o.items=Xs.mergeEvaluated.items(s,g.items,o.items)}else{let x=s.var("items",Ke._`${y}.evaluated.items`);o.items=Xs.mergeEvaluated.items(s,x,o.items,Ke.Name)}}}YO.callRef=Nd;YO.default=qU});var rb=W(function(QO){Object.defineProperty(QO,"__esModule",{value:!0});var BU=GO(),UU=Md(),zU=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",BU.default,UU.default];QO.default=zU});var tA=W(function(eA){Object.defineProperty(eA,"__esModule",{value:!0});var Zs=$e(),Ys=Zs.operators,Id={maximum:{okStr:"<=",ok:Ys.LTE,fail:Ys.GT},minimum:{okStr:">=",ok:Ys.GTE,fail:Ys.LT},exclusiveMaximum:{okStr:"<",ok:Ys.LT,fail:Ys.GTE},exclusiveMinimum:{okStr:">",ok:Ys.GT,fail:Ys.LTE}},GU={message:({keyword:e,schemaCode:t})=>Zs.str`must be ${Id[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>Zs._`{comparison: ${Id[e].okStr}, limit: ${t}}`},XU={keyword:Object.keys(Id),type:"number",schemaType:"number",$data:!0,error:GU,code(e){let{keyword:t,data:n,schemaCode:r}=e;e.fail$data(Zs._`${n} ${Id[t].fail} ${r} || isNaN(${n})`)}};eA.default=XU});var rA=W(function(nA){Object.defineProperty(nA,"__esModule",{value:!0});var Lr=$e(),ZU={message:({schemaCode:e})=>Lr.str`must be multiple of ${e}`,params:({schemaCode:e})=>Lr._`{multipleOf: ${e}}`},QU={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:ZU,code(e){let{gen:t,data:n,schemaCode:r,it:s}=e,o=s.opts.multipleOfPrecision,i=t.let("res"),a=o?Lr._`Math.abs(Math.round(${i}) - ${i}) > 1e-${o}`:Lr._`${i} !== parseInt(${i})`;e.fail$data(Lr._`(${r} === 0 || (${i} = ${n}/${r}, ${a}))`)}};nA.default=QU});var iA=W(function(oA){Object.defineProperty(oA,"__esModule",{value:!0});function sA(e){let t=e.length,n=0,r=0,s;while(r<t)if(n++,s=e.charCodeAt(r++),s>=55296&&s<=56319&&r<t){if(s=e.charCodeAt(r),(s&64512)===56320)r++}return n}oA.default=sA;sA.code='require("ajv/dist/runtime/ucs2length").default'});var cA=W(function(lA){Object.defineProperty(lA,"__esModule",{value:!0});var Sn=$e(),aA=Oe(),nz=iA(),rz={message({keyword:e,schemaCode:t}){return Sn.str`must NOT have ${e==="maxLength"?"more":"fewer"} than ${t} characters`},params:({schemaCode:e})=>Sn._`{limit: ${e}}`},sz={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:rz,code(e){let{keyword:t,data:n,schemaCode:r,it:s}=e,o=t==="maxLength"?Sn.operators.GT:Sn.operators.LT,i=s.opts.unicode===!1?Sn._`${n}.length`:Sn._`${aA.useFunc(e.gen,nz.default)}(${n})`;e.fail$data(Sn._`${i} ${o} ${r}`)}};lA.default=sz});var pA=W(function(dA){Object.defineProperty(dA,"__esModule",{value:!0});var uA=Xn(),fA=Oe(),Yn=$e(),iz={message:({schemaCode:e})=>Yn.str`must match pattern "${e}"`,params:({schemaCode:e})=>Yn._`{pattern: ${e}}`},az={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:iz,code(e){let{gen:t,data:n,$data:r,schema:s,schemaCode:o,it:i}=e,a=i.opts.unicodeRegExp?"u":"";if(r){let{regExp:l}=i.opts.code,c=l.code==="new RegExp"?Yn._`new RegExp`:fA.useFunc(t,l),u=t.let("valid");t.try(()=>t.assign(u,Yn._`${c}(${o}, ${a}).test(${n})`),()=>t.assign(u,!1)),e.fail$data(Yn._`!${u}`)}else{let l=uA.usePattern(e,s);e.fail$data(Yn._`!${l}.test(${n})`)}}};dA.default=az});var hA=W(function(mA){Object.defineProperty(mA,"__esModule",{value:!0});var Fr=$e(),cz={message({keyword:e,schemaCode:t}){return Fr.str`must NOT have ${e==="maxProperties"?"more":"fewer"} than ${t} properties`},params:({schemaCode:e})=>Fr._`{limit: ${e}}`},uz={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:cz,code(e){let{keyword:t,data:n,schemaCode:r}=e,s=t==="maxProperties"?Fr.operators.GT:Fr.operators.LT;e.fail$data(Fr._`Object.keys(${n}).length ${s} ${r}`)}};mA.default=uz});var xA=W(function(yA){Object.defineProperty(yA,"__esModule",{value:!0});var Vr=Xn(),qr=$e(),gA=Oe(),dz={message:({params:{missingProperty:e}})=>qr.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>qr._`{missingProperty: ${e}}`},pz={keyword:"required",type:"object",schemaType:"array",$data:!0,error:dz,code(e){let{gen:t,schema:n,schemaCode:r,data:s,$data:o,it:i}=e,{opts:a}=i;if(!o&&n.length===0)return;let l=n.length>=a.loopRequired;if(i.allErrors)c();else u();if(a.strictRequired){let m=e.parentSchema.properties,{definedProperties:y}=e.it;for(let S of n)if((m===null||m===void 0?void 0:m[S])===void 0&&!y.has(S)){let g=i.schemaEnv.baseId+i.errSchemaPath,x=`required property "${S}" is not defined at "${g}" (strictRequired)`;gA.checkStrictMode(i,x,i.opts.strictRequired)}}function c(){if(l||o)e.block$data(qr.nil,d);else for(let m of n)Vr.checkReportMissingProp(e,m)}function u(){let m=t.let("missing");if(l||o){let y=t.let("valid",!0);e.block$data(y,()=>p(m,y)),e.ok(y)}else t.if(Vr.checkMissingProp(e,n,m)),Vr.reportMissingProp(e,m),t.else()}function d(){t.forOf("prop",r,(m)=>{e.setParams({missingProperty:m}),t.if(Vr.noPropertyInData(t,s,m,a.ownProperties),()=>e.error())})}function p(m,y){e.setParams({missingProperty:m}),t.forOf(m,r,()=>{t.assign(y,Vr.propertyInData(t,s,m,a.ownProperties)),t.if(qr.not(y),()=>{e.error(),t.break()})},qr.nil)}}};yA.default=pz});var $A=W(function(bA){Object.defineProperty(bA,"__esModule",{value:!0});var Hr=$e(),hz={message({keyword:e,schemaCode:t}){return Hr.str`must NOT have ${e==="maxItems"?"more":"fewer"} than ${t} items`},params:({schemaCode:e})=>Hr._`{limit: ${e}}`},gz={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:hz,code(e){let{keyword:t,data:n,schemaCode:r}=e,s=t==="maxItems"?Hr.operators.GT:Hr.operators.LT;e.fail$data(Hr._`${n}.length ${s} ${r}`)}};bA.default=gz});var Dd=W(function(wA){Object.defineProperty(wA,"__esModule",{value:!0});var SA=Dx();SA.code='require("ajv/dist/runtime/equal").default';wA.default=SA});var jA=W(function(EA){Object.defineProperty(EA,"__esModule",{value:!0});var ga=ac(),Te=$e(),vA=Oe(),bz=Dd(),$z={message:({params:{i:e,j:t}})=>Te.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>Te._`{i: ${e}, j: ${t}}`},Sz={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:$z,code(e){let{gen:t,data:n,$data:r,schema:s,parentSchema:o,schemaCode:i,it:a}=e;if(!r&&!s)return;let l=t.let("valid"),c=o.items?ga.getSchemaTypes(o.items):[];e.block$data(l,u,Te._`${i} === false`),e.ok(l);function u(){let y=t.let("i",Te._`${n}.length`),S=t.let("j");e.setParams({i:y,j:S}),t.assign(l,!0),t.if(Te._`${y} > 1`,()=>(d()?p:m)(y,S))}function d(){return c.length>0&&!c.some((y)=>y==="object"||y==="array")}function p(y,S){let g=t.name("item"),x=ga.checkDataTypes(c,g,a.opts.strictNumbers,ga.DataType.Wrong),P=t.const("indices",Te._`{}`);t.for(Te._`;${y}--;`,()=>{if(t.let(g,Te._`${n}[${y}]`),t.if(x,Te._`continue`),c.length>1)t.if(Te._`typeof ${g} == "string"`,Te._`${g} += "_"`);t.if(Te._`typeof ${P}[${g}] == "number"`,()=>{t.assign(S,Te._`${P}[${g}]`),e.error(),t.assign(l,!1).break()}).code(Te._`${P}[${g}] = ${y}`)})}function m(y,S){let g=vA.useFunc(t,bz.default),x=t.name("outer");t.label(x).for(Te._`;${y}--;`,()=>t.for(Te._`${S} = ${y}; ${S}--;`,()=>t.if(Te._`${g}(${n}[${y}], ${n}[${S}])`,()=>{e.error(),t.assign(l,!1).break(x)})))}}};EA.default=Sz});var kA=W(function(_A){Object.defineProperty(_A,"__esModule",{value:!0});var ya=$e(),PA=Oe(),vz=Dd(),Ez={message:"must be equal to constant",params:({schemaCode:e})=>ya._`{allowedValue: ${e}}`},jz={keyword:"const",$data:!0,error:Ez,code(e){let{gen:t,data:n,$data:r,schemaCode:s,schema:o}=e;if(r||o&&typeof o=="object")e.fail$data(ya._`!${PA.useFunc(t,vz.default)}(${n}, ${s})`);else e.fail(ya._`${o} !== ${n}`)}};_A.default=jz});var CA=W(function(AA){Object.defineProperty(AA,"__esModule",{value:!0});var Wr=$e(),OA=Oe(),_z=Dd(),kz={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>Wr._`{allowedValues: ${e}}`},Oz={keyword:"enum",schemaType:"array",$data:!0,error:kz,code(e){let{gen:t,data:n,$data:r,schema:s,schemaCode:o,it:i}=e;if(!r&&s.length===0)throw Error("enum must have non-empty array");let a=s.length>=i.opts.loopEnum,l,c=()=>l!==null&&l!==void 0?l:l=OA.useFunc(t,_z.default),u;if(a||r)u=t.let("valid"),e.block$data(u,d);else{if(!Array.isArray(s))throw Error("ajv implementation error");let m=t.const("vSchema",o);u=Wr.or(...s.map((y,S)=>p(m,S)))}e.pass(u);function d(){t.assign(u,!1),t.forOf("v",o,(m)=>t.if(Wr._`${c()}(${n}, ${m})`,()=>t.assign(u,!0).break()))}function p(m,y){let S=s[y];return typeof S==="object"&&S!==null?Wr._`${c()}(${n}, ${m}[${y}])`:Wr._`${n} === ${S}`}}};AA.default=Oz});var sb=W(function(RA){Object.defineProperty(RA,"__esModule",{value:!0});var Cz=tA(),Rz=rA(),Nz=cA(),Tz=pA(),Jz=hA(),Mz=xA(),Iz=$A(),Dz=jA(),Lz=kA(),Fz=CA(),Vz=[Cz.default,Rz.default,Nz.default,Tz.default,Jz.default,Mz.default,Iz.default,Dz.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Lz.default,Fz.default];RA.default=Vz});var ob=W(function(TA){Object.defineProperty(TA,"__esModule",{value:!0});TA.validateAdditionalItems=void 0;var wn=$e(),xa=Oe(),Hz={message:({params:{len:e}})=>wn.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>wn._`{limit: ${e}}`},Wz={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Hz,code(e){let{parentSchema:t,it:n}=e,{items:r}=t;if(!Array.isArray(r)){xa.checkStrictMode(n,'"additionalItems" is ignored when "items" is not an array of schemas');return}NA(e,r)}};function NA(e,t){let{gen:n,schema:r,data:s,keyword:o,it:i}=e;i.items=!0;let a=n.const("len",wn._`${s}.length`);if(r===!1)e.setParams({len:t.length}),e.pass(wn._`${a} <= ${t.length}`);else if(typeof r=="object"&&!xa.alwaysValidSchema(i,r)){let c=n.var("valid",wn._`${a} <= ${t.length}`);n.if(wn.not(c),()=>l(c)),e.ok(c)}function l(c){n.forRange("i",t.length,a,(u)=>{if(e.subschema({keyword:o,dataProp:u,dataPropType:xa.Type.Num},c),!i.allErrors)n.if(wn.not(c),()=>n.break())})}}TA.validateAdditionalItems=NA;TA.default=Wz});var ib=W(function(DA){Object.defineProperty(DA,"__esModule",{value:!0});DA.validateTuple=void 0;var Ld=$e(),Qs=Oe(),MA=Xn(),Uz={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:n}=e;if(Array.isArray(t))return IA(e,"additionalItems",t);if(n.items=!0,Qs.alwaysValidSchema(n,t))return;e.ok(MA.validateArray(e))}};function IA(e,t,n=e.schema){let{gen:r,parentSchema:s,data:o,keyword:i,it:a}=e;if(u(s),a.opts.unevaluated&&n.length&&a.items!==!0)a.items=Qs.mergeEvaluated.items(r,n.length,a.items);let l=r.name("valid"),c=r.const("len",Ld._`${o}.length`);n.forEach((d,p)=>{if(Qs.alwaysValidSchema(a,d))return;r.if(Ld._`${c} > ${p}`,()=>e.subschema({keyword:i,schemaProp:p,dataProp:p},l)),e.ok(l)});function u(d){let{opts:p,errSchemaPath:m}=a,y=n.length,S=y===d.minItems&&(y===d.maxItems||d[t]===!1);if(p.strictTuples&&!S){let g=`"${i}" is ${y}-tuple, but minItems or maxItems/${t} are not specified or different at path "${m}"`;Qs.checkStrictMode(a,g,p.strictTuples)}}}DA.validateTuple=IA;DA.default=Uz});var qA=W(function(VA){Object.defineProperty(VA,"__esModule",{value:!0});var FA=ib(),Kz={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(e)=>FA.validateTuple(e,"items")};VA.default=Kz});var zA=W(function(UA){Object.defineProperty(UA,"__esModule",{value:!0});var Fd=$e(),HA=Oe(),WA=Xn(),BA=ob(),Xz={message:({params:{len:e}})=>Fd.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Fd._`{limit: ${e}}`},Yz={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Xz,code(e){let{schema:t,parentSchema:n,it:r}=e,{prefixItems:s}=n;if(r.items=!0,HA.alwaysValidSchema(r,t))return;if(s)BA.validateAdditionalItems(e,s);else e.ok(WA.validateArray(e))}};UA.default=Yz});var GA=W(function(KA){Object.defineProperty(KA,"__esModule",{value:!0});var lt=$e(),eo=Oe(),Qz={message:({params:{min:e,max:t}})=>t===void 0?lt.str`must contain at least ${e} valid item(s)`:lt.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?lt._`{minContains: ${e}}`:lt._`{minContains: ${e}, maxContains: ${t}}`},e8={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Qz,code(e){let{gen:t,schema:n,parentSchema:r,data:s,it:o}=e,i,a,{minContains:l,maxContains:c}=r;if(o.opts.next)i=l===void 0?1:l,a=c;else i=1;let u=t.const("len",lt._`${s}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){eo.checkStrictMode(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){eo.checkStrictMode(o,'"minContains" > "maxContains" is always invalid'),e.fail();return}if(eo.alwaysValidSchema(o,n)){let S=lt._`${u} >= ${i}`;if(a!==void 0)S=lt._`${S} && ${u} <= ${a}`;e.pass(S);return}o.items=!0;let d=t.name("valid");if(a===void 0&&i===1)m(d,()=>t.if(d,()=>t.break()));else if(i===0){if(t.let(d,!0),a!==void 0)t.if(lt._`${s}.length > 0`,p)}else t.let(d,!1),p();e.result(d,()=>e.reset());function p(){let S=t.name("_valid"),g=t.let("count",0);m(S,()=>t.if(S,()=>y(g)))}function m(S,g){t.forRange("i",0,u,(x)=>{e.subschema({keyword:"contains",dataProp:x,dataPropType:eo.Type.Num,compositeRule:!0},S),g()})}function y(S){if(t.code(lt._`${S}++`),a===void 0)t.if(lt._`${S} >= ${i}`,()=>t.assign(d,!0).break());else if(t.if(lt._`${S} > ${a}`,()=>t.assign(d,!1).break()),i===1)t.assign(d,!0);else t.if(lt._`${S} >= ${i}`,()=>t.assign(d,!0))}}};KA.default=e8});var Vd=W(function(QA){Object.defineProperty(QA,"__esModule",{value:!0});QA.validateSchemaDeps=QA.validatePropertyDeps=QA.error=void 0;var ba=$e(),XA=Oe(),Br=Xn();QA.error={message:({params:{property:e,depsCount:t,deps:n}})=>ba.str`must have ${t===1?"property":"properties"} ${n} when property ${e} is present`,params:({params:{property:e,depsCount:t,deps:n,missingProperty:r}})=>ba._`{property: ${e},
|
|
621
634
|
missingProperty: ${r},
|
|
622
635
|
depsCount: ${t},
|
|
623
|
-
deps: ${n}}`};var MH={keyword:"dependencies",type:"object",schemaType:"object",error:jk.error,code(e){let[t,n]=DH(e);vk(e,t),Ek(e,n)}};function DH({schema:e}){let t={},n={};for(let r in e){if(r==="__proto__")continue;let s=Array.isArray(e[r])?t:n;s[r]=e[r]}return[t,n]}function vk(e,t=e.schema){let{gen:n,data:r,it:s}=e;if(Object.keys(t).length===0)return;let o=n.let("missing");for(let i in t){let a=t[i];if(a.length===0)continue;let c=kr.propertyInData(n,r,i,s.opts.ownProperties);if(e.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),s.allErrors)n.if(c,()=>{for(let l of a)kr.checkReportMissingProp(e,l)});else n.if(oa._`${c} && (${kr.checkMissingProp(e,a,o)})`),kr.reportMissingProp(e,o),n.else()}}jk.validatePropertyDeps=vk;function Ek(e,t=e.schema){let{gen:n,data:r,keyword:s,it:o}=e,i=n.name("valid");for(let a in t){if(Sk.alwaysValidSchema(o,t[a]))continue;n.if(kr.propertyInData(n,r,a,o.opts.ownProperties),()=>{let c=e.subschema({keyword:s,schemaProp:a},i);e.mergeValidEvaluated(c,i)},()=>n.var(i,!0)),e.ok(i)}}jk.validateSchemaDeps=Ek;jk.default=MH});var Ak=W(function(Ok){Object.defineProperty(Ok,"__esModule",{value:!0});var _f=ge(),kk=ke(),VH={message:"property name must be valid",params:({params:e})=>_f._`{propertyName: ${e.propertyName}}`},qH={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:VH,code(e){let{gen:t,schema:n,data:r,it:s}=e;if(kk.alwaysValidSchema(s,n))return;let o=t.name("valid");t.forIn("key",r,(i)=>{e.setParams({propertyName:i}),e.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},o),t.if(_f.not(o),()=>{if(e.error(!0),!s.allErrors)t.break()})}),e.ok(o)}};Ok.default=qH});var og=W(function(Rk){Object.defineProperty(Rk,"__esModule",{value:!0});var qs=Fn(),ft=ge(),HH=Mn(),Ws=ke(),UH={message:"must NOT have additional properties",params:({params:e})=>ft._`{additionalProperty: ${e.additionalProperty}}`},BH={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:UH,code(e){let{gen:t,schema:n,parentSchema:r,data:s,errsCount:o,it:i}=e;if(!o)throw Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&Ws.alwaysValidSchema(i,n))return;let l=qs.allSchemaProperties(r.properties),u=qs.allSchemaProperties(r.patternProperties);d(),e.ok(ft._`${o} === ${HH.default.errors}`);function d(){t.forIn("key",s,(g)=>{if(!l.length&&!u.length)x(g);else t.if(p(g),()=>x(g))})}function p(g){let b;if(l.length>8){let j=Ws.schemaRefOrVal(i,r.properties,"properties");b=qs.isOwnProperty(t,j,g)}else if(l.length)b=ft.or(...l.map((j)=>ft._`${g} === ${j}`));else b=ft.nil;if(u.length)b=ft.or(b,...u.map((j)=>ft._`${qs.usePattern(e,j)}.test(${g})`));return ft.not(b)}function m(g){t.code(ft._`delete ${s}[${g}]`)}function x(g){if(c.removeAdditional==="all"||c.removeAdditional&&n===!1){m(g);return}if(n===!1){if(e.setParams({additionalProperty:g}),e.error(),!a)t.break();return}if(typeof n=="object"&&!Ws.alwaysValidSchema(i,n)){let b=t.name("valid");if(c.removeAdditional==="failing")h(g,b,!1),t.if(ft.not(b),()=>{e.reset(),m(g)});else if(h(g,b),!a)t.if(ft.not(b),()=>t.break())}}function h(g,b,j){let v={keyword:"additionalProperties",dataProp:g,dataPropType:Ws.Type.Str};if(j===!1)Object.assign(v,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(v,b)}}};Rk.default=BH});var Jk=W(function(Tk){Object.defineProperty(Tk,"__esModule",{value:!0});var Nk=Xi(),kf=Fn(),ia=ke(),Ck=og(),KH={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:n,parentSchema:r,data:s,it:o}=e;if(o.opts.removeAdditional==="all"&&r.additionalProperties===void 0)Ck.default.code(new Nk.KeywordCxt(o,Ck.default,"additionalProperties"));let i=kf.allSchemaProperties(n);for(let d of i)o.definedProperties.add(d);if(o.opts.unevaluated&&i.length&&o.props!==!0)o.props=ia.mergeEvaluated.props(t,ia.toHash(i),o.props);let a=i.filter((d)=>!ia.alwaysValidSchema(o,n[d]));if(a.length===0)return;let c=t.name("valid");for(let d of a){if(l(d))u(d);else{if(t.if(kf.propertyInData(t,s,d,o.opts.ownProperties)),u(d),!o.allErrors)t.else().var(c,!0);t.endIf()}e.it.definedProperties.add(d),e.ok(c)}function l(d){return o.opts.useDefaults&&!o.compositeRule&&n[d].default!==void 0}function u(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};Tk.default=KH});var Mk=W(function(Ik){Object.defineProperty(Ik,"__esModule",{value:!0});var Of=Fn(),Hs=ge(),Af=ke(),Rf=ke(),XH={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:n,data:r,parentSchema:s,it:o}=e,{opts:i}=o,a=Of.allSchemaProperties(n),c=a.filter((h)=>Af.alwaysValidSchema(o,n[h]));if(a.length===0||c.length===a.length&&(!o.opts.unevaluated||o.props===!0))return;let l=i.strictSchema&&!i.allowMatchingProperties&&s.properties,u=t.name("valid");if(o.props!==!0&&!(o.props instanceof Hs.Name))o.props=Rf.evaluatedPropsToName(t,o.props);let{props:d}=o;p();function p(){for(let h of a){if(l)m(h);if(o.allErrors)x(h);else t.var(u,!0),x(h),t.if(u)}}function m(h){for(let g in l)if(new RegExp(h).test(g))Af.checkStrictMode(o,`property ${g} matches pattern ${h} (use allowMatchingProperties)`)}function x(h){t.forIn("key",r,(g)=>{t.if(Hs._`${Of.usePattern(e,h)}.test(${g})`,()=>{let b=c.includes(h);if(!b)e.subschema({keyword:"patternProperties",schemaProp:h,dataProp:g,dataPropType:Rf.Type.Str},u);if(o.opts.unevaluated&&d!==!0)t.assign(Hs._`${d}[${g}]`,!0);else if(!b&&!o.allErrors)t.if(Hs.not(u),()=>t.break())})})}}};Ik.default=XH});var Lk=W(function(Fk){Object.defineProperty(Fk,"__esModule",{value:!0});var Dk=ke(),ZH={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:n,it:r}=e;if(Dk.alwaysValidSchema(r,n)){e.fail();return}let s=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},s),e.failResult(s,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};Fk.default=ZH});var Wk=W(function(qk){Object.defineProperty(qk,"__esModule",{value:!0});var Vk=Fn(),eU={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Vk.validateUnion,error:{message:"must match a schema in anyOf"}};qk.default=eU});var Bk=W(function(Uk){Object.defineProperty(Uk,"__esModule",{value:!0});var Us=ge(),Hk=ke(),nU={message:"must match exactly one schema in oneOf",params:({params:e})=>Us._`{passingSchemas: ${e.passing}}`},rU={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:nU,code(e){let{gen:t,schema:n,parentSchema:r,it:s}=e;if(!Array.isArray(n))throw Error("ajv implementation error");if(s.opts.discriminator&&r.discriminator)return;let o=n,i=t.let("valid",!1),a=t.let("passing",null),c=t.name("_valid");e.setParams({passing:a}),t.block(l),e.result(i,()=>e.reset(),()=>e.error(!0));function l(){o.forEach((u,d)=>{let p;if(Hk.alwaysValidSchema(s,u))t.var(c,!0);else p=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c);if(d>0)t.if(Us._`${c} && ${i}`).assign(i,!1).assign(a,Us._`[${a}, ${d}]`).else();t.if(c,()=>{if(t.assign(i,!0),t.assign(a,d),p)e.mergeEvaluated(p,Us.Name)})})}}};Uk.default=rU});var Gk=W(function(Kk){Object.defineProperty(Kk,"__esModule",{value:!0});var zk=ke(),oU={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:n,it:r}=e;if(!Array.isArray(n))throw Error("ajv implementation error");let s=t.name("valid");n.forEach((o,i)=>{if(zk.alwaysValidSchema(r,o))return;let a=e.subschema({keyword:"allOf",schemaProp:i},s);e.ok(s),e.mergeEvaluated(a)})}};Kk.default=oU});var Zk=W(function(Yk){Object.defineProperty(Yk,"__esModule",{value:!0});var Bs=ge(),Cf=ke(),aU={message:({params:e})=>Bs.str`must match "${e.ifClause}" schema`,params:({params:e})=>Bs._`{failingKeyword: ${e.ifClause}}`},cU={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:aU,code(e){let{gen:t,parentSchema:n,it:r}=e;if(n.then===void 0&&n.else===void 0)Cf.checkStrictMode(r,'"if" without "then" and "else" is ignored');let s=Xk(r,"then"),o=Xk(r,"else");if(!s&&!o)return;let i=t.let("valid",!0),a=t.name("_valid");if(c(),e.reset(),s&&o){let u=t.let("ifClause");e.setParams({ifClause:u}),t.if(a,l("then",u),l("else",u))}else if(s)t.if(a,l("then"));else t.if(Bs.not(a),l("else"));e.pass(i,()=>e.error(!0));function c(){let u=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(u)}function l(u,d){return()=>{let p=e.subschema({keyword:u},a);if(t.assign(i,a),e.mergeValidEvaluated(p,i),d)t.assign(d,Bs._`${u}`);else e.setParams({ifClause:u})}}}};function Xk(e,t){let n=e.schema[t];return n!==void 0&&!Cf.alwaysValidSchema(e,n)}Yk.default=cU});var tO=W(function(eO){Object.defineProperty(eO,"__esModule",{value:!0});var Qk=ke(),uU={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:n}){if(t.if===void 0)Qk.checkStrictMode(n,`"${e}" without "if" is ignored`)}};eO.default=uU});var ig=W(function(nO){Object.defineProperty(nO,"__esModule",{value:!0});var dU=rg(),pU=mk(),mU=sg(),hU=bk(),gU=wk(),yU=Pf(),xU=Ak(),bU=og(),$U=Jk(),wU=Mk(),SU=Lk(),vU=Wk(),EU=Bk(),jU=Gk(),PU=Zk(),_U=tO();function kU(e=!1){let t=[SU.default,vU.default,EU.default,jU.default,PU.default,_U.default,xU.default,bU.default,yU.default,$U.default,wU.default];if(e)t.push(pU.default,hU.default);else t.push(dU.default,mU.default);return t.push(gU.default),t}nO.default=kU});var ag=W(function(oO){Object.defineProperty(oO,"__esModule",{value:!0});oO.dynamicAnchor=void 0;var aa=ge(),AU=Mn(),Nf=Oc(),rO=wf(),RU={keyword:"$dynamicAnchor",schemaType:"string",code:(e)=>sO(e,e.schema)};function sO(e,t){let{gen:n,it:r}=e;r.schemaEnv.root.dynamicAnchors[t]=!0;let s=aa._`${AU.default.dynamicAnchors}${aa.getProperty(t)}`,o=r.errSchemaPath==="#"?r.validateName:CU(e);n.if(aa._`!${s}`,()=>n.assign(s,o))}oO.dynamicAnchor=sO;function CU(e){let{schemaEnv:t,schema:n,self:r}=e.it,{root:s,baseId:o,localRefs:i,meta:a}=t.root,{schemaId:c}=r.opts,l=new Nf.SchemaEnv({schema:n,schemaId:c,root:s,baseId:o,localRefs:i,meta:a});return Nf.compileSchema.call(r,l),rO.getValidate(e,l)}oO.default=RU});var cg=W(function(cO){Object.defineProperty(cO,"__esModule",{value:!0});cO.dynamicRef=void 0;var Tf=ge(),TU=Mn(),Jf=wf(),JU={keyword:"$dynamicRef",schemaType:"string",code:(e)=>aO(e,e.schema)};function aO(e,t){let{gen:n,keyword:r,it:s}=e;if(t[0]!=="#")throw Error(`"${r}" only supports hash fragment reference`);let o=t.slice(1);if(s.allErrors)i();else{let c=n.let("valid",!1);i(c),e.ok(c)}function i(c){if(s.schemaEnv.root.dynamicAnchors[o]){let l=n.let("_v",Tf._`${TU.default.dynamicAnchors}${Tf.getProperty(o)}`);n.if(l,a(l,c),a(s.validateName,c))}else a(s.validateName,c)()}function a(c,l){return l?()=>n.block(()=>{Jf.callRef(e,c),n.let(l,!0)}):()=>Jf.callRef(e,c)}}cO.dynamicRef=aO;cO.default=JU});var pO=W(function(dO){Object.defineProperty(dO,"__esModule",{value:!0});var uO=ag(),fO=ke(),MU={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){if(e.schema)uO.dynamicAnchor(e,"");else fO.checkStrictMode(e.it,"$recursiveAnchor: false is ignored")}};dO.default=MU});var gO=W(function(hO){Object.defineProperty(hO,"__esModule",{value:!0});var mO=cg(),FU={keyword:"$recursiveRef",schemaType:"string",code:(e)=>mO.dynamicRef(e,e.schema)};hO.default=FU});var xO=W(function(yO){Object.defineProperty(yO,"__esModule",{value:!0});var VU=ag(),qU=cg(),WU=pO(),HU=gO(),UU=[VU.default,qU.default,WU.default,HU.default];yO.default=UU});var $O=W(function(bO){Object.defineProperty(bO,"__esModule",{value:!0});var If=Pf(),zU={keyword:"dependentRequired",type:"object",schemaType:"object",error:If.error,code:(e)=>If.validatePropertyDeps(e)};bO.default=zU});var vO=W(function(SO){Object.defineProperty(SO,"__esModule",{value:!0});var wO=Pf(),GU={keyword:"dependentSchemas",type:"object",schemaType:"object",code:(e)=>wO.validateSchemaDeps(e)};SO.default=GU});var PO=W(function(jO){Object.defineProperty(jO,"__esModule",{value:!0});var EO=ke(),YU={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:e,parentSchema:t,it:n}){if(t.contains===void 0)EO.checkStrictMode(n,`"${e}" without "contains" is ignored`)}};jO.default=YU});var kO=W(function(_O){Object.defineProperty(_O,"__esModule",{value:!0});var QU=$O(),eB=vO(),tB=PO(),nB=[QU.default,eB.default,tB.default];_O.default=nB});var AO=W(function(OO){Object.defineProperty(OO,"__esModule",{value:!0});var Wt=ge(),Mf=ke(),sB=Mn(),oB={message:"must NOT have unevaluated properties",params:({params:e})=>Wt._`{unevaluatedProperty: ${e.unevaluatedProperty}}`},iB={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:oB,code(e){let{gen:t,schema:n,data:r,errsCount:s,it:o}=e;if(!s)throw Error("ajv implementation error");let{allErrors:i,props:a}=o;if(a instanceof Wt.Name)t.if(Wt._`${a} !== true`,()=>t.forIn("key",r,(d)=>t.if(l(a,d),()=>c(d))));else if(a!==!0)t.forIn("key",r,(d)=>a===void 0?c(d):t.if(u(a,d),()=>c(d)));o.props=!0,e.ok(Wt._`${s} === ${sB.default.errors}`);function c(d){if(n===!1){if(e.setParams({unevaluatedProperty:d}),e.error(),!i)t.break();return}if(!Mf.alwaysValidSchema(o,n)){let p=t.name("valid");if(e.subschema({keyword:"unevaluatedProperties",dataProp:d,dataPropType:Mf.Type.Str},p),!i)t.if(Wt.not(p),()=>t.break())}}function l(d,p){return Wt._`!${d} || !${d}[${p}]`}function u(d,p){let m=[];for(let x in d)if(d[x]===!0)m.push(Wt._`${p} !== ${x}`);return Wt.and(...m)}}};OO.default=iB});var CO=W(function(RO){Object.defineProperty(RO,"__esModule",{value:!0});var pn=ge(),Df=ke(),cB={message:({params:{len:e}})=>pn.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>pn._`{limit: ${e}}`},lB={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:cB,code(e){let{gen:t,schema:n,data:r,it:s}=e,o=s.items||0;if(o===!0)return;let i=t.const("len",pn._`${r}.length`);if(n===!1)e.setParams({len:o}),e.fail(pn._`${i} > ${o}`);else if(typeof n=="object"&&!Df.alwaysValidSchema(s,n)){let c=t.var("valid",pn._`${i} <= ${o}`);t.if(pn.not(c),()=>a(c,o)),e.ok(c)}s.items=!0;function a(c,l){t.forRange("i",l,i,(u)=>{if(e.subschema({keyword:"unevaluatedItems",dataProp:u,dataPropType:Df.Type.Num},c),!s.allErrors)t.if(pn.not(c),()=>t.break())})}}};RO.default=lB});var TO=W(function(NO){Object.defineProperty(NO,"__esModule",{value:!0});var fB=AO(),dB=CO(),pB=[fB.default,dB.default];NO.default=pB});var IO=W(function(JO){Object.defineProperty(JO,"__esModule",{value:!0});var we=ge(),hB={message:({schemaCode:e})=>we.str`must match format "${e}"`,params:({schemaCode:e})=>we._`{format: ${e}}`},gB={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:hB,code(e,t){let{gen:n,data:r,$data:s,schema:o,schemaCode:i,it:a}=e,{opts:c,errSchemaPath:l,schemaEnv:u,self:d}=a;if(!c.validateFormats)return;if(s)p();else m();function p(){let x=n.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=n.const("fDef",we._`${x}[${i}]`),g=n.let("fType"),b=n.let("format");n.if(we._`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>n.assign(g,we._`${h}.type || "string"`).assign(b,we._`${h}.validate`),()=>n.assign(g,we._`"string"`).assign(b,h)),e.fail$data(we.or(j(),v()));function j(){if(c.strictSchema===!1)return we.nil;return we._`${i} && !${b}`}function v(){let P=u.$async?we._`(${h}.async ? await ${b}(${r}) : ${b}(${r}))`:we._`${b}(${r})`,S=we._`(typeof ${b} == "function" ? ${P} : ${b}.test(${r}))`;return we._`${b} && ${b} !== true && ${g} === ${t} && !${S}`}}function m(){let x=d.formats[o];if(!x){j();return}if(x===!0)return;let[h,g,b]=v(x);if(h===t)e.pass(P());function j(){if(c.strictSchema===!1){d.logger.warn(S());return}throw Error(S());function S(){return`unknown format "${o}" ignored in schema at path "${l}"`}}function v(S){let _=S instanceof RegExp?we.regexpCode(S):c.code.formats?we._`${c.code.formats}${we.getProperty(o)}`:void 0,N=n.scopeValue("formats",{key:o,ref:S,code:_});if(typeof S=="object"&&!(S instanceof RegExp))return[S.type||"string",S.validate,we._`${N}.validate`];return["string",S,N]}function P(){if(typeof x=="object"&&!(x instanceof RegExp)&&x.async){if(!u.$async)throw Error("async format in sync schema");return we._`await ${b}(${r})`}return typeof g=="function"?we._`${b}(${r})`:we._`${b}.test(${r})`}}}};JO.default=gB});var lg=W(function(MO){Object.defineProperty(MO,"__esModule",{value:!0});var xB=IO(),bB=[xB.default];MO.default=bB});var ug=W(function(DO){Object.defineProperty(DO,"__esModule",{value:!0});DO.contentVocabulary=DO.metadataVocabulary=void 0;DO.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];DO.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var VO=W(function(LO){Object.defineProperty(LO,"__esModule",{value:!0});var SB=tg(),vB=ng(),EB=ig(),jB=xO(),PB=kO(),_B=TO(),kB=lg(),Ff=ug(),OB=[jB.default,SB.default,vB.default,(0,EB.default)(!0),kB.default,Ff.metadataVocabulary,Ff.contentVocabulary,PB.default,_B.default];LO.default=OB});var UO=W(function(WO){Object.defineProperty(WO,"__esModule",{value:!0});WO.DiscrError=void 0;var qO;(function(e){e.Tag="tag",e.Mapping="mapping"})(qO||(WO.DiscrError=qO={}))});var fg=W(function(zO){Object.defineProperty(zO,"__esModule",{value:!0});var Vn=ge(),ca=UO(),Lf=Oc(),RB=Zi(),BO=ke(),CB={message:({params:{discrError:e,tagName:t}})=>e===ca.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:n}})=>Vn._`{error: ${e}, tag: ${n}, tagValue: ${t}}`},NB={keyword:"discriminator",type:"object",schemaType:"object",error:CB,code(e){let{gen:t,data:n,schema:r,parentSchema:s,it:o}=e,{oneOf:i}=s;if(!o.opts.discriminator)throw Error("discriminator: requires discriminator option");let a=r.propertyName;if(typeof a!="string")throw Error("discriminator: requires propertyName");if(r.mapping)throw Error("discriminator: mapping is not supported");if(!i)throw Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),l=t.const("tag",Vn._`${n}${Vn.getProperty(a)}`);t.if(Vn._`typeof ${l} == "string"`,()=>u(),()=>e.error(!1,{discrError:ca.DiscrError.Tag,tag:l,tagName:a})),e.ok(c);function u(){let m=p();t.if(!1);for(let x in m)t.elseIf(Vn._`${l} === ${x}`),t.assign(c,d(m[x]));t.else(),e.error(!1,{discrError:ca.DiscrError.Mapping,tag:l,tagName:a}),t.endIf()}function d(m){let x=t.name("valid"),h=e.subschema({keyword:"oneOf",schemaProp:m},x);return e.mergeEvaluated(h,Vn.Name),x}function p(){var m;let x={},h=b(s),g=!0;for(let P=0;P<i.length;P++){let S=i[P];if((S===null||S===void 0?void 0:S.$ref)&&!BO.schemaHasRulesButRef(S,o.self.RULES)){let N=S.$ref;if(S=Lf.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,N),S instanceof Lf.SchemaEnv)S=S.schema;if(S===void 0)throw new RB.default(o.opts.uriResolver,o.baseId,N)}let _=(m=S===null||S===void 0?void 0:S.properties)===null||m===void 0?void 0:m[a];if(typeof _!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);g=g&&(h||b(S)),j(_,P)}if(!g)throw Error(`discriminator: "${a}" must be required`);return x;function b({required:P}){return Array.isArray(P)&&P.includes(a)}function j(P,S){if(P.const)v(P.const,S);else if(P.enum)for(let _ of P.enum)v(_,S);else throw Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function v(P,S){if(typeof P!="string"||P in x)throw Error(`discriminator: "${a}" values must be unique strings`);x[P]=S}}}};zO.default=NB});var KO=W(function(hee,JB){JB.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/schema",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],type:["object","boolean"],$comment:"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",properties:{definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}}}});var GO=W(function(gee,IB){IB.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$dynamicAnchor:"meta",title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}}}});var XO=W(function(yee,MB){MB.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/unevaluated",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$dynamicAnchor:"meta",title:"Unevaluated applicator vocabulary meta-schema",type:["object","boolean"],properties:{unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}}}});var YO=W(function(xee,DB){DB.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/content",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}}}});var ZO=W(function(bee,FB){FB.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/core",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0},$dynamicAnchor:"meta",title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},$defs:{anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}}}});var QO=W(function($ee,LB){LB.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/format-annotation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},$dynamicAnchor:"meta",title:"Format vocabulary meta-schema for annotation results",type:["object","boolean"],properties:{format:{type:"string"}}}});var eA=W(function(wee,VB){VB.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$dynamicAnchor:"meta",title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}});var tA=W(function(See,qB){qB.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/validation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/validation":!0},$dynamicAnchor:"meta",title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}});var rA=W(function(nA){Object.defineProperty(nA,"__esModule",{value:!0});var WB=KO(),HB=GO(),UB=XO(),BB=YO(),zB=ZO(),KB=QO(),GB=eA(),XB=tA(),YB=["/properties"];function ZB(e){return[WB,HB,UB,BB,zB,t(this,KB),GB,t(this,XB)].forEach((n)=>this.addMetaSchema(n,void 0,!1)),this;function t(n,r){return e?n.$dataMetaSchema(r,YB):r}}nA.default=ZB});var mg=W(function(mn,pg){Object.defineProperty(mn,"__esModule",{value:!0});mn.MissingRefError=mn.ValidationError=mn.CodeGen=mn.Name=mn.nil=mn.stringify=mn.str=mn._=mn.KeywordCxt=mn.Ajv2020=void 0;var ez=eg(),tz=VO(),nz=fg(),rz=rA(),dg="https://json-schema.org/draft/2020-12/schema";class Cc extends ez.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){if(super._addVocabularies(),tz.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(nz.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:t}=this.opts;if(!t)return;rz.default.call(this,e),this.refs["http://json-schema.org/schema"]=dg}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(dg)?dg:void 0)}}mn.Ajv2020=Cc;pg.exports=mn=Cc;pg.exports.Ajv2020=Cc;Object.defineProperty(mn,"__esModule",{value:!0});mn.default=Cc;var sz=Xi();Object.defineProperty(mn,"KeywordCxt",{enumerable:!0,get:function(){return sz.KeywordCxt}});var la=ge();Object.defineProperty(mn,"_",{enumerable:!0,get:function(){return la._}});Object.defineProperty(mn,"str",{enumerable:!0,get:function(){return la.str}});Object.defineProperty(mn,"stringify",{enumerable:!0,get:function(){return la.stringify}});Object.defineProperty(mn,"nil",{enumerable:!0,get:function(){return la.nil}});Object.defineProperty(mn,"Name",{enumerable:!0,get:function(){return la.Name}});Object.defineProperty(mn,"CodeGen",{enumerable:!0,get:function(){return la.CodeGen}});var oz=_c();Object.defineProperty(mn,"ValidationError",{enumerable:!0,get:function(){return oz.default}});var iz=Zi();Object.defineProperty(mn,"MissingRefError",{enumerable:!0,get:function(){return iz.default}})});import{existsSync as qf,readFileSync as iA}from"node:fs";import{createRequire as sA}from"node:module";import{basename as lz,isAbsolute as uz,relative as fz,resolve as hg}from"node:path";import{fileURLToPath as oA,pathToFileURL as dz}from"node:url";function Vf(e){return JSON.parse(iA(e,"utf8"))}async function aA(e){let t=hg(e),n=Rn(t),r=hg(t,"project.schema.json");if(!qf(n))throw Error(`No project.jxn or project.json in ${t}`);if(!qf(r))throw Error(`project.schema.json not found in ${t} — run \`jx schema\` to generate it from `+"the project file's extensions");let s=wl(iA(n,"utf8"),n),o=Vf(r);o.$id=dz(r).href;let i;try{({default:i}=await Promise.resolve().then(() => Jr(mg(),1)))}catch(d){throw Error("Project validation requires ajv: bun add ajv",{cause:d})}let c=await new i({allErrors:!0,loadSchema:(d)=>hz(d,t),strict:!1}).compileAsync(o),l=c(s),u=c.errors??null;return{errors:u&&qr(n)?mz(u,s):u,file:lz(n),valid:l}}function pz(e,t){let n=e;for(let r of t.split("/").slice(1)){let s=r.replaceAll("~1","/").replaceAll("~0","~");n=Array.isArray(n)?n[Number(s)]:V(n)?n[s]:void 0}return n}function mz(e,t){return e.map((n)=>{if(!D(n)||!("keyword"in n)||n.keyword!=="type"||!("params"in n)||!D(n.params)||!("type"in n.params)||n.params.type!=="array"||!("instancePath"in n)||!k(n.instancePath))return n;let r=pz(t,n.instancePath),s=rt(r,"",n.instancePath),o=n.instancePath.split("/").at(-1)??"";if(s===null||s.includes(`
|
|
624
|
-
`)||o==="")return n;return{...n,message:`must be a list, written as ${o} { - ${s} }`}})}async function hz(e,t){if(!e.startsWith("file:"))throw Error(`Cannot resolve schema ref "${e}": only project-relative file refs are loadable (canonical URIs must resolve from already-loaded fragments)`);let n=oA(e),r=fz(t,n);if(r.startsWith("..")||uz(r))throw Error(`Schema ref "${e}" escapes the project root ${t}`);if(qf(n))return Vf(n);let s=r.split("\\").join("/"),o="node_modules/",i=s.lastIndexOf(o);if(i===-1)throw Error(`Schema ref "${e}" does not exist`);let a=s.slice(i+o.length),c="@jxsuite/schema/",l;try{l=sA(hg(t,"package.json")).resolve(a)}catch(u){if(!a.startsWith(c))throw Error(`Schema ref "${e}" does not exist and "${a}" is not resolvable from the `+"project — is the package installed?",{cause:u});try{l=sA(import.meta.url).resolve(a)}catch(d){let p=oA(new URL(`../${a.slice(c.length)}`,import.meta.url));if(qf(p))return Vf(p);throw Error(`Schema ref "${e}" does not exist and "${a}" is not resolvable from the project or this host's core`,{cause:d})}}return Vf(l)}var cA=T(()=>{le();dl();bl();Sl();po()});function Ar(e){return V(e.attributes)?e.attributes:{}}function Ht(e,t){let n=Ar(e)[t];return k(n)?n:null}function yt(e){return k(e.tagName)?e.tagName.toLowerCase():""}function en(e,t="the popover"){let n=k(e.id)?e.id:Ht(e,"id");if(n)return`#${n}`;let r=yt(e);return r===""?t:`the <${r}>`}function xz(e){let t=Ar(e).popover;return k(t)?t:null}function uA(e){let t=new Set,n=new Set;for(let r of e){let s=r!==null&&k(r.tagName)?r.tagName:"";if(r===null||!s.includes("-"))continue;if(gg(r))t.add(s);let o=r.observedAttributes;if(Array.isArray(o)&&bz.every((i)=>o.includes(i)))n.add(s)}return{invokerTags:n,popoverTags:t}}function gg(e){return"popover"in Ar(e)||"popover"in e}function Nc(e,t){return gg(e)||(t?.popoverTags?.has(yt(e))??!1)}function zs(e){if(k(e.id)&&e.id!=="")return e.id;let t=Ht(e,"id");return t===""?null:t}function*Or(e,t=[],n=null,r){yield{enclosing:n,node:e,path:t};let s=Nc(e,r)?e:n,{children:o}=e;if(Array.isArray(o)){for(let[c,l]of o.entries())if(D(l))yield*Or(l,[...t,"children",c],s,r)}else if(V(o)&&nn(o.map))yield*Or(o.map,[...t,"children","map"],s,r);let i=nn(e.map)?e.map:null;if(i)yield*Or(i,[...t,"map"],s,r);let a=V(e.cases)?e.cases:{};for(let[c,l]of Object.entries(a))if(D(l))yield*Or(l,[...t,"cases",c],s,r)}function yg(e,t){let n=[];for(let{node:r}of Or(e,[],null,t)){if(!Nc(r,t))continue;let s=zs(r);if(s!==null&&!n.includes(s))n.push(s)}return n}function Wf(e){return e.startsWith("@")}function fA(e){return e.startsWith(":")||e.startsWith("&")||e.startsWith(".")||e.startsWith("[")}function Qt(e,t){let n=e?.[t];if(n===void 0||no(n)||Array.isArray(n))return null;return String(n)}function dA(e){for(let[t,n]of Object.entries(e??{})){if(!no(n))continue;if(fA(t)&&t.includes(":popover-open")&&Qt(n,"display")!==null)return!0;if(Wf(t)&&dA(n))return!0}return!1}function pA(e){for(let[t,n]of Object.entries(e??{})){if(!no(n))continue;if(fA(t)&&t.includes(":popover-open"))return!0;if(Wf(t)&&pA(n))return!0}return!1}function wz(e){return $z.some((t)=>Qt(e,t)!==null)}function Sz(e){if(!e)return[];let t=[];for(let[n,r]of Object.entries(e))if(Wf(n)&&no(r)&&Qt(r,"display")!==null)t.push(n);return t}function mA(e){if(!e)return[];let t=[],n=Qt(e,"transition");if(n!==null)t.push(n);for(let[r,s]of Object.entries(e))if(Wf(r)&&no(s))t.push(...mA(s));return t}function vz(e){if(!e)return!1;if(Qt(e,"positionAnchor")!==null||Qt(e,"position-anchor")!==null)return!0;return["top","left","right","bottom","inset","insetBlockStart","insetInlineStart"].some((t)=>(Qt(e,t)??"").includes("anchor("))}function Ez(e){if(!e)return!1;if(Qt(e,"positionArea")!==null||Qt(e,"position-area")!==null||Qt(e,"positionTryFallbacks")!==null||Qt(e,"position-try-fallbacks")!==null)return!0;return Object.keys(e).some((t)=>t.startsWith("@supports"))}function hA(e,t){let n=[...Or(e,[],null,t)],r=yg(e,t),s=n.some(({node:a})=>Nc(a,t)),o=new Set;for(let{node:a}of n)if(lA.has(yt(a))){let c=Ht(a,"popovertarget");if(c!==null)o.add(c)}let i=[];for(let{enclosing:a,node:c,path:l}of n)if(i.push(...jz(c,l,a,r,s,t)),gg(c))i.push(...Pz(c,l,o));return i}function jz(e,t,n,r,s,o){let i=[],a=yt(e),c=Ht(e,"popovertarget"),l=lA.has(a)||(o?.invokerTags?.has(a)??!1);if(c!==null&&!l)return i.push({detail:"`popovertarget` and `popovertargetaction` come from the `PopoverTargetAttributes` IDL mixin, which HTML includes into `HTMLButtonElement` and `HTMLInputElement` and into nothing else. Elsewhere they parse and do nothing. A link inside an open popover "+"dismisses it by navigating away, which is why this looks like it works — but it does "+`not for a new tab or a same-page fragment. Remove both attributes. ${Ze}`,fix:"invoker",message:`<${a||"element"}> carries popovertarget, which only <button> and <input> support.`,path:t,rule:"invoker-not-button",severity:"error"}),i;if(c!==null){if(s&&!r.includes(c)){let u=r.length>0?`The popovers here are: ${r.map((d)=>`"${d}"`).join(", ")}. `:"";i.push({detail:`No element in this document declares \`popover\` with the id "${c}". ${u}A target that names nothing does nothing, silently. ${Ze}`,message:`popovertarget="${c}" names no popover in this document.`,path:t,rule:"target-missing",severity:"error"})}else if(n!==null&&zs(n)!==null&&zs(n)!==c)i.push({detail:`This control is inside ${en(n)} but targets "${c}". Dismissing a different popover leaves the one the reader is looking at open. This is usually a copy-paste between two panels in the same file. ${Ze}`,message:`A control inside ${en(n)} targets "${c}" instead.`,path:t,rule:"target-mismatch",severity:"warn"})}if(a==="a"&&n!==null&&c===null){let u=Ht(e,"href")??(k(e.href)?e.href:null),d=Ht(e,"target")==="_blank",p=u!==null&&u.includes("#");if(d||p){let m=d?"it opens a new tab, so the panel stays open on the page behind it. ":"it is a same-document fragment, so the page scrolls behind the open panel. ";i.push({detail:`A link inside a panel normally dismisses it by navigating away. This one does not: ${m}`+"There is no declarative fix — a link cannot carry `popovertarget`. Move it out of the "+`panel, make it a <button>, or accept it deliberately. ${Ze}`,message:`A link inside ${en(n)} does not dismiss it.`,path:t,rule:"link-does-not-dismiss",severity:"warn"})}}return i}function Pz(e,t,n){let r=[],{style:s}=e,o=en(e),i=xz(e);if(i!==null&&i!==""&&!yz.some((l)=>l===i))r.push({detail:"`popover` is an enumerated attribute taking `auto`, `manual` or `hint`. Anything else falls back to the invalid-value default `manual`, which gives up light dismiss and gives "+`up Escape — so the panel opens and there is no way to close it. Write "auto". ${Ze}`,fix:"mode",message:`${o} declares popover="${i}", which is not one of auto, manual or hint.`,path:t,rule:"invalid-mode",severity:"error"});else if(Mt(Ar(e).popover))r.push({detail:`\`popover\` carries its value in its text, so a boolean is not the right shape. Written as \`true\` it reaches two of the compiler's emitters as \`popover="true"\`, which is not one of the three keywords, so HTML falls back to \`manual\`: no light dismiss, no Escape, and the trigger stops toggling. Write "auto". ${Ze}`,fix:"mode",message:`${o} writes popover as a boolean.`,path:t,rule:"invalid-mode",severity:"error"});let a=Qt(s,"display");if(a!==null&&a!=="revert"&&a!=="revert-layer")r.push({detail:"A closed popover is hidden by the browser's own `[popover]:not(:popover-open) { display: none }`. That rule is UA-origin, so any author `display` beats it at any specificity, and "+"the panel is laid out on every page whether it is open or not — usually parked off the "+`side of the viewport by the transform meant to animate it, so nothing looks wrong until you scroll sideways. \`display\` belongs in \`:popover-open\` and nowhere else. ${Ze}`,fix:"display",message:`${o} sets display in its base rule.`,path:t,rule:"base-display",severity:"error"});for(let l of Sz(s))r.push({detail:`The same defect as a base \`display\`, arriving through \`${l}\` and therefore only at `+"one width — which is what makes it hard to see. Gate the TRIGGER on a breakpoint, never "+`the panel: the popover mechanism is what hides the panel. ${Ze}`,fix:"display",message:`${o} sets display inside ${l}.`,path:t,rule:"breakpoint-display",severity:"error"});if(Qt(s,"visibility")!==null)r.push({detail:`A second hiding mechanism the browser already provides. Once \`display\` leaves the base rule this one only adds a frame of flicker on open, and it hides the element from assistive technology in a way \`display: none\` already did. ${Ze}`,fix:"display",message:`${o} also hides itself with visibility.`,path:t,rule:"base-visibility",severity:"warn"});if(!pA(s))r.push({detail:"Nothing changes when it opens, so no transition on it can run and — if `display` is not "+"in the base rule — the panel has no `display` at all while open. This is usually a panel "+`that was styled before it was made a popover. ${Ze}`,message:`${o} has no :popover-open rule.`,path:t,rule:"no-open-rule",severity:"warn"});else if(!dA(s)&&a===null&&wz(s))r.push({detail:`${o} declares flex or grid properties, but neither its base rule nor its `+"`:popover-open` rule sets a `display` for them to apply to — and the base rule must not "+`(that is what keeps the closed panel hidden). So it opens with the UA's \`display: block\` and the layout silently does nothing. Put \`display: flex\` in \`:popover-open\`. ${Ze}`,fix:"open-display",message:`${o} is laid out with flex or grid but never sets display.`,path:t,rule:"no-open-display",severity:"error"});for(let l of mA(s))if(l.includes("display")&&!l.includes("overlay")){r.push({detail:"`display …allow-discrete` keeps the box alive while it animates out; `overlay "+"…allow-discrete` is what keeps it in the TOP LAYER for those same milliseconds. "+`Without it the panel drops behind the page content and the backdrop disappears a frame early, so the exit reads as a flicker rather than an animation. ${Ze}`,message:`${o} transitions display but not overlay.`,path:t,rule:"cut-exit",severity:"warn"});break}if(vz(s)&&!Ez(s))r.push({detail:"When `anchor()` does not resolve, every inset it feeds computes to `auto` — and a "+`\`position: fixed\` box with four \`auto\` insets falls back to its STATIC position, which for a panel declared inside a header is in the middle of the header. Use \`position-area\` with \`position-try-fallbacks\`, or add a \`@supports\` block that positions it without anchors. ${Ze}`,message:`${o} is anchor-positioned with no fallback.`,path:t,rule:"unsafe-anchor",severity:"warn"});let c=zs(e);if(c!==null&&!n.has(c))r.push({detail:`No \`<button>\` or \`<input>\` in this document names it with \`popovertarget\`. If it is opened from another file or from a function that calls \`showPopover()\`, this is fine; otherwise there is no way for a reader to open it. ${Ze}`,message:`${o} has no invoker in this document.`,path:t,rule:"no-invoker",severity:"warn"});return r}var yz,lA,bz,$z,Ze="See docs/framework/concepts/overlays.";var Hf=T(()=>{le();yz=["auto","manual","hint"],lA=new Set(["button","input"]);bz=["popovertarget","popovertargetaction","command","commandfor"];$z=["flexDirection","flex-direction","alignItems","align-items","justifyContent","justify-content","flexWrap","flex-wrap","gridTemplateColumns","grid-template-columns","gridTemplateRows","grid-template-rows","gap"]});function pa(e,t){let n=Ar(e),r=t in n?n[t]:e[t];if(r===void 0||r===null)return{kind:"absent"};if(Ne(r)||V(r))return{kind:"bound"};if(k(r))return r.includes("${")?{kind:"bound"}:{kind:"text",text:r};return{isTrue:r===!0,kind:"other"}}function fa(e,t){let n=pa(e,t);return n.kind==="text"&&n.text.trim()!==""?n.text:null}function Ut(e,t){return pa(e,t).kind!=="absent"}function Ks(e){let t=pa(e,"role");if(t.kind==="bound")return da;return t.kind==="text"?t.text.trim().toLowerCase().split(/\s+/)[0]:null}function Uf(e){let t=pa(e,"id");if(t.kind==="bound")return da;return t.kind==="text"&&t.text!==""?t.text:null}function qn(e,t){let n=pa(e,t);return n.kind==="bound"||n.kind==="text"&&n.text.trim()!==""}function Bf(e){let t=e.textContent;if(k(t)){if(t.trim()!=="")return!0}else if(t!==void 0&&t!==null)return!0;if(qn(e,"aria-label")||Ut(e,"aria-labelledby"))return!0;if(yt(e)==="img"&&(qn(e,"alt")||qn(e,"title")))return!0;if(yt(e)==="slot")return!0;let{children:n}=e;if(Array.isArray(n)){for(let s of n)if(k(s)){if(s.trim()!=="")return!0}else if(D(s)&&Bf(s))return!0}else if(n!=null)return!0;if(V(e.map))return!0;return(V(e.cases)?Object.values(e.cases):[]).some((s)=>nn(s)&&Bf(s))}function*ua(e,t=[],n=[],r=[]){yield{node:e,path:t,roles:n,tags:r};let s=[...n,Ks(e)],o=[...r,yt(e)],{children:i}=e;if(Array.isArray(i)){for(let[a,c]of i.entries())if(D(c))yield*ua(c,[...t,"children",a],s,o)}else if(V(i)&&nn(i.map))yield*ua(i.map,[...t,"children","map"],s,o);if(nn(e.map))yield*ua(e.map,[...t,"map"],s,o);if(V(e.cases)){for(let[a,c]of Object.entries(e.cases))if(D(c))yield*ua(c,[...t,"cases",a],s,o)}}function Cz(e){return e.some((t)=>t.includes("-"))}function Rr(e,t,n,r,s,o="error"){return{criterion:s,detail:`${r} ${_z}`,message:n,path:t,rule:e,severity:o}}function gA(e,t,n){if(n.includes("label"))return!0;if(e===da||t.bound)return!0;return e!==null&&t.ids.has(e)}function Nz(e,t){let{node:n,path:r,tags:s}=e,o=yt(n),i=Ks(n);if(i==="bound")return null;if(qn(n,"aria-label")||Ut(n,"aria-labelledby")||qn(n,"title"))return null;let c=en(n,"the control"),l=(d)=>Rr("interactive-unnamed",r,`${c} has no accessible name.`,`A control with no name is announced as its role alone, so a reader hears "button" and nothing else. ${d}`,"4.1.2"),u=Tz(n,o,t,s);if(u==="named"||u==="exempt")return null;if(i!==null&&kz.has(i))return Bf(n)?null:l("Give it text content, or an aria-label.");if(i!==null&&Oz.has(i))return l("Give it an aria-label, or aria-labelledby naming its visible label.");if(i!==null)return null;if(o==="button"||o==="summary"||o==="a"&&Ut(n,"href"))return Bf(n)?null:l("Give it text content, or an aria-label.");if(u==="unnamed")return l("Give it a <label for> naming its id, or an aria-label.");if(u==="unnamed-value")return l("Give it a value, or an aria-label.");if(u==="unnamed-alt")return l("Give it an alt, or an aria-label.");return null}function Tz(e,t,n,r){if(t==="area"){if(!Ut(e,"href"))return"none";return qn(e,"alt")?"named":"unnamed-alt"}if(t==="select"||t==="textarea")return gA(Uf(e),n,r)||qn(e,"placeholder")?"named":"unnamed";if(t!=="input")return"none";let s=(fa(e,"type")??"text").toLowerCase();if(s==="hidden"||Ut(e,"type")&&fa(e,"type")===null)return"exempt";if(Az.has(s))return qn(e,"value")?"named":"unnamed-value";if(s==="image")return qn(e,"alt")?"named":"unnamed-alt";return gA(Uf(e),n,r)||qn(e,"placeholder")?"named":"unnamed"}function Iz(e){let{node:t,path:n,tags:r}=e,s=yt(t);if(!s.includes("-")||!r.some((o)=>Jz.has(o)))return null;return Rr("custom-element-in-select",n,`<${s}> is a custom element inside a <select>.`,'A <select> builds its own rows: an element it does not know is not in select.options, so it cannot be picked, cannot be reached with the arrow keys, and fires no change event — while role="option" on it still makes the accessibility tree read as though it could. Every row of a <select> is a native <option>; a listbox whose rows are jx-option elements is a jx-listbox.',"4.1.2")}function Mz(e){let{node:t,path:n}=e;if(yt(t)!=="img")return null;let r=Ks(t);if(r==="bound"||r==="presentation"||r==="none")return null;if(Ut(t,"alt")||qn(t,"aria-label")||Ut(t,"aria-labelledby"))return null;return Rr("img-alt-missing",n,`${en(t,"the image")} has no alt text.`,'An image with no alt is announced by its file name. Describe it in alt, or write alt="" for a decorative one.',"1.1.1")}function Fz(e,t){let{node:n,path:r}=e,s=[];for(let o of Dz){let i=fa(n,o);if(i===null)continue;for(let a of i.split(/\s+/))if(a!==""&&!t.has(a))s.push(Rr("aria-target-missing",r,`${en(n,"the element")} points ${o} at #${a}, which nothing in this document has as its id.`,"A reference to an id that is not in the document is silently dropped, so the relationship it declares does not exist. Name an element that is here, or give that element the id.","1.3.1"))}return s}function Lz(e,t,n){for(let r of yA.get(t)??[]){let s=n.get(r);if(s===void 0)continue;if(s.bound)return!0;if(e===da&&s.ids.size>0)return!0;if(e!==null&&e!==da&&s.ids.has(e))return!0}return!1}function Vz(e,t){let{node:n,path:r,roles:s,tags:o}=e,i=Ks(n);if(i===null||i==="bound"||r.length===0||Cz(o))return null;if(s.includes("bound")||Lz(Uf(n),i,t))return null;let a=en(n,"the element");if(i==="tab"&&!s.includes("tablist"))return Rr("tab-outside-tablist",r,`${a} is a tab outside any tablist.`,'A tab is announced with its position in a tablist, so one with no tablist ancestor has no place to be counted in. Put the tabs in a container with role="tablist".',"1.3.1");if((i==="menuitem"||i==="menuitemcheckbox"||i==="menuitemradio")&&!s.includes("menu")&&!s.includes("menubar"))return Rr("menuitem-outside-menu",r,`${a} is a ${i} outside any menu.`,'A menu item is owned by a menu, and is announced as one of its items. Put it in a container with role="menu" or role="menubar".',"1.3.1");if(i==="option"&&!s.includes("listbox")&&!o.includes("select")&&!o.includes("datalist"))return Rr("option-outside-listbox",r,`${a} is an option outside any listbox.`,'An option is owned by a listbox, and is announced as one of its choices. Put it in a container with role="listbox", or in a <select>.',"1.3.1");return null}function qz(e){let t=[];for(let{node:n}of ua(e)){if(Ks(n)!=="tab")continue;let r=pa(n,"aria-selected");if(r.kind==="bound")return null;t.push(r.kind==="other"&&r.isTrue||r.kind==="text"&&r.text==="true")}return t}function Wz(e){let{node:t,path:n}=e;if(Ks(t)!=="tablist")return null;let r=qz(t);if(r===null||r.length===0||r.includes(!0))return null;return Rr("tablist-none-selected",n,`${en(t,"the tablist")} has ${r.length} tab(s) and none is selected.`,'A tablist always has a current tab, and aria-selected="true" is how it is announced. Mark the tab whose panel is showing.',"4.1.2","warn")}function Hz(e){let{node:t,path:n}=e,r=Ks(t);if(!(yt(t)==="dialog"||r==="dialog"||r==="alertdialog")||r==="bound")return null;if(qn(t,"aria-label")||Ut(t,"aria-labelledby"))return null;return Rr("dialog-unnamed",n,`${en(t,"the dialog")} has no accessible name.`,"A dialog is announced by its name when it opens, and its content does not name it. Give it aria-labelledby naming its heading, or an aria-label.","4.1.2")}function Bz(e){let{node:t,path:n}=e;if(!Ut(t,"aria-activedescendant"))return null;let r=yt(t);if(Uz.has(r)||r==="a"&&Ut(t,"href")||Ut(t,"tabIndex")||Ut(t,"tabindex")||Ut(t,"contenteditable"))return null;return Rr("activedescendant-not-focusable",n,`${en(t,"the element")} manages focus with aria-activedescendant but cannot itself take focus.`,"aria-activedescendant names the active child of a FOCUSED container; on one that cannot be focused, the keyboard never reaches it. Give the container a tabindex.","2.1.1")}function xA(e){let t=[...ua(e)],n=new Set,r={bound:!1,ids:new Set},s=new Map,o=!1;for(let{node:a}of t){let c=Ks(a);if(c!==null&&Rz.has(c)){let u=s.get(c)??{bound:!1,ids:new Set},d=fa(a,"aria-owns");if(d===null)u.bound||=Ut(a,"aria-owns");else for(let p of d.split(/\s+/))if(p!=="")u.ids.add(p);s.set(c,u)}let l=Uf(a);if(l===da)o=!0;else if(l!==null)n.add(l);if(yt(a)==="label"){let u=fa(a,"for")??fa(a,"htmlFor");if(u===null)r.bound||=Ut(a,"for")||Ut(a,"htmlFor");else r.ids.add(u)}}let i=[];for(let a of t){let c=[Nz(a,r),Mz(a),Vz(a,s),Iz(a),Wz(a),Hz(a),Bz(a)];for(let l of c)if(l)i.push(l);if(!o)i.push(...Fz(a,n))}return i}var _z="See docs/framework/concepts/accessibility.",da="bound",kz,Oz,Az,yA,Rz,Jz,Dz,Uz;var bA=T(()=>{le();Hf();kz=new Set(["button","checkbox","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","switch","tab","treeitem"]),Oz=new Set(["combobox","listbox","searchbox","slider","spinbutton","textbox"]),Az=new Set(["button","reset","submit"]),yA=new Map([["menuitem",["menu","menubar"]],["menuitemcheckbox",["menu","menubar"]],["menuitemradio",["menu","menubar"]],["option",["listbox"]],["tab",["tablist"]]]),Rz=new Set([...yA.values()].flat());Jz=new Set(["select","jx-select"]);Dz=["aria-activedescendant","aria-controls","aria-describedby","aria-details","aria-errormessage","aria-flowto","aria-labelledby","aria-owns"];Uz=new Set(["button","input","select","textarea"])});function xg(e){return yt(e)==="dialog"}function $A(e){return e.startsWith("--")}function Qz(e){let t=[];for(let{node:n}of Or(e)){let r=zs(n);if(xg(n)&&r!==null&&!t.includes(r))t.push(r)}return t}function e8(e){let t=e.oncommand;return t!==void 0&&t!==null}function t8(e,t){for(let{node:n}of Or(e)){if(n===e)continue;let r=yt(n);if(r==="button"){let s=Ht(n,"command"),o=Ht(n,"commandfor");if(s!==null&&(s==="close"||s==="request-close")&&(o===null||o===t))return!0}if(r==="form"&&Ht(n,"method")?.toLowerCase()==="dialog")return!0}return!1}function SA(e,t){let n=[...Or(e,[],null,t)],r=Qz(e),s=yg(e,t),o=r.length>0||s.length>0,i=new Map,a=new Map;for(let{node:l}of n){let u=zs(l);if(u!==null&&!i.has(u))i.set(u,l);if(yt(l)==="button"){let d=Ht(l,"commandfor"),p=Ht(l,"command");if(d!==null){let m=a.get(d)??new Set;m.add(p??""),a.set(d,m)}}}let c=[];for(let{node:l,path:u}of n)if(c.push(...n8(l,u,i,r,s,o,t)),xg(l))c.push(...r8(l,u,a));return c}function n8(e,t,n,r,s,o,i){let a=[],c=yt(e),l=i?.invokerTags?.has(c)??!1,u=Ht(e,"command"),d=Ht(e,"commandfor");if(!(u!==null||d!==null||("command"in Ar(e))||("commandfor"in Ar(e))))return a;let m=en(e,"the element");if(!Zz.has(c)&&!l)return a.push({detail:"`command` and `commandfor` are attributes of `HTMLButtonElement` and of no other "+"interface — not even `<input>`, which `popovertarget` does allow. Elsewhere they parse "+`and do nothing. Make it a <button>, or remove both attributes. ${Ze}`,fix:"invoker",message:`<${c||"element"}> carries command/commandfor, which only <button> supports.`,path:t,rule:"invoker-not-button",severity:"error"}),a;if(u!==null&&!Xz.has(u)&&!$A(u))return a.push({detail:`\`command\` is an enumerated attribute taking ${wA.map((x)=>`\`${x}\``).join(", ")}, or a custom command starting with \`--\`. Anything else is the invalid-value state, and a button in that state does nothing when clicked. ${Ze}`,message:`${m} declares command="${u}", which is not a built-in or --custom command.`,path:t,rule:"command-invalid",severity:"error"}),a;if(d!==null){let x=n.get(d),h=r.includes(d),g=s.includes(d);if(!x&&o){let b=[...r,...s].map((j)=>`"${j}"`).join(", ");return a.push({detail:`No element in this document has the id "${d}". The dialogs and popovers here are: ${b}. A commandfor that names nothing does nothing, silently. ${Ze}`,message:`commandfor="${d}" names nothing in this document.`,path:t,rule:"command-target-missing",severity:"error"}),a}if(u!==null&&x){if(zz.has(u)&&!xg(x))a.push({detail:`\`${u}\` acts on a <dialog>, and "${d}" is ${g?"a popover":`a <${yt(x)||"element"}>`}. The click is ignored. ${g?"Use `toggle-popover`, `show-popover` or `hide-popover` for a popover.":"Point it at a dialog, or make the target one."} ${Ze}`,message:`${m} sends ${u} to "${d}", which is not a dialog.`,path:t,rule:"command-target-mismatch",severity:"error"});else if(Kz.has(u)&&!Nc(x,i))a.push({detail:`\`${u}\` acts on a popover, and "${d}" is ${h?"a dialog":`a <${yt(x)||"element"}>`} that declares no \`popover\`. The click is ignored. ${h?"Use `show-modal`, `close` or `request-close` for a dialog.":"Give the target a `popover` attribute, or point the button elsewhere."} ${Ze}`,message:`${m} sends ${u} to "${d}", which is not a popover.`,path:t,rule:"command-target-mismatch",severity:"error"});else if($A(u)&&!e8(x))a.push({detail:`A custom command is a \`CommandEvent\` dispatched at its target, and "${d}" has no `+"`oncommand` handler to answer it — so the click does nothing. Add one that switches on "+`\`event#/command\`, or use a built-in command. ${Ze}`,message:`${m} sends ${u} to "${d}", which handles no command.`,path:t,rule:"custom-command-unhandled",severity:"warn"})}}return a}function r8(e,t,n){let r=[],s=en(e,"the dialog"),o=zs(e),{style:i}=e,a=Ht(e,"closedby");if(a!==null&&!Yz.has(a))r.push({detail:`\`closedby\` is an enumerated attribute taking \`any\` (light dismiss and Escape), \`closerequest\` (Escape only, the default for a modal) or \`none\`. Anything else is the invalid-value default, \`auto\`, which is the same as leaving it out. ${Ze}`,message:`${s} declares closedby="${a}", which is not any, closerequest or none.`,path:t,rule:"dialog-closedby-invalid",severity:"error"});if(Qt(i,"display")!==null)r.push({detail:`A closed dialog is hidden by the browser's own \`dialog:not([open]) { display: none }\`. That rule is UA-origin, so any author \`display\` beats it, and the dialog is laid out on every page whether or not anyone opened it. \`display\` belongs in the \`&[open]\` rule and nowhere else. ${Ze}`,fix:"display",message:`${s} sets display in its base rule.`,path:t,rule:"dialog-display",severity:"error"});let c=o===null?void 0:n.get(o),l=Ht(e,"open")!==null||Ar(e).open===!0||e.open===!0;if(o!==null&&!c?.has("show-modal")&&!l)r.push({detail:`No <button> in this document opens it with \`command="show-modal"\`. If it is opened from another file or from a function that calls \`showModal()\`, this is fine; otherwise there is no way for a reader to open it. ${Ze}`,message:`${s} has no invoker in this document.`,path:t,rule:"dialog-no-invoker",severity:"warn"});if(c?.has("show-modal")&&a==="none"&&!t8(e,o))r.push({detail:`A modal dialog makes everything outside it inert, so the only ways out are the ones it offers: \`closedby="none"\` turns off Escape and light dismiss, and nothing inside it closes it. A reader who opens it cannot leave. Add a <button command="close"> inside, or drop \`closedby="none"\`. ${Ze}`,message:`${s} opens modally, closes on nothing, and has no close button.`,path:t,rule:"modal-without-close",severity:"error"});return r}var wA,zz,Kz,Gz,Xz,Yz,Zz;var vA=T(()=>{le();Hf();wA=["toggle-popover","show-popover","hide-popover","show-modal","close","request-close"],zz=new Set(["show-modal","close","request-close"]),Kz=new Set(["toggle-popover","show-popover","hide-popover"]),Gz=["any","closerequest","none"],Xz=new Set(wA),Yz=new Set(Gz),Zz=new Set(["button"])});var NA=W(function(RA){Object.defineProperty(RA,"__esModule",{value:!0});RA.formatNames=RA.fastFormats=RA.fullFormats=void 0;function Cr(e,t){return{validate:e,compare:t}}RA.fullFormats={date:Cr(_A,Sg),time:Cr($g(!0),vg),"date-time":Cr(EA(!0),OA),"iso-time":Cr($g(),kA),"iso-date-time":Cr(EA(),AA),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:l8,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:g8,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:u8,int32:{type:"number",validate:p8},int64:{type:"number",validate:m8},float:{type:"number",validate:PA},double:{type:"number",validate:PA},password:!0,binary:!0};RA.fastFormats={...RA.fullFormats,date:Cr(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Sg),time:Cr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,vg),"date-time":Cr(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,OA),"iso-time":Cr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,kA),"iso-date-time":Cr(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,AA),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};RA.formatNames=Object.keys(RA.fullFormats);function s8(e){return e%4===0&&(e%100!==0||e%400===0)}var o8=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i8=[0,31,28,31,30,31,30,31,31,30,31,30,31];function _A(e){let t=o8.exec(e);if(!t)return!1;let n=+t[1],r=+t[2],s=+t[3];return r>=1&&r<=12&&s>=1&&s<=(r===2&&s8(n)?29:i8[r])}function Sg(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var bg=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function $g(e){return function(n){let r=bg.exec(n);if(!r)return!1;let s=+r[1],o=+r[2],i=+r[3],a=r[4],c=r[5]==="-"?-1:1,l=+(r[6]||0),u=+(r[7]||0);if(l>23||u>59||e&&!a)return!1;if(s<=23&&o<=59&&i<60)return!0;let d=o-u*c,p=s-l*c-(d<0?1:0);return(p===23||p===-1)&&(d===59||d===-1)&&i<61}}function vg(e,t){if(!(e&&t))return;let n=new Date("2020-01-01T"+e).valueOf(),r=new Date("2020-01-01T"+t).valueOf();if(!(n&&r))return;return n-r}function kA(e,t){if(!(e&&t))return;let n=bg.exec(e),r=bg.exec(t);if(!(n&&r))return;if(e=n[1]+n[2]+n[3],t=r[1]+r[2]+r[3],e>t)return 1;if(e<t)return-1;return 0}var wg=/t|\s/i;function EA(e){let t=$g(e);return function(r){let s=r.split(wg);return s.length===2&&_A(s[0])&&t(s[1])}}function OA(e,t){if(!(e&&t))return;let n=new Date(e).valueOf(),r=new Date(t).valueOf();if(!(n&&r))return;return n-r}function AA(e,t){if(!(e&&t))return;let[n,r]=e.split(wg),[s,o]=t.split(wg),i=Sg(n,s);if(i===void 0)return;return i||vg(r,o)}var a8=/\/|:/,c8=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function l8(e){return a8.test(e)&&c8.test(e)}var jA=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function u8(e){return jA.lastIndex=0,jA.test(e)}var f8=-2147483648,d8=2147483647;function p8(e){return Number.isInteger(e)&&e<=d8&&e>=f8}function m8(e){return Number.isInteger(e)}function PA(){return!0}var h8=/[^\\]\\Z/;function g8(e){if(h8.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var JA=W(function(TA){Object.defineProperty(TA,"__esModule",{value:!0});var x8=tg(),b8=ng(),$8=ig(),w8=lg(),zf=ug(),S8=[x8.default,b8.default,(0,$8.default)(),w8.default,zf.metadataVocabulary,zf.contentVocabulary];TA.default=S8});var IA=W(function(Zee,E8){E8.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var DA=W(function(hn,jg){Object.defineProperty(hn,"__esModule",{value:!0});hn.MissingRefError=hn.ValidationError=hn.CodeGen=hn.Name=hn.nil=hn.stringify=hn.str=hn._=hn.KeywordCxt=hn.Ajv=void 0;var j8=eg(),P8=JA(),_8=fg(),MA=IA(),k8=["/properties"],Kf="http://json-schema.org/draft-07/schema";class Tc extends j8.default{_addVocabularies(){if(super._addVocabularies(),P8.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(_8.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(MA,k8):MA;this.addMetaSchema(e,Kf,!1),this.refs["http://json-schema.org/schema"]=Kf}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Kf)?Kf:void 0)}}hn.Ajv=Tc;jg.exports=hn=Tc;jg.exports.Ajv=Tc;Object.defineProperty(hn,"__esModule",{value:!0});hn.default=Tc;var O8=Xi();Object.defineProperty(hn,"KeywordCxt",{enumerable:!0,get:function(){return O8.KeywordCxt}});var ma=ge();Object.defineProperty(hn,"_",{enumerable:!0,get:function(){return ma._}});Object.defineProperty(hn,"str",{enumerable:!0,get:function(){return ma.str}});Object.defineProperty(hn,"stringify",{enumerable:!0,get:function(){return ma.stringify}});Object.defineProperty(hn,"nil",{enumerable:!0,get:function(){return ma.nil}});Object.defineProperty(hn,"Name",{enumerable:!0,get:function(){return ma.Name}});Object.defineProperty(hn,"CodeGen",{enumerable:!0,get:function(){return ma.CodeGen}});var A8=_c();Object.defineProperty(hn,"ValidationError",{enumerable:!0,get:function(){return A8.default}});var R8=Zi();Object.defineProperty(hn,"MissingRefError",{enumerable:!0,get:function(){return R8.default}})});var VA=W(function(LA){Object.defineProperty(LA,"__esModule",{value:!0});LA.formatLimitDefinition=void 0;var FA=DA(),dt=ge(),Gs=dt.operators,Gf={formatMaximum:{okStr:"<=",ok:Gs.LTE,fail:Gs.GT},formatMinimum:{okStr:">=",ok:Gs.GTE,fail:Gs.LT},formatExclusiveMaximum:{okStr:"<",ok:Gs.LT,fail:Gs.GTE},formatExclusiveMinimum:{okStr:">",ok:Gs.GT,fail:Gs.LTE}},T8={message:({keyword:e,schemaCode:t})=>dt.str`should be ${Gf[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>dt._`{comparison: ${Gf[e].okStr}, limit: ${t}}`};LA.formatLimitDefinition={keyword:Object.keys(Gf),type:"string",schemaType:"string",$data:!0,error:T8,code(e){let{gen:t,data:n,schemaCode:r,keyword:s,it:o}=e,{opts:i,self:a}=o;if(!i.validateFormats)return;let c=new FA.KeywordCxt(o,a.RULES.all.format.definition,"format");if(c.$data)l();else u();function l(){let p=t.scopeValue("formats",{ref:a.formats,code:i.code.formats}),m=t.const("fmt",dt._`${p}[${c.schemaCode}]`);e.fail$data(dt.or(dt._`typeof ${m} != "object"`,dt._`${m} instanceof RegExp`,dt._`typeof ${m}.compare != "function"`,d(m)))}function u(){let p=c.schema,m=a.formats[p];if(!m||m===!0)return;if(typeof m!="object"||m instanceof RegExp||typeof m.compare!="function")throw Error(`"${s}": format "${p}" does not define "compare" function`);let x=t.scopeValue("formats",{key:p,ref:m,code:i.code.formats?dt._`${i.code.formats}${dt.getProperty(p)}`:void 0});e.fail$data(d(x))}function d(p){return dt._`${p}.compare(${n}, ${r}) ${Gf[s].fail} 0`}},dependencies:["format"]};var J8=(e)=>(e.addKeyword(LA.formatLimitDefinition),e);LA.default=J8});var UA=W(function(Jc,HA){Object.defineProperty(Jc,"__esModule",{value:!0});var Wn=NA(),M8=VA(),ha=ge(),qA=new ha.Name("fullFormats"),D8=new ha.Name("fastFormats"),_g=(e,t={keywords:!0})=>{if(Array.isArray(t))return WA(e,t,Wn.fullFormats,qA),e;let[n,r]=t.mode==="fast"?[Wn.fastFormats,D8]:[Wn.fullFormats,qA],s=t.formats||Wn.formatNames;if(WA(e,s,n,r),t.keywords)(0,M8.default)(e);return e};_g.get=(e,t="full")=>{let r=(t==="fast"?Wn.fastFormats:Wn.fullFormats)[e];if(!r)throw Error(`Unknown format "${e}"`);return r};function WA(e,t,n,r){var s,o;(s=(o=e.opts.code).formats)!==null&&s!==void 0||(o.formats=ha._`require("ajv-formats/dist/formats").${r}`);for(let i of t)e.addFormat(i,n[i])}HA.exports=Jc=_g;Object.defineProperty(Jc,"__esModule",{value:!0});Jc.default=_g});import{existsSync as KA,readFileSync as Og,readdirSync as GA,statSync as XA}from"node:fs";import{createRequire as F8}from"node:module";import{join as YA,relative as ga,resolve as kg}from"node:path";async function W8(){try{let{default:e}=await Promise.resolve().then(() => Jr(mg(),1)),{default:t}=await Promise.resolve().then(() => Jr(UA(),1));return{addFormats:t,Ajv:e}}catch(e){throw Error("Project validation requires ajv and ajv-formats: bun add ajv ajv-formats",{cause:e})}}async function ZA(e,t={}){let n=kg(e),r=[],s=[],o=0;for(let v of["project.schema.json","document.schema.json"]){let P=kg(n,v);if(!KA(P))continue;o+=1;let S=Ic(P),_=z8(S);if(_.length>0)r.push({errors:_.map(({reason:N,ref:F})=>({message:`$ref "${F}" ${N} — committed entry documents must be self-contained `+"single-resource schemas; regenerate with `jx schema`"})),file:v})}if(r.length>0)return{checked:o,issues:r,lint:s,valid:!1};let i=await aA(n);if(o+=1,!i.valid)r.push({errors:i.errors??[],file:i.file});let{addFormats:a,Ajv:c}=await W8(),{document:l}=await Lv(n,{write:!1}),u=new c({allErrors:!0,ownProperties:!0,strict:!1});a(u);let d=u.compile(l),p=uA(zA(n).flatMap((v)=>{try{return[JSON.parse(Og(v,"utf8"))]}catch{return[]}}));for(let v of L8)for(let P of tR(kg(n,v))){if(P.endsWith(".class.json"))continue;o+=1;let S=H8(P,ga(n,P));if(s.push(...S.warnings),S.failure!==null){r.push(S.failure);continue}let _=S.document,N=BA(_,ga(n,P));if(s.push(...N.warnings),N.failure!==null){r.push(N.failure);continue}if(d(_))s.push(...B8(_,ga(n,P),p));else r.push({errors:d.errors??[],file:ga(n,P)})}let m=new c({allErrors:!0,ownProperties:!0,strict:!1});a(m);let x=m.compile(hh());for(let v of zA(n)){o+=1;let P=Ic(v),S=BA(P,ga(n,v));if(s.push(...S.warnings),S.failure!==null)r.push(S.failure);else if(!x(P))r.push({errors:x.errors??[],file:ga(n,v)})}let{config:h}=ms(n),g=await ps(n,h),b=F8(import.meta.url);for(let v of g.extensions)for(let P of["project","document","fields"]){let S=v.schemas[P];if(!S)continue;o+=1;let _=new c({allErrors:!0,ownProperties:!0,strict:!1});a(_);for(let N of q8){let F=b.resolve(N);_.addSchema(Ic(F))}try{_.compile(Ic(S))}catch(N){r.push({errors:[{message:N instanceof Error?N.message:String(N)}],file:`${v.specifier} (${P} fragment)`})}}let j=t.strict===!0&&s.some((v)=>v.severity==="error");return{checked:o,issues:r,lint:s,valid:r.length===0&&!j}}function H8(e,t){if(!qr(e))return{document:Ic(e),failure:null,warnings:[]};let n=Og(e,"utf8"),r=Ad(n).map((s)=>({detail:s.message,file:t,message:`line ${s.line}, column ${s.column}: ${s.message}`,path:[],rule:"escape",severity:"warn",source:"notation"}));try{return{document:U8(n),failure:null,warnings:r}}catch(s){return{document:null,failure:{errors:[{message:$e(s)}],file:t},warnings:r}}}function BA(e,t){let n=[];try{Ha(e,t,n)}catch(s){return{failure:{errors:[{message:$e(s)}],file:t},warnings:[]}}return{failure:null,warnings:n.map(({pointer:s,problem:o})=>({detail:o.message,file:t,message:`${s} (line ${o.line}, column ${o.column}): ${o.message}`,path:s.split("/").slice(1),rule:"typescript-reading",severity:"warn",source:"function-body"}))}}function U8(e){let t=fo(e);return V(t)?t:null}function Ic(e){return JSON.parse(Og(e,"utf8"))}function B8(e,t,n){let r=[];for(let s of hA(e,n))r.push({...Xf(s),file:t,source:"popover"});for(let s of SA(e,n))r.push({...Xf(s),file:t,source:"dialog"});for(let s of xA(e))r.push({...Xf(s),criterion:s.criterion,file:t,source:"accessibility"});for(let s of o$(e))r.push({...Xf({...s,severity:"info"}),file:t,source:"module"});return r}function Xf(e){return{detail:e.detail,message:e.message,path:e.path,rule:e.rule,severity:e.severity}}function QA(e){return e.lint.map((t)=>{let n=t.criterion===void 0?`${t.source}/${t.rule}`:`${t.source}/${t.rule}, WCAG ${t.criterion}`;return`${t.file}: ${t.severity}: ${t.message} [${n}]`})}function z8(e){let t=[],n=new Set,r=(o)=>{let i=e;for(let a of o.slice(1).split("/")){if(a==="")continue;let c=a.replaceAll("~1","/").replaceAll("~0","~");if(!D(i))return!1;if(i=i[c],i===void 0)return!1}return!0},s=(o)=>{if(!V(o)||n.has(o))return;n.add(o);let i=o.$ref;if(k(i)){if(/^[a-zA-Z][a-zA-Z\d+.-]*:/.test(i))t.push({reason:"is an absolute URI editors resolve over the network",ref:i});else if(!i.startsWith("#"))t.push({reason:"is a relative path only Node module resolution can follow",ref:i});else if(i.length>1&&!i.startsWith("#/"))t.push({reason:"is an $anchor reference, which has no root-pointer form",ref:i});else if(i.length>1&&!r(i.slice(1)))t.push({reason:"points at no node in this document",ref:i})}for(let[a,c]of Object.entries(o)){if(!K8.has(a))continue;if(Array.isArray(c))for(let l of c)s(l);else if(V(c)){if(s(c),eR.has(a))for(let l of Object.values(c))s(l)}}};return s(e),t}function tR(e){if(!KA(e))return[];let t=[];for(let n of GA(e)){let r=YA(e,n);if(XA(r).isDirectory())t.push(...tR(r));else if(Wr(n))t.push(r)}return t.toSorted()}function zA(e){let t=[],n=(r)=>{for(let s of GA(r)){if(V8.has(s))continue;let o=YA(r,s);if(XA(o).isDirectory())n(o);else if(s.endsWith(".class.json"))t.push(o)}};return n(e),t.toSorted()}function nR(e){let t=[];for(let n of e.issues){t.push(`${n.file}:`);for(let r of n.errors){let s=V(r)?r:{},{instancePath:o,message:i}=s;t.push(` - ${o||"/"}: ${i??JSON.stringify(r)}`)}}return t}var L8,V8,q8,eR,K8;var rR=T(()=>{ds();Dt();ql();RE();cA();bA();vA();Si();Hf();le();Ur();Da();nh();L8=["components","pages","layouts"],V8=new Set(["node_modules","dist",".git"]),q8=["@jxsuite/schema/schemas/project.core.schema.json","@jxsuite/schema/schemas/project.fields.schema.json","@jxsuite/schema/schemas/document.paths.schema.json"];eR=new Set(["$defs","definitions","dependencies","dependentSchemas","patternProperties","properties"]),K8=new Set([...eR,"additionalItems","additionalProperties","allOf","anyOf","contains","contentSchema","else","if","items","not","oneOf","prefixItems","propertyNames","then","unevaluatedItems","unevaluatedProperties"])});Dt();import{relative as Ag,resolve as sR}from"node:path";async function G8(){let e=process.argv.slice(2),[t]=e;if(!t||t==="--help"||t==="-h")console.log(`Usage: jx <command> [options]
|
|
636
|
+
deps: ${n}}`};var n8={keyword:"dependencies",type:"object",schemaType:"object",error:QA.error,code(e){let[t,n]=r8(e);YA(e,t),ZA(e,n)}};function r8({schema:e}){let t={},n={};for(let r in e){if(r==="__proto__")continue;let s=Array.isArray(e[r])?t:n;s[r]=e[r]}return[t,n]}function YA(e,t=e.schema){let{gen:n,data:r,it:s}=e;if(Object.keys(t).length===0)return;let o=n.let("missing");for(let i in t){let a=t[i];if(a.length===0)continue;let l=Br.propertyInData(n,r,i,s.opts.ownProperties);if(e.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),s.allErrors)n.if(l,()=>{for(let c of a)Br.checkReportMissingProp(e,c)});else n.if(ba._`${l} && (${Br.checkMissingProp(e,a,o)})`),Br.reportMissingProp(e,o),n.else()}}QA.validatePropertyDeps=YA;function ZA(e,t=e.schema){let{gen:n,data:r,keyword:s,it:o}=e,i=n.name("valid");for(let a in t){if(XA.alwaysValidSchema(o,t[a]))continue;n.if(Br.propertyInData(n,r,a,o.opts.ownProperties),()=>{let l=e.subschema({keyword:s,schemaProp:a},i);e.mergeValidEvaluated(l,i)},()=>n.var(i,!0)),e.ok(i)}}QA.validateSchemaDeps=ZA;QA.default=n8});var sC=W(function(rC){Object.defineProperty(rC,"__esModule",{value:!0});var qd=$e(),nC=Oe(),i8={message:"property name must be valid",params:({params:e})=>qd._`{propertyName: ${e.propertyName}}`},a8={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:i8,code(e){let{gen:t,schema:n,data:r,it:s}=e;if(nC.alwaysValidSchema(s,n))return;let o=t.name("valid");t.forIn("key",r,(i)=>{e.setParams({propertyName:i}),e.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},o),t.if(qd.not(o),()=>{if(e.error(!0),!s.allErrors)t.break()})}),e.ok(o)}};rC.default=a8});var ab=W(function(oC){Object.defineProperty(oC,"__esModule",{value:!0});var to=Xn(),yt=$e(),c8=Kn(),no=Oe(),u8={message:"must NOT have additional properties",params:({params:e})=>yt._`{additionalProperty: ${e.additionalProperty}}`},f8={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:u8,code(e){let{gen:t,schema:n,parentSchema:r,data:s,errsCount:o,it:i}=e;if(!o)throw Error("ajv implementation error");let{allErrors:a,opts:l}=i;if(i.props=!0,l.removeAdditional!=="all"&&no.alwaysValidSchema(i,n))return;let c=to.allSchemaProperties(r.properties),u=to.allSchemaProperties(r.patternProperties);d(),e.ok(yt._`${o} === ${c8.default.errors}`);function d(){t.forIn("key",s,(g)=>{if(!c.length&&!u.length)y(g);else t.if(p(g),()=>y(g))})}function p(g){let x;if(c.length>8){let P=no.schemaRefOrVal(i,r.properties,"properties");x=to.isOwnProperty(t,P,g)}else if(c.length)x=yt.or(...c.map((P)=>yt._`${g} === ${P}`));else x=yt.nil;if(u.length)x=yt.or(x,...u.map((P)=>yt._`${to.usePattern(e,P)}.test(${g})`));return yt.not(x)}function m(g){t.code(yt._`delete ${s}[${g}]`)}function y(g){if(l.removeAdditional==="all"||l.removeAdditional&&n===!1){m(g);return}if(n===!1){if(e.setParams({additionalProperty:g}),e.error(),!a)t.break();return}if(typeof n=="object"&&!no.alwaysValidSchema(i,n)){let x=t.name("valid");if(l.removeAdditional==="failing")S(g,x,!1),t.if(yt.not(x),()=>{e.reset(),m(g)});else if(S(g,x),!a)t.if(yt.not(x),()=>t.break())}}function S(g,x,P){let w={keyword:"additionalProperties",dataProp:g,dataPropType:no.Type.Str};if(P===!1)Object.assign(w,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(w,x)}}};oC.default=f8});var cC=W(function(lC){Object.defineProperty(lC,"__esModule",{value:!0});var aC=ua(),Hd=Xn(),$a=Oe(),iC=ab(),p8={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:n,parentSchema:r,data:s,it:o}=e;if(o.opts.removeAdditional==="all"&&r.additionalProperties===void 0)iC.default.code(new aC.KeywordCxt(o,iC.default,"additionalProperties"));let i=Hd.allSchemaProperties(n);for(let d of i)o.definedProperties.add(d);if(o.opts.unevaluated&&i.length&&o.props!==!0)o.props=$a.mergeEvaluated.props(t,$a.toHash(i),o.props);let a=i.filter((d)=>!$a.alwaysValidSchema(o,n[d]));if(a.length===0)return;let l=t.name("valid");for(let d of a){if(c(d))u(d);else{if(t.if(Hd.propertyInData(t,s,d,o.opts.ownProperties)),u(d),!o.allErrors)t.else().var(l,!0);t.endIf()}e.it.definedProperties.add(d),e.ok(l)}function c(d){return o.opts.useDefaults&&!o.compositeRule&&n[d].default!==void 0}function u(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},l)}}};lC.default=p8});var fC=W(function(uC){Object.defineProperty(uC,"__esModule",{value:!0});var Wd=Xn(),ro=$e(),Bd=Oe(),Ud=Oe(),h8={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:n,data:r,parentSchema:s,it:o}=e,{opts:i}=o,a=Wd.allSchemaProperties(n),l=a.filter((S)=>Bd.alwaysValidSchema(o,n[S]));if(a.length===0||l.length===a.length&&(!o.opts.unevaluated||o.props===!0))return;let c=i.strictSchema&&!i.allowMatchingProperties&&s.properties,u=t.name("valid");if(o.props!==!0&&!(o.props instanceof ro.Name))o.props=Ud.evaluatedPropsToName(t,o.props);let{props:d}=o;p();function p(){for(let S of a){if(c)m(S);if(o.allErrors)y(S);else t.var(u,!0),y(S),t.if(u)}}function m(S){for(let g in c)if(new RegExp(S).test(g))Bd.checkStrictMode(o,`property ${g} matches pattern ${S} (use allowMatchingProperties)`)}function y(S){t.forIn("key",r,(g)=>{t.if(ro._`${Wd.usePattern(e,S)}.test(${g})`,()=>{let x=l.includes(S);if(!x)e.subschema({keyword:"patternProperties",schemaProp:S,dataProp:g,dataPropType:Ud.Type.Str},u);if(o.opts.unevaluated&&d!==!0)t.assign(ro._`${d}[${g}]`,!0);else if(!x&&!o.allErrors)t.if(ro.not(u),()=>t.break())})})}}};uC.default=h8});var mC=W(function(pC){Object.defineProperty(pC,"__esModule",{value:!0});var dC=Oe(),y8={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:n,it:r}=e;if(dC.alwaysValidSchema(r,n)){e.fail();return}let s=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},s),e.failResult(s,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};pC.default=y8});var yC=W(function(gC){Object.defineProperty(gC,"__esModule",{value:!0});var hC=Xn(),b8={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:hC.validateUnion,error:{message:"must match a schema in anyOf"}};gC.default=b8});var $C=W(function(bC){Object.defineProperty(bC,"__esModule",{value:!0});var so=$e(),xC=Oe(),S8={message:"must match exactly one schema in oneOf",params:({params:e})=>so._`{passingSchemas: ${e.passing}}`},w8={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:S8,code(e){let{gen:t,schema:n,parentSchema:r,it:s}=e;if(!Array.isArray(n))throw Error("ajv implementation error");if(s.opts.discriminator&&r.discriminator)return;let o=n,i=t.let("valid",!1),a=t.let("passing",null),l=t.name("_valid");e.setParams({passing:a}),t.block(c),e.result(i,()=>e.reset(),()=>e.error(!0));function c(){o.forEach((u,d)=>{let p;if(xC.alwaysValidSchema(s,u))t.var(l,!0);else p=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},l);if(d>0)t.if(so._`${l} && ${i}`).assign(i,!1).assign(a,so._`[${a}, ${d}]`).else();t.if(l,()=>{if(t.assign(i,!0),t.assign(a,d),p)e.mergeEvaluated(p,so.Name)})})}}};bC.default=w8});var vC=W(function(wC){Object.defineProperty(wC,"__esModule",{value:!0});var SC=Oe(),E8={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:n,it:r}=e;if(!Array.isArray(n))throw Error("ajv implementation error");let s=t.name("valid");n.forEach((o,i)=>{if(SC.alwaysValidSchema(r,o))return;let a=e.subschema({keyword:"allOf",schemaProp:i},s);e.ok(s),e.mergeEvaluated(a)})}};wC.default=E8});var PC=W(function(jC){Object.defineProperty(jC,"__esModule",{value:!0});var oo=$e(),zd=Oe(),P8={message:({params:e})=>oo.str`must match "${e.ifClause}" schema`,params:({params:e})=>oo._`{failingKeyword: ${e.ifClause}}`},_8={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:P8,code(e){let{gen:t,parentSchema:n,it:r}=e;if(n.then===void 0&&n.else===void 0)zd.checkStrictMode(r,'"if" without "then" and "else" is ignored');let s=EC(r,"then"),o=EC(r,"else");if(!s&&!o)return;let i=t.let("valid",!0),a=t.name("_valid");if(l(),e.reset(),s&&o){let u=t.let("ifClause");e.setParams({ifClause:u}),t.if(a,c("then",u),c("else",u))}else if(s)t.if(a,c("then"));else t.if(oo.not(a),c("else"));e.pass(i,()=>e.error(!0));function l(){let u=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(u)}function c(u,d){return()=>{let p=e.subschema({keyword:u},a);if(t.assign(i,a),e.mergeValidEvaluated(p,i),d)t.assign(d,oo._`${u}`);else e.setParams({ifClause:u})}}}};function EC(e,t){let n=e.schema[t];return n!==void 0&&!zd.alwaysValidSchema(e,n)}jC.default=_8});var OC=W(function(kC){Object.defineProperty(kC,"__esModule",{value:!0});var _C=Oe(),O8={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:n}){if(t.if===void 0)_C.checkStrictMode(n,`"${e}" without "if" is ignored`)}};kC.default=O8});var lb=W(function(AC){Object.defineProperty(AC,"__esModule",{value:!0});var C8=ob(),R8=qA(),N8=ib(),T8=zA(),J8=GA(),M8=Vd(),I8=sC(),D8=ab(),L8=cC(),F8=fC(),V8=mC(),q8=yC(),H8=$C(),W8=vC(),B8=PC(),U8=OC();function z8(e=!1){let t=[V8.default,q8.default,H8.default,W8.default,B8.default,U8.default,I8.default,D8.default,M8.default,L8.default,F8.default];if(e)t.push(R8.default,T8.default);else t.push(C8.default,N8.default);return t.push(J8.default),t}AC.default=z8});var cb=W(function(NC){Object.defineProperty(NC,"__esModule",{value:!0});NC.dynamicAnchor=void 0;var Sa=$e(),G8=Kn(),Kd=fc(),CC=Md(),X8={keyword:"$dynamicAnchor",schemaType:"string",code:(e)=>RC(e,e.schema)};function RC(e,t){let{gen:n,it:r}=e;r.schemaEnv.root.dynamicAnchors[t]=!0;let s=Sa._`${G8.default.dynamicAnchors}${Sa.getProperty(t)}`,o=r.errSchemaPath==="#"?r.validateName:Y8(e);n.if(Sa._`!${s}`,()=>n.assign(s,o))}NC.dynamicAnchor=RC;function Y8(e){let{schemaEnv:t,schema:n,self:r}=e.it,{root:s,baseId:o,localRefs:i,meta:a}=t.root,{schemaId:l}=r.opts,c=new Kd.SchemaEnv({schema:n,schemaId:l,root:s,baseId:o,localRefs:i,meta:a});return Kd.compileSchema.call(r,c),CC.getValidate(e,c)}NC.default=X8});var ub=W(function(MC){Object.defineProperty(MC,"__esModule",{value:!0});MC.dynamicRef=void 0;var Gd=$e(),Q8=Kn(),Xd=Md(),eK={keyword:"$dynamicRef",schemaType:"string",code:(e)=>JC(e,e.schema)};function JC(e,t){let{gen:n,keyword:r,it:s}=e;if(t[0]!=="#")throw Error(`"${r}" only supports hash fragment reference`);let o=t.slice(1);if(s.allErrors)i();else{let l=n.let("valid",!1);i(l),e.ok(l)}function i(l){if(s.schemaEnv.root.dynamicAnchors[o]){let c=n.let("_v",Gd._`${Q8.default.dynamicAnchors}${Gd.getProperty(o)}`);n.if(c,a(c,l),a(s.validateName,l))}else a(s.validateName,l)()}function a(l,c){return c?()=>n.block(()=>{Xd.callRef(e,l),n.let(c,!0)}):()=>Xd.callRef(e,l)}}MC.dynamicRef=JC;MC.default=eK});var VC=W(function(FC){Object.defineProperty(FC,"__esModule",{value:!0});var DC=cb(),LC=Oe(),nK={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){if(e.schema)DC.dynamicAnchor(e,"");else LC.checkStrictMode(e.it,"$recursiveAnchor: false is ignored")}};FC.default=nK});var WC=W(function(HC){Object.defineProperty(HC,"__esModule",{value:!0});var qC=ub(),sK={keyword:"$recursiveRef",schemaType:"string",code:(e)=>qC.dynamicRef(e,e.schema)};HC.default=sK});var UC=W(function(BC){Object.defineProperty(BC,"__esModule",{value:!0});var iK=cb(),aK=ub(),lK=VC(),cK=WC(),uK=[iK.default,aK.default,lK.default,cK.default];BC.default=uK});var KC=W(function(zC){Object.defineProperty(zC,"__esModule",{value:!0});var Yd=Vd(),dK={keyword:"dependentRequired",type:"object",schemaType:"object",error:Yd.error,code:(e)=>Yd.validatePropertyDeps(e)};zC.default=dK});var YC=W(function(XC){Object.defineProperty(XC,"__esModule",{value:!0});var GC=Vd(),mK={keyword:"dependentSchemas",type:"object",schemaType:"object",code:(e)=>GC.validateSchemaDeps(e)};XC.default=mK});var eR=W(function(QC){Object.defineProperty(QC,"__esModule",{value:!0});var ZC=Oe(),gK={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:e,parentSchema:t,it:n}){if(t.contains===void 0)ZC.checkStrictMode(n,`"${e}" without "contains" is ignored`)}};QC.default=gK});var nR=W(function(tR){Object.defineProperty(tR,"__esModule",{value:!0});var xK=KC(),bK=YC(),$K=eR(),SK=[xK.default,bK.default,$K.default];tR.default=SK});var sR=W(function(rR){Object.defineProperty(rR,"__esModule",{value:!0});var Zt=$e(),Zd=Oe(),vK=Kn(),EK={message:"must NOT have unevaluated properties",params:({params:e})=>Zt._`{unevaluatedProperty: ${e.unevaluatedProperty}}`},jK={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:EK,code(e){let{gen:t,schema:n,data:r,errsCount:s,it:o}=e;if(!s)throw Error("ajv implementation error");let{allErrors:i,props:a}=o;if(a instanceof Zt.Name)t.if(Zt._`${a} !== true`,()=>t.forIn("key",r,(d)=>t.if(c(a,d),()=>l(d))));else if(a!==!0)t.forIn("key",r,(d)=>a===void 0?l(d):t.if(u(a,d),()=>l(d)));o.props=!0,e.ok(Zt._`${s} === ${vK.default.errors}`);function l(d){if(n===!1){if(e.setParams({unevaluatedProperty:d}),e.error(),!i)t.break();return}if(!Zd.alwaysValidSchema(o,n)){let p=t.name("valid");if(e.subschema({keyword:"unevaluatedProperties",dataProp:d,dataPropType:Zd.Type.Str},p),!i)t.if(Zt.not(p),()=>t.break())}}function c(d,p){return Zt._`!${d} || !${d}[${p}]`}function u(d,p){let m=[];for(let y in d)if(d[y]===!0)m.push(Zt._`${p} !== ${y}`);return Zt.and(...m)}}};rR.default=jK});var iR=W(function(oR){Object.defineProperty(oR,"__esModule",{value:!0});var vn=$e(),Qd=Oe(),_K={message:({params:{len:e}})=>vn.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>vn._`{limit: ${e}}`},kK={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:_K,code(e){let{gen:t,schema:n,data:r,it:s}=e,o=s.items||0;if(o===!0)return;let i=t.const("len",vn._`${r}.length`);if(n===!1)e.setParams({len:o}),e.fail(vn._`${i} > ${o}`);else if(typeof n=="object"&&!Qd.alwaysValidSchema(s,n)){let l=t.var("valid",vn._`${i} <= ${o}`);t.if(vn.not(l),()=>a(l,o)),e.ok(l)}s.items=!0;function a(l,c){t.forRange("i",c,i,(u)=>{if(e.subschema({keyword:"unevaluatedItems",dataProp:u,dataPropType:Qd.Type.Num},l),!s.allErrors)t.if(vn.not(l),()=>t.break())})}}};oR.default=kK});var lR=W(function(aR){Object.defineProperty(aR,"__esModule",{value:!0});var AK=sR(),CK=iR(),RK=[AK.default,CK.default];aR.default=RK});var uR=W(function(cR){Object.defineProperty(cR,"__esModule",{value:!0});var ve=$e(),TK={message:({schemaCode:e})=>ve.str`must match format "${e}"`,params:({schemaCode:e})=>ve._`{format: ${e}}`},JK={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:TK,code(e,t){let{gen:n,data:r,$data:s,schema:o,schemaCode:i,it:a}=e,{opts:l,errSchemaPath:c,schemaEnv:u,self:d}=a;if(!l.validateFormats)return;if(s)p();else m();function p(){let y=n.scopeValue("formats",{ref:d.formats,code:l.code.formats}),S=n.const("fDef",ve._`${y}[${i}]`),g=n.let("fType"),x=n.let("format");n.if(ve._`typeof ${S} == "object" && !(${S} instanceof RegExp)`,()=>n.assign(g,ve._`${S}.type || "string"`).assign(x,ve._`${S}.validate`),()=>n.assign(g,ve._`"string"`).assign(x,S)),e.fail$data(ve.or(P(),w()));function P(){if(l.strictSchema===!1)return ve.nil;return ve._`${i} && !${x}`}function w(){let E=u.$async?ve._`(${S}.async ? await ${x}(${r}) : ${x}(${r}))`:ve._`${x}(${r})`,j=ve._`(typeof ${x} == "function" ? ${E} : ${x}.test(${r}))`;return ve._`${x} && ${x} !== true && ${g} === ${t} && !${j}`}}function m(){let y=d.formats[o];if(!y){P();return}if(y===!0)return;let[S,g,x]=w(y);if(S===t)e.pass(E());function P(){if(l.strictSchema===!1){d.logger.warn(j());return}throw Error(j());function j(){return`unknown format "${o}" ignored in schema at path "${c}"`}}function w(j){let A=j instanceof RegExp?ve.regexpCode(j):l.code.formats?ve._`${l.code.formats}${ve.getProperty(o)}`:void 0,T=n.scopeValue("formats",{key:o,ref:j,code:A});if(typeof j=="object"&&!(j instanceof RegExp))return[j.type||"string",j.validate,ve._`${T}.validate`];return["string",j,T]}function E(){if(typeof y=="object"&&!(y instanceof RegExp)&&y.async){if(!u.$async)throw Error("async format in sync schema");return ve._`await ${x}(${r})`}return typeof g=="function"?ve._`${x}(${r})`:ve._`${x}.test(${r})`}}}};cR.default=JK});var fb=W(function(fR){Object.defineProperty(fR,"__esModule",{value:!0});var IK=uR(),DK=[IK.default];fR.default=DK});var db=W(function(dR){Object.defineProperty(dR,"__esModule",{value:!0});dR.contentVocabulary=dR.metadataVocabulary=void 0;dR.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];dR.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var hR=W(function(mR){Object.defineProperty(mR,"__esModule",{value:!0});var VK=rb(),qK=sb(),HK=lb(),WK=UC(),BK=nR(),UK=lR(),zK=fb(),ep=db(),KK=[WK.default,VK.default,qK.default,(0,HK.default)(!0),zK.default,ep.metadataVocabulary,ep.contentVocabulary,BK.default,UK.default];mR.default=KK});var bR=W(function(yR){Object.defineProperty(yR,"__esModule",{value:!0});yR.DiscrError=void 0;var gR;(function(e){e.Tag="tag",e.Mapping="mapping"})(gR||(yR.DiscrError=gR={}))});var pb=W(function(SR){Object.defineProperty(SR,"__esModule",{value:!0});var Zn=$e(),wa=bR(),tp=fc(),XK=da(),$R=Oe(),YK={message:({params:{discrError:e,tagName:t}})=>e===wa.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:n}})=>Zn._`{error: ${e}, tag: ${n}, tagValue: ${t}}`},ZK={keyword:"discriminator",type:"object",schemaType:"object",error:YK,code(e){let{gen:t,data:n,schema:r,parentSchema:s,it:o}=e,{oneOf:i}=s;if(!o.opts.discriminator)throw Error("discriminator: requires discriminator option");let a=r.propertyName;if(typeof a!="string")throw Error("discriminator: requires propertyName");if(r.mapping)throw Error("discriminator: mapping is not supported");if(!i)throw Error("discriminator: requires oneOf keyword");let l=t.let("valid",!1),c=t.const("tag",Zn._`${n}${Zn.getProperty(a)}`);t.if(Zn._`typeof ${c} == "string"`,()=>u(),()=>e.error(!1,{discrError:wa.DiscrError.Tag,tag:c,tagName:a})),e.ok(l);function u(){let m=p();t.if(!1);for(let y in m)t.elseIf(Zn._`${c} === ${y}`),t.assign(l,d(m[y]));t.else(),e.error(!1,{discrError:wa.DiscrError.Mapping,tag:c,tagName:a}),t.endIf()}function d(m){let y=t.name("valid"),S=e.subschema({keyword:"oneOf",schemaProp:m},y);return e.mergeEvaluated(S,Zn.Name),y}function p(){var m;let y={},S=x(s),g=!0;for(let E=0;E<i.length;E++){let j=i[E];if((j===null||j===void 0?void 0:j.$ref)&&!$R.schemaHasRulesButRef(j,o.self.RULES)){let T=j.$ref;if(j=tp.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,T),j instanceof tp.SchemaEnv)j=j.schema;if(j===void 0)throw new XK.default(o.opts.uriResolver,o.baseId,T)}let A=(m=j===null||j===void 0?void 0:j.properties)===null||m===void 0?void 0:m[a];if(typeof A!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);g=g&&(S||x(j)),P(A,E)}if(!g)throw Error(`discriminator: "${a}" must be required`);return y;function x({required:E}){return Array.isArray(E)&&E.includes(a)}function P(E,j){if(E.const)w(E.const,j);else if(E.enum)for(let A of E.enum)w(A,j);else throw Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function w(E,j){if(typeof E!="string"||E in y)throw Error(`discriminator: "${a}" values must be unique strings`);y[E]=j}}}};SR.default=ZK});var wR=W(function(Vse,e9){e9.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/schema",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],type:["object","boolean"],$comment:"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",properties:{definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}}}});var vR=W(function(qse,t9){t9.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$dynamicAnchor:"meta",title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}}}});var ER=W(function(Hse,n9){n9.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/unevaluated",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$dynamicAnchor:"meta",title:"Unevaluated applicator vocabulary meta-schema",type:["object","boolean"],properties:{unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}}}});var jR=W(function(Wse,r9){r9.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/content",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}}}});var PR=W(function(Bse,s9){s9.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/core",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0},$dynamicAnchor:"meta",title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},$defs:{anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}}}});var _R=W(function(Use,o9){o9.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/format-annotation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},$dynamicAnchor:"meta",title:"Format vocabulary meta-schema for annotation results",type:["object","boolean"],properties:{format:{type:"string"}}}});var kR=W(function(zse,i9){i9.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$dynamicAnchor:"meta",title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}});var OR=W(function(Kse,a9){a9.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/validation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/validation":!0},$dynamicAnchor:"meta",title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}});var CR=W(function(AR){Object.defineProperty(AR,"__esModule",{value:!0});var l9=wR(),c9=vR(),u9=ER(),f9=jR(),d9=PR(),p9=_R(),m9=kR(),h9=OR(),g9=["/properties"];function y9(e){return[l9,c9,u9,f9,d9,t(this,p9),m9,t(this,h9)].forEach((n)=>this.addMetaSchema(n,void 0,!1)),this;function t(n,r){return e?n.$dataMetaSchema(r,g9):r}}AR.default=y9});var gb=W(function(En,hb){Object.defineProperty(En,"__esModule",{value:!0});En.MissingRefError=En.ValidationError=En.CodeGen=En.Name=En.nil=En.stringify=En.str=En._=En.KeywordCxt=En.Ajv2020=void 0;var b9=nb(),$9=hR(),S9=pb(),w9=CR(),mb="https://json-schema.org/draft/2020-12/schema";class mc extends b9.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){if(super._addVocabularies(),$9.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(S9.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:t}=this.opts;if(!t)return;w9.default.call(this,e),this.refs["http://json-schema.org/schema"]=mb}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(mb)?mb:void 0)}}En.Ajv2020=mc;hb.exports=En=mc;hb.exports.Ajv2020=mc;Object.defineProperty(En,"__esModule",{value:!0});En.default=mc;var v9=ua();Object.defineProperty(En,"KeywordCxt",{enumerable:!0,get:function(){return v9.KeywordCxt}});var va=$e();Object.defineProperty(En,"_",{enumerable:!0,get:function(){return va._}});Object.defineProperty(En,"str",{enumerable:!0,get:function(){return va.str}});Object.defineProperty(En,"stringify",{enumerable:!0,get:function(){return va.stringify}});Object.defineProperty(En,"nil",{enumerable:!0,get:function(){return va.nil}});Object.defineProperty(En,"Name",{enumerable:!0,get:function(){return va.Name}});Object.defineProperty(En,"CodeGen",{enumerable:!0,get:function(){return va.CodeGen}});var E9=cc();Object.defineProperty(En,"ValidationError",{enumerable:!0,get:function(){return E9.default}});var j9=da();Object.defineProperty(En,"MissingRefError",{enumerable:!0,get:function(){return j9.default}})});import{existsSync as rp,readFileSync as TR}from"node:fs";import{createRequire as RR}from"node:module";import{basename as k9,isAbsolute as O9,relative as A9,resolve as yb}from"node:path";import{fileURLToPath as NR,pathToFileURL as C9}from"node:url";function np(e){return JSON.parse(TR(e,"utf8"))}async function JR(e){let t=yb(e),n=qn(t),r=yb(t,"project.schema.json");if(!rp(n))throw Error(`No project.jxn or project.json in ${t}`);if(!rp(r))throw Error(`project.schema.json not found in ${t} — run \`jx schema\` to generate it from `+"the project file's extensions");let s=lu(TR(n,"utf8"),n),o=np(r);o.$id=C9(r).href;let i;try{({default:i}=await Promise.resolve().then(() => Sr(gb(),1)))}catch(d){throw Error("Project validation requires ajv: bun add ajv",{cause:d})}let l=await new i({allErrors:!0,loadSchema:(d)=>T9(d,t),strict:!1}).compileAsync(o),c=l(s),u=l.errors??null;return{errors:u&&rs(n)?N9(u,s):u,file:k9(n),valid:c}}function R9(e,t){let n=e;for(let r of t.split("/").slice(1)){let s=r.replaceAll("~1","/").replaceAll("~0","~");n=Array.isArray(n)?n[Number(s)]:L(n)?n[s]:void 0}return n}function N9(e,t){return e.map((n)=>{if(!D(n)||!("keyword"in n)||n.keyword!=="type"||!("params"in n)||!D(n.params)||!("type"in n.params)||n.params.type!=="array"||!("instancePath"in n)||!k(n.instancePath))return n;let r=R9(t,n.instancePath),s=ft(r,"",n.instancePath),o=n.instancePath.split("/").at(-1)??"";if(s===null||s.includes(`
|
|
637
|
+
`)||o==="")return n;return{...n,message:`must be a list, written as ${o} { - ${s} }`}})}async function T9(e,t){if(!e.startsWith("file:"))throw Error(`Cannot resolve schema ref "${e}": only project-relative file refs are loadable (canonical URIs must resolve from already-loaded fragments)`);let n=NR(e),r=A9(t,n);if(r.startsWith("..")||O9(r))throw Error(`Schema ref "${e}" escapes the project root ${t}`);if(rp(n))return np(n);let s=r.split("\\").join("/"),o="node_modules/",i=s.lastIndexOf(o);if(i===-1)throw Error(`Schema ref "${e}" does not exist`);let a=s.slice(i+o.length),l="@jxsuite/schema/",c;try{c=RR(yb(t,"package.json")).resolve(a)}catch(u){if(!a.startsWith(l))throw Error(`Schema ref "${e}" does not exist and "${a}" is not resolvable from the `+"project — is the package installed?",{cause:u});try{c=RR(import.meta.url).resolve(a)}catch(d){let p=NR(new URL(`../${a.slice(l.length)}`,import.meta.url));if(rp(p))return np(p);throw Error(`Schema ref "${e}" does not exist and "${a}" is not resolvable from the project or this host's core`,{cause:d})}}return np(c)}var MR=J(()=>{ce();Qc();iu();cu();Eo()});function zr(e){return L(e.attributes)?e.attributes:{}}function Qt(e,t){let n=zr(e)[t];return k(n)?n:null}function Et(e){return k(e.tagName)?e.tagName.toLowerCase():""}function cn(e,t="the popover"){let n=k(e.id)?e.id:Qt(e,"id");if(n)return`#${n}`;let r=Et(e);return r===""?t:`the <${r}>`}function I9(e){let t=zr(e).popover;return k(t)?t:null}function DR(e){let t=new Set,n=new Set;for(let r of e){let s=r!==null&&k(r.tagName)?r.tagName:"";if(r===null||!s.includes("-"))continue;if(xb(r))t.add(s);let o=r.observedAttributes;if(Array.isArray(o)&&D9.every((i)=>o.includes(i)))n.add(s)}return{invokerTags:n,popoverTags:t}}function xb(e){return"popover"in zr(e)||"popover"in e}function hc(e,t){return xb(e)||(t?.popoverTags?.has(Et(e))??!1)}function io(e){if(k(e.id)&&e.id!=="")return e.id;let t=Qt(e,"id");return t===""?null:t}function*Ur(e,t=[],n=null,r){yield{enclosing:n,node:e,path:t};let s=hc(e,r)?e:n,{children:o}=e;if(Array.isArray(o)){for(let[l,c]of o.entries())if(D(c))yield*Ur(c,[...t,"children",l],s,r)}else if(L(o)&&Ot(o.map))yield*Ur(o.map,[...t,"children","map"],s,r);let i=Ot(e.map)?e.map:null;if(i)yield*Ur(i,[...t,"map"],s,r);let a=L(e.cases)?e.cases:{};for(let[l,c]of Object.entries(a))if(D(c))yield*Ur(c,[...t,"cases",l],s,r)}function bb(e,t){let n=[];for(let{node:r}of Ur(e,[],null,t)){if(!hc(r,t))continue;let s=io(r);if(s!==null&&!n.includes(s))n.push(s)}return n}function sp(e){return e.startsWith("@")}function LR(e){return e.startsWith(":")||e.startsWith("&")||e.startsWith(".")||e.startsWith("[")}function ln(e,t){let n=e?.[t];if(n===void 0||mo(n)||Array.isArray(n))return null;return String(n)}function FR(e){for(let[t,n]of Object.entries(e??{})){if(!mo(n))continue;if(LR(t)&&t.includes(":popover-open")&&ln(n,"display")!==null)return!0;if(sp(t)&&FR(n))return!0}return!1}function VR(e){for(let[t,n]of Object.entries(e??{})){if(!mo(n))continue;if(LR(t)&&t.includes(":popover-open"))return!0;if(sp(t)&&VR(n))return!0}return!1}function F9(e){return L9.some((t)=>ln(e,t)!==null)}function V9(e){if(!e)return[];let t=[];for(let[n,r]of Object.entries(e))if(sp(n)&&mo(r)&&ln(r,"display")!==null)t.push(n);return t}function qR(e){if(!e)return[];let t=[],n=ln(e,"transition");if(n!==null)t.push(n);for(let[r,s]of Object.entries(e))if(sp(r)&&mo(s))t.push(...qR(s));return t}function q9(e){if(!e)return!1;if(ln(e,"positionAnchor")!==null||ln(e,"position-anchor")!==null)return!0;return["top","left","right","bottom","inset","insetBlockStart","insetInlineStart"].some((t)=>(ln(e,t)??"").includes("anchor("))}function H9(e){if(!e)return!1;if(ln(e,"positionArea")!==null||ln(e,"position-area")!==null||ln(e,"positionTryFallbacks")!==null||ln(e,"position-try-fallbacks")!==null)return!0;return Object.keys(e).some((t)=>t.startsWith("@supports"))}function HR(e,t){let n=[...Ur(e,[],null,t)],r=bb(e,t),s=n.some(({node:a})=>hc(a,t)),o=new Set;for(let{node:a}of n)if(IR.has(Et(a))){let l=Qt(a,"popovertarget");if(l!==null)o.add(l)}let i=[];for(let{enclosing:a,node:l,path:c}of n)if(i.push(...W9(l,c,a,r,s,t)),xb(l))i.push(...B9(l,c,o));return i}function W9(e,t,n,r,s,o){let i=[],a=Et(e),l=Qt(e,"popovertarget"),c=IR.has(a)||(o?.invokerTags?.has(a)??!1);if(l!==null&&!c)return i.push({detail:"`popovertarget` and `popovertargetaction` come from the `PopoverTargetAttributes` IDL mixin, which HTML includes into `HTMLButtonElement` and `HTMLInputElement` and into nothing else. Elsewhere they parse and do nothing. A link inside an open popover "+"dismisses it by navigating away, which is why this looks like it works — but it does "+`not for a new tab or a same-page fragment. Remove both attributes. ${st}`,fix:"invoker",message:`<${a||"element"}> carries popovertarget, which only <button> and <input> support.`,path:t,rule:"invoker-not-button",severity:"error"}),i;if(l!==null){if(s&&!r.includes(l)){let u=r.length>0?`The popovers here are: ${r.map((d)=>`"${d}"`).join(", ")}. `:"";i.push({detail:`No element in this document declares \`popover\` with the id "${l}". ${u}A target that names nothing does nothing, silently. ${st}`,message:`popovertarget="${l}" names no popover in this document.`,path:t,rule:"target-missing",severity:"error"})}else if(n!==null&&io(n)!==null&&io(n)!==l)i.push({detail:`This control is inside ${cn(n)} but targets "${l}". Dismissing a different popover leaves the one the reader is looking at open. This is usually a copy-paste between two panels in the same file. ${st}`,message:`A control inside ${cn(n)} targets "${l}" instead.`,path:t,rule:"target-mismatch",severity:"warn"})}if(a==="a"&&n!==null&&l===null){let u=Qt(e,"href")??(k(e.href)?e.href:null),d=Qt(e,"target")==="_blank",p=u!==null&&u.includes("#");if(d||p){let m=d?"it opens a new tab, so the panel stays open on the page behind it. ":"it is a same-document fragment, so the page scrolls behind the open panel. ";i.push({detail:`A link inside a panel normally dismisses it by navigating away. This one does not: ${m}`+"There is no declarative fix — a link cannot carry `popovertarget`. Move it out of the "+`panel, make it a <button>, or accept it deliberately. ${st}`,message:`A link inside ${cn(n)} does not dismiss it.`,path:t,rule:"link-does-not-dismiss",severity:"warn"})}}return i}function B9(e,t,n){let r=[],{style:s}=e,o=cn(e),i=I9(e);if(i!==null&&i!==""&&!M9.some((c)=>c===i))r.push({detail:"`popover` is an enumerated attribute taking `auto`, `manual` or `hint`. Anything else falls back to the invalid-value default `manual`, which gives up light dismiss and gives "+`up Escape — so the panel opens and there is no way to close it. Write "auto". ${st}`,fix:"mode",message:`${o} declares popover="${i}", which is not one of auto, manual or hint.`,path:t,rule:"invalid-mode",severity:"error"});else if(Ge(zr(e).popover))r.push({detail:`\`popover\` carries its value in its text, so a boolean is not the right shape. Written as \`true\` it reaches two of the compiler's emitters as \`popover="true"\`, which is not one of the three keywords, so HTML falls back to \`manual\`: no light dismiss, no Escape, and the trigger stops toggling. Write "auto". ${st}`,fix:"mode",message:`${o} writes popover as a boolean.`,path:t,rule:"invalid-mode",severity:"error"});let a=ln(s,"display");if(a!==null&&a!=="revert"&&a!=="revert-layer")r.push({detail:"A closed popover is hidden by the browser's own `[popover]:not(:popover-open) { display: none }`. That rule is UA-origin, so any author `display` beats it at any specificity, and "+"the panel is laid out on every page whether it is open or not — usually parked off the "+`side of the viewport by the transform meant to animate it, so nothing looks wrong until you scroll sideways. \`display\` belongs in \`:popover-open\` and nowhere else. ${st}`,fix:"display",message:`${o} sets display in its base rule.`,path:t,rule:"base-display",severity:"error"});for(let c of V9(s))r.push({detail:`The same defect as a base \`display\`, arriving through \`${c}\` and therefore only at `+"one width — which is what makes it hard to see. Gate the TRIGGER on a breakpoint, never "+`the panel: the popover mechanism is what hides the panel. ${st}`,fix:"display",message:`${o} sets display inside ${c}.`,path:t,rule:"breakpoint-display",severity:"error"});if(ln(s,"visibility")!==null)r.push({detail:`A second hiding mechanism the browser already provides. Once \`display\` leaves the base rule this one only adds a frame of flicker on open, and it hides the element from assistive technology in a way \`display: none\` already did. ${st}`,fix:"display",message:`${o} also hides itself with visibility.`,path:t,rule:"base-visibility",severity:"warn"});if(!VR(s))r.push({detail:"Nothing changes when it opens, so no transition on it can run and — if `display` is not "+"in the base rule — the panel has no `display` at all while open. This is usually a panel "+`that was styled before it was made a popover. ${st}`,message:`${o} has no :popover-open rule.`,path:t,rule:"no-open-rule",severity:"warn"});else if(!FR(s)&&a===null&&F9(s))r.push({detail:`${o} declares flex or grid properties, but neither its base rule nor its `+"`:popover-open` rule sets a `display` for them to apply to — and the base rule must not "+`(that is what keeps the closed panel hidden). So it opens with the UA's \`display: block\` and the layout silently does nothing. Put \`display: flex\` in \`:popover-open\`. ${st}`,fix:"open-display",message:`${o} is laid out with flex or grid but never sets display.`,path:t,rule:"no-open-display",severity:"error"});for(let c of qR(s))if(c.includes("display")&&!c.includes("overlay")){r.push({detail:"`display …allow-discrete` keeps the box alive while it animates out; `overlay "+"…allow-discrete` is what keeps it in the TOP LAYER for those same milliseconds. "+`Without it the panel drops behind the page content and the backdrop disappears a frame early, so the exit reads as a flicker rather than an animation. ${st}`,message:`${o} transitions display but not overlay.`,path:t,rule:"cut-exit",severity:"warn"});break}if(q9(s)&&!H9(s))r.push({detail:"When `anchor()` does not resolve, every inset it feeds computes to `auto` — and a "+`\`position: fixed\` box with four \`auto\` insets falls back to its STATIC position, which for a panel declared inside a header is in the middle of the header. Use \`position-area\` with \`position-try-fallbacks\`, or add a \`@supports\` block that positions it without anchors. ${st}`,message:`${o} is anchor-positioned with no fallback.`,path:t,rule:"unsafe-anchor",severity:"warn"});let l=io(e);if(l!==null&&!n.has(l))r.push({detail:`No \`<button>\` or \`<input>\` in this document names it with \`popovertarget\`. If it is opened from another file or from a function that calls \`showPopover()\`, this is fine; otherwise there is no way for a reader to open it. ${st}`,message:`${o} has no invoker in this document.`,path:t,rule:"no-invoker",severity:"warn"});return r}var M9,IR,D9,L9,st="See docs/framework/concepts/overlays.";var op=J(()=>{ce();M9=["auto","manual","hint"],IR=new Set(["button","input"]);D9=["popovertarget","popovertargetaction","command","commandfor"];L9=["flexDirection","flex-direction","alignItems","align-items","justifyContent","justify-content","flexWrap","flex-wrap","gridTemplateColumns","grid-template-columns","gridTemplateRows","grid-template-rows","gap"]});function _a(e,t){let n=zr(e),r=t in n?n[t]:e[t];if(r===void 0||r===null)return{kind:"absent"};if(me(r)||L(r))return{kind:"bound"};if(k(r))return r.includes("${")?{kind:"bound"}:{kind:"text",text:r};return{isTrue:r===!0,kind:"other"}}function ja(e,t){let n=_a(e,t);return n.kind==="text"&&n.text.trim()!==""?n.text:null}function en(e,t){return _a(e,t).kind!=="absent"}function ao(e){let t=_a(e,"role");if(t.kind==="bound")return Pa;return t.kind==="text"?t.text.trim().toLowerCase().split(/\s+/)[0]:null}function ip(e){let t=_a(e,"id");if(t.kind==="bound")return Pa;return t.kind==="text"&&t.text!==""?t.text:null}function Qn(e,t){let n=_a(e,t);return n.kind==="bound"||n.kind==="text"&&n.text.trim()!==""}function ap(e){let t=e.textContent;if(k(t)){if(t.trim()!=="")return!0}else if(t!==void 0&&t!==null)return!0;if(Qn(e,"aria-label")||en(e,"aria-labelledby"))return!0;if(Et(e)==="img"&&(Qn(e,"alt")||Qn(e,"title")))return!0;if(Et(e)==="slot")return!0;let{children:n}=e;if(Array.isArray(n)){for(let s of n)if(k(s)){if(s.trim()!=="")return!0}else if(D(s)&&ap(s))return!0}else if(n!=null)return!0;if(L(e.map))return!0;return(L(e.cases)?Object.values(e.cases):[]).some((s)=>Ot(s)&&ap(s))}function*Ea(e,t=[],n=[],r=[]){yield{node:e,path:t,roles:n,tags:r};let s=[...n,ao(e)],o=[...r,Et(e)],{children:i}=e;if(Array.isArray(i)){for(let[a,l]of i.entries())if(D(l))yield*Ea(l,[...t,"children",a],s,o)}else if(L(i)&&Ot(i.map))yield*Ea(i.map,[...t,"children","map"],s,o);if(Ot(e.map))yield*Ea(e.map,[...t,"map"],s,o);if(L(e.cases)){for(let[a,l]of Object.entries(e.cases))if(D(l))yield*Ea(l,[...t,"cases",a],s,o)}}function Y9(e){return e.some((t)=>t.includes("-"))}function Kr(e,t,n,r,s,o="error"){return{criterion:s,detail:`${r} ${U9}`,message:n,path:t,rule:e,severity:o}}function WR(e,t,n){if(n.includes("label"))return!0;if(e===Pa||t.bound)return!0;return e!==null&&t.ids.has(e)}function Z9(e,t){let{node:n,path:r,tags:s}=e,o=Et(n),i=ao(n);if(i==="bound")return null;if(Qn(n,"aria-label")||en(n,"aria-labelledby")||Qn(n,"title"))return null;let l=cn(n,"the control"),c=(d)=>Kr("interactive-unnamed",r,`${l} has no accessible name.`,`A control with no name is announced as its role alone, so a reader hears "button" and nothing else. ${d}`,"4.1.2"),u=Q9(n,o,t,s);if(u==="named"||u==="exempt")return null;if(i!==null&&z9.has(i))return ap(n)?null:c("Give it text content, or an aria-label.");if(i!==null&&K9.has(i))return c("Give it an aria-label, or aria-labelledby naming its visible label.");if(i!==null)return null;if(o==="button"||o==="summary"||o==="a"&&en(n,"href"))return ap(n)?null:c("Give it text content, or an aria-label.");if(u==="unnamed")return c("Give it a <label for> naming its id, or an aria-label.");if(u==="unnamed-value")return c("Give it a value, or an aria-label.");if(u==="unnamed-alt")return c("Give it an alt, or an aria-label.");return null}function Q9(e,t,n,r){if(t==="area"){if(!en(e,"href"))return"none";return Qn(e,"alt")?"named":"unnamed-alt"}if(t==="select"||t==="textarea")return WR(ip(e),n,r)||Qn(e,"placeholder")?"named":"unnamed";if(t!=="input")return"none";let s=(ja(e,"type")??"text").toLowerCase();if(s==="hidden"||en(e,"type")&&ja(e,"type")===null)return"exempt";if(G9.has(s))return Qn(e,"value")?"named":"unnamed-value";if(s==="image")return Qn(e,"alt")?"named":"unnamed-alt";return WR(ip(e),n,r)||Qn(e,"placeholder")?"named":"unnamed"}function t4(e){let{node:t,path:n,tags:r}=e,s=Et(t);if(!s.includes("-")||!r.some((o)=>e4.has(o)))return null;return Kr("custom-element-in-select",n,`<${s}> is a custom element inside a <select>.`,'A <select> builds its own rows: an element it does not know is not in select.options, so it cannot be picked, cannot be reached with the arrow keys, and fires no change event — while role="option" on it still makes the accessibility tree read as though it could. Every row of a <select> is a native <option>; a listbox whose rows are jx-option elements is a jx-listbox.',"4.1.2")}function n4(e){let{node:t,path:n}=e;if(Et(t)!=="img")return null;let r=ao(t);if(r==="bound"||r==="presentation"||r==="none")return null;if(en(t,"alt")||Qn(t,"aria-label")||en(t,"aria-labelledby"))return null;return Kr("img-alt-missing",n,`${cn(t,"the image")} has no alt text.`,'An image with no alt is announced by its file name. Describe it in alt, or write alt="" for a decorative one.',"1.1.1")}function s4(e,t){let{node:n,path:r}=e,s=[];for(let o of r4){let i=ja(n,o);if(i===null)continue;for(let a of i.split(/\s+/))if(a!==""&&!t.has(a))s.push(Kr("aria-target-missing",r,`${cn(n,"the element")} points ${o} at #${a}, which nothing in this document has as its id.`,"A reference to an id that is not in the document is silently dropped, so the relationship it declares does not exist. Name an element that is here, or give that element the id.","1.3.1"))}return s}function o4(e,t,n){for(let r of BR.get(t)??[]){let s=n.get(r);if(s===void 0)continue;if(s.bound)return!0;if(e===Pa&&s.ids.size>0)return!0;if(e!==null&&e!==Pa&&s.ids.has(e))return!0}return!1}function i4(e,t){let{node:n,path:r,roles:s,tags:o}=e,i=ao(n);if(i===null||i==="bound"||r.length===0||Y9(o))return null;if(s.includes("bound")||o4(ip(n),i,t))return null;let a=cn(n,"the element");if(i==="tab"&&!s.includes("tablist"))return Kr("tab-outside-tablist",r,`${a} is a tab outside any tablist.`,'A tab is announced with its position in a tablist, so one with no tablist ancestor has no place to be counted in. Put the tabs in a container with role="tablist".',"1.3.1");if((i==="menuitem"||i==="menuitemcheckbox"||i==="menuitemradio")&&!s.includes("menu")&&!s.includes("menubar"))return Kr("menuitem-outside-menu",r,`${a} is a ${i} outside any menu.`,'A menu item is owned by a menu, and is announced as one of its items. Put it in a container with role="menu" or role="menubar".',"1.3.1");if(i==="option"&&!s.includes("listbox")&&!o.includes("select")&&!o.includes("datalist"))return Kr("option-outside-listbox",r,`${a} is an option outside any listbox.`,'An option is owned by a listbox, and is announced as one of its choices. Put it in a container with role="listbox", or in a <select>.',"1.3.1");return null}function a4(e){let t=[];for(let{node:n}of Ea(e)){if(ao(n)!=="tab")continue;let r=_a(n,"aria-selected");if(r.kind==="bound")return null;t.push(r.kind==="other"&&r.isTrue||r.kind==="text"&&r.text==="true")}return t}function l4(e){let{node:t,path:n}=e;if(ao(t)!=="tablist")return null;let r=a4(t);if(r===null||r.length===0||r.includes(!0))return null;return Kr("tablist-none-selected",n,`${cn(t,"the tablist")} has ${r.length} tab(s) and none is selected.`,'A tablist always has a current tab, and aria-selected="true" is how it is announced. Mark the tab whose panel is showing.',"4.1.2","warn")}function c4(e){let{node:t,path:n}=e,r=ao(t);if(!(Et(t)==="dialog"||r==="dialog"||r==="alertdialog")||r==="bound")return null;if(Qn(t,"aria-label")||en(t,"aria-labelledby"))return null;return Kr("dialog-unnamed",n,`${cn(t,"the dialog")} has no accessible name.`,"A dialog is announced by its name when it opens, and its content does not name it. Give it aria-labelledby naming its heading, or an aria-label.","4.1.2")}function f4(e){let{node:t,path:n}=e;if(!en(t,"aria-activedescendant"))return null;let r=Et(t);if(u4.has(r)||r==="a"&&en(t,"href")||en(t,"tabIndex")||en(t,"tabindex")||en(t,"contenteditable"))return null;return Kr("activedescendant-not-focusable",n,`${cn(t,"the element")} manages focus with aria-activedescendant but cannot itself take focus.`,"aria-activedescendant names the active child of a FOCUSED container; on one that cannot be focused, the keyboard never reaches it. Give the container a tabindex.","2.1.1")}function UR(e){let t=[...Ea(e)],n=new Set,r={bound:!1,ids:new Set},s=new Map,o=!1;for(let{node:a}of t){let l=ao(a);if(l!==null&&X9.has(l)){let u=s.get(l)??{bound:!1,ids:new Set},d=ja(a,"aria-owns");if(d===null)u.bound||=en(a,"aria-owns");else for(let p of d.split(/\s+/))if(p!=="")u.ids.add(p);s.set(l,u)}let c=ip(a);if(c===Pa)o=!0;else if(c!==null)n.add(c);if(Et(a)==="label"){let u=ja(a,"for")??ja(a,"htmlFor");if(u===null)r.bound||=en(a,"for")||en(a,"htmlFor");else r.ids.add(u)}}let i=[];for(let a of t){let l=[Z9(a,r),n4(a),i4(a,s),t4(a),l4(a),c4(a),f4(a)];for(let c of l)if(c)i.push(c);if(!o)i.push(...s4(a,n))}return i}var U9="See docs/framework/concepts/accessibility.",Pa="bound",z9,K9,G9,BR,X9,e4,r4,u4;var zR=J(()=>{ce();op();z9=new Set(["button","checkbox","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","switch","tab","treeitem"]),K9=new Set(["combobox","listbox","searchbox","slider","spinbutton","textbox"]),G9=new Set(["button","reset","submit"]),BR=new Map([["menuitem",["menu","menubar"]],["menuitemcheckbox",["menu","menubar"]],["menuitemradio",["menu","menubar"]],["option",["listbox"]],["tab",["tablist"]]]),X9=new Set([...BR.values()].flat());e4=new Set(["select","jx-select"]);r4=["aria-activedescendant","aria-controls","aria-describedby","aria-details","aria-errormessage","aria-flowto","aria-labelledby","aria-owns"];u4=new Set(["button","input","select","textarea"])});function $b(e){return Et(e)==="dialog"}function KR(e){return e.startsWith("--")}function x4(e){let t=[];for(let{node:n}of Ur(e)){let r=io(n);if($b(n)&&r!==null&&!t.includes(r))t.push(r)}return t}function b4(e){let t=e.oncommand;return t!==void 0&&t!==null}function $4(e,t){for(let{node:n}of Ur(e)){if(n===e)continue;let r=Et(n);if(r==="button"){let s=Qt(n,"command"),o=Qt(n,"commandfor");if(s!==null&&(s==="close"||s==="request-close")&&(o===null||o===t))return!0}if(r==="form"&&Qt(n,"method")?.toLowerCase()==="dialog")return!0}return!1}function XR(e,t){let n=[...Ur(e,[],null,t)],r=x4(e),s=bb(e,t),o=r.length>0||s.length>0,i=new Map,a=new Map;for(let{node:c}of n){let u=io(c);if(u!==null&&!i.has(u))i.set(u,c);if(Et(c)==="button"){let d=Qt(c,"commandfor"),p=Qt(c,"command");if(d!==null){let m=a.get(d)??new Set;m.add(p??""),a.set(d,m)}}}let l=[];for(let{node:c,path:u}of n)if(l.push(...S4(c,u,i,r,s,o,t)),$b(c))l.push(...w4(c,u,a));return l}function S4(e,t,n,r,s,o,i){let a=[],l=Et(e),c=i?.invokerTags?.has(l)??!1,u=Qt(e,"command"),d=Qt(e,"commandfor");if(!(u!==null||d!==null||("command"in zr(e))||("commandfor"in zr(e))))return a;let m=cn(e,"the element");if(!y4.has(l)&&!c)return a.push({detail:"`command` and `commandfor` are attributes of `HTMLButtonElement` and of no other "+"interface — not even `<input>`, which `popovertarget` does allow. Elsewhere they parse "+`and do nothing. Make it a <button>, or remove both attributes. ${st}`,fix:"invoker",message:`<${l||"element"}> carries command/commandfor, which only <button> supports.`,path:t,rule:"invoker-not-button",severity:"error"}),a;if(u!==null&&!h4.has(u)&&!KR(u))return a.push({detail:`\`command\` is an enumerated attribute taking ${GR.map((y)=>`\`${y}\``).join(", ")}, or a custom command starting with \`--\`. Anything else is the invalid-value state, and a button in that state does nothing when clicked. ${st}`,message:`${m} declares command="${u}", which is not a built-in or --custom command.`,path:t,rule:"command-invalid",severity:"error"}),a;if(d!==null){let y=n.get(d),S=r.includes(d),g=s.includes(d);if(!y&&o){let x=[...r,...s].map((P)=>`"${P}"`).join(", ");return a.push({detail:`No element in this document has the id "${d}". The dialogs and popovers here are: ${x}. A commandfor that names nothing does nothing, silently. ${st}`,message:`commandfor="${d}" names nothing in this document.`,path:t,rule:"command-target-missing",severity:"error"}),a}if(u!==null&&y){if(d4.has(u)&&!$b(y))a.push({detail:`\`${u}\` acts on a <dialog>, and "${d}" is ${g?"a popover":`a <${Et(y)||"element"}>`}. The click is ignored. ${g?"Use `toggle-popover`, `show-popover` or `hide-popover` for a popover.":"Point it at a dialog, or make the target one."} ${st}`,message:`${m} sends ${u} to "${d}", which is not a dialog.`,path:t,rule:"command-target-mismatch",severity:"error"});else if(p4.has(u)&&!hc(y,i))a.push({detail:`\`${u}\` acts on a popover, and "${d}" is ${S?"a dialog":`a <${Et(y)||"element"}>`} that declares no \`popover\`. The click is ignored. ${S?"Use `show-modal`, `close` or `request-close` for a dialog.":"Give the target a `popover` attribute, or point the button elsewhere."} ${st}`,message:`${m} sends ${u} to "${d}", which is not a popover.`,path:t,rule:"command-target-mismatch",severity:"error"});else if(KR(u)&&!b4(y))a.push({detail:`A custom command is a \`CommandEvent\` dispatched at its target, and "${d}" has no `+"`oncommand` handler to answer it — so the click does nothing. Add one that switches on "+`\`event#/command\`, or use a built-in command. ${st}`,message:`${m} sends ${u} to "${d}", which handles no command.`,path:t,rule:"custom-command-unhandled",severity:"warn"})}}return a}function w4(e,t,n){let r=[],s=cn(e,"the dialog"),o=io(e),{style:i}=e,a=Qt(e,"closedby");if(a!==null&&!g4.has(a))r.push({detail:`\`closedby\` is an enumerated attribute taking \`any\` (light dismiss and Escape), \`closerequest\` (Escape only, the default for a modal) or \`none\`. Anything else is the invalid-value default, \`auto\`, which is the same as leaving it out. ${st}`,message:`${s} declares closedby="${a}", which is not any, closerequest or none.`,path:t,rule:"dialog-closedby-invalid",severity:"error"});if(ln(i,"display")!==null)r.push({detail:`A closed dialog is hidden by the browser's own \`dialog:not([open]) { display: none }\`. That rule is UA-origin, so any author \`display\` beats it, and the dialog is laid out on every page whether or not anyone opened it. \`display\` belongs in the \`&[open]\` rule and nowhere else. ${st}`,fix:"display",message:`${s} sets display in its base rule.`,path:t,rule:"dialog-display",severity:"error"});let l=o===null?void 0:n.get(o),c=Qt(e,"open")!==null||zr(e).open===!0||e.open===!0;if(o!==null&&!l?.has("show-modal")&&!c)r.push({detail:`No <button> in this document opens it with \`command="show-modal"\`. If it is opened from another file or from a function that calls \`showModal()\`, this is fine; otherwise there is no way for a reader to open it. ${st}`,message:`${s} has no invoker in this document.`,path:t,rule:"dialog-no-invoker",severity:"warn"});if(l?.has("show-modal")&&a==="none"&&!$4(e,o))r.push({detail:`A modal dialog makes everything outside it inert, so the only ways out are the ones it offers: \`closedby="none"\` turns off Escape and light dismiss, and nothing inside it closes it. A reader who opens it cannot leave. Add a <button command="close"> inside, or drop \`closedby="none"\`. ${st}`,message:`${s} opens modally, closes on nothing, and has no close button.`,path:t,rule:"modal-without-close",severity:"error"});return r}var GR,d4,p4,m4,h4,g4,y4;var YR=J(()=>{ce();op();GR=["toggle-popover","show-popover","hide-popover","show-modal","close","request-close"],d4=new Set(["show-modal","close","request-close"]),p4=new Set(["toggle-popover","show-popover","hide-popover"]),m4=["any","closerequest","none"],h4=new Set(GR),g4=new Set(m4),y4=new Set(["button"])});var aN=W(function(oN){Object.defineProperty(oN,"__esModule",{value:!0});oN.formatNames=oN.fastFormats=oN.fullFormats=void 0;function Gr(e,t){return{validate:e,compare:t}}oN.fullFormats={date:Gr(tN,Eb),time:Gr(wb(!0),jb),"date-time":Gr(ZR(!0),rN),"iso-time":Gr(wb(),nN),"iso-date-time":Gr(ZR(),sN),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:k4,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:J4,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:O4,int32:{type:"number",validate:R4},int64:{type:"number",validate:N4},float:{type:"number",validate:eN},double:{type:"number",validate:eN},password:!0,binary:!0};oN.fastFormats={...oN.fullFormats,date:Gr(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Eb),time:Gr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,jb),"date-time":Gr(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,rN),"iso-time":Gr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,nN),"iso-date-time":Gr(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,sN),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};oN.formatNames=Object.keys(oN.fullFormats);function v4(e){return e%4===0&&(e%100!==0||e%400===0)}var E4=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,j4=[0,31,28,31,30,31,30,31,31,30,31,30,31];function tN(e){let t=E4.exec(e);if(!t)return!1;let n=+t[1],r=+t[2],s=+t[3];return r>=1&&r<=12&&s>=1&&s<=(r===2&&v4(n)?29:j4[r])}function Eb(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var Sb=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function wb(e){return function(n){let r=Sb.exec(n);if(!r)return!1;let s=+r[1],o=+r[2],i=+r[3],a=r[4],l=r[5]==="-"?-1:1,c=+(r[6]||0),u=+(r[7]||0);if(c>23||u>59||e&&!a)return!1;if(s<=23&&o<=59&&i<60)return!0;let d=o-u*l,p=s-c*l-(d<0?1:0);return(p===23||p===-1)&&(d===59||d===-1)&&i<61}}function jb(e,t){if(!(e&&t))return;let n=new Date("2020-01-01T"+e).valueOf(),r=new Date("2020-01-01T"+t).valueOf();if(!(n&&r))return;return n-r}function nN(e,t){if(!(e&&t))return;let n=Sb.exec(e),r=Sb.exec(t);if(!(n&&r))return;if(e=n[1]+n[2]+n[3],t=r[1]+r[2]+r[3],e>t)return 1;if(e<t)return-1;return 0}var vb=/t|\s/i;function ZR(e){let t=wb(e);return function(r){let s=r.split(vb);return s.length===2&&tN(s[0])&&t(s[1])}}function rN(e,t){if(!(e&&t))return;let n=new Date(e).valueOf(),r=new Date(t).valueOf();if(!(n&&r))return;return n-r}function sN(e,t){if(!(e&&t))return;let[n,r]=e.split(vb),[s,o]=t.split(vb),i=Eb(n,s);if(i===void 0)return;return i||jb(r,o)}var P4=/\/|:/,_4=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function k4(e){return P4.test(e)&&_4.test(e)}var QR=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function O4(e){return QR.lastIndex=0,QR.test(e)}var A4=-2147483648,C4=2147483647;function R4(e){return Number.isInteger(e)&&e<=C4&&e>=A4}function N4(e){return Number.isInteger(e)}function eN(){return!0}var T4=/[^\\]\\Z/;function J4(e){if(T4.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var cN=W(function(lN){Object.defineProperty(lN,"__esModule",{value:!0});var I4=rb(),D4=sb(),L4=lb(),F4=fb(),lp=db(),V4=[I4.default,D4.default,(0,L4.default)(),F4.default,lp.metadataVocabulary,lp.contentVocabulary];lN.default=V4});var uN=W(function(Eoe,H4){H4.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var dN=W(function(jn,_b){Object.defineProperty(jn,"__esModule",{value:!0});jn.MissingRefError=jn.ValidationError=jn.CodeGen=jn.Name=jn.nil=jn.stringify=jn.str=jn._=jn.KeywordCxt=jn.Ajv=void 0;var W4=nb(),B4=cN(),U4=pb(),fN=uN(),z4=["/properties"],cp="http://json-schema.org/draft-07/schema";class gc extends W4.default{_addVocabularies(){if(super._addVocabularies(),B4.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(U4.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(fN,z4):fN;this.addMetaSchema(e,cp,!1),this.refs["http://json-schema.org/schema"]=cp}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(cp)?cp:void 0)}}jn.Ajv=gc;_b.exports=jn=gc;_b.exports.Ajv=gc;Object.defineProperty(jn,"__esModule",{value:!0});jn.default=gc;var K4=ua();Object.defineProperty(jn,"KeywordCxt",{enumerable:!0,get:function(){return K4.KeywordCxt}});var ka=$e();Object.defineProperty(jn,"_",{enumerable:!0,get:function(){return ka._}});Object.defineProperty(jn,"str",{enumerable:!0,get:function(){return ka.str}});Object.defineProperty(jn,"stringify",{enumerable:!0,get:function(){return ka.stringify}});Object.defineProperty(jn,"nil",{enumerable:!0,get:function(){return ka.nil}});Object.defineProperty(jn,"Name",{enumerable:!0,get:function(){return ka.Name}});Object.defineProperty(jn,"CodeGen",{enumerable:!0,get:function(){return ka.CodeGen}});var G4=cc();Object.defineProperty(jn,"ValidationError",{enumerable:!0,get:function(){return G4.default}});var X4=da();Object.defineProperty(jn,"MissingRefError",{enumerable:!0,get:function(){return X4.default}})});var hN=W(function(mN){Object.defineProperty(mN,"__esModule",{value:!0});mN.formatLimitDefinition=void 0;var pN=dN(),xt=$e(),lo=xt.operators,up={formatMaximum:{okStr:"<=",ok:lo.LTE,fail:lo.GT},formatMinimum:{okStr:">=",ok:lo.GTE,fail:lo.LT},formatExclusiveMaximum:{okStr:"<",ok:lo.LT,fail:lo.GTE},formatExclusiveMinimum:{okStr:">",ok:lo.GT,fail:lo.LTE}},Q4={message:({keyword:e,schemaCode:t})=>xt.str`should be ${up[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>xt._`{comparison: ${up[e].okStr}, limit: ${t}}`};mN.formatLimitDefinition={keyword:Object.keys(up),type:"string",schemaType:"string",$data:!0,error:Q4,code(e){let{gen:t,data:n,schemaCode:r,keyword:s,it:o}=e,{opts:i,self:a}=o;if(!i.validateFormats)return;let l=new pN.KeywordCxt(o,a.RULES.all.format.definition,"format");if(l.$data)c();else u();function c(){let p=t.scopeValue("formats",{ref:a.formats,code:i.code.formats}),m=t.const("fmt",xt._`${p}[${l.schemaCode}]`);e.fail$data(xt.or(xt._`typeof ${m} != "object"`,xt._`${m} instanceof RegExp`,xt._`typeof ${m}.compare != "function"`,d(m)))}function u(){let p=l.schema,m=a.formats[p];if(!m||m===!0)return;if(typeof m!="object"||m instanceof RegExp||typeof m.compare!="function")throw Error(`"${s}": format "${p}" does not define "compare" function`);let y=t.scopeValue("formats",{key:p,ref:m,code:i.code.formats?xt._`${i.code.formats}${xt.getProperty(p)}`:void 0});e.fail$data(d(y))}function d(p){return xt._`${p}.compare(${n}, ${r}) ${up[s].fail} 0`}},dependencies:["format"]};var e3=(e)=>(e.addKeyword(mN.formatLimitDefinition),e);mN.default=e3});var bN=W(function(yc,xN){Object.defineProperty(yc,"__esModule",{value:!0});var er=aN(),n3=hN(),Oa=$e(),gN=new Oa.Name("fullFormats"),r3=new Oa.Name("fastFormats"),Ob=(e,t={keywords:!0})=>{if(Array.isArray(t))return yN(e,t,er.fullFormats,gN),e;let[n,r]=t.mode==="fast"?[er.fastFormats,r3]:[er.fullFormats,gN],s=t.formats||er.formatNames;if(yN(e,s,n,r),t.keywords)(0,n3.default)(e);return e};Ob.get=(e,t="full")=>{let r=(t==="fast"?er.fastFormats:er.fullFormats)[e];if(!r)throw Error(`Unknown format "${e}"`);return r};function yN(e,t,n,r){var s,o;(s=(o=e.opts.code).formats)!==null&&s!==void 0||(o.formats=Oa._`require("ajv-formats/dist/formats").${r}`);for(let i of t)e.addFormat(i,n[i])}xN.exports=yc=Ob;Object.defineProperty(yc,"__esModule",{value:!0});yc.default=Ob});import{existsSync as wN,readFileSync as Cb,readdirSync as vN,statSync as EN}from"node:fs";import{createRequire as s3}from"node:module";import{join as jN,relative as Aa,resolve as Ab}from"node:path";async function l3(){try{let{default:e}=await Promise.resolve().then(() => Sr(gb(),1)),{default:t}=await Promise.resolve().then(() => Sr(bN(),1));return{addFormats:t,Ajv:e}}catch(e){throw Error("Project validation requires ajv and ajv-formats: bun add ajv ajv-formats",{cause:e})}}async function PN(e,t={}){let n=Ab(e),r=[],s=[],o=0;for(let w of["project.schema.json","document.schema.json"]){let E=Ab(n,w);if(!wN(E))continue;o+=1;let j=xc(E),A=d3(j);if(A.length>0)r.push({errors:A.map(({reason:T,ref:I})=>({message:`$ref "${I}" ${T} — committed entry documents must be self-contained `+"single-resource schemas; regenerate with `jx schema`"})),file:w})}if(r.length>0)return{checked:o,issues:r,lint:s,valid:!1};let i=await JR(n);if(o+=1,!i.valid)r.push({errors:i.errors??[],file:i.file});let{addFormats:a,Ajv:l}=await l3(),{document:c}=await MP(n,{write:!1}),u=new l({allErrors:!0,ownProperties:!0,strict:!1});a(u);let d=u.compile(c),p=DR(SN(n).flatMap((w)=>{try{return[JSON.parse(Cb(w,"utf8"))]}catch{return[]}}));for(let w of o3)for(let E of ON(Ab(n,w))){if(E.endsWith(".class.json"))continue;o+=1;let j=c3(E,Aa(n,E));if(s.push(...j.warnings),j.failure!==null){r.push(j.failure);continue}let A=j.document,T=$N(A,Aa(n,E));if(s.push(...T.warnings),T.failure!==null){r.push(T.failure);continue}if(d(A))s.push(...f3(A,Aa(n,E),p));else r.push({errors:d.errors??[],file:Aa(n,E)})}let m=new l({allErrors:!0,ownProperties:!0,strict:!1});a(m);let y=m.compile(yx());for(let w of SN(n)){o+=1;let E=xc(w),j=$N(E,Aa(n,w));if(s.push(...j.warnings),j.failure!==null)r.push(j.failure);else if(!y(E))r.push({errors:y.errors??[],file:Aa(n,w)})}let{config:S}=As(n),g=await Os(n,S),x=s3(import.meta.url);for(let w of g.extensions)for(let E of["project","document","fields"]){let j=w.schemas[E];if(!j)continue;o+=1;let A=new l({allErrors:!0,ownProperties:!0,strict:!1});a(A);for(let T of a3){let I=x.resolve(T);A.addSchema(xc(I))}try{A.compile(xc(j))}catch(T){r.push({errors:[{message:T instanceof Error?T.message:String(T)}],file:`${w.specifier} (${E} fragment)`})}}let P=t.strict===!0&&s.some((w)=>w.severity==="error");return{checked:o,issues:r,lint:s,valid:r.length===0&&!P}}function c3(e,t){if(!rs(e))return{document:xc(e),failure:null,warnings:[]};let n=Cb(e,"utf8"),r=Bp(n).map((s)=>({detail:s.message,file:t,message:`line ${s.line}, column ${s.column}: ${s.message}`,path:[],rule:"escape",severity:"warn",source:"notation"}));try{return{document:u3(n),failure:null,warnings:r}}catch(s){return{document:null,failure:{errors:[{message:be(s)}],file:t},warnings:r}}}function $N(e,t){let n=[];try{il(e,t,n)}catch(s){return{failure:{errors:[{message:be(s)}],file:t},warnings:[]}}return{failure:null,warnings:n.map(({pointer:s,problem:o})=>({detail:o.message,file:t,message:`${s} (line ${o.line}, column ${o.column}): ${o.message}`,path:s.split("/").slice(1),rule:"typescript-reading",severity:"warn",source:"function-body"}))}}function u3(e){let t=vo(e);return L(t)?t:null}function xc(e){return JSON.parse(Cb(e,"utf8"))}function f3(e,t,n){let r=[];for(let s of HR(e,n))r.push({...fp(s),file:t,source:"popover"});for(let s of XR(e,n))r.push({...fp(s),file:t,source:"dialog"});for(let s of UR(e))r.push({...fp(s),criterion:s.criterion,file:t,source:"accessibility"});for(let s of wv(e))r.push({...fp({...s,severity:"info"}),file:t,source:"module"});return r}function fp(e){return{detail:e.detail,message:e.message,path:e.path,rule:e.rule,severity:e.severity}}function _N(e){return e.lint.map((t)=>{let n=t.criterion===void 0?`${t.source}/${t.rule}`:`${t.source}/${t.rule}, WCAG ${t.criterion}`;return`${t.file}: ${t.severity}: ${t.message} [${n}]`})}function d3(e){let t=[],n=new Set,r=(o)=>{let i=e;for(let a of o.slice(1).split("/")){if(a==="")continue;let l=a.replaceAll("~1","/").replaceAll("~0","~");if(!D(i))return!1;if(i=i[l],i===void 0)return!1}return!0},s=(o)=>{if(!L(o)||n.has(o))return;n.add(o);let i=o.$ref;if(k(i)){if(/^[a-zA-Z][a-zA-Z\d+.-]*:/.test(i))t.push({reason:"is an absolute URI editors resolve over the network",ref:i});else if(!i.startsWith("#"))t.push({reason:"is a relative path only Node module resolution can follow",ref:i});else if(i.length>1&&!i.startsWith("#/"))t.push({reason:"is an $anchor reference, which has no root-pointer form",ref:i});else if(i.length>1&&!r(i.slice(1)))t.push({reason:"points at no node in this document",ref:i})}for(let[a,l]of Object.entries(o)){if(!p3.has(a))continue;if(Array.isArray(l))for(let c of l)s(c);else if(L(l)){if(s(l),kN.has(a))for(let c of Object.values(l))s(c)}}};return s(e),t}function ON(e){if(!wN(e))return[];let t=[];for(let n of vN(e)){let r=jN(e,n);if(EN(r).isDirectory())t.push(...ON(r));else if(Vn(n))t.push(r)}return t.toSorted()}function SN(e){let t=[],n=(r)=>{for(let s of vN(r)){if(i3.has(s))continue;let o=jN(r,s);if(EN(o).isDirectory())n(o);else if(s.endsWith(".class.json"))t.push(o)}};return n(e),t.toSorted()}function AN(e){let t=[];for(let n of e.issues){t.push(`${n.file}:`);for(let r of n.errors){let s=L(r)?r:{},{instancePath:o,message:i}=s;t.push(` - ${o||"/"}: ${i??JSON.stringify(r)}`)}}return t}var o3,i3,a3,kN,p3;var CN=J(()=>{os();Lt();Ru();o_();MR();zR();YR();Ti();op();ce();is();bi();hx();o3=["components","pages","layouts"],i3=new Set(["node_modules","dist",".git"]),a3=["@jxsuite/schema/schemas/project.core.schema.json","@jxsuite/schema/schemas/project.fields.schema.json","@jxsuite/schema/schemas/document.paths.schema.json"];kN=new Set(["$defs","definitions","dependencies","dependentSchemas","patternProperties","properties"]),p3=new Set([...kN,"additionalItems","additionalProperties","allOf","anyOf","contains","contentSchema","else","if","items","not","oneOf","prefixItems","propertyNames","then","unevaluatedItems","unevaluatedProperties"])});Lt();import{relative as Rb,resolve as RN}from"node:path";async function m3(){let e=process.argv.slice(2),[t]=e;if(!t||t==="--help"||t==="-h")console.log(`Usage: jx <command> [options]
|
|
625
638
|
|
|
626
639
|
Commands:
|
|
627
640
|
build [root] Build a Jx site to dist/
|
|
@@ -637,14 +650,16 @@ Options:
|
|
|
637
650
|
--verbose Print detailed build progress
|
|
638
651
|
--no-clean Don't clean outDir before building
|
|
639
652
|
--include-held Keep entries a content type's hold rules match, for a preview
|
|
653
|
+
--no-optimize-images Publish images as they are, whatever images.optimize says (also
|
|
654
|
+
JX_IMAGES_OPTIMIZE=false in the environment)
|
|
640
655
|
--port <n> dev/preview: port to listen on (default 3000 / 4173)
|
|
641
656
|
--dry-run db push: print the statements without executing them
|
|
642
657
|
--connection db push: restrict to one connection name
|
|
643
658
|
--strict validate: fail on an overlay or accessibility lint error, not only a schema error
|
|
644
659
|
--to <format> convert: jxn or json
|
|
645
660
|
--drop-comments convert: convert a .jxn file to .json even though it has comments
|
|
646
|
-
--check format: write nothing, and fail when a file would change`),process.exit(0);if(t==="convert"||t==="format"){try{if(t==="convert"){await Promise.resolve().then(() =>
|
|
647
|
-
Usage: jx db push [root] [--dry-run] [--connection <name>]`),process.exit(1);let d=o.has("--dry-run");try{await Promise.resolve().then(() =>
|
|
648
|
-
Build completed with ${
|
|
649
|
-
Done: ${
|
|
650
|
-
Run "jx --help" for usage.`),process.exit(1)}var
|
|
661
|
+
--check format: write nothing, and fail when a file would change`),process.exit(0);if(t==="convert"||t==="format"){try{if(t==="convert"){await Promise.resolve().then(() => n$());t$(process.cwd(),e.slice(1))}else{await Promise.resolve().then(() => s$());r$(process.cwd(),e.slice(1))}}catch(d){console.error(be(d)),process.exit(1)}return}let n=t==="db",r=n?e[1]:null,s=e.slice(n?2:1),o=new Set,i=[],a,l;for(let d=0;d<s.length;d+=1){let p=s[d];if(p==="--connection")d+=1,a=s[d];else if(p==="--port"){d+=1;let m=Math.trunc(Number(s[d]??""));if(Number.isFinite(m)&&m>=0)l=m}else if(p.startsWith("--"))o.add(p);else i.push(p)}let[c]=i,u=RN(c??".");if(n){if(r!=="push")console.error(`Unknown db subcommand: ${r??"(none)"}
|
|
662
|
+
Usage: jx db push [root] [--dry-run] [--connection <name>]`),process.exit(1);let d=o.has("--dry-run");try{await Promise.resolve().then(() => MS());let m={dryRun:d};if(a!==void 0)m.connection=a;let{results:y,bindingsPatched:S,wranglerPath:g}=await JS(u,m);for(let x of y){let P=x.applied?"applied":"dry-run";console.log(`${x.connection} (${x.provider}) — ${x.tables.length} table(s), ${x.statements.length} statement(s) [${P}]`);for(let w of x.statements)console.log(` ${w}`);for(let w of x.warnings)console.warn(` warning: ${w}`)}if(S&&g)console.log(`Updated bindings in ${Rb(u,g)}`)}catch(p){console.error(`db push failed: ${be(p)}`),process.exit(1)}return}if(t==="build"){let d=o.has("--verbose"),p=!o.has("--no-clean"),m=o.has("--include-held");console.log(`Building site from ${u}...`);try{await Promise.resolve().then(() => xP());await Promise.resolve().then(() => bi());let g=!o.has("--no-optimize-images")&&!RS(process.env.JX_IMAGES_OPTIMIZE),x=await fP(u,{clean:p,includeHeld:m,optimizeImages:g,verbose:d});if(x.errors.length>0){console.error(`
|
|
663
|
+
Build completed with ${x.errors.length} error(s):`);for(let P of x.errors)console.error(` - ${P}`);process.exit(1)}console.log(`
|
|
664
|
+
Done: ${x.routes} routes → ${x.files} files`)}catch(y){console.error(`Build failed: ${be(y)}`),process.exit(1)}}else if(t==="dev")try{await Promise.resolve().then(() => $P());bP(u,l)}catch(d){console.error(be(d)),process.exit(1)}else if(t==="preview"){let{existsSync:d}=await import("node:fs"),p=RN(u,"dist");if(!d(p))console.error(`No build output at ${p} — run \`jx build\` first.`),process.exit(1);await Promise.resolve().then(() => EP());let y=l??4173;vP(p,y),console.log(`Previewing ${p} at http://localhost:${y}`)}else if(t==="schema")try{await Promise.resolve().then(() => hx());let{projectSchemaPath:p,documentSchemaPath:m}=await JP(u);console.log(`Wrote ${Rb(u,p)}`),console.log(`Wrote ${Rb(u,m)}`)}catch(d){console.error(`Schema generation failed: ${be(d)}`),process.exit(1)}else if(t==="validate")try{await Promise.resolve().then(() => CN());let y=await PN(u,{strict:o.has("--strict")}),S=_N(y);if(y.valid){console.log(`Project is valid (${y.checked} files checked in ${u})`);for(let g of S)console.log(g)}else{console.error(`Project is INVALID (${u}):`);for(let g of[...AN(y),...S])console.error(g);process.exit(1)}}catch(d){console.error(`Validation failed: ${be(d)}`),process.exit(1)}else console.error(`Unknown command: ${t}
|
|
665
|
+
Run "jx --help" for usage.`),process.exit(1)}var Qoe=m3();export{Qoe as ready};
|